From 30ea0888b141c4085d7e30eab4beecd6c8fd9a62 Mon Sep 17 00:00:00 2001 From: nicholaspai Date: Fri, 18 Mar 2022 09:22:42 -0400 Subject: [PATCH 01/11] improve: Update solc version to 8.13 --- hardhat.config.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/hardhat.config.ts b/hardhat.config.ts index 168b7ea41..3361eadd7 100644 --- a/hardhat.config.ts +++ b/hardhat.config.ts @@ -12,7 +12,7 @@ import "hardhat-deploy"; dotenv.config(); -const solcVersion = "0.8.11"; +const solcVersion = "0.8.13"; const mnemonic = getMnemonic(); // Compilation settings are overridden for large contracts to allow them to compile without going over the bytecode From a4d29bd66806bd9efdd3b3493bdc6f8e7442f662 Mon Sep 17 00:00:00 2001 From: nicholaspai Date: Fri, 18 Mar 2022 11:43:01 -0400 Subject: [PATCH 02/11] feat: Changes after running 8.13 wargames --- deploy/consts.ts | 16 +- deployments/kovan/Arbitrum_Adapter.json | 285 ++++++++++++ deployments/kovan/Ethereum_Adapter.json | 39 +- deployments/kovan/Ethereum_SpokePool.json | 197 +++++---- deployments/kovan/HubPool.json | 417 +++++++++++------- deployments/kovan/LpTokenFactory.json | 26 +- deployments/kovan/Optimism_Adapter.json | 52 +-- deployments/kovan/PolygonTokenBridger.json | 182 ++++++++ deployments/kovan/Polygon_Adapter.json | 235 ++++++++++ ... => 2fe6c4b637a440a1380be3adbf7d9e12.json} | 18 +- ... => c8b9349311d8b5049b613ac98eb998d0.json} | 106 +++-- .../optimism-kovan/Optimism_SpokePool.json | 201 +++++---- ... => c8b9349311d8b5049b613ac98eb998d0.json} | 106 +++-- scripts/setupOptimismSpokePool.ts | 10 +- 14 files changed, 1329 insertions(+), 561 deletions(-) create mode 100644 deployments/kovan/Arbitrum_Adapter.json create mode 100644 deployments/kovan/PolygonTokenBridger.json create mode 100644 deployments/kovan/Polygon_Adapter.json rename deployments/kovan/solcInputs/{abccea57e702a2494fadb0e94bc8fd72.json => 2fe6c4b637a440a1380be3adbf7d9e12.json} (61%) rename deployments/kovan/solcInputs/{d3cc7d49c45bf725b6aea61557b961e9.json => c8b9349311d8b5049b613ac98eb998d0.json} (64%) rename deployments/optimism-kovan/solcInputs/{d3cc7d49c45bf725b6aea61557b961e9.json => c8b9349311d8b5049b613ac98eb998d0.json} (64%) diff --git a/deploy/consts.ts b/deploy/consts.ts index bd0fd41a3..db44e012d 100644 --- a/deploy/consts.ts +++ b/deploy/consts.ts @@ -15,22 +15,30 @@ export const L1_ADDRESS_MAP: { [key: number]: { [contractName: string]: string } finder: "0xbb6206fb01fAad31e8aaFc3AD303cEA89D8c8157", l1ArbitrumInbox: "0x578BAde599406A8fE3d24Fd7f7211c0911F5B29e", l1ERC20Gateway: "0x91169Dbb45e6804743F94609De50D511C437572E", + optimismCrossDomainMessenger: "0x25ace71c97B33Cc4729CF772ae268934F7ab5fA1", // dummy: Optimism's testnet is kovan + optimismStandardBridge: "0x99C9fc46f92E8a1c0deC1b1747d010903E884bE1", // dummy: Optimism's testnet is kovan + polygonRootChainManager: "0xBbD7cBFA79faee899Eaf900F13C9065bF03B1A74", // dummy: Polygon's testnet is goerli + polygonFxRoot: "0x3d1d3E34f7fB6D26245E6640E1c50710eFFf15bA", // dummy: Polygon's testnet is goerli }, 5: { - optimismCrossDomainMessenger: "0x25ace71c97B33Cc4729CF772ae268934F7ab5fA1", // dummy - optimismStandardBridge: "0x99C9fc46f92E8a1c0deC1b1747d010903E884bE1", // dummy - l1ArbitrumInbox: "0x578BAde599406A8fE3d24Fd7f7211c0911F5B29e", // dummy - l1ERC20Gateway: "0x91169Dbb45e6804743F94609De50D511C437572E", // dummy + optimismCrossDomainMessenger: "0x25ace71c97B33Cc4729CF772ae268934F7ab5fA1", // dummy: Optimism's testnet is kovan + optimismStandardBridge: "0x99C9fc46f92E8a1c0deC1b1747d010903E884bE1", // dummy: Optimism's testnet is kovan + l1ArbitrumInbox: "0x578BAde599406A8fE3d24Fd7f7211c0911F5B29e", // dummy: Arbitrum's testnet is rinkeby + l1ERC20Gateway: "0x91169Dbb45e6804743F94609De50D511C437572E", // dummy: Arbitrum's testnet is rinkeby finder: "0xDC6b80D38004F495861E081e249213836a2F3217", polygonRootChainManager: "0xBbD7cBFA79faee899Eaf900F13C9065bF03B1A74", polygonFxRoot: "0x3d1d3E34f7fB6D26245E6640E1c50710eFFf15bA", weth: "0x60D4dB9b534EF9260a88b0BED6c486fe13E604Fc", }, 42: { + l1ArbitrumInbox: "0x578BAde599406A8fE3d24Fd7f7211c0911F5B29e", // dummy: Arbitrum's testnet is rinkeby + l1ERC20Gateway: "0x91169Dbb45e6804743F94609De50D511C437572E", // dummy: Arbitrum's testnet is rinkeby optimismCrossDomainMessenger: "0x4361d0F75A0186C05f971c566dC6bEa5957483fD", weth: "0xd0A1E359811322d97991E03f863a0C30C2cF029C", optimismStandardBridge: "0x22F24361D548e5FaAfb36d1437839f080363982B", finder: "0xeD0169a88d267063184b0853BaAAAe66c3c154B2", + polygonRootChainManager: "0xBbD7cBFA79faee899Eaf900F13C9065bF03B1A74", // dummy: Polygon's testnet is goerli + polygonFxRoot: "0x3d1d3E34f7fB6D26245E6640E1c50710eFFf15bA", // dummy: Polygon's testnet is goerli }, }; diff --git a/deployments/kovan/Arbitrum_Adapter.json b/deployments/kovan/Arbitrum_Adapter.json new file mode 100644 index 000000000..96067fe2b --- /dev/null +++ b/deployments/kovan/Arbitrum_Adapter.json @@ -0,0 +1,285 @@ +{ + "address": "0xD007aB76E36B03853C1F2fE5980069E7ACd38FF8", + "abi": [ + { + "inputs": [ + { + "internalType": "contract ArbitrumL1InboxLike", + "name": "_l1ArbitrumInbox", + "type": "address" + }, + { + "internalType": "contract ArbitrumL1ERC20GatewayLike", + "name": "_l1ERC20Gateway", + "type": "address" + } + ], + "stateMutability": "nonpayable", + "type": "constructor" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "address", + "name": "target", + "type": "address" + }, + { + "indexed": false, + "internalType": "bytes", + "name": "message", + "type": "bytes" + } + ], + "name": "MessageRelayed", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "address", + "name": "l1Token", + "type": "address" + }, + { + "indexed": false, + "internalType": "address", + "name": "l2Token", + "type": "address" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "amount", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "address", + "name": "to", + "type": "address" + } + ], + "name": "TokensRelayed", + "type": "event" + }, + { + "inputs": [], + "name": "getL1CallValue", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "pure", + "type": "function" + }, + { + "inputs": [], + "name": "l1ERC20Gateway", + "outputs": [ + { + "internalType": "contract ArbitrumL1ERC20GatewayLike", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "l1Inbox", + "outputs": [ + { + "internalType": "contract ArbitrumL1InboxLike", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "l2GasLimit", + "outputs": [ + { + "internalType": "uint32", + "name": "", + "type": "uint32" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "l2GasPrice", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "l2MaxSubmissionCost", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "l2RefundL2Address", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "target", + "type": "address" + }, + { + "internalType": "bytes", + "name": "message", + "type": "bytes" + } + ], + "name": "relayMessage", + "outputs": [], + "stateMutability": "payable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "l1Token", + "type": "address" + }, + { + "internalType": "address", + "name": "l2Token", + "type": "address" + }, + { + "internalType": "uint256", + "name": "amount", + "type": "uint256" + }, + { + "internalType": "address", + "name": "to", + "type": "address" + } + ], + "name": "relayTokens", + "outputs": [], + "stateMutability": "payable", + "type": "function" + } + ], + "transactionHash": "0xc4e7e5661563508104de7b6f7f3ad7d83dc3505cf50c16951ab698493c42c9f3", + "receipt": { + "to": null, + "from": "0x9A8f92a830A5cB89a3816e3D267CB7791c16b04D", + "contractAddress": "0xD007aB76E36B03853C1F2fE5980069E7ACd38FF8", + "transactionIndex": 0, + "gasUsed": "644324", + "logsBloom": "0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", + "blockHash": "0xc187f686bd66164e7be933327fea392466365912e0a20653e9d1e72808a4aab2", + "transactionHash": "0xc4e7e5661563508104de7b6f7f3ad7d83dc3505cf50c16951ab698493c42c9f3", + "logs": [], + "blockNumber": 30475933, + "cumulativeGasUsed": "644324", + "status": 1, + "byzantium": true + }, + "args": ["0x578BAde599406A8fE3d24Fd7f7211c0911F5B29e", "0x91169Dbb45e6804743F94609De50D511C437572E"], + "numDeployments": 1, + "solcInputHash": "c8b9349311d8b5049b613ac98eb998d0", + "metadata": "{\"compiler\":{\"version\":\"0.8.13+commit.abaa5c0e\"},\"language\":\"Solidity\",\"output\":{\"abi\":[{\"inputs\":[{\"internalType\":\"contract ArbitrumL1InboxLike\",\"name\":\"_l1ArbitrumInbox\",\"type\":\"address\"},{\"internalType\":\"contract ArbitrumL1ERC20GatewayLike\",\"name\":\"_l1ERC20Gateway\",\"type\":\"address\"}],\"stateMutability\":\"nonpayable\",\"type\":\"constructor\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"address\",\"name\":\"target\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"bytes\",\"name\":\"message\",\"type\":\"bytes\"}],\"name\":\"MessageRelayed\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"address\",\"name\":\"l1Token\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"address\",\"name\":\"l2Token\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"address\",\"name\":\"to\",\"type\":\"address\"}],\"name\":\"TokensRelayed\",\"type\":\"event\"},{\"inputs\":[],\"name\":\"getL1CallValue\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"pure\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"l1ERC20Gateway\",\"outputs\":[{\"internalType\":\"contract ArbitrumL1ERC20GatewayLike\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"l1Inbox\",\"outputs\":[{\"internalType\":\"contract ArbitrumL1InboxLike\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"l2GasLimit\",\"outputs\":[{\"internalType\":\"uint32\",\"name\":\"\",\"type\":\"uint32\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"l2GasPrice\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"l2MaxSubmissionCost\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"l2RefundL2Address\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"target\",\"type\":\"address\"},{\"internalType\":\"bytes\",\"name\":\"message\",\"type\":\"bytes\"}],\"name\":\"relayMessage\",\"outputs\":[],\"stateMutability\":\"payable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"l1Token\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"l2Token\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"},{\"internalType\":\"address\",\"name\":\"to\",\"type\":\"address\"}],\"name\":\"relayTokens\",\"outputs\":[],\"stateMutability\":\"payable\",\"type\":\"function\"}],\"devdoc\":{\"details\":\"Public functions calling external contracts do not guard against reentrancy because they are expected to be called via delegatecall, which will execute this contract's logic within the context of the originating contract. For example, the HubPool will delegatecall these functions, therefore its only necessary that the HubPool's methods that call this contract's logic guard against reentrancy.\",\"kind\":\"dev\",\"methods\":{\"constructor\":{\"params\":{\"_l1ArbitrumInbox\":\"Inbox helper contract to send messages to Arbitrum.\",\"_l1ERC20Gateway\":\"ERC20 gateway contract to send tokens to Arbitrum.\"}},\"getL1CallValue()\":{\"returns\":{\"_0\":\"amount of ETH that this contract needs to hold in order for relayMessage to succeed.\"}},\"relayMessage(address,bytes)\":{\"params\":{\"message\":\"Data to send to target.\",\"target\":\"Contract on Arbitrum that will receive message.\"}},\"relayTokens(address,address,uint256,address)\":{\"params\":{\"amount\":\"Amount of L1 tokens to deposit and L2 tokens to receive.\",\"l1Token\":\"L1 token to deposit.\",\"l2Token\":\"L2 token to receive.\",\"to\":\"Bridge recipient.\"}}},\"version\":1},\"userdoc\":{\"kind\":\"user\",\"methods\":{\"constructor\":{\"notice\":\"Constructs new Adapter.\"},\"getL1CallValue()\":{\"notice\":\"Returns required amount of ETH to send a message via the Inbox.\"},\"relayMessage(address,bytes)\":{\"notice\":\"Send cross-chain message to target on Arbitrum.This contract must hold at least getL1CallValue() amount of ETH to send a message via the Inbox successfully, or the message will get stuck.\"},\"relayTokens(address,address,uint256,address)\":{\"notice\":\"Bridge tokens to Arbitrum.\"}},\"notice\":\"Contract containing logic to send messages from L1 to Arbitrum.\",\"version\":1}},\"settings\":{\"compilationTarget\":{\"contracts/chain-adapters/Arbitrum_Adapter.sol\":\"Arbitrum_Adapter\"},\"evmVersion\":\"london\",\"libraries\":{},\"metadata\":{\"bytecodeHash\":\"ipfs\",\"useLiteralContent\":true},\"optimizer\":{\"enabled\":true,\"runs\":1000000},\"remappings\":[]},\"sources\":{\"contracts/chain-adapters/Arbitrum_Adapter.sol\":{\"content\":\"// SPDX-License-Identifier: AGPL-3.0-only\\npragma solidity ^0.8.0;\\n\\nimport \\\"../interfaces/AdapterInterface.sol\\\";\\n\\ninterface ArbitrumL1InboxLike {\\n function createRetryableTicket(\\n address destAddr,\\n uint256 arbTxCallValue,\\n uint256 maxSubmissionCost,\\n address submissionRefundAddress,\\n address valueRefundAddress,\\n uint256 maxGas,\\n uint256 gasPriceBid,\\n bytes calldata data\\n ) external payable returns (uint256);\\n}\\n\\ninterface ArbitrumL1ERC20GatewayLike {\\n function outboundTransfer(\\n address _token,\\n address _to,\\n uint256 _amount,\\n uint256 _maxGas,\\n uint256 _gasPriceBid,\\n bytes calldata _data\\n ) external payable returns (bytes memory);\\n}\\n\\n/**\\n * @notice Contract containing logic to send messages from L1 to Arbitrum.\\n * @dev Public functions calling external contracts do not guard against reentrancy because they are expected to be\\n * called via delegatecall, which will execute this contract's logic within the context of the originating contract.\\n * For example, the HubPool will delegatecall these functions, therefore its only necessary that the HubPool's methods\\n * that call this contract's logic guard against reentrancy.\\n */\\ncontract Arbitrum_Adapter is AdapterInterface {\\n // Gas limit for immediate L2 execution attempt (can be estimated via NodeInterface.estimateRetryableTicket).\\n // NodeInterface precompile interface exists at L2 address 0x00000000000000000000000000000000000000C8\\n uint32 public immutable l2GasLimit = 5_000_000;\\n\\n // Amount of ETH allocated to pay for the base submission fee. The base submission fee is a parameter unique to\\n // retryable transactions; the user is charged the base submission fee to cover the storage costs of keeping their\\n // ticket\\u2019s calldata in the retry buffer. (current base submission fee is queryable via\\n // ArbRetryableTx.getSubmissionPrice). ArbRetryableTicket precompile interface exists at L2 address\\n // 0x000000000000000000000000000000000000006E.\\n uint256 public immutable l2MaxSubmissionCost = 0.1e18;\\n\\n // L2 Gas price bid for immediate L2 execution attempt (queryable via standard eth*gasPrice RPC)\\n uint256 public immutable l2GasPrice = 10e9; // 10 gWei\\n\\n // This address on L2 receives extra ETH that is left over after relaying a message via the inbox.\\n address public immutable l2RefundL2Address;\\n\\n ArbitrumL1InboxLike public immutable l1Inbox;\\n\\n ArbitrumL1ERC20GatewayLike public immutable l1ERC20Gateway;\\n\\n /**\\n * @notice Constructs new Adapter.\\n * @param _l1ArbitrumInbox Inbox helper contract to send messages to Arbitrum.\\n * @param _l1ERC20Gateway ERC20 gateway contract to send tokens to Arbitrum.\\n */\\n constructor(ArbitrumL1InboxLike _l1ArbitrumInbox, ArbitrumL1ERC20GatewayLike _l1ERC20Gateway) {\\n l1Inbox = _l1ArbitrumInbox;\\n l1ERC20Gateway = _l1ERC20Gateway;\\n\\n l2RefundL2Address = msg.sender;\\n }\\n\\n /**\\n * @notice Send cross-chain message to target on Arbitrum.\\n * @notice This contract must hold at least getL1CallValue() amount of ETH to send a message via the Inbox\\n * successfully, or the message will get stuck.\\n * @param target Contract on Arbitrum that will receive message.\\n * @param message Data to send to target.\\n */\\n function relayMessage(address target, bytes memory message) external payable override {\\n uint256 requiredL1CallValue = getL1CallValue();\\n require(address(this).balance >= requiredL1CallValue, \\\"Insufficient ETH balance\\\");\\n\\n l1Inbox.createRetryableTicket{ value: requiredL1CallValue }(\\n target, // destAddr destination L2 contract address\\n 0, // l2CallValue call value for retryable L2 message\\n l2MaxSubmissionCost, // maxSubmissionCost Max gas deducted from user's L2 balance to cover base fee\\n l2RefundL2Address, // excessFeeRefundAddress maxgas * gasprice - execution cost gets credited here on L2\\n l2RefundL2Address, // callValueRefundAddress l2Callvalue gets credited here on L2 if retryable txn times out or gets cancelled\\n l2GasLimit, // maxGas Max gas deducted from user's L2 balance to cover L2 execution\\n l2GasPrice, // gasPriceBid price bid for L2 execution\\n message // data ABI encoded data of L2 message\\n );\\n\\n emit MessageRelayed(target, message);\\n }\\n\\n /**\\n * @notice Bridge tokens to Arbitrum.\\n * @param l1Token L1 token to deposit.\\n * @param l2Token L2 token to receive.\\n * @param amount Amount of L1 tokens to deposit and L2 tokens to receive.\\n * @param to Bridge recipient.\\n */\\n function relayTokens(\\n address l1Token,\\n address l2Token, // l2Token is unused for Arbitrum.\\n uint256 amount,\\n address to\\n ) external payable override {\\n l1ERC20Gateway.outboundTransfer(l1Token, to, amount, l2GasLimit, l2GasPrice, \\\"\\\");\\n emit TokensRelayed(l1Token, l2Token, amount, to);\\n }\\n\\n /**\\n * @notice Returns required amount of ETH to send a message via the Inbox.\\n * @return amount of ETH that this contract needs to hold in order for relayMessage to succeed.\\n */\\n function getL1CallValue() public pure returns (uint256) {\\n return l2MaxSubmissionCost + l2GasPrice * l2GasLimit;\\n }\\n}\\n\",\"keccak256\":\"0xd81b9aa219cd11f97cae6bc1ab5ca6b013a7021be5baac97cd25be637bda69bb\",\"license\":\"AGPL-3.0-only\"},\"contracts/interfaces/AdapterInterface.sol\":{\"content\":\"// SPDX-License-Identifier: AGPL-3.0-only\\npragma solidity ^0.8.0;\\n\\n/**\\n * @notice Sends cross chain messages and tokens to contracts on a specific L2 network.\\n */\\n\\ninterface AdapterInterface {\\n event MessageRelayed(address target, bytes message);\\n\\n event TokensRelayed(address l1Token, address l2Token, uint256 amount, address to);\\n\\n function relayMessage(address target, bytes memory message) external payable;\\n\\n function relayTokens(\\n address l1Token,\\n address l2Token,\\n uint256 amount,\\n address to\\n ) external payable;\\n}\\n\",\"keccak256\":\"0xbd7091006acbdfe72b21ce985f964f0682a2316d9d3b38967beeb55f4ae5118c\",\"license\":\"AGPL-3.0-only\"}},\"version\":1}", + "bytecode": "0x610140604052624c4b4060805267016345785d8a000060a0526402540be40060c05234801561002d57600080fd5b50604051610c11380380610c1183398101604081905261004c91610081565b6001600160a01b039182166101005216610120523360e0526100bb565b6001600160a01b038116811461007e57600080fd5b50565b6000806040838503121561009457600080fd5b825161009f81610069565b60208401519092506100b081610069565b809150509250929050565b60805160a05160c05160e0516101005161012051610abb6101566000396000818160d50152610392015260008181610143015261053e0152600081816101ab01526105940152600081816101770152818161028b0152818161035e01526105da015260008181610228015281816102b501526105720152600081816101df015281816102690152818161033701526105b80152610abb6000f3fe6080604052600436106100965760003560e01c80639ae3668511610069578063cf6e65b71161004e578063cf6e65b7146101cd578063e599477e14610216578063e6eb8ade1461024a57600080fd5b80639ae36685146101655780639c3ba2001461019957600080fd5b806308f1ed151461009b5780630e283a6a146100c357806352c8c75c1461011c5780638134f38514610131575b600080fd5b3480156100a757600080fd5b506100b061025d565b6040519081526020015b60405180910390f35b3480156100cf57600080fd5b506100f77f000000000000000000000000000000000000000000000000000000000000000081565b60405173ffffffffffffffffffffffffffffffffffffffff90911681526020016100ba565b61012f61012a3660046106af565b6102de565b005b34801561013d57600080fd5b506100f77f000000000000000000000000000000000000000000000000000000000000000081565b34801561017157600080fd5b506100b07f000000000000000000000000000000000000000000000000000000000000000081565b3480156101a557600080fd5b506100f77f000000000000000000000000000000000000000000000000000000000000000081565b3480156101d957600080fd5b506102017f000000000000000000000000000000000000000000000000000000000000000081565b60405163ffffffff90911681526020016100ba565b34801561022257600080fd5b506100b07f000000000000000000000000000000000000000000000000000000000000000081565b61012f6102583660046107c0565b610487565b60006102af63ffffffff7f0000000000000000000000000000000000000000000000000000000000000000167f0000000000000000000000000000000000000000000000000000000000000000610880565b6102d9907f00000000000000000000000000000000000000000000000000000000000000006108bd565b905090565b6040517fd2ce7d6500000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff858116600483015282811660248301526044820184905263ffffffff7f00000000000000000000000000000000000000000000000000000000000000001660648301527f0000000000000000000000000000000000000000000000000000000000000000608483015260c060a4830152600060c48301527f0000000000000000000000000000000000000000000000000000000000000000169063d2ce7d659060e4016000604051808303816000875af11580156103db573d6000803e3d6000fd5b505050506040513d6000823e601f3d9081017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe01682016040526104219190810190610905565b506040805173ffffffffffffffffffffffffffffffffffffffff868116825285811660208301528183018590528316606082015290517fd7e09655439c3932e55857df3220186e5a7f0980825f20691c2b35d941dee75b9181900360800190a150505050565b600061049161025d565b905080471015610501576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601860248201527f496e73756666696369656e74204554482062616c616e63650000000000000000604482015260640160405180910390fd5b6040517f679b6ded00000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff7f0000000000000000000000000000000000000000000000000000000000000000169063679b6ded9083906106049087906000907f0000000000000000000000000000000000000000000000000000000000000000907f00000000000000000000000000000000000000000000000000000000000000009081907f0000000000000000000000000000000000000000000000000000000000000000907f0000000000000000000000000000000000000000000000000000000000000000908d906004016109c6565b60206040518083038185885af1158015610622573d6000803e3d6000fd5b50505050506040513d601f19601f820116820180604052508101906106479190610a35565b507f9e6c52944e331ba6270e7fe4cea2a4086bae8f7a27e1cdba07f416806f5d0ac48383604051610679929190610a4e565b60405180910390a1505050565b803573ffffffffffffffffffffffffffffffffffffffff811681146106aa57600080fd5b919050565b600080600080608085870312156106c557600080fd5b6106ce85610686565b93506106dc60208601610686565b9250604085013591506106f160608601610686565b905092959194509250565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b604051601f82017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe016810167ffffffffffffffff81118282101715610772576107726106fc565b604052919050565b600067ffffffffffffffff821115610794576107946106fc565b50601f017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe01660200190565b600080604083850312156107d357600080fd5b6107dc83610686565b9150602083013567ffffffffffffffff8111156107f857600080fd5b8301601f8101851361080957600080fd5b803561081c6108178261077a565b61072b565b81815286602083850101111561083157600080fd5b816020840160208301376000602083830101528093505050509250929050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b6000817fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff04831182151516156108b8576108b8610851565b500290565b600082198211156108d0576108d0610851565b500190565b60005b838110156108f05781810151838201526020016108d8565b838111156108ff576000848401525b50505050565b60006020828403121561091757600080fd5b815167ffffffffffffffff81111561092e57600080fd5b8201601f8101841361093f57600080fd5b805161094d6108178261077a565b81815285602083850101111561096257600080fd5b6109738260208301602086016108d5565b95945050505050565b600081518084526109948160208601602086016108d5565b601f017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0169290920160200192915050565b600061010073ffffffffffffffffffffffffffffffffffffffff808c1684528a6020850152896040850152808916606085015280881660808501525063ffffffff861660a08401528460c08401528060e0840152610a268184018561097c565b9b9a5050505050505050505050565b600060208284031215610a4757600080fd5b5051919050565b73ffffffffffffffffffffffffffffffffffffffff83168152604060208201526000610a7d604083018461097c565b94935050505056fea26469706673582212201138a6fca9cde9a32c1accbbb9cfaeced745b08b0ff836da36e0cc9731508d6364736f6c634300080d0033", + "deployedBytecode": "0x6080604052600436106100965760003560e01c80639ae3668511610069578063cf6e65b71161004e578063cf6e65b7146101cd578063e599477e14610216578063e6eb8ade1461024a57600080fd5b80639ae36685146101655780639c3ba2001461019957600080fd5b806308f1ed151461009b5780630e283a6a146100c357806352c8c75c1461011c5780638134f38514610131575b600080fd5b3480156100a757600080fd5b506100b061025d565b6040519081526020015b60405180910390f35b3480156100cf57600080fd5b506100f77f000000000000000000000000000000000000000000000000000000000000000081565b60405173ffffffffffffffffffffffffffffffffffffffff90911681526020016100ba565b61012f61012a3660046106af565b6102de565b005b34801561013d57600080fd5b506100f77f000000000000000000000000000000000000000000000000000000000000000081565b34801561017157600080fd5b506100b07f000000000000000000000000000000000000000000000000000000000000000081565b3480156101a557600080fd5b506100f77f000000000000000000000000000000000000000000000000000000000000000081565b3480156101d957600080fd5b506102017f000000000000000000000000000000000000000000000000000000000000000081565b60405163ffffffff90911681526020016100ba565b34801561022257600080fd5b506100b07f000000000000000000000000000000000000000000000000000000000000000081565b61012f6102583660046107c0565b610487565b60006102af63ffffffff7f0000000000000000000000000000000000000000000000000000000000000000167f0000000000000000000000000000000000000000000000000000000000000000610880565b6102d9907f00000000000000000000000000000000000000000000000000000000000000006108bd565b905090565b6040517fd2ce7d6500000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff858116600483015282811660248301526044820184905263ffffffff7f00000000000000000000000000000000000000000000000000000000000000001660648301527f0000000000000000000000000000000000000000000000000000000000000000608483015260c060a4830152600060c48301527f0000000000000000000000000000000000000000000000000000000000000000169063d2ce7d659060e4016000604051808303816000875af11580156103db573d6000803e3d6000fd5b505050506040513d6000823e601f3d9081017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe01682016040526104219190810190610905565b506040805173ffffffffffffffffffffffffffffffffffffffff868116825285811660208301528183018590528316606082015290517fd7e09655439c3932e55857df3220186e5a7f0980825f20691c2b35d941dee75b9181900360800190a150505050565b600061049161025d565b905080471015610501576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601860248201527f496e73756666696369656e74204554482062616c616e63650000000000000000604482015260640160405180910390fd5b6040517f679b6ded00000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff7f0000000000000000000000000000000000000000000000000000000000000000169063679b6ded9083906106049087906000907f0000000000000000000000000000000000000000000000000000000000000000907f00000000000000000000000000000000000000000000000000000000000000009081907f0000000000000000000000000000000000000000000000000000000000000000907f0000000000000000000000000000000000000000000000000000000000000000908d906004016109c6565b60206040518083038185885af1158015610622573d6000803e3d6000fd5b50505050506040513d601f19601f820116820180604052508101906106479190610a35565b507f9e6c52944e331ba6270e7fe4cea2a4086bae8f7a27e1cdba07f416806f5d0ac48383604051610679929190610a4e565b60405180910390a1505050565b803573ffffffffffffffffffffffffffffffffffffffff811681146106aa57600080fd5b919050565b600080600080608085870312156106c557600080fd5b6106ce85610686565b93506106dc60208601610686565b9250604085013591506106f160608601610686565b905092959194509250565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b604051601f82017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe016810167ffffffffffffffff81118282101715610772576107726106fc565b604052919050565b600067ffffffffffffffff821115610794576107946106fc565b50601f017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe01660200190565b600080604083850312156107d357600080fd5b6107dc83610686565b9150602083013567ffffffffffffffff8111156107f857600080fd5b8301601f8101851361080957600080fd5b803561081c6108178261077a565b61072b565b81815286602083850101111561083157600080fd5b816020840160208301376000602083830101528093505050509250929050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b6000817fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff04831182151516156108b8576108b8610851565b500290565b600082198211156108d0576108d0610851565b500190565b60005b838110156108f05781810151838201526020016108d8565b838111156108ff576000848401525b50505050565b60006020828403121561091757600080fd5b815167ffffffffffffffff81111561092e57600080fd5b8201601f8101841361093f57600080fd5b805161094d6108178261077a565b81815285602083850101111561096257600080fd5b6109738260208301602086016108d5565b95945050505050565b600081518084526109948160208601602086016108d5565b601f017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0169290920160200192915050565b600061010073ffffffffffffffffffffffffffffffffffffffff808c1684528a6020850152896040850152808916606085015280881660808501525063ffffffff861660a08401528460c08401528060e0840152610a268184018561097c565b9b9a5050505050505050505050565b600060208284031215610a4757600080fd5b5051919050565b73ffffffffffffffffffffffffffffffffffffffff83168152604060208201526000610a7d604083018461097c565b94935050505056fea26469706673582212201138a6fca9cde9a32c1accbbb9cfaeced745b08b0ff836da36e0cc9731508d6364736f6c634300080d0033", + "devdoc": { + "details": "Public functions calling external contracts do not guard against reentrancy because they are expected to be called via delegatecall, which will execute this contract's logic within the context of the originating contract. For example, the HubPool will delegatecall these functions, therefore its only necessary that the HubPool's methods that call this contract's logic guard against reentrancy.", + "kind": "dev", + "methods": { + "constructor": { + "params": { + "_l1ArbitrumInbox": "Inbox helper contract to send messages to Arbitrum.", + "_l1ERC20Gateway": "ERC20 gateway contract to send tokens to Arbitrum." + } + }, + "getL1CallValue()": { + "returns": { + "_0": "amount of ETH that this contract needs to hold in order for relayMessage to succeed." + } + }, + "relayMessage(address,bytes)": { + "params": { + "message": "Data to send to target.", + "target": "Contract on Arbitrum that will receive message." + } + }, + "relayTokens(address,address,uint256,address)": { + "params": { + "amount": "Amount of L1 tokens to deposit and L2 tokens to receive.", + "l1Token": "L1 token to deposit.", + "l2Token": "L2 token to receive.", + "to": "Bridge recipient." + } + } + }, + "version": 1 + }, + "userdoc": { + "kind": "user", + "methods": { + "constructor": { + "notice": "Constructs new Adapter." + }, + "getL1CallValue()": { + "notice": "Returns required amount of ETH to send a message via the Inbox." + }, + "relayMessage(address,bytes)": { + "notice": "Send cross-chain message to target on Arbitrum.This contract must hold at least getL1CallValue() amount of ETH to send a message via the Inbox successfully, or the message will get stuck." + }, + "relayTokens(address,address,uint256,address)": { + "notice": "Bridge tokens to Arbitrum." + } + }, + "notice": "Contract containing logic to send messages from L1 to Arbitrum.", + "version": 1 + }, + "storageLayout": { + "storage": [], + "types": null + } +} diff --git a/deployments/kovan/Ethereum_Adapter.json b/deployments/kovan/Ethereum_Adapter.json index b3ddad04b..154d5de71 100644 --- a/deployments/kovan/Ethereum_Adapter.json +++ b/deployments/kovan/Ethereum_Adapter.json @@ -1,19 +1,6 @@ { - "address": "0xaB366EFf1AB09814e847d04a32C837d8aCe5584d", + "address": "0x304d7cbD119E356084b6c02542191EA43df5E399", "abi": [ - { - "anonymous": false, - "inputs": [ - { - "indexed": false, - "internalType": "address", - "name": "newHubPool", - "type": "address" - } - ], - "name": "HubPoolChanged", - "type": "event" - }, { "anonymous": false, "inputs": [ @@ -111,30 +98,30 @@ "type": "function" } ], - "transactionHash": "0x114be92c2acc555fe8b29bdcff5e6afd5359c1f4413234b77cb951f9b689516a", + "transactionHash": "0x48e8862df61663f2171f5153747828ba7c32998670774a43c5cfd12238ec5475", "receipt": { "to": null, "from": "0x9A8f92a830A5cB89a3816e3D267CB7791c16b04D", - "contractAddress": "0xaB366EFf1AB09814e847d04a32C837d8aCe5584d", - "transactionIndex": 2, + "contractAddress": "0x304d7cbD119E356084b6c02542191EA43df5E399", + "transactionIndex": 0, "gasUsed": "491295", "logsBloom": "0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", - "blockHash": "0x23e3b3312104f1a175b50fc6d91bd655a6d7fad225dbcfc30b2b65727fc2d4c0", - "transactionHash": "0x114be92c2acc555fe8b29bdcff5e6afd5359c1f4413234b77cb951f9b689516a", + "blockHash": "0x73da76d2c178a1e3e80ef4b718af7c0c36f22c47c795dbd71da738adb3998db4", + "transactionHash": "0x48e8862df61663f2171f5153747828ba7c32998670774a43c5cfd12238ec5475", "logs": [], - "blockNumber": 30251472, - "cumulativeGasUsed": "835402", + "blockNumber": 30475935, + "cumulativeGasUsed": "491295", "status": 1, "byzantium": true }, "args": [], "numDeployments": 1, - "solcInputHash": "d3cc7d49c45bf725b6aea61557b961e9", - "metadata": "{\"compiler\":{\"version\":\"0.8.11+commit.d7f03943\"},\"language\":\"Solidity\",\"output\":{\"abi\":[{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"address\",\"name\":\"newHubPool\",\"type\":\"address\"}],\"name\":\"HubPoolChanged\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"address\",\"name\":\"target\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"bytes\",\"name\":\"message\",\"type\":\"bytes\"}],\"name\":\"MessageRelayed\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"address\",\"name\":\"l1Token\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"address\",\"name\":\"l2Token\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"address\",\"name\":\"to\",\"type\":\"address\"}],\"name\":\"TokensRelayed\",\"type\":\"event\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"target\",\"type\":\"address\"},{\"internalType\":\"bytes\",\"name\":\"message\",\"type\":\"bytes\"}],\"name\":\"relayMessage\",\"outputs\":[],\"stateMutability\":\"payable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"l1Token\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"l2Token\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"},{\"internalType\":\"address\",\"name\":\"to\",\"type\":\"address\"}],\"name\":\"relayTokens\",\"outputs\":[],\"stateMutability\":\"payable\",\"type\":\"function\"}],\"devdoc\":{\"details\":\"Public functions calling external contracts do not guard against reentrancy because they are expected to be called via delegatecall, which will execute this contract's logic within the context of the originating contract. For example, the HubPool will delegatecall these functions, therefore its only neccessary that the HubPool's methods that call this contract's logic guard against reentrancy.\",\"kind\":\"dev\",\"methods\":{\"relayMessage(address,bytes)\":{\"params\":{\"message\":\"Data to send to target.\",\"target\":\"Contract that will receive message.\"}},\"relayTokens(address,address,uint256,address)\":{\"params\":{\"amount\":\"Amount of L1 tokens to send.\",\"l1Token\":\"L1 token to send.\",\"l2Token\":\"Unused parameter in this contract.\",\"to\":\"recipient.\"}}},\"version\":1},\"userdoc\":{\"kind\":\"user\",\"methods\":{\"relayMessage(address,bytes)\":{\"notice\":\"Send message to target on Ethereum.This function, and contract overall, is not useful in practice except that the HubPool expects to interact with the SpokePool via an Adapter, so when communicating to the Ethereum_SpokePool, it must send messages via this pass-through contract.\"},\"relayTokens(address,address,uint256,address)\":{\"notice\":\"Send tokens to target.\"}},\"notice\":\"Contract containing logic to send messages from L1 to Ethereum SpokePool.This contract should always be deployed on the same chain as the HubPool, as it acts as a pass-through contract between HubPool and SpokePool on the same chain. Its named \\\"Ethereum_Adapter\\\" because a core assumption is that the HubPool will be deployed on Ethereum, so this adapter will be used to communicate between HubPool and the Ethereum_SpokePool.\",\"version\":1}},\"settings\":{\"compilationTarget\":{\"contracts/chain-adapters/Ethereum_Adapter.sol\":\"Ethereum_Adapter\"},\"evmVersion\":\"london\",\"libraries\":{},\"metadata\":{\"bytecodeHash\":\"ipfs\",\"useLiteralContent\":true},\"optimizer\":{\"enabled\":true,\"runs\":1000000},\"remappings\":[]},\"sources\":{\"@openzeppelin/contracts/token/ERC20/IERC20.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.5.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 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(\\n address from,\\n address to,\\n uint256 amount\\n ) external returns (bool);\\n\\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\",\"keccak256\":\"0xbbc8ac883ac3c0078ce5ad3e288fbb3ffcc8a30c3a98c0fda0114d64fc44fca2\",\"license\":\"MIT\"},\"@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts v4.4.1 (token/ERC20/utils/SafeERC20.sol)\\n\\npragma solidity ^0.8.0;\\n\\nimport \\\"../IERC20.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 function safeTransfer(\\n IERC20 token,\\n address to,\\n uint256 value\\n ) internal {\\n _callOptionalReturn(token, abi.encodeWithSelector(token.transfer.selector, to, value));\\n }\\n\\n function safeTransferFrom(\\n IERC20 token,\\n address from,\\n address to,\\n uint256 value\\n ) 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(\\n IERC20 token,\\n address spender,\\n uint256 value\\n ) 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 function safeIncreaseAllowance(\\n IERC20 token,\\n address spender,\\n uint256 value\\n ) internal {\\n uint256 newAllowance = token.allowance(address(this), spender) + value;\\n _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, newAllowance));\\n }\\n\\n function safeDecreaseAllowance(\\n IERC20 token,\\n address spender,\\n uint256 value\\n ) internal {\\n unchecked {\\n uint256 oldAllowance = token.allowance(address(this), spender);\\n require(oldAllowance >= value, \\\"SafeERC20: decreased allowance below zero\\\");\\n uint256 newAllowance = oldAllowance - value;\\n _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, newAllowance));\\n }\\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 if (returndata.length > 0) {\\n // Return data is optional\\n require(abi.decode(returndata, (bool)), \\\"SafeERC20: ERC20 operation did not succeed\\\");\\n }\\n }\\n}\\n\",\"keccak256\":\"0xc3d946432c0ddbb1f846a0d3985be71299df331b91d06732152117f62f0be2b5\",\"license\":\"MIT\"},\"@openzeppelin/contracts/utils/Address.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.5.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 *\\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://diligence.consensys.net/posts/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.5.11/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 functionCall(target, data, \\\"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(\\n address target,\\n bytes memory data,\\n uint256 value\\n ) 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 require(isContract(target), \\\"Address: call to non-contract\\\");\\n\\n (bool success, bytes memory returndata) = target.call{value: value}(data);\\n return verifyCallResult(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 require(isContract(target), \\\"Address: static call to non-contract\\\");\\n\\n (bool success, bytes memory returndata) = target.staticcall(data);\\n return verifyCallResult(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 require(isContract(target), \\\"Address: delegate call to non-contract\\\");\\n\\n (bool success, bytes memory returndata) = target.delegatecall(data);\\n return verifyCallResult(success, returndata, errorMessage);\\n }\\n\\n /**\\n * @dev Tool to verifies that a low level call was successful, and revert if it wasn't, either by bubbling the\\n * revert reason 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 // 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\\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}\\n\",\"keccak256\":\"0x2ccf9d2313a313d41a791505f2b5abfdc62191b5d4334f7f7a82691c088a1c87\",\"license\":\"MIT\"},\"contracts/chain-adapters/Ethereum_Adapter.sol\":{\"content\":\"// SPDX-License-Identifier: AGPL-3.0-only\\npragma solidity ^0.8.0;\\n\\nimport \\\"../interfaces/AdapterInterface.sol\\\";\\nimport \\\"../interfaces/WETH9.sol\\\";\\n\\nimport \\\"@openzeppelin/contracts/token/ERC20/IERC20.sol\\\";\\nimport \\\"@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol\\\";\\n\\n/**\\n * @notice Contract containing logic to send messages from L1 to Ethereum SpokePool.\\n * @notice This contract should always be deployed on the same chain as the HubPool, as it acts as a pass-through\\n * contract between HubPool and SpokePool on the same chain. Its named \\\"Ethereum_Adapter\\\" because a core assumption\\n * is that the HubPool will be deployed on Ethereum, so this adapter will be used to communicate between HubPool\\n * and the Ethereum_SpokePool.\\n * @dev Public functions calling external contracts do not guard against reentrancy because they are expected to be\\n * called via delegatecall, which will execute this contract's logic within the context of the originating contract.\\n * For example, the HubPool will delegatecall these functions, therefore its only neccessary that the HubPool's methods\\n * that call this contract's logic guard against reentrancy.\\n */\\ncontract Ethereum_Adapter is AdapterInterface {\\n using SafeERC20 for IERC20;\\n\\n /**\\n * @notice Send message to target on Ethereum.\\n * @notice This function, and contract overall, is not useful in practice except that the HubPool\\n * expects to interact with the SpokePool via an Adapter, so when communicating to the Ethereum_SpokePool, it must\\n * send messages via this pass-through contract.\\n * @param target Contract that will receive message.\\n * @param message Data to send to target.\\n */\\n function relayMessage(address target, bytes memory message) external payable override {\\n _executeCall(target, message);\\n emit MessageRelayed(target, message);\\n }\\n\\n /**\\n * @notice Send tokens to target.\\n * @param l1Token L1 token to send.\\n * @param l2Token Unused parameter in this contract.\\n * @param amount Amount of L1 tokens to send.\\n * @param to recipient.\\n */\\n function relayTokens(\\n address l1Token,\\n address l2Token, // l2Token is unused for ethereum since we are assuming that the HubPool is only deployed\\n // on this network.\\n uint256 amount,\\n address to\\n ) external payable override {\\n IERC20(l1Token).safeTransfer(to, amount);\\n emit TokensRelayed(l1Token, l2Token, amount, to);\\n }\\n\\n // Note: this snippet of code is copied from Governor.sol.\\n function _executeCall(address to, bytes memory data) private {\\n // Note: this snippet of code is copied from Governor.sol and modified to not include any \\\"value\\\" field.\\n // solhint-disable-next-line no-inline-assembly\\n\\n bool success;\\n assembly {\\n let inputData := add(data, 0x20)\\n let inputDataSize := mload(data)\\n // Hardcode value to be 0 for relayed governance calls in order to avoid addressing complexity of bridging\\n // value cross-chain.\\n success := call(gas(), to, 0, inputData, inputDataSize, 0, 0)\\n }\\n require(success, \\\"execute call failed\\\");\\n }\\n}\\n\",\"keccak256\":\"0x9271143a2872c8fc4028e67e011d1fd98e3b7f812a20af7e96ab681ac2efb0ca\",\"license\":\"AGPL-3.0-only\"},\"contracts/interfaces/AdapterInterface.sol\":{\"content\":\"// SPDX-License-Identifier: AGPL-3.0-only\\npragma solidity ^0.8.0;\\n\\n/**\\n * @notice Sends cross chain messages and tokens to contracts on a specific L2 network.\\n */\\n\\ninterface AdapterInterface {\\n event HubPoolChanged(address newHubPool);\\n\\n event MessageRelayed(address target, bytes message);\\n\\n event TokensRelayed(address l1Token, address l2Token, uint256 amount, address to);\\n\\n function relayMessage(address target, bytes memory message) external payable;\\n\\n function relayTokens(\\n address l1Token,\\n address l2Token,\\n uint256 amount,\\n address to\\n ) external payable;\\n}\\n\",\"keccak256\":\"0x60e1ed2205f90655fe4152a90709be15bc9550fb3faeaf9835fee22c095bab11\",\"license\":\"AGPL-3.0-only\"},\"contracts/interfaces/WETH9.sol\":{\"content\":\"// SPDX-License-Identifier: GPL-3.0-only\\npragma solidity ^0.8.0;\\n\\ninterface WETH9 {\\n function withdraw(uint256 wad) external;\\n\\n function deposit() external payable;\\n\\n function balanceOf(address guy) external view returns (uint256 wad);\\n\\n function transfer(address guy, uint256 wad) external;\\n}\\n\",\"keccak256\":\"0x7b444d0840b1f76eee9bf39d74830f70644395613b96cce2d80fc50785a82eaa\",\"license\":\"GPL-3.0-only\"}},\"version\":1}", - "bytecode": "0x608060405234801561001057600080fd5b506107fa806100206000396000f3fe6080604052600436106100295760003560e01c806352c8c75c1461002e578063e6eb8ade14610043575b600080fd5b61004161003c36600461056e565b610056565b005b6100416100513660046105ea565b6100dc565b61007773ffffffffffffffffffffffffffffffffffffffff85168284610123565b6040805173ffffffffffffffffffffffffffffffffffffffff868116825285811660208301528183018590528316606082015290517fd7e09655439c3932e55857df3220186e5a7f0980825f20691c2b35d941dee75b9181900360800190a150505050565b6100e682826101b5565b7f9e6c52944e331ba6270e7fe4cea2a4086bae8f7a27e1cdba07f416806f5d0ac48282604051610117929190610744565b60405180910390a15050565b6040805173ffffffffffffffffffffffffffffffffffffffff8416602482015260448082018490528251808303909101815260649091019091526020810180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff167fa9059cbb000000000000000000000000000000000000000000000000000000001790526101b0908490610237565b505050565b600060208201825160008082846000895af192505050806101b0576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601360248201527f657865637574652063616c6c206661696c65640000000000000000000000000060448201526064015b60405180910390fd5b6000610299826040518060400160405280602081526020017f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c65648152508573ffffffffffffffffffffffffffffffffffffffff166103439092919063ffffffff16565b8051909150156101b057808060200190518101906102b79190610773565b6101b0576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602a60248201527f5361666545524332303a204552433230206f7065726174696f6e20646964206e60448201527f6f74207375636365656400000000000000000000000000000000000000000000606482015260840161022e565b6060610352848460008561035c565b90505b9392505050565b6060824710156103ee576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602660248201527f416464726573733a20696e73756666696369656e742062616c616e636520666f60448201527f722063616c6c0000000000000000000000000000000000000000000000000000606482015260840161022e565b73ffffffffffffffffffffffffffffffffffffffff85163b61046c576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e7472616374000000604482015260640161022e565b6000808673ffffffffffffffffffffffffffffffffffffffff1685876040516104959190610795565b60006040518083038185875af1925050503d80600081146104d2576040519150601f19603f3d011682016040523d82523d6000602084013e6104d7565b606091505b50915091506104e78282866104f2565b979650505050505050565b60608315610501575081610355565b8251156105115782518084602001fd5b816040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161022e91906107b1565b803573ffffffffffffffffffffffffffffffffffffffff8116811461056957600080fd5b919050565b6000806000806080858703121561058457600080fd5b61058d85610545565b935061059b60208601610545565b9250604085013591506105b060608601610545565b905092959194509250565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b600080604083850312156105fd57600080fd5b61060683610545565b9150602083013567ffffffffffffffff8082111561062357600080fd5b818501915085601f83011261063757600080fd5b813581811115610649576106496105bb565b604051601f82017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0908116603f0116810190838211818310171561068f5761068f6105bb565b816040528281528860208487010111156106a857600080fd5b8260208601602083013760006020848301015280955050505050509250929050565b60005b838110156106e55781810151838201526020016106cd565b838111156106f4576000848401525b50505050565b600081518084526107128160208601602086016106ca565b601f017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0169290920160200192915050565b73ffffffffffffffffffffffffffffffffffffffff8316815260406020820152600061035260408301846106fa565b60006020828403121561078557600080fd5b8151801515811461035557600080fd5b600082516107a78184602087016106ca565b9190910192915050565b60208152600061035560208301846106fa56fea2646970667358221220dd19386ab891a70db6faa0a689e515de03ddeb9565752ae2d95a71931add6a8064736f6c634300080b0033", - "deployedBytecode": "0x6080604052600436106100295760003560e01c806352c8c75c1461002e578063e6eb8ade14610043575b600080fd5b61004161003c36600461056e565b610056565b005b6100416100513660046105ea565b6100dc565b61007773ffffffffffffffffffffffffffffffffffffffff85168284610123565b6040805173ffffffffffffffffffffffffffffffffffffffff868116825285811660208301528183018590528316606082015290517fd7e09655439c3932e55857df3220186e5a7f0980825f20691c2b35d941dee75b9181900360800190a150505050565b6100e682826101b5565b7f9e6c52944e331ba6270e7fe4cea2a4086bae8f7a27e1cdba07f416806f5d0ac48282604051610117929190610744565b60405180910390a15050565b6040805173ffffffffffffffffffffffffffffffffffffffff8416602482015260448082018490528251808303909101815260649091019091526020810180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff167fa9059cbb000000000000000000000000000000000000000000000000000000001790526101b0908490610237565b505050565b600060208201825160008082846000895af192505050806101b0576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601360248201527f657865637574652063616c6c206661696c65640000000000000000000000000060448201526064015b60405180910390fd5b6000610299826040518060400160405280602081526020017f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c65648152508573ffffffffffffffffffffffffffffffffffffffff166103439092919063ffffffff16565b8051909150156101b057808060200190518101906102b79190610773565b6101b0576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602a60248201527f5361666545524332303a204552433230206f7065726174696f6e20646964206e60448201527f6f74207375636365656400000000000000000000000000000000000000000000606482015260840161022e565b6060610352848460008561035c565b90505b9392505050565b6060824710156103ee576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602660248201527f416464726573733a20696e73756666696369656e742062616c616e636520666f60448201527f722063616c6c0000000000000000000000000000000000000000000000000000606482015260840161022e565b73ffffffffffffffffffffffffffffffffffffffff85163b61046c576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e7472616374000000604482015260640161022e565b6000808673ffffffffffffffffffffffffffffffffffffffff1685876040516104959190610795565b60006040518083038185875af1925050503d80600081146104d2576040519150601f19603f3d011682016040523d82523d6000602084013e6104d7565b606091505b50915091506104e78282866104f2565b979650505050505050565b60608315610501575081610355565b8251156105115782518084602001fd5b816040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161022e91906107b1565b803573ffffffffffffffffffffffffffffffffffffffff8116811461056957600080fd5b919050565b6000806000806080858703121561058457600080fd5b61058d85610545565b935061059b60208601610545565b9250604085013591506105b060608601610545565b905092959194509250565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b600080604083850312156105fd57600080fd5b61060683610545565b9150602083013567ffffffffffffffff8082111561062357600080fd5b818501915085601f83011261063757600080fd5b813581811115610649576106496105bb565b604051601f82017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0908116603f0116810190838211818310171561068f5761068f6105bb565b816040528281528860208487010111156106a857600080fd5b8260208601602083013760006020848301015280955050505050509250929050565b60005b838110156106e55781810151838201526020016106cd565b838111156106f4576000848401525b50505050565b600081518084526107128160208601602086016106ca565b601f017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0169290920160200192915050565b73ffffffffffffffffffffffffffffffffffffffff8316815260406020820152600061035260408301846106fa565b60006020828403121561078557600080fd5b8151801515811461035557600080fd5b600082516107a78184602087016106ca565b9190910192915050565b60208152600061035560208301846106fa56fea2646970667358221220dd19386ab891a70db6faa0a689e515de03ddeb9565752ae2d95a71931add6a8064736f6c634300080b0033", + "solcInputHash": "c8b9349311d8b5049b613ac98eb998d0", + "metadata": "{\"compiler\":{\"version\":\"0.8.13+commit.abaa5c0e\"},\"language\":\"Solidity\",\"output\":{\"abi\":[{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"address\",\"name\":\"target\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"bytes\",\"name\":\"message\",\"type\":\"bytes\"}],\"name\":\"MessageRelayed\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"address\",\"name\":\"l1Token\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"address\",\"name\":\"l2Token\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"address\",\"name\":\"to\",\"type\":\"address\"}],\"name\":\"TokensRelayed\",\"type\":\"event\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"target\",\"type\":\"address\"},{\"internalType\":\"bytes\",\"name\":\"message\",\"type\":\"bytes\"}],\"name\":\"relayMessage\",\"outputs\":[],\"stateMutability\":\"payable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"l1Token\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"l2Token\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"},{\"internalType\":\"address\",\"name\":\"to\",\"type\":\"address\"}],\"name\":\"relayTokens\",\"outputs\":[],\"stateMutability\":\"payable\",\"type\":\"function\"}],\"devdoc\":{\"details\":\"Public functions calling external contracts do not guard against reentrancy because they are expected to be called via delegatecall, which will execute this contract's logic within the context of the originating contract. For example, the HubPool will delegatecall these functions, therefore its only necessary that the HubPool's methods that call this contract's logic guard against reentrancy.\",\"kind\":\"dev\",\"methods\":{\"relayMessage(address,bytes)\":{\"params\":{\"message\":\"Data to send to target.\",\"target\":\"Contract that will receive message.\"}},\"relayTokens(address,address,uint256,address)\":{\"params\":{\"amount\":\"Amount of L1 tokens to send.\",\"l1Token\":\"L1 token to send.\",\"l2Token\":\"Unused parameter in this contract.\",\"to\":\"recipient.\"}}},\"version\":1},\"userdoc\":{\"kind\":\"user\",\"methods\":{\"relayMessage(address,bytes)\":{\"notice\":\"Send message to target on Ethereum.This function, and contract overall, is not useful in practice except that the HubPool expects to interact with the SpokePool via an Adapter, so when communicating to the Ethereum_SpokePool, it must send messages via this pass-through contract.\"},\"relayTokens(address,address,uint256,address)\":{\"notice\":\"Send tokens to target.\"}},\"notice\":\"Contract containing logic to send messages from L1 to Ethereum SpokePool.This contract should always be deployed on the same chain as the HubPool, as it acts as a pass-through contract between HubPool and SpokePool on the same chain. Its named \\\"Ethereum_Adapter\\\" because a core assumption is that the HubPool will be deployed on Ethereum, so this adapter will be used to communicate between HubPool and the Ethereum_SpokePool.\",\"version\":1}},\"settings\":{\"compilationTarget\":{\"contracts/chain-adapters/Ethereum_Adapter.sol\":\"Ethereum_Adapter\"},\"evmVersion\":\"london\",\"libraries\":{},\"metadata\":{\"bytecodeHash\":\"ipfs\",\"useLiteralContent\":true},\"optimizer\":{\"enabled\":true,\"runs\":1000000},\"remappings\":[]},\"sources\":{\"@openzeppelin/contracts/token/ERC20/IERC20.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.5.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 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(\\n address from,\\n address to,\\n uint256 amount\\n ) external returns (bool);\\n\\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\",\"keccak256\":\"0xbbc8ac883ac3c0078ce5ad3e288fbb3ffcc8a30c3a98c0fda0114d64fc44fca2\",\"license\":\"MIT\"},\"@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts v4.4.1 (token/ERC20/utils/SafeERC20.sol)\\n\\npragma solidity ^0.8.0;\\n\\nimport \\\"../IERC20.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 function safeTransfer(\\n IERC20 token,\\n address to,\\n uint256 value\\n ) internal {\\n _callOptionalReturn(token, abi.encodeWithSelector(token.transfer.selector, to, value));\\n }\\n\\n function safeTransferFrom(\\n IERC20 token,\\n address from,\\n address to,\\n uint256 value\\n ) 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(\\n IERC20 token,\\n address spender,\\n uint256 value\\n ) 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 function safeIncreaseAllowance(\\n IERC20 token,\\n address spender,\\n uint256 value\\n ) internal {\\n uint256 newAllowance = token.allowance(address(this), spender) + value;\\n _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, newAllowance));\\n }\\n\\n function safeDecreaseAllowance(\\n IERC20 token,\\n address spender,\\n uint256 value\\n ) internal {\\n unchecked {\\n uint256 oldAllowance = token.allowance(address(this), spender);\\n require(oldAllowance >= value, \\\"SafeERC20: decreased allowance below zero\\\");\\n uint256 newAllowance = oldAllowance - value;\\n _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, newAllowance));\\n }\\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 if (returndata.length > 0) {\\n // Return data is optional\\n require(abi.decode(returndata, (bool)), \\\"SafeERC20: ERC20 operation did not succeed\\\");\\n }\\n }\\n}\\n\",\"keccak256\":\"0xc3d946432c0ddbb1f846a0d3985be71299df331b91d06732152117f62f0be2b5\",\"license\":\"MIT\"},\"@openzeppelin/contracts/utils/Address.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.5.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 *\\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://diligence.consensys.net/posts/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.5.11/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 functionCall(target, data, \\\"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(\\n address target,\\n bytes memory data,\\n uint256 value\\n ) 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 require(isContract(target), \\\"Address: call to non-contract\\\");\\n\\n (bool success, bytes memory returndata) = target.call{value: value}(data);\\n return verifyCallResult(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 require(isContract(target), \\\"Address: static call to non-contract\\\");\\n\\n (bool success, bytes memory returndata) = target.staticcall(data);\\n return verifyCallResult(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 require(isContract(target), \\\"Address: delegate call to non-contract\\\");\\n\\n (bool success, bytes memory returndata) = target.delegatecall(data);\\n return verifyCallResult(success, returndata, errorMessage);\\n }\\n\\n /**\\n * @dev Tool to verifies that a low level call was successful, and revert if it wasn't, either by bubbling the\\n * revert reason 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 // 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\\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}\\n\",\"keccak256\":\"0x2ccf9d2313a313d41a791505f2b5abfdc62191b5d4334f7f7a82691c088a1c87\",\"license\":\"MIT\"},\"contracts/chain-adapters/Ethereum_Adapter.sol\":{\"content\":\"// SPDX-License-Identifier: AGPL-3.0-only\\npragma solidity ^0.8.0;\\n\\nimport \\\"../interfaces/AdapterInterface.sol\\\";\\n\\nimport \\\"@openzeppelin/contracts/token/ERC20/IERC20.sol\\\";\\nimport \\\"@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol\\\";\\n\\n/**\\n * @notice Contract containing logic to send messages from L1 to Ethereum SpokePool.\\n * @notice This contract should always be deployed on the same chain as the HubPool, as it acts as a pass-through\\n * contract between HubPool and SpokePool on the same chain. Its named \\\"Ethereum_Adapter\\\" because a core assumption\\n * is that the HubPool will be deployed on Ethereum, so this adapter will be used to communicate between HubPool\\n * and the Ethereum_SpokePool.\\n * @dev Public functions calling external contracts do not guard against reentrancy because they are expected to be\\n * called via delegatecall, which will execute this contract's logic within the context of the originating contract.\\n * For example, the HubPool will delegatecall these functions, therefore its only necessary that the HubPool's methods\\n * that call this contract's logic guard against reentrancy.\\n */\\ncontract Ethereum_Adapter is AdapterInterface {\\n using SafeERC20 for IERC20;\\n\\n /**\\n * @notice Send message to target on Ethereum.\\n * @notice This function, and contract overall, is not useful in practice except that the HubPool\\n * expects to interact with the SpokePool via an Adapter, so when communicating to the Ethereum_SpokePool, it must\\n * send messages via this pass-through contract.\\n * @param target Contract that will receive message.\\n * @param message Data to send to target.\\n */\\n function relayMessage(address target, bytes memory message) external payable override {\\n _executeCall(target, message);\\n emit MessageRelayed(target, message);\\n }\\n\\n /**\\n * @notice Send tokens to target.\\n * @param l1Token L1 token to send.\\n * @param l2Token Unused parameter in this contract.\\n * @param amount Amount of L1 tokens to send.\\n * @param to recipient.\\n */\\n function relayTokens(\\n address l1Token,\\n address l2Token, // l2Token is unused for ethereum since we are assuming that the HubPool is only deployed\\n // on this network.\\n uint256 amount,\\n address to\\n ) external payable override {\\n IERC20(l1Token).safeTransfer(to, amount);\\n emit TokensRelayed(l1Token, l2Token, amount, to);\\n }\\n\\n // Note: this snippet of code is copied from Governor.sol. Source: https://github.com/UMAprotocol/protocol/blob/5b37ea818a28479c01e458389a83c3e736306b17/packages/core/contracts/oracle/implementation/Governor.sol#L190-L207\\n function _executeCall(address to, bytes memory data) private {\\n // Note: this snippet of code is copied from Governor.sol and modified to not include any \\\"value\\\" field.\\n // solhint-disable-next-line no-inline-assembly\\n\\n bool success;\\n assembly {\\n let inputData := add(data, 0x20)\\n let inputDataSize := mload(data)\\n // Hardcode value to be 0 for relayed governance calls in order to avoid addressing complexity of bridging\\n // value cross-chain.\\n success := call(gas(), to, 0, inputData, inputDataSize, 0, 0)\\n }\\n require(success, \\\"execute call failed\\\");\\n }\\n}\\n\",\"keccak256\":\"0xd553b891966b6d01d77af8eccc394b7554c3fce1275e6470feecb72cbe173ae4\",\"license\":\"AGPL-3.0-only\"},\"contracts/interfaces/AdapterInterface.sol\":{\"content\":\"// SPDX-License-Identifier: AGPL-3.0-only\\npragma solidity ^0.8.0;\\n\\n/**\\n * @notice Sends cross chain messages and tokens to contracts on a specific L2 network.\\n */\\n\\ninterface AdapterInterface {\\n event MessageRelayed(address target, bytes message);\\n\\n event TokensRelayed(address l1Token, address l2Token, uint256 amount, address to);\\n\\n function relayMessage(address target, bytes memory message) external payable;\\n\\n function relayTokens(\\n address l1Token,\\n address l2Token,\\n uint256 amount,\\n address to\\n ) external payable;\\n}\\n\",\"keccak256\":\"0xbd7091006acbdfe72b21ce985f964f0682a2316d9d3b38967beeb55f4ae5118c\",\"license\":\"AGPL-3.0-only\"}},\"version\":1}", + "bytecode": "0x608060405234801561001057600080fd5b506107fa806100206000396000f3fe6080604052600436106100295760003560e01c806352c8c75c1461002e578063e6eb8ade14610043575b600080fd5b61004161003c36600461056e565b610056565b005b6100416100513660046105ea565b6100dc565b61007773ffffffffffffffffffffffffffffffffffffffff85168284610123565b6040805173ffffffffffffffffffffffffffffffffffffffff868116825285811660208301528183018590528316606082015290517fd7e09655439c3932e55857df3220186e5a7f0980825f20691c2b35d941dee75b9181900360800190a150505050565b6100e682826101b5565b7f9e6c52944e331ba6270e7fe4cea2a4086bae8f7a27e1cdba07f416806f5d0ac48282604051610117929190610744565b60405180910390a15050565b6040805173ffffffffffffffffffffffffffffffffffffffff8416602482015260448082018490528251808303909101815260649091019091526020810180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff167fa9059cbb000000000000000000000000000000000000000000000000000000001790526101b0908490610237565b505050565b600060208201825160008082846000895af192505050806101b0576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601360248201527f657865637574652063616c6c206661696c65640000000000000000000000000060448201526064015b60405180910390fd5b6000610299826040518060400160405280602081526020017f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c65648152508573ffffffffffffffffffffffffffffffffffffffff166103439092919063ffffffff16565b8051909150156101b057808060200190518101906102b79190610773565b6101b0576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602a60248201527f5361666545524332303a204552433230206f7065726174696f6e20646964206e60448201527f6f74207375636365656400000000000000000000000000000000000000000000606482015260840161022e565b6060610352848460008561035c565b90505b9392505050565b6060824710156103ee576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602660248201527f416464726573733a20696e73756666696369656e742062616c616e636520666f60448201527f722063616c6c0000000000000000000000000000000000000000000000000000606482015260840161022e565b73ffffffffffffffffffffffffffffffffffffffff85163b61046c576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e7472616374000000604482015260640161022e565b6000808673ffffffffffffffffffffffffffffffffffffffff1685876040516104959190610795565b60006040518083038185875af1925050503d80600081146104d2576040519150601f19603f3d011682016040523d82523d6000602084013e6104d7565b606091505b50915091506104e78282866104f2565b979650505050505050565b60608315610501575081610355565b8251156105115782518084602001fd5b816040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161022e91906107b1565b803573ffffffffffffffffffffffffffffffffffffffff8116811461056957600080fd5b919050565b6000806000806080858703121561058457600080fd5b61058d85610545565b935061059b60208601610545565b9250604085013591506105b060608601610545565b905092959194509250565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b600080604083850312156105fd57600080fd5b61060683610545565b9150602083013567ffffffffffffffff8082111561062357600080fd5b818501915085601f83011261063757600080fd5b813581811115610649576106496105bb565b604051601f82017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0908116603f0116810190838211818310171561068f5761068f6105bb565b816040528281528860208487010111156106a857600080fd5b8260208601602083013760006020848301015280955050505050509250929050565b60005b838110156106e55781810151838201526020016106cd565b838111156106f4576000848401525b50505050565b600081518084526107128160208601602086016106ca565b601f017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0169290920160200192915050565b73ffffffffffffffffffffffffffffffffffffffff8316815260406020820152600061035260408301846106fa565b60006020828403121561078557600080fd5b8151801515811461035557600080fd5b600082516107a78184602087016106ca565b9190910192915050565b60208152600061035560208301846106fa56fea2646970667358221220c375741f9f8699c2539c58570c2a4ba4c1e9099e507ad943cb7b7cfe570455d264736f6c634300080d0033", + "deployedBytecode": "0x6080604052600436106100295760003560e01c806352c8c75c1461002e578063e6eb8ade14610043575b600080fd5b61004161003c36600461056e565b610056565b005b6100416100513660046105ea565b6100dc565b61007773ffffffffffffffffffffffffffffffffffffffff85168284610123565b6040805173ffffffffffffffffffffffffffffffffffffffff868116825285811660208301528183018590528316606082015290517fd7e09655439c3932e55857df3220186e5a7f0980825f20691c2b35d941dee75b9181900360800190a150505050565b6100e682826101b5565b7f9e6c52944e331ba6270e7fe4cea2a4086bae8f7a27e1cdba07f416806f5d0ac48282604051610117929190610744565b60405180910390a15050565b6040805173ffffffffffffffffffffffffffffffffffffffff8416602482015260448082018490528251808303909101815260649091019091526020810180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff167fa9059cbb000000000000000000000000000000000000000000000000000000001790526101b0908490610237565b505050565b600060208201825160008082846000895af192505050806101b0576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601360248201527f657865637574652063616c6c206661696c65640000000000000000000000000060448201526064015b60405180910390fd5b6000610299826040518060400160405280602081526020017f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c65648152508573ffffffffffffffffffffffffffffffffffffffff166103439092919063ffffffff16565b8051909150156101b057808060200190518101906102b79190610773565b6101b0576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602a60248201527f5361666545524332303a204552433230206f7065726174696f6e20646964206e60448201527f6f74207375636365656400000000000000000000000000000000000000000000606482015260840161022e565b6060610352848460008561035c565b90505b9392505050565b6060824710156103ee576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602660248201527f416464726573733a20696e73756666696369656e742062616c616e636520666f60448201527f722063616c6c0000000000000000000000000000000000000000000000000000606482015260840161022e565b73ffffffffffffffffffffffffffffffffffffffff85163b61046c576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e7472616374000000604482015260640161022e565b6000808673ffffffffffffffffffffffffffffffffffffffff1685876040516104959190610795565b60006040518083038185875af1925050503d80600081146104d2576040519150601f19603f3d011682016040523d82523d6000602084013e6104d7565b606091505b50915091506104e78282866104f2565b979650505050505050565b60608315610501575081610355565b8251156105115782518084602001fd5b816040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161022e91906107b1565b803573ffffffffffffffffffffffffffffffffffffffff8116811461056957600080fd5b919050565b6000806000806080858703121561058457600080fd5b61058d85610545565b935061059b60208601610545565b9250604085013591506105b060608601610545565b905092959194509250565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b600080604083850312156105fd57600080fd5b61060683610545565b9150602083013567ffffffffffffffff8082111561062357600080fd5b818501915085601f83011261063757600080fd5b813581811115610649576106496105bb565b604051601f82017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0908116603f0116810190838211818310171561068f5761068f6105bb565b816040528281528860208487010111156106a857600080fd5b8260208601602083013760006020848301015280955050505050509250929050565b60005b838110156106e55781810151838201526020016106cd565b838111156106f4576000848401525b50505050565b600081518084526107128160208601602086016106ca565b601f017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0169290920160200192915050565b73ffffffffffffffffffffffffffffffffffffffff8316815260406020820152600061035260408301846106fa565b60006020828403121561078557600080fd5b8151801515811461035557600080fd5b600082516107a78184602087016106ca565b9190910192915050565b60208152600061035560208301846106fa56fea2646970667358221220c375741f9f8699c2539c58570c2a4ba4c1e9099e507ad943cb7b7cfe570455d264736f6c634300080d0033", "devdoc": { - "details": "Public functions calling external contracts do not guard against reentrancy because they are expected to be called via delegatecall, which will execute this contract's logic within the context of the originating contract. For example, the HubPool will delegatecall these functions, therefore its only neccessary that the HubPool's methods that call this contract's logic guard against reentrancy.", + "details": "Public functions calling external contracts do not guard against reentrancy because they are expected to be called via delegatecall, which will execute this contract's logic within the context of the originating contract. For example, the HubPool will delegatecall these functions, therefore its only necessary that the HubPool's methods that call this contract's logic guard against reentrancy.", "kind": "dev", "methods": { "relayMessage(address,bytes)": { diff --git a/deployments/kovan/Ethereum_SpokePool.json b/deployments/kovan/Ethereum_SpokePool.json index fa95526df..7f353a271 100644 --- a/deployments/kovan/Ethereum_SpokePool.json +++ b/deployments/kovan/Ethereum_SpokePool.json @@ -1,5 +1,5 @@ { - "address": "0x64080593b69BE1c481f22C036CA3FF0A783AfC8e", + "address": "0x73549B5639B04090033c1E77a22eE9Aa44C2eBa0", "abi": [ { "inputs": [ @@ -22,6 +22,19 @@ "stateMutability": "nonpayable", "type": "constructor" }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "uint256", + "name": "rootBundleId", + "type": "uint256" + } + ], + "name": "EmergencyDeleteRootBundle", + "type": "event" + }, { "anonymous": false, "inputs": [ @@ -141,6 +154,12 @@ "name": "originChainId", "type": "uint256" }, + { + "indexed": false, + "internalType": "uint256", + "name": "destinationChainId", + "type": "uint256" + }, { "indexed": false, "internalType": "uint64", @@ -202,6 +221,12 @@ "name": "amount", "type": "uint256" }, + { + "indexed": false, + "internalType": "uint256", + "name": "originChainId", + "type": "uint256" + }, { "indexed": false, "internalType": "uint256", @@ -425,19 +450,6 @@ "stateMutability": "view", "type": "function" }, - { - "inputs": [], - "name": "deploymentTime", - "outputs": [ - { - "internalType": "uint32", - "name": "", - "type": "uint32" - } - ], - "stateMutability": "view", - "type": "function" - }, { "inputs": [ { @@ -489,6 +501,19 @@ "stateMutability": "view", "type": "function" }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "rootBundleId", + "type": "uint256" + } + ], + "name": "emergencyDeleteRootBundle", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, { "inputs": [ { @@ -1038,73 +1063,73 @@ "type": "receive" } ], - "transactionHash": "0x8190adbfee712f97c557b82a29ac902c76f0a681ef0b1c1dfc01aabaffd38154", + "transactionHash": "0x94c6a2939e245368dec96a8a7bc963b16178335fa09a713dc19e89b19300d0b9", "receipt": { "to": null, "from": "0x9A8f92a830A5cB89a3816e3D267CB7791c16b04D", - "contractAddress": "0x64080593b69BE1c481f22C036CA3FF0A783AfC8e", + "contractAddress": "0x73549B5639B04090033c1E77a22eE9Aa44C2eBa0", "transactionIndex": 4, - "gasUsed": "3649493", - "logsBloom": "0x00040000000000000000000000000000000000000000000000800000000000000000000000000000000800000800000000200000000000000000000000000000000000000000000000000000000000000001000000000000000000000000000000000000020000000000000000000800000800000000000000000000040000400000000000000080000000000000000040080000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000800000000000002000000080000000000000000000000020000001000000000000000000000000000000000400000000000000000080000000", - "blockHash": "0xb9da9b88cd3b1383276edec46e871d2729e1d0888ca3ff75952a8334524a3934", - "transactionHash": "0x8190adbfee712f97c557b82a29ac902c76f0a681ef0b1c1dfc01aabaffd38154", + "gasUsed": "3867944", + "logsBloom": "0x00000000000000000000000000000000000000000000400000800000000000000000000000000000000000080800000000200000000000000000000000000000000000000000000000000000000000000001000000000000000000000000000000000000020000000000000000000800000800000000000000000000040000400000000000000000000000000000000040000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000100000800000000000000000000080000400000000000000000020000001000000000000010000000000000000000400004000000000000000000000", + "blockHash": "0x8a057152f08fd2aa12d366e608d311597c11ce481f405a4d065821226ed68838", + "transactionHash": "0x94c6a2939e245368dec96a8a7bc963b16178335fa09a713dc19e89b19300d0b9", "logs": [ { "transactionIndex": 4, - "blockNumber": 30251473, - "transactionHash": "0x8190adbfee712f97c557b82a29ac902c76f0a681ef0b1c1dfc01aabaffd38154", - "address": "0x64080593b69BE1c481f22C036CA3FF0A783AfC8e", + "blockNumber": 30475937, + "transactionHash": "0x94c6a2939e245368dec96a8a7bc963b16178335fa09a713dc19e89b19300d0b9", + "address": "0x73549B5639B04090033c1E77a22eE9Aa44C2eBa0", "topics": [ "0xa9e8c42c9e7fca7f62755189a16b2f5314d43d8fb24e91ba54e6d65f9314e849", "0x0000000000000000000000009a8f92a830a5cb89a3816e3d267cb7791c16b04d" ], "data": "0x", - "logIndex": 9, - "blockHash": "0xb9da9b88cd3b1383276edec46e871d2729e1d0888ca3ff75952a8334524a3934" + "logIndex": 21, + "blockHash": "0x8a057152f08fd2aa12d366e608d311597c11ce481f405a4d065821226ed68838" }, { "transactionIndex": 4, - "blockNumber": 30251473, - "transactionHash": "0x8190adbfee712f97c557b82a29ac902c76f0a681ef0b1c1dfc01aabaffd38154", - "address": "0x64080593b69BE1c481f22C036CA3FF0A783AfC8e", + "blockNumber": 30475937, + "transactionHash": "0x94c6a2939e245368dec96a8a7bc963b16178335fa09a713dc19e89b19300d0b9", + "address": "0x73549B5639B04090033c1E77a22eE9Aa44C2eBa0", "topics": [ "0x1f17a88f67b0f49060a34bec1a4723a563620e6aa265eb640b5046dcee0759a0", - "0x00000000000000000000000026efa52a66b7b776df2196bf34a9f70327f4b26d" + "0x000000000000000000000000d449af45a032df413b497a709eed3e8c112ebce3" ], "data": "0x", - "logIndex": 10, - "blockHash": "0xb9da9b88cd3b1383276edec46e871d2729e1d0888ca3ff75952a8334524a3934" + "logIndex": 22, + "blockHash": "0x8a057152f08fd2aa12d366e608d311597c11ce481f405a4d065821226ed68838" }, { "transactionIndex": 4, - "blockNumber": 30251473, - "transactionHash": "0x8190adbfee712f97c557b82a29ac902c76f0a681ef0b1c1dfc01aabaffd38154", - "address": "0x64080593b69BE1c481f22C036CA3FF0A783AfC8e", + "blockNumber": 30475937, + "transactionHash": "0x94c6a2939e245368dec96a8a7bc963b16178335fa09a713dc19e89b19300d0b9", + "address": "0x73549B5639B04090033c1E77a22eE9Aa44C2eBa0", "topics": [ "0x8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0", "0x0000000000000000000000000000000000000000000000000000000000000000", "0x0000000000000000000000009a8f92a830a5cb89a3816e3d267cb7791c16b04d" ], "data": "0x", - "logIndex": 11, - "blockHash": "0xb9da9b88cd3b1383276edec46e871d2729e1d0888ca3ff75952a8334524a3934" + "logIndex": 23, + "blockHash": "0x8a057152f08fd2aa12d366e608d311597c11ce481f405a4d065821226ed68838" } ], - "blockNumber": 30251473, - "cumulativeGasUsed": "4025012", + "blockNumber": 30475937, + "cumulativeGasUsed": "4294165", "status": 1, "byzantium": true }, "args": [ - "0x26EfA52A66b7B776Df2196Bf34A9F70327f4b26d", + "0xD449Af45a032Df413b497A709EeD3E8C112EbcE3", "0xd0A1E359811322d97991E03f863a0C30C2cF029C", "0x0000000000000000000000000000000000000000" ], "numDeployments": 1, - "solcInputHash": "d3cc7d49c45bf725b6aea61557b961e9", - "metadata": "{\"compiler\":{\"version\":\"0.8.11+commit.d7f03943\"},\"language\":\"Solidity\",\"output\":{\"abi\":[{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_hubPool\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"_wethAddress\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"timerAddress\",\"type\":\"address\"}],\"stateMutability\":\"nonpayable\",\"type\":\"constructor\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"originToken\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"uint256\",\"name\":\"destinationChainId\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"bool\",\"name\":\"enabled\",\"type\":\"bool\"}],\"name\":\"EnabledDepositRoute\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"amountToReturn\",\"type\":\"uint256\"},{\"indexed\":true,\"internalType\":\"uint256\",\"name\":\"chainId\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"uint256[]\",\"name\":\"refundAmounts\",\"type\":\"uint256[]\"},{\"indexed\":true,\"internalType\":\"uint32\",\"name\":\"rootBundleId\",\"type\":\"uint32\"},{\"indexed\":true,\"internalType\":\"uint32\",\"name\":\"leafId\",\"type\":\"uint32\"},{\"indexed\":false,\"internalType\":\"address\",\"name\":\"l2TokenAddress\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"address[]\",\"name\":\"refundAddresses\",\"type\":\"address[]\"},{\"indexed\":false,\"internalType\":\"address\",\"name\":\"caller\",\"type\":\"address\"}],\"name\":\"ExecutedRelayerRefundRoot\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"bytes32\",\"name\":\"relayHash\",\"type\":\"bytes32\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"totalFilledAmount\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"fillAmount\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"repaymentChainId\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"originChainId\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"uint64\",\"name\":\"relayerFeePct\",\"type\":\"uint64\"},{\"indexed\":false,\"internalType\":\"uint64\",\"name\":\"realizedLpFeePct\",\"type\":\"uint64\"},{\"indexed\":false,\"internalType\":\"uint32\",\"name\":\"depositId\",\"type\":\"uint32\"},{\"indexed\":false,\"internalType\":\"address\",\"name\":\"destinationToken\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"relayer\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"depositor\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"address\",\"name\":\"recipient\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"bool\",\"name\":\"isSlowRelay\",\"type\":\"bool\"}],\"name\":\"FilledRelay\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"destinationChainId\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"uint64\",\"name\":\"relayerFeePct\",\"type\":\"uint64\"},{\"indexed\":true,\"internalType\":\"uint32\",\"name\":\"depositId\",\"type\":\"uint32\"},{\"indexed\":false,\"internalType\":\"uint32\",\"name\":\"quoteTimestamp\",\"type\":\"uint32\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"originToken\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"address\",\"name\":\"recipient\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"depositor\",\"type\":\"address\"}],\"name\":\"FundsDeposited\",\"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\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"uint32\",\"name\":\"rootBundleId\",\"type\":\"uint32\"},{\"indexed\":false,\"internalType\":\"bytes32\",\"name\":\"relayerRefundRoot\",\"type\":\"bytes32\"},{\"indexed\":false,\"internalType\":\"bytes32\",\"name\":\"slowRelayRoot\",\"type\":\"bytes32\"}],\"name\":\"RelayedRootBundle\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"uint64\",\"name\":\"newRelayerFeePct\",\"type\":\"uint64\"},{\"indexed\":true,\"internalType\":\"uint32\",\"name\":\"depositId\",\"type\":\"uint32\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"depositor\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"bytes\",\"name\":\"depositorSignature\",\"type\":\"bytes\"}],\"name\":\"RequestedSpeedUpDeposit\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"uint32\",\"name\":\"newBuffer\",\"type\":\"uint32\"}],\"name\":\"SetDepositQuoteTimeBuffer\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"newHubPool\",\"type\":\"address\"}],\"name\":\"SetHubPool\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"newAdmin\",\"type\":\"address\"}],\"name\":\"SetXDomainAdmin\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"amountToReturn\",\"type\":\"uint256\"},{\"indexed\":true,\"internalType\":\"uint256\",\"name\":\"chainId\",\"type\":\"uint256\"},{\"indexed\":true,\"internalType\":\"uint32\",\"name\":\"leafId\",\"type\":\"uint32\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"l2TokenAddress\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"address\",\"name\":\"caller\",\"type\":\"address\"}],\"name\":\"TokensBridged\",\"type\":\"event\"},{\"inputs\":[],\"name\":\"chainId\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"crossDomainAdmin\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"deploymentTime\",\"outputs\":[{\"internalType\":\"uint32\",\"name\":\"\",\"type\":\"uint32\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"recipient\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"originToken\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"destinationChainId\",\"type\":\"uint256\"},{\"internalType\":\"uint64\",\"name\":\"relayerFeePct\",\"type\":\"uint64\"},{\"internalType\":\"uint32\",\"name\":\"quoteTimestamp\",\"type\":\"uint32\"}],\"name\":\"deposit\",\"outputs\":[],\"stateMutability\":\"payable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"depositQuoteTimeBuffer\",\"outputs\":[{\"internalType\":\"uint32\",\"name\":\"\",\"type\":\"uint32\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"name\":\"enabledDepositRoutes\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint32\",\"name\":\"rootBundleId\",\"type\":\"uint32\"},{\"components\":[{\"internalType\":\"uint256\",\"name\":\"amountToReturn\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"chainId\",\"type\":\"uint256\"},{\"internalType\":\"uint256[]\",\"name\":\"refundAmounts\",\"type\":\"uint256[]\"},{\"internalType\":\"uint32\",\"name\":\"leafId\",\"type\":\"uint32\"},{\"internalType\":\"address\",\"name\":\"l2TokenAddress\",\"type\":\"address\"},{\"internalType\":\"address[]\",\"name\":\"refundAddresses\",\"type\":\"address[]\"}],\"internalType\":\"struct SpokePoolInterface.RelayerRefundLeaf\",\"name\":\"relayerRefundLeaf\",\"type\":\"tuple\"},{\"internalType\":\"bytes32[]\",\"name\":\"proof\",\"type\":\"bytes32[]\"}],\"name\":\"executeRelayerRefundRoot\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"depositor\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"recipient\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"destinationToken\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"originChainId\",\"type\":\"uint256\"},{\"internalType\":\"uint64\",\"name\":\"realizedLpFeePct\",\"type\":\"uint64\"},{\"internalType\":\"uint64\",\"name\":\"relayerFeePct\",\"type\":\"uint64\"},{\"internalType\":\"uint32\",\"name\":\"depositId\",\"type\":\"uint32\"},{\"internalType\":\"uint32\",\"name\":\"rootBundleId\",\"type\":\"uint32\"},{\"internalType\":\"bytes32[]\",\"name\":\"proof\",\"type\":\"bytes32[]\"}],\"name\":\"executeSlowRelayRoot\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"depositor\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"recipient\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"destinationToken\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"maxTokensToSend\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"repaymentChainId\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"originChainId\",\"type\":\"uint256\"},{\"internalType\":\"uint64\",\"name\":\"realizedLpFeePct\",\"type\":\"uint64\"},{\"internalType\":\"uint64\",\"name\":\"relayerFeePct\",\"type\":\"uint64\"},{\"internalType\":\"uint32\",\"name\":\"depositId\",\"type\":\"uint32\"}],\"name\":\"fillRelay\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"depositor\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"recipient\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"destinationToken\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"maxTokensToSend\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"repaymentChainId\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"originChainId\",\"type\":\"uint256\"},{\"internalType\":\"uint64\",\"name\":\"realizedLpFeePct\",\"type\":\"uint64\"},{\"internalType\":\"uint64\",\"name\":\"relayerFeePct\",\"type\":\"uint64\"},{\"internalType\":\"uint64\",\"name\":\"newRelayerFeePct\",\"type\":\"uint64\"},{\"internalType\":\"uint32\",\"name\":\"depositId\",\"type\":\"uint32\"},{\"internalType\":\"bytes\",\"name\":\"depositorSignature\",\"type\":\"bytes\"}],\"name\":\"fillRelayWithUpdatedFee\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"getCurrentTime\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"hubPool\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes[]\",\"name\":\"data\",\"type\":\"bytes[]\"}],\"name\":\"multicall\",\"outputs\":[{\"internalType\":\"bytes[]\",\"name\":\"results\",\"type\":\"bytes[]\"}],\"stateMutability\":\"payable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"numberOfDeposits\",\"outputs\":[{\"internalType\":\"uint32\",\"name\":\"\",\"type\":\"uint32\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"owner\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"\",\"type\":\"bytes32\"}],\"name\":\"relayFills\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"relayerRefundRoot\",\"type\":\"bytes32\"},{\"internalType\":\"bytes32\",\"name\":\"slowRelayRoot\",\"type\":\"bytes32\"}],\"name\":\"relayRootBundle\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"renounceOwnership\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"name\":\"rootBundles\",\"outputs\":[{\"internalType\":\"bytes32\",\"name\":\"slowRelayRoot\",\"type\":\"bytes32\"},{\"internalType\":\"bytes32\",\"name\":\"relayerRefundRoot\",\"type\":\"bytes32\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"newCrossDomainAdmin\",\"type\":\"address\"}],\"name\":\"setCrossDomainAdmin\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"time\",\"type\":\"uint256\"}],\"name\":\"setCurrentTime\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint32\",\"name\":\"newDepositQuoteTimeBuffer\",\"type\":\"uint32\"}],\"name\":\"setDepositQuoteTimeBuffer\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"originToken\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"destinationChainId\",\"type\":\"uint256\"},{\"internalType\":\"bool\",\"name\":\"enabled\",\"type\":\"bool\"}],\"name\":\"setEnableRoute\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"newHubPool\",\"type\":\"address\"}],\"name\":\"setHubPool\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"depositor\",\"type\":\"address\"},{\"internalType\":\"uint64\",\"name\":\"newRelayerFeePct\",\"type\":\"uint64\"},{\"internalType\":\"uint32\",\"name\":\"depositId\",\"type\":\"uint32\"},{\"internalType\":\"bytes\",\"name\":\"depositorSignature\",\"type\":\"bytes\"}],\"name\":\"speedUpDeposit\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"timerAddress\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"newOwner\",\"type\":\"address\"}],\"name\":\"transferOwnership\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"weth\",\"outputs\":[{\"internalType\":\"contract WETH9\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"stateMutability\":\"payable\",\"type\":\"receive\"}],\"devdoc\":{\"kind\":\"dev\",\"methods\":{\"chainId()\":{\"details\":\"Some L2s like ZKSync don't support the CHAIN_ID opcode so we allow the implementer to override this.\"},\"constructor\":{\"params\":{\"_hubPool\":\"Hub pool address to set. Can be changed by admin.\",\"_wethAddress\":\"Weth address for this network to set.\",\"timerAddress\":\"Timer address to set.\"}},\"deposit(address,address,uint256,uint256,uint64,uint32)\":{\"params\":{\"amount\":\"Amount of tokens to deposit. Will be amount of tokens to receive less fees.\",\"destinationChainId\":\"Denotes network where user will receive funds from SpokePool by a relayer.\",\"originToken\":\"Token to lock into this contract to initiate deposit.\",\"quoteTimestamp\":\"Timestamp used by relayers to compute this deposit's realizedLPFeePct which is paid to LP pool on HubPool.\",\"recipient\":\"Address to receive funds at on destination chain.\",\"relayerFeePct\":\"% of deposit amount taken out to incentivize a fast relayer.\"}},\"executeRelayerRefundRoot(uint32,(uint256,uint256,uint256[],uint32,address,address[]),bytes32[])\":{\"params\":{\"proof\":\"Inclusion proof for this leaf in relayer refund root in root bundle.\",\"relayerRefundLeaf\":\"Contains all data neccessary to reconstruct leaf contained in root bundle and to refund relayer. This data structure is explained in detail in the SpokePoolInterface.\",\"rootBundleId\":\"Unique ID of root bundle containing relayer refund root that this leaf is contained in.\"}},\"executeSlowRelayRoot(address,address,address,uint256,uint256,uint64,uint64,uint32,uint32,bytes32[])\":{\"params\":{\"amount\":\"Full size of the deposit.\",\"depositId\":\"Unique deposit ID on origin spoke pool.\",\"depositor\":\"Depositor on origin chain who set this chain as the destination chain.\",\"destinationToken\":\"Token to send to recipient. Should be mapped to the origin token, origin chain ID and this chain ID via a mapping on the HubPool.\",\"originChainId\":\"Chain of SpokePool where deposit originated.\",\"proof\":\"Inclusion proof for this leaf in slow relay root in root bundle.\",\"realizedLpFeePct\":\"Fee % based on L1 HubPool utilization at deposit quote time. Deterministic based on quote time.\",\"recipient\":\"Specified recipient on this chain.\",\"relayerFeePct\":\"Original fee % to keep as relayer set by depositor.\",\"rootBundleId\":\"Unique ID of root bundle containing slow relay root that this leaf is contained in.\"}},\"fillRelay(address,address,address,uint256,uint256,uint256,uint256,uint64,uint64,uint32)\":{\"params\":{\"amount\":\"Full size of the deposit.\",\"depositId\":\"Unique deposit ID on origin spoke pool.\",\"depositor\":\"Depositor on origin chain who set this chain as the destination chain.\",\"destinationToken\":\"Token to send to recipient. Should be mapped to the origin token, origin chain ID and this chain ID via a mapping on the HubPool.\",\"maxTokensToSend\":\"Max amount of tokens to send recipient. If higher than amount, then caller will send recipient the full relay amount.\",\"originChainId\":\"Chain of SpokePool where deposit originated.\",\"realizedLpFeePct\":\"Fee % based on L1 HubPool utilization at deposit quote time. Deterministic based on quote time.\",\"recipient\":\"Specified recipient on this chain.\",\"relayerFeePct\":\"Fee % to keep as relayer, specified by depositor.\",\"repaymentChainId\":\"Chain of SpokePool where relayer wants to be refunded after the challenge window has passed.\"}},\"fillRelayWithUpdatedFee(address,address,address,uint256,uint256,uint256,uint256,uint64,uint64,uint64,uint32,bytes)\":{\"params\":{\"amount\":\"Full size of the deposit.\",\"depositId\":\"Unique deposit ID on origin spoke pool.\",\"depositor\":\"Depositor on origin chain who set this chain as the destination chain.\",\"depositorSignature\":\"Depositor-signed message containing updated fee %.\",\"destinationToken\":\"Token to send to recipient. Should be mapped to the origin token, origin chain ID and this chain ID via a mapping on the HubPool.\",\"maxTokensToSend\":\"Max amount of tokens to send recipient. If higher than amount, then caller will send recipient the full relay amount.\",\"newRelayerFeePct\":\"New fee % to keep as relayer also specified by depositor.\",\"originChainId\":\"Chain of SpokePool where deposit originated.\",\"realizedLpFeePct\":\"Fee % based on L1 HubPool utilization at deposit quote time. Deterministic based on quote time.\",\"recipient\":\"Specified recipient on this chain.\",\"relayerFeePct\":\"Original fee % to keep as relayer set by depositor.\",\"repaymentChainId\":\"Chain of SpokePool where relayer wants to be refunded after the challenge window has passed.\"}},\"getCurrentTime()\":{\"returns\":{\"_0\":\"uint for the current Testable timestamp.\"}},\"owner()\":{\"details\":\"Returns the address of the current owner.\"},\"relayRootBundle(bytes32,bytes32)\":{\"params\":{\"relayerRefundRoot\":\"Merkle root containing relayer refund leaves that can be individually executed via executeRelayerRefundRoot().\",\"slowRelayRoot\":\"Merkle root containing slow relay fulfillment leaves that can be individually executed via executeSlowRelayRoot().\"}},\"renounceOwnership()\":{\"details\":\"Leaves the contract without owner. It will not be possible to call `onlyOwner` functions anymore. Can only be called by the current owner. NOTE: Renouncing ownership will leave the contract without an owner, thereby removing any functionality that is only available to the owner.\"},\"setCrossDomainAdmin(address)\":{\"params\":{\"newCrossDomainAdmin\":\"New cross domain admin.\"}},\"setCurrentTime(uint256)\":{\"details\":\"Will revert if not running in test mode.\",\"params\":{\"time\":\"timestamp to set current Testable time to.\"}},\"setDepositQuoteTimeBuffer(uint32)\":{\"params\":{\"newDepositQuoteTimeBuffer\":\"New quote time buffer.\"}},\"setEnableRoute(address,uint256,bool)\":{\"params\":{\"destinationChainId\":\"Chain ID for where depositor wants to receive funds.\",\"enabled\":\"True to enable deposits, False otherwise.\",\"originToken\":\"Token that depositor can deposit to this contract.\"}},\"setHubPool(address)\":{\"params\":{\"newHubPool\":\"New hub pool.\"}},\"speedUpDeposit(address,uint64,uint32,bytes)\":{\"params\":{\"depositId\":\"Deposit to update fee for that originated in this contract.\",\"depositor\":\"Signer of the update fee message who originally submitted the deposit. If the deposit doesn't exist, then the relayer will not be able to fill any relay, so the caller should validate that the depositor did in fact submit a relay.\",\"depositorSignature\":\"Signed message containing the depositor address, this contract chain ID, the updated relayer fee %, and the deposit ID. This signature is produced by signing a hash of data according to the EIP-191 standard. See more in the _verifyUpdateRelayerFeeMessage() comments.\",\"newRelayerFeePct\":\"New relayer fee that relayers can use.\"}},\"transferOwnership(address)\":{\"details\":\"Transfers ownership of the contract to a new account (`newOwner`). Can only be called by the current owner.\"}},\"version\":1},\"userdoc\":{\"kind\":\"user\",\"methods\":{\"chainId()\":{\"notice\":\"Returns chain ID for this network.\"},\"constructor\":{\"notice\":\"Construct the Ethereum SpokePool.\"},\"deposit(address,address,uint256,uint256,uint64,uint32)\":{\"notice\":\"Called by user to bridge funds from origin to destination chain. Depositor will effectively lock tokens in this contract and receive a destination token on the destination chain. The origin => destination token mapping is stored on the L1 HubPool.The caller must first approve this contract to spend amount of originToken.The originToken => destinationChainId must be enabled.This method is payable because the caller is able to deposit ETH if the originToken is WETH and this function will handle wrapping ETH.\"},\"executeRelayerRefundRoot(uint32,(uint256,uint256,uint256[],uint32,address,address[]),bytes32[])\":{\"notice\":\"Executes a relayer refund leaf stored as part of a root bundle. Will send the relayer the amount they sent to the recipient plus a relayer fee.\"},\"executeSlowRelayRoot(address,address,address,uint256,uint256,uint64,uint64,uint32,uint32,bytes32[])\":{\"notice\":\"Executes a slow relay leaf stored as part of a root bundle. Will send the full amount remaining in the relay to the recipient, less fees.\"},\"fillRelay(address,address,address,uint256,uint256,uint256,uint256,uint64,uint64,uint32)\":{\"notice\":\"Called by relayer to fulfill part of a deposit by sending destination tokens to the receipient. Relayer is expected to pass in unique identifying information for deposit that they want to fulfill, and this relay submission will be validated by off-chain data workers who can dispute this relay if any part is invalid. If the relay is valid, then the relayer will be refunded on their desired repayment chain. If relay is invalid, then relayer will not receive any refund.All of the deposit data can be found via on-chain events from the origin SpokePool, except for the realizedLpFeePct which is a function of the HubPool's utilization at the deposit quote time. This fee % is deterministic based on the quote time, so the relayer should just compute it using the canonical algorithm as described in a UMIP linked to the HubPool's identifier.\"},\"fillRelayWithUpdatedFee(address,address,address,uint256,uint256,uint256,uint256,uint64,uint64,uint64,uint32,bytes)\":{\"notice\":\"Called by relayer to execute same logic as calling fillRelay except that relayer is using an updated relayer fee %. The fee % must have been emitted in a message cryptographically signed by the depositor.By design, the depositor probably emitted the message with the updated fee by calling speedUpRelay().\"},\"getCurrentTime()\":{\"notice\":\"Gets the current time. Will return the last time set in `setCurrentTime` if running in test mode. Otherwise, it will return the block timestamp.\"},\"relayRootBundle(bytes32,bytes32)\":{\"notice\":\"This method stores a new root bundle in this contract that can be executed to refund relayers, fulfill slow relays, and send funds back to the HubPool on L1. This method can only be called by the admin and is designed to be called as part of a cross-chain message from the HubPool's executeRootBundle method.\"},\"setCrossDomainAdmin(address)\":{\"notice\":\"Change cross domain admin address. Callable by admin only.\"},\"setCurrentTime(uint256)\":{\"notice\":\"Sets the current time.\"},\"setDepositQuoteTimeBuffer(uint32)\":{\"notice\":\"Change allowance for deposit quote time to differ from current block time. Callable by admin only.\"},\"setEnableRoute(address,uint256,bool)\":{\"notice\":\"Enable/Disable an origin token => destination chain ID route for deposits. Callable by admin only.\"},\"setHubPool(address)\":{\"notice\":\"Change L1 hub pool address. Callable by admin only.\"},\"speedUpDeposit(address,uint64,uint32,bytes)\":{\"notice\":\"Convenience method that depositor can use to signal to relayer to use updated fee.Relayer should only use events emitted by this function to submit fills with updated fees, otherwise they risk their fills getting disputed for being invalid, for example if the depositor never actually signed the update fee message.This function will revert if the depositor did not sign a message containing the updated fee for the deposit ID stored in this contract. If the deposit ID is for another contract, or the depositor address is incorrect, or the updated fee is incorrect, then the signature will not match and this function will revert.\"}},\"notice\":\"Ethereum L1 specific SpokePool. Used on Ethereum L1 to facilitate L2->L1 transfers.\",\"version\":1}},\"settings\":{\"compilationTarget\":{\"contracts/Ethereum_SpokePool.sol\":\"Ethereum_SpokePool\"},\"evmVersion\":\"london\",\"libraries\":{},\"metadata\":{\"bytecodeHash\":\"ipfs\",\"useLiteralContent\":true},\"optimizer\":{\"enabled\":true,\"runs\":1000000},\"remappings\":[]},\"sources\":{\"@openzeppelin/contracts/access/Ownable.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts v4.4.1 (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 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 called by any account other than the owner.\\n */\\n modifier onlyOwner() {\\n require(owner() == _msgSender(), \\\"Ownable: caller is not the owner\\\");\\n _;\\n }\\n\\n /**\\n * @dev Leaves the contract without owner. It will not be possible to call\\n * `onlyOwner` functions anymore. Can only be called by the current owner.\\n *\\n * NOTE: Renouncing ownership will leave the contract without an owner,\\n * thereby removing 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\",\"keccak256\":\"0x24e0364e503a9bbde94c715d26573a76f14cd2a202d45f96f52134ab806b67b9\",\"license\":\"MIT\"},\"@openzeppelin/contracts/interfaces/IERC1271.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts v4.4.1 (interfaces/IERC1271.sol)\\n\\npragma solidity ^0.8.0;\\n\\n/**\\n * @dev Interface of the ERC1271 standard signature validation method for\\n * contracts as defined in https://eips.ethereum.org/EIPS/eip-1271[ERC-1271].\\n *\\n * _Available since v4.1._\\n */\\ninterface IERC1271 {\\n /**\\n * @dev Should return whether the signature provided is valid for the provided data\\n * @param hash Hash of the data to be signed\\n * @param signature Signature byte array associated with _data\\n */\\n function isValidSignature(bytes32 hash, bytes memory signature) external view returns (bytes4 magicValue);\\n}\\n\",\"keccak256\":\"0x0705a4b1b86d7b0bd8432118f226ba139c44b9dcaba0a6eafba2dd7d0639c544\",\"license\":\"MIT\"},\"@openzeppelin/contracts/token/ERC20/IERC20.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.5.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 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(\\n address from,\\n address to,\\n uint256 amount\\n ) external returns (bool);\\n\\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\",\"keccak256\":\"0xbbc8ac883ac3c0078ce5ad3e288fbb3ffcc8a30c3a98c0fda0114d64fc44fca2\",\"license\":\"MIT\"},\"@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts v4.4.1 (token/ERC20/utils/SafeERC20.sol)\\n\\npragma solidity ^0.8.0;\\n\\nimport \\\"../IERC20.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 function safeTransfer(\\n IERC20 token,\\n address to,\\n uint256 value\\n ) internal {\\n _callOptionalReturn(token, abi.encodeWithSelector(token.transfer.selector, to, value));\\n }\\n\\n function safeTransferFrom(\\n IERC20 token,\\n address from,\\n address to,\\n uint256 value\\n ) 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(\\n IERC20 token,\\n address spender,\\n uint256 value\\n ) 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 function safeIncreaseAllowance(\\n IERC20 token,\\n address spender,\\n uint256 value\\n ) internal {\\n uint256 newAllowance = token.allowance(address(this), spender) + value;\\n _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, newAllowance));\\n }\\n\\n function safeDecreaseAllowance(\\n IERC20 token,\\n address spender,\\n uint256 value\\n ) internal {\\n unchecked {\\n uint256 oldAllowance = token.allowance(address(this), spender);\\n require(oldAllowance >= value, \\\"SafeERC20: decreased allowance below zero\\\");\\n uint256 newAllowance = oldAllowance - value;\\n _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, newAllowance));\\n }\\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 if (returndata.length > 0) {\\n // Return data is optional\\n require(abi.decode(returndata, (bool)), \\\"SafeERC20: ERC20 operation did not succeed\\\");\\n }\\n }\\n}\\n\",\"keccak256\":\"0xc3d946432c0ddbb1f846a0d3985be71299df331b91d06732152117f62f0be2b5\",\"license\":\"MIT\"},\"@openzeppelin/contracts/utils/Address.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.5.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 *\\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://diligence.consensys.net/posts/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.5.11/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 functionCall(target, data, \\\"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(\\n address target,\\n bytes memory data,\\n uint256 value\\n ) 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 require(isContract(target), \\\"Address: call to non-contract\\\");\\n\\n (bool success, bytes memory returndata) = target.call{value: value}(data);\\n return verifyCallResult(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 require(isContract(target), \\\"Address: static call to non-contract\\\");\\n\\n (bool success, bytes memory returndata) = target.staticcall(data);\\n return verifyCallResult(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 require(isContract(target), \\\"Address: delegate call to non-contract\\\");\\n\\n (bool success, bytes memory returndata) = target.delegatecall(data);\\n return verifyCallResult(success, returndata, errorMessage);\\n }\\n\\n /**\\n * @dev Tool to verifies that a low level call was successful, and revert if it wasn't, either by bubbling the\\n * revert reason 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 // 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\\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}\\n\",\"keccak256\":\"0x2ccf9d2313a313d41a791505f2b5abfdc62191b5d4334f7f7a82691c088a1c87\",\"license\":\"MIT\"},\"@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\",\"keccak256\":\"0xe2e337e6dde9ef6b680e07338c493ebea1b5fd09b43424112868e9cc1706bca7\",\"license\":\"MIT\"},\"@openzeppelin/contracts/utils/Strings.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts v4.4.1 (utils/Strings.sol)\\n\\npragma solidity ^0.8.0;\\n\\n/**\\n * @dev String operations.\\n */\\nlibrary Strings {\\n bytes16 private constant _HEX_SYMBOLS = \\\"0123456789abcdef\\\";\\n\\n /**\\n * @dev Converts a `uint256` to its ASCII `string` decimal representation.\\n */\\n function toString(uint256 value) internal pure returns (string memory) {\\n // Inspired by OraclizeAPI's implementation - MIT licence\\n // https://github.com/oraclize/ethereum-api/blob/b42146b063c7d6ee1358846c198246239e9360e8/oraclizeAPI_0.4.25.sol\\n\\n if (value == 0) {\\n return \\\"0\\\";\\n }\\n uint256 temp = value;\\n uint256 digits;\\n while (temp != 0) {\\n digits++;\\n temp /= 10;\\n }\\n bytes memory buffer = new bytes(digits);\\n while (value != 0) {\\n digits -= 1;\\n buffer[digits] = bytes1(uint8(48 + uint256(value % 10)));\\n value /= 10;\\n }\\n return string(buffer);\\n }\\n\\n /**\\n * @dev Converts a `uint256` to its ASCII `string` hexadecimal representation.\\n */\\n function toHexString(uint256 value) internal pure returns (string memory) {\\n if (value == 0) {\\n return \\\"0x00\\\";\\n }\\n uint256 temp = value;\\n uint256 length = 0;\\n while (temp != 0) {\\n length++;\\n temp >>= 8;\\n }\\n return toHexString(value, length);\\n }\\n\\n /**\\n * @dev Converts a `uint256` to its ASCII `string` hexadecimal representation with fixed length.\\n */\\n function toHexString(uint256 value, uint256 length) internal pure returns (string memory) {\\n bytes memory buffer = new bytes(2 * length + 2);\\n buffer[0] = \\\"0\\\";\\n buffer[1] = \\\"x\\\";\\n for (uint256 i = 2 * length + 1; i > 1; --i) {\\n buffer[i] = _HEX_SYMBOLS[value & 0xf];\\n value >>= 4;\\n }\\n require(value == 0, \\\"Strings: hex length insufficient\\\");\\n return string(buffer);\\n }\\n}\\n\",\"keccak256\":\"0x32c202bd28995dd20c4347b7c6467a6d3241c74c8ad3edcbb610cd9205916c45\",\"license\":\"MIT\"},\"@openzeppelin/contracts/utils/cryptography/ECDSA.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.5.0) (utils/cryptography/ECDSA.sol)\\n\\npragma solidity ^0.8.0;\\n\\nimport \\\"../Strings.sol\\\";\\n\\n/**\\n * @dev Elliptic Curve Digital Signature Algorithm (ECDSA) operations.\\n *\\n * These functions can be used to verify that a message was signed by the holder\\n * of the private keys of a given address.\\n */\\nlibrary ECDSA {\\n enum RecoverError {\\n NoError,\\n InvalidSignature,\\n InvalidSignatureLength,\\n InvalidSignatureS,\\n InvalidSignatureV\\n }\\n\\n function _throwError(RecoverError error) private pure {\\n if (error == RecoverError.NoError) {\\n return; // no error: do nothing\\n } else if (error == RecoverError.InvalidSignature) {\\n revert(\\\"ECDSA: invalid signature\\\");\\n } else if (error == RecoverError.InvalidSignatureLength) {\\n revert(\\\"ECDSA: invalid signature length\\\");\\n } else if (error == RecoverError.InvalidSignatureS) {\\n revert(\\\"ECDSA: invalid signature 's' value\\\");\\n } else if (error == RecoverError.InvalidSignatureV) {\\n revert(\\\"ECDSA: invalid signature 'v' value\\\");\\n }\\n }\\n\\n /**\\n * @dev Returns the address that signed a hashed message (`hash`) with\\n * `signature` or error string. This address can then be used for verification purposes.\\n *\\n * The `ecrecover` EVM opcode allows for malleable (non-unique) signatures:\\n * this function rejects them by requiring the `s` value to be in the lower\\n * half order, and the `v` value to be either 27 or 28.\\n *\\n * IMPORTANT: `hash` _must_ be the result of a hash operation for the\\n * verification to be secure: it is possible to craft signatures that\\n * recover to arbitrary addresses for non-hashed data. A safe way to ensure\\n * this is by receiving a hash of the original message (which may otherwise\\n * be too long), and then calling {toEthSignedMessageHash} on it.\\n *\\n * Documentation for signature generation:\\n * - with https://web3js.readthedocs.io/en/v1.3.4/web3-eth-accounts.html#sign[Web3.js]\\n * - with https://docs.ethers.io/v5/api/signer/#Signer-signMessage[ethers]\\n *\\n * _Available since v4.3._\\n */\\n function tryRecover(bytes32 hash, bytes memory signature) internal pure returns (address, RecoverError) {\\n // Check the signature length\\n // - case 65: r,s,v signature (standard)\\n // - case 64: r,vs signature (cf https://eips.ethereum.org/EIPS/eip-2098) _Available since v4.1._\\n if (signature.length == 65) {\\n bytes32 r;\\n bytes32 s;\\n uint8 v;\\n // ecrecover takes the signature parameters, and the only way to get them\\n // currently is to use assembly.\\n assembly {\\n r := mload(add(signature, 0x20))\\n s := mload(add(signature, 0x40))\\n v := byte(0, mload(add(signature, 0x60)))\\n }\\n return tryRecover(hash, v, r, s);\\n } else if (signature.length == 64) {\\n bytes32 r;\\n bytes32 vs;\\n // ecrecover takes the signature parameters, and the only way to get them\\n // currently is to use assembly.\\n assembly {\\n r := mload(add(signature, 0x20))\\n vs := mload(add(signature, 0x40))\\n }\\n return tryRecover(hash, r, vs);\\n } else {\\n return (address(0), RecoverError.InvalidSignatureLength);\\n }\\n }\\n\\n /**\\n * @dev Returns the address that signed a hashed message (`hash`) with\\n * `signature`. This address can then be used for verification purposes.\\n *\\n * The `ecrecover` EVM opcode allows for malleable (non-unique) signatures:\\n * this function rejects them by requiring the `s` value to be in the lower\\n * half order, and the `v` value to be either 27 or 28.\\n *\\n * IMPORTANT: `hash` _must_ be the result of a hash operation for the\\n * verification to be secure: it is possible to craft signatures that\\n * recover to arbitrary addresses for non-hashed data. A safe way to ensure\\n * this is by receiving a hash of the original message (which may otherwise\\n * be too long), and then calling {toEthSignedMessageHash} on it.\\n */\\n function recover(bytes32 hash, bytes memory signature) internal pure returns (address) {\\n (address recovered, RecoverError error) = tryRecover(hash, signature);\\n _throwError(error);\\n return recovered;\\n }\\n\\n /**\\n * @dev Overload of {ECDSA-tryRecover} that receives the `r` and `vs` short-signature fields separately.\\n *\\n * See https://eips.ethereum.org/EIPS/eip-2098[EIP-2098 short signatures]\\n *\\n * _Available since v4.3._\\n */\\n function tryRecover(\\n bytes32 hash,\\n bytes32 r,\\n bytes32 vs\\n ) internal pure returns (address, RecoverError) {\\n bytes32 s = vs & bytes32(0x7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff);\\n uint8 v = uint8((uint256(vs) >> 255) + 27);\\n return tryRecover(hash, v, r, s);\\n }\\n\\n /**\\n * @dev Overload of {ECDSA-recover} that receives the `r and `vs` short-signature fields separately.\\n *\\n * _Available since v4.2._\\n */\\n function recover(\\n bytes32 hash,\\n bytes32 r,\\n bytes32 vs\\n ) internal pure returns (address) {\\n (address recovered, RecoverError error) = tryRecover(hash, r, vs);\\n _throwError(error);\\n return recovered;\\n }\\n\\n /**\\n * @dev Overload of {ECDSA-tryRecover} that receives the `v`,\\n * `r` and `s` signature fields separately.\\n *\\n * _Available since v4.3._\\n */\\n function tryRecover(\\n bytes32 hash,\\n uint8 v,\\n bytes32 r,\\n bytes32 s\\n ) internal pure returns (address, RecoverError) {\\n // EIP-2 still allows signature malleability for ecrecover(). Remove this possibility and make the signature\\n // unique. Appendix F in the Ethereum Yellow paper (https://ethereum.github.io/yellowpaper/paper.pdf), defines\\n // the valid range for s in (301): 0 < s < secp256k1n \\u00f7 2 + 1, and for v in (302): v \\u2208 {27, 28}. Most\\n // signatures from current libraries generate a unique signature with an s-value in the lower half order.\\n //\\n // If your library generates malleable signatures, such as s-values in the upper range, calculate a new s-value\\n // with 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFEBAAEDCE6AF48A03BBFD25E8CD0364141 - s1 and flip v from 27 to 28 or\\n // vice versa. If your library also generates signatures with 0/1 for v instead 27/28, add 27 to v to accept\\n // these malleable signatures as well.\\n if (uint256(s) > 0x7FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF5D576E7357A4501DDFE92F46681B20A0) {\\n return (address(0), RecoverError.InvalidSignatureS);\\n }\\n if (v != 27 && v != 28) {\\n return (address(0), RecoverError.InvalidSignatureV);\\n }\\n\\n // If the signature is valid (and not malleable), return the signer address\\n address signer = ecrecover(hash, v, r, s);\\n if (signer == address(0)) {\\n return (address(0), RecoverError.InvalidSignature);\\n }\\n\\n return (signer, RecoverError.NoError);\\n }\\n\\n /**\\n * @dev Overload of {ECDSA-recover} that receives the `v`,\\n * `r` and `s` signature fields separately.\\n */\\n function recover(\\n bytes32 hash,\\n uint8 v,\\n bytes32 r,\\n bytes32 s\\n ) internal pure returns (address) {\\n (address recovered, RecoverError error) = tryRecover(hash, v, r, s);\\n _throwError(error);\\n return recovered;\\n }\\n\\n /**\\n * @dev Returns an Ethereum Signed Message, created from a `hash`. This\\n * produces hash corresponding to the one signed with the\\n * https://eth.wiki/json-rpc/API#eth_sign[`eth_sign`]\\n * JSON-RPC method as part of EIP-191.\\n *\\n * See {recover}.\\n */\\n function toEthSignedMessageHash(bytes32 hash) internal pure returns (bytes32) {\\n // 32 is the length in bytes of hash,\\n // enforced by the type signature above\\n return keccak256(abi.encodePacked(\\\"\\\\x19Ethereum Signed Message:\\\\n32\\\", hash));\\n }\\n\\n /**\\n * @dev Returns an Ethereum Signed Message, created from `s`. This\\n * produces hash corresponding to the one signed with the\\n * https://eth.wiki/json-rpc/API#eth_sign[`eth_sign`]\\n * JSON-RPC method as part of EIP-191.\\n *\\n * See {recover}.\\n */\\n function toEthSignedMessageHash(bytes memory s) internal pure returns (bytes32) {\\n return keccak256(abi.encodePacked(\\\"\\\\x19Ethereum Signed Message:\\\\n\\\", Strings.toString(s.length), s));\\n }\\n\\n /**\\n * @dev Returns an Ethereum Signed Typed Data, created from a\\n * `domainSeparator` and a `structHash`. This produces hash corresponding\\n * to the one signed with the\\n * https://eips.ethereum.org/EIPS/eip-712[`eth_signTypedData`]\\n * JSON-RPC method as part of EIP-712.\\n *\\n * See {recover}.\\n */\\n function toTypedDataHash(bytes32 domainSeparator, bytes32 structHash) internal pure returns (bytes32) {\\n return keccak256(abi.encodePacked(\\\"\\\\x19\\\\x01\\\", domainSeparator, structHash));\\n }\\n}\\n\",\"keccak256\":\"0x3c07f43e60e099b3b157243b3152722e73b80eeb7985c2cd73712828d7f7da29\",\"license\":\"MIT\"},\"@openzeppelin/contracts/utils/cryptography/MerkleProof.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.5.0) (utils/cryptography/MerkleProof.sol)\\n\\npragma solidity ^0.8.0;\\n\\n/**\\n * @dev These functions deal with verification of Merkle Trees proofs.\\n *\\n * The proofs can be generated using the JavaScript library\\n * https://github.com/miguelmota/merkletreejs[merkletreejs].\\n * Note: the hashing algorithm should be keccak256 and pair sorting should be enabled.\\n *\\n * See `test/utils/cryptography/MerkleProof.test.js` for some examples.\\n */\\nlibrary MerkleProof {\\n /**\\n * @dev Returns true if a `leaf` can be proved to be a part of a Merkle tree\\n * defined by `root`. For this, a `proof` must be provided, containing\\n * sibling hashes on the branch from the leaf to the root of the tree. Each\\n * pair of leaves and each pair of pre-images are assumed to be sorted.\\n */\\n function verify(\\n bytes32[] memory proof,\\n bytes32 root,\\n bytes32 leaf\\n ) internal pure returns (bool) {\\n return processProof(proof, leaf) == root;\\n }\\n\\n /**\\n * @dev Returns the rebuilt hash obtained by traversing a Merklee tree up\\n * from `leaf` using `proof`. A `proof` is valid if and only if the rebuilt\\n * hash matches the root of the tree. When processing the proof, the pairs\\n * of leafs & pre-images are assumed to be sorted.\\n *\\n * _Available since v4.4._\\n */\\n function processProof(bytes32[] memory proof, bytes32 leaf) internal pure returns (bytes32) {\\n bytes32 computedHash = leaf;\\n for (uint256 i = 0; i < proof.length; i++) {\\n bytes32 proofElement = proof[i];\\n if (computedHash <= proofElement) {\\n // Hash(current computed hash + current element of the proof)\\n computedHash = _efficientHash(computedHash, proofElement);\\n } else {\\n // Hash(current element of the proof + current computed hash)\\n computedHash = _efficientHash(proofElement, computedHash);\\n }\\n }\\n return computedHash;\\n }\\n\\n function _efficientHash(bytes32 a, bytes32 b) private pure returns (bytes32 value) {\\n assembly {\\n mstore(0x00, a)\\n mstore(0x20, b)\\n value := keccak256(0x00, 0x40)\\n }\\n }\\n}\\n\",\"keccak256\":\"0xea64fbaccbf9d8c235cf6838240ddcebb97f9fc383660289e9dff32e4fb85f7a\",\"license\":\"MIT\"},\"@openzeppelin/contracts/utils/cryptography/SignatureChecker.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.5.0) (utils/cryptography/SignatureChecker.sol)\\n\\npragma solidity ^0.8.0;\\n\\nimport \\\"./ECDSA.sol\\\";\\nimport \\\"../Address.sol\\\";\\nimport \\\"../../interfaces/IERC1271.sol\\\";\\n\\n/**\\n * @dev Signature verification helper that can be used instead of `ECDSA.recover` to seamlessly support both ECDSA\\n * signatures from externally owned accounts (EOAs) as well as ERC1271 signatures from smart contract wallets like\\n * Argent and Gnosis Safe.\\n *\\n * _Available since v4.1._\\n */\\nlibrary SignatureChecker {\\n /**\\n * @dev Checks if a signature is valid for a given signer and data hash. If the signer is a smart contract, the\\n * signature is validated against that smart contract using ERC1271, otherwise it's validated using `ECDSA.recover`.\\n *\\n * NOTE: Unlike ECDSA signatures, contract signatures are revocable, and the outcome of this function can thus\\n * change through time. It could return true at block N and false at block N+1 (or the opposite).\\n */\\n function isValidSignatureNow(\\n address signer,\\n bytes32 hash,\\n bytes memory signature\\n ) internal view returns (bool) {\\n (address recovered, ECDSA.RecoverError error) = ECDSA.tryRecover(hash, signature);\\n if (error == ECDSA.RecoverError.NoError && recovered == signer) {\\n return true;\\n }\\n\\n (bool success, bytes memory result) = signer.staticcall(\\n abi.encodeWithSelector(IERC1271.isValidSignature.selector, hash, signature)\\n );\\n return (success && result.length == 32 && abi.decode(result, (bytes4)) == IERC1271.isValidSignature.selector);\\n }\\n}\\n\",\"keccak256\":\"0xc8add71d80d05a1390e1c656686a0ea10ffaebfcc433cc397a63fd725f376b7e\",\"license\":\"MIT\"},\"@uma/core/contracts/common/implementation/MultiCaller.sol\":{\"content\":\"// This contract is taken from Uniswaps'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.\\npragma solidity ^0.8.0;\\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 payable returns (bytes[] memory results) {\\n require(msg.value == 0, \\\"Only multicall with 0 value\\\");\\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\",\"keccak256\":\"0x31f18055b14fd9eeb459c6d6a88d1a60921bf3755031f6db4b709c3e01d078f7\"},\"@uma/core/contracts/common/implementation/Testable.sol\":{\"content\":\"// SPDX-License-Identifier: AGPL-3.0-only\\npragma solidity ^0.8.0;\\n\\nimport \\\"./Timer.sol\\\";\\n\\n/**\\n * @title Base class that provides time overrides, but only if being run in test mode.\\n */\\nabstract contract Testable {\\n // If the contract is being run in production, then `timerAddress` will be the 0x0 address.\\n // Note: this variable should be set on construction and never modified.\\n address public timerAddress;\\n\\n /**\\n * @notice Constructs the Testable contract. Called by child contracts.\\n * @param _timerAddress Contract that stores the current time in a testing environment.\\n * Must be set to 0x0 for production environments that use live time.\\n */\\n constructor(address _timerAddress) {\\n timerAddress = _timerAddress;\\n }\\n\\n /**\\n * @notice Reverts if not running in test mode.\\n */\\n modifier onlyIfTest {\\n require(timerAddress != address(0x0));\\n _;\\n }\\n\\n /**\\n * @notice Sets the current time.\\n * @dev Will revert if not running in test mode.\\n * @param time timestamp to set current Testable time to.\\n */\\n function setCurrentTime(uint256 time) external onlyIfTest {\\n Timer(timerAddress).setCurrentTime(time);\\n }\\n\\n /**\\n * @notice Gets the current time. Will return the last time set in `setCurrentTime` if running in test mode.\\n * Otherwise, it will return the block timestamp.\\n * @return uint for the current Testable timestamp.\\n */\\n function getCurrentTime() public view virtual returns (uint256) {\\n if (timerAddress != address(0x0)) {\\n return Timer(timerAddress).getCurrentTime();\\n } else {\\n return block.timestamp; // solhint-disable-line not-rely-on-time\\n }\\n }\\n}\\n\",\"keccak256\":\"0x0254b45747293bb800373a58d123969adec0428f7be79dc941cab10fcad09918\",\"license\":\"AGPL-3.0-only\"},\"@uma/core/contracts/common/implementation/Timer.sol\":{\"content\":\"// SPDX-License-Identifier: AGPL-3.0-only\\npragma solidity ^0.8.0;\\n\\n/**\\n * @title Universal store of current contract time for testing environments.\\n */\\ncontract Timer {\\n uint256 private currentTime;\\n\\n constructor() {\\n currentTime = block.timestamp; // solhint-disable-line not-rely-on-time\\n }\\n\\n /**\\n * @notice Sets the current time.\\n * @dev Will revert if not running in test mode.\\n * @param time timestamp to set `currentTime` to.\\n */\\n function setCurrentTime(uint256 time) external {\\n currentTime = time;\\n }\\n\\n /**\\n * @notice Gets the currentTime variable set in the Timer.\\n * @return uint256 for the current Testable timestamp.\\n */\\n function getCurrentTime() public view returns (uint256) {\\n return currentTime;\\n }\\n}\\n\",\"keccak256\":\"0x9e0dd7389718bd5d1da910273a6f4cee98ee22bfc0c92bde0f0955c0e23adb5e\",\"license\":\"AGPL-3.0-only\"},\"contracts/Ethereum_SpokePool.sol\":{\"content\":\"// SPDX-License-Identifier: GPL-3.0-only\\npragma solidity ^0.8.0;\\n\\nimport \\\"./interfaces/WETH9.sol\\\";\\n\\nimport \\\"@openzeppelin/contracts/access/Ownable.sol\\\";\\nimport \\\"@openzeppelin/contracts/token/ERC20/IERC20.sol\\\";\\n\\nimport \\\"./SpokePool.sol\\\";\\nimport \\\"./SpokePoolInterface.sol\\\";\\n\\n/**\\n * @notice Ethereum L1 specific SpokePool. Used on Ethereum L1 to facilitate L2->L1 transfers.\\n */\\ncontract Ethereum_SpokePool is SpokePool, Ownable {\\n /**\\n * @notice Construct the Ethereum SpokePool.\\n * @param _hubPool Hub pool address to set. Can be changed by admin.\\n * @param _wethAddress Weth address for this network to set.\\n * @param timerAddress Timer address to set.\\n */\\n constructor(\\n address _hubPool,\\n address _wethAddress,\\n address timerAddress\\n ) SpokePool(msg.sender, _hubPool, _wethAddress, timerAddress) {}\\n\\n /**************************************\\n * INTERNAL FUNCTIONS *\\n **************************************/\\n\\n function _bridgeTokensToHubPool(RelayerRefundLeaf memory relayerRefundLeaf) internal override {\\n IERC20(relayerRefundLeaf.l2TokenAddress).transfer(hubPool, relayerRefundLeaf.amountToReturn);\\n }\\n\\n // Admin is simply owner which should be same account that owns the HubPool deployed on this network. A core\\n // assumption of this contract system is that the HubPool is deployed on Ethereum.\\n function _requireAdminSender() internal override onlyOwner {}\\n}\\n\",\"keccak256\":\"0xd79fa8169876135f95c018cdcd4e8e615bb58d68c28b11d1d1cdc3af1f3d7233\",\"license\":\"GPL-3.0-only\"},\"contracts/HubPoolInterface.sol\":{\"content\":\"// SPDX-License-Identifier: GPL-3.0-only\\npragma solidity ^0.8.0;\\n\\nimport \\\"@openzeppelin/contracts/token/ERC20/IERC20.sol\\\";\\nimport \\\"./interfaces/AdapterInterface.sol\\\";\\n\\n/**\\n * @notice Concise list of functions in HubPool implementation.\\n */\\ninterface HubPoolInterface {\\n // This leaf is meant to be decoded in the HubPool to rebalance tokens between HubPool and SpokePool.\\n struct PoolRebalanceLeaf {\\n // This is used to know which chain to send cross-chain transactions to (and which SpokePool to sent to).\\n uint256 chainId;\\n // Total LP fee amount per token in this bundle, encompassing all associated bundled relays.\\n uint256[] bundleLpFees;\\n // This array is grouped with the two above, and it represents the amount to send or request back from the\\n // SpokePool. If positive, the pool will pay the SpokePool. If negative the SpokePool will pay the HubPool.\\n // There can be arbitrarily complex rebalancing rules defined offchain. This number is only nonzero\\n // when the rules indicate that a rebalancing action should occur. When a rebalance does not occur,\\n // runningBalances for this token should change by the total relays - deposits in this bundle. When a rebalance\\n // does occur, runningBalances should be set to zero for this token and the netSendAmounts should be set to the\\n // previous runningBalances + relays - deposits in this bundle.\\n int256[] netSendAmounts;\\n // This is only here to be emitted in an event to track a running unpaid balance between the L2 pool and the L1 pool.\\n // A positive number indicates that the HubPool owes the SpokePool funds. A negative number indicates that the\\n // SpokePool owes the HubPool funds. See the comment above for the dynamics of this and netSendAmounts\\n int256[] runningBalances;\\n // Used as the index in the bitmap to track whether this leaf has been executed or not.\\n uint8 leafId;\\n // The following arrays are required to be the same length. They are parallel arrays for the given chainId and\\n // should be ordered by the l1Tokens field. All whitelisted tokens with nonzero relays on this chain in this\\n // bundle in the order of whitelisting.\\n address[] l1Tokens;\\n }\\n\\n function relaySpokePoolAdminFunction(uint256 chainId, bytes memory functionData) external;\\n\\n function setProtocolFeeCapture(address newProtocolFeeCaptureAddress, uint256 newProtocolFeeCapturePct) external;\\n\\n function setBond(IERC20 newBondToken, uint256 newBondAmount) external;\\n\\n function setLiveness(uint32 newLiveness) external;\\n\\n function setIdentifier(bytes32 newIdentifier) external;\\n\\n function setCrossChainContracts(\\n uint256 l2ChainId,\\n address adapter,\\n address spokePool\\n ) external;\\n\\n function whitelistRoute(\\n uint256 originChainId,\\n uint256 destinationChainId,\\n address originToken,\\n address destinationToken,\\n bool enableRoute\\n ) external;\\n\\n function enableL1TokenForLiquidityProvision(address l1Token) external;\\n\\n function disableL1TokenForLiquidityProvision(address l1Token) external;\\n\\n function addLiquidity(address l1Token, uint256 l1TokenAmount) external payable;\\n\\n function removeLiquidity(\\n address l1Token,\\n uint256 lpTokenAmount,\\n bool sendEth\\n ) external;\\n\\n function exchangeRateCurrent(address l1Token) external returns (uint256);\\n\\n function liquidityUtilizationCurrent(address l1Token) external returns (uint256);\\n\\n function liquidityUtilizationPostRelay(address token, uint256 relayedAmount) external returns (uint256);\\n\\n function sync(address l1Token) external;\\n\\n function proposeRootBundle(\\n uint256[] memory bundleEvaluationBlockNumbers,\\n uint8 poolRebalanceLeafCount,\\n bytes32 poolRebalanceRoot,\\n bytes32 relayerRefundRoot,\\n bytes32 slowRelayRoot\\n ) external;\\n\\n function executeRootBundle(PoolRebalanceLeaf memory poolRebalanceLeaf, bytes32[] memory proof) external;\\n\\n function disputeRootBundle() external;\\n\\n function claimProtocolFeesCaptured(address l1Token) external;\\n\\n function getRootBundleProposalAncillaryData() external view returns (bytes memory ancillaryData);\\n\\n function whitelistedRoute(\\n uint256 originChainId,\\n address originToken,\\n uint256 destinationChainId\\n ) external view returns (address);\\n\\n function loadEthForL2Calls() external payable;\\n}\\n\",\"keccak256\":\"0x990c28fe43a929f5d0524ebabed269965d759d1294df4e75880b9d30b34397ed\",\"license\":\"GPL-3.0-only\"},\"contracts/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 * @dev The reason why we use this local contract instead of importing from uma/contracts is because of the addition\\n * of the internal method `functionCallStackOriginatesFromOutsideThisContract` which doesn't exist in the one exported\\n * by uma/contracts.\\n */\\ncontract Lockable {\\n bool internal _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 /**\\n * @dev Returns true if the contract is currently in a non-entered state, meaning that the origination of the call\\n * came from outside the contract. This is relevant with fallback/receive methods to see if the call came from ETH\\n * being dropped onto the contract externally or due to ETH dropped on the the contract from within a method in this\\n * contract, such as unwrapping WETH to ETH within the contract.\\n */\\n function functionCallStackOriginatesFromOutsideThisContract() internal view returns (bool) {\\n return _notEntered;\\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\",\"keccak256\":\"0xef490be5cb859c97c6f600f3b0db0d50c6e18f334d3c74c6d9e693a260eaec3e\",\"license\":\"AGPL-3.0-only\"},\"contracts/MerkleLib.sol\":{\"content\":\"// SPDX-License-Identifier: GPL-3.0-only\\npragma solidity ^0.8.0;\\n\\nimport \\\"@openzeppelin/contracts/utils/cryptography/MerkleProof.sol\\\";\\nimport \\\"./SpokePoolInterface.sol\\\";\\nimport \\\"./HubPoolInterface.sol\\\";\\n\\n/**\\n * @notice Library to help with merkle roots, proofs, and claims.\\n */\\nlibrary MerkleLib {\\n /**\\n * @notice Verifies that a repayment is contained within a merkle root.\\n * @param root the merkle root.\\n * @param rebalance the rebalance struct.\\n * @param proof the merkle proof.\\n */\\n function verifyPoolRebalance(\\n bytes32 root,\\n HubPoolInterface.PoolRebalanceLeaf memory rebalance,\\n bytes32[] memory proof\\n ) internal pure returns (bool) {\\n return MerkleProof.verify(proof, root, keccak256(abi.encode(rebalance)));\\n }\\n\\n /**\\n * @notice Verifies that a relayer refund is contained within a merkle root.\\n * @param root the merkle root.\\n * @param refund the refund struct.\\n * @param proof the merkle proof.\\n */\\n function verifyRelayerRefund(\\n bytes32 root,\\n SpokePoolInterface.RelayerRefundLeaf memory refund,\\n bytes32[] memory proof\\n ) internal pure returns (bool) {\\n return MerkleProof.verify(proof, root, keccak256(abi.encode(refund)));\\n }\\n\\n /**\\n * @notice Verifies that a distribution is contained within a merkle root.\\n * @param root the merkle root.\\n * @param slowRelayFulfillment the relayData fulfullment struct.\\n * @param proof the merkle proof.\\n */\\n function verifySlowRelayFulfillment(\\n bytes32 root,\\n SpokePoolInterface.RelayData memory slowRelayFulfillment,\\n bytes32[] memory proof\\n ) internal pure returns (bool) {\\n return MerkleProof.verify(proof, root, keccak256(abi.encode(slowRelayFulfillment)));\\n }\\n\\n // The following functions are primarily copied from\\n // https://github.com/Uniswap/merkle-distributor/blob/master/contracts/MerkleDistributor.sol with minor changes.\\n\\n /**\\n * @notice Tests whether a claim is contained within a claimedBitMap mapping.\\n * @param claimedBitMap a simple uint256 mapping in storage used as a bitmap.\\n * @param index the index to check in the bitmap.\\n * @return bool indicating if the index within the claimedBitMap has been marked as claimed.\\n */\\n function isClaimed(mapping(uint256 => uint256) storage claimedBitMap, uint256 index) internal view returns (bool) {\\n uint256 claimedWordIndex = index / 256;\\n uint256 claimedBitIndex = index % 256;\\n uint256 claimedWord = claimedBitMap[claimedWordIndex];\\n uint256 mask = (1 << claimedBitIndex);\\n return claimedWord & mask == mask;\\n }\\n\\n /**\\n * @notice Marks an index in a claimedBitMap as claimed.\\n * @param claimedBitMap a simple uint256 mapping in storage used as a bitmap.\\n * @param index the index to mark in the bitmap.\\n */\\n function setClaimed(mapping(uint256 => uint256) storage claimedBitMap, uint256 index) internal {\\n uint256 claimedWordIndex = index / 256;\\n uint256 claimedBitIndex = index % 256;\\n claimedBitMap[claimedWordIndex] = claimedBitMap[claimedWordIndex] | (1 << claimedBitIndex);\\n }\\n\\n /**\\n * @notice Tests whether a claim is contained within a 1D claimedBitMap mapping.\\n * @param claimedBitMap a simple uint256 value, encoding a 1D bitmap.\\n * @param index the index to check in the bitmap.\\n \\\\* @return bool indicating if the index within the claimedBitMap has been marked as claimed.\\n */\\n function isClaimed1D(uint256 claimedBitMap, uint256 index) internal pure returns (bool) {\\n uint256 mask = (1 << index);\\n return claimedBitMap & mask == mask;\\n }\\n\\n /**\\n * @notice Marks an index in a claimedBitMap as claimed.\\n * @param claimedBitMap a simple uint256 mapping in storage used as a bitmap.\\n * @param index the index to mark in the bitmap.\\n */\\n function setClaimed1D(uint256 claimedBitMap, uint256 index) internal pure returns (uint256) {\\n require(index <= 255, \\\"Index out of bounds\\\");\\n return claimedBitMap | (1 << index % 256);\\n }\\n}\\n\",\"keccak256\":\"0xfec238b342924f5226ab994aa108a9917bc840a89cd34c2ee6c6806161ef3e0c\",\"license\":\"GPL-3.0-only\"},\"contracts/SpokePool.sol\":{\"content\":\"// SPDX-License-Identifier: GPL-3.0-only\\npragma solidity ^0.8.0;\\n\\nimport \\\"./MerkleLib.sol\\\";\\nimport \\\"./interfaces/WETH9.sol\\\";\\n\\nimport \\\"@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol\\\";\\nimport \\\"@openzeppelin/contracts/token/ERC20/IERC20.sol\\\";\\nimport \\\"@openzeppelin/contracts/utils/Address.sol\\\";\\n\\nimport \\\"@openzeppelin/contracts/utils/cryptography/SignatureChecker.sol\\\";\\nimport \\\"@openzeppelin/contracts/utils/cryptography/ECDSA.sol\\\";\\n\\nimport \\\"@uma/core/contracts/common/implementation/Testable.sol\\\";\\nimport \\\"@uma/core/contracts/common/implementation/MultiCaller.sol\\\";\\nimport \\\"./Lockable.sol\\\";\\nimport \\\"./MerkleLib.sol\\\";\\nimport \\\"./SpokePoolInterface.sol\\\";\\n\\n/**\\n * @title SpokePool\\n * @notice Base contract deployed on source and destination chains enabling depositors to transfer assets from source to\\n * destination. Deposit orders are fulfilled by off-chain relayers who also interact with this contract. Deposited\\n * tokens are locked on the source chain and relayers send the recipient the desired token currency and amount\\n * on the destination chain. Locked source chain tokens are later sent over the canonical token bridge to L1 HubPool.\\n * Relayers are refunded with destination tokens out of this contract after another off-chain actor, a \\\"data worker\\\",\\n * submits a proof that the relayer correctly submitted a relay on this SpokePool.\\n */\\nabstract contract SpokePool is SpokePoolInterface, Testable, Lockable, MultiCaller {\\n using SafeERC20 for IERC20;\\n using Address for address;\\n\\n // Address of the L1 contract that acts as the owner of this SpokePool. If this contract is deployed on Ethereum,\\n // then this address should be set to the same owner as the HubPool and the whole system.\\n address public crossDomainAdmin;\\n\\n // Address of the L1 contract that will send tokens to and receive tokens from this contract to fund relayer\\n // refunds and slow relays.\\n address public hubPool;\\n\\n // Address of WETH contract for this network. If an origin token matches this, then the caller can optionally\\n // instruct this contract to wrap ETH when depositing.\\n WETH9 public weth;\\n\\n // Timestamp when contract was constructed. Relays cannot have a quote time before this.\\n uint32 public deploymentTime;\\n\\n // Any deposit quote times greater than or less than this value to the current contract time is blocked. Forces\\n // caller to use an approximately \\\"current\\\" realized fee. Defaults to 10 minutes.\\n uint32 public depositQuoteTimeBuffer = 600;\\n\\n // Count of deposits is used to construct a unique deposit identifier for this spoke pool.\\n uint32 public numberOfDeposits;\\n\\n // Origin token to destination token routings can be turned on or off, which can enable or disable deposits.\\n // A reverse mapping is stored on the L1 HubPool to enable or disable rebalance transfers from the HubPool to this\\n // contract.\\n mapping(address => mapping(uint256 => bool)) public enabledDepositRoutes;\\n\\n // Stores collection of merkle roots that can be published to this contract from the HubPool, which are referenced\\n // by \\\"data workers\\\" via inclusion proofs to execute leaves in the roots.\\n struct RootBundle {\\n // Merkle root of slow relays that were not fully filled and whose recipient is still owed funds from the LP pool.\\n bytes32 slowRelayRoot;\\n // Merkle root of relayer refunds for successful relays.\\n bytes32 relayerRefundRoot;\\n // This is a 2D bitmap tracking which leafs in the relayer refund root have been claimed, with max size of\\n // 256x256 leaves per root.\\n mapping(uint256 => uint256) claimedBitmap;\\n }\\n\\n // This contract can store as many root bundles as the HubPool chooses to publish here.\\n RootBundle[] public rootBundles;\\n\\n // Each relay is associated with the hash of parameters that uniquely identify the original deposit and a relay\\n // attempt for that deposit. The relay itself is just represented as the amount filled so far. The total amount to\\n // relay, the fees, and the agents are all parameters included in the hash key.\\n mapping(bytes32 => uint256) public relayFills;\\n\\n /****************************************\\n * EVENTS *\\n ****************************************/\\n event SetXDomainAdmin(address indexed newAdmin);\\n event SetHubPool(address indexed newHubPool);\\n event EnabledDepositRoute(address indexed originToken, uint256 indexed destinationChainId, bool enabled);\\n event SetDepositQuoteTimeBuffer(uint32 newBuffer);\\n event FundsDeposited(\\n uint256 amount,\\n uint256 destinationChainId,\\n uint64 relayerFeePct,\\n uint32 indexed depositId,\\n uint32 quoteTimestamp,\\n address indexed originToken,\\n address recipient,\\n address indexed depositor\\n );\\n event RequestedSpeedUpDeposit(\\n uint64 newRelayerFeePct,\\n uint32 indexed depositId,\\n address indexed depositor,\\n bytes depositorSignature\\n );\\n event FilledRelay(\\n bytes32 indexed relayHash,\\n uint256 amount,\\n uint256 totalFilledAmount,\\n uint256 fillAmount,\\n uint256 repaymentChainId,\\n uint256 originChainId,\\n uint64 relayerFeePct,\\n uint64 realizedLpFeePct,\\n uint32 depositId,\\n address destinationToken,\\n address indexed relayer,\\n address indexed depositor,\\n address recipient,\\n bool isSlowRelay\\n );\\n event RelayedRootBundle(uint32 indexed rootBundleId, bytes32 relayerRefundRoot, bytes32 slowRelayRoot);\\n event ExecutedRelayerRefundRoot(\\n uint256 amountToReturn,\\n uint256 indexed chainId,\\n uint256[] refundAmounts,\\n uint32 indexed rootBundleId,\\n uint32 indexed leafId,\\n address l2TokenAddress,\\n address[] refundAddresses,\\n address caller\\n );\\n event TokensBridged(\\n uint256 amountToReturn,\\n uint256 indexed chainId,\\n uint32 indexed leafId,\\n address indexed l2TokenAddress,\\n address caller\\n );\\n\\n /**\\n * @notice Construct the base SpokePool.\\n * @param _crossDomainAdmin Cross domain admin to set. Can be changed by admin.\\n * @param _hubPool Hub pool address to set. Can be changed by admin.\\n * @param _wethAddress Weth address for this network to set.\\n * @param timerAddress Timer address to set.\\n */\\n constructor(\\n address _crossDomainAdmin,\\n address _hubPool,\\n address _wethAddress,\\n address timerAddress\\n ) Testable(timerAddress) {\\n _setCrossDomainAdmin(_crossDomainAdmin);\\n _setHubPool(_hubPool);\\n deploymentTime = uint32(getCurrentTime());\\n weth = WETH9(_wethAddress);\\n }\\n\\n /****************************************\\n * MODIFIERS *\\n ****************************************/\\n\\n modifier onlyEnabledRoute(address originToken, uint256 destinationId) {\\n require(enabledDepositRoutes[originToken][destinationId], \\\"Disabled route\\\");\\n _;\\n }\\n\\n // Implementing contract needs to override _requireAdminSender() to ensure that admin functions are protected\\n // appropriately.\\n modifier onlyAdmin() {\\n _requireAdminSender();\\n _;\\n }\\n\\n /**************************************\\n * ADMIN FUNCTIONS *\\n **************************************/\\n\\n /**\\n * @notice Change cross domain admin address. Callable by admin only.\\n * @param newCrossDomainAdmin New cross domain admin.\\n */\\n function setCrossDomainAdmin(address newCrossDomainAdmin) public override onlyAdmin {\\n _setCrossDomainAdmin(newCrossDomainAdmin);\\n }\\n\\n /**\\n * @notice Change L1 hub pool address. Callable by admin only.\\n * @param newHubPool New hub pool.\\n */\\n function setHubPool(address newHubPool) public override onlyAdmin {\\n _setHubPool(newHubPool);\\n }\\n\\n /**\\n * @notice Enable/Disable an origin token => destination chain ID route for deposits. Callable by admin only.\\n * @param originToken Token that depositor can deposit to this contract.\\n * @param destinationChainId Chain ID for where depositor wants to receive funds.\\n * @param enabled True to enable deposits, False otherwise.\\n */\\n function setEnableRoute(\\n address originToken,\\n uint256 destinationChainId,\\n bool enabled\\n ) public override onlyAdmin {\\n enabledDepositRoutes[originToken][destinationChainId] = enabled;\\n emit EnabledDepositRoute(originToken, destinationChainId, enabled);\\n }\\n\\n /**\\n * @notice Change allowance for deposit quote time to differ from current block time. Callable by admin only.\\n * @param newDepositQuoteTimeBuffer New quote time buffer.\\n */\\n function setDepositQuoteTimeBuffer(uint32 newDepositQuoteTimeBuffer) public override onlyAdmin {\\n depositQuoteTimeBuffer = newDepositQuoteTimeBuffer;\\n emit SetDepositQuoteTimeBuffer(newDepositQuoteTimeBuffer);\\n }\\n\\n /**\\n * @notice This method stores a new root bundle in this contract that can be executed to refund relayers, fulfill\\n * slow relays, and send funds back to the HubPool on L1. This method can only be called by the admin and is\\n * designed to be called as part of a cross-chain message from the HubPool's executeRootBundle method.\\n * @param relayerRefundRoot Merkle root containing relayer refund leaves that can be individually executed via\\n * executeRelayerRefundRoot().\\n * @param slowRelayRoot Merkle root containing slow relay fulfillment leaves that can be individually executed via\\n * executeSlowRelayRoot().\\n */\\n function relayRootBundle(bytes32 relayerRefundRoot, bytes32 slowRelayRoot) public override onlyAdmin {\\n uint32 rootBundleId = uint32(rootBundles.length);\\n RootBundle storage rootBundle = rootBundles.push();\\n rootBundle.relayerRefundRoot = relayerRefundRoot;\\n rootBundle.slowRelayRoot = slowRelayRoot;\\n emit RelayedRootBundle(rootBundleId, relayerRefundRoot, slowRelayRoot);\\n }\\n\\n /**************************************\\n * DEPOSITOR FUNCTIONS *\\n **************************************/\\n\\n /**\\n * @notice Called by user to bridge funds from origin to destination chain. Depositor will effectively lock\\n * tokens in this contract and receive a destination token on the destination chain. The origin => destination\\n * token mapping is stored on the L1 HubPool.\\n * @notice The caller must first approve this contract to spend amount of originToken.\\n * @notice The originToken => destinationChainId must be enabled.\\n * @notice This method is payable because the caller is able to deposit ETH if the originToken is WETH and this\\n * function will handle wrapping ETH.\\n * @param recipient Address to receive funds at on destination chain.\\n * @param originToken Token to lock into this contract to initiate deposit.\\n * @param amount Amount of tokens to deposit. Will be amount of tokens to receive less fees.\\n * @param destinationChainId Denotes network where user will receive funds from SpokePool by a relayer.\\n * @param relayerFeePct % of deposit amount taken out to incentivize a fast relayer.\\n * @param quoteTimestamp Timestamp used by relayers to compute this deposit's realizedLPFeePct which is paid\\n * to LP pool on HubPool.\\n */\\n function deposit(\\n address recipient,\\n address originToken,\\n uint256 amount,\\n uint256 destinationChainId,\\n uint64 relayerFeePct,\\n uint32 quoteTimestamp\\n ) public payable override onlyEnabledRoute(originToken, destinationChainId) nonReentrant {\\n // We limit the relay fees to prevent the user spending all their funds on fees.\\n require(relayerFeePct < 0.5e18, \\\"invalid relayer fee\\\");\\n // This function assumes that L2 timing cannot be compared accurately and consistently to L1 timing. Therefore,\\n // block.timestamp is different from the L1 EVM's. Therefore, the quoteTimestamp must be within a configurable\\n // buffer of this contract's block time to allow for this variance.\\n // Note also that quoteTimestamp cannot be less than the buffer otherwise the following arithmetic can result\\n // in underflow. This isn't a problem as the deposit will revert, but the error might be unexpected for clients.\\n require(\\n getCurrentTime() >= quoteTimestamp - depositQuoteTimeBuffer &&\\n getCurrentTime() <= quoteTimestamp + depositQuoteTimeBuffer,\\n \\\"invalid quote time\\\"\\n );\\n // If the address of the origin token is a WETH contract and there is a msg.value with the transaction\\n // then the user is sending ETH. In this case, the ETH should be deposited to WETH.\\n if (originToken == address(weth) && msg.value > 0) {\\n require(msg.value == amount, \\\"msg.value must match amount\\\");\\n weth.deposit{ value: msg.value }();\\n // Else, it is a normal ERC20. In this case pull the token from the users wallet as per normal.\\n // Note: this includes the case where the L2 user has WETH (already wrapped ETH) and wants to bridge them.\\n // In this case the msg.value will be set to 0, indicating a \\\"normal\\\" ERC20 bridging action.\\n } else IERC20(originToken).safeTransferFrom(msg.sender, address(this), amount);\\n\\n emit FundsDeposited(\\n amount,\\n destinationChainId,\\n relayerFeePct,\\n numberOfDeposits,\\n quoteTimestamp,\\n originToken,\\n recipient,\\n msg.sender\\n );\\n\\n // Increment count of deposits so that deposit ID for this spoke pool is unique.\\n numberOfDeposits += 1;\\n }\\n\\n /**\\n * @notice Convenience method that depositor can use to signal to relayer to use updated fee.\\n * @notice Relayer should only use events emitted by this function to submit fills with updated fees, otherwise they\\n * risk their fills getting disputed for being invalid, for example if the depositor never actually signed the\\n * update fee message.\\n * @notice This function will revert if the depositor did not sign a message containing the updated fee for the\\n * deposit ID stored in this contract. If the deposit ID is for another contract, or the depositor address is\\n * incorrect, or the updated fee is incorrect, then the signature will not match and this function will revert.\\n * @param depositor Signer of the update fee message who originally submitted the deposit. If the deposit doesn't\\n * exist, then the relayer will not be able to fill any relay, so the caller should validate that the depositor\\n * did in fact submit a relay.\\n * @param newRelayerFeePct New relayer fee that relayers can use.\\n * @param depositId Deposit to update fee for that originated in this contract.\\n * @param depositorSignature Signed message containing the depositor address, this contract chain ID, the updated\\n * relayer fee %, and the deposit ID. This signature is produced by signing a hash of data according to the\\n * EIP-191 standard. See more in the _verifyUpdateRelayerFeeMessage() comments.\\n */\\n function speedUpDeposit(\\n address depositor,\\n uint64 newRelayerFeePct,\\n uint32 depositId,\\n bytes memory depositorSignature\\n ) public override nonReentrant {\\n _verifyUpdateRelayerFeeMessage(depositor, chainId(), newRelayerFeePct, depositId, depositorSignature);\\n\\n // Assuming the above checks passed, a relayer can take the signature and the updated relayer fee information\\n // from the following event to submit a fill with an updated fee %.\\n emit RequestedSpeedUpDeposit(newRelayerFeePct, depositId, depositor, depositorSignature);\\n }\\n\\n /**************************************\\n * RELAYER FUNCTIONS *\\n **************************************/\\n\\n /**\\n * @notice Called by relayer to fulfill part of a deposit by sending destination tokens to the receipient.\\n * Relayer is expected to pass in unique identifying information for deposit that they want to fulfill, and this\\n * relay submission will be validated by off-chain data workers who can dispute this relay if any part is invalid.\\n * If the relay is valid, then the relayer will be refunded on their desired repayment chain. If relay is invalid,\\n * then relayer will not receive any refund.\\n * @notice All of the deposit data can be found via on-chain events from the origin SpokePool, except for the\\n * realizedLpFeePct which is a function of the HubPool's utilization at the deposit quote time. This fee %\\n * is deterministic based on the quote time, so the relayer should just compute it using the canonical algorithm\\n * as described in a UMIP linked to the HubPool's identifier.\\n * @param depositor Depositor on origin chain who set this chain as the destination chain.\\n * @param recipient Specified recipient on this chain.\\n * @param destinationToken Token to send to recipient. Should be mapped to the origin token, origin chain ID\\n * and this chain ID via a mapping on the HubPool.\\n * @param amount Full size of the deposit.\\n * @param maxTokensToSend Max amount of tokens to send recipient. If higher than amount, then caller will\\n * send recipient the full relay amount.\\n * @param repaymentChainId Chain of SpokePool where relayer wants to be refunded after the challenge window has\\n * passed.\\n * @param originChainId Chain of SpokePool where deposit originated.\\n * @param realizedLpFeePct Fee % based on L1 HubPool utilization at deposit quote time. Deterministic based on\\n * quote time.\\n * @param relayerFeePct Fee % to keep as relayer, specified by depositor.\\n * @param depositId Unique deposit ID on origin spoke pool.\\n */\\n function fillRelay(\\n address depositor,\\n address recipient,\\n address destinationToken,\\n uint256 amount,\\n uint256 maxTokensToSend,\\n uint256 repaymentChainId,\\n uint256 originChainId,\\n uint64 realizedLpFeePct,\\n uint64 relayerFeePct,\\n uint32 depositId\\n ) public nonReentrant {\\n // Each relay attempt is mapped to the hash of data uniquely identifying it, which includes the deposit data\\n // such as the origin chain ID and the deposit ID, and the data in a relay attempt such as who the recipient\\n // is, which chain and currency the recipient wants to receive funds on, and the relay fees.\\n SpokePoolInterface.RelayData memory relayData = SpokePoolInterface.RelayData({\\n depositor: depositor,\\n recipient: recipient,\\n destinationToken: destinationToken,\\n amount: amount,\\n realizedLpFeePct: realizedLpFeePct,\\n relayerFeePct: relayerFeePct,\\n depositId: depositId,\\n originChainId: originChainId\\n });\\n bytes32 relayHash = _getRelayHash(relayData);\\n\\n uint256 fillAmountPreFees = _fillRelay(relayHash, relayData, maxTokensToSend, relayerFeePct, false);\\n\\n _emitFillRelay(relayHash, fillAmountPreFees, repaymentChainId, relayerFeePct, relayData, false);\\n }\\n\\n /**\\n * @notice Called by relayer to execute same logic as calling fillRelay except that relayer is using an updated\\n * relayer fee %. The fee % must have been emitted in a message cryptographically signed by the depositor.\\n * @notice By design, the depositor probably emitted the message with the updated fee by calling speedUpRelay().\\n * @param depositor Depositor on origin chain who set this chain as the destination chain.\\n * @param recipient Specified recipient on this chain.\\n * @param destinationToken Token to send to recipient. Should be mapped to the origin token, origin chain ID\\n * and this chain ID via a mapping on the HubPool.\\n * @param amount Full size of the deposit.\\n * @param maxTokensToSend Max amount of tokens to send recipient. If higher than amount, then caller will\\n * send recipient the full relay amount.\\n * @param repaymentChainId Chain of SpokePool where relayer wants to be refunded after the challenge window has\\n * passed.\\n * @param originChainId Chain of SpokePool where deposit originated.\\n * @param realizedLpFeePct Fee % based on L1 HubPool utilization at deposit quote time. Deterministic based on\\n * quote time.\\n * @param relayerFeePct Original fee % to keep as relayer set by depositor.\\n * @param newRelayerFeePct New fee % to keep as relayer also specified by depositor.\\n * @param depositId Unique deposit ID on origin spoke pool.\\n * @param depositorSignature Depositor-signed message containing updated fee %.\\n */\\n function fillRelayWithUpdatedFee(\\n address depositor,\\n address recipient,\\n address destinationToken,\\n uint256 amount,\\n uint256 maxTokensToSend,\\n uint256 repaymentChainId,\\n uint256 originChainId,\\n uint64 realizedLpFeePct,\\n uint64 relayerFeePct,\\n uint64 newRelayerFeePct,\\n uint32 depositId,\\n bytes memory depositorSignature\\n ) public override nonReentrant {\\n _verifyUpdateRelayerFeeMessage(depositor, originChainId, newRelayerFeePct, depositId, depositorSignature);\\n\\n // Now follow the default fillRelay flow with the updated fee and the original relay hash.\\n RelayData memory relayData = RelayData({\\n depositor: depositor,\\n recipient: recipient,\\n destinationToken: destinationToken,\\n amount: amount,\\n realizedLpFeePct: realizedLpFeePct,\\n relayerFeePct: relayerFeePct,\\n depositId: depositId,\\n originChainId: originChainId\\n });\\n bytes32 relayHash = _getRelayHash(relayData);\\n uint256 fillAmountPreFees = _fillRelay(relayHash, relayData, maxTokensToSend, newRelayerFeePct, false);\\n\\n _emitFillRelay(relayHash, fillAmountPreFees, repaymentChainId, newRelayerFeePct, relayData, false);\\n }\\n\\n /**************************************\\n * DATA WORKER FUNCTIONS *\\n **************************************/\\n\\n /**\\n * @notice Executes a slow relay leaf stored as part of a root bundle. Will send the full amount remaining in the\\n * relay to the recipient, less fees.\\n * @param depositor Depositor on origin chain who set this chain as the destination chain.\\n * @param recipient Specified recipient on this chain.\\n * @param destinationToken Token to send to recipient. Should be mapped to the origin token, origin chain ID\\n * and this chain ID via a mapping on the HubPool.\\n * @param amount Full size of the deposit.\\n * @param originChainId Chain of SpokePool where deposit originated.\\n * @param realizedLpFeePct Fee % based on L1 HubPool utilization at deposit quote time. Deterministic based on\\n * quote time.\\n * @param relayerFeePct Original fee % to keep as relayer set by depositor.\\n * @param depositId Unique deposit ID on origin spoke pool.\\n * @param rootBundleId Unique ID of root bundle containing slow relay root that this leaf is contained in.\\n * @param proof Inclusion proof for this leaf in slow relay root in root bundle.\\n */\\n function executeSlowRelayRoot(\\n address depositor,\\n address recipient,\\n address destinationToken,\\n uint256 amount,\\n uint256 originChainId,\\n uint64 realizedLpFeePct,\\n uint64 relayerFeePct,\\n uint32 depositId,\\n uint32 rootBundleId,\\n bytes32[] memory proof\\n ) public virtual override nonReentrant {\\n _executeSlowRelayRoot(\\n depositor,\\n recipient,\\n destinationToken,\\n amount,\\n originChainId,\\n realizedLpFeePct,\\n relayerFeePct,\\n depositId,\\n rootBundleId,\\n proof\\n );\\n }\\n\\n /**\\n * @notice Executes a relayer refund leaf stored as part of a root bundle. Will send the relayer the amount they\\n * sent to the recipient plus a relayer fee.\\n * @param rootBundleId Unique ID of root bundle containing relayer refund root that this leaf is contained in.\\n * @param relayerRefundLeaf Contains all data neccessary to reconstruct leaf contained in root bundle and to\\n * refund relayer. This data structure is explained in detail in the SpokePoolInterface.\\n * @param proof Inclusion proof for this leaf in relayer refund root in root bundle.\\n */\\n function executeRelayerRefundRoot(\\n uint32 rootBundleId,\\n SpokePoolInterface.RelayerRefundLeaf memory relayerRefundLeaf,\\n bytes32[] memory proof\\n ) public virtual override nonReentrant {\\n _executeRelayerRefundRoot(rootBundleId, relayerRefundLeaf, proof);\\n }\\n\\n /**************************************\\n * VIEW FUNCTIONS *\\n **************************************/\\n\\n /**\\n * @notice Returns chain ID for this network.\\n * @dev Some L2s like ZKSync don't support the CHAIN_ID opcode so we allow the implementer to override this.\\n */\\n function chainId() public view override returns (uint256) {\\n return block.chainid;\\n }\\n\\n /**************************************\\n * INTERNAL FUNCTIONS *\\n **************************************/\\n\\n // Verifies inclusion proof of leaf in root, sends relayer their refund, and sends to HubPool any rebalance\\n // transfers.\\n function _executeRelayerRefundRoot(\\n uint32 rootBundleId,\\n SpokePoolInterface.RelayerRefundLeaf memory relayerRefundLeaf,\\n bytes32[] memory proof\\n ) internal {\\n // Check integrity of leaf structure:\\n require(relayerRefundLeaf.chainId == chainId(), \\\"Invalid chainId\\\");\\n require(relayerRefundLeaf.refundAddresses.length == relayerRefundLeaf.refundAmounts.length, \\\"invalid leaf\\\");\\n\\n RootBundle storage rootBundle = rootBundles[rootBundleId];\\n\\n // Check that inclusionProof proves that relayerRefundLeaf is contained within the relayer refund root.\\n // Note: This should revert if the relayerRefundRoot is uninitialized.\\n require(MerkleLib.verifyRelayerRefund(rootBundle.relayerRefundRoot, relayerRefundLeaf, proof), \\\"Bad Proof\\\");\\n\\n // Verify the leafId in the leaf has not yet been claimed.\\n require(!MerkleLib.isClaimed(rootBundle.claimedBitmap, relayerRefundLeaf.leafId), \\\"Already claimed\\\");\\n\\n // Set leaf as claimed in bitmap. This is passed by reference to the storage rootBundle.\\n MerkleLib.setClaimed(rootBundle.claimedBitmap, relayerRefundLeaf.leafId);\\n\\n // Send each relayer refund address the associated refundAmount for the L2 token address.\\n // Note: Even if the L2 token is not enabled on this spoke pool, we should still refund relayers.\\n for (uint32 i = 0; i < relayerRefundLeaf.refundAmounts.length; i++) {\\n uint256 amount = relayerRefundLeaf.refundAmounts[i];\\n if (amount > 0)\\n IERC20(relayerRefundLeaf.l2TokenAddress).safeTransfer(relayerRefundLeaf.refundAddresses[i], amount);\\n }\\n\\n // If leaf's amountToReturn is positive, then send L2 --> L1 message to bridge tokens back via\\n // chain-specific bridging method.\\n if (relayerRefundLeaf.amountToReturn > 0) {\\n _bridgeTokensToHubPool(relayerRefundLeaf);\\n\\n emit TokensBridged(\\n relayerRefundLeaf.amountToReturn,\\n relayerRefundLeaf.chainId,\\n relayerRefundLeaf.leafId,\\n relayerRefundLeaf.l2TokenAddress,\\n msg.sender\\n );\\n }\\n\\n emit ExecutedRelayerRefundRoot(\\n relayerRefundLeaf.amountToReturn,\\n relayerRefundLeaf.chainId,\\n relayerRefundLeaf.refundAmounts,\\n rootBundleId,\\n relayerRefundLeaf.leafId,\\n relayerRefundLeaf.l2TokenAddress,\\n relayerRefundLeaf.refundAddresses,\\n msg.sender\\n );\\n }\\n\\n // Verifies inclusion proof of leaf in root and sends recipient remainder of relay. Marks relay as filled.\\n function _executeSlowRelayRoot(\\n address depositor,\\n address recipient,\\n address destinationToken,\\n uint256 amount,\\n uint256 originChainId,\\n uint64 realizedLpFeePct,\\n uint64 relayerFeePct,\\n uint32 depositId,\\n uint32 rootBundleId,\\n bytes32[] memory proof\\n ) internal {\\n RelayData memory relayData = RelayData({\\n depositor: depositor,\\n recipient: recipient,\\n destinationToken: destinationToken,\\n amount: amount,\\n originChainId: originChainId,\\n realizedLpFeePct: realizedLpFeePct,\\n relayerFeePct: relayerFeePct,\\n depositId: depositId\\n });\\n\\n require(\\n MerkleLib.verifySlowRelayFulfillment(rootBundles[rootBundleId].slowRelayRoot, relayData, proof),\\n \\\"Invalid proof\\\"\\n );\\n\\n bytes32 relayHash = _getRelayHash(relayData);\\n\\n // Note: use relayAmount as the max amount to send, so the relay is always completely filled by the contract's\\n // funds in all cases. As this is a slow relay we set the relayerFeePct to 0. This effectively refunds the\\n // relayer component of the relayerFee thereby only charging the depositor the LpFee.\\n uint256 fillAmountPreFees = _fillRelay(relayHash, relayData, relayData.amount, 0, true);\\n\\n // Note: Set repayment chain ID to 0 to indicate that there is no repayment to be made. The off-chain data\\n // worker can use repaymentChainId=0 as a signal to ignore such relays for refunds. Also, set the relayerFeePct\\n // to 0 as slow relays do not pay the caller of this method (depositor is refunded this fee).\\n _emitFillRelay(relayHash, fillAmountPreFees, 0, 0, relayData, true);\\n }\\n\\n function _setCrossDomainAdmin(address newCrossDomainAdmin) internal {\\n require(newCrossDomainAdmin != address(0), \\\"Bad bridge router address\\\");\\n crossDomainAdmin = newCrossDomainAdmin;\\n emit SetXDomainAdmin(crossDomainAdmin);\\n }\\n\\n function _setHubPool(address newHubPool) internal {\\n require(newHubPool != address(0), \\\"Bad hub pool address\\\");\\n hubPool = newHubPool;\\n emit SetHubPool(hubPool);\\n }\\n\\n // Should be overriden by implementing contract depending on how L2 handles sending tokens to L1.\\n function _bridgeTokensToHubPool(SpokePoolInterface.RelayerRefundLeaf memory relayerRefundLeaf) internal virtual;\\n\\n function _verifyUpdateRelayerFeeMessage(\\n address depositor,\\n uint256 originChainId,\\n uint64 newRelayerFeePct,\\n uint32 depositId,\\n bytes memory depositorSignature\\n ) internal view {\\n // A depositor can request to speed up an un-relayed deposit by signing a hash containing the relayer\\n // fee % to update to and information uniquely identifying the deposit to relay. This information ensures\\n // that this signature cannot be re-used for other deposits. The version string is included as a precaution\\n // in case this contract is upgraded.\\n // Note: we use encode instead of encodePacked because it is more secure, more in the \\\"warning\\\" section\\n // here: https://docs.soliditylang.org/en/v0.8.11/abi-spec.html#non-standard-packed-mode\\n bytes32 expectedDepositorMessageHash = keccak256(\\n abi.encode(\\\"ACROSS-V2-FEE-1.0\\\", newRelayerFeePct, depositId, originChainId)\\n );\\n\\n // Check the hash corresponding to the https://eth.wiki/json-rpc/API#eth_sign[eth_sign]\\n // JSON-RPC method as part of EIP-191. We use OZ's signature checker library which adds support for\\n // EIP-1271 which can verify messages signed by smart contract wallets like Argent and Gnosis safes.\\n // If the depositor signed a message with a different updated fee (or any other param included in the\\n // above keccak156 hash), then this will revert.\\n bytes32 ethSignedMessageHash = ECDSA.toEthSignedMessageHash(expectedDepositorMessageHash);\\n\\n _verifyDepositorUpdateFeeMessage(depositor, ethSignedMessageHash, depositorSignature);\\n }\\n\\n // This function is isolated and made virtual to allow different L2's to implement chain specific recovery of\\n // signers from signatures because some L2s might not support ecrecover, such as those with account abstraction\\n // like ZKSync.\\n function _verifyDepositorUpdateFeeMessage(\\n address depositor,\\n bytes32 ethSignedMessageHash,\\n bytes memory depositorSignature\\n ) internal view virtual {\\n // Note: no need to worry about reentrancy from contract deployed at depositor address since\\n // SignatureChecker.isValidSignatureNow is a non state-modifying STATICCALL:\\n // - https://github.com/OpenZeppelin/openzeppelin-contracts/blob/63b466901fb015538913f811c5112a2775042177/contracts/utils/cryptography/SignatureChecker.sol#L35\\n // - https://github.com/ethereum/EIPs/pull/214\\n require(\\n SignatureChecker.isValidSignatureNow(depositor, ethSignedMessageHash, depositorSignature),\\n \\\"invalid signature\\\"\\n );\\n }\\n\\n function _computeAmountPreFees(uint256 amount, uint64 feesPct) private pure returns (uint256) {\\n return (1e18 * amount) / (1e18 - feesPct);\\n }\\n\\n function _computeAmountPostFees(uint256 amount, uint64 feesPct) private pure returns (uint256) {\\n return (amount * (1e18 - feesPct)) / 1e18;\\n }\\n\\n function _getRelayHash(SpokePoolInterface.RelayData memory relayData) private pure returns (bytes32) {\\n return keccak256(abi.encode(relayData));\\n }\\n\\n // Unwraps ETH and does a transfer to a recipient address. If the recipient is a smart contract then sends WETH.\\n function _unwrapWETHTo(address payable to, uint256 amount) internal {\\n if (address(to).isContract()) {\\n IERC20(address(weth)).safeTransfer(to, amount);\\n } else {\\n weth.withdraw(amount);\\n to.transfer(amount);\\n }\\n }\\n\\n // @notice Caller specifies the max amount of tokens to send to user. Based on this amount and the amount of the\\n // relay remaining (as stored in the relayFills mapping), pull the amount of tokens from the caller ancillaryData\\n // and send to the caller.\\n // @dev relayFills keeps track of pre-fee fill amounts as a convenience to relayers who want to specify round\\n // numbers for the maxTokensToSend parameter or convenient numbers like 100 (i.e. relayers who will fully\\n // fill any relay up to 100 tokens, and partial fill with 100 tokens for larger relays).\\n function _fillRelay(\\n bytes32 relayHash,\\n RelayData memory relayData,\\n uint256 maxTokensToSend,\\n uint64 updatableRelayerFeePct,\\n bool useContractFunds\\n ) internal returns (uint256 fillAmountPreFees) {\\n // We limit the relay fees to prevent the user spending all their funds on fees. Note that 0.5e18 (i.e. 50%)\\n // fees are just magic numbers. The important point is to prevent the total fee from being 100%, otherwise\\n // computing the amount pre fees runs into divide-by-0 issues.\\n require(updatableRelayerFeePct < 0.5e18 && relayData.realizedLpFeePct < 0.5e18, \\\"invalid fees\\\");\\n\\n // Check that the relay has not already been completely filled. Note that the relays mapping will point to\\n // the amount filled so far for a particular relayHash, so this will start at 0 and increment with each fill.\\n require(relayFills[relayHash] < relayData.amount, \\\"relay filled\\\");\\n\\n // Stores the equivalent amount to be sent by the relayer before fees have been taken out.\\n if (maxTokensToSend == 0) return 0;\\n\\n // Derive the amount of the relay filled if the caller wants to send exactly maxTokensToSend tokens to\\n // the recipient. For example, if the user wants to send 10 tokens to the recipient, the full relay amount\\n // is 100, and the fee %'s total 5%, then this computation would return ~10.5, meaning that to fill 10.5/100\\n // of the full relay size, the caller would need to send 10 tokens to the user.\\n fillAmountPreFees = _computeAmountPreFees(\\n maxTokensToSend,\\n (relayData.realizedLpFeePct + updatableRelayerFeePct)\\n );\\n // If user's specified max amount to send is greater than the amount of the relay remaining pre-fees,\\n // we'll pull exactly enough tokens to complete the relay.\\n uint256 amountToSend = maxTokensToSend;\\n uint256 amountRemainingInRelay = relayData.amount - relayFills[relayHash];\\n if (amountRemainingInRelay < fillAmountPreFees) {\\n fillAmountPreFees = amountRemainingInRelay;\\n\\n // The user will fulfill the remainder of the relay, so we need to compute exactly how many tokens post-fees\\n // that they need to send to the recipient. Note that if the relayer is filled using contract funds then\\n // this is a slow relay.\\n amountToSend = _computeAmountPostFees(\\n fillAmountPreFees,\\n relayData.realizedLpFeePct + updatableRelayerFeePct\\n );\\n }\\n\\n // relayFills keeps track of pre-fee fill amounts as a convenience to relayers who want to specify round\\n // numbers for the maxTokensToSend parameter or convenient numbers like 100 (i.e. relayers who will fully\\n // fill any relay up to 100 tokens, and partial fill with 100 tokens for larger relays).\\n relayFills[relayHash] += fillAmountPreFees;\\n\\n // If relay token is weth then unwrap and send eth.\\n if (relayData.destinationToken == address(weth)) {\\n // Note: useContractFunds is True if we want to send funds to the recipient directly out of this contract,\\n // otherwise we expect the caller to send funds to the recipient. If useContractFunds is True and the\\n // recipient wants WETH, then we can assume that WETH is already in the contract, otherwise we'll need the\\n // the user to send WETH to this contract. Regardless, we'll need to unwrap it before sending to the user.\\n if (!useContractFunds)\\n IERC20(relayData.destinationToken).safeTransferFrom(msg.sender, address(this), amountToSend);\\n _unwrapWETHTo(payable(relayData.recipient), amountToSend);\\n // Else, this is a normal ERC20 token. Send to recipient.\\n } else {\\n // Note: Similar to note above, send token directly from the contract to the user in the slow relay case.\\n if (!useContractFunds)\\n IERC20(relayData.destinationToken).safeTransferFrom(msg.sender, relayData.recipient, amountToSend);\\n else IERC20(relayData.destinationToken).safeTransfer(relayData.recipient, amountToSend);\\n }\\n }\\n\\n // The following internal methods emit events with many params to overcome solidity stack too deep issues.\\n function _emitFillRelay(\\n bytes32 relayHash,\\n uint256 fillAmount,\\n uint256 repaymentChainId,\\n uint64 relayerFeePct,\\n RelayData memory relayData,\\n bool isSlowRelay\\n ) internal {\\n emit FilledRelay(\\n relayHash,\\n relayData.amount,\\n relayFills[relayHash],\\n fillAmount,\\n repaymentChainId,\\n relayData.originChainId,\\n relayerFeePct,\\n relayData.realizedLpFeePct,\\n relayData.depositId,\\n relayData.destinationToken,\\n msg.sender,\\n relayData.depositor,\\n relayData.recipient,\\n isSlowRelay\\n );\\n }\\n\\n // Implementing contract needs to override this to ensure that only the appropriate cross chain admin can execute\\n // certain admin functions. For L2 contracts, the cross chain admin refers to some L1 address or contract, and for\\n // L1, this would just be the same admin of the HubPool.\\n function _requireAdminSender() internal virtual;\\n\\n // Added to enable the this contract to receive ETH. Used when unwrapping Weth.\\n receive() external payable {}\\n}\\n\",\"keccak256\":\"0x53900aac0bdf745c489daae95f1fe7b5165ac2dbc000ceb307ff9ce4ed331787\",\"license\":\"GPL-3.0-only\"},\"contracts/SpokePoolInterface.sol\":{\"content\":\"// SPDX-License-Identifier: GPL-3.0-only\\npragma solidity ^0.8.0;\\n\\n/**\\n * @notice Contains common data structures and functions used by all SpokePool implementations.\\n */\\ninterface SpokePoolInterface {\\n // This leaf is meant to be decoded in the SpokePool to pay out successful relayers.\\n struct RelayerRefundLeaf {\\n // This is the amount to return to the HubPool. This occurs when there is a PoolRebalanceLeaf netSendAmount that is\\n // negative. This is just that value inverted.\\n uint256 amountToReturn;\\n // Used to verify that this is being executed on the correct destination chainId.\\n uint256 chainId;\\n // This array designates how much each of those addresses should be refunded.\\n uint256[] refundAmounts;\\n // Used as the index in the bitmap to track whether this leaf has been executed or not.\\n uint32 leafId;\\n // The associated L2TokenAddress that these claims apply to.\\n address l2TokenAddress;\\n // Must be same length as refundAmounts and designates each address that must be refunded.\\n address[] refundAddresses;\\n }\\n\\n // This struct represents the data to fully specify a relay. If any portion of this data differs, the relay is\\n // considered to be completely distinct. Only one relay for a particular depositId, chainId pair should be\\n // considered valid and repaid. This data is hashed and inserted into a the slow relay merkle root so that an off\\n // chain validator can choose when to refund slow relayers.\\n struct RelayData {\\n // The address that made the deposit on the origin chain.\\n address depositor;\\n // The recipient address on the destination chain.\\n address recipient;\\n // The corresponding token address on the destination chain.\\n address destinationToken;\\n // The total relay amount before fees are taken out.\\n uint256 amount;\\n // Origin chain id.\\n uint256 originChainId;\\n // The LP Fee percentage computed by the relayer based on the deposit's quote timestamp\\n // and the HubPool's utilization.\\n uint64 realizedLpFeePct;\\n // The relayer fee percentage specified in the deposit.\\n uint64 relayerFeePct;\\n // The id uniquely identifying this deposit on the origin chain.\\n uint32 depositId;\\n }\\n\\n function setCrossDomainAdmin(address newCrossDomainAdmin) external;\\n\\n function setHubPool(address newHubPool) external;\\n\\n function setEnableRoute(\\n address originToken,\\n uint256 destinationChainId,\\n bool enable\\n ) external;\\n\\n function setDepositQuoteTimeBuffer(uint32 buffer) external;\\n\\n function relayRootBundle(bytes32 relayerRefundRoot, bytes32 slowRelayRoot) external;\\n\\n function deposit(\\n address recipient,\\n address originToken,\\n uint256 amount,\\n uint256 destinationChainId,\\n uint64 relayerFeePct,\\n uint32 quoteTimestamp\\n ) external payable;\\n\\n function speedUpDeposit(\\n address depositor,\\n uint64 newRelayerFeePct,\\n uint32 depositId,\\n bytes memory depositorSignature\\n ) external;\\n\\n function fillRelay(\\n address depositor,\\n address recipient,\\n address destinationToken,\\n uint256 amount,\\n uint256 maxTokensToSend,\\n uint256 repaymentChainId,\\n uint256 originChainId,\\n uint64 realizedLpFeePct,\\n uint64 relayerFeePct,\\n uint32 depositId\\n ) external;\\n\\n function fillRelayWithUpdatedFee(\\n address depositor,\\n address recipient,\\n address destinationToken,\\n uint256 amount,\\n uint256 maxTokensToSend,\\n uint256 repaymentChainId,\\n uint256 originChainId,\\n uint64 realizedLpFeePct,\\n uint64 relayerFeePct,\\n uint64 newRelayerFeePct,\\n uint32 depositId,\\n bytes memory depositorSignature\\n ) external;\\n\\n function executeSlowRelayRoot(\\n address depositor,\\n address recipient,\\n address destinationToken,\\n uint256 amount,\\n uint256 originChainId,\\n uint64 realizedLpFeePct,\\n uint64 relayerFeePct,\\n uint32 depositId,\\n uint32 rootBundleId,\\n bytes32[] memory proof\\n ) external;\\n\\n function executeRelayerRefundRoot(\\n uint32 rootBundleId,\\n SpokePoolInterface.RelayerRefundLeaf memory relayerRefundLeaf,\\n bytes32[] memory proof\\n ) external;\\n\\n function chainId() external view returns (uint256);\\n}\\n\",\"keccak256\":\"0x33257e146b1f3aecadcefded630c6a8d1308518d1992d84b963a734745ab96a5\",\"license\":\"GPL-3.0-only\"},\"contracts/interfaces/AdapterInterface.sol\":{\"content\":\"// SPDX-License-Identifier: AGPL-3.0-only\\npragma solidity ^0.8.0;\\n\\n/**\\n * @notice Sends cross chain messages and tokens to contracts on a specific L2 network.\\n */\\n\\ninterface AdapterInterface {\\n event HubPoolChanged(address newHubPool);\\n\\n event MessageRelayed(address target, bytes message);\\n\\n event TokensRelayed(address l1Token, address l2Token, uint256 amount, address to);\\n\\n function relayMessage(address target, bytes memory message) external payable;\\n\\n function relayTokens(\\n address l1Token,\\n address l2Token,\\n uint256 amount,\\n address to\\n ) external payable;\\n}\\n\",\"keccak256\":\"0x60e1ed2205f90655fe4152a90709be15bc9550fb3faeaf9835fee22c095bab11\",\"license\":\"AGPL-3.0-only\"},\"contracts/interfaces/WETH9.sol\":{\"content\":\"// SPDX-License-Identifier: GPL-3.0-only\\npragma solidity ^0.8.0;\\n\\ninterface WETH9 {\\n function withdraw(uint256 wad) external;\\n\\n function deposit() external payable;\\n\\n function balanceOf(address guy) external view returns (uint256 wad);\\n\\n function transfer(address guy, uint256 wad) external;\\n}\\n\",\"keccak256\":\"0x7b444d0840b1f76eee9bf39d74830f70644395613b96cce2d80fc50785a82eaa\",\"license\":\"GPL-3.0-only\"}},\"version\":1}", - "bytecode": "0x60806040526003805463ffffffff60c01b1916604b60c31b1790553480156200002757600080fd5b50604051620042c3380380620042c38339810160408190526200004a916200033a565b600080546001600160a81b0319166001600160a01b03831617600160a01b179055338383836200007a84620000ee565b620000858362000194565b6200008f62000236565b600380546001600160a01b039094166001600160a01b031963ffffffff93909316600160a01b02929092166001600160c01b0319909416939093171790915550620000e59150620000df90503390565b620002cb565b5050506200039e565b6001600160a01b0381166200014a5760405162461bcd60e51b815260206004820152601960248201527f4261642062726964676520726f7574657220616464726573730000000000000060448201526064015b60405180910390fd5b600180546001600160a01b0319166001600160a01b0383169081179091556040517fa9e8c42c9e7fca7f62755189a16b2f5314d43d8fb24e91ba54e6d65f9314e84990600090a250565b6001600160a01b038116620001ec5760405162461bcd60e51b815260206004820152601460248201527f4261642068756220706f6f6c2061646472657373000000000000000000000000604482015260640162000141565b600280546001600160a01b0319166001600160a01b0383169081179091556040517f1f17a88f67b0f49060a34bec1a4723a563620e6aa265eb640b5046dcee0759a090600090a250565b600080546001600160a01b031615620002c65760008054906101000a90046001600160a01b03166001600160a01b03166329cb924d6040518163ffffffff1660e01b8152600401602060405180830381865afa1580156200029b573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190620002c1919062000384565b905090565b504290565b600780546001600160a01b038381166001600160a01b0319831681179093556040519116919082907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e090600090a35050565b80516001600160a01b03811681146200033557600080fd5b919050565b6000806000606084860312156200035057600080fd5b6200035b846200031d565b92506200036b602085016200031d565b91506200037b604085016200031d565b90509250925092565b6000602082840312156200039757600080fd5b5051919050565b613f1580620003ae6000396000f3fe6080604052600436106101bb5760003560e01c80638da5cb5b116100ec578063e282d5b91161008a578063f06850f611610064578063f06850f6146105b0578063f2fde38b146105dd578063f500697c146105fd578063ffc351a31461061d57600080fd5b8063e282d5b914610526578063ecda10f514610546578063ee2a53f81461057b57600080fd5b8063ac9650d8116100c6578063ac9650d814610499578063c894c0ca146104b9578063de7eba78146104d9578063e1904402146104f957600080fd5b80638da5cb5b1461041e5780639a8a059214610449578063a1244c671461045c57600080fd5b806349228978116101595780635285e058116101335780635285e0581461036e57806357f6dcb81461039b578063715018a6146103e957806389a153cc146103fe57600080fd5b806349228978146102f0578063493a4f84146103035780635249fef11461032357600080fd5b8063272751c711610195578063272751c7146102605780632752042e1461028057806329cb924d146102a05780633fc8cef3146102c357600080fd5b80631c39c38d146101c75780631dfb2d021461021e57806322f8e5661461024057600080fd5b366101c257005b600080fd5b3480156101d357600080fd5b506000546101f49073ffffffffffffffffffffffffffffffffffffffff1681565b60405173ffffffffffffffffffffffffffffffffffffffff90911681526020015b60405180910390f35b34801561022a57600080fd5b5061023e610239366004613012565b61063d565b005b34801561024c57600080fd5b5061023e61025b36600461302d565b610651565b34801561026c57600080fd5b5061023e61027b366004613054565b6106fa565b34801561028c57600080fd5b5061023e61029b3660046130a8565b610798565b3480156102ac57600080fd5b506102b5610827565b604051908152602001610215565b3480156102cf57600080fd5b506003546101f49073ffffffffffffffffffffffffffffffffffffffff1681565b61023e6102fe3660046130db565b6108df565b34801561030f57600080fd5b5061023e61031e366004613141565b610d8f565b34801561032f57600080fd5b5061035e61033e366004613163565b600460209081526000928352604080842090915290825290205460ff1681565b6040519015158152602001610215565b34801561037a57600080fd5b506001546101f49073ffffffffffffffffffffffffffffffffffffffff1681565b3480156103a757600080fd5b506003546103d4907801000000000000000000000000000000000000000000000000900463ffffffff1681565b60405163ffffffff9091168152602001610215565b3480156103f557600080fd5b5061023e610e3d565b34801561040a57600080fd5b5061023e61041936600461318d565b610eca565b34801561042a57600080fd5b5060075473ffffffffffffffffffffffffffffffffffffffff166101f4565b34801561045557600080fd5b50466102b5565b34801561046857600080fd5b506003546103d4907c0100000000000000000000000000000000000000000000000000000000900463ffffffff1681565b6104ac6104a736600461322b565b61101a565b6040516102159190613316565b3480156104c557600080fd5b5061023e6104d436600461352e565b6111f4565b3480156104e557600080fd5b5061023e6104f4366004613012565b61127d565b34801561050557600080fd5b506002546101f49073ffffffffffffffffffffffffffffffffffffffff1681565b34801561053257600080fd5b5061023e6105413660046136c1565b61128e565b34801561055257600080fd5b506003546103d49074010000000000000000000000000000000000000000900463ffffffff1681565b34801561058757600080fd5b5061059b61059636600461302d565b611371565b60408051928352602083019190915201610215565b3480156105bc57600080fd5b506102b56105cb36600461302d565b60066020526000908152604090205481565b3480156105e957600080fd5b5061023e6105f8366004613012565b61139f565b34801561060957600080fd5b5061023e610618366004613730565b6114cc565b34801561062957600080fd5b5061023e6106383660046137f7565b611557565b6106456116b6565b61064e81611737565b50565b60005473ffffffffffffffffffffffffffffffffffffffff1661067357600080fd5b6000546040517f22f8e5660000000000000000000000000000000000000000000000000000000081526004810183905273ffffffffffffffffffffffffffffffffffffffff909116906322f8e56690602401600060405180830381600087803b1580156106df57600080fd5b505af11580156106f3573d6000803e3d6000fd5b5050505050565b6107026116b6565b73ffffffffffffffffffffffffffffffffffffffff8316600081815260046020908152604080832086845282529182902080547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff001685151590811790915591519182528492917f0a21fdd43d0ad0c62689ee7230a47309a050755bcc52eba00310add65297692a910160405180910390a3505050565b6107a06116b6565b600380547fffffffff00000000ffffffffffffffffffffffffffffffffffffffffffffffff16780100000000000000000000000000000000000000000000000063ffffffff8416908102919091179091556040519081527f0e55dd180fa793d9036c804d0a116e6a7617a48e72cee1f83d92793a793fcc039060200160405180910390a150565b6000805473ffffffffffffffffffffffffffffffffffffffff16156108da5760008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166329cb924d6040518163ffffffff1660e01b8152600401602060405180830381865afa1580156108b1573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906108d591906138d5565b905090565b504290565b73ffffffffffffffffffffffffffffffffffffffff851660009081526004602090815260408083208684529091529020548590849060ff16610982576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152600e60248201527f44697361626c656420726f75746500000000000000000000000000000000000060448201526064015b60405180910390fd5b61098a611823565b6109b7600080547fffffffffffffffffffffff00ffffffffffffffffffffffffffffffffffffffff169055565b6706f05b59d3b200008467ffffffffffffffff1610610a32576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601360248201527f696e76616c69642072656c6179657220666565000000000000000000000000006044820152606401610979565b600354610a61907801000000000000000000000000000000000000000000000000900463ffffffff168461391d565b63ffffffff16610a6f610827565b10158015610ab85750600354610aa7907801000000000000000000000000000000000000000000000000900463ffffffff1684613942565b63ffffffff16610ab5610827565b11155b610b1e576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601260248201527f696e76616c69642071756f74652074696d6500000000000000000000000000006044820152606401610979565b60035473ffffffffffffffffffffffffffffffffffffffff8881169116148015610b485750600034115b15610c3e57853414610bb6576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601b60248201527f6d73672e76616c7565206d757374206d6174636820616d6f756e7400000000006044820152606401610979565b600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663d0e30db0346040518263ffffffff1660e01b81526004016000604051808303818588803b158015610c2057600080fd5b505af1158015610c34573d6000803e3d6000fd5b5050505050610c60565b610c6073ffffffffffffffffffffffffffffffffffffffff88163330896118a7565b600354604080518881526020810188905267ffffffffffffffff87168183015263ffffffff868116606083015273ffffffffffffffffffffffffffffffffffffffff8c8116608084015292513394938c16937c01000000000000000000000000000000000000000000000000000000009004909116917ffc53c5b967d467d4136291c639720626f3d6dda97b4364da813e6858ad48a721919081900360a00190a460016003601c8282829054906101000a900463ffffffff16610d239190613942565b92506101000a81548163ffffffff021916908363ffffffff160217905550610d85600080547fffffffffffffffffffffff00ffffffffffffffffffffffffffffffffffffffff1674010000000000000000000000000000000000000000179055565b5050505050505050565b610d976116b6565b60058054600181018255600091909152600381027f036b6384b5eca791c62761152d0c79bb0604c104a5fb6f4eb0703f3154bb3db181018490557f036b6384b5eca791c62761152d0c79bb0604c104a5fb6f4eb0703f3154bb3db001828155604080518581526020810185905263ffffffff8416917fc86ba04c55bc5eb2f2876b91c438849a296dbec7b08751c3074d92e04f0a77af910160405180910390a250505050565b60075473ffffffffffffffffffffffffffffffffffffffff163314610ebe576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e65726044820152606401610979565b610ec86000611983565b565b610ed2611823565b610eff600080547fffffffffffffffffffffff00ffffffffffffffffffffffffffffffffffffffff169055565b60006040518061010001604052808c73ffffffffffffffffffffffffffffffffffffffff1681526020018b73ffffffffffffffffffffffffffffffffffffffff1681526020018a73ffffffffffffffffffffffffffffffffffffffff1681526020018981526020018681526020018567ffffffffffffffff1681526020018467ffffffffffffffff1681526020018363ffffffff1681525090506000610fa4826119fa565b90506000610fb682848b886000611a2a565b9050610fc782828a88876000611cb8565b50505061100e600080547fffffffffffffffffffffff00ffffffffffffffffffffffffffffffffffffffff1674010000000000000000000000000000000000000000179055565b50505050505050505050565b60603415611084576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601b60248201527f4f6e6c79206d756c746963616c6c207769746820302076616c756500000000006044820152606401610979565b8167ffffffffffffffff81111561109d5761109d613396565b6040519080825280602002602001820160405280156110d057816020015b60608152602001906001900390816110bb5790505b50905060005b828110156111ed57600080308686858181106110f4576110f461396a565b90506020028101906111069190613999565b6040516111149291906139fe565b600060405180830381855af49150503d806000811461114f576040519150601f19603f3d011682016040523d82523d6000602084013e611154565b606091505b5091509150816111ba5760448151101561116d57600080fd5b600481019050808060200190518101906111879190613a0e565b6040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016109799190613a7c565b808484815181106111cd576111cd61396a565b6020026020010181905250505080806111e590613a8f565b9150506110d6565b5092915050565b6111fc611823565b611229600080547fffffffffffffffffffffff00ffffffffffffffffffffffffffffffffffffffff169055565b611234838383611ddd565b611278600080547fffffffffffffffffffffff00ffffffffffffffffffffffffffffffffffffffff1674010000000000000000000000000000000000000000179055565b505050565b6112856116b6565b61064e816121a3565b611296611823565b6112c3600080547fffffffffffffffffffffff00ffffffffffffffffffffffffffffffffffffffff169055565b6112d0844685858561228f565b8373ffffffffffffffffffffffffffffffffffffffff168263ffffffff167fb9de16bf376724405019a10ef4fedac57fecd292bf86c08d81d7c42d394d5d37858460405161131f929190613ac8565b60405180910390a361136b600080547fffffffffffffffffffffff00ffffffffffffffffffffffffffffffffffffffff1674010000000000000000000000000000000000000000179055565b50505050565b6005818154811061138157600080fd5b60009182526020909120600390910201805460019091015490915082565b60075473ffffffffffffffffffffffffffffffffffffffff163314611420576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e65726044820152606401610979565b73ffffffffffffffffffffffffffffffffffffffff81166114c3576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201527f64647265737300000000000000000000000000000000000000000000000000006064820152608401610979565b61064e81611983565b6114d4611823565b611501600080547fffffffffffffffffffffff00ffffffffffffffffffffffffffffffffffffffff169055565b6115138a8a8a8a8a8a8a8a8a8a61232c565b61100e600080547fffffffffffffffffffffff00ffffffffffffffffffffffffffffffffffffffff1674010000000000000000000000000000000000000000179055565b61155f611823565b61158c600080547fffffffffffffffffffffff00ffffffffffffffffffffffffffffffffffffffff169055565b6115998c8785858561228f565b60006040518061010001604052808e73ffffffffffffffffffffffffffffffffffffffff1681526020018d73ffffffffffffffffffffffffffffffffffffffff1681526020018c73ffffffffffffffffffffffffffffffffffffffff1681526020018b81526020018881526020018767ffffffffffffffff1681526020018667ffffffffffffffff1681526020018463ffffffff168152509050600061163e826119fa565b9050600061165082848d896000611a2a565b905061166182828c89876000611cb8565b5050506116a8600080547fffffffffffffffffffffff00ffffffffffffffffffffffffffffffffffffffff1674010000000000000000000000000000000000000000179055565b505050505050505050505050565b60075473ffffffffffffffffffffffffffffffffffffffff163314610ec8576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e65726044820152606401610979565b73ffffffffffffffffffffffffffffffffffffffff81166117b4576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601460248201527f4261642068756220706f6f6c20616464726573730000000000000000000000006044820152606401610979565b600280547fffffffffffffffffffffffff00000000000000000000000000000000000000001673ffffffffffffffffffffffffffffffffffffffff83169081179091556040517f1f17a88f67b0f49060a34bec1a4723a563620e6aa265eb640b5046dcee0759a090600090a250565b60005474010000000000000000000000000000000000000000900460ff16610ec8576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601f60248201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c006044820152606401610979565b60405173ffffffffffffffffffffffffffffffffffffffff8085166024830152831660448201526064810182905261136b9085907f23b872dd00000000000000000000000000000000000000000000000000000000906084015b604080517fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe08184030181529190526020810180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff167fffffffff00000000000000000000000000000000000000000000000000000000909316929092179091526124a4565b6007805473ffffffffffffffffffffffffffffffffffffffff8381167fffffffffffffffffffffffff0000000000000000000000000000000000000000831681179093556040519116919082907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e090600090a35050565b600081604051602001611a0d9190613aeb565b604051602081830303815290604052805190602001209050919050565b60006706f05b59d3b200008367ffffffffffffffff16108015611a6257506706f05b59d3b200008560a0015167ffffffffffffffff16105b611ac8576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152600c60248201527f696e76616c6964206665657300000000000000000000000000000000000000006044820152606401610979565b606085015160008781526006602052604090205410611b43576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152600c60248201527f72656c61792066696c6c656400000000000000000000000000000000000000006044820152606401610979565b83611b5057506000611caf565b611b6984848760a00151611b649190613b77565b6125b0565b60008781526006602052604081205460608801519293508692611b8c9190613b9a565b905082811015611bb557809250611bb283868960a00151611bad9190613b77565b6125f1565b91505b60008881526006602052604081208054859290611bd3908490613bb1565b9091555050600354604088015173ffffffffffffffffffffffffffffffffffffffff90811691161415611c3f5783611c2c576040870151611c2c9073ffffffffffffffffffffffffffffffffffffffff163330856118a7565b611c3a87602001518361261a565b611cac565b83611c7957611c3a338860200151848a6040015173ffffffffffffffffffffffffffffffffffffffff166118a7909392919063ffffffff16565b611cac876020015183896040015173ffffffffffffffffffffffffffffffffffffffff166127269092919063ffffffff16565b50505b95945050505050565b816000015173ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16877fedf6b64f49870333280b7dcf98ec56c6b9ff7cf50aa9be7caecb3874e961849f8560600151600660008c8152602001908152602001600020548a8a89608001518b8b60a001518c60e001518d604001518e602001518e604051611dcd9b9a999897969594939291909a8b5260208b019990995260408a01979097526060890195909552608088019390935267ffffffffffffffff91821660a08801521660c086015263ffffffff1660e085015273ffffffffffffffffffffffffffffffffffffffff9081166101008501521661012083015215156101408201526101600190565b60405180910390a4505050505050565b46826020015114611e4a576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152600f60248201527f496e76616c696420636861696e496400000000000000000000000000000000006044820152606401610979565b8160400151518260a001515114611ebd576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152600c60248201527f696e76616c6964206c65616600000000000000000000000000000000000000006044820152606401610979565b600060058463ffffffff1681548110611ed857611ed861396a565b90600052602060002090600302019050611ef78160010154848461277c565b611f5d576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152600960248201527f4261642050726f6f6600000000000000000000000000000000000000000000006044820152606401610979565b611f7481600201846060015163ffffffff166127b7565b15611fdb576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152600f60248201527f416c726561647920636c61696d656400000000000000000000000000000000006044820152606401610979565b611ff281600201846060015163ffffffff166127f8565b60005b8360400151518163ffffffff16101561209e57600084604001518263ffffffff16815181106120265761202661396a565b60200260200101519050600081111561208b5761208b8560a001518363ffffffff16815181106120585761205861396a565b602002602001015182876080015173ffffffffffffffffffffffffffffffffffffffff166127269092919063ffffffff16565b508061209681613bc9565b915050611ff5565b50825115612137576120af83612836565b826080015173ffffffffffffffffffffffffffffffffffffffff16836060015163ffffffff1684602001517f828fc203220356df8f072a91681caee7d5c75095e2a95e80ed5a14b384697f7186600001513360405161212e92919091825273ffffffffffffffffffffffffffffffffffffffff16602082015260400190565b60405180910390a45b826060015163ffffffff168463ffffffff1684602001517ff8bd640004bcec1b89657020f561d0b070cbdf662d0b158db9dccb0a8301bfab8660000151876040015188608001518960a0015133604051612195959493929190613c6e565b60405180910390a450505050565b73ffffffffffffffffffffffffffffffffffffffff8116612220576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601960248201527f4261642062726964676520726f757465722061646472657373000000000000006044820152606401610979565b600180547fffffffffffffffffffffffff00000000000000000000000000000000000000001673ffffffffffffffffffffffffffffffffffffffff83169081179091556040517fa9e8c42c9e7fca7f62755189a16b2f5314d43d8fb24e91ba54e6d65f9314e84990600090a250565b60408051608060208201819052601160a08301527f4143524f53532d56322d4645452d312e3000000000000000000000000000000060c083015267ffffffffffffffff86169282019290925263ffffffff8416606082015290810185905260009060e0016040516020818303038152906040528051906020012090506000612316826128da565b9050612323878285612915565b50505050505050565b60006040518061010001604052808c73ffffffffffffffffffffffffffffffffffffffff1681526020018b73ffffffffffffffffffffffffffffffffffffffff1681526020018a73ffffffffffffffffffffffffffffffffffffffff1681526020018981526020018881526020018767ffffffffffffffff1681526020018667ffffffffffffffff1681526020018563ffffffff1681525090506123fb60058463ffffffff16815481106123e2576123e261396a565b9060005260206000209060030201600001548284612986565b612461576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152600d60248201527f496e76616c69642070726f6f66000000000000000000000000000000000000006044820152606401610979565b600061246c826119fa565b905060006124838284856060015160006001611a2a565b90506124958282600080876001611cb8565b50505050505050505050505050565b6000612506826040518060400160405280602081526020017f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c65648152508573ffffffffffffffffffffffffffffffffffffffff1661299e9092919063ffffffff16565b80519091501561127857808060200190518101906125249190613ccc565b611278576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602a60248201527f5361666545524332303a204552433230206f7065726174696f6e20646964206e60448201527f6f742073756363656564000000000000000000000000000000000000000000006064820152608401610979565b60006125c482670de0b6b3a7640000613ce9565b67ffffffffffffffff166125e084670de0b6b3a7640000613d0a565b6125ea9190613d76565b9392505050565b6000670de0b6b3a76400006126068382613ce9565b6125e09067ffffffffffffffff1685613d0a565b73ffffffffffffffffffffffffffffffffffffffff82163b1561265f5760035461265b9073ffffffffffffffffffffffffffffffffffffffff168383612726565b5050565b6003546040517f2e1a7d4d0000000000000000000000000000000000000000000000000000000081526004810183905273ffffffffffffffffffffffffffffffffffffffff90911690632e1a7d4d90602401600060405180830381600087803b1580156126cb57600080fd5b505af11580156126df573d6000803e3d6000fd5b505060405173ffffffffffffffffffffffffffffffffffffffff8516925083156108fc02915083906000818181858888f19350505050158015611278573d6000803e3d6000fd5b60405173ffffffffffffffffffffffffffffffffffffffff83166024820152604481018290526112789084907fa9059cbb0000000000000000000000000000000000000000000000000000000090606401611901565b60006127af8285856040516020016127949190613d8a565b604051602081830303815290604052805190602001206129ad565b949350505050565b6000806127c661010084613d76565b905060006127d661010085613e25565b6000928352602095909552506040902054600190931b92831690921492915050565b600061280661010083613d76565b9050600061281661010084613e25565b600092835260209490945250604090208054600190931b90921790915550565b608081015160025482516040517fa9059cbb00000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff9283166004820152602481019190915291169063a9059cbb906044016020604051808303816000875af11580156128b6573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061265b9190613ccc565b6040517f19457468657265756d205369676e6564204d6573736167653a0a3332000000006020820152603c8101829052600090605c01611a0d565b6129208383836129c3565b611278576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601160248201527f696e76616c6964207369676e61747572650000000000000000000000000000006044820152606401610979565b60006127af8285856040516020016127949190613aeb565b60606127af8484600085612bb2565b6000826129ba8584612d48565b14949350505050565b60008060006129d28585612dbc565b909250905060008160048111156129eb576129eb613e39565b148015612a2357508573ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff16145b15612a33576001925050506125ea565b6000808773ffffffffffffffffffffffffffffffffffffffff16631626ba7e60e01b8888604051602401612a68929190613e68565b604080517fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe08184030181529181526020820180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff167fffffffff00000000000000000000000000000000000000000000000000000000909416939093179092529051612af19190613e81565b600060405180830381855afa9150503d8060008114612b2c576040519150601f19603f3d011682016040523d82523d6000602084013e612b31565b606091505b5091509150818015612b44575080516020145b8015612ba6575080517f1626ba7e0000000000000000000000000000000000000000000000000000000090612b829083016020908101908401613e9d565b7fffffffff0000000000000000000000000000000000000000000000000000000016145b98975050505050505050565b606082471015612c44576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602660248201527f416464726573733a20696e73756666696369656e742062616c616e636520666f60448201527f722063616c6c00000000000000000000000000000000000000000000000000006064820152608401610979565b73ffffffffffffffffffffffffffffffffffffffff85163b612cc2576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e74726163740000006044820152606401610979565b6000808673ffffffffffffffffffffffffffffffffffffffff168587604051612ceb9190613e81565b60006040518083038185875af1925050503d8060008114612d28576040519150601f19603f3d011682016040523d82523d6000602084013e612d2d565b606091505b5091509150612d3d828286612e2c565b979650505050505050565b600081815b8451811015612db4576000858281518110612d6a57612d6a61396a565b60200260200101519050808311612d905760008381526020829052604090209250612da1565b600081815260208490526040902092505b5080612dac81613a8f565b915050612d4d565b509392505050565b600080825160411415612df35760208301516040840151606085015160001a612de787828585612e7f565b94509450505050612e25565b825160401415612e1d5760208301516040840151612e12868383612f97565b935093505050612e25565b506000905060025b9250929050565b60608315612e3b5750816125ea565b825115612e4b5782518084602001fd5b816040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016109799190613a7c565b6000807f7fffffffffffffffffffffffffffffff5d576e7357a4501ddfe92f46681b20a0831115612eb65750600090506003612f8e565b8460ff16601b14158015612ece57508460ff16601c14155b15612edf5750600090506004612f8e565b6040805160008082526020820180845289905260ff881692820192909252606081018690526080810185905260019060a0016020604051602081039080840390855afa158015612f33573d6000803e3d6000fd5b50506040517fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0015191505073ffffffffffffffffffffffffffffffffffffffff8116612f8757600060019250925050612f8e565b9150600090505b94509492505050565b6000807f7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff831681612fcd60ff86901c601b613bb1565b9050612fdb87828885612e7f565b935093505050935093915050565b803573ffffffffffffffffffffffffffffffffffffffff8116811461300d57600080fd5b919050565b60006020828403121561302457600080fd5b6125ea82612fe9565b60006020828403121561303f57600080fd5b5035919050565b801515811461064e57600080fd5b60008060006060848603121561306957600080fd5b61307284612fe9565b925060208401359150604084013561308981613046565b809150509250925092565b803563ffffffff8116811461300d57600080fd5b6000602082840312156130ba57600080fd5b6125ea82613094565b803567ffffffffffffffff8116811461300d57600080fd5b60008060008060008060c087890312156130f457600080fd5b6130fd87612fe9565b955061310b60208801612fe9565b94506040870135935060608701359250613127608088016130c3565b915061313560a08801613094565b90509295509295509295565b6000806040838503121561315457600080fd5b50508035926020909101359150565b6000806040838503121561317657600080fd5b61317f83612fe9565b946020939093013593505050565b6000806000806000806000806000806101408b8d0312156131ad57600080fd5b6131b68b612fe9565b99506131c460208c01612fe9565b98506131d260408c01612fe9565b975060608b0135965060808b0135955060a08b0135945060c08b013593506131fc60e08c016130c3565b925061320b6101008c016130c3565b915061321a6101208c01613094565b90509295989b9194979a5092959850565b6000806020838503121561323e57600080fd5b823567ffffffffffffffff8082111561325657600080fd5b818501915085601f83011261326a57600080fd5b81358181111561327957600080fd5b8660208260051b850101111561328e57600080fd5b60209290920196919550909350505050565b60005b838110156132bb5781810151838201526020016132a3565b8381111561136b5750506000910152565b600081518084526132e48160208601602086016132a0565b601f017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0169290920160200192915050565b6000602080830181845280855180835260408601915060408160051b870101925083870160005b82811015613389577fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc08886030184526133778583516132cc565b9450928501929085019060010161333d565b5092979650505050505050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b60405160c0810167ffffffffffffffff811182821017156133e8576133e8613396565b60405290565b604051601f82017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe016810167ffffffffffffffff8111828210171561343557613435613396565b604052919050565b600067ffffffffffffffff82111561345757613457613396565b5060051b60200190565b600082601f83011261347257600080fd5b813560206134876134828361343d565b6133ee565b82815260059290921b840181019181810190868411156134a657600080fd5b8286015b848110156134c157803583529183019183016134aa565b509695505050505050565b600082601f8301126134dd57600080fd5b813560206134ed6134828361343d565b82815260059290921b8401810191818101908684111561350c57600080fd5b8286015b848110156134c15761352181612fe9565b8352918301918301613510565b60008060006060848603121561354357600080fd5b61354c84613094565b9250602084013567ffffffffffffffff8082111561356957600080fd5b9085019060c0828803121561357d57600080fd5b6135856133c5565b82358152602083013560208201526040830135828111156135a557600080fd5b6135b189828601613461565b6040830152506135c360608401613094565b60608201526135d460808401612fe9565b608082015260a0830135828111156135eb57600080fd5b6135f7898286016134cc565b60a0830152509350604086013591508082111561361357600080fd5b5061362086828701613461565b9150509250925092565b600067ffffffffffffffff82111561364457613644613396565b50601f017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe01660200190565b600082601f83011261368157600080fd5b813561368f6134828261362a565b8181528460208386010111156136a457600080fd5b816020850160208301376000918101602001919091529392505050565b600080600080608085870312156136d757600080fd5b6136e085612fe9565b93506136ee602086016130c3565b92506136fc60408601613094565b9150606085013567ffffffffffffffff81111561371857600080fd5b61372487828801613670565b91505092959194509250565b6000806000806000806000806000806101408b8d03121561375057600080fd5b6137598b612fe9565b995061376760208c01612fe9565b985061377560408c01612fe9565b975060608b0135965060808b0135955061379160a08c016130c3565b945061379f60c08c016130c3565b93506137ad60e08c01613094565b92506137bc6101008c01613094565b91506101208b013567ffffffffffffffff8111156137d957600080fd5b6137e58d828e01613461565b9150509295989b9194979a5092959850565b6000806000806000806000806000806000806101808d8f03121561381a57600080fd5b6138238d612fe9565b9b5061383160208e01612fe9565b9a5061383f60408e01612fe9565b995060608d0135985060808d0135975060a08d0135965060c08d0135955061386960e08e016130c3565b94506138786101008e016130c3565b93506138876101208e016130c3565b92506138966101408e01613094565b915067ffffffffffffffff6101608e013511156138b257600080fd5b6138c38e6101608f01358f01613670565b90509295989b509295989b509295989b565b6000602082840312156138e757600080fd5b5051919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b600063ffffffff8381169083168181101561393a5761393a6138ee565b039392505050565b600063ffffffff808316818516808303821115613961576139616138ee565b01949350505050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b60008083357fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe18436030181126139ce57600080fd5b83018035915067ffffffffffffffff8211156139e957600080fd5b602001915036819003821315612e2557600080fd5b8183823760009101908152919050565b600060208284031215613a2057600080fd5b815167ffffffffffffffff811115613a3757600080fd5b8201601f81018413613a4857600080fd5b8051613a566134828261362a565b818152856020838501011115613a6b57600080fd5b611caf8260208301602086016132a0565b6020815260006125ea60208301846132cc565b60007fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff821415613ac157613ac16138ee565b5060010190565b67ffffffffffffffff831681526040602082015260006127af60408301846132cc565b60006101008201905073ffffffffffffffffffffffffffffffffffffffff80845116835280602085015116602084015280604085015116604084015250606083015160608301526080830151608083015260a083015167ffffffffffffffff80821660a08501528060c08601511660c0850152505060e08301516111ed60e084018263ffffffff169052565b600067ffffffffffffffff808316818516808303821115613961576139616138ee565b600082821015613bac57613bac6138ee565b500390565b60008219821115613bc457613bc46138ee565b500190565b600063ffffffff80831681811415613be357613be36138ee565b6001019392505050565b600081518084526020808501945080840160005b83811015613c1d57815187529582019590820190600101613c01565b509495945050505050565b600081518084526020808501945080840160005b83811015613c1d57815173ffffffffffffffffffffffffffffffffffffffff1687529582019590820190600101613c3c565b85815260a060208201526000613c8760a0830187613bed565b73ffffffffffffffffffffffffffffffffffffffff80871660408501528382036060850152613cb68287613c28565b9250808516608085015250509695505050505050565b600060208284031215613cde57600080fd5b81516125ea81613046565b600067ffffffffffffffff8381169083168181101561393a5761393a6138ee565b6000817fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0483118215151615613d4257613d426138ee565b500290565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601260045260246000fd5b600082613d8557613d85613d47565b500490565b6020815281516020820152602082015160408201526000604083015160c06060840152613dba60e0840182613bed565b905063ffffffff606085015116608084015273ffffffffffffffffffffffffffffffffffffffff60808501511660a084015260a08401517fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe08483030160c0850152611caf8282613c28565b600082613e3457613e34613d47565b500690565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052602160045260246000fd5b8281526040602082015260006127af60408301846132cc565b60008251613e938184602087016132a0565b9190910192915050565b600060208284031215613eaf57600080fd5b81517fffffffff00000000000000000000000000000000000000000000000000000000811681146125ea57600080fdfea2646970667358221220bd80d79b6a81460de18a2bd508f914365d7ed05be2e4a268227c40afeedfcc9e64736f6c634300080b0033", - "deployedBytecode": "0x6080604052600436106101bb5760003560e01c80638da5cb5b116100ec578063e282d5b91161008a578063f06850f611610064578063f06850f6146105b0578063f2fde38b146105dd578063f500697c146105fd578063ffc351a31461061d57600080fd5b8063e282d5b914610526578063ecda10f514610546578063ee2a53f81461057b57600080fd5b8063ac9650d8116100c6578063ac9650d814610499578063c894c0ca146104b9578063de7eba78146104d9578063e1904402146104f957600080fd5b80638da5cb5b1461041e5780639a8a059214610449578063a1244c671461045c57600080fd5b806349228978116101595780635285e058116101335780635285e0581461036e57806357f6dcb81461039b578063715018a6146103e957806389a153cc146103fe57600080fd5b806349228978146102f0578063493a4f84146103035780635249fef11461032357600080fd5b8063272751c711610195578063272751c7146102605780632752042e1461028057806329cb924d146102a05780633fc8cef3146102c357600080fd5b80631c39c38d146101c75780631dfb2d021461021e57806322f8e5661461024057600080fd5b366101c257005b600080fd5b3480156101d357600080fd5b506000546101f49073ffffffffffffffffffffffffffffffffffffffff1681565b60405173ffffffffffffffffffffffffffffffffffffffff90911681526020015b60405180910390f35b34801561022a57600080fd5b5061023e610239366004613012565b61063d565b005b34801561024c57600080fd5b5061023e61025b36600461302d565b610651565b34801561026c57600080fd5b5061023e61027b366004613054565b6106fa565b34801561028c57600080fd5b5061023e61029b3660046130a8565b610798565b3480156102ac57600080fd5b506102b5610827565b604051908152602001610215565b3480156102cf57600080fd5b506003546101f49073ffffffffffffffffffffffffffffffffffffffff1681565b61023e6102fe3660046130db565b6108df565b34801561030f57600080fd5b5061023e61031e366004613141565b610d8f565b34801561032f57600080fd5b5061035e61033e366004613163565b600460209081526000928352604080842090915290825290205460ff1681565b6040519015158152602001610215565b34801561037a57600080fd5b506001546101f49073ffffffffffffffffffffffffffffffffffffffff1681565b3480156103a757600080fd5b506003546103d4907801000000000000000000000000000000000000000000000000900463ffffffff1681565b60405163ffffffff9091168152602001610215565b3480156103f557600080fd5b5061023e610e3d565b34801561040a57600080fd5b5061023e61041936600461318d565b610eca565b34801561042a57600080fd5b5060075473ffffffffffffffffffffffffffffffffffffffff166101f4565b34801561045557600080fd5b50466102b5565b34801561046857600080fd5b506003546103d4907c0100000000000000000000000000000000000000000000000000000000900463ffffffff1681565b6104ac6104a736600461322b565b61101a565b6040516102159190613316565b3480156104c557600080fd5b5061023e6104d436600461352e565b6111f4565b3480156104e557600080fd5b5061023e6104f4366004613012565b61127d565b34801561050557600080fd5b506002546101f49073ffffffffffffffffffffffffffffffffffffffff1681565b34801561053257600080fd5b5061023e6105413660046136c1565b61128e565b34801561055257600080fd5b506003546103d49074010000000000000000000000000000000000000000900463ffffffff1681565b34801561058757600080fd5b5061059b61059636600461302d565b611371565b60408051928352602083019190915201610215565b3480156105bc57600080fd5b506102b56105cb36600461302d565b60066020526000908152604090205481565b3480156105e957600080fd5b5061023e6105f8366004613012565b61139f565b34801561060957600080fd5b5061023e610618366004613730565b6114cc565b34801561062957600080fd5b5061023e6106383660046137f7565b611557565b6106456116b6565b61064e81611737565b50565b60005473ffffffffffffffffffffffffffffffffffffffff1661067357600080fd5b6000546040517f22f8e5660000000000000000000000000000000000000000000000000000000081526004810183905273ffffffffffffffffffffffffffffffffffffffff909116906322f8e56690602401600060405180830381600087803b1580156106df57600080fd5b505af11580156106f3573d6000803e3d6000fd5b5050505050565b6107026116b6565b73ffffffffffffffffffffffffffffffffffffffff8316600081815260046020908152604080832086845282529182902080547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff001685151590811790915591519182528492917f0a21fdd43d0ad0c62689ee7230a47309a050755bcc52eba00310add65297692a910160405180910390a3505050565b6107a06116b6565b600380547fffffffff00000000ffffffffffffffffffffffffffffffffffffffffffffffff16780100000000000000000000000000000000000000000000000063ffffffff8416908102919091179091556040519081527f0e55dd180fa793d9036c804d0a116e6a7617a48e72cee1f83d92793a793fcc039060200160405180910390a150565b6000805473ffffffffffffffffffffffffffffffffffffffff16156108da5760008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166329cb924d6040518163ffffffff1660e01b8152600401602060405180830381865afa1580156108b1573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906108d591906138d5565b905090565b504290565b73ffffffffffffffffffffffffffffffffffffffff851660009081526004602090815260408083208684529091529020548590849060ff16610982576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152600e60248201527f44697361626c656420726f75746500000000000000000000000000000000000060448201526064015b60405180910390fd5b61098a611823565b6109b7600080547fffffffffffffffffffffff00ffffffffffffffffffffffffffffffffffffffff169055565b6706f05b59d3b200008467ffffffffffffffff1610610a32576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601360248201527f696e76616c69642072656c6179657220666565000000000000000000000000006044820152606401610979565b600354610a61907801000000000000000000000000000000000000000000000000900463ffffffff168461391d565b63ffffffff16610a6f610827565b10158015610ab85750600354610aa7907801000000000000000000000000000000000000000000000000900463ffffffff1684613942565b63ffffffff16610ab5610827565b11155b610b1e576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601260248201527f696e76616c69642071756f74652074696d6500000000000000000000000000006044820152606401610979565b60035473ffffffffffffffffffffffffffffffffffffffff8881169116148015610b485750600034115b15610c3e57853414610bb6576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601b60248201527f6d73672e76616c7565206d757374206d6174636820616d6f756e7400000000006044820152606401610979565b600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663d0e30db0346040518263ffffffff1660e01b81526004016000604051808303818588803b158015610c2057600080fd5b505af1158015610c34573d6000803e3d6000fd5b5050505050610c60565b610c6073ffffffffffffffffffffffffffffffffffffffff88163330896118a7565b600354604080518881526020810188905267ffffffffffffffff87168183015263ffffffff868116606083015273ffffffffffffffffffffffffffffffffffffffff8c8116608084015292513394938c16937c01000000000000000000000000000000000000000000000000000000009004909116917ffc53c5b967d467d4136291c639720626f3d6dda97b4364da813e6858ad48a721919081900360a00190a460016003601c8282829054906101000a900463ffffffff16610d239190613942565b92506101000a81548163ffffffff021916908363ffffffff160217905550610d85600080547fffffffffffffffffffffff00ffffffffffffffffffffffffffffffffffffffff1674010000000000000000000000000000000000000000179055565b5050505050505050565b610d976116b6565b60058054600181018255600091909152600381027f036b6384b5eca791c62761152d0c79bb0604c104a5fb6f4eb0703f3154bb3db181018490557f036b6384b5eca791c62761152d0c79bb0604c104a5fb6f4eb0703f3154bb3db001828155604080518581526020810185905263ffffffff8416917fc86ba04c55bc5eb2f2876b91c438849a296dbec7b08751c3074d92e04f0a77af910160405180910390a250505050565b60075473ffffffffffffffffffffffffffffffffffffffff163314610ebe576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e65726044820152606401610979565b610ec86000611983565b565b610ed2611823565b610eff600080547fffffffffffffffffffffff00ffffffffffffffffffffffffffffffffffffffff169055565b60006040518061010001604052808c73ffffffffffffffffffffffffffffffffffffffff1681526020018b73ffffffffffffffffffffffffffffffffffffffff1681526020018a73ffffffffffffffffffffffffffffffffffffffff1681526020018981526020018681526020018567ffffffffffffffff1681526020018467ffffffffffffffff1681526020018363ffffffff1681525090506000610fa4826119fa565b90506000610fb682848b886000611a2a565b9050610fc782828a88876000611cb8565b50505061100e600080547fffffffffffffffffffffff00ffffffffffffffffffffffffffffffffffffffff1674010000000000000000000000000000000000000000179055565b50505050505050505050565b60603415611084576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601b60248201527f4f6e6c79206d756c746963616c6c207769746820302076616c756500000000006044820152606401610979565b8167ffffffffffffffff81111561109d5761109d613396565b6040519080825280602002602001820160405280156110d057816020015b60608152602001906001900390816110bb5790505b50905060005b828110156111ed57600080308686858181106110f4576110f461396a565b90506020028101906111069190613999565b6040516111149291906139fe565b600060405180830381855af49150503d806000811461114f576040519150601f19603f3d011682016040523d82523d6000602084013e611154565b606091505b5091509150816111ba5760448151101561116d57600080fd5b600481019050808060200190518101906111879190613a0e565b6040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016109799190613a7c565b808484815181106111cd576111cd61396a565b6020026020010181905250505080806111e590613a8f565b9150506110d6565b5092915050565b6111fc611823565b611229600080547fffffffffffffffffffffff00ffffffffffffffffffffffffffffffffffffffff169055565b611234838383611ddd565b611278600080547fffffffffffffffffffffff00ffffffffffffffffffffffffffffffffffffffff1674010000000000000000000000000000000000000000179055565b505050565b6112856116b6565b61064e816121a3565b611296611823565b6112c3600080547fffffffffffffffffffffff00ffffffffffffffffffffffffffffffffffffffff169055565b6112d0844685858561228f565b8373ffffffffffffffffffffffffffffffffffffffff168263ffffffff167fb9de16bf376724405019a10ef4fedac57fecd292bf86c08d81d7c42d394d5d37858460405161131f929190613ac8565b60405180910390a361136b600080547fffffffffffffffffffffff00ffffffffffffffffffffffffffffffffffffffff1674010000000000000000000000000000000000000000179055565b50505050565b6005818154811061138157600080fd5b60009182526020909120600390910201805460019091015490915082565b60075473ffffffffffffffffffffffffffffffffffffffff163314611420576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e65726044820152606401610979565b73ffffffffffffffffffffffffffffffffffffffff81166114c3576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201527f64647265737300000000000000000000000000000000000000000000000000006064820152608401610979565b61064e81611983565b6114d4611823565b611501600080547fffffffffffffffffffffff00ffffffffffffffffffffffffffffffffffffffff169055565b6115138a8a8a8a8a8a8a8a8a8a61232c565b61100e600080547fffffffffffffffffffffff00ffffffffffffffffffffffffffffffffffffffff1674010000000000000000000000000000000000000000179055565b61155f611823565b61158c600080547fffffffffffffffffffffff00ffffffffffffffffffffffffffffffffffffffff169055565b6115998c8785858561228f565b60006040518061010001604052808e73ffffffffffffffffffffffffffffffffffffffff1681526020018d73ffffffffffffffffffffffffffffffffffffffff1681526020018c73ffffffffffffffffffffffffffffffffffffffff1681526020018b81526020018881526020018767ffffffffffffffff1681526020018667ffffffffffffffff1681526020018463ffffffff168152509050600061163e826119fa565b9050600061165082848d896000611a2a565b905061166182828c89876000611cb8565b5050506116a8600080547fffffffffffffffffffffff00ffffffffffffffffffffffffffffffffffffffff1674010000000000000000000000000000000000000000179055565b505050505050505050505050565b60075473ffffffffffffffffffffffffffffffffffffffff163314610ec8576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e65726044820152606401610979565b73ffffffffffffffffffffffffffffffffffffffff81166117b4576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601460248201527f4261642068756220706f6f6c20616464726573730000000000000000000000006044820152606401610979565b600280547fffffffffffffffffffffffff00000000000000000000000000000000000000001673ffffffffffffffffffffffffffffffffffffffff83169081179091556040517f1f17a88f67b0f49060a34bec1a4723a563620e6aa265eb640b5046dcee0759a090600090a250565b60005474010000000000000000000000000000000000000000900460ff16610ec8576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601f60248201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c006044820152606401610979565b60405173ffffffffffffffffffffffffffffffffffffffff8085166024830152831660448201526064810182905261136b9085907f23b872dd00000000000000000000000000000000000000000000000000000000906084015b604080517fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe08184030181529190526020810180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff167fffffffff00000000000000000000000000000000000000000000000000000000909316929092179091526124a4565b6007805473ffffffffffffffffffffffffffffffffffffffff8381167fffffffffffffffffffffffff0000000000000000000000000000000000000000831681179093556040519116919082907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e090600090a35050565b600081604051602001611a0d9190613aeb565b604051602081830303815290604052805190602001209050919050565b60006706f05b59d3b200008367ffffffffffffffff16108015611a6257506706f05b59d3b200008560a0015167ffffffffffffffff16105b611ac8576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152600c60248201527f696e76616c6964206665657300000000000000000000000000000000000000006044820152606401610979565b606085015160008781526006602052604090205410611b43576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152600c60248201527f72656c61792066696c6c656400000000000000000000000000000000000000006044820152606401610979565b83611b5057506000611caf565b611b6984848760a00151611b649190613b77565b6125b0565b60008781526006602052604081205460608801519293508692611b8c9190613b9a565b905082811015611bb557809250611bb283868960a00151611bad9190613b77565b6125f1565b91505b60008881526006602052604081208054859290611bd3908490613bb1565b9091555050600354604088015173ffffffffffffffffffffffffffffffffffffffff90811691161415611c3f5783611c2c576040870151611c2c9073ffffffffffffffffffffffffffffffffffffffff163330856118a7565b611c3a87602001518361261a565b611cac565b83611c7957611c3a338860200151848a6040015173ffffffffffffffffffffffffffffffffffffffff166118a7909392919063ffffffff16565b611cac876020015183896040015173ffffffffffffffffffffffffffffffffffffffff166127269092919063ffffffff16565b50505b95945050505050565b816000015173ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16877fedf6b64f49870333280b7dcf98ec56c6b9ff7cf50aa9be7caecb3874e961849f8560600151600660008c8152602001908152602001600020548a8a89608001518b8b60a001518c60e001518d604001518e602001518e604051611dcd9b9a999897969594939291909a8b5260208b019990995260408a01979097526060890195909552608088019390935267ffffffffffffffff91821660a08801521660c086015263ffffffff1660e085015273ffffffffffffffffffffffffffffffffffffffff9081166101008501521661012083015215156101408201526101600190565b60405180910390a4505050505050565b46826020015114611e4a576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152600f60248201527f496e76616c696420636861696e496400000000000000000000000000000000006044820152606401610979565b8160400151518260a001515114611ebd576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152600c60248201527f696e76616c6964206c65616600000000000000000000000000000000000000006044820152606401610979565b600060058463ffffffff1681548110611ed857611ed861396a565b90600052602060002090600302019050611ef78160010154848461277c565b611f5d576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152600960248201527f4261642050726f6f6600000000000000000000000000000000000000000000006044820152606401610979565b611f7481600201846060015163ffffffff166127b7565b15611fdb576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152600f60248201527f416c726561647920636c61696d656400000000000000000000000000000000006044820152606401610979565b611ff281600201846060015163ffffffff166127f8565b60005b8360400151518163ffffffff16101561209e57600084604001518263ffffffff16815181106120265761202661396a565b60200260200101519050600081111561208b5761208b8560a001518363ffffffff16815181106120585761205861396a565b602002602001015182876080015173ffffffffffffffffffffffffffffffffffffffff166127269092919063ffffffff16565b508061209681613bc9565b915050611ff5565b50825115612137576120af83612836565b826080015173ffffffffffffffffffffffffffffffffffffffff16836060015163ffffffff1684602001517f828fc203220356df8f072a91681caee7d5c75095e2a95e80ed5a14b384697f7186600001513360405161212e92919091825273ffffffffffffffffffffffffffffffffffffffff16602082015260400190565b60405180910390a45b826060015163ffffffff168463ffffffff1684602001517ff8bd640004bcec1b89657020f561d0b070cbdf662d0b158db9dccb0a8301bfab8660000151876040015188608001518960a0015133604051612195959493929190613c6e565b60405180910390a450505050565b73ffffffffffffffffffffffffffffffffffffffff8116612220576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601960248201527f4261642062726964676520726f757465722061646472657373000000000000006044820152606401610979565b600180547fffffffffffffffffffffffff00000000000000000000000000000000000000001673ffffffffffffffffffffffffffffffffffffffff83169081179091556040517fa9e8c42c9e7fca7f62755189a16b2f5314d43d8fb24e91ba54e6d65f9314e84990600090a250565b60408051608060208201819052601160a08301527f4143524f53532d56322d4645452d312e3000000000000000000000000000000060c083015267ffffffffffffffff86169282019290925263ffffffff8416606082015290810185905260009060e0016040516020818303038152906040528051906020012090506000612316826128da565b9050612323878285612915565b50505050505050565b60006040518061010001604052808c73ffffffffffffffffffffffffffffffffffffffff1681526020018b73ffffffffffffffffffffffffffffffffffffffff1681526020018a73ffffffffffffffffffffffffffffffffffffffff1681526020018981526020018881526020018767ffffffffffffffff1681526020018667ffffffffffffffff1681526020018563ffffffff1681525090506123fb60058463ffffffff16815481106123e2576123e261396a565b9060005260206000209060030201600001548284612986565b612461576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152600d60248201527f496e76616c69642070726f6f66000000000000000000000000000000000000006044820152606401610979565b600061246c826119fa565b905060006124838284856060015160006001611a2a565b90506124958282600080876001611cb8565b50505050505050505050505050565b6000612506826040518060400160405280602081526020017f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c65648152508573ffffffffffffffffffffffffffffffffffffffff1661299e9092919063ffffffff16565b80519091501561127857808060200190518101906125249190613ccc565b611278576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602a60248201527f5361666545524332303a204552433230206f7065726174696f6e20646964206e60448201527f6f742073756363656564000000000000000000000000000000000000000000006064820152608401610979565b60006125c482670de0b6b3a7640000613ce9565b67ffffffffffffffff166125e084670de0b6b3a7640000613d0a565b6125ea9190613d76565b9392505050565b6000670de0b6b3a76400006126068382613ce9565b6125e09067ffffffffffffffff1685613d0a565b73ffffffffffffffffffffffffffffffffffffffff82163b1561265f5760035461265b9073ffffffffffffffffffffffffffffffffffffffff168383612726565b5050565b6003546040517f2e1a7d4d0000000000000000000000000000000000000000000000000000000081526004810183905273ffffffffffffffffffffffffffffffffffffffff90911690632e1a7d4d90602401600060405180830381600087803b1580156126cb57600080fd5b505af11580156126df573d6000803e3d6000fd5b505060405173ffffffffffffffffffffffffffffffffffffffff8516925083156108fc02915083906000818181858888f19350505050158015611278573d6000803e3d6000fd5b60405173ffffffffffffffffffffffffffffffffffffffff83166024820152604481018290526112789084907fa9059cbb0000000000000000000000000000000000000000000000000000000090606401611901565b60006127af8285856040516020016127949190613d8a565b604051602081830303815290604052805190602001206129ad565b949350505050565b6000806127c661010084613d76565b905060006127d661010085613e25565b6000928352602095909552506040902054600190931b92831690921492915050565b600061280661010083613d76565b9050600061281661010084613e25565b600092835260209490945250604090208054600190931b90921790915550565b608081015160025482516040517fa9059cbb00000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff9283166004820152602481019190915291169063a9059cbb906044016020604051808303816000875af11580156128b6573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061265b9190613ccc565b6040517f19457468657265756d205369676e6564204d6573736167653a0a3332000000006020820152603c8101829052600090605c01611a0d565b6129208383836129c3565b611278576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601160248201527f696e76616c6964207369676e61747572650000000000000000000000000000006044820152606401610979565b60006127af8285856040516020016127949190613aeb565b60606127af8484600085612bb2565b6000826129ba8584612d48565b14949350505050565b60008060006129d28585612dbc565b909250905060008160048111156129eb576129eb613e39565b148015612a2357508573ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff16145b15612a33576001925050506125ea565b6000808773ffffffffffffffffffffffffffffffffffffffff16631626ba7e60e01b8888604051602401612a68929190613e68565b604080517fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe08184030181529181526020820180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff167fffffffff00000000000000000000000000000000000000000000000000000000909416939093179092529051612af19190613e81565b600060405180830381855afa9150503d8060008114612b2c576040519150601f19603f3d011682016040523d82523d6000602084013e612b31565b606091505b5091509150818015612b44575080516020145b8015612ba6575080517f1626ba7e0000000000000000000000000000000000000000000000000000000090612b829083016020908101908401613e9d565b7fffffffff0000000000000000000000000000000000000000000000000000000016145b98975050505050505050565b606082471015612c44576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602660248201527f416464726573733a20696e73756666696369656e742062616c616e636520666f60448201527f722063616c6c00000000000000000000000000000000000000000000000000006064820152608401610979565b73ffffffffffffffffffffffffffffffffffffffff85163b612cc2576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e74726163740000006044820152606401610979565b6000808673ffffffffffffffffffffffffffffffffffffffff168587604051612ceb9190613e81565b60006040518083038185875af1925050503d8060008114612d28576040519150601f19603f3d011682016040523d82523d6000602084013e612d2d565b606091505b5091509150612d3d828286612e2c565b979650505050505050565b600081815b8451811015612db4576000858281518110612d6a57612d6a61396a565b60200260200101519050808311612d905760008381526020829052604090209250612da1565b600081815260208490526040902092505b5080612dac81613a8f565b915050612d4d565b509392505050565b600080825160411415612df35760208301516040840151606085015160001a612de787828585612e7f565b94509450505050612e25565b825160401415612e1d5760208301516040840151612e12868383612f97565b935093505050612e25565b506000905060025b9250929050565b60608315612e3b5750816125ea565b825115612e4b5782518084602001fd5b816040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016109799190613a7c565b6000807f7fffffffffffffffffffffffffffffff5d576e7357a4501ddfe92f46681b20a0831115612eb65750600090506003612f8e565b8460ff16601b14158015612ece57508460ff16601c14155b15612edf5750600090506004612f8e565b6040805160008082526020820180845289905260ff881692820192909252606081018690526080810185905260019060a0016020604051602081039080840390855afa158015612f33573d6000803e3d6000fd5b50506040517fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0015191505073ffffffffffffffffffffffffffffffffffffffff8116612f8757600060019250925050612f8e565b9150600090505b94509492505050565b6000807f7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff831681612fcd60ff86901c601b613bb1565b9050612fdb87828885612e7f565b935093505050935093915050565b803573ffffffffffffffffffffffffffffffffffffffff8116811461300d57600080fd5b919050565b60006020828403121561302457600080fd5b6125ea82612fe9565b60006020828403121561303f57600080fd5b5035919050565b801515811461064e57600080fd5b60008060006060848603121561306957600080fd5b61307284612fe9565b925060208401359150604084013561308981613046565b809150509250925092565b803563ffffffff8116811461300d57600080fd5b6000602082840312156130ba57600080fd5b6125ea82613094565b803567ffffffffffffffff8116811461300d57600080fd5b60008060008060008060c087890312156130f457600080fd5b6130fd87612fe9565b955061310b60208801612fe9565b94506040870135935060608701359250613127608088016130c3565b915061313560a08801613094565b90509295509295509295565b6000806040838503121561315457600080fd5b50508035926020909101359150565b6000806040838503121561317657600080fd5b61317f83612fe9565b946020939093013593505050565b6000806000806000806000806000806101408b8d0312156131ad57600080fd5b6131b68b612fe9565b99506131c460208c01612fe9565b98506131d260408c01612fe9565b975060608b0135965060808b0135955060a08b0135945060c08b013593506131fc60e08c016130c3565b925061320b6101008c016130c3565b915061321a6101208c01613094565b90509295989b9194979a5092959850565b6000806020838503121561323e57600080fd5b823567ffffffffffffffff8082111561325657600080fd5b818501915085601f83011261326a57600080fd5b81358181111561327957600080fd5b8660208260051b850101111561328e57600080fd5b60209290920196919550909350505050565b60005b838110156132bb5781810151838201526020016132a3565b8381111561136b5750506000910152565b600081518084526132e48160208601602086016132a0565b601f017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0169290920160200192915050565b6000602080830181845280855180835260408601915060408160051b870101925083870160005b82811015613389577fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc08886030184526133778583516132cc565b9450928501929085019060010161333d565b5092979650505050505050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b60405160c0810167ffffffffffffffff811182821017156133e8576133e8613396565b60405290565b604051601f82017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe016810167ffffffffffffffff8111828210171561343557613435613396565b604052919050565b600067ffffffffffffffff82111561345757613457613396565b5060051b60200190565b600082601f83011261347257600080fd5b813560206134876134828361343d565b6133ee565b82815260059290921b840181019181810190868411156134a657600080fd5b8286015b848110156134c157803583529183019183016134aa565b509695505050505050565b600082601f8301126134dd57600080fd5b813560206134ed6134828361343d565b82815260059290921b8401810191818101908684111561350c57600080fd5b8286015b848110156134c15761352181612fe9565b8352918301918301613510565b60008060006060848603121561354357600080fd5b61354c84613094565b9250602084013567ffffffffffffffff8082111561356957600080fd5b9085019060c0828803121561357d57600080fd5b6135856133c5565b82358152602083013560208201526040830135828111156135a557600080fd5b6135b189828601613461565b6040830152506135c360608401613094565b60608201526135d460808401612fe9565b608082015260a0830135828111156135eb57600080fd5b6135f7898286016134cc565b60a0830152509350604086013591508082111561361357600080fd5b5061362086828701613461565b9150509250925092565b600067ffffffffffffffff82111561364457613644613396565b50601f017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe01660200190565b600082601f83011261368157600080fd5b813561368f6134828261362a565b8181528460208386010111156136a457600080fd5b816020850160208301376000918101602001919091529392505050565b600080600080608085870312156136d757600080fd5b6136e085612fe9565b93506136ee602086016130c3565b92506136fc60408601613094565b9150606085013567ffffffffffffffff81111561371857600080fd5b61372487828801613670565b91505092959194509250565b6000806000806000806000806000806101408b8d03121561375057600080fd5b6137598b612fe9565b995061376760208c01612fe9565b985061377560408c01612fe9565b975060608b0135965060808b0135955061379160a08c016130c3565b945061379f60c08c016130c3565b93506137ad60e08c01613094565b92506137bc6101008c01613094565b91506101208b013567ffffffffffffffff8111156137d957600080fd5b6137e58d828e01613461565b9150509295989b9194979a5092959850565b6000806000806000806000806000806000806101808d8f03121561381a57600080fd5b6138238d612fe9565b9b5061383160208e01612fe9565b9a5061383f60408e01612fe9565b995060608d0135985060808d0135975060a08d0135965060c08d0135955061386960e08e016130c3565b94506138786101008e016130c3565b93506138876101208e016130c3565b92506138966101408e01613094565b915067ffffffffffffffff6101608e013511156138b257600080fd5b6138c38e6101608f01358f01613670565b90509295989b509295989b509295989b565b6000602082840312156138e757600080fd5b5051919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b600063ffffffff8381169083168181101561393a5761393a6138ee565b039392505050565b600063ffffffff808316818516808303821115613961576139616138ee565b01949350505050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b60008083357fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe18436030181126139ce57600080fd5b83018035915067ffffffffffffffff8211156139e957600080fd5b602001915036819003821315612e2557600080fd5b8183823760009101908152919050565b600060208284031215613a2057600080fd5b815167ffffffffffffffff811115613a3757600080fd5b8201601f81018413613a4857600080fd5b8051613a566134828261362a565b818152856020838501011115613a6b57600080fd5b611caf8260208301602086016132a0565b6020815260006125ea60208301846132cc565b60007fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff821415613ac157613ac16138ee565b5060010190565b67ffffffffffffffff831681526040602082015260006127af60408301846132cc565b60006101008201905073ffffffffffffffffffffffffffffffffffffffff80845116835280602085015116602084015280604085015116604084015250606083015160608301526080830151608083015260a083015167ffffffffffffffff80821660a08501528060c08601511660c0850152505060e08301516111ed60e084018263ffffffff169052565b600067ffffffffffffffff808316818516808303821115613961576139616138ee565b600082821015613bac57613bac6138ee565b500390565b60008219821115613bc457613bc46138ee565b500190565b600063ffffffff80831681811415613be357613be36138ee565b6001019392505050565b600081518084526020808501945080840160005b83811015613c1d57815187529582019590820190600101613c01565b509495945050505050565b600081518084526020808501945080840160005b83811015613c1d57815173ffffffffffffffffffffffffffffffffffffffff1687529582019590820190600101613c3c565b85815260a060208201526000613c8760a0830187613bed565b73ffffffffffffffffffffffffffffffffffffffff80871660408501528382036060850152613cb68287613c28565b9250808516608085015250509695505050505050565b600060208284031215613cde57600080fd5b81516125ea81613046565b600067ffffffffffffffff8381169083168181101561393a5761393a6138ee565b6000817fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0483118215151615613d4257613d426138ee565b500290565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601260045260246000fd5b600082613d8557613d85613d47565b500490565b6020815281516020820152602082015160408201526000604083015160c06060840152613dba60e0840182613bed565b905063ffffffff606085015116608084015273ffffffffffffffffffffffffffffffffffffffff60808501511660a084015260a08401517fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe08483030160c0850152611caf8282613c28565b600082613e3457613e34613d47565b500690565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052602160045260246000fd5b8281526040602082015260006127af60408301846132cc565b60008251613e938184602087016132a0565b9190910192915050565b600060208284031215613eaf57600080fd5b81517fffffffff00000000000000000000000000000000000000000000000000000000811681146125ea57600080fdfea2646970667358221220bd80d79b6a81460de18a2bd508f914365d7ed05be2e4a268227c40afeedfcc9e64736f6c634300080b0033", + "solcInputHash": "c8b9349311d8b5049b613ac98eb998d0", + "metadata": "{\"compiler\":{\"version\":\"0.8.13+commit.abaa5c0e\"},\"language\":\"Solidity\",\"output\":{\"abi\":[{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_hubPool\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"_wethAddress\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"timerAddress\",\"type\":\"address\"}],\"stateMutability\":\"nonpayable\",\"type\":\"constructor\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"uint256\",\"name\":\"rootBundleId\",\"type\":\"uint256\"}],\"name\":\"EmergencyDeleteRootBundle\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"originToken\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"uint256\",\"name\":\"destinationChainId\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"bool\",\"name\":\"enabled\",\"type\":\"bool\"}],\"name\":\"EnabledDepositRoute\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"amountToReturn\",\"type\":\"uint256\"},{\"indexed\":true,\"internalType\":\"uint256\",\"name\":\"chainId\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"uint256[]\",\"name\":\"refundAmounts\",\"type\":\"uint256[]\"},{\"indexed\":true,\"internalType\":\"uint32\",\"name\":\"rootBundleId\",\"type\":\"uint32\"},{\"indexed\":true,\"internalType\":\"uint32\",\"name\":\"leafId\",\"type\":\"uint32\"},{\"indexed\":false,\"internalType\":\"address\",\"name\":\"l2TokenAddress\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"address[]\",\"name\":\"refundAddresses\",\"type\":\"address[]\"},{\"indexed\":false,\"internalType\":\"address\",\"name\":\"caller\",\"type\":\"address\"}],\"name\":\"ExecutedRelayerRefundRoot\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"bytes32\",\"name\":\"relayHash\",\"type\":\"bytes32\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"totalFilledAmount\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"fillAmount\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"repaymentChainId\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"originChainId\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"destinationChainId\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"uint64\",\"name\":\"relayerFeePct\",\"type\":\"uint64\"},{\"indexed\":false,\"internalType\":\"uint64\",\"name\":\"realizedLpFeePct\",\"type\":\"uint64\"},{\"indexed\":false,\"internalType\":\"uint32\",\"name\":\"depositId\",\"type\":\"uint32\"},{\"indexed\":false,\"internalType\":\"address\",\"name\":\"destinationToken\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"relayer\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"depositor\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"address\",\"name\":\"recipient\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"bool\",\"name\":\"isSlowRelay\",\"type\":\"bool\"}],\"name\":\"FilledRelay\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"originChainId\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"destinationChainId\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"uint64\",\"name\":\"relayerFeePct\",\"type\":\"uint64\"},{\"indexed\":true,\"internalType\":\"uint32\",\"name\":\"depositId\",\"type\":\"uint32\"},{\"indexed\":false,\"internalType\":\"uint32\",\"name\":\"quoteTimestamp\",\"type\":\"uint32\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"originToken\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"address\",\"name\":\"recipient\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"depositor\",\"type\":\"address\"}],\"name\":\"FundsDeposited\",\"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\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"uint32\",\"name\":\"rootBundleId\",\"type\":\"uint32\"},{\"indexed\":false,\"internalType\":\"bytes32\",\"name\":\"relayerRefundRoot\",\"type\":\"bytes32\"},{\"indexed\":false,\"internalType\":\"bytes32\",\"name\":\"slowRelayRoot\",\"type\":\"bytes32\"}],\"name\":\"RelayedRootBundle\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"uint64\",\"name\":\"newRelayerFeePct\",\"type\":\"uint64\"},{\"indexed\":true,\"internalType\":\"uint32\",\"name\":\"depositId\",\"type\":\"uint32\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"depositor\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"bytes\",\"name\":\"depositorSignature\",\"type\":\"bytes\"}],\"name\":\"RequestedSpeedUpDeposit\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"uint32\",\"name\":\"newBuffer\",\"type\":\"uint32\"}],\"name\":\"SetDepositQuoteTimeBuffer\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"newHubPool\",\"type\":\"address\"}],\"name\":\"SetHubPool\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"newAdmin\",\"type\":\"address\"}],\"name\":\"SetXDomainAdmin\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"amountToReturn\",\"type\":\"uint256\"},{\"indexed\":true,\"internalType\":\"uint256\",\"name\":\"chainId\",\"type\":\"uint256\"},{\"indexed\":true,\"internalType\":\"uint32\",\"name\":\"leafId\",\"type\":\"uint32\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"l2TokenAddress\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"address\",\"name\":\"caller\",\"type\":\"address\"}],\"name\":\"TokensBridged\",\"type\":\"event\"},{\"inputs\":[],\"name\":\"chainId\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"crossDomainAdmin\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"recipient\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"originToken\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"destinationChainId\",\"type\":\"uint256\"},{\"internalType\":\"uint64\",\"name\":\"relayerFeePct\",\"type\":\"uint64\"},{\"internalType\":\"uint32\",\"name\":\"quoteTimestamp\",\"type\":\"uint32\"}],\"name\":\"deposit\",\"outputs\":[],\"stateMutability\":\"payable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"depositQuoteTimeBuffer\",\"outputs\":[{\"internalType\":\"uint32\",\"name\":\"\",\"type\":\"uint32\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"rootBundleId\",\"type\":\"uint256\"}],\"name\":\"emergencyDeleteRootBundle\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"name\":\"enabledDepositRoutes\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint32\",\"name\":\"rootBundleId\",\"type\":\"uint32\"},{\"components\":[{\"internalType\":\"uint256\",\"name\":\"amountToReturn\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"chainId\",\"type\":\"uint256\"},{\"internalType\":\"uint256[]\",\"name\":\"refundAmounts\",\"type\":\"uint256[]\"},{\"internalType\":\"uint32\",\"name\":\"leafId\",\"type\":\"uint32\"},{\"internalType\":\"address\",\"name\":\"l2TokenAddress\",\"type\":\"address\"},{\"internalType\":\"address[]\",\"name\":\"refundAddresses\",\"type\":\"address[]\"}],\"internalType\":\"struct SpokePoolInterface.RelayerRefundLeaf\",\"name\":\"relayerRefundLeaf\",\"type\":\"tuple\"},{\"internalType\":\"bytes32[]\",\"name\":\"proof\",\"type\":\"bytes32[]\"}],\"name\":\"executeRelayerRefundRoot\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"depositor\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"recipient\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"destinationToken\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"originChainId\",\"type\":\"uint256\"},{\"internalType\":\"uint64\",\"name\":\"realizedLpFeePct\",\"type\":\"uint64\"},{\"internalType\":\"uint64\",\"name\":\"relayerFeePct\",\"type\":\"uint64\"},{\"internalType\":\"uint32\",\"name\":\"depositId\",\"type\":\"uint32\"},{\"internalType\":\"uint32\",\"name\":\"rootBundleId\",\"type\":\"uint32\"},{\"internalType\":\"bytes32[]\",\"name\":\"proof\",\"type\":\"bytes32[]\"}],\"name\":\"executeSlowRelayRoot\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"depositor\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"recipient\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"destinationToken\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"maxTokensToSend\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"repaymentChainId\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"originChainId\",\"type\":\"uint256\"},{\"internalType\":\"uint64\",\"name\":\"realizedLpFeePct\",\"type\":\"uint64\"},{\"internalType\":\"uint64\",\"name\":\"relayerFeePct\",\"type\":\"uint64\"},{\"internalType\":\"uint32\",\"name\":\"depositId\",\"type\":\"uint32\"}],\"name\":\"fillRelay\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"depositor\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"recipient\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"destinationToken\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"maxTokensToSend\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"repaymentChainId\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"originChainId\",\"type\":\"uint256\"},{\"internalType\":\"uint64\",\"name\":\"realizedLpFeePct\",\"type\":\"uint64\"},{\"internalType\":\"uint64\",\"name\":\"relayerFeePct\",\"type\":\"uint64\"},{\"internalType\":\"uint64\",\"name\":\"newRelayerFeePct\",\"type\":\"uint64\"},{\"internalType\":\"uint32\",\"name\":\"depositId\",\"type\":\"uint32\"},{\"internalType\":\"bytes\",\"name\":\"depositorSignature\",\"type\":\"bytes\"}],\"name\":\"fillRelayWithUpdatedFee\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"getCurrentTime\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"hubPool\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes[]\",\"name\":\"data\",\"type\":\"bytes[]\"}],\"name\":\"multicall\",\"outputs\":[{\"internalType\":\"bytes[]\",\"name\":\"results\",\"type\":\"bytes[]\"}],\"stateMutability\":\"payable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"numberOfDeposits\",\"outputs\":[{\"internalType\":\"uint32\",\"name\":\"\",\"type\":\"uint32\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"owner\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"\",\"type\":\"bytes32\"}],\"name\":\"relayFills\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"relayerRefundRoot\",\"type\":\"bytes32\"},{\"internalType\":\"bytes32\",\"name\":\"slowRelayRoot\",\"type\":\"bytes32\"}],\"name\":\"relayRootBundle\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"renounceOwnership\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"name\":\"rootBundles\",\"outputs\":[{\"internalType\":\"bytes32\",\"name\":\"slowRelayRoot\",\"type\":\"bytes32\"},{\"internalType\":\"bytes32\",\"name\":\"relayerRefundRoot\",\"type\":\"bytes32\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"newCrossDomainAdmin\",\"type\":\"address\"}],\"name\":\"setCrossDomainAdmin\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"time\",\"type\":\"uint256\"}],\"name\":\"setCurrentTime\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint32\",\"name\":\"newDepositQuoteTimeBuffer\",\"type\":\"uint32\"}],\"name\":\"setDepositQuoteTimeBuffer\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"originToken\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"destinationChainId\",\"type\":\"uint256\"},{\"internalType\":\"bool\",\"name\":\"enabled\",\"type\":\"bool\"}],\"name\":\"setEnableRoute\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"newHubPool\",\"type\":\"address\"}],\"name\":\"setHubPool\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"depositor\",\"type\":\"address\"},{\"internalType\":\"uint64\",\"name\":\"newRelayerFeePct\",\"type\":\"uint64\"},{\"internalType\":\"uint32\",\"name\":\"depositId\",\"type\":\"uint32\"},{\"internalType\":\"bytes\",\"name\":\"depositorSignature\",\"type\":\"bytes\"}],\"name\":\"speedUpDeposit\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"timerAddress\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"newOwner\",\"type\":\"address\"}],\"name\":\"transferOwnership\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"weth\",\"outputs\":[{\"internalType\":\"contract WETH9\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"stateMutability\":\"payable\",\"type\":\"receive\"}],\"devdoc\":{\"kind\":\"dev\",\"methods\":{\"chainId()\":{\"details\":\"Some L2s like ZKSync don't support the CHAIN_ID opcode so we allow the implementer to override this.\"},\"constructor\":{\"params\":{\"_hubPool\":\"Hub pool address to set. Can be changed by admin.\",\"_wethAddress\":\"Weth address for this network to set.\",\"timerAddress\":\"Timer address to set.\"}},\"deposit(address,address,uint256,uint256,uint64,uint32)\":{\"params\":{\"amount\":\"Amount of tokens to deposit. Will be amount of tokens to receive less fees.\",\"destinationChainId\":\"Denotes network where user will receive funds from SpokePool by a relayer.\",\"originToken\":\"Token to lock into this contract to initiate deposit.\",\"quoteTimestamp\":\"Timestamp used by relayers to compute this deposit's realizedLPFeePct which is paid to LP pool on HubPool.\",\"recipient\":\"Address to receive funds at on destination chain.\",\"relayerFeePct\":\"% of deposit amount taken out to incentivize a fast relayer.\"}},\"emergencyDeleteRootBundle(uint256)\":{\"params\":{\"rootBundleId\":\"Index of the root bundle that needs to be deleted. Note: this is intentionally a uint256 to ensure that a small input range doesn't limit which indices this method is able to reach.\"}},\"executeRelayerRefundRoot(uint32,(uint256,uint256,uint256[],uint32,address,address[]),bytes32[])\":{\"params\":{\"proof\":\"Inclusion proof for this leaf in relayer refund root in root bundle.\",\"relayerRefundLeaf\":\"Contains all data necessary to reconstruct leaf contained in root bundle and to refund relayer. This data structure is explained in detail in the SpokePoolInterface.\",\"rootBundleId\":\"Unique ID of root bundle containing relayer refund root that this leaf is contained in.\"}},\"executeSlowRelayRoot(address,address,address,uint256,uint256,uint64,uint64,uint32,uint32,bytes32[])\":{\"details\":\"This function assumes that the relay's destination chain ID is the current chain ID, which prevents the caller from executing a slow relay intended for another chain on this chain.\",\"params\":{\"amount\":\"Full size of the deposit.\",\"depositId\":\"Unique deposit ID on origin spoke pool.\",\"depositor\":\"Depositor on origin chain who set this chain as the destination chain.\",\"destinationToken\":\"Token to send to recipient. Should be mapped to the origin token, origin chain ID and this chain ID via a mapping on the HubPool.\",\"originChainId\":\"Chain of SpokePool where deposit originated.\",\"proof\":\"Inclusion proof for this leaf in slow relay root in root bundle.\",\"realizedLpFeePct\":\"Fee % based on L1 HubPool utilization at deposit quote time. Deterministic based on quote time.\",\"recipient\":\"Specified recipient on this chain.\",\"relayerFeePct\":\"Original fee % to keep as relayer set by depositor.\",\"rootBundleId\":\"Unique ID of root bundle containing slow relay root that this leaf is contained in.\"}},\"fillRelay(address,address,address,uint256,uint256,uint256,uint256,uint64,uint64,uint32)\":{\"params\":{\"amount\":\"Full size of the deposit.\",\"depositId\":\"Unique deposit ID on origin spoke pool.\",\"depositor\":\"Depositor on origin chain who set this chain as the destination chain.\",\"destinationToken\":\"Token to send to recipient. Should be mapped to the origin token, origin chain ID and this chain ID via a mapping on the HubPool.\",\"maxTokensToSend\":\"Max amount of tokens to send recipient. If higher than amount, then caller will send recipient the full relay amount.\",\"originChainId\":\"Chain of SpokePool where deposit originated.\",\"realizedLpFeePct\":\"Fee % based on L1 HubPool utilization at deposit quote time. Deterministic based on quote time.\",\"recipient\":\"Specified recipient on this chain.\",\"relayerFeePct\":\"Fee % to keep as relayer, specified by depositor.\",\"repaymentChainId\":\"Chain of SpokePool where relayer wants to be refunded after the challenge window has passed.\"}},\"fillRelayWithUpdatedFee(address,address,address,uint256,uint256,uint256,uint256,uint64,uint64,uint64,uint32,bytes)\":{\"params\":{\"amount\":\"Full size of the deposit.\",\"depositId\":\"Unique deposit ID on origin spoke pool.\",\"depositor\":\"Depositor on origin chain who set this chain as the destination chain.\",\"depositorSignature\":\"Depositor-signed message containing updated fee %.\",\"destinationToken\":\"Token to send to recipient. Should be mapped to the origin token, origin chain ID and this chain ID via a mapping on the HubPool.\",\"maxTokensToSend\":\"Max amount of tokens to send recipient. If higher than amount, then caller will send recipient the full relay amount.\",\"newRelayerFeePct\":\"New fee % to keep as relayer also specified by depositor.\",\"originChainId\":\"Chain of SpokePool where deposit originated.\",\"realizedLpFeePct\":\"Fee % based on L1 HubPool utilization at deposit quote time. Deterministic based on quote time.\",\"recipient\":\"Specified recipient on this chain.\",\"relayerFeePct\":\"Original fee % to keep as relayer set by depositor.\",\"repaymentChainId\":\"Chain of SpokePool where relayer wants to be refunded after the challenge window has passed.\"}},\"getCurrentTime()\":{\"returns\":{\"_0\":\"uint for the current Testable timestamp.\"}},\"owner()\":{\"details\":\"Returns the address of the current owner.\"},\"relayRootBundle(bytes32,bytes32)\":{\"params\":{\"relayerRefundRoot\":\"Merkle root containing relayer refund leaves that can be individually executed via executeRelayerRefundRoot().\",\"slowRelayRoot\":\"Merkle root containing slow relay fulfillment leaves that can be individually executed via executeSlowRelayRoot().\"}},\"renounceOwnership()\":{\"details\":\"Leaves the contract without owner. It will not be possible to call `onlyOwner` functions anymore. Can only be called by the current owner. NOTE: Renouncing ownership will leave the contract without an owner, thereby removing any functionality that is only available to the owner.\"},\"setCrossDomainAdmin(address)\":{\"params\":{\"newCrossDomainAdmin\":\"New cross domain admin.\"}},\"setCurrentTime(uint256)\":{\"details\":\"Will revert if not running in test mode.\",\"params\":{\"time\":\"timestamp to set current Testable time to.\"}},\"setDepositQuoteTimeBuffer(uint32)\":{\"params\":{\"newDepositQuoteTimeBuffer\":\"New quote time buffer.\"}},\"setEnableRoute(address,uint256,bool)\":{\"params\":{\"destinationChainId\":\"Chain ID for where depositor wants to receive funds.\",\"enabled\":\"True to enable deposits, False otherwise.\",\"originToken\":\"Token that depositor can deposit to this contract.\"}},\"setHubPool(address)\":{\"params\":{\"newHubPool\":\"New hub pool.\"}},\"speedUpDeposit(address,uint64,uint32,bytes)\":{\"params\":{\"depositId\":\"Deposit to update fee for that originated in this contract.\",\"depositor\":\"Signer of the update fee message who originally submitted the deposit. If the deposit doesn't exist, then the relayer will not be able to fill any relay, so the caller should validate that the depositor did in fact submit a relay.\",\"depositorSignature\":\"Signed message containing the depositor address, this contract chain ID, the updated relayer fee %, and the deposit ID. This signature is produced by signing a hash of data according to the EIP-191 standard. See more in the _verifyUpdateRelayerFeeMessage() comments.\",\"newRelayerFeePct\":\"New relayer fee that relayers can use.\"}},\"transferOwnership(address)\":{\"details\":\"Transfers ownership of the contract to a new account (`newOwner`). Can only be called by the current owner.\"}},\"version\":1},\"userdoc\":{\"kind\":\"user\",\"methods\":{\"chainId()\":{\"notice\":\"Returns chain ID for this network.\"},\"constructor\":{\"notice\":\"Construct the Ethereum SpokePool.\"},\"deposit(address,address,uint256,uint256,uint64,uint32)\":{\"notice\":\"Called by user to bridge funds from origin to destination chain. Depositor will effectively lock tokens in this contract and receive a destination token on the destination chain. The origin => destination token mapping is stored on the L1 HubPool.The caller must first approve this contract to spend amount of originToken.The originToken => destinationChainId must be enabled.This method is payable because the caller is able to deposit ETH if the originToken is WETH and this function will handle wrapping ETH.\"},\"emergencyDeleteRootBundle(uint256)\":{\"notice\":\"This method is intended to only be used in emergencies where a bad root bundle has reached the SpokePool.\"},\"executeRelayerRefundRoot(uint32,(uint256,uint256,uint256[],uint32,address,address[]),bytes32[])\":{\"notice\":\"Executes a relayer refund leaf stored as part of a root bundle. Will send the relayer the amount they sent to the recipient plus a relayer fee.\"},\"executeSlowRelayRoot(address,address,address,uint256,uint256,uint64,uint64,uint32,uint32,bytes32[])\":{\"notice\":\"Executes a slow relay leaf stored as part of a root bundle. Will send the full amount remaining in the relay to the recipient, less fees.\"},\"fillRelay(address,address,address,uint256,uint256,uint256,uint256,uint64,uint64,uint32)\":{\"notice\":\"Called by relayer to fulfill part of a deposit by sending destination tokens to the recipient. Relayer is expected to pass in unique identifying information for deposit that they want to fulfill, and this relay submission will be validated by off-chain data workers who can dispute this relay if any part is invalid. If the relay is valid, then the relayer will be refunded on their desired repayment chain. If relay is invalid, then relayer will not receive any refund.All of the deposit data can be found via on-chain events from the origin SpokePool, except for the realizedLpFeePct which is a function of the HubPool's utilization at the deposit quote time. This fee % is deterministic based on the quote time, so the relayer should just compute it using the canonical algorithm as described in a UMIP linked to the HubPool's identifier.\"},\"fillRelayWithUpdatedFee(address,address,address,uint256,uint256,uint256,uint256,uint64,uint64,uint64,uint32,bytes)\":{\"notice\":\"Called by relayer to execute same logic as calling fillRelay except that relayer is using an updated relayer fee %. The fee % must have been emitted in a message cryptographically signed by the depositor.By design, the depositor probably emitted the message with the updated fee by calling speedUpRelay().\"},\"getCurrentTime()\":{\"notice\":\"Gets the current time. Will return the last time set in `setCurrentTime` if running in test mode. Otherwise, it will return the block timestamp.\"},\"relayRootBundle(bytes32,bytes32)\":{\"notice\":\"This method stores a new root bundle in this contract that can be executed to refund relayers, fulfill slow relays, and send funds back to the HubPool on L1. This method can only be called by the admin and is designed to be called as part of a cross-chain message from the HubPool's executeRootBundle method.\"},\"setCrossDomainAdmin(address)\":{\"notice\":\"Change cross domain admin address. Callable by admin only.\"},\"setCurrentTime(uint256)\":{\"notice\":\"Sets the current time.\"},\"setDepositQuoteTimeBuffer(uint32)\":{\"notice\":\"Change allowance for deposit quote time to differ from current block time. Callable by admin only.\"},\"setEnableRoute(address,uint256,bool)\":{\"notice\":\"Enable/Disable an origin token => destination chain ID route for deposits. Callable by admin only.\"},\"setHubPool(address)\":{\"notice\":\"Change L1 hub pool address. Callable by admin only.\"},\"speedUpDeposit(address,uint64,uint32,bytes)\":{\"notice\":\"Convenience method that depositor can use to signal to relayer to use updated fee.Relayer should only use events emitted by this function to submit fills with updated fees, otherwise they risk their fills getting disputed for being invalid, for example if the depositor never actually signed the update fee message.This function will revert if the depositor did not sign a message containing the updated fee for the deposit ID stored in this contract. If the deposit ID is for another contract, or the depositor address is incorrect, or the updated fee is incorrect, then the signature will not match and this function will revert.\"}},\"notice\":\"Ethereum L1 specific SpokePool. Used on Ethereum L1 to facilitate L2->L1 transfers.\",\"version\":1}},\"settings\":{\"compilationTarget\":{\"contracts/Ethereum_SpokePool.sol\":\"Ethereum_SpokePool\"},\"evmVersion\":\"london\",\"libraries\":{},\"metadata\":{\"bytecodeHash\":\"ipfs\",\"useLiteralContent\":true},\"optimizer\":{\"enabled\":true,\"runs\":1000000},\"remappings\":[]},\"sources\":{\"@openzeppelin/contracts/access/Ownable.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts v4.4.1 (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 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 called by any account other than the owner.\\n */\\n modifier onlyOwner() {\\n require(owner() == _msgSender(), \\\"Ownable: caller is not the owner\\\");\\n _;\\n }\\n\\n /**\\n * @dev Leaves the contract without owner. It will not be possible to call\\n * `onlyOwner` functions anymore. Can only be called by the current owner.\\n *\\n * NOTE: Renouncing ownership will leave the contract without an owner,\\n * thereby removing 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\",\"keccak256\":\"0x24e0364e503a9bbde94c715d26573a76f14cd2a202d45f96f52134ab806b67b9\",\"license\":\"MIT\"},\"@openzeppelin/contracts/token/ERC20/IERC20.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.5.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 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(\\n address from,\\n address to,\\n uint256 amount\\n ) external returns (bool);\\n\\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\",\"keccak256\":\"0xbbc8ac883ac3c0078ce5ad3e288fbb3ffcc8a30c3a98c0fda0114d64fc44fca2\",\"license\":\"MIT\"},\"@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts v4.4.1 (token/ERC20/utils/SafeERC20.sol)\\n\\npragma solidity ^0.8.0;\\n\\nimport \\\"../IERC20.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 function safeTransfer(\\n IERC20 token,\\n address to,\\n uint256 value\\n ) internal {\\n _callOptionalReturn(token, abi.encodeWithSelector(token.transfer.selector, to, value));\\n }\\n\\n function safeTransferFrom(\\n IERC20 token,\\n address from,\\n address to,\\n uint256 value\\n ) 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(\\n IERC20 token,\\n address spender,\\n uint256 value\\n ) 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 function safeIncreaseAllowance(\\n IERC20 token,\\n address spender,\\n uint256 value\\n ) internal {\\n uint256 newAllowance = token.allowance(address(this), spender) + value;\\n _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, newAllowance));\\n }\\n\\n function safeDecreaseAllowance(\\n IERC20 token,\\n address spender,\\n uint256 value\\n ) internal {\\n unchecked {\\n uint256 oldAllowance = token.allowance(address(this), spender);\\n require(oldAllowance >= value, \\\"SafeERC20: decreased allowance below zero\\\");\\n uint256 newAllowance = oldAllowance - value;\\n _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, newAllowance));\\n }\\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 if (returndata.length > 0) {\\n // Return data is optional\\n require(abi.decode(returndata, (bool)), \\\"SafeERC20: ERC20 operation did not succeed\\\");\\n }\\n }\\n}\\n\",\"keccak256\":\"0xc3d946432c0ddbb1f846a0d3985be71299df331b91d06732152117f62f0be2b5\",\"license\":\"MIT\"},\"@openzeppelin/contracts/utils/Address.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.5.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 *\\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://diligence.consensys.net/posts/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.5.11/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 functionCall(target, data, \\\"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(\\n address target,\\n bytes memory data,\\n uint256 value\\n ) 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 require(isContract(target), \\\"Address: call to non-contract\\\");\\n\\n (bool success, bytes memory returndata) = target.call{value: value}(data);\\n return verifyCallResult(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 require(isContract(target), \\\"Address: static call to non-contract\\\");\\n\\n (bool success, bytes memory returndata) = target.staticcall(data);\\n return verifyCallResult(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 require(isContract(target), \\\"Address: delegate call to non-contract\\\");\\n\\n (bool success, bytes memory returndata) = target.delegatecall(data);\\n return verifyCallResult(success, returndata, errorMessage);\\n }\\n\\n /**\\n * @dev Tool to verifies that a low level call was successful, and revert if it wasn't, either by bubbling the\\n * revert reason 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 // 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\\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}\\n\",\"keccak256\":\"0x2ccf9d2313a313d41a791505f2b5abfdc62191b5d4334f7f7a82691c088a1c87\",\"license\":\"MIT\"},\"@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\",\"keccak256\":\"0xe2e337e6dde9ef6b680e07338c493ebea1b5fd09b43424112868e9cc1706bca7\",\"license\":\"MIT\"},\"@openzeppelin/contracts/utils/Strings.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts v4.4.1 (utils/Strings.sol)\\n\\npragma solidity ^0.8.0;\\n\\n/**\\n * @dev String operations.\\n */\\nlibrary Strings {\\n bytes16 private constant _HEX_SYMBOLS = \\\"0123456789abcdef\\\";\\n\\n /**\\n * @dev Converts a `uint256` to its ASCII `string` decimal representation.\\n */\\n function toString(uint256 value) internal pure returns (string memory) {\\n // Inspired by OraclizeAPI's implementation - MIT licence\\n // https://github.com/oraclize/ethereum-api/blob/b42146b063c7d6ee1358846c198246239e9360e8/oraclizeAPI_0.4.25.sol\\n\\n if (value == 0) {\\n return \\\"0\\\";\\n }\\n uint256 temp = value;\\n uint256 digits;\\n while (temp != 0) {\\n digits++;\\n temp /= 10;\\n }\\n bytes memory buffer = new bytes(digits);\\n while (value != 0) {\\n digits -= 1;\\n buffer[digits] = bytes1(uint8(48 + uint256(value % 10)));\\n value /= 10;\\n }\\n return string(buffer);\\n }\\n\\n /**\\n * @dev Converts a `uint256` to its ASCII `string` hexadecimal representation.\\n */\\n function toHexString(uint256 value) internal pure returns (string memory) {\\n if (value == 0) {\\n return \\\"0x00\\\";\\n }\\n uint256 temp = value;\\n uint256 length = 0;\\n while (temp != 0) {\\n length++;\\n temp >>= 8;\\n }\\n return toHexString(value, length);\\n }\\n\\n /**\\n * @dev Converts a `uint256` to its ASCII `string` hexadecimal representation with fixed length.\\n */\\n function toHexString(uint256 value, uint256 length) internal pure returns (string memory) {\\n bytes memory buffer = new bytes(2 * length + 2);\\n buffer[0] = \\\"0\\\";\\n buffer[1] = \\\"x\\\";\\n for (uint256 i = 2 * length + 1; i > 1; --i) {\\n buffer[i] = _HEX_SYMBOLS[value & 0xf];\\n value >>= 4;\\n }\\n require(value == 0, \\\"Strings: hex length insufficient\\\");\\n return string(buffer);\\n }\\n}\\n\",\"keccak256\":\"0x32c202bd28995dd20c4347b7c6467a6d3241c74c8ad3edcbb610cd9205916c45\",\"license\":\"MIT\"},\"@openzeppelin/contracts/utils/cryptography/ECDSA.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.5.0) (utils/cryptography/ECDSA.sol)\\n\\npragma solidity ^0.8.0;\\n\\nimport \\\"../Strings.sol\\\";\\n\\n/**\\n * @dev Elliptic Curve Digital Signature Algorithm (ECDSA) operations.\\n *\\n * These functions can be used to verify that a message was signed by the holder\\n * of the private keys of a given address.\\n */\\nlibrary ECDSA {\\n enum RecoverError {\\n NoError,\\n InvalidSignature,\\n InvalidSignatureLength,\\n InvalidSignatureS,\\n InvalidSignatureV\\n }\\n\\n function _throwError(RecoverError error) private pure {\\n if (error == RecoverError.NoError) {\\n return; // no error: do nothing\\n } else if (error == RecoverError.InvalidSignature) {\\n revert(\\\"ECDSA: invalid signature\\\");\\n } else if (error == RecoverError.InvalidSignatureLength) {\\n revert(\\\"ECDSA: invalid signature length\\\");\\n } else if (error == RecoverError.InvalidSignatureS) {\\n revert(\\\"ECDSA: invalid signature 's' value\\\");\\n } else if (error == RecoverError.InvalidSignatureV) {\\n revert(\\\"ECDSA: invalid signature 'v' value\\\");\\n }\\n }\\n\\n /**\\n * @dev Returns the address that signed a hashed message (`hash`) with\\n * `signature` or error string. This address can then be used for verification purposes.\\n *\\n * The `ecrecover` EVM opcode allows for malleable (non-unique) signatures:\\n * this function rejects them by requiring the `s` value to be in the lower\\n * half order, and the `v` value to be either 27 or 28.\\n *\\n * IMPORTANT: `hash` _must_ be the result of a hash operation for the\\n * verification to be secure: it is possible to craft signatures that\\n * recover to arbitrary addresses for non-hashed data. A safe way to ensure\\n * this is by receiving a hash of the original message (which may otherwise\\n * be too long), and then calling {toEthSignedMessageHash} on it.\\n *\\n * Documentation for signature generation:\\n * - with https://web3js.readthedocs.io/en/v1.3.4/web3-eth-accounts.html#sign[Web3.js]\\n * - with https://docs.ethers.io/v5/api/signer/#Signer-signMessage[ethers]\\n *\\n * _Available since v4.3._\\n */\\n function tryRecover(bytes32 hash, bytes memory signature) internal pure returns (address, RecoverError) {\\n // Check the signature length\\n // - case 65: r,s,v signature (standard)\\n // - case 64: r,vs signature (cf https://eips.ethereum.org/EIPS/eip-2098) _Available since v4.1._\\n if (signature.length == 65) {\\n bytes32 r;\\n bytes32 s;\\n uint8 v;\\n // ecrecover takes the signature parameters, and the only way to get them\\n // currently is to use assembly.\\n assembly {\\n r := mload(add(signature, 0x20))\\n s := mload(add(signature, 0x40))\\n v := byte(0, mload(add(signature, 0x60)))\\n }\\n return tryRecover(hash, v, r, s);\\n } else if (signature.length == 64) {\\n bytes32 r;\\n bytes32 vs;\\n // ecrecover takes the signature parameters, and the only way to get them\\n // currently is to use assembly.\\n assembly {\\n r := mload(add(signature, 0x20))\\n vs := mload(add(signature, 0x40))\\n }\\n return tryRecover(hash, r, vs);\\n } else {\\n return (address(0), RecoverError.InvalidSignatureLength);\\n }\\n }\\n\\n /**\\n * @dev Returns the address that signed a hashed message (`hash`) with\\n * `signature`. This address can then be used for verification purposes.\\n *\\n * The `ecrecover` EVM opcode allows for malleable (non-unique) signatures:\\n * this function rejects them by requiring the `s` value to be in the lower\\n * half order, and the `v` value to be either 27 or 28.\\n *\\n * IMPORTANT: `hash` _must_ be the result of a hash operation for the\\n * verification to be secure: it is possible to craft signatures that\\n * recover to arbitrary addresses for non-hashed data. A safe way to ensure\\n * this is by receiving a hash of the original message (which may otherwise\\n * be too long), and then calling {toEthSignedMessageHash} on it.\\n */\\n function recover(bytes32 hash, bytes memory signature) internal pure returns (address) {\\n (address recovered, RecoverError error) = tryRecover(hash, signature);\\n _throwError(error);\\n return recovered;\\n }\\n\\n /**\\n * @dev Overload of {ECDSA-tryRecover} that receives the `r` and `vs` short-signature fields separately.\\n *\\n * See https://eips.ethereum.org/EIPS/eip-2098[EIP-2098 short signatures]\\n *\\n * _Available since v4.3._\\n */\\n function tryRecover(\\n bytes32 hash,\\n bytes32 r,\\n bytes32 vs\\n ) internal pure returns (address, RecoverError) {\\n bytes32 s = vs & bytes32(0x7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff);\\n uint8 v = uint8((uint256(vs) >> 255) + 27);\\n return tryRecover(hash, v, r, s);\\n }\\n\\n /**\\n * @dev Overload of {ECDSA-recover} that receives the `r and `vs` short-signature fields separately.\\n *\\n * _Available since v4.2._\\n */\\n function recover(\\n bytes32 hash,\\n bytes32 r,\\n bytes32 vs\\n ) internal pure returns (address) {\\n (address recovered, RecoverError error) = tryRecover(hash, r, vs);\\n _throwError(error);\\n return recovered;\\n }\\n\\n /**\\n * @dev Overload of {ECDSA-tryRecover} that receives the `v`,\\n * `r` and `s` signature fields separately.\\n *\\n * _Available since v4.3._\\n */\\n function tryRecover(\\n bytes32 hash,\\n uint8 v,\\n bytes32 r,\\n bytes32 s\\n ) internal pure returns (address, RecoverError) {\\n // EIP-2 still allows signature malleability for ecrecover(). Remove this possibility and make the signature\\n // unique. Appendix F in the Ethereum Yellow paper (https://ethereum.github.io/yellowpaper/paper.pdf), defines\\n // the valid range for s in (301): 0 < s < secp256k1n \\u00f7 2 + 1, and for v in (302): v \\u2208 {27, 28}. Most\\n // signatures from current libraries generate a unique signature with an s-value in the lower half order.\\n //\\n // If your library generates malleable signatures, such as s-values in the upper range, calculate a new s-value\\n // with 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFEBAAEDCE6AF48A03BBFD25E8CD0364141 - s1 and flip v from 27 to 28 or\\n // vice versa. If your library also generates signatures with 0/1 for v instead 27/28, add 27 to v to accept\\n // these malleable signatures as well.\\n if (uint256(s) > 0x7FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF5D576E7357A4501DDFE92F46681B20A0) {\\n return (address(0), RecoverError.InvalidSignatureS);\\n }\\n if (v != 27 && v != 28) {\\n return (address(0), RecoverError.InvalidSignatureV);\\n }\\n\\n // If the signature is valid (and not malleable), return the signer address\\n address signer = ecrecover(hash, v, r, s);\\n if (signer == address(0)) {\\n return (address(0), RecoverError.InvalidSignature);\\n }\\n\\n return (signer, RecoverError.NoError);\\n }\\n\\n /**\\n * @dev Overload of {ECDSA-recover} that receives the `v`,\\n * `r` and `s` signature fields separately.\\n */\\n function recover(\\n bytes32 hash,\\n uint8 v,\\n bytes32 r,\\n bytes32 s\\n ) internal pure returns (address) {\\n (address recovered, RecoverError error) = tryRecover(hash, v, r, s);\\n _throwError(error);\\n return recovered;\\n }\\n\\n /**\\n * @dev Returns an Ethereum Signed Message, created from a `hash`. This\\n * produces hash corresponding to the one signed with the\\n * https://eth.wiki/json-rpc/API#eth_sign[`eth_sign`]\\n * JSON-RPC method as part of EIP-191.\\n *\\n * See {recover}.\\n */\\n function toEthSignedMessageHash(bytes32 hash) internal pure returns (bytes32) {\\n // 32 is the length in bytes of hash,\\n // enforced by the type signature above\\n return keccak256(abi.encodePacked(\\\"\\\\x19Ethereum Signed Message:\\\\n32\\\", hash));\\n }\\n\\n /**\\n * @dev Returns an Ethereum Signed Message, created from `s`. This\\n * produces hash corresponding to the one signed with the\\n * https://eth.wiki/json-rpc/API#eth_sign[`eth_sign`]\\n * JSON-RPC method as part of EIP-191.\\n *\\n * See {recover}.\\n */\\n function toEthSignedMessageHash(bytes memory s) internal pure returns (bytes32) {\\n return keccak256(abi.encodePacked(\\\"\\\\x19Ethereum Signed Message:\\\\n\\\", Strings.toString(s.length), s));\\n }\\n\\n /**\\n * @dev Returns an Ethereum Signed Typed Data, created from a\\n * `domainSeparator` and a `structHash`. This produces hash corresponding\\n * to the one signed with the\\n * https://eips.ethereum.org/EIPS/eip-712[`eth_signTypedData`]\\n * JSON-RPC method as part of EIP-712.\\n *\\n * See {recover}.\\n */\\n function toTypedDataHash(bytes32 domainSeparator, bytes32 structHash) internal pure returns (bytes32) {\\n return keccak256(abi.encodePacked(\\\"\\\\x19\\\\x01\\\", domainSeparator, structHash));\\n }\\n}\\n\",\"keccak256\":\"0x3c07f43e60e099b3b157243b3152722e73b80eeb7985c2cd73712828d7f7da29\",\"license\":\"MIT\"},\"@openzeppelin/contracts/utils/cryptography/MerkleProof.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.5.0) (utils/cryptography/MerkleProof.sol)\\n\\npragma solidity ^0.8.0;\\n\\n/**\\n * @dev These functions deal with verification of Merkle Trees proofs.\\n *\\n * The proofs can be generated using the JavaScript library\\n * https://github.com/miguelmota/merkletreejs[merkletreejs].\\n * Note: the hashing algorithm should be keccak256 and pair sorting should be enabled.\\n *\\n * See `test/utils/cryptography/MerkleProof.test.js` for some examples.\\n */\\nlibrary MerkleProof {\\n /**\\n * @dev Returns true if a `leaf` can be proved to be a part of a Merkle tree\\n * defined by `root`. For this, a `proof` must be provided, containing\\n * sibling hashes on the branch from the leaf to the root of the tree. Each\\n * pair of leaves and each pair of pre-images are assumed to be sorted.\\n */\\n function verify(\\n bytes32[] memory proof,\\n bytes32 root,\\n bytes32 leaf\\n ) internal pure returns (bool) {\\n return processProof(proof, leaf) == root;\\n }\\n\\n /**\\n * @dev Returns the rebuilt hash obtained by traversing a Merklee tree up\\n * from `leaf` using `proof`. A `proof` is valid if and only if the rebuilt\\n * hash matches the root of the tree. When processing the proof, the pairs\\n * of leafs & pre-images are assumed to be sorted.\\n *\\n * _Available since v4.4._\\n */\\n function processProof(bytes32[] memory proof, bytes32 leaf) internal pure returns (bytes32) {\\n bytes32 computedHash = leaf;\\n for (uint256 i = 0; i < proof.length; i++) {\\n bytes32 proofElement = proof[i];\\n if (computedHash <= proofElement) {\\n // Hash(current computed hash + current element of the proof)\\n computedHash = _efficientHash(computedHash, proofElement);\\n } else {\\n // Hash(current element of the proof + current computed hash)\\n computedHash = _efficientHash(proofElement, computedHash);\\n }\\n }\\n return computedHash;\\n }\\n\\n function _efficientHash(bytes32 a, bytes32 b) private pure returns (bytes32 value) {\\n assembly {\\n mstore(0x00, a)\\n mstore(0x20, b)\\n value := keccak256(0x00, 0x40)\\n }\\n }\\n}\\n\",\"keccak256\":\"0xea64fbaccbf9d8c235cf6838240ddcebb97f9fc383660289e9dff32e4fb85f7a\",\"license\":\"MIT\"},\"@uma/core/contracts/common/implementation/MultiCaller.sol\":{\"content\":\"// This contract is taken from Uniswaps'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.\\npragma solidity ^0.8.0;\\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 payable returns (bytes[] memory results) {\\n require(msg.value == 0, \\\"Only multicall with 0 value\\\");\\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\",\"keccak256\":\"0x31f18055b14fd9eeb459c6d6a88d1a60921bf3755031f6db4b709c3e01d078f7\"},\"@uma/core/contracts/common/implementation/Testable.sol\":{\"content\":\"// SPDX-License-Identifier: AGPL-3.0-only\\npragma solidity ^0.8.0;\\n\\nimport \\\"./Timer.sol\\\";\\n\\n/**\\n * @title Base class that provides time overrides, but only if being run in test mode.\\n */\\nabstract contract Testable {\\n // If the contract is being run in production, then `timerAddress` will be the 0x0 address.\\n // Note: this variable should be set on construction and never modified.\\n address public timerAddress;\\n\\n /**\\n * @notice Constructs the Testable contract. Called by child contracts.\\n * @param _timerAddress Contract that stores the current time in a testing environment.\\n * Must be set to 0x0 for production environments that use live time.\\n */\\n constructor(address _timerAddress) {\\n timerAddress = _timerAddress;\\n }\\n\\n /**\\n * @notice Reverts if not running in test mode.\\n */\\n modifier onlyIfTest {\\n require(timerAddress != address(0x0));\\n _;\\n }\\n\\n /**\\n * @notice Sets the current time.\\n * @dev Will revert if not running in test mode.\\n * @param time timestamp to set current Testable time to.\\n */\\n function setCurrentTime(uint256 time) external onlyIfTest {\\n Timer(timerAddress).setCurrentTime(time);\\n }\\n\\n /**\\n * @notice Gets the current time. Will return the last time set in `setCurrentTime` if running in test mode.\\n * Otherwise, it will return the block timestamp.\\n * @return uint for the current Testable timestamp.\\n */\\n function getCurrentTime() public view virtual returns (uint256) {\\n if (timerAddress != address(0x0)) {\\n return Timer(timerAddress).getCurrentTime();\\n } else {\\n return block.timestamp; // solhint-disable-line not-rely-on-time\\n }\\n }\\n}\\n\",\"keccak256\":\"0x0254b45747293bb800373a58d123969adec0428f7be79dc941cab10fcad09918\",\"license\":\"AGPL-3.0-only\"},\"@uma/core/contracts/common/implementation/Timer.sol\":{\"content\":\"// SPDX-License-Identifier: AGPL-3.0-only\\npragma solidity ^0.8.0;\\n\\n/**\\n * @title Universal store of current contract time for testing environments.\\n */\\ncontract Timer {\\n uint256 private currentTime;\\n\\n constructor() {\\n currentTime = block.timestamp; // solhint-disable-line not-rely-on-time\\n }\\n\\n /**\\n * @notice Sets the current time.\\n * @dev Will revert if not running in test mode.\\n * @param time timestamp to set `currentTime` to.\\n */\\n function setCurrentTime(uint256 time) external {\\n currentTime = time;\\n }\\n\\n /**\\n * @notice Gets the currentTime variable set in the Timer.\\n * @return uint256 for the current Testable timestamp.\\n */\\n function getCurrentTime() public view returns (uint256) {\\n return currentTime;\\n }\\n}\\n\",\"keccak256\":\"0x9e0dd7389718bd5d1da910273a6f4cee98ee22bfc0c92bde0f0955c0e23adb5e\",\"license\":\"AGPL-3.0-only\"},\"contracts/Ethereum_SpokePool.sol\":{\"content\":\"// SPDX-License-Identifier: GPL-3.0-only\\npragma solidity ^0.8.0;\\n\\nimport \\\"./SpokePool.sol\\\";\\nimport \\\"@openzeppelin/contracts/access/Ownable.sol\\\";\\n\\n/**\\n * @notice Ethereum L1 specific SpokePool. Used on Ethereum L1 to facilitate L2->L1 transfers.\\n */\\ncontract Ethereum_SpokePool is SpokePool, Ownable {\\n /**\\n * @notice Construct the Ethereum SpokePool.\\n * @param _hubPool Hub pool address to set. Can be changed by admin.\\n * @param _wethAddress Weth address for this network to set.\\n * @param timerAddress Timer address to set.\\n */\\n constructor(\\n address _hubPool,\\n address _wethAddress,\\n address timerAddress\\n ) SpokePool(msg.sender, _hubPool, _wethAddress, timerAddress) {}\\n\\n /**************************************\\n * INTERNAL FUNCTIONS *\\n **************************************/\\n\\n function _bridgeTokensToHubPool(RelayerRefundLeaf memory relayerRefundLeaf) internal override {\\n IERC20(relayerRefundLeaf.l2TokenAddress).transfer(hubPool, relayerRefundLeaf.amountToReturn);\\n }\\n\\n // Admin is simply owner which should be same account that owns the HubPool deployed on this network. A core\\n // assumption of this contract system is that the HubPool is deployed on Ethereum.\\n function _requireAdminSender() internal override onlyOwner {}\\n}\\n\",\"keccak256\":\"0xe4bc6410665d75f98cb23420cfd30dc88091204810e0af7847e65debbf8edeea\",\"license\":\"GPL-3.0-only\"},\"contracts/HubPoolInterface.sol\":{\"content\":\"// SPDX-License-Identifier: GPL-3.0-only\\npragma solidity ^0.8.0;\\n\\nimport \\\"./interfaces/AdapterInterface.sol\\\";\\n\\nimport \\\"@openzeppelin/contracts/token/ERC20/IERC20.sol\\\";\\n\\n/**\\n * @notice Concise list of functions in HubPool implementation.\\n */\\ninterface HubPoolInterface {\\n // This leaf is meant to be decoded in the HubPool to rebalance tokens between HubPool and SpokePool.\\n struct PoolRebalanceLeaf {\\n // This is used to know which chain to send cross-chain transactions to (and which SpokePool to send to).\\n uint256 chainId;\\n // Total LP fee amount per token in this bundle, encompassing all associated bundled relays.\\n uint256[] bundleLpFees;\\n // This array is grouped with the two above, and it represents the amount to send or request back from the\\n // SpokePool. If positive, the pool will pay the SpokePool. If negative the SpokePool will pay the HubPool.\\n // There can be arbitrarily complex rebalancing rules defined offchain. This number is only nonzero when the\\n // rules indicate that a rebalancing action should occur. When a rebalance does occur, runningBalances should be\\n // set to zero for this token and the netSendAmounts should be set to the previous runningBalances + relays -\\n // deposits in this bundle. If non-zero then it must be set on the SpokePool's RelayerRefundLeaf amountToReturn\\n // as -1 * this value to indicate if funds are being sent from or to the SpokePool.\\n int256[] netSendAmounts;\\n // This is only here to be emitted in an event to track a running unpaid balance between the L2 pool and the L1\\n // pool. A positive number indicates that the HubPool owes the SpokePool funds. A negative number indicates that\\n // the SpokePool owes the HubPool funds. See the comment above for the dynamics of this and netSendAmounts.\\n int256[] runningBalances;\\n // Used by data worker to mark which leaves should relay roots to SpokePools, and to otherwise organize leaves.\\n // For example, each leaf should contain all the rebalance information for a single chain, but in the case where\\n // the list of l1Tokens is very large such that they all can't fit into a single leaf that can be executed under\\n // the block gas limit, then the data worker can use this groupIndex to organize them. Any leaves with\\n // a groupIndex equal to 0 will relay roots to the SpokePool, so the data worker should ensure that only one\\n // leaf for a specific chainId should have a groupIndex equal to 0.\\n uint256 groupIndex;\\n // Used as the index in the bitmap to track whether this leaf has been executed or not.\\n uint8 leafId;\\n // The following arrays are required to be the same length. They are parallel arrays for the given chainId and\\n // should be ordered by the l1Tokens field. All whitelisted tokens with nonzero relays on this chain in this\\n // bundle in the order of whitelisting.\\n address[] l1Tokens;\\n }\\n\\n // A data worker can optimistically store several merkle roots on this contract by staking a bond and calling\\n // proposeRootBundle. By staking a bond, the data worker is alleging that the merkle roots all contain valid leaves\\n // that can be executed later to:\\n // - Send funds from this contract to a SpokePool or vice versa\\n // - Send funds from a SpokePool to Relayer as a refund for a relayed deposit\\n // - Send funds from a SpokePool to a deposit recipient to fulfill a \\\"slow\\\" relay\\n // Anyone can dispute this struct if the merkle roots contain invalid leaves before the\\n // requestExpirationTimestamp. Once the expiration timestamp is passed, executeRootBundle to execute a leaf\\n // from the poolRebalanceRoot on this contract and it will simultaneously publish the relayerRefundRoot and\\n // slowRelayRoot to a SpokePool. The latter two roots, once published to the SpokePool, contain\\n // leaves that can be executed on the SpokePool to pay relayers or recipients.\\n struct RootBundle {\\n // Contains leaves instructing this contract to send funds to SpokePools.\\n bytes32 poolRebalanceRoot;\\n // Relayer refund merkle root to be published to a SpokePool.\\n bytes32 relayerRefundRoot;\\n // Slow relay merkle root to be published to a SpokePool.\\n bytes32 slowRelayRoot;\\n // This is a 1D bitmap, with max size of 256 elements, limiting us to 256 chainsIds.\\n uint256 claimedBitMap;\\n // Proposer of this root bundle.\\n address proposer;\\n // Number of pool rebalance leaves to execute in the poolRebalanceRoot. After this number\\n // of leaves are executed, a new root bundle can be proposed\\n uint8 unclaimedPoolRebalanceLeafCount;\\n // When root bundle challenge period passes and this root bundle becomes executable.\\n uint32 requestExpirationTimestamp;\\n }\\n\\n // Each whitelisted L1 token has an associated pooledToken struct that contains all information used to track the\\n // cumulative LP positions and if this token is enabled for deposits.\\n struct PooledToken {\\n // LP token given to LPs of a specific L1 token.\\n address lpToken;\\n // True if accepting new LP's.\\n bool isEnabled;\\n // Timestamp of last LP fee update.\\n uint32 lastLpFeeUpdate;\\n // Number of LP funds sent via pool rebalances to SpokePools and are expected to be sent\\n // back later.\\n int256 utilizedReserves;\\n // Number of LP funds held in contract less utilized reserves.\\n uint256 liquidReserves;\\n // Number of LP funds reserved to pay out to LPs as fees.\\n uint256 undistributedLpFees;\\n }\\n\\n // Helper contracts to facilitate cross chain actions between HubPool and SpokePool for a specific network.\\n struct CrossChainContract {\\n address adapter;\\n address spokePool;\\n }\\n\\n function setPaused(bool pause) external;\\n\\n function emergencyDeleteProposal() external;\\n\\n function relaySpokePoolAdminFunction(uint256 chainId, bytes memory functionData) external;\\n\\n function setProtocolFeeCapture(address newProtocolFeeCaptureAddress, uint256 newProtocolFeeCapturePct) external;\\n\\n function setBond(IERC20 newBondToken, uint256 newBondAmount) external;\\n\\n function setLiveness(uint32 newLiveness) external;\\n\\n function setIdentifier(bytes32 newIdentifier) external;\\n\\n function setCrossChainContracts(\\n uint256 l2ChainId,\\n address adapter,\\n address spokePool\\n ) external;\\n\\n function enableL1TokenForLiquidityProvision(address l1Token) external;\\n\\n function disableL1TokenForLiquidityProvision(address l1Token) external;\\n\\n function addLiquidity(address l1Token, uint256 l1TokenAmount) external payable;\\n\\n function removeLiquidity(\\n address l1Token,\\n uint256 lpTokenAmount,\\n bool sendEth\\n ) external;\\n\\n function exchangeRateCurrent(address l1Token) external returns (uint256);\\n\\n function liquidityUtilizationCurrent(address l1Token) external returns (uint256);\\n\\n function liquidityUtilizationPostRelay(address token, uint256 relayedAmount) external returns (uint256);\\n\\n function sync(address l1Token) external;\\n\\n function proposeRootBundle(\\n uint256[] memory bundleEvaluationBlockNumbers,\\n uint8 poolRebalanceLeafCount,\\n bytes32 poolRebalanceRoot,\\n bytes32 relayerRefundRoot,\\n bytes32 slowRelayRoot\\n ) external;\\n\\n function executeRootBundle(\\n uint256 chainId,\\n uint256 groupIndex,\\n uint256[] memory bundleLpFees,\\n int256[] memory netSendAmounts,\\n int256[] memory runningBalances,\\n uint8 leafId,\\n address[] memory l1Tokens,\\n bytes32[] memory proof\\n ) external;\\n\\n function disputeRootBundle() external;\\n\\n function claimProtocolFeesCaptured(address l1Token) external;\\n\\n function setPoolRebalanceRoute(\\n uint256 destinationChainId,\\n address l1Token,\\n address destinationToken\\n ) external;\\n\\n function setDepositRoute(\\n uint256 originChainId,\\n uint256 destinationChainId,\\n address originToken,\\n bool depositsEnabled\\n ) external;\\n\\n function poolRebalanceRoute(uint256 destinationChainId, address l1Token)\\n external\\n view\\n returns (address destinationToken);\\n\\n function loadEthForL2Calls() external payable;\\n}\\n\",\"keccak256\":\"0x71b427ffd4a1e8c0cc681bafe050c536d79464f12559e90172681e6745f2e7bc\",\"license\":\"GPL-3.0-only\"},\"contracts/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 * @dev The reason why we use this local contract instead of importing from uma/contracts is because of the addition\\n * of the internal method `functionCallStackOriginatesFromOutsideThisContract` which doesn't exist in the one exported\\n * by uma/contracts.\\n */\\ncontract Lockable {\\n bool internal _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 /**\\n * @dev Returns true if the contract is currently in a non-entered state, meaning that the origination of the call\\n * came from outside the contract. This is relevant with fallback/receive methods to see if the call came from ETH\\n * being dropped onto the contract externally or due to ETH dropped on the the contract from within a method in this\\n * contract, such as unwrapping WETH to ETH within the contract.\\n */\\n function functionCallStackOriginatesFromOutsideThisContract() internal view returns (bool) {\\n return _notEntered;\\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\",\"keccak256\":\"0xef490be5cb859c97c6f600f3b0db0d50c6e18f334d3c74c6d9e693a260eaec3e\",\"license\":\"AGPL-3.0-only\"},\"contracts/MerkleLib.sol\":{\"content\":\"// SPDX-License-Identifier: GPL-3.0-only\\npragma solidity ^0.8.0;\\n\\nimport \\\"./SpokePoolInterface.sol\\\";\\nimport \\\"./HubPoolInterface.sol\\\";\\n\\nimport \\\"@openzeppelin/contracts/utils/cryptography/MerkleProof.sol\\\";\\n\\n/**\\n * @notice Library to help with merkle roots, proofs, and claims.\\n */\\nlibrary MerkleLib {\\n /**\\n * @notice Verifies that a repayment is contained within a merkle root.\\n * @param root the merkle root.\\n * @param rebalance the rebalance struct.\\n * @param proof the merkle proof.\\n * @return bool to signal if the pool rebalance proof correctly shows inclusion of the rebalance within the tree.\\n */\\n function verifyPoolRebalance(\\n bytes32 root,\\n HubPoolInterface.PoolRebalanceLeaf memory rebalance,\\n bytes32[] memory proof\\n ) internal pure returns (bool) {\\n return MerkleProof.verify(proof, root, keccak256(abi.encode(rebalance)));\\n }\\n\\n /**\\n * @notice Verifies that a relayer refund is contained within a merkle root.\\n * @param root the merkle root.\\n * @param refund the refund struct.\\n * @param proof the merkle proof.\\n * @return bool to signal if the relayer refund proof correctly shows inclusion of the refund within the tree.\\n */\\n function verifyRelayerRefund(\\n bytes32 root,\\n SpokePoolInterface.RelayerRefundLeaf memory refund,\\n bytes32[] memory proof\\n ) internal pure returns (bool) {\\n return MerkleProof.verify(proof, root, keccak256(abi.encode(refund)));\\n }\\n\\n /**\\n * @notice Verifies that a distribution is contained within a merkle root.\\n * @param root the merkle root.\\n * @param slowRelayFulfillment the relayData fulfillment struct.\\n * @param proof the merkle proof.\\n * @return bool to signal if the slow relay's proof correctly shows inclusion of the slow relay within the tree.\\n */\\n function verifySlowRelayFulfillment(\\n bytes32 root,\\n SpokePoolInterface.RelayData memory slowRelayFulfillment,\\n bytes32[] memory proof\\n ) internal pure returns (bool) {\\n return MerkleProof.verify(proof, root, keccak256(abi.encode(slowRelayFulfillment)));\\n }\\n\\n // The following functions are primarily copied from\\n // https://github.com/Uniswap/merkle-distributor/blob/master/contracts/MerkleDistributor.sol with minor changes.\\n\\n /**\\n * @notice Tests whether a claim is contained within a claimedBitMap mapping.\\n * @param claimedBitMap a simple uint256 mapping in storage used as a bitmap.\\n * @param index the index to check in the bitmap.\\n * @return bool indicating if the index within the claimedBitMap has been marked as claimed.\\n */\\n function isClaimed(mapping(uint256 => uint256) storage claimedBitMap, uint256 index) internal view returns (bool) {\\n uint256 claimedWordIndex = index / 256;\\n uint256 claimedBitIndex = index % 256;\\n uint256 claimedWord = claimedBitMap[claimedWordIndex];\\n uint256 mask = (1 << claimedBitIndex);\\n return claimedWord & mask == mask;\\n }\\n\\n /**\\n * @notice Marks an index in a claimedBitMap as claimed.\\n * @param claimedBitMap a simple uint256 mapping in storage used as a bitmap.\\n * @param index the index to mark in the bitmap.\\n */\\n function setClaimed(mapping(uint256 => uint256) storage claimedBitMap, uint256 index) internal {\\n uint256 claimedWordIndex = index / 256;\\n uint256 claimedBitIndex = index % 256;\\n claimedBitMap[claimedWordIndex] = claimedBitMap[claimedWordIndex] | (1 << claimedBitIndex);\\n }\\n\\n /**\\n * @notice Tests whether a claim is contained within a 1D claimedBitMap mapping.\\n * @param claimedBitMap a simple uint256 value, encoding a 1D bitmap.\\n * @param index the index to check in the bitmap. Uint8 type enforces that index can't be > 255.\\n * @return bool indicating if the index within the claimedBitMap has been marked as claimed.\\n */\\n function isClaimed1D(uint256 claimedBitMap, uint8 index) internal pure returns (bool) {\\n uint256 mask = (1 << index);\\n return claimedBitMap & mask == mask;\\n }\\n\\n /**\\n * @notice Marks an index in a claimedBitMap as claimed.\\n * @param claimedBitMap a simple uint256 mapping in storage used as a bitmap. Uint8 type enforces that index\\n * can't be > 255.\\n * @param index the index to mark in the bitmap.\\n * @return uint256 representing the modified input claimedBitMap with the index set to true.\\n */\\n function setClaimed1D(uint256 claimedBitMap, uint8 index) internal pure returns (uint256) {\\n return claimedBitMap | (1 << index % 256);\\n }\\n}\\n\",\"keccak256\":\"0x5b49211d8b8e5a2792d08adb818fddc2ad8abaef45822f91ca678ceb7ea018ea\",\"license\":\"GPL-3.0-only\"},\"contracts/SpokePool.sol\":{\"content\":\"// SPDX-License-Identifier: GPL-3.0-only\\npragma solidity ^0.8.0;\\n\\nimport \\\"./MerkleLib.sol\\\";\\nimport \\\"./interfaces/WETH9.sol\\\";\\nimport \\\"./Lockable.sol\\\";\\nimport \\\"./SpokePoolInterface.sol\\\";\\n\\nimport \\\"@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol\\\";\\nimport \\\"@openzeppelin/contracts/token/ERC20/IERC20.sol\\\";\\nimport \\\"@openzeppelin/contracts/utils/Address.sol\\\";\\n\\nimport \\\"@openzeppelin/contracts/utils/cryptography/ECDSA.sol\\\";\\nimport \\\"@uma/core/contracts/common/implementation/Testable.sol\\\";\\nimport \\\"@uma/core/contracts/common/implementation/MultiCaller.sol\\\";\\n\\n/**\\n * @title SpokePool\\n * @notice Base contract deployed on source and destination chains enabling depositors to transfer assets from source to\\n * destination. Deposit orders are fulfilled by off-chain relayers who also interact with this contract. Deposited\\n * tokens are locked on the source chain and relayers send the recipient the desired token currency and amount\\n * on the destination chain. Locked source chain tokens are later sent over the canonical token bridge to L1 HubPool.\\n * Relayers are refunded with destination tokens out of this contract after another off-chain actor, a \\\"data worker\\\",\\n * submits a proof that the relayer correctly submitted a relay on this SpokePool.\\n */\\nabstract contract SpokePool is SpokePoolInterface, Testable, Lockable, MultiCaller {\\n using SafeERC20 for IERC20;\\n using Address for address;\\n\\n // Address of the L1 contract that acts as the owner of this SpokePool. If this contract is deployed on Ethereum,\\n // then this address should be set to the same owner as the HubPool and the whole system.\\n address public crossDomainAdmin;\\n\\n // Address of the L1 contract that will send tokens to and receive tokens from this contract to fund relayer\\n // refunds and slow relays.\\n address public hubPool;\\n\\n // Address of WETH contract for this network. If an origin token matches this, then the caller can optionally\\n // instruct this contract to wrap ETH when depositing.\\n WETH9 public immutable weth;\\n\\n // Any deposit quote times greater than or less than this value to the current contract time is blocked. Forces\\n // caller to use an approximately \\\"current\\\" realized fee. Defaults to 10 minutes.\\n uint32 public depositQuoteTimeBuffer = 600;\\n\\n // Count of deposits is used to construct a unique deposit identifier for this spoke pool.\\n uint32 public numberOfDeposits;\\n\\n // Origin token to destination token routings can be turned on or off, which can enable or disable deposits.\\n\\n mapping(address => mapping(uint256 => bool)) public enabledDepositRoutes;\\n\\n // This contract can store as many root bundles as the HubPool chooses to publish here.\\n RootBundle[] public rootBundles;\\n\\n // Each relay is associated with the hash of parameters that uniquely identify the original deposit and a relay\\n // attempt for that deposit. The relay itself is just represented as the amount filled so far. The total amount to\\n // relay, the fees, and the agents are all parameters included in the hash key.\\n mapping(bytes32 => uint256) public relayFills;\\n\\n /****************************************\\n * EVENTS *\\n ****************************************/\\n event SetXDomainAdmin(address indexed newAdmin);\\n event SetHubPool(address indexed newHubPool);\\n event EnabledDepositRoute(address indexed originToken, uint256 indexed destinationChainId, bool enabled);\\n event SetDepositQuoteTimeBuffer(uint32 newBuffer);\\n event FundsDeposited(\\n uint256 amount,\\n uint256 originChainId,\\n uint256 destinationChainId,\\n uint64 relayerFeePct,\\n uint32 indexed depositId,\\n uint32 quoteTimestamp,\\n address indexed originToken,\\n address recipient,\\n address indexed depositor\\n );\\n event RequestedSpeedUpDeposit(\\n uint64 newRelayerFeePct,\\n uint32 indexed depositId,\\n address indexed depositor,\\n bytes depositorSignature\\n );\\n event FilledRelay(\\n bytes32 indexed relayHash,\\n uint256 amount,\\n uint256 totalFilledAmount,\\n uint256 fillAmount,\\n uint256 repaymentChainId,\\n uint256 originChainId,\\n uint256 destinationChainId,\\n uint64 relayerFeePct,\\n uint64 realizedLpFeePct,\\n uint32 depositId,\\n address destinationToken,\\n address indexed relayer,\\n address indexed depositor,\\n address recipient,\\n bool isSlowRelay\\n );\\n event RelayedRootBundle(uint32 indexed rootBundleId, bytes32 relayerRefundRoot, bytes32 slowRelayRoot);\\n event ExecutedRelayerRefundRoot(\\n uint256 amountToReturn,\\n uint256 indexed chainId,\\n uint256[] refundAmounts,\\n uint32 indexed rootBundleId,\\n uint32 indexed leafId,\\n address l2TokenAddress,\\n address[] refundAddresses,\\n address caller\\n );\\n event TokensBridged(\\n uint256 amountToReturn,\\n uint256 indexed chainId,\\n uint32 indexed leafId,\\n address indexed l2TokenAddress,\\n address caller\\n );\\n event EmergencyDeleteRootBundle(uint256 indexed rootBundleId);\\n\\n /**\\n * @notice Construct the base SpokePool.\\n * @param _crossDomainAdmin Cross domain admin to set. Can be changed by admin.\\n * @param _hubPool Hub pool address to set. Can be changed by admin.\\n * @param _wethAddress Weth address for this network to set.\\n * @param timerAddress Timer address to set.\\n */\\n constructor(\\n address _crossDomainAdmin,\\n address _hubPool,\\n address _wethAddress,\\n address timerAddress\\n ) Testable(timerAddress) {\\n _setCrossDomainAdmin(_crossDomainAdmin);\\n _setHubPool(_hubPool);\\n weth = WETH9(_wethAddress);\\n }\\n\\n /****************************************\\n * MODIFIERS *\\n ****************************************/\\n\\n // Implementing contract needs to override _requireAdminSender() to ensure that admin functions are protected\\n // appropriately.\\n modifier onlyAdmin() {\\n _requireAdminSender();\\n _;\\n }\\n\\n /**************************************\\n * ADMIN FUNCTIONS *\\n **************************************/\\n\\n /**\\n * @notice Change cross domain admin address. Callable by admin only.\\n * @param newCrossDomainAdmin New cross domain admin.\\n */\\n function setCrossDomainAdmin(address newCrossDomainAdmin) public override onlyAdmin nonReentrant {\\n _setCrossDomainAdmin(newCrossDomainAdmin);\\n }\\n\\n /**\\n * @notice Change L1 hub pool address. Callable by admin only.\\n * @param newHubPool New hub pool.\\n */\\n function setHubPool(address newHubPool) public override onlyAdmin nonReentrant {\\n _setHubPool(newHubPool);\\n }\\n\\n /**\\n * @notice Enable/Disable an origin token => destination chain ID route for deposits. Callable by admin only.\\n * @param originToken Token that depositor can deposit to this contract.\\n * @param destinationChainId Chain ID for where depositor wants to receive funds.\\n * @param enabled True to enable deposits, False otherwise.\\n */\\n function setEnableRoute(\\n address originToken,\\n uint256 destinationChainId,\\n bool enabled\\n ) public override onlyAdmin nonReentrant {\\n enabledDepositRoutes[originToken][destinationChainId] = enabled;\\n emit EnabledDepositRoute(originToken, destinationChainId, enabled);\\n }\\n\\n /**\\n * @notice Change allowance for deposit quote time to differ from current block time. Callable by admin only.\\n * @param newDepositQuoteTimeBuffer New quote time buffer.\\n */\\n function setDepositQuoteTimeBuffer(uint32 newDepositQuoteTimeBuffer) public override onlyAdmin nonReentrant {\\n depositQuoteTimeBuffer = newDepositQuoteTimeBuffer;\\n emit SetDepositQuoteTimeBuffer(newDepositQuoteTimeBuffer);\\n }\\n\\n /**\\n * @notice This method stores a new root bundle in this contract that can be executed to refund relayers, fulfill\\n * slow relays, and send funds back to the HubPool on L1. This method can only be called by the admin and is\\n * designed to be called as part of a cross-chain message from the HubPool's executeRootBundle method.\\n * @param relayerRefundRoot Merkle root containing relayer refund leaves that can be individually executed via\\n * executeRelayerRefundRoot().\\n * @param slowRelayRoot Merkle root containing slow relay fulfillment leaves that can be individually executed via\\n * executeSlowRelayRoot().\\n */\\n function relayRootBundle(bytes32 relayerRefundRoot, bytes32 slowRelayRoot) public override onlyAdmin nonReentrant {\\n uint32 rootBundleId = uint32(rootBundles.length);\\n RootBundle storage rootBundle = rootBundles.push();\\n rootBundle.relayerRefundRoot = relayerRefundRoot;\\n rootBundle.slowRelayRoot = slowRelayRoot;\\n emit RelayedRootBundle(rootBundleId, relayerRefundRoot, slowRelayRoot);\\n }\\n\\n /**\\n * @notice This method is intended to only be used in emergencies where a bad root bundle has reached the\\n * SpokePool.\\n * @param rootBundleId Index of the root bundle that needs to be deleted. Note: this is intentionally a uint256\\n * to ensure that a small input range doesn't limit which indices this method is able to reach.\\n */\\n function emergencyDeleteRootBundle(uint256 rootBundleId) public override onlyAdmin nonReentrant {\\n delete rootBundles[rootBundleId];\\n emit EmergencyDeleteRootBundle(rootBundleId);\\n }\\n\\n /**************************************\\n * DEPOSITOR FUNCTIONS *\\n **************************************/\\n\\n /**\\n * @notice Called by user to bridge funds from origin to destination chain. Depositor will effectively lock\\n * tokens in this contract and receive a destination token on the destination chain. The origin => destination\\n * token mapping is stored on the L1 HubPool.\\n * @notice The caller must first approve this contract to spend amount of originToken.\\n * @notice The originToken => destinationChainId must be enabled.\\n * @notice This method is payable because the caller is able to deposit ETH if the originToken is WETH and this\\n * function will handle wrapping ETH.\\n * @param recipient Address to receive funds at on destination chain.\\n * @param originToken Token to lock into this contract to initiate deposit.\\n * @param amount Amount of tokens to deposit. Will be amount of tokens to receive less fees.\\n * @param destinationChainId Denotes network where user will receive funds from SpokePool by a relayer.\\n * @param relayerFeePct % of deposit amount taken out to incentivize a fast relayer.\\n * @param quoteTimestamp Timestamp used by relayers to compute this deposit's realizedLPFeePct which is paid\\n * to LP pool on HubPool.\\n */\\n function deposit(\\n address recipient,\\n address originToken,\\n uint256 amount,\\n uint256 destinationChainId,\\n uint64 relayerFeePct,\\n uint32 quoteTimestamp\\n ) public payable override nonReentrant {\\n // Check that deposit route is enabled.\\n require(enabledDepositRoutes[originToken][destinationChainId], \\\"Disabled route\\\");\\n\\n // We limit the relay fees to prevent the user spending all their funds on fees.\\n require(relayerFeePct < 0.5e18, \\\"invalid relayer fee\\\");\\n // This function assumes that L2 timing cannot be compared accurately and consistently to L1 timing. Therefore,\\n // block.timestamp is different from the L1 EVM's. Therefore, the quoteTimestamp must be within a configurable\\n // buffer of this contract's block time to allow for this variance.\\n // Note also that quoteTimestamp cannot be less than the buffer otherwise the following arithmetic can result\\n // in underflow. This isn't a problem as the deposit will revert, but the error might be unexpected for clients.\\n require(\\n getCurrentTime() >= quoteTimestamp - depositQuoteTimeBuffer &&\\n getCurrentTime() <= quoteTimestamp + depositQuoteTimeBuffer,\\n \\\"invalid quote time\\\"\\n );\\n // If the address of the origin token is a WETH contract and there is a msg.value with the transaction\\n // then the user is sending ETH. In this case, the ETH should be deposited to WETH.\\n if (originToken == address(weth) && msg.value > 0) {\\n require(msg.value == amount, \\\"msg.value must match amount\\\");\\n weth.deposit{ value: msg.value }();\\n // Else, it is a normal ERC20. In this case pull the token from the user's wallet as per normal.\\n // Note: this includes the case where the L2 user has WETH (already wrapped ETH) and wants to bridge them.\\n // In this case the msg.value will be set to 0, indicating a \\\"normal\\\" ERC20 bridging action.\\n } else IERC20(originToken).safeTransferFrom(msg.sender, address(this), amount);\\n\\n _emitDeposit(\\n amount,\\n chainId(),\\n destinationChainId,\\n relayerFeePct,\\n numberOfDeposits,\\n quoteTimestamp,\\n originToken,\\n recipient,\\n msg.sender\\n );\\n\\n // Increment count of deposits so that deposit ID for this spoke pool is unique.\\n numberOfDeposits += 1;\\n }\\n\\n /**\\n * @notice Convenience method that depositor can use to signal to relayer to use updated fee.\\n * @notice Relayer should only use events emitted by this function to submit fills with updated fees, otherwise they\\n * risk their fills getting disputed for being invalid, for example if the depositor never actually signed the\\n * update fee message.\\n * @notice This function will revert if the depositor did not sign a message containing the updated fee for the\\n * deposit ID stored in this contract. If the deposit ID is for another contract, or the depositor address is\\n * incorrect, or the updated fee is incorrect, then the signature will not match and this function will revert.\\n * @param depositor Signer of the update fee message who originally submitted the deposit. If the deposit doesn't\\n * exist, then the relayer will not be able to fill any relay, so the caller should validate that the depositor\\n * did in fact submit a relay.\\n * @param newRelayerFeePct New relayer fee that relayers can use.\\n * @param depositId Deposit to update fee for that originated in this contract.\\n * @param depositorSignature Signed message containing the depositor address, this contract chain ID, the updated\\n * relayer fee %, and the deposit ID. This signature is produced by signing a hash of data according to the\\n * EIP-191 standard. See more in the _verifyUpdateRelayerFeeMessage() comments.\\n */\\n function speedUpDeposit(\\n address depositor,\\n uint64 newRelayerFeePct,\\n uint32 depositId,\\n bytes memory depositorSignature\\n ) public override nonReentrant {\\n require(newRelayerFeePct < 0.5e18, \\\"invalid relayer fee\\\");\\n\\n _verifyUpdateRelayerFeeMessage(depositor, chainId(), newRelayerFeePct, depositId, depositorSignature);\\n\\n // Assuming the above checks passed, a relayer can take the signature and the updated relayer fee information\\n // from the following event to submit a fill with an updated fee %.\\n emit RequestedSpeedUpDeposit(newRelayerFeePct, depositId, depositor, depositorSignature);\\n }\\n\\n /**************************************\\n * RELAYER FUNCTIONS *\\n **************************************/\\n\\n /**\\n * @notice Called by relayer to fulfill part of a deposit by sending destination tokens to the recipient.\\n * Relayer is expected to pass in unique identifying information for deposit that they want to fulfill, and this\\n * relay submission will be validated by off-chain data workers who can dispute this relay if any part is invalid.\\n * If the relay is valid, then the relayer will be refunded on their desired repayment chain. If relay is invalid,\\n * then relayer will not receive any refund.\\n * @notice All of the deposit data can be found via on-chain events from the origin SpokePool, except for the\\n * realizedLpFeePct which is a function of the HubPool's utilization at the deposit quote time. This fee %\\n * is deterministic based on the quote time, so the relayer should just compute it using the canonical algorithm\\n * as described in a UMIP linked to the HubPool's identifier.\\n * @param depositor Depositor on origin chain who set this chain as the destination chain.\\n * @param recipient Specified recipient on this chain.\\n * @param destinationToken Token to send to recipient. Should be mapped to the origin token, origin chain ID\\n * and this chain ID via a mapping on the HubPool.\\n * @param amount Full size of the deposit.\\n * @param maxTokensToSend Max amount of tokens to send recipient. If higher than amount, then caller will\\n * send recipient the full relay amount.\\n * @param repaymentChainId Chain of SpokePool where relayer wants to be refunded after the challenge window has\\n * passed.\\n * @param originChainId Chain of SpokePool where deposit originated.\\n * @param realizedLpFeePct Fee % based on L1 HubPool utilization at deposit quote time. Deterministic based on\\n * quote time.\\n * @param relayerFeePct Fee % to keep as relayer, specified by depositor.\\n * @param depositId Unique deposit ID on origin spoke pool.\\n */\\n function fillRelay(\\n address depositor,\\n address recipient,\\n address destinationToken,\\n uint256 amount,\\n uint256 maxTokensToSend,\\n uint256 repaymentChainId,\\n uint256 originChainId,\\n uint64 realizedLpFeePct,\\n uint64 relayerFeePct,\\n uint32 depositId\\n ) public nonReentrant {\\n // Each relay attempt is mapped to the hash of data uniquely identifying it, which includes the deposit data\\n // such as the origin chain ID and the deposit ID, and the data in a relay attempt such as who the recipient\\n // is, which chain and currency the recipient wants to receive funds on, and the relay fees.\\n SpokePoolInterface.RelayData memory relayData = SpokePoolInterface.RelayData({\\n depositor: depositor,\\n recipient: recipient,\\n destinationToken: destinationToken,\\n amount: amount,\\n realizedLpFeePct: realizedLpFeePct,\\n relayerFeePct: relayerFeePct,\\n depositId: depositId,\\n originChainId: originChainId,\\n destinationChainId: chainId()\\n });\\n bytes32 relayHash = _getRelayHash(relayData);\\n\\n uint256 fillAmountPreFees = _fillRelay(relayHash, relayData, maxTokensToSend, relayerFeePct, false);\\n\\n _emitFillRelay(relayHash, fillAmountPreFees, repaymentChainId, relayerFeePct, relayData, false);\\n }\\n\\n /**\\n * @notice Called by relayer to execute same logic as calling fillRelay except that relayer is using an updated\\n * relayer fee %. The fee % must have been emitted in a message cryptographically signed by the depositor.\\n * @notice By design, the depositor probably emitted the message with the updated fee by calling speedUpRelay().\\n * @param depositor Depositor on origin chain who set this chain as the destination chain.\\n * @param recipient Specified recipient on this chain.\\n * @param destinationToken Token to send to recipient. Should be mapped to the origin token, origin chain ID\\n * and this chain ID via a mapping on the HubPool.\\n * @param amount Full size of the deposit.\\n * @param maxTokensToSend Max amount of tokens to send recipient. If higher than amount, then caller will\\n * send recipient the full relay amount.\\n * @param repaymentChainId Chain of SpokePool where relayer wants to be refunded after the challenge window has\\n * passed.\\n * @param originChainId Chain of SpokePool where deposit originated.\\n * @param realizedLpFeePct Fee % based on L1 HubPool utilization at deposit quote time. Deterministic based on\\n * quote time.\\n * @param relayerFeePct Original fee % to keep as relayer set by depositor.\\n * @param newRelayerFeePct New fee % to keep as relayer also specified by depositor.\\n * @param depositId Unique deposit ID on origin spoke pool.\\n * @param depositorSignature Depositor-signed message containing updated fee %.\\n */\\n function fillRelayWithUpdatedFee(\\n address depositor,\\n address recipient,\\n address destinationToken,\\n uint256 amount,\\n uint256 maxTokensToSend,\\n uint256 repaymentChainId,\\n uint256 originChainId,\\n uint64 realizedLpFeePct,\\n uint64 relayerFeePct,\\n uint64 newRelayerFeePct,\\n uint32 depositId,\\n bytes memory depositorSignature\\n ) public override nonReentrant {\\n _verifyUpdateRelayerFeeMessage(depositor, originChainId, newRelayerFeePct, depositId, depositorSignature);\\n\\n // Now follow the default fillRelay flow with the updated fee and the original relay hash.\\n RelayData memory relayData = RelayData({\\n depositor: depositor,\\n recipient: recipient,\\n destinationToken: destinationToken,\\n amount: amount,\\n realizedLpFeePct: realizedLpFeePct,\\n relayerFeePct: relayerFeePct,\\n depositId: depositId,\\n originChainId: originChainId,\\n destinationChainId: chainId()\\n });\\n bytes32 relayHash = _getRelayHash(relayData);\\n uint256 fillAmountPreFees = _fillRelay(relayHash, relayData, maxTokensToSend, newRelayerFeePct, false);\\n\\n _emitFillRelay(relayHash, fillAmountPreFees, repaymentChainId, newRelayerFeePct, relayData, false);\\n }\\n\\n /**************************************\\n * DATA WORKER FUNCTIONS *\\n **************************************/\\n\\n /**\\n * @notice Executes a slow relay leaf stored as part of a root bundle. Will send the full amount remaining in the\\n * relay to the recipient, less fees.\\n * @dev This function assumes that the relay's destination chain ID is the current chain ID, which prevents\\n * the caller from executing a slow relay intended for another chain on this chain.\\n * @param depositor Depositor on origin chain who set this chain as the destination chain.\\n * @param recipient Specified recipient on this chain.\\n * @param destinationToken Token to send to recipient. Should be mapped to the origin token, origin chain ID\\n * and this chain ID via a mapping on the HubPool.\\n * @param amount Full size of the deposit.\\n * @param originChainId Chain of SpokePool where deposit originated.\\n * @param realizedLpFeePct Fee % based on L1 HubPool utilization at deposit quote time. Deterministic based on\\n * quote time.\\n * @param relayerFeePct Original fee % to keep as relayer set by depositor.\\n * @param depositId Unique deposit ID on origin spoke pool.\\n * @param rootBundleId Unique ID of root bundle containing slow relay root that this leaf is contained in.\\n * @param proof Inclusion proof for this leaf in slow relay root in root bundle.\\n */\\n function executeSlowRelayRoot(\\n address depositor,\\n address recipient,\\n address destinationToken,\\n uint256 amount,\\n uint256 originChainId,\\n uint64 realizedLpFeePct,\\n uint64 relayerFeePct,\\n uint32 depositId,\\n uint32 rootBundleId,\\n bytes32[] memory proof\\n ) public virtual override nonReentrant {\\n _executeSlowRelayRoot(\\n depositor,\\n recipient,\\n destinationToken,\\n amount,\\n originChainId,\\n chainId(),\\n realizedLpFeePct,\\n relayerFeePct,\\n depositId,\\n rootBundleId,\\n proof\\n );\\n }\\n\\n /**\\n * @notice Executes a relayer refund leaf stored as part of a root bundle. Will send the relayer the amount they\\n * sent to the recipient plus a relayer fee.\\n * @param rootBundleId Unique ID of root bundle containing relayer refund root that this leaf is contained in.\\n * @param relayerRefundLeaf Contains all data necessary to reconstruct leaf contained in root bundle and to\\n * refund relayer. This data structure is explained in detail in the SpokePoolInterface.\\n * @param proof Inclusion proof for this leaf in relayer refund root in root bundle.\\n */\\n function executeRelayerRefundRoot(\\n uint32 rootBundleId,\\n SpokePoolInterface.RelayerRefundLeaf memory relayerRefundLeaf,\\n bytes32[] memory proof\\n ) public virtual override nonReentrant {\\n _executeRelayerRefundRoot(rootBundleId, relayerRefundLeaf, proof);\\n }\\n\\n /**************************************\\n * VIEW FUNCTIONS *\\n **************************************/\\n\\n /**\\n * @notice Returns chain ID for this network.\\n * @dev Some L2s like ZKSync don't support the CHAIN_ID opcode so we allow the implementer to override this.\\n */\\n function chainId() public view virtual override returns (uint256) {\\n return block.chainid;\\n }\\n\\n /**************************************\\n * INTERNAL FUNCTIONS *\\n **************************************/\\n\\n // Verifies inclusion proof of leaf in root, sends relayer their refund, and sends to HubPool any rebalance\\n // transfers.\\n function _executeRelayerRefundRoot(\\n uint32 rootBundleId,\\n SpokePoolInterface.RelayerRefundLeaf memory relayerRefundLeaf,\\n bytes32[] memory proof\\n ) internal {\\n // Check integrity of leaf structure:\\n require(relayerRefundLeaf.chainId == chainId(), \\\"Invalid chainId\\\");\\n require(relayerRefundLeaf.refundAddresses.length == relayerRefundLeaf.refundAmounts.length, \\\"invalid leaf\\\");\\n\\n RootBundle storage rootBundle = rootBundles[rootBundleId];\\n\\n // Check that inclusionProof proves that relayerRefundLeaf is contained within the relayer refund root.\\n // Note: This should revert if the relayerRefundRoot is uninitialized.\\n require(MerkleLib.verifyRelayerRefund(rootBundle.relayerRefundRoot, relayerRefundLeaf, proof), \\\"Bad Proof\\\");\\n\\n // Verify the leafId in the leaf has not yet been claimed.\\n require(!MerkleLib.isClaimed(rootBundle.claimedBitmap, relayerRefundLeaf.leafId), \\\"Already claimed\\\");\\n\\n // Set leaf as claimed in bitmap. This is passed by reference to the storage rootBundle.\\n MerkleLib.setClaimed(rootBundle.claimedBitmap, relayerRefundLeaf.leafId);\\n\\n // Send each relayer refund address the associated refundAmount for the L2 token address.\\n // Note: Even if the L2 token is not enabled on this spoke pool, we should still refund relayers.\\n for (uint32 i = 0; i < relayerRefundLeaf.refundAmounts.length; i++) {\\n uint256 amount = relayerRefundLeaf.refundAmounts[i];\\n if (amount > 0)\\n IERC20(relayerRefundLeaf.l2TokenAddress).safeTransfer(relayerRefundLeaf.refundAddresses[i], amount);\\n }\\n\\n // If leaf's amountToReturn is positive, then send L2 --> L1 message to bridge tokens back via\\n // chain-specific bridging method.\\n if (relayerRefundLeaf.amountToReturn > 0) {\\n _bridgeTokensToHubPool(relayerRefundLeaf);\\n\\n emit TokensBridged(\\n relayerRefundLeaf.amountToReturn,\\n relayerRefundLeaf.chainId,\\n relayerRefundLeaf.leafId,\\n relayerRefundLeaf.l2TokenAddress,\\n msg.sender\\n );\\n }\\n\\n emit ExecutedRelayerRefundRoot(\\n relayerRefundLeaf.amountToReturn,\\n relayerRefundLeaf.chainId,\\n relayerRefundLeaf.refundAmounts,\\n rootBundleId,\\n relayerRefundLeaf.leafId,\\n relayerRefundLeaf.l2TokenAddress,\\n relayerRefundLeaf.refundAddresses,\\n msg.sender\\n );\\n }\\n\\n // Verifies inclusion proof of leaf in root and sends recipient remainder of relay. Marks relay as filled.\\n function _executeSlowRelayRoot(\\n address depositor,\\n address recipient,\\n address destinationToken,\\n uint256 amount,\\n uint256 originChainId,\\n uint256 destinationChainId,\\n uint64 realizedLpFeePct,\\n uint64 relayerFeePct,\\n uint32 depositId,\\n uint32 rootBundleId,\\n bytes32[] memory proof\\n ) internal {\\n RelayData memory relayData = RelayData({\\n depositor: depositor,\\n recipient: recipient,\\n destinationToken: destinationToken,\\n amount: amount,\\n originChainId: originChainId,\\n destinationChainId: destinationChainId,\\n realizedLpFeePct: realizedLpFeePct,\\n relayerFeePct: relayerFeePct,\\n depositId: depositId\\n });\\n\\n require(\\n MerkleLib.verifySlowRelayFulfillment(rootBundles[rootBundleId].slowRelayRoot, relayData, proof),\\n \\\"Invalid proof\\\"\\n );\\n\\n bytes32 relayHash = _getRelayHash(relayData);\\n\\n // Note: use relayAmount as the max amount to send, so the relay is always completely filled by the contract's\\n // funds in all cases. As this is a slow relay we set the relayerFeePct to 0. This effectively refunds the\\n // relayer component of the relayerFee thereby only charging the depositor the LpFee.\\n uint256 fillAmountPreFees = _fillRelay(relayHash, relayData, relayData.amount, 0, true);\\n\\n // Note: Set repayment chain ID to 0 to indicate that there is no repayment to be made. The off-chain data\\n // worker can use repaymentChainId=0 as a signal to ignore such relays for refunds. Also, set the relayerFeePct\\n // to 0 as slow relays do not pay the caller of this method (depositor is refunded this fee).\\n _emitFillRelay(relayHash, fillAmountPreFees, 0, 0, relayData, true);\\n }\\n\\n function _setCrossDomainAdmin(address newCrossDomainAdmin) internal {\\n require(newCrossDomainAdmin != address(0), \\\"Bad bridge router address\\\");\\n crossDomainAdmin = newCrossDomainAdmin;\\n emit SetXDomainAdmin(crossDomainAdmin);\\n }\\n\\n function _setHubPool(address newHubPool) internal {\\n require(newHubPool != address(0), \\\"Bad hub pool address\\\");\\n hubPool = newHubPool;\\n emit SetHubPool(hubPool);\\n }\\n\\n // Should be overriden by implementing contract depending on how L2 handles sending tokens to L1.\\n function _bridgeTokensToHubPool(SpokePoolInterface.RelayerRefundLeaf memory relayerRefundLeaf) internal virtual;\\n\\n function _verifyUpdateRelayerFeeMessage(\\n address depositor,\\n uint256 originChainId,\\n uint64 newRelayerFeePct,\\n uint32 depositId,\\n bytes memory depositorSignature\\n ) internal view {\\n // A depositor can request to speed up an un-relayed deposit by signing a hash containing the relayer\\n // fee % to update to and information uniquely identifying the deposit to relay. This information ensures\\n // that this signature cannot be re-used for other deposits. The version string is included as a precaution\\n // in case this contract is upgraded.\\n // Note: we use encode instead of encodePacked because it is more secure, more in the \\\"warning\\\" section\\n // here: https://docs.soliditylang.org/en/v0.8.11/abi-spec.html#non-standard-packed-mode\\n bytes32 expectedDepositorMessageHash = keccak256(\\n abi.encode(\\\"ACROSS-V2-FEE-1.0\\\", newRelayerFeePct, depositId, originChainId)\\n );\\n\\n // Check the hash corresponding to the https://eth.wiki/json-rpc/API#eth_sign[eth_sign]\\n // If the depositor signed a message with a different updated fee (or any other param included in the\\n // above keccak156 hash), then this will revert.\\n bytes32 ethSignedMessageHash = ECDSA.toEthSignedMessageHash(expectedDepositorMessageHash);\\n\\n _verifyDepositorUpdateFeeMessage(depositor, ethSignedMessageHash, depositorSignature);\\n }\\n\\n // This function is isolated and made virtual to allow different L2's to implement chain specific recovery of\\n // signers from signatures because some L2s might not support ecrecover. To be safe, consider always reverting\\n // this function for L2s where ecrecover is different from how it works on Ethereum, otherwise there is the\\n // potential to forge a signature from the depositor using a different private key than the original depositor's.\\n function _verifyDepositorUpdateFeeMessage(\\n address depositor,\\n bytes32 ethSignedMessageHash,\\n bytes memory depositorSignature\\n ) internal view virtual {\\n // Note: We purposefully do not support EIP-191 signatures (meaning that multisigs and smart contract wallets\\n // like Argent are not supported) because of the possibility that a multisig that signed a message on the origin\\n // chain does not have a parallel on this destination chain.\\n require(depositor == ECDSA.recover(ethSignedMessageHash, depositorSignature), \\\"invalid signature\\\");\\n }\\n\\n function _computeAmountPreFees(uint256 amount, uint64 feesPct) private pure returns (uint256) {\\n return (1e18 * amount) / (1e18 - feesPct);\\n }\\n\\n function _computeAmountPostFees(uint256 amount, uint64 feesPct) private pure returns (uint256) {\\n return (amount * (1e18 - feesPct)) / 1e18;\\n }\\n\\n function _getRelayHash(SpokePoolInterface.RelayData memory relayData) private pure returns (bytes32) {\\n return keccak256(abi.encode(relayData));\\n }\\n\\n // Unwraps ETH and does a transfer to a recipient address. If the recipient is a smart contract then sends WETH.\\n function _unwrapWETHTo(address payable to, uint256 amount) internal {\\n if (address(to).isContract()) {\\n IERC20(address(weth)).safeTransfer(to, amount);\\n } else {\\n weth.withdraw(amount);\\n to.transfer(amount);\\n }\\n }\\n\\n /**\\n * @notice Caller specifies the max amount of tokens to send to user. Based on this amount and the amount of the\\n * relay remaining (as stored in the relayFills mapping), pull the amount of tokens from the caller\\n * and send to the recipient.\\n * @dev relayFills keeps track of pre-fee fill amounts as a convenience to relayers who want to specify round\\n * numbers for the maxTokensToSend parameter or convenient numbers like 100 (i.e. relayers who will fully\\n * fill any relay up to 100 tokens, and partial fill with 100 tokens for larger relays).\\n * @dev Caller must approve this contract to transfer up to maxTokensToSend of the relayData.destinationToken.\\n * The amount to be sent might end up less if there is insufficient relay amount remaining to be sent.\\n */\\n function _fillRelay(\\n bytes32 relayHash,\\n RelayData memory relayData,\\n uint256 maxTokensToSend,\\n uint64 updatableRelayerFeePct,\\n bool useContractFunds\\n ) internal returns (uint256 fillAmountPreFees) {\\n // We limit the relay fees to prevent the user spending all their funds on fees. Note that 0.5e18 (i.e. 50%)\\n // fees are just magic numbers. The important point is to prevent the total fee from being 100%, otherwise\\n // computing the amount pre fees runs into divide-by-0 issues.\\n require(updatableRelayerFeePct < 0.5e18 && relayData.realizedLpFeePct < 0.5e18, \\\"invalid fees\\\");\\n\\n // Check that the relay has not already been completely filled. Note that the relays mapping will point to\\n // the amount filled so far for a particular relayHash, so this will start at 0 and increment with each fill.\\n require(relayFills[relayHash] < relayData.amount, \\\"relay filled\\\");\\n\\n // Stores the equivalent amount to be sent by the relayer before fees have been taken out.\\n if (maxTokensToSend == 0) return 0;\\n\\n // Derive the amount of the relay filled if the caller wants to send exactly maxTokensToSend tokens to\\n // the recipient. For example, if the user wants to send 10 tokens to the recipient, the full relay amount\\n // is 100, and the fee %'s total 5%, then this computation would return ~10.5, meaning that to fill 10.5/100\\n // of the full relay size, the caller would need to send 10 tokens to the user.\\n fillAmountPreFees = _computeAmountPreFees(\\n maxTokensToSend,\\n (relayData.realizedLpFeePct + updatableRelayerFeePct)\\n );\\n // If user's specified max amount to send is greater than the amount of the relay remaining pre-fees,\\n // we'll pull exactly enough tokens to complete the relay.\\n uint256 amountToSend = maxTokensToSend;\\n uint256 amountRemainingInRelay = relayData.amount - relayFills[relayHash];\\n if (amountRemainingInRelay < fillAmountPreFees) {\\n fillAmountPreFees = amountRemainingInRelay;\\n\\n // The user will fulfill the remainder of the relay, so we need to compute exactly how many tokens post-fees\\n // that they need to send to the recipient. Note that if the relayer is filled using contract funds then\\n // this is a slow relay.\\n amountToSend = _computeAmountPostFees(\\n fillAmountPreFees,\\n relayData.realizedLpFeePct + updatableRelayerFeePct\\n );\\n }\\n\\n // relayFills keeps track of pre-fee fill amounts as a convenience to relayers who want to specify round\\n // numbers for the maxTokensToSend parameter or convenient numbers like 100 (i.e. relayers who will fully\\n // fill any relay up to 100 tokens, and partial fill with 100 tokens for larger relays).\\n relayFills[relayHash] += fillAmountPreFees;\\n\\n // If relay token is weth then unwrap and send eth.\\n if (relayData.destinationToken == address(weth)) {\\n // Note: useContractFunds is True if we want to send funds to the recipient directly out of this contract,\\n // otherwise we expect the caller to send funds to the recipient. If useContractFunds is True and the\\n // recipient wants WETH, then we can assume that WETH is already in the contract, otherwise we'll need the\\n // the user to send WETH to this contract. Regardless, we'll need to unwrap it before sending to the user.\\n if (!useContractFunds)\\n IERC20(relayData.destinationToken).safeTransferFrom(msg.sender, address(this), amountToSend);\\n _unwrapWETHTo(payable(relayData.recipient), amountToSend);\\n // Else, this is a normal ERC20 token. Send to recipient.\\n } else {\\n // Note: Similar to note above, send token directly from the contract to the user in the slow relay case.\\n if (!useContractFunds)\\n IERC20(relayData.destinationToken).safeTransferFrom(msg.sender, relayData.recipient, amountToSend);\\n else IERC20(relayData.destinationToken).safeTransfer(relayData.recipient, amountToSend);\\n }\\n }\\n\\n // The following internal methods emit events with many params to overcome solidity stack too deep issues.\\n function _emitFillRelay(\\n bytes32 relayHash,\\n uint256 fillAmount,\\n uint256 repaymentChainId,\\n uint64 relayerFeePct,\\n RelayData memory relayData,\\n bool isSlowRelay\\n ) internal {\\n emit FilledRelay(\\n relayHash,\\n relayData.amount,\\n relayFills[relayHash],\\n fillAmount,\\n repaymentChainId,\\n relayData.originChainId,\\n relayData.destinationChainId,\\n relayerFeePct,\\n relayData.realizedLpFeePct,\\n relayData.depositId,\\n relayData.destinationToken,\\n msg.sender,\\n relayData.depositor,\\n relayData.recipient,\\n isSlowRelay\\n );\\n }\\n\\n function _emitDeposit(\\n uint256 amount,\\n uint256 originChainId,\\n uint256 destinationChainId,\\n uint64 relayerFeePct,\\n uint32 depositId,\\n uint32 quoteTimestamp,\\n address originToken,\\n address recipient,\\n address depositor\\n ) internal {\\n emit FundsDeposited(\\n amount,\\n originChainId,\\n destinationChainId,\\n relayerFeePct,\\n depositId,\\n quoteTimestamp,\\n originToken,\\n recipient,\\n depositor\\n );\\n }\\n\\n // Implementing contract needs to override this to ensure that only the appropriate cross chain admin can execute\\n // certain admin functions. For L2 contracts, the cross chain admin refers to some L1 address or contract, and for\\n // L1, this would just be the same admin of the HubPool.\\n function _requireAdminSender() internal virtual;\\n\\n // Added to enable the this contract to receive ETH. Used when unwrapping Weth.\\n receive() external payable {}\\n}\\n\",\"keccak256\":\"0x460bea0562b87af55699b2ec0e53735b2224039573f9c5243815541263588bc1\",\"license\":\"GPL-3.0-only\"},\"contracts/SpokePoolInterface.sol\":{\"content\":\"// SPDX-License-Identifier: GPL-3.0-only\\npragma solidity ^0.8.0;\\n\\n/**\\n * @notice Contains common data structures and functions used by all SpokePool implementations.\\n */\\ninterface SpokePoolInterface {\\n // This leaf is meant to be decoded in the SpokePool to pay out successful relayers.\\n struct RelayerRefundLeaf {\\n // This is the amount to return to the HubPool. This occurs when there is a PoolRebalanceLeaf netSendAmount that\\n // is negative. This is just the negative of this value.\\n uint256 amountToReturn;\\n // Used to verify that this is being executed on the correct destination chainId.\\n uint256 chainId;\\n // This array designates how much each of those addresses should be refunded.\\n uint256[] refundAmounts;\\n // Used as the index in the bitmap to track whether this leaf has been executed or not.\\n uint32 leafId;\\n // The associated L2TokenAddress that these claims apply to.\\n address l2TokenAddress;\\n // Must be same length as refundAmounts and designates each address that must be refunded.\\n address[] refundAddresses;\\n }\\n\\n // This struct represents the data to fully specify a relay. If any portion of this data differs, the relay is\\n // considered to be completely distinct. Only one relay for a particular depositId, chainId pair should be\\n // considered valid and repaid. This data is hashed and inserted into the slow relay merkle root so that an off\\n // chain validator can choose when to refund slow relayers.\\n struct RelayData {\\n // The address that made the deposit on the origin chain.\\n address depositor;\\n // The recipient address on the destination chain.\\n address recipient;\\n // The corresponding token address on the destination chain.\\n address destinationToken;\\n // The total relay amount before fees are taken out.\\n uint256 amount;\\n // Origin chain id.\\n uint256 originChainId;\\n // Destination chain id.\\n uint256 destinationChainId;\\n // The LP Fee percentage computed by the relayer based on the deposit's quote timestamp\\n // and the HubPool's utilization.\\n uint64 realizedLpFeePct;\\n // The relayer fee percentage specified in the deposit.\\n uint64 relayerFeePct;\\n // The id uniquely identifying this deposit on the origin chain.\\n uint32 depositId;\\n }\\n\\n // Stores collection of merkle roots that can be published to this contract from the HubPool, which are referenced\\n // by \\\"data workers\\\" via inclusion proofs to execute leaves in the roots.\\n struct RootBundle {\\n // Merkle root of slow relays that were not fully filled and whose recipient is still owed funds from the LP pool.\\n bytes32 slowRelayRoot;\\n // Merkle root of relayer refunds for successful relays.\\n bytes32 relayerRefundRoot;\\n // This is a 2D bitmap tracking which leaves in the relayer refund root have been claimed, with max size of\\n // 256x256 leaves per root.\\n mapping(uint256 => uint256) claimedBitmap;\\n }\\n\\n function setCrossDomainAdmin(address newCrossDomainAdmin) external;\\n\\n function setHubPool(address newHubPool) external;\\n\\n function setEnableRoute(\\n address originToken,\\n uint256 destinationChainId,\\n bool enable\\n ) external;\\n\\n function setDepositQuoteTimeBuffer(uint32 buffer) external;\\n\\n function relayRootBundle(bytes32 relayerRefundRoot, bytes32 slowRelayRoot) external;\\n\\n function emergencyDeleteRootBundle(uint256 rootBundleId) external;\\n\\n function deposit(\\n address recipient,\\n address originToken,\\n uint256 amount,\\n uint256 destinationChainId,\\n uint64 relayerFeePct,\\n uint32 quoteTimestamp\\n ) external payable;\\n\\n function speedUpDeposit(\\n address depositor,\\n uint64 newRelayerFeePct,\\n uint32 depositId,\\n bytes memory depositorSignature\\n ) external;\\n\\n function fillRelay(\\n address depositor,\\n address recipient,\\n address destinationToken,\\n uint256 amount,\\n uint256 maxTokensToSend,\\n uint256 repaymentChainId,\\n uint256 originChainId,\\n uint64 realizedLpFeePct,\\n uint64 relayerFeePct,\\n uint32 depositId\\n ) external;\\n\\n function fillRelayWithUpdatedFee(\\n address depositor,\\n address recipient,\\n address destinationToken,\\n uint256 amount,\\n uint256 maxTokensToSend,\\n uint256 repaymentChainId,\\n uint256 originChainId,\\n uint64 realizedLpFeePct,\\n uint64 relayerFeePct,\\n uint64 newRelayerFeePct,\\n uint32 depositId,\\n bytes memory depositorSignature\\n ) external;\\n\\n function executeSlowRelayRoot(\\n address depositor,\\n address recipient,\\n address destinationToken,\\n uint256 amount,\\n uint256 originChainId,\\n uint64 realizedLpFeePct,\\n uint64 relayerFeePct,\\n uint32 depositId,\\n uint32 rootBundleId,\\n bytes32[] memory proof\\n ) external;\\n\\n function executeRelayerRefundRoot(\\n uint32 rootBundleId,\\n SpokePoolInterface.RelayerRefundLeaf memory relayerRefundLeaf,\\n bytes32[] memory proof\\n ) external;\\n\\n function chainId() external view returns (uint256);\\n}\\n\",\"keccak256\":\"0xe0ae593c1cd9c8204f0b7a3f226a5d4bd30d580692d2ecb2a33548b5b4e75f12\",\"license\":\"GPL-3.0-only\"},\"contracts/interfaces/AdapterInterface.sol\":{\"content\":\"// SPDX-License-Identifier: AGPL-3.0-only\\npragma solidity ^0.8.0;\\n\\n/**\\n * @notice Sends cross chain messages and tokens to contracts on a specific L2 network.\\n */\\n\\ninterface AdapterInterface {\\n event MessageRelayed(address target, bytes message);\\n\\n event TokensRelayed(address l1Token, address l2Token, uint256 amount, address to);\\n\\n function relayMessage(address target, bytes memory message) external payable;\\n\\n function relayTokens(\\n address l1Token,\\n address l2Token,\\n uint256 amount,\\n address to\\n ) external payable;\\n}\\n\",\"keccak256\":\"0xbd7091006acbdfe72b21ce985f964f0682a2316d9d3b38967beeb55f4ae5118c\",\"license\":\"AGPL-3.0-only\"},\"contracts/interfaces/WETH9.sol\":{\"content\":\"// SPDX-License-Identifier: GPL-3.0-only\\npragma solidity ^0.8.0;\\n\\ninterface WETH9 {\\n function withdraw(uint256 wad) external;\\n\\n function deposit() external payable;\\n\\n function balanceOf(address guy) external view returns (uint256 wad);\\n\\n function transfer(address guy, uint256 wad) external;\\n}\\n\",\"keccak256\":\"0x7b444d0840b1f76eee9bf39d74830f70644395613b96cce2d80fc50785a82eaa\",\"license\":\"GPL-3.0-only\"}},\"version\":1}", + "bytecode": "0x60a06040526002805463ffffffff60a01b1916604b60a31b1790553480156200002757600080fd5b506040516200467a3803806200467a8339810160408190526200004a9162000260565b600080546001600160a81b0319166001600160a01b03831617600160a01b179055338383836200007a84620000a9565b62000085836200014f565b506001600160a01b031660805250620000a0905033620001f1565b505050620002aa565b6001600160a01b038116620001055760405162461bcd60e51b815260206004820152601960248201527f4261642062726964676520726f7574657220616464726573730000000000000060448201526064015b60405180910390fd5b600180546001600160a01b0319166001600160a01b0383169081179091556040517fa9e8c42c9e7fca7f62755189a16b2f5314d43d8fb24e91ba54e6d65f9314e84990600090a250565b6001600160a01b038116620001a75760405162461bcd60e51b815260206004820152601460248201527f4261642068756220706f6f6c20616464726573730000000000000000000000006044820152606401620000fc565b600280546001600160a01b0319166001600160a01b0383169081179091556040517f1f17a88f67b0f49060a34bec1a4723a563620e6aa265eb640b5046dcee0759a090600090a250565b600680546001600160a01b038381166001600160a01b0319831681179093556040519116919082907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e090600090a35050565b80516001600160a01b03811681146200025b57600080fd5b919050565b6000806000606084860312156200027657600080fd5b620002818462000243565b9250620002916020850162000243565b9150620002a16040850162000243565b90509250925092565b608051614391620002e9600039600081816102d501528181610c6201528181610d2b01528181611f9e01528181612a2e0152612a8401526143916000f3fe6080604052600436106101bb5760003560e01c80638a7860ce116100ec578063e19044021161008a578063f06850f611610064578063f06850f61461059a578063f2fde38b146105c7578063f500697c146105e7578063ffc351a31461060757600080fd5b8063e190440214610518578063e282d5b914610545578063ee2a53f81461056557600080fd5b8063a1244c67116100c6578063a1244c671461047f578063ac9650d8146104b8578063c894c0ca146104d8578063de7eba78146104f857600080fd5b80638a7860ce146104215780638da5cb5b146104415780639a8a05921461046c57600080fd5b806349228978116101595780635285e058116101335780635285e0581461037557806357f6dcb8146103a2578063715018a6146103ec57806389a153cc1461040157600080fd5b806349228978146102f7578063493a4f841461030a5780635249fef11461032a57600080fd5b8063272751c711610195578063272751c7146102605780632752042e1461028057806329cb924d146102a05780633fc8cef3146102c357600080fd5b80631c39c38d146101c75780631dfb2d021461021e57806322f8e5661461024057600080fd5b366101c257005b600080fd5b3480156101d357600080fd5b506000546101f49073ffffffffffffffffffffffffffffffffffffffff1681565b60405173ffffffffffffffffffffffffffffffffffffffff90911681526020015b60405180910390f35b34801561022a57600080fd5b5061023e6102393660046134d0565b610627565b005b34801561024c57600080fd5b5061023e61025b3660046134eb565b6106b4565b34801561026c57600080fd5b5061023e61027b366004613512565b61075d565b34801561028c57600080fd5b5061023e61029b366004613566565b610874565b3480156102ac57600080fd5b506102b5610975565b604051908152602001610215565b3480156102cf57600080fd5b506101f47f000000000000000000000000000000000000000000000000000000000000000081565b61023e610305366004613599565b610a2d565b34801561031657600080fd5b5061023e6103253660046135ff565b610e94565b34801561033657600080fd5b50610365610345366004613621565b600360209081526000928352604080842090915290825290205460ff1681565b6040519015158152602001610215565b34801561038157600080fd5b506001546101f49073ffffffffffffffffffffffffffffffffffffffff1681565b3480156103ae57600080fd5b506002546103d79074010000000000000000000000000000000000000000900463ffffffff1681565b60405163ffffffff9091168152602001610215565b3480156103f857600080fd5b5061023e610fbb565b34801561040d57600080fd5b5061023e61041c36600461364b565b611048565b34801561042d57600080fd5b5061023e61043c3660046134eb565b6111a4565b34801561044d57600080fd5b5060065473ffffffffffffffffffffffffffffffffffffffff166101f4565b34801561047857600080fd5b50466102b5565b34801561048b57600080fd5b506002546103d7907801000000000000000000000000000000000000000000000000900463ffffffff1681565b6104cb6104c63660046136e9565b611278565b60405161021591906137d4565b3480156104e457600080fd5b5061023e6104f33660046139ec565b611452565b34801561050457600080fd5b5061023e6105133660046134d0565b6114d6565b34801561052457600080fd5b506002546101f49073ffffffffffffffffffffffffffffffffffffffff1681565b34801561055157600080fd5b5061023e610560366004613b7f565b61151c565b34801561057157600080fd5b506105856105803660046134eb565b61167a565b60408051928352602083019190915201610215565b3480156105a657600080fd5b506102b56105b53660046134eb565b60056020526000908152604090205481565b3480156105d357600080fd5b5061023e6105e23660046134d0565b6116a8565b3480156105f357600080fd5b5061023e610602366004613bee565b6117d5565b34801561061357600080fd5b5061023e610622366004613cb5565b611861565b61062f6119cc565b610637611a4d565b610664600080547fffffffffffffffffffffff00ffffffffffffffffffffffffffffffffffffffff169055565b61066d81611ad1565b6106b1600080547fffffffffffffffffffffff00ffffffffffffffffffffffffffffffffffffffff1674010000000000000000000000000000000000000000179055565b50565b60005473ffffffffffffffffffffffffffffffffffffffff166106d657600080fd5b6000546040517f22f8e5660000000000000000000000000000000000000000000000000000000081526004810183905273ffffffffffffffffffffffffffffffffffffffff909116906322f8e56690602401600060405180830381600087803b15801561074257600080fd5b505af1158015610756573d6000803e3d6000fd5b5050505050565b6107656119cc565b61076d611a4d565b61079a600080547fffffffffffffffffffffff00ffffffffffffffffffffffffffffffffffffffff169055565b73ffffffffffffffffffffffffffffffffffffffff8316600081815260036020908152604080832086845282529182902080547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff001685151590811790915591519182528492917f0a21fdd43d0ad0c62689ee7230a47309a050755bcc52eba00310add65297692a910160405180910390a361086f600080547fffffffffffffffffffffff00ffffffffffffffffffffffffffffffffffffffff1674010000000000000000000000000000000000000000179055565b505050565b61087c6119cc565b610884611a4d565b6108b1600080547fffffffffffffffffffffff00ffffffffffffffffffffffffffffffffffffffff169055565b600280547fffffffffffffffff00000000ffffffffffffffffffffffffffffffffffffffff167401000000000000000000000000000000000000000063ffffffff8416908102919091179091556040519081527f0e55dd180fa793d9036c804d0a116e6a7617a48e72cee1f83d92793a793fcc039060200160405180910390a16106b1600080547fffffffffffffffffffffff00ffffffffffffffffffffffffffffffffffffffff1674010000000000000000000000000000000000000000179055565b6000805473ffffffffffffffffffffffffffffffffffffffff1615610a285760008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166329cb924d6040518163ffffffff1660e01b8152600401602060405180830381865afa1580156109ff573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610a239190613d93565b905090565b504290565b610a35611a4d565b610a62600080547fffffffffffffffffffffff00ffffffffffffffffffffffffffffffffffffffff169055565b73ffffffffffffffffffffffffffffffffffffffff8516600090815260036020908152604080832086845290915290205460ff16610b01576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152600e60248201527f44697361626c656420726f75746500000000000000000000000000000000000060448201526064015b60405180910390fd5b6706f05b59d3b200008267ffffffffffffffff1610610b7c576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601360248201527f696e76616c69642072656c6179657220666565000000000000000000000000006044820152606401610af8565b600254610ba79074010000000000000000000000000000000000000000900463ffffffff1682613ddb565b63ffffffff16610bb5610975565b10158015610bfa5750600254610be99074010000000000000000000000000000000000000000900463ffffffff1682613e00565b63ffffffff16610bf7610975565b11155b610c60576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601260248201527f696e76616c69642071756f74652074696d6500000000000000000000000000006044820152606401610af8565b7f000000000000000000000000000000000000000000000000000000000000000073ffffffffffffffffffffffffffffffffffffffff168573ffffffffffffffffffffffffffffffffffffffff16148015610cbb5750600034115b15610daf57833414610d29576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601b60248201527f6d73672e76616c7565206d757374206d6174636820616d6f756e7400000000006044820152606401610af8565b7f000000000000000000000000000000000000000000000000000000000000000073ffffffffffffffffffffffffffffffffffffffff1663d0e30db0346040518263ffffffff1660e01b81526004016000604051808303818588803b158015610d9157600080fd5b505af1158015610da5573d6000803e3d6000fd5b5050505050610dd1565b610dd173ffffffffffffffffffffffffffffffffffffffff8616333087611bbd565b610e088446600254869086907801000000000000000000000000000000000000000000000000900463ffffffff16868b8d33611c99565b6001600260188282829054906101000a900463ffffffff16610e2a9190613e00565b92506101000a81548163ffffffff021916908363ffffffff160217905550610e8c600080547fffffffffffffffffffffff00ffffffffffffffffffffffffffffffffffffffff1674010000000000000000000000000000000000000000179055565b505050505050565b610e9c6119cc565b610ea4611a4d565b610ed1600080547fffffffffffffffffffffff00ffffffffffffffffffffffffffffffffffffffff169055565b60048054600181018255600091909152600381027f8a35acfbc15ff81a39ae7d344fd709f28e8600b4aa8c65c6b64bfe7fe36bd19c81018490557f8a35acfbc15ff81a39ae7d344fd709f28e8600b4aa8c65c6b64bfe7fe36bd19b01828155604080518581526020810185905263ffffffff8416917fc86ba04c55bc5eb2f2876b91c438849a296dbec7b08751c3074d92e04f0a77af910160405180910390a25050610fb7600080547fffffffffffffffffffffff00ffffffffffffffffffffffffffffffffffffffff1674010000000000000000000000000000000000000000179055565b5050565b60065473ffffffffffffffffffffffffffffffffffffffff16331461103c576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e65726044820152606401610af8565b6110466000611d2a565b565b611050611a4d565b61107d600080547fffffffffffffffffffffff00ffffffffffffffffffffffffffffffffffffffff169055565b60006040518061012001604052808c73ffffffffffffffffffffffffffffffffffffffff1681526020018b73ffffffffffffffffffffffffffffffffffffffff1681526020018a73ffffffffffffffffffffffffffffffffffffffff1681526020018981526020018681526020016110f24690565b81526020018567ffffffffffffffff1681526020018467ffffffffffffffff1681526020018363ffffffff168152509050600061112e82611da1565b9050600061114082848b886000611dd1565b905061115182828a8887600061207e565b505050611198600080547fffffffffffffffffffffff00ffffffffffffffffffffffffffffffffffffffff1674010000000000000000000000000000000000000000179055565b50505050505050505050565b6111ac6119cc565b6111b4611a4d565b6111e1600080547fffffffffffffffffffffff00ffffffffffffffffffffffffffffffffffffffff169055565b600481815481106111f4576111f4613e28565b60009182526020822060039091020181815560010181905560405182917f3569b846531b754c99cb80df3f49cd72fa6fe106aaee5ab8e0caf35a9d7ce88d91a26106b1600080547fffffffffffffffffffffff00ffffffffffffffffffffffffffffffffffffffff1674010000000000000000000000000000000000000000179055565b606034156112e2576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601b60248201527f4f6e6c79206d756c746963616c6c207769746820302076616c756500000000006044820152606401610af8565b8167ffffffffffffffff8111156112fb576112fb613854565b60405190808252806020026020018201604052801561132e57816020015b60608152602001906001900390816113195790505b50905060005b8281101561144b576000803086868581811061135257611352613e28565b90506020028101906113649190613e57565b604051611372929190613ebc565b600060405180830381855af49150503d80600081146113ad576040519150601f19603f3d011682016040523d82523d6000602084013e6113b2565b606091505b509150915081611418576044815110156113cb57600080fd5b600481019050808060200190518101906113e59190613ecc565b6040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610af89190613f3a565b8084848151811061142b5761142b613e28565b60200260200101819052505050808061144390613f4d565b915050611334565b5092915050565b61145a611a4d565b611487600080547fffffffffffffffffffffff00ffffffffffffffffffffffffffffffffffffffff169055565b6114928383836121b3565b61086f600080547fffffffffffffffffffffff00ffffffffffffffffffffffffffffffffffffffff1674010000000000000000000000000000000000000000179055565b6114de6119cc565b6114e6611a4d565b611513600080547fffffffffffffffffffffff00ffffffffffffffffffffffffffffffffffffffff169055565b61066d81612579565b611524611a4d565b611551600080547fffffffffffffffffffffff00ffffffffffffffffffffffffffffffffffffffff169055565b6706f05b59d3b200008367ffffffffffffffff16106115cc576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601360248201527f696e76616c69642072656c6179657220666565000000000000000000000000006044820152606401610af8565b6115d98446858585612665565b8373ffffffffffffffffffffffffffffffffffffffff168263ffffffff167fb9de16bf376724405019a10ef4fedac57fecd292bf86c08d81d7c42d394d5d378584604051611628929190613f85565b60405180910390a3611674600080547fffffffffffffffffffffff00ffffffffffffffffffffffffffffffffffffffff1674010000000000000000000000000000000000000000179055565b50505050565b6004818154811061168a57600080fd5b60009182526020909120600390910201805460019091015490915082565b60065473ffffffffffffffffffffffffffffffffffffffff163314611729576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e65726044820152606401610af8565b73ffffffffffffffffffffffffffffffffffffffff81166117cc576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201527f64647265737300000000000000000000000000000000000000000000000000006064820152608401610af8565b6106b181611d2a565b6117dd611a4d565b61180a600080547fffffffffffffffffffffff00ffffffffffffffffffffffffffffffffffffffff169055565b61181d8a8a8a8a8a468b8b8b8b8b612702565b611198600080547fffffffffffffffffffffff00ffffffffffffffffffffffffffffffffffffffff1674010000000000000000000000000000000000000000179055565b611869611a4d565b611896600080547fffffffffffffffffffffff00ffffffffffffffffffffffffffffffffffffffff169055565b6118a38c87858585612665565b60006040518061012001604052808e73ffffffffffffffffffffffffffffffffffffffff1681526020018d73ffffffffffffffffffffffffffffffffffffffff1681526020018c73ffffffffffffffffffffffffffffffffffffffff1681526020018b81526020018881526020016119184690565b81526020018767ffffffffffffffff1681526020018667ffffffffffffffff1681526020018463ffffffff168152509050600061195482611da1565b9050600061196682848d896000611dd1565b905061197782828c8987600061207e565b5050506119be600080547fffffffffffffffffffffff00ffffffffffffffffffffffffffffffffffffffff1674010000000000000000000000000000000000000000179055565b505050505050505050505050565b60065473ffffffffffffffffffffffffffffffffffffffff163314611046576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e65726044820152606401610af8565b60005474010000000000000000000000000000000000000000900460ff16611046576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601f60248201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c006044820152606401610af8565b73ffffffffffffffffffffffffffffffffffffffff8116611b4e576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601460248201527f4261642068756220706f6f6c20616464726573730000000000000000000000006044820152606401610af8565b600280547fffffffffffffffffffffffff00000000000000000000000000000000000000001673ffffffffffffffffffffffffffffffffffffffff83169081179091556040517f1f17a88f67b0f49060a34bec1a4723a563620e6aa265eb640b5046dcee0759a090600090a250565b60405173ffffffffffffffffffffffffffffffffffffffff808516602483015283166044820152606481018290526116749085907f23b872dd00000000000000000000000000000000000000000000000000000000906084015b604080517fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe08184030181529190526020810180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff167fffffffff0000000000000000000000000000000000000000000000000000000090931692909217909152612881565b604080518a8152602081018a905290810188905267ffffffffffffffff8716606082015263ffffffff858116608083015273ffffffffffffffffffffffffffffffffffffffff84811660a084015280841692908616918816907f4a4fc49abd237bfd7f4ac82d6c7a284c69daaea5154430cff04ad7482c6c42549060c00160405180910390a4505050505050505050565b6006805473ffffffffffffffffffffffffffffffffffffffff8381167fffffffffffffffffffffffff0000000000000000000000000000000000000000831681179093556040519116919082907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e090600090a35050565b600081604051602001611db49190613fa8565b604051602081830303815290604052805190602001209050919050565b60006706f05b59d3b200008367ffffffffffffffff16108015611e0957506706f05b59d3b200008560c0015167ffffffffffffffff16105b611e6f576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152600c60248201527f696e76616c6964206665657300000000000000000000000000000000000000006044820152606401610af8565b606085015160008781526005602052604090205410611eea576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152600c60248201527f72656c61792066696c6c656400000000000000000000000000000000000000006044820152606401610af8565b83600003611efa57506000612075565b611f1384848760c00151611f0e919061404f565b61298d565b60008781526005602052604081205460608801519293508692611f369190614072565b905082811015611f5f57809250611f5c83868960c00151611f57919061404f565b6129ce565b91505b60008881526005602052604081208054859290611f7d908490614089565b9091555050604087015173ffffffffffffffffffffffffffffffffffffffff7f000000000000000000000000000000000000000000000000000000000000000081169116036120055783611ff2576040870151611ff29073ffffffffffffffffffffffffffffffffffffffff16333085611bbd565b6120008760200151836129f7565b612072565b8361203f57612000338860200151848a6040015173ffffffffffffffffffffffffffffffffffffffff16611bbd909392919063ffffffff16565b612072876020015183896040015173ffffffffffffffffffffffffffffffffffffffff16612b389092919063ffffffff16565b50505b95945050505050565b816000015173ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16877f1d59c1d19baf4b4de03cec9c844258e7ca2f2004975025eb14fe9a5e1d4e0d888560600151600560008c8152602001908152602001600020548a8a89608001518a60a001518c8c60c001518d61010001518e604001518f602001518f6040516121a39c9b9a999897969594939291909b8c5260208c019a909a5260408b019890985260608a0196909652608089019490945260a088019290925267ffffffffffffffff90811660c08801521660e086015263ffffffff1661010085015273ffffffffffffffffffffffffffffffffffffffff9081166101208501521661014083015215156101608201526101800190565b60405180910390a4505050505050565b46826020015114612220576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152600f60248201527f496e76616c696420636861696e496400000000000000000000000000000000006044820152606401610af8565b8160400151518260a001515114612293576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152600c60248201527f696e76616c6964206c65616600000000000000000000000000000000000000006044820152606401610af8565b600060048463ffffffff16815481106122ae576122ae613e28565b906000526020600020906003020190506122cd81600101548484612b8e565b612333576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152600960248201527f4261642050726f6f6600000000000000000000000000000000000000000000006044820152606401610af8565b61234a81600201846060015163ffffffff16612bc9565b156123b1576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152600f60248201527f416c726561647920636c61696d656400000000000000000000000000000000006044820152606401610af8565b6123c881600201846060015163ffffffff16612c0a565b60005b8360400151518163ffffffff16101561247457600084604001518263ffffffff16815181106123fc576123fc613e28565b602002602001015190506000811115612461576124618560a001518363ffffffff168151811061242e5761242e613e28565b602002602001015182876080015173ffffffffffffffffffffffffffffffffffffffff16612b389092919063ffffffff16565b508061246c816140a1565b9150506123cb565b5082511561250d5761248583612c48565b826080015173ffffffffffffffffffffffffffffffffffffffff16836060015163ffffffff1684602001517f828fc203220356df8f072a91681caee7d5c75095e2a95e80ed5a14b384697f7186600001513360405161250492919091825273ffffffffffffffffffffffffffffffffffffffff16602082015260400190565b60405180910390a45b826060015163ffffffff168463ffffffff1684602001517ff8bd640004bcec1b89657020f561d0b070cbdf662d0b158db9dccb0a8301bfab8660000151876040015188608001518960a001513360405161256b959493929190614145565b60405180910390a450505050565b73ffffffffffffffffffffffffffffffffffffffff81166125f6576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601960248201527f4261642062726964676520726f757465722061646472657373000000000000006044820152606401610af8565b600180547fffffffffffffffffffffffff00000000000000000000000000000000000000001673ffffffffffffffffffffffffffffffffffffffff83169081179091556040517fa9e8c42c9e7fca7f62755189a16b2f5314d43d8fb24e91ba54e6d65f9314e84990600090a250565b60408051608060208201819052601160a08301527f4143524f53532d56322d4645452d312e3000000000000000000000000000000060c083015267ffffffffffffffff86169282019290925263ffffffff8416606082015290810185905260009060e00160405160208183030381529060405280519060200120905060006126ec82612cec565b90506126f9878285612d27565b50505050505050565b60006040518061012001604052808d73ffffffffffffffffffffffffffffffffffffffff1681526020018c73ffffffffffffffffffffffffffffffffffffffff1681526020018b73ffffffffffffffffffffffffffffffffffffffff1681526020018a81526020018981526020018881526020018767ffffffffffffffff1681526020018667ffffffffffffffff1681526020018563ffffffff1681525090506127d760048463ffffffff16815481106127be576127be613e28565b9060005260206000209060030201600001548284612dc5565b61283d576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152600d60248201527f496e76616c69642070726f6f66000000000000000000000000000000000000006044820152606401610af8565b600061284882611da1565b9050600061285f8284856060015160006001611dd1565b9050612871828260008087600161207e565b5050505050505050505050505050565b60006128e3826040518060400160405280602081526020017f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c65648152508573ffffffffffffffffffffffffffffffffffffffff16612ddd9092919063ffffffff16565b80519091501561086f578080602001905181019061290191906141a3565b61086f576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602a60248201527f5361666545524332303a204552433230206f7065726174696f6e20646964206e60448201527f6f742073756363656564000000000000000000000000000000000000000000006064820152608401610af8565b60006129a182670de0b6b3a76400006141c0565b67ffffffffffffffff166129bd84670de0b6b3a76400006141e1565b6129c7919061424d565b9392505050565b6000670de0b6b3a76400006129e383826141c0565b6129bd9067ffffffffffffffff16856141e1565b73ffffffffffffffffffffffffffffffffffffffff82163b15612a5557610fb773ffffffffffffffffffffffffffffffffffffffff7f0000000000000000000000000000000000000000000000000000000000000000168383612b38565b6040517f2e1a7d4d000000000000000000000000000000000000000000000000000000008152600481018290527f000000000000000000000000000000000000000000000000000000000000000073ffffffffffffffffffffffffffffffffffffffff1690632e1a7d4d90602401600060405180830381600087803b158015612add57600080fd5b505af1158015612af1573d6000803e3d6000fd5b505060405173ffffffffffffffffffffffffffffffffffffffff8516925083156108fc02915083906000818181858888f1935050505015801561086f573d6000803e3d6000fd5b60405173ffffffffffffffffffffffffffffffffffffffff831660248201526044810182905261086f9084907fa9059cbb0000000000000000000000000000000000000000000000000000000090606401611c17565b6000612bc1828585604051602001612ba69190614261565b60405160208183030381529060405280519060200120612dec565b949350505050565b600080612bd86101008461424d565b90506000612be8610100856142fc565b6000928352602095909552506040902054600190931b92831690921492915050565b6000612c186101008361424d565b90506000612c28610100846142fc565b600092835260209490945250604090208054600190931b90921790915550565b608081015160025482516040517fa9059cbb00000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff9283166004820152602481019190915291169063a9059cbb906044016020604051808303816000875af1158015612cc8573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610fb791906141a3565b6040517f19457468657265756d205369676e6564204d6573736167653a0a3332000000006020820152603c8101829052600090605c01611db4565b612d318282612e02565b73ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161461086f576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601160248201527f696e76616c6964207369676e61747572650000000000000000000000000000006044820152606401610af8565b6000612bc1828585604051602001612ba69190613fa8565b6060612bc18484600085612e26565b600082612df98584612fbc565b14949350505050565b6000806000612e118585613028565b91509150612e1e81613096565b509392505050565b606082471015612eb8576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602660248201527f416464726573733a20696e73756666696369656e742062616c616e636520666f60448201527f722063616c6c00000000000000000000000000000000000000000000000000006064820152608401610af8565b73ffffffffffffffffffffffffffffffffffffffff85163b612f36576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e74726163740000006044820152606401610af8565b6000808673ffffffffffffffffffffffffffffffffffffffff168587604051612f5f9190614310565b60006040518083038185875af1925050503d8060008114612f9c576040519150601f19603f3d011682016040523d82523d6000602084013e612fa1565b606091505b5091509150612fb18282866132ea565b979650505050505050565b600081815b8451811015612e1e576000858281518110612fde57612fde613e28565b602002602001015190508083116130045760008381526020829052604090209250613015565b600081815260208490526040902092505b508061302081613f4d565b915050612fc1565b600080825160410361305e5760208301516040840151606085015160001a6130528782858561333d565b9450945050505061308f565b8251604003613087576020830151604084015161307c868383613455565b93509350505061308f565b506000905060025b9250929050565b60008160048111156130aa576130aa61432c565b036130b25750565b60018160048111156130c6576130c661432c565b0361312d576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601860248201527f45434453413a20696e76616c6964207369676e617475726500000000000000006044820152606401610af8565b60028160048111156131415761314161432c565b036131a8576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601f60248201527f45434453413a20696e76616c6964207369676e6174757265206c656e677468006044820152606401610af8565b60038160048111156131bc576131bc61432c565b03613249576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602260248201527f45434453413a20696e76616c6964207369676e6174757265202773272076616c60448201527f75650000000000000000000000000000000000000000000000000000000000006064820152608401610af8565b600481600481111561325d5761325d61432c565b036106b1576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602260248201527f45434453413a20696e76616c6964207369676e6174757265202776272076616c60448201527f75650000000000000000000000000000000000000000000000000000000000006064820152608401610af8565b606083156132f95750816129c7565b8251156133095782518084602001fd5b816040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610af89190613f3a565b6000807f7fffffffffffffffffffffffffffffff5d576e7357a4501ddfe92f46681b20a0831115613374575060009050600361344c565b8460ff16601b1415801561338c57508460ff16601c14155b1561339d575060009050600461344c565b6040805160008082526020820180845289905260ff881692820192909252606081018690526080810185905260019060a0016020604051602081039080840390855afa1580156133f1573d6000803e3d6000fd5b50506040517fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0015191505073ffffffffffffffffffffffffffffffffffffffff81166134455760006001925092505061344c565b9150600090505b94509492505050565b6000807f7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff83168161348b60ff86901c601b614089565b90506134998782888561333d565b935093505050935093915050565b803573ffffffffffffffffffffffffffffffffffffffff811681146134cb57600080fd5b919050565b6000602082840312156134e257600080fd5b6129c7826134a7565b6000602082840312156134fd57600080fd5b5035919050565b80151581146106b157600080fd5b60008060006060848603121561352757600080fd5b613530846134a7565b925060208401359150604084013561354781613504565b809150509250925092565b803563ffffffff811681146134cb57600080fd5b60006020828403121561357857600080fd5b6129c782613552565b803567ffffffffffffffff811681146134cb57600080fd5b60008060008060008060c087890312156135b257600080fd5b6135bb876134a7565b95506135c9602088016134a7565b945060408701359350606087013592506135e560808801613581565b91506135f360a08801613552565b90509295509295509295565b6000806040838503121561361257600080fd5b50508035926020909101359150565b6000806040838503121561363457600080fd5b61363d836134a7565b946020939093013593505050565b6000806000806000806000806000806101408b8d03121561366b57600080fd5b6136748b6134a7565b995061368260208c016134a7565b985061369060408c016134a7565b975060608b0135965060808b0135955060a08b0135945060c08b013593506136ba60e08c01613581565b92506136c96101008c01613581565b91506136d86101208c01613552565b90509295989b9194979a5092959850565b600080602083850312156136fc57600080fd5b823567ffffffffffffffff8082111561371457600080fd5b818501915085601f83011261372857600080fd5b81358181111561373757600080fd5b8660208260051b850101111561374c57600080fd5b60209290920196919550909350505050565b60005b83811015613779578181015183820152602001613761565b838111156116745750506000910152565b600081518084526137a281602086016020860161375e565b601f017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0169290920160200192915050565b6000602080830181845280855180835260408601915060408160051b870101925083870160005b82811015613847577fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc088860301845261383585835161378a565b945092850192908501906001016137fb565b5092979650505050505050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b60405160c0810167ffffffffffffffff811182821017156138a6576138a6613854565b60405290565b604051601f82017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe016810167ffffffffffffffff811182821017156138f3576138f3613854565b604052919050565b600067ffffffffffffffff82111561391557613915613854565b5060051b60200190565b600082601f83011261393057600080fd5b81356020613945613940836138fb565b6138ac565b82815260059290921b8401810191818101908684111561396457600080fd5b8286015b8481101561397f5780358352918301918301613968565b509695505050505050565b600082601f83011261399b57600080fd5b813560206139ab613940836138fb565b82815260059290921b840181019181810190868411156139ca57600080fd5b8286015b8481101561397f576139df816134a7565b83529183019183016139ce565b600080600060608486031215613a0157600080fd5b613a0a84613552565b9250602084013567ffffffffffffffff80821115613a2757600080fd5b9085019060c08288031215613a3b57600080fd5b613a43613883565b8235815260208301356020820152604083013582811115613a6357600080fd5b613a6f8982860161391f565b604083015250613a8160608401613552565b6060820152613a92608084016134a7565b608082015260a083013582811115613aa957600080fd5b613ab58982860161398a565b60a08301525093506040860135915080821115613ad157600080fd5b50613ade8682870161391f565b9150509250925092565b600067ffffffffffffffff821115613b0257613b02613854565b50601f017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe01660200190565b600082601f830112613b3f57600080fd5b8135613b4d61394082613ae8565b818152846020838601011115613b6257600080fd5b816020850160208301376000918101602001919091529392505050565b60008060008060808587031215613b9557600080fd5b613b9e856134a7565b9350613bac60208601613581565b9250613bba60408601613552565b9150606085013567ffffffffffffffff811115613bd657600080fd5b613be287828801613b2e565b91505092959194509250565b6000806000806000806000806000806101408b8d031215613c0e57600080fd5b613c178b6134a7565b9950613c2560208c016134a7565b9850613c3360408c016134a7565b975060608b0135965060808b01359550613c4f60a08c01613581565b9450613c5d60c08c01613581565b9350613c6b60e08c01613552565b9250613c7a6101008c01613552565b91506101208b013567ffffffffffffffff811115613c9757600080fd5b613ca38d828e0161391f565b9150509295989b9194979a5092959850565b6000806000806000806000806000806000806101808d8f031215613cd857600080fd5b613ce18d6134a7565b9b50613cef60208e016134a7565b9a50613cfd60408e016134a7565b995060608d0135985060808d0135975060a08d0135965060c08d01359550613d2760e08e01613581565b9450613d366101008e01613581565b9350613d456101208e01613581565b9250613d546101408e01613552565b915067ffffffffffffffff6101608e01351115613d7057600080fd5b613d818e6101608f01358f01613b2e565b90509295989b509295989b509295989b565b600060208284031215613da557600080fd5b5051919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b600063ffffffff83811690831681811015613df857613df8613dac565b039392505050565b600063ffffffff808316818516808303821115613e1f57613e1f613dac565b01949350505050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b60008083357fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe1843603018112613e8c57600080fd5b83018035915067ffffffffffffffff821115613ea757600080fd5b60200191503681900382131561308f57600080fd5b8183823760009101908152919050565b600060208284031215613ede57600080fd5b815167ffffffffffffffff811115613ef557600080fd5b8201601f81018413613f0657600080fd5b8051613f1461394082613ae8565b818152856020838501011115613f2957600080fd5b61207582602083016020860161375e565b6020815260006129c7602083018461378a565b60007fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff8203613f7e57613f7e613dac565b5060010190565b67ffffffffffffffff83168152604060208201526000612bc1604083018461378a565b815173ffffffffffffffffffffffffffffffffffffffff90811682526020808401518216908301526040808401519182169083015261012082019050606083015160608301526080830151608083015260a083015160a083015260c083015161401d60c084018267ffffffffffffffff169052565b5060e083015161403960e084018267ffffffffffffffff169052565b506101009283015163ffffffff16919092015290565b600067ffffffffffffffff808316818516808303821115613e1f57613e1f613dac565b60008282101561408457614084613dac565b500390565b6000821982111561409c5761409c613dac565b500190565b600063ffffffff8083168181036140ba576140ba613dac565b6001019392505050565b600081518084526020808501945080840160005b838110156140f4578151875295820195908201906001016140d8565b509495945050505050565b600081518084526020808501945080840160005b838110156140f457815173ffffffffffffffffffffffffffffffffffffffff1687529582019590820190600101614113565b85815260a06020820152600061415e60a08301876140c4565b73ffffffffffffffffffffffffffffffffffffffff8087166040850152838203606085015261418d82876140ff565b9250808516608085015250509695505050505050565b6000602082840312156141b557600080fd5b81516129c781613504565b600067ffffffffffffffff83811690831681811015613df857613df8613dac565b6000817fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff048311821515161561421957614219613dac565b500290565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601260045260246000fd5b60008261425c5761425c61421e565b500490565b6020815281516020820152602082015160408201526000604083015160c0606084015261429160e08401826140c4565b905063ffffffff606085015116608084015273ffffffffffffffffffffffffffffffffffffffff60808501511660a084015260a08401517fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe08483030160c085015261207582826140ff565b60008261430b5761430b61421e565b500690565b6000825161432281846020870161375e565b9190910192915050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052602160045260246000fdfea2646970667358221220a7f1307b7dde32a245b37e5a351651f10990f2f8b407aded39d08202e81402e464736f6c634300080d0033", + "deployedBytecode": "0x6080604052600436106101bb5760003560e01c80638a7860ce116100ec578063e19044021161008a578063f06850f611610064578063f06850f61461059a578063f2fde38b146105c7578063f500697c146105e7578063ffc351a31461060757600080fd5b8063e190440214610518578063e282d5b914610545578063ee2a53f81461056557600080fd5b8063a1244c67116100c6578063a1244c671461047f578063ac9650d8146104b8578063c894c0ca146104d8578063de7eba78146104f857600080fd5b80638a7860ce146104215780638da5cb5b146104415780639a8a05921461046c57600080fd5b806349228978116101595780635285e058116101335780635285e0581461037557806357f6dcb8146103a2578063715018a6146103ec57806389a153cc1461040157600080fd5b806349228978146102f7578063493a4f841461030a5780635249fef11461032a57600080fd5b8063272751c711610195578063272751c7146102605780632752042e1461028057806329cb924d146102a05780633fc8cef3146102c357600080fd5b80631c39c38d146101c75780631dfb2d021461021e57806322f8e5661461024057600080fd5b366101c257005b600080fd5b3480156101d357600080fd5b506000546101f49073ffffffffffffffffffffffffffffffffffffffff1681565b60405173ffffffffffffffffffffffffffffffffffffffff90911681526020015b60405180910390f35b34801561022a57600080fd5b5061023e6102393660046134d0565b610627565b005b34801561024c57600080fd5b5061023e61025b3660046134eb565b6106b4565b34801561026c57600080fd5b5061023e61027b366004613512565b61075d565b34801561028c57600080fd5b5061023e61029b366004613566565b610874565b3480156102ac57600080fd5b506102b5610975565b604051908152602001610215565b3480156102cf57600080fd5b506101f47f000000000000000000000000000000000000000000000000000000000000000081565b61023e610305366004613599565b610a2d565b34801561031657600080fd5b5061023e6103253660046135ff565b610e94565b34801561033657600080fd5b50610365610345366004613621565b600360209081526000928352604080842090915290825290205460ff1681565b6040519015158152602001610215565b34801561038157600080fd5b506001546101f49073ffffffffffffffffffffffffffffffffffffffff1681565b3480156103ae57600080fd5b506002546103d79074010000000000000000000000000000000000000000900463ffffffff1681565b60405163ffffffff9091168152602001610215565b3480156103f857600080fd5b5061023e610fbb565b34801561040d57600080fd5b5061023e61041c36600461364b565b611048565b34801561042d57600080fd5b5061023e61043c3660046134eb565b6111a4565b34801561044d57600080fd5b5060065473ffffffffffffffffffffffffffffffffffffffff166101f4565b34801561047857600080fd5b50466102b5565b34801561048b57600080fd5b506002546103d7907801000000000000000000000000000000000000000000000000900463ffffffff1681565b6104cb6104c63660046136e9565b611278565b60405161021591906137d4565b3480156104e457600080fd5b5061023e6104f33660046139ec565b611452565b34801561050457600080fd5b5061023e6105133660046134d0565b6114d6565b34801561052457600080fd5b506002546101f49073ffffffffffffffffffffffffffffffffffffffff1681565b34801561055157600080fd5b5061023e610560366004613b7f565b61151c565b34801561057157600080fd5b506105856105803660046134eb565b61167a565b60408051928352602083019190915201610215565b3480156105a657600080fd5b506102b56105b53660046134eb565b60056020526000908152604090205481565b3480156105d357600080fd5b5061023e6105e23660046134d0565b6116a8565b3480156105f357600080fd5b5061023e610602366004613bee565b6117d5565b34801561061357600080fd5b5061023e610622366004613cb5565b611861565b61062f6119cc565b610637611a4d565b610664600080547fffffffffffffffffffffff00ffffffffffffffffffffffffffffffffffffffff169055565b61066d81611ad1565b6106b1600080547fffffffffffffffffffffff00ffffffffffffffffffffffffffffffffffffffff1674010000000000000000000000000000000000000000179055565b50565b60005473ffffffffffffffffffffffffffffffffffffffff166106d657600080fd5b6000546040517f22f8e5660000000000000000000000000000000000000000000000000000000081526004810183905273ffffffffffffffffffffffffffffffffffffffff909116906322f8e56690602401600060405180830381600087803b15801561074257600080fd5b505af1158015610756573d6000803e3d6000fd5b5050505050565b6107656119cc565b61076d611a4d565b61079a600080547fffffffffffffffffffffff00ffffffffffffffffffffffffffffffffffffffff169055565b73ffffffffffffffffffffffffffffffffffffffff8316600081815260036020908152604080832086845282529182902080547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff001685151590811790915591519182528492917f0a21fdd43d0ad0c62689ee7230a47309a050755bcc52eba00310add65297692a910160405180910390a361086f600080547fffffffffffffffffffffff00ffffffffffffffffffffffffffffffffffffffff1674010000000000000000000000000000000000000000179055565b505050565b61087c6119cc565b610884611a4d565b6108b1600080547fffffffffffffffffffffff00ffffffffffffffffffffffffffffffffffffffff169055565b600280547fffffffffffffffff00000000ffffffffffffffffffffffffffffffffffffffff167401000000000000000000000000000000000000000063ffffffff8416908102919091179091556040519081527f0e55dd180fa793d9036c804d0a116e6a7617a48e72cee1f83d92793a793fcc039060200160405180910390a16106b1600080547fffffffffffffffffffffff00ffffffffffffffffffffffffffffffffffffffff1674010000000000000000000000000000000000000000179055565b6000805473ffffffffffffffffffffffffffffffffffffffff1615610a285760008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166329cb924d6040518163ffffffff1660e01b8152600401602060405180830381865afa1580156109ff573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610a239190613d93565b905090565b504290565b610a35611a4d565b610a62600080547fffffffffffffffffffffff00ffffffffffffffffffffffffffffffffffffffff169055565b73ffffffffffffffffffffffffffffffffffffffff8516600090815260036020908152604080832086845290915290205460ff16610b01576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152600e60248201527f44697361626c656420726f75746500000000000000000000000000000000000060448201526064015b60405180910390fd5b6706f05b59d3b200008267ffffffffffffffff1610610b7c576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601360248201527f696e76616c69642072656c6179657220666565000000000000000000000000006044820152606401610af8565b600254610ba79074010000000000000000000000000000000000000000900463ffffffff1682613ddb565b63ffffffff16610bb5610975565b10158015610bfa5750600254610be99074010000000000000000000000000000000000000000900463ffffffff1682613e00565b63ffffffff16610bf7610975565b11155b610c60576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601260248201527f696e76616c69642071756f74652074696d6500000000000000000000000000006044820152606401610af8565b7f000000000000000000000000000000000000000000000000000000000000000073ffffffffffffffffffffffffffffffffffffffff168573ffffffffffffffffffffffffffffffffffffffff16148015610cbb5750600034115b15610daf57833414610d29576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601b60248201527f6d73672e76616c7565206d757374206d6174636820616d6f756e7400000000006044820152606401610af8565b7f000000000000000000000000000000000000000000000000000000000000000073ffffffffffffffffffffffffffffffffffffffff1663d0e30db0346040518263ffffffff1660e01b81526004016000604051808303818588803b158015610d9157600080fd5b505af1158015610da5573d6000803e3d6000fd5b5050505050610dd1565b610dd173ffffffffffffffffffffffffffffffffffffffff8616333087611bbd565b610e088446600254869086907801000000000000000000000000000000000000000000000000900463ffffffff16868b8d33611c99565b6001600260188282829054906101000a900463ffffffff16610e2a9190613e00565b92506101000a81548163ffffffff021916908363ffffffff160217905550610e8c600080547fffffffffffffffffffffff00ffffffffffffffffffffffffffffffffffffffff1674010000000000000000000000000000000000000000179055565b505050505050565b610e9c6119cc565b610ea4611a4d565b610ed1600080547fffffffffffffffffffffff00ffffffffffffffffffffffffffffffffffffffff169055565b60048054600181018255600091909152600381027f8a35acfbc15ff81a39ae7d344fd709f28e8600b4aa8c65c6b64bfe7fe36bd19c81018490557f8a35acfbc15ff81a39ae7d344fd709f28e8600b4aa8c65c6b64bfe7fe36bd19b01828155604080518581526020810185905263ffffffff8416917fc86ba04c55bc5eb2f2876b91c438849a296dbec7b08751c3074d92e04f0a77af910160405180910390a25050610fb7600080547fffffffffffffffffffffff00ffffffffffffffffffffffffffffffffffffffff1674010000000000000000000000000000000000000000179055565b5050565b60065473ffffffffffffffffffffffffffffffffffffffff16331461103c576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e65726044820152606401610af8565b6110466000611d2a565b565b611050611a4d565b61107d600080547fffffffffffffffffffffff00ffffffffffffffffffffffffffffffffffffffff169055565b60006040518061012001604052808c73ffffffffffffffffffffffffffffffffffffffff1681526020018b73ffffffffffffffffffffffffffffffffffffffff1681526020018a73ffffffffffffffffffffffffffffffffffffffff1681526020018981526020018681526020016110f24690565b81526020018567ffffffffffffffff1681526020018467ffffffffffffffff1681526020018363ffffffff168152509050600061112e82611da1565b9050600061114082848b886000611dd1565b905061115182828a8887600061207e565b505050611198600080547fffffffffffffffffffffff00ffffffffffffffffffffffffffffffffffffffff1674010000000000000000000000000000000000000000179055565b50505050505050505050565b6111ac6119cc565b6111b4611a4d565b6111e1600080547fffffffffffffffffffffff00ffffffffffffffffffffffffffffffffffffffff169055565b600481815481106111f4576111f4613e28565b60009182526020822060039091020181815560010181905560405182917f3569b846531b754c99cb80df3f49cd72fa6fe106aaee5ab8e0caf35a9d7ce88d91a26106b1600080547fffffffffffffffffffffff00ffffffffffffffffffffffffffffffffffffffff1674010000000000000000000000000000000000000000179055565b606034156112e2576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601b60248201527f4f6e6c79206d756c746963616c6c207769746820302076616c756500000000006044820152606401610af8565b8167ffffffffffffffff8111156112fb576112fb613854565b60405190808252806020026020018201604052801561132e57816020015b60608152602001906001900390816113195790505b50905060005b8281101561144b576000803086868581811061135257611352613e28565b90506020028101906113649190613e57565b604051611372929190613ebc565b600060405180830381855af49150503d80600081146113ad576040519150601f19603f3d011682016040523d82523d6000602084013e6113b2565b606091505b509150915081611418576044815110156113cb57600080fd5b600481019050808060200190518101906113e59190613ecc565b6040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610af89190613f3a565b8084848151811061142b5761142b613e28565b60200260200101819052505050808061144390613f4d565b915050611334565b5092915050565b61145a611a4d565b611487600080547fffffffffffffffffffffff00ffffffffffffffffffffffffffffffffffffffff169055565b6114928383836121b3565b61086f600080547fffffffffffffffffffffff00ffffffffffffffffffffffffffffffffffffffff1674010000000000000000000000000000000000000000179055565b6114de6119cc565b6114e6611a4d565b611513600080547fffffffffffffffffffffff00ffffffffffffffffffffffffffffffffffffffff169055565b61066d81612579565b611524611a4d565b611551600080547fffffffffffffffffffffff00ffffffffffffffffffffffffffffffffffffffff169055565b6706f05b59d3b200008367ffffffffffffffff16106115cc576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601360248201527f696e76616c69642072656c6179657220666565000000000000000000000000006044820152606401610af8565b6115d98446858585612665565b8373ffffffffffffffffffffffffffffffffffffffff168263ffffffff167fb9de16bf376724405019a10ef4fedac57fecd292bf86c08d81d7c42d394d5d378584604051611628929190613f85565b60405180910390a3611674600080547fffffffffffffffffffffff00ffffffffffffffffffffffffffffffffffffffff1674010000000000000000000000000000000000000000179055565b50505050565b6004818154811061168a57600080fd5b60009182526020909120600390910201805460019091015490915082565b60065473ffffffffffffffffffffffffffffffffffffffff163314611729576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e65726044820152606401610af8565b73ffffffffffffffffffffffffffffffffffffffff81166117cc576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201527f64647265737300000000000000000000000000000000000000000000000000006064820152608401610af8565b6106b181611d2a565b6117dd611a4d565b61180a600080547fffffffffffffffffffffff00ffffffffffffffffffffffffffffffffffffffff169055565b61181d8a8a8a8a8a468b8b8b8b8b612702565b611198600080547fffffffffffffffffffffff00ffffffffffffffffffffffffffffffffffffffff1674010000000000000000000000000000000000000000179055565b611869611a4d565b611896600080547fffffffffffffffffffffff00ffffffffffffffffffffffffffffffffffffffff169055565b6118a38c87858585612665565b60006040518061012001604052808e73ffffffffffffffffffffffffffffffffffffffff1681526020018d73ffffffffffffffffffffffffffffffffffffffff1681526020018c73ffffffffffffffffffffffffffffffffffffffff1681526020018b81526020018881526020016119184690565b81526020018767ffffffffffffffff1681526020018667ffffffffffffffff1681526020018463ffffffff168152509050600061195482611da1565b9050600061196682848d896000611dd1565b905061197782828c8987600061207e565b5050506119be600080547fffffffffffffffffffffff00ffffffffffffffffffffffffffffffffffffffff1674010000000000000000000000000000000000000000179055565b505050505050505050505050565b60065473ffffffffffffffffffffffffffffffffffffffff163314611046576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e65726044820152606401610af8565b60005474010000000000000000000000000000000000000000900460ff16611046576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601f60248201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c006044820152606401610af8565b73ffffffffffffffffffffffffffffffffffffffff8116611b4e576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601460248201527f4261642068756220706f6f6c20616464726573730000000000000000000000006044820152606401610af8565b600280547fffffffffffffffffffffffff00000000000000000000000000000000000000001673ffffffffffffffffffffffffffffffffffffffff83169081179091556040517f1f17a88f67b0f49060a34bec1a4723a563620e6aa265eb640b5046dcee0759a090600090a250565b60405173ffffffffffffffffffffffffffffffffffffffff808516602483015283166044820152606481018290526116749085907f23b872dd00000000000000000000000000000000000000000000000000000000906084015b604080517fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe08184030181529190526020810180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff167fffffffff0000000000000000000000000000000000000000000000000000000090931692909217909152612881565b604080518a8152602081018a905290810188905267ffffffffffffffff8716606082015263ffffffff858116608083015273ffffffffffffffffffffffffffffffffffffffff84811660a084015280841692908616918816907f4a4fc49abd237bfd7f4ac82d6c7a284c69daaea5154430cff04ad7482c6c42549060c00160405180910390a4505050505050505050565b6006805473ffffffffffffffffffffffffffffffffffffffff8381167fffffffffffffffffffffffff0000000000000000000000000000000000000000831681179093556040519116919082907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e090600090a35050565b600081604051602001611db49190613fa8565b604051602081830303815290604052805190602001209050919050565b60006706f05b59d3b200008367ffffffffffffffff16108015611e0957506706f05b59d3b200008560c0015167ffffffffffffffff16105b611e6f576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152600c60248201527f696e76616c6964206665657300000000000000000000000000000000000000006044820152606401610af8565b606085015160008781526005602052604090205410611eea576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152600c60248201527f72656c61792066696c6c656400000000000000000000000000000000000000006044820152606401610af8565b83600003611efa57506000612075565b611f1384848760c00151611f0e919061404f565b61298d565b60008781526005602052604081205460608801519293508692611f369190614072565b905082811015611f5f57809250611f5c83868960c00151611f57919061404f565b6129ce565b91505b60008881526005602052604081208054859290611f7d908490614089565b9091555050604087015173ffffffffffffffffffffffffffffffffffffffff7f000000000000000000000000000000000000000000000000000000000000000081169116036120055783611ff2576040870151611ff29073ffffffffffffffffffffffffffffffffffffffff16333085611bbd565b6120008760200151836129f7565b612072565b8361203f57612000338860200151848a6040015173ffffffffffffffffffffffffffffffffffffffff16611bbd909392919063ffffffff16565b612072876020015183896040015173ffffffffffffffffffffffffffffffffffffffff16612b389092919063ffffffff16565b50505b95945050505050565b816000015173ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16877f1d59c1d19baf4b4de03cec9c844258e7ca2f2004975025eb14fe9a5e1d4e0d888560600151600560008c8152602001908152602001600020548a8a89608001518a60a001518c8c60c001518d61010001518e604001518f602001518f6040516121a39c9b9a999897969594939291909b8c5260208c019a909a5260408b019890985260608a0196909652608089019490945260a088019290925267ffffffffffffffff90811660c08801521660e086015263ffffffff1661010085015273ffffffffffffffffffffffffffffffffffffffff9081166101208501521661014083015215156101608201526101800190565b60405180910390a4505050505050565b46826020015114612220576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152600f60248201527f496e76616c696420636861696e496400000000000000000000000000000000006044820152606401610af8565b8160400151518260a001515114612293576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152600c60248201527f696e76616c6964206c65616600000000000000000000000000000000000000006044820152606401610af8565b600060048463ffffffff16815481106122ae576122ae613e28565b906000526020600020906003020190506122cd81600101548484612b8e565b612333576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152600960248201527f4261642050726f6f6600000000000000000000000000000000000000000000006044820152606401610af8565b61234a81600201846060015163ffffffff16612bc9565b156123b1576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152600f60248201527f416c726561647920636c61696d656400000000000000000000000000000000006044820152606401610af8565b6123c881600201846060015163ffffffff16612c0a565b60005b8360400151518163ffffffff16101561247457600084604001518263ffffffff16815181106123fc576123fc613e28565b602002602001015190506000811115612461576124618560a001518363ffffffff168151811061242e5761242e613e28565b602002602001015182876080015173ffffffffffffffffffffffffffffffffffffffff16612b389092919063ffffffff16565b508061246c816140a1565b9150506123cb565b5082511561250d5761248583612c48565b826080015173ffffffffffffffffffffffffffffffffffffffff16836060015163ffffffff1684602001517f828fc203220356df8f072a91681caee7d5c75095e2a95e80ed5a14b384697f7186600001513360405161250492919091825273ffffffffffffffffffffffffffffffffffffffff16602082015260400190565b60405180910390a45b826060015163ffffffff168463ffffffff1684602001517ff8bd640004bcec1b89657020f561d0b070cbdf662d0b158db9dccb0a8301bfab8660000151876040015188608001518960a001513360405161256b959493929190614145565b60405180910390a450505050565b73ffffffffffffffffffffffffffffffffffffffff81166125f6576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601960248201527f4261642062726964676520726f757465722061646472657373000000000000006044820152606401610af8565b600180547fffffffffffffffffffffffff00000000000000000000000000000000000000001673ffffffffffffffffffffffffffffffffffffffff83169081179091556040517fa9e8c42c9e7fca7f62755189a16b2f5314d43d8fb24e91ba54e6d65f9314e84990600090a250565b60408051608060208201819052601160a08301527f4143524f53532d56322d4645452d312e3000000000000000000000000000000060c083015267ffffffffffffffff86169282019290925263ffffffff8416606082015290810185905260009060e00160405160208183030381529060405280519060200120905060006126ec82612cec565b90506126f9878285612d27565b50505050505050565b60006040518061012001604052808d73ffffffffffffffffffffffffffffffffffffffff1681526020018c73ffffffffffffffffffffffffffffffffffffffff1681526020018b73ffffffffffffffffffffffffffffffffffffffff1681526020018a81526020018981526020018881526020018767ffffffffffffffff1681526020018667ffffffffffffffff1681526020018563ffffffff1681525090506127d760048463ffffffff16815481106127be576127be613e28565b9060005260206000209060030201600001548284612dc5565b61283d576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152600d60248201527f496e76616c69642070726f6f66000000000000000000000000000000000000006044820152606401610af8565b600061284882611da1565b9050600061285f8284856060015160006001611dd1565b9050612871828260008087600161207e565b5050505050505050505050505050565b60006128e3826040518060400160405280602081526020017f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c65648152508573ffffffffffffffffffffffffffffffffffffffff16612ddd9092919063ffffffff16565b80519091501561086f578080602001905181019061290191906141a3565b61086f576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602a60248201527f5361666545524332303a204552433230206f7065726174696f6e20646964206e60448201527f6f742073756363656564000000000000000000000000000000000000000000006064820152608401610af8565b60006129a182670de0b6b3a76400006141c0565b67ffffffffffffffff166129bd84670de0b6b3a76400006141e1565b6129c7919061424d565b9392505050565b6000670de0b6b3a76400006129e383826141c0565b6129bd9067ffffffffffffffff16856141e1565b73ffffffffffffffffffffffffffffffffffffffff82163b15612a5557610fb773ffffffffffffffffffffffffffffffffffffffff7f0000000000000000000000000000000000000000000000000000000000000000168383612b38565b6040517f2e1a7d4d000000000000000000000000000000000000000000000000000000008152600481018290527f000000000000000000000000000000000000000000000000000000000000000073ffffffffffffffffffffffffffffffffffffffff1690632e1a7d4d90602401600060405180830381600087803b158015612add57600080fd5b505af1158015612af1573d6000803e3d6000fd5b505060405173ffffffffffffffffffffffffffffffffffffffff8516925083156108fc02915083906000818181858888f1935050505015801561086f573d6000803e3d6000fd5b60405173ffffffffffffffffffffffffffffffffffffffff831660248201526044810182905261086f9084907fa9059cbb0000000000000000000000000000000000000000000000000000000090606401611c17565b6000612bc1828585604051602001612ba69190614261565b60405160208183030381529060405280519060200120612dec565b949350505050565b600080612bd86101008461424d565b90506000612be8610100856142fc565b6000928352602095909552506040902054600190931b92831690921492915050565b6000612c186101008361424d565b90506000612c28610100846142fc565b600092835260209490945250604090208054600190931b90921790915550565b608081015160025482516040517fa9059cbb00000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff9283166004820152602481019190915291169063a9059cbb906044016020604051808303816000875af1158015612cc8573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610fb791906141a3565b6040517f19457468657265756d205369676e6564204d6573736167653a0a3332000000006020820152603c8101829052600090605c01611db4565b612d318282612e02565b73ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161461086f576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601160248201527f696e76616c6964207369676e61747572650000000000000000000000000000006044820152606401610af8565b6000612bc1828585604051602001612ba69190613fa8565b6060612bc18484600085612e26565b600082612df98584612fbc565b14949350505050565b6000806000612e118585613028565b91509150612e1e81613096565b509392505050565b606082471015612eb8576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602660248201527f416464726573733a20696e73756666696369656e742062616c616e636520666f60448201527f722063616c6c00000000000000000000000000000000000000000000000000006064820152608401610af8565b73ffffffffffffffffffffffffffffffffffffffff85163b612f36576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e74726163740000006044820152606401610af8565b6000808673ffffffffffffffffffffffffffffffffffffffff168587604051612f5f9190614310565b60006040518083038185875af1925050503d8060008114612f9c576040519150601f19603f3d011682016040523d82523d6000602084013e612fa1565b606091505b5091509150612fb18282866132ea565b979650505050505050565b600081815b8451811015612e1e576000858281518110612fde57612fde613e28565b602002602001015190508083116130045760008381526020829052604090209250613015565b600081815260208490526040902092505b508061302081613f4d565b915050612fc1565b600080825160410361305e5760208301516040840151606085015160001a6130528782858561333d565b9450945050505061308f565b8251604003613087576020830151604084015161307c868383613455565b93509350505061308f565b506000905060025b9250929050565b60008160048111156130aa576130aa61432c565b036130b25750565b60018160048111156130c6576130c661432c565b0361312d576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601860248201527f45434453413a20696e76616c6964207369676e617475726500000000000000006044820152606401610af8565b60028160048111156131415761314161432c565b036131a8576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601f60248201527f45434453413a20696e76616c6964207369676e6174757265206c656e677468006044820152606401610af8565b60038160048111156131bc576131bc61432c565b03613249576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602260248201527f45434453413a20696e76616c6964207369676e6174757265202773272076616c60448201527f75650000000000000000000000000000000000000000000000000000000000006064820152608401610af8565b600481600481111561325d5761325d61432c565b036106b1576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602260248201527f45434453413a20696e76616c6964207369676e6174757265202776272076616c60448201527f75650000000000000000000000000000000000000000000000000000000000006064820152608401610af8565b606083156132f95750816129c7565b8251156133095782518084602001fd5b816040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610af89190613f3a565b6000807f7fffffffffffffffffffffffffffffff5d576e7357a4501ddfe92f46681b20a0831115613374575060009050600361344c565b8460ff16601b1415801561338c57508460ff16601c14155b1561339d575060009050600461344c565b6040805160008082526020820180845289905260ff881692820192909252606081018690526080810185905260019060a0016020604051602081039080840390855afa1580156133f1573d6000803e3d6000fd5b50506040517fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0015191505073ffffffffffffffffffffffffffffffffffffffff81166134455760006001925092505061344c565b9150600090505b94509492505050565b6000807f7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff83168161348b60ff86901c601b614089565b90506134998782888561333d565b935093505050935093915050565b803573ffffffffffffffffffffffffffffffffffffffff811681146134cb57600080fd5b919050565b6000602082840312156134e257600080fd5b6129c7826134a7565b6000602082840312156134fd57600080fd5b5035919050565b80151581146106b157600080fd5b60008060006060848603121561352757600080fd5b613530846134a7565b925060208401359150604084013561354781613504565b809150509250925092565b803563ffffffff811681146134cb57600080fd5b60006020828403121561357857600080fd5b6129c782613552565b803567ffffffffffffffff811681146134cb57600080fd5b60008060008060008060c087890312156135b257600080fd5b6135bb876134a7565b95506135c9602088016134a7565b945060408701359350606087013592506135e560808801613581565b91506135f360a08801613552565b90509295509295509295565b6000806040838503121561361257600080fd5b50508035926020909101359150565b6000806040838503121561363457600080fd5b61363d836134a7565b946020939093013593505050565b6000806000806000806000806000806101408b8d03121561366b57600080fd5b6136748b6134a7565b995061368260208c016134a7565b985061369060408c016134a7565b975060608b0135965060808b0135955060a08b0135945060c08b013593506136ba60e08c01613581565b92506136c96101008c01613581565b91506136d86101208c01613552565b90509295989b9194979a5092959850565b600080602083850312156136fc57600080fd5b823567ffffffffffffffff8082111561371457600080fd5b818501915085601f83011261372857600080fd5b81358181111561373757600080fd5b8660208260051b850101111561374c57600080fd5b60209290920196919550909350505050565b60005b83811015613779578181015183820152602001613761565b838111156116745750506000910152565b600081518084526137a281602086016020860161375e565b601f017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0169290920160200192915050565b6000602080830181845280855180835260408601915060408160051b870101925083870160005b82811015613847577fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc088860301845261383585835161378a565b945092850192908501906001016137fb565b5092979650505050505050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b60405160c0810167ffffffffffffffff811182821017156138a6576138a6613854565b60405290565b604051601f82017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe016810167ffffffffffffffff811182821017156138f3576138f3613854565b604052919050565b600067ffffffffffffffff82111561391557613915613854565b5060051b60200190565b600082601f83011261393057600080fd5b81356020613945613940836138fb565b6138ac565b82815260059290921b8401810191818101908684111561396457600080fd5b8286015b8481101561397f5780358352918301918301613968565b509695505050505050565b600082601f83011261399b57600080fd5b813560206139ab613940836138fb565b82815260059290921b840181019181810190868411156139ca57600080fd5b8286015b8481101561397f576139df816134a7565b83529183019183016139ce565b600080600060608486031215613a0157600080fd5b613a0a84613552565b9250602084013567ffffffffffffffff80821115613a2757600080fd5b9085019060c08288031215613a3b57600080fd5b613a43613883565b8235815260208301356020820152604083013582811115613a6357600080fd5b613a6f8982860161391f565b604083015250613a8160608401613552565b6060820152613a92608084016134a7565b608082015260a083013582811115613aa957600080fd5b613ab58982860161398a565b60a08301525093506040860135915080821115613ad157600080fd5b50613ade8682870161391f565b9150509250925092565b600067ffffffffffffffff821115613b0257613b02613854565b50601f017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe01660200190565b600082601f830112613b3f57600080fd5b8135613b4d61394082613ae8565b818152846020838601011115613b6257600080fd5b816020850160208301376000918101602001919091529392505050565b60008060008060808587031215613b9557600080fd5b613b9e856134a7565b9350613bac60208601613581565b9250613bba60408601613552565b9150606085013567ffffffffffffffff811115613bd657600080fd5b613be287828801613b2e565b91505092959194509250565b6000806000806000806000806000806101408b8d031215613c0e57600080fd5b613c178b6134a7565b9950613c2560208c016134a7565b9850613c3360408c016134a7565b975060608b0135965060808b01359550613c4f60a08c01613581565b9450613c5d60c08c01613581565b9350613c6b60e08c01613552565b9250613c7a6101008c01613552565b91506101208b013567ffffffffffffffff811115613c9757600080fd5b613ca38d828e0161391f565b9150509295989b9194979a5092959850565b6000806000806000806000806000806000806101808d8f031215613cd857600080fd5b613ce18d6134a7565b9b50613cef60208e016134a7565b9a50613cfd60408e016134a7565b995060608d0135985060808d0135975060a08d0135965060c08d01359550613d2760e08e01613581565b9450613d366101008e01613581565b9350613d456101208e01613581565b9250613d546101408e01613552565b915067ffffffffffffffff6101608e01351115613d7057600080fd5b613d818e6101608f01358f01613b2e565b90509295989b509295989b509295989b565b600060208284031215613da557600080fd5b5051919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b600063ffffffff83811690831681811015613df857613df8613dac565b039392505050565b600063ffffffff808316818516808303821115613e1f57613e1f613dac565b01949350505050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b60008083357fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe1843603018112613e8c57600080fd5b83018035915067ffffffffffffffff821115613ea757600080fd5b60200191503681900382131561308f57600080fd5b8183823760009101908152919050565b600060208284031215613ede57600080fd5b815167ffffffffffffffff811115613ef557600080fd5b8201601f81018413613f0657600080fd5b8051613f1461394082613ae8565b818152856020838501011115613f2957600080fd5b61207582602083016020860161375e565b6020815260006129c7602083018461378a565b60007fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff8203613f7e57613f7e613dac565b5060010190565b67ffffffffffffffff83168152604060208201526000612bc1604083018461378a565b815173ffffffffffffffffffffffffffffffffffffffff90811682526020808401518216908301526040808401519182169083015261012082019050606083015160608301526080830151608083015260a083015160a083015260c083015161401d60c084018267ffffffffffffffff169052565b5060e083015161403960e084018267ffffffffffffffff169052565b506101009283015163ffffffff16919092015290565b600067ffffffffffffffff808316818516808303821115613e1f57613e1f613dac565b60008282101561408457614084613dac565b500390565b6000821982111561409c5761409c613dac565b500190565b600063ffffffff8083168181036140ba576140ba613dac565b6001019392505050565b600081518084526020808501945080840160005b838110156140f4578151875295820195908201906001016140d8565b509495945050505050565b600081518084526020808501945080840160005b838110156140f457815173ffffffffffffffffffffffffffffffffffffffff1687529582019590820190600101614113565b85815260a06020820152600061415e60a08301876140c4565b73ffffffffffffffffffffffffffffffffffffffff8087166040850152838203606085015261418d82876140ff565b9250808516608085015250509695505050505050565b6000602082840312156141b557600080fd5b81516129c781613504565b600067ffffffffffffffff83811690831681811015613df857613df8613dac565b6000817fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff048311821515161561421957614219613dac565b500290565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601260045260246000fd5b60008261425c5761425c61421e565b500490565b6020815281516020820152602082015160408201526000604083015160c0606084015261429160e08401826140c4565b905063ffffffff606085015116608084015273ffffffffffffffffffffffffffffffffffffffff60808501511660a084015260a08401517fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe08483030160c085015261207582826140ff565b60008261430b5761430b61421e565b500690565b6000825161432281846020870161375e565b9190910192915050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052602160045260246000fdfea2646970667358221220a7f1307b7dde32a245b37e5a351651f10990f2f8b407aded39d08202e81402e464736f6c634300080d0033", "devdoc": { "kind": "dev", "methods": { @@ -1128,14 +1153,20 @@ "relayerFeePct": "% of deposit amount taken out to incentivize a fast relayer." } }, + "emergencyDeleteRootBundle(uint256)": { + "params": { + "rootBundleId": "Index of the root bundle that needs to be deleted. Note: this is intentionally a uint256 to ensure that a small input range doesn't limit which indices this method is able to reach." + } + }, "executeRelayerRefundRoot(uint32,(uint256,uint256,uint256[],uint32,address,address[]),bytes32[])": { "params": { "proof": "Inclusion proof for this leaf in relayer refund root in root bundle.", - "relayerRefundLeaf": "Contains all data neccessary to reconstruct leaf contained in root bundle and to refund relayer. This data structure is explained in detail in the SpokePoolInterface.", + "relayerRefundLeaf": "Contains all data necessary to reconstruct leaf contained in root bundle and to refund relayer. This data structure is explained in detail in the SpokePoolInterface.", "rootBundleId": "Unique ID of root bundle containing relayer refund root that this leaf is contained in." } }, "executeSlowRelayRoot(address,address,address,uint256,uint256,uint64,uint64,uint32,uint32,bytes32[])": { + "details": "This function assumes that the relay's destination chain ID is the current chain ID, which prevents the caller from executing a slow relay intended for another chain on this chain.", "params": { "amount": "Full size of the deposit.", "depositId": "Unique deposit ID on origin spoke pool.", @@ -1250,6 +1281,9 @@ "deposit(address,address,uint256,uint256,uint64,uint32)": { "notice": "Called by user to bridge funds from origin to destination chain. Depositor will effectively lock tokens in this contract and receive a destination token on the destination chain. The origin => destination token mapping is stored on the L1 HubPool.The caller must first approve this contract to spend amount of originToken.The originToken => destinationChainId must be enabled.This method is payable because the caller is able to deposit ETH if the originToken is WETH and this function will handle wrapping ETH." }, + "emergencyDeleteRootBundle(uint256)": { + "notice": "This method is intended to only be used in emergencies where a bad root bundle has reached the SpokePool." + }, "executeRelayerRefundRoot(uint32,(uint256,uint256,uint256[],uint32,address,address[]),bytes32[])": { "notice": "Executes a relayer refund leaf stored as part of a root bundle. Will send the relayer the amount they sent to the recipient plus a relayer fee." }, @@ -1257,7 +1291,7 @@ "notice": "Executes a slow relay leaf stored as part of a root bundle. Will send the full amount remaining in the relay to the recipient, less fees." }, "fillRelay(address,address,address,uint256,uint256,uint256,uint256,uint64,uint64,uint32)": { - "notice": "Called by relayer to fulfill part of a deposit by sending destination tokens to the receipient. Relayer is expected to pass in unique identifying information for deposit that they want to fulfill, and this relay submission will be validated by off-chain data workers who can dispute this relay if any part is invalid. If the relay is valid, then the relayer will be refunded on their desired repayment chain. If relay is invalid, then relayer will not receive any refund.All of the deposit data can be found via on-chain events from the origin SpokePool, except for the realizedLpFeePct which is a function of the HubPool's utilization at the deposit quote time. This fee % is deterministic based on the quote time, so the relayer should just compute it using the canonical algorithm as described in a UMIP linked to the HubPool's identifier." + "notice": "Called by relayer to fulfill part of a deposit by sending destination tokens to the recipient. Relayer is expected to pass in unique identifying information for deposit that they want to fulfill, and this relay submission will be validated by off-chain data workers who can dispute this relay if any part is invalid. If the relay is valid, then the relayer will be refunded on their desired repayment chain. If relay is invalid, then relayer will not receive any refund.All of the deposit data can be found via on-chain events from the origin SpokePool, except for the realizedLpFeePct which is a function of the HubPool's utilization at the deposit quote time. This fee % is deterministic based on the quote time, so the relayer should just compute it using the canonical algorithm as described in a UMIP linked to the HubPool's identifier." }, "fillRelayWithUpdatedFee(address,address,address,uint256,uint256,uint256,uint256,uint64,uint64,uint64,uint32,bytes)": { "notice": "Called by relayer to execute same logic as calling fillRelay except that relayer is using an updated relayer fee %. The fee % must have been emitted in a message cryptographically signed by the depositor.By design, the depositor probably emitted the message with the updated fee by calling speedUpRelay()." @@ -1293,7 +1327,7 @@ "storageLayout": { "storage": [ { - "astId": 5884, + "astId": 5790, "contract": "contracts/Ethereum_SpokePool.sol:Ethereum_SpokePool", "label": "timerAddress", "offset": 0, @@ -1301,7 +1335,7 @@ "type": "t_address" }, { - "astId": 7106, + "astId": 7084, "contract": "contracts/Ethereum_SpokePool.sol:Ethereum_SpokePool", "label": "_notEntered", "offset": 20, @@ -1309,7 +1343,7 @@ "type": "t_bool" }, { - "astId": 8192, + "astId": 8179, "contract": "contracts/Ethereum_SpokePool.sol:Ethereum_SpokePool", "label": "crossDomainAdmin", "offset": 0, @@ -1317,7 +1351,7 @@ "type": "t_address" }, { - "astId": 8194, + "astId": 8181, "contract": "contracts/Ethereum_SpokePool.sol:Ethereum_SpokePool", "label": "hubPool", "offset": 0, @@ -1325,59 +1359,43 @@ "type": "t_address" }, { - "astId": 8197, - "contract": "contracts/Ethereum_SpokePool.sol:Ethereum_SpokePool", - "label": "weth", - "offset": 0, - "slot": "3", - "type": "t_contract(WETH9)10662" - }, - { - "astId": 8199, - "contract": "contracts/Ethereum_SpokePool.sol:Ethereum_SpokePool", - "label": "deploymentTime", - "offset": 20, - "slot": "3", - "type": "t_uint32" - }, - { - "astId": 8202, + "astId": 8187, "contract": "contracts/Ethereum_SpokePool.sol:Ethereum_SpokePool", "label": "depositQuoteTimeBuffer", - "offset": 24, - "slot": "3", + "offset": 20, + "slot": "2", "type": "t_uint32" }, { - "astId": 8204, + "astId": 8189, "contract": "contracts/Ethereum_SpokePool.sol:Ethereum_SpokePool", "label": "numberOfDeposits", - "offset": 28, - "slot": "3", + "offset": 24, + "slot": "2", "type": "t_uint32" }, { - "astId": 8210, + "astId": 8195, "contract": "contracts/Ethereum_SpokePool.sol:Ethereum_SpokePool", "label": "enabledDepositRoutes", "offset": 0, - "slot": "4", + "slot": "3", "type": "t_mapping(t_address,t_mapping(t_uint256,t_bool))" }, { - "astId": 8223, + "astId": 8199, "contract": "contracts/Ethereum_SpokePool.sol:Ethereum_SpokePool", "label": "rootBundles", "offset": 0, - "slot": "5", - "type": "t_array(t_struct(RootBundle)8219_storage)dyn_storage" + "slot": "4", + "type": "t_array(t_struct(RootBundle)9627_storage)dyn_storage" }, { - "astId": 8227, + "astId": 8203, "contract": "contracts/Ethereum_SpokePool.sol:Ethereum_SpokePool", "label": "relayFills", "offset": 0, - "slot": "6", + "slot": "5", "type": "t_mapping(t_bytes32,t_uint256)" }, { @@ -1385,7 +1403,7 @@ "contract": "contracts/Ethereum_SpokePool.sol:Ethereum_SpokePool", "label": "_owner", "offset": 0, - "slot": "7", + "slot": "6", "type": "t_address" } ], @@ -1395,10 +1413,10 @@ "label": "address", "numberOfBytes": "20" }, - "t_array(t_struct(RootBundle)8219_storage)dyn_storage": { - "base": "t_struct(RootBundle)8219_storage", + "t_array(t_struct(RootBundle)9627_storage)dyn_storage": { + "base": "t_struct(RootBundle)9627_storage", "encoding": "dynamic_array", - "label": "struct SpokePool.RootBundle[]", + "label": "struct SpokePoolInterface.RootBundle[]", "numberOfBytes": "32" }, "t_bool": { @@ -1411,11 +1429,6 @@ "label": "bytes32", "numberOfBytes": "32" }, - "t_contract(WETH9)10662": { - "encoding": "inplace", - "label": "contract WETH9", - "numberOfBytes": "20" - }, "t_mapping(t_address,t_mapping(t_uint256,t_bool))": { "encoding": "mapping", "key": "t_address", @@ -1444,12 +1457,12 @@ "numberOfBytes": "32", "value": "t_uint256" }, - "t_struct(RootBundle)8219_storage": { + "t_struct(RootBundle)9627_storage": { "encoding": "inplace", - "label": "struct SpokePool.RootBundle", + "label": "struct SpokePoolInterface.RootBundle", "members": [ { - "astId": 8212, + "astId": 9620, "contract": "contracts/Ethereum_SpokePool.sol:Ethereum_SpokePool", "label": "slowRelayRoot", "offset": 0, @@ -1457,7 +1470,7 @@ "type": "t_bytes32" }, { - "astId": 8214, + "astId": 9622, "contract": "contracts/Ethereum_SpokePool.sol:Ethereum_SpokePool", "label": "relayerRefundRoot", "offset": 0, @@ -1465,7 +1478,7 @@ "type": "t_bytes32" }, { - "astId": 8218, + "astId": 9626, "contract": "contracts/Ethereum_SpokePool.sol:Ethereum_SpokePool", "label": "claimedBitmap", "offset": 0, diff --git a/deployments/kovan/HubPool.json b/deployments/kovan/HubPool.json index b5f4625de..61b24726e 100644 --- a/deployments/kovan/HubPool.json +++ b/deployments/kovan/HubPool.json @@ -1,5 +1,5 @@ { - "address": "0x26EfA52A66b7B776Df2196Bf34A9F70327f4b26d", + "address": "0xD449Af45a032Df413b497A709EeD3E8C112EbcE3", "abi": [ { "inputs": [ @@ -71,6 +71,37 @@ "name": "CrossChainContractsSet", "type": "event" }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "bytes32", + "name": "poolRebalanceRoot", + "type": "bytes32" + }, + { + "indexed": true, + "internalType": "bytes32", + "name": "relayerRefundRoot", + "type": "bytes32" + }, + { + "indexed": false, + "internalType": "bytes32", + "name": "slowRelayRoot", + "type": "bytes32" + }, + { + "indexed": true, + "internalType": "address", + "name": "proposer", + "type": "address" + } + ], + "name": "EmergencyRootBundleDeleted", + "type": "event" + }, { "anonymous": false, "inputs": [ @@ -216,6 +247,19 @@ "name": "OwnershipTransferred", "type": "event" }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "bool", + "name": "isPaused", + "type": "bool" + } + ], + "name": "Paused", + "type": "event" + }, { "anonymous": false, "inputs": [ @@ -317,12 +361,6 @@ "internalType": "uint256", "name": "requestTime", "type": "uint256" - }, - { - "indexed": false, - "internalType": "bytes", - "name": "disputedAncillaryData", - "type": "bytes" } ], "name": "RootBundleCanceled", @@ -342,12 +380,6 @@ "internalType": "uint256", "name": "requestTime", "type": "uint256" - }, - { - "indexed": false, - "internalType": "bytes", - "name": "disputedAncillaryData", - "type": "bytes" } ], "name": "RootBundleDisputed", @@ -356,6 +388,12 @@ { "anonymous": false, "inputs": [ + { + "indexed": false, + "internalType": "uint256", + "name": "groupIndex", + "type": "uint256" + }, { "indexed": true, "internalType": "uint256", @@ -408,28 +446,34 @@ { "indexed": true, "internalType": "uint256", - "name": "chainId", + "name": "originChainId", "type": "uint256" }, + { + "indexed": true, + "internalType": "uint256", + "name": "destinationChainId", + "type": "uint256" + }, + { + "indexed": true, + "internalType": "address", + "name": "originToken", + "type": "address" + }, { "indexed": false, - "internalType": "bytes", - "name": "message", - "type": "bytes" + "internalType": "bool", + "name": "depositsEnabled", + "type": "bool" } ], - "name": "SpokePoolAdminFunctionTriggered", + "name": "SetEnableDepositRoute", "type": "event" }, { "anonymous": false, "inputs": [ - { - "indexed": true, - "internalType": "uint256", - "name": "originChainId", - "type": "uint256" - }, { "indexed": true, "internalType": "uint256", @@ -439,23 +483,36 @@ { "indexed": true, "internalType": "address", - "name": "originToken", + "name": "l1Token", "type": "address" }, { - "indexed": false, + "indexed": true, "internalType": "address", "name": "destinationToken", "type": "address" + } + ], + "name": "SetPoolRebalanceRoute", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "uint256", + "name": "chainId", + "type": "uint256" }, { "indexed": false, - "internalType": "bool", - "name": "enableRoute", - "type": "bool" + "internalType": "bytes", + "name": "message", + "type": "bytes" } ], - "name": "WhitelistRoute", + "name": "SpokePoolAdminFunctionTriggered", "type": "event" }, { @@ -530,7 +587,7 @@ "name": "crossChainContracts", "outputs": [ { - "internalType": "contract AdapterInterface", + "internalType": "address", "name": "adapter", "type": "address" }, @@ -563,6 +620,13 @@ "stateMutability": "nonpayable", "type": "function" }, + { + "inputs": [], + "name": "emergencyDeleteProposal", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, { "inputs": [ { @@ -598,41 +662,39 @@ { "inputs": [ { - "components": [ - { - "internalType": "uint256", - "name": "chainId", - "type": "uint256" - }, - { - "internalType": "uint256[]", - "name": "bundleLpFees", - "type": "uint256[]" - }, - { - "internalType": "int256[]", - "name": "netSendAmounts", - "type": "int256[]" - }, - { - "internalType": "int256[]", - "name": "runningBalances", - "type": "int256[]" - }, - { - "internalType": "uint8", - "name": "leafId", - "type": "uint8" - }, - { - "internalType": "address[]", - "name": "l1Tokens", - "type": "address[]" - } - ], - "internalType": "struct HubPoolInterface.PoolRebalanceLeaf", - "name": "poolRebalanceLeaf", - "type": "tuple" + "internalType": "uint256", + "name": "chainId", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "groupIndex", + "type": "uint256" + }, + { + "internalType": "uint256[]", + "name": "bundleLpFees", + "type": "uint256[]" + }, + { + "internalType": "int256[]", + "name": "netSendAmounts", + "type": "int256[]" + }, + { + "internalType": "int256[]", + "name": "runningBalances", + "type": "int256[]" + }, + { + "internalType": "uint8", + "name": "leafId", + "type": "uint8" + }, + { + "internalType": "address[]", + "name": "l1Tokens", + "type": "address[]" }, { "internalType": "bytes32[]", @@ -671,19 +733,6 @@ "stateMutability": "view", "type": "function" }, - { - "inputs": [], - "name": "getRootBundleProposalAncillaryData", - "outputs": [ - { - "internalType": "bytes", - "name": "ancillaryData", - "type": "bytes" - } - ], - "stateMutability": "view", - "type": "function" - }, { "inputs": [], "name": "identifier", @@ -818,6 +867,43 @@ "stateMutability": "view", "type": "function" }, + { + "inputs": [], + "name": "paused", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "destinationChainId", + "type": "uint256" + }, + { + "internalType": "address", + "name": "l1Token", + "type": "address" + } + ], + "name": "poolRebalanceRoute", + "outputs": [ + { + "internalType": "address", + "name": "destinationToken", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, { "inputs": [ { @@ -998,11 +1084,6 @@ "name": "proposer", "type": "address" }, - { - "internalType": "bool", - "name": "proposerBondRepaid", - "type": "bool" - }, { "internalType": "uint8", "name": "unclaimedPoolRebalanceLeafCount", @@ -1071,6 +1152,34 @@ "stateMutability": "nonpayable", "type": "function" }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "originChainId", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "destinationChainId", + "type": "uint256" + }, + { + "internalType": "address", + "name": "originToken", + "type": "address" + }, + { + "internalType": "bool", + "name": "depositsEnabled", + "type": "bool" + } + ], + "name": "setDepositRoute", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, { "inputs": [ { @@ -1097,6 +1206,42 @@ "stateMutability": "nonpayable", "type": "function" }, + { + "inputs": [ + { + "internalType": "bool", + "name": "pause", + "type": "bool" + } + ], + "name": "setPaused", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "destinationChainId", + "type": "uint256" + }, + { + "internalType": "address", + "name": "l1Token", + "type": "address" + }, + { + "internalType": "address", + "name": "destinationToken", + "type": "address" + } + ], + "name": "setPoolRebalanceRoute", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, { "inputs": [ { @@ -1186,116 +1331,54 @@ "stateMutability": "view", "type": "function" }, - { - "inputs": [ - { - "internalType": "uint256", - "name": "originChainId", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "destinationChainId", - "type": "uint256" - }, - { - "internalType": "address", - "name": "originToken", - "type": "address" - }, - { - "internalType": "address", - "name": "destinationToken", - "type": "address" - }, - { - "internalType": "bool", - "name": "enableRoute", - "type": "bool" - } - ], - "name": "whitelistRoute", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "uint256", - "name": "originChainId", - "type": "uint256" - }, - { - "internalType": "address", - "name": "originToken", - "type": "address" - }, - { - "internalType": "uint256", - "name": "destinationChainId", - "type": "uint256" - } - ], - "name": "whitelistedRoute", - "outputs": [ - { - "internalType": "address", - "name": "", - "type": "address" - } - ], - "stateMutability": "view", - "type": "function" - }, { "stateMutability": "payable", "type": "receive" } ], - "transactionHash": "0x32de83c7af7a2e5799605c8b75d498e5c928931bb5634b6c5efbee7d6026c7df", + "transactionHash": "0x29591bc76e12f81fbb02e1e10f2b29c0f4c489761e779c7e7906b5a95ee40f03", "receipt": { "to": null, "from": "0x9A8f92a830A5cB89a3816e3D267CB7791c16b04D", - "contractAddress": "0x26EfA52A66b7B776Df2196Bf34A9F70327f4b26d", - "transactionIndex": 1, - "gasUsed": "4545415", - "logsBloom": "0x00000000000000000000000000000000000000000000000000840000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001000000000000000000000000000000000000020000000000000000000800000000000010000000000000040000400000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000010000000000000000000000000000000000000000000000800000000000000000000000000000000000000000000020000001000000000000000000000000000000000000000000000000000000000000", - "blockHash": "0xb7677dd8daa874b1b38c13b19f0933aff6bb59eb13dba32e224e73682038e5e3", - "transactionHash": "0x32de83c7af7a2e5799605c8b75d498e5c928931bb5634b6c5efbee7d6026c7df", + "contractAddress": "0xD449Af45a032Df413b497A709EeD3E8C112EbcE3", + "transactionIndex": 4, + "gasUsed": "4284004", + "logsBloom": "0x00000000000000000000000000000000000000000000000000800000000000000000000000000000000000000040000000000000000000000000000000000000000000000000000000000000000000000001000000000000000000000000000000000000020000000000000000000800000000000000000000000000040000400000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000800000000000000000000000000000000000000000000020000001000000000080000000000000000000000000000000000000000000000800", + "blockHash": "0xd8bff6f6543414dba16b4c3eaf4b17e82c4c7fe427e918939d15f4cc8eef4e95", + "transactionHash": "0x29591bc76e12f81fbb02e1e10f2b29c0f4c489761e779c7e7906b5a95ee40f03", "logs": [ { - "transactionIndex": 1, - "blockNumber": 30251467, - "transactionHash": "0x32de83c7af7a2e5799605c8b75d498e5c928931bb5634b6c5efbee7d6026c7df", - "address": "0x26EfA52A66b7B776Df2196Bf34A9F70327f4b26d", + "transactionIndex": 4, + "blockNumber": 30475928, + "transactionHash": "0x29591bc76e12f81fbb02e1e10f2b29c0f4c489761e779c7e7906b5a95ee40f03", + "address": "0xD449Af45a032Df413b497A709EeD3E8C112EbcE3", "topics": [ "0x8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0", "0x0000000000000000000000000000000000000000000000000000000000000000", "0x0000000000000000000000009a8f92a830a5cb89a3816e3d267cb7791c16b04d" ], "data": "0x", - "logIndex": 8, - "blockHash": "0xb7677dd8daa874b1b38c13b19f0933aff6bb59eb13dba32e224e73682038e5e3" + "logIndex": 1, + "blockHash": "0xd8bff6f6543414dba16b4c3eaf4b17e82c4c7fe427e918939d15f4cc8eef4e95" } ], - "blockNumber": 30251467, - "cumulativeGasUsed": "4832610", + "blockNumber": 30475928, + "cumulativeGasUsed": "4466945", "status": 1, "byzantium": true }, "args": [ - "0x0e4D1366bF08365B783e097D0Af6Ce5bF7DbD013", + "0x2C4f1527Ec183ccD25f65816Cfc3a45b26B626B8", "0xeD0169a88d267063184b0853BaAAAe66c3c154B2", "0xd0A1E359811322d97991E03f863a0C30C2cF029C", "0x0000000000000000000000000000000000000000" ], "numDeployments": 1, - "solcInputHash": "abccea57e702a2494fadb0e94bc8fd72", - "metadata": "{\"compiler\":{\"version\":\"0.8.11+commit.d7f03943\"},\"language\":\"Solidity\",\"output\":{\"abi\":[{\"inputs\":[{\"internalType\":\"contract LpTokenFactoryInterface\",\"name\":\"_lpTokenFactory\",\"type\":\"address\"},{\"internalType\":\"contract FinderInterface\",\"name\":\"_finder\",\"type\":\"address\"},{\"internalType\":\"contract WETH9\",\"name\":\"_weth\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"_timer\",\"type\":\"address\"}],\"stateMutability\":\"nonpayable\",\"type\":\"constructor\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"newBondToken\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"newBondAmount\",\"type\":\"uint256\"}],\"name\":\"BondSet\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"l2ChainId\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"address\",\"name\":\"adapter\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"address\",\"name\":\"spokePool\",\"type\":\"address\"}],\"name\":\"CrossChainContractsSet\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"bytes32\",\"name\":\"newIdentifier\",\"type\":\"bytes32\"}],\"name\":\"IdentifierSet\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"address\",\"name\":\"l1Token\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"address\",\"name\":\"lpToken\",\"type\":\"address\"}],\"name\":\"L1TokenEnabledForLiquidityProvision\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"address\",\"name\":\"l1Token\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"address\",\"name\":\"lpToken\",\"type\":\"address\"}],\"name\":\"L2TokenDisabledForLiquidityProvision\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"l1Token\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"lpTokensMinted\",\"type\":\"uint256\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"liquidityProvider\",\"type\":\"address\"}],\"name\":\"LiquidityAdded\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"l1Token\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"lpTokensBurnt\",\"type\":\"uint256\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"liquidityProvider\",\"type\":\"address\"}],\"name\":\"LiquidityRemoved\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"newLiveness\",\"type\":\"uint256\"}],\"name\":\"LivenessSet\",\"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\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"uint32\",\"name\":\"requestExpirationTimestamp\",\"type\":\"uint32\"},{\"indexed\":false,\"internalType\":\"uint64\",\"name\":\"unclaimedPoolRebalanceLeafCount\",\"type\":\"uint64\"},{\"indexed\":false,\"internalType\":\"uint256[]\",\"name\":\"bundleEvaluationBlockNumbers\",\"type\":\"uint256[]\"},{\"indexed\":true,\"internalType\":\"bytes32\",\"name\":\"poolRebalanceRoot\",\"type\":\"bytes32\"},{\"indexed\":true,\"internalType\":\"bytes32\",\"name\":\"relayerRefundRoot\",\"type\":\"bytes32\"},{\"indexed\":false,\"internalType\":\"bytes32\",\"name\":\"slowRelayRoot\",\"type\":\"bytes32\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"proposer\",\"type\":\"address\"}],\"name\":\"ProposeRootBundle\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"newProtocolFeeCaptureAddress\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"uint256\",\"name\":\"newProtocolFeeCapturePct\",\"type\":\"uint256\"}],\"name\":\"ProtocolFeeCaptureSet\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"l1Token\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"uint256\",\"name\":\"accumulatedFees\",\"type\":\"uint256\"}],\"name\":\"ProtocolFeesCapturedClaimed\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"disputer\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"requestTime\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"bytes\",\"name\":\"disputedAncillaryData\",\"type\":\"bytes\"}],\"name\":\"RootBundleCanceled\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"disputer\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"requestTime\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"bytes\",\"name\":\"disputedAncillaryData\",\"type\":\"bytes\"}],\"name\":\"RootBundleDisputed\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"uint256\",\"name\":\"leafId\",\"type\":\"uint256\"},{\"indexed\":true,\"internalType\":\"uint256\",\"name\":\"chainId\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"address[]\",\"name\":\"l1Token\",\"type\":\"address[]\"},{\"indexed\":false,\"internalType\":\"uint256[]\",\"name\":\"bundleLpFees\",\"type\":\"uint256[]\"},{\"indexed\":false,\"internalType\":\"int256[]\",\"name\":\"netSendAmount\",\"type\":\"int256[]\"},{\"indexed\":false,\"internalType\":\"int256[]\",\"name\":\"runningBalance\",\"type\":\"int256[]\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"caller\",\"type\":\"address\"}],\"name\":\"RootBundleExecuted\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"uint256\",\"name\":\"chainId\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"bytes\",\"name\":\"message\",\"type\":\"bytes\"}],\"name\":\"SpokePoolAdminFunctionTriggered\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"uint256\",\"name\":\"originChainId\",\"type\":\"uint256\"},{\"indexed\":true,\"internalType\":\"uint256\",\"name\":\"destinationChainId\",\"type\":\"uint256\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"originToken\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"address\",\"name\":\"destinationToken\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"bool\",\"name\":\"enableRoute\",\"type\":\"bool\"}],\"name\":\"WhitelistRoute\",\"type\":\"event\"},{\"stateMutability\":\"payable\",\"type\":\"fallback\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"l1Token\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"l1TokenAmount\",\"type\":\"uint256\"}],\"name\":\"addLiquidity\",\"outputs\":[],\"stateMutability\":\"payable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"bondAmount\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"bondToken\",\"outputs\":[{\"internalType\":\"contract IERC20\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"l1Token\",\"type\":\"address\"}],\"name\":\"claimProtocolFeesCaptured\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"name\":\"crossChainContracts\",\"outputs\":[{\"internalType\":\"contract AdapterInterface\",\"name\":\"adapter\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"spokePool\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"l1Token\",\"type\":\"address\"}],\"name\":\"disableL1TokenForLiquidityProvision\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"disputeRootBundle\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"l1Token\",\"type\":\"address\"}],\"name\":\"enableL1TokenForLiquidityProvision\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"l1Token\",\"type\":\"address\"}],\"name\":\"exchangeRateCurrent\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"components\":[{\"internalType\":\"uint256\",\"name\":\"chainId\",\"type\":\"uint256\"},{\"internalType\":\"uint256[]\",\"name\":\"bundleLpFees\",\"type\":\"uint256[]\"},{\"internalType\":\"int256[]\",\"name\":\"netSendAmounts\",\"type\":\"int256[]\"},{\"internalType\":\"int256[]\",\"name\":\"runningBalances\",\"type\":\"int256[]\"},{\"internalType\":\"uint8\",\"name\":\"leafId\",\"type\":\"uint8\"},{\"internalType\":\"address[]\",\"name\":\"l1Tokens\",\"type\":\"address[]\"}],\"internalType\":\"struct HubPoolInterface.PoolRebalanceLeaf\",\"name\":\"poolRebalanceLeaf\",\"type\":\"tuple\"},{\"internalType\":\"bytes32[]\",\"name\":\"proof\",\"type\":\"bytes32[]\"}],\"name\":\"executeRootBundle\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"finder\",\"outputs\":[{\"internalType\":\"contract FinderInterface\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"getCurrentTime\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"getRootBundleProposalAncillaryData\",\"outputs\":[{\"internalType\":\"bytes\",\"name\":\"ancillaryData\",\"type\":\"bytes\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"identifier\",\"outputs\":[{\"internalType\":\"bytes32\",\"name\":\"\",\"type\":\"bytes32\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"l1Token\",\"type\":\"address\"}],\"name\":\"liquidityUtilizationCurrent\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"l1Token\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"relayedAmount\",\"type\":\"uint256\"}],\"name\":\"liquidityUtilizationPostRelay\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"liveness\",\"outputs\":[{\"internalType\":\"uint32\",\"name\":\"\",\"type\":\"uint32\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"loadEthForL2Calls\",\"outputs\":[],\"stateMutability\":\"payable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"lpFeeRatePerSecond\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"lpTokenFactory\",\"outputs\":[{\"internalType\":\"contract LpTokenFactoryInterface\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes[]\",\"name\":\"data\",\"type\":\"bytes[]\"}],\"name\":\"multicall\",\"outputs\":[{\"internalType\":\"bytes[]\",\"name\":\"results\",\"type\":\"bytes[]\"}],\"stateMutability\":\"payable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"owner\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"name\":\"pooledTokens\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"lpToken\",\"type\":\"address\"},{\"internalType\":\"bool\",\"name\":\"isEnabled\",\"type\":\"bool\"},{\"internalType\":\"uint32\",\"name\":\"lastLpFeeUpdate\",\"type\":\"uint32\"},{\"internalType\":\"int256\",\"name\":\"utilizedReserves\",\"type\":\"int256\"},{\"internalType\":\"uint256\",\"name\":\"liquidReserves\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"undistributedLpFees\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256[]\",\"name\":\"bundleEvaluationBlockNumbers\",\"type\":\"uint256[]\"},{\"internalType\":\"uint8\",\"name\":\"poolRebalanceLeafCount\",\"type\":\"uint8\"},{\"internalType\":\"bytes32\",\"name\":\"poolRebalanceRoot\",\"type\":\"bytes32\"},{\"internalType\":\"bytes32\",\"name\":\"relayerRefundRoot\",\"type\":\"bytes32\"},{\"internalType\":\"bytes32\",\"name\":\"slowRelayRoot\",\"type\":\"bytes32\"}],\"name\":\"proposeRootBundle\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"protocolFeeCaptureAddress\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"protocolFeeCapturePct\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"chainId\",\"type\":\"uint256\"},{\"internalType\":\"bytes\",\"name\":\"functionData\",\"type\":\"bytes\"}],\"name\":\"relaySpokePoolAdminFunction\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"l1Token\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"lpTokenAmount\",\"type\":\"uint256\"},{\"internalType\":\"bool\",\"name\":\"sendEth\",\"type\":\"bool\"}],\"name\":\"removeLiquidity\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"renounceOwnership\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"rootBundleProposal\",\"outputs\":[{\"internalType\":\"bytes32\",\"name\":\"poolRebalanceRoot\",\"type\":\"bytes32\"},{\"internalType\":\"bytes32\",\"name\":\"relayerRefundRoot\",\"type\":\"bytes32\"},{\"internalType\":\"bytes32\",\"name\":\"slowRelayRoot\",\"type\":\"bytes32\"},{\"internalType\":\"uint256\",\"name\":\"claimedBitMap\",\"type\":\"uint256\"},{\"internalType\":\"address\",\"name\":\"proposer\",\"type\":\"address\"},{\"internalType\":\"bool\",\"name\":\"proposerBondRepaid\",\"type\":\"bool\"},{\"internalType\":\"uint8\",\"name\":\"unclaimedPoolRebalanceLeafCount\",\"type\":\"uint8\"},{\"internalType\":\"uint32\",\"name\":\"requestExpirationTimestamp\",\"type\":\"uint32\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"contract IERC20\",\"name\":\"newBondToken\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"newBondAmount\",\"type\":\"uint256\"}],\"name\":\"setBond\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"l2ChainId\",\"type\":\"uint256\"},{\"internalType\":\"address\",\"name\":\"adapter\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"spokePool\",\"type\":\"address\"}],\"name\":\"setCrossChainContracts\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"time\",\"type\":\"uint256\"}],\"name\":\"setCurrentTime\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"newIdentifier\",\"type\":\"bytes32\"}],\"name\":\"setIdentifier\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint32\",\"name\":\"newLiveness\",\"type\":\"uint32\"}],\"name\":\"setLiveness\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"newProtocolFeeCaptureAddress\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"newProtocolFeeCapturePct\",\"type\":\"uint256\"}],\"name\":\"setProtocolFeeCapture\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"l1Token\",\"type\":\"address\"}],\"name\":\"sync\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"timerAddress\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"newOwner\",\"type\":\"address\"}],\"name\":\"transferOwnership\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"name\":\"unclaimedAccumulatedProtocolFees\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"weth\",\"outputs\":[{\"internalType\":\"contract WETH9\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"originChainId\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"destinationChainId\",\"type\":\"uint256\"},{\"internalType\":\"address\",\"name\":\"originToken\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"destinationToken\",\"type\":\"address\"},{\"internalType\":\"bool\",\"name\":\"enableRoute\",\"type\":\"bool\"}],\"name\":\"whitelistRoute\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"originChainId\",\"type\":\"uint256\"},{\"internalType\":\"address\",\"name\":\"originToken\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"destinationChainId\",\"type\":\"uint256\"}],\"name\":\"whitelistedRoute\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"stateMutability\":\"payable\",\"type\":\"receive\"}],\"devdoc\":{\"kind\":\"dev\",\"methods\":{\"addLiquidity(address,uint256)\":{\"params\":{\"l1Token\":\"Token to deposit into this contract.\",\"l1TokenAmount\":\"Amount of liquidity to provide.\"}},\"claimProtocolFeesCaptured(address)\":{\"params\":{\"l1Token\":\"Token whose protocol fees the caller wants to disburse.\"}},\"constructor\":{\"params\":{\"_finder\":\"Finder address.\",\"_lpTokenFactory\":\"LP Token factory address used to deploy LP tokens for new collateral types.\",\"_timer\":\"Timer address.\",\"_weth\":\"WETH address.\"}},\"disableL1TokenForLiquidityProvision(address)\":{\"params\":{\"l1Token\":\"Token to disable liquidity provision for.\"}},\"enableL1TokenForLiquidityProvision(address)\":{\"params\":{\"l1Token\":\"Token to provide liquidity for.\"}},\"exchangeRateCurrent(address)\":{\"params\":{\"l1Token\":\"L1 token redeemable by burning LP token.\"},\"returns\":{\"_0\":\"Amount of L1 tokens redeemable for 1 unit LP token.\"}},\"executeRootBundle((uint256,uint256[],int256[],int256[],uint8,address[]),bytes32[])\":{\"details\":\"In some cases, will instruct spokePool to send funds back to L1.\",\"params\":{\"poolRebalanceLeaf\":\"Contains all data neccessary to reconstruct leaf contained in root bundle and to bridge tokens to HubPool. This data structure is explained in detail in the HubPoolInterface.\",\"proof\":\"Inclusion proof for this leaf in pool rebalance root in root bundle.\"}},\"getCurrentTime()\":{\"returns\":{\"_0\":\"uint for the current Testable timestamp.\"}},\"getRootBundleProposalAncillaryData()\":{\"returns\":{\"ancillaryData\":\"Ancillary data that can be decoded into UTF8.\"}},\"liquidityUtilizationCurrent(address)\":{\"params\":{\"l1Token\":\"L1 token to query utilization for.\"},\"returns\":{\"_0\":\"% of liquid reserves currently being \\\"used\\\" and sitting in SpokePools.\"}},\"liquidityUtilizationPostRelay(address,uint256)\":{\"params\":{\"l1Token\":\"L1 token to query utilization for.\",\"relayedAmount\":\"The higher this amount, the higher the utilization.\"},\"returns\":{\"_0\":\"% of liquid reserves currently being \\\"used\\\" and sitting in SpokePools plus the relayedAmount.\"}},\"owner()\":{\"details\":\"Returns the address of the current owner.\"},\"proposeRootBundle(uint256[],uint8,bytes32,bytes32,bytes32)\":{\"params\":{\"bundleEvaluationBlockNumbers\":\"should contain the latest block number for all chains, even if there are no relays contained on some of them. The usage of this variable should be defined in an off chain UMIP.\",\"poolRebalanceLeafCount\":\"Number of leaves contained in pool rebalance root. Max is the number of whitelisted chains.\",\"poolRebalanceRoot\":\"Pool rebalance root containing leaves that will send tokens from this contract to a SpokePool.\",\"relayerRefundRoot\":\"Relayer refund root to publish to SpokePool where a data worker can execute leaves to refund relayers on their chosen refund chainId.\",\"slowRelayRoot\":\"Slow relay root to publish to Spoke Pool where a data worker can execute leaves to fulfill slow relays.\"}},\"relaySpokePoolAdminFunction(uint256,bytes)\":{\"details\":\"This function has permission to call onlyAdmin functions on the SpokePool, so its imperative that this contract only allows the owner to call this method directly or indirectly.\",\"params\":{\"chainId\":\"Chain with SpokePool to send message to.\",\"functionData\":\"ABI encoded function call to send to SpokePool, but can be any arbitrary data technically.\"}},\"removeLiquidity(address,uint256,bool)\":{\"params\":{\"l1Token\":\"Token to redeem LP share for.\",\"lpTokenAmount\":\"Amount of LP tokens to burn. Exchange rate between L1 token and LP token can be queried via public exchangeRateCurrent method.\",\"sendEth\":\"Set to True if L1 token is WETH and user wants to receive ETH.\"}},\"renounceOwnership()\":{\"details\":\"Leaves the contract without owner. It will not be possible to call `onlyOwner` functions anymore. Can only be called by the current owner. NOTE: Renouncing ownership will leave the contract without an owner, thereby removing any functionality that is only available to the owner.\"},\"setBond(address,uint256)\":{\"params\":{\"newBondAmount\":\"New bond amount.\",\"newBondToken\":\"New bond currency.\"}},\"setCrossChainContracts(uint256,address,address)\":{\"params\":{\"adapter\":\"Adapter used to relay messages and tokens to spoke pool.\",\"l2ChainId\":\"Chain to set contracts for.\",\"spokePool\":\"Recipient of relayed messages and tokens on SpokePool.\"}},\"setCurrentTime(uint256)\":{\"details\":\"Will revert if not running in test mode.\",\"params\":{\"time\":\"timestamp to set current Testable time to.\"}},\"setIdentifier(bytes32)\":{\"params\":{\"newIdentifier\":\"New identifier.\"}},\"setLiveness(uint32)\":{\"params\":{\"newLiveness\":\"New liveness period.\"}},\"setProtocolFeeCapture(address,uint256)\":{\"params\":{\"newProtocolFeeCaptureAddress\":\"New protocol fee capture address.\",\"newProtocolFeeCapturePct\":\"New protocol fee capture %.\"}},\"transferOwnership(address)\":{\"details\":\"Transfers ownership of the contract to a new account (`newOwner`). Can only be called by the current owner.\"},\"whitelistRoute(uint256,uint256,address,address,bool)\":{\"params\":{\"destinationChainId\":\"Chain where depositor wants to receive funds.\",\"destinationToken\":\"Token that depositor wants to receive on destination chain. Unused if `enableRoute` is False.\",\"enableRoute\":\"Set to true to enable route on L2 and whitelist new destination token, or False to disable route on L2 and delete destination token mapping on this contract.\",\"originChainId\":\"Chain where deposit occurs.\",\"originToken\":\"Deposited token.\"}},\"whitelistedRoute(uint256,address,uint256)\":{\"params\":{\"destinationChainId\":\"Where depositor can receive funds.\",\"originChainId\":\"Deposit chain.\",\"originToken\":\"Deposited token.\"},\"returns\":{\"_0\":\"address Depositor can receive this token on destination chain ID.\"}}},\"version\":1},\"userdoc\":{\"kind\":\"user\",\"methods\":{\"addLiquidity(address,uint256)\":{\"notice\":\"Deposit liquidity into this contract to earn LP fees in exchange for funding relays on SpokePools. Caller is essentially loaning their funds to be sent from this contract to the SpokePool, where it will be used to repay a relayer, and ultimately receives their loan back after the tokens are bridged back to this contract via the canonical token bridge. Then, the caller's loans are used for again. This loan cycle repeats continuously and the caller, or \\\"liquidity provider\\\" earns a continuous fee for their credit that they are extending relayers.Caller will receive an LP token representing their share of this pool. The LP token's redemption value increments from the time that they enter the pool to reflect their accrued fees.\"},\"claimProtocolFeesCaptured(address)\":{\"notice\":\"Send unclaimed accumulated protocol fees to fee capture address.\"},\"constructor\":{\"notice\":\"Construct HubPool.\"},\"disableL1TokenForLiquidityProvision(address)\":{\"notice\":\"Disables LPs from providing liquidity for L1 token. Callable only by owner.\"},\"disputeRootBundle()\":{\"notice\":\"Caller stakes a bond to dispute the current root bundle proposal assuming it has not passed liveness yet. The proposal is deleted, allowing a follow-up proposal to be submitted, and the dispute is sent to the optimistic oracle to be adjudicated. Can only be called within the liveness period of the current proposal.\"},\"enableL1TokenForLiquidityProvision(address)\":{\"notice\":\"Enables LPs to provide liquidity for L1 token. Deploys new LP token for L1 token if appropriate. Callable only by owner.\"},\"exchangeRateCurrent(address)\":{\"notice\":\"Returns exchange rate of L1 token to LP token.\"},\"executeRootBundle((uint256,uint256[],int256[],int256[],uint8,address[]),bytes32[])\":{\"notice\":\"Executes a pool rebalance leaf as part of the currently published root bundle. Will bridge any tokens from this contract to the SpokePool designated in the leaf, and will also publish relayer refund and slow relay roots to the SpokePool on the network specified in the leaf.Deletes the published root bundle if this is the last leaf to be executed in the root bundle.\"},\"getCurrentTime()\":{\"notice\":\"Gets the current time. Will return the last time set in `setCurrentTime` if running in test mode. Otherwise, it will return the block timestamp.\"},\"getRootBundleProposalAncillaryData()\":{\"notice\":\"Returns ancillary data containing all relevant root bundle data that voters can format into UTF8 and use to determine if the root bundle proposal is valid.\"},\"liquidityUtilizationCurrent(address)\":{\"notice\":\"Returns % of liquid reserves currently being \\\"used\\\" and sitting in SpokePools.\"},\"liquidityUtilizationPostRelay(address,uint256)\":{\"notice\":\"Returns % of liquid reserves currently being \\\"used\\\" and sitting in SpokePools and accounting for relayedAmount of tokens to be withdrawn from the pool.\"},\"loadEthForL2Calls()\":{\"notice\":\"This function allows a caller to load the contract with raw ETH to perform L2 calls. This is needed for arbitrum calls, but may also be needed for others.\"},\"proposeRootBundle(uint256[],uint8,bytes32,bytes32,bytes32)\":{\"notice\":\"Publish a new root bundle to along with all of the block numbers that the merkle roots are relevant for. This is used to aid off-chain validators in evaluating the correctness of this bundle. Caller stakes a bond that can be slashed if the root bundle proposal is invalid, and they will receive it back if accepted.After proposeRootBundle is called, if the any props are wrong then this proposal can be challenged. Once the challenge period passes, then the roots are no longer disputable, and only executeRootBundle can be called; moreover, this method can't be called again until all leafs are executed.\"},\"relaySpokePoolAdminFunction(uint256,bytes)\":{\"notice\":\"Sends message to SpokePool from this contract. Callable only by owner.\"},\"removeLiquidity(address,uint256,bool)\":{\"notice\":\"Burns LP share to redeem for underlying l1Token original deposit amount plus fees.\"},\"setBond(address,uint256)\":{\"notice\":\"Sets bond token and amount. Callable only by owner.\"},\"setCrossChainContracts(uint256,address,address)\":{\"notice\":\"Sets cross chain relay helper contracts for L2 chain ID. Callable only by owner.\"},\"setCurrentTime(uint256)\":{\"notice\":\"Sets the current time.\"},\"setIdentifier(bytes32)\":{\"notice\":\"Sets identifier for root bundle disputes.. Callable only by owner.\"},\"setLiveness(uint32)\":{\"notice\":\"Sets root bundle proposal liveness period. Callable only by owner.\"},\"setProtocolFeeCapture(address,uint256)\":{\"notice\":\"Sets protocolFeeCaptureAddress and protocolFeeCapturePct. Callable only by owner.\"},\"sync(address)\":{\"notice\":\"Synchronize any balance changes in this contract with the utilized & liquid reserves. This should be done at the conclusion of a L2->L1 token transfer via the canonical token bridge, when this contract's reserves do not reflect its true balance due to new tokens being dropped onto the contract at the conclusion of a bridging action.\"},\"whitelistRoute(uint256,uint256,address,address,bool)\":{\"notice\":\"Whitelist an origin chain ID + token <-> destination token route. Callable only by owner.\"},\"whitelistedRoute(uint256,address,uint256)\":{\"notice\":\"Conveniently queries whether an origin chain + token => destination chain ID is whitelisted and returns the whitelisted destination token.\"}},\"notice\":\"Contract deployed on Ethereum that houses L1 token liquidity for all SpokePools. A dataworker can interact with merkle roots stored in this contract via inclusion proofs to instruct this contract to send tokens to L2 SpokePools via \\\"pool rebalances\\\" that can be used to pay out relayers on those networks. This contract is also responsible for publishing relayer refund and slow relay merkle roots to SpokePools.This contract is meant to act as the cross chain administrator and owner of all L2 spoke pools, so all governance actions and pool rebalances originate from here and bridge instructions to L2s.\",\"version\":1}},\"settings\":{\"compilationTarget\":{\"contracts/HubPool.sol\":\"HubPool\"},\"evmVersion\":\"london\",\"libraries\":{},\"metadata\":{\"bytecodeHash\":\"ipfs\"},\"optimizer\":{\"enabled\":true,\"runs\":200},\"remappings\":[]},\"sources\":{\"@openzeppelin/contracts/access/Ownable.sol\":{\"keccak256\":\"0x24e0364e503a9bbde94c715d26573a76f14cd2a202d45f96f52134ab806b67b9\",\"license\":\"MIT\",\"urls\":[\"bzz-raw://e12cbaa7378fd9b62280e4e1d164bedcb4399ce238f5f98fc0eefb7e50577981\",\"dweb:/ipfs/QmXRoFGUgfsaRkoPT5bxNMtSayKTQ8GZATLPXf69HcRA51\"]},\"@openzeppelin/contracts/token/ERC20/IERC20.sol\":{\"keccak256\":\"0xbbc8ac883ac3c0078ce5ad3e288fbb3ffcc8a30c3a98c0fda0114d64fc44fca2\",\"license\":\"MIT\",\"urls\":[\"bzz-raw://87a7a5d2f6f63f84598af02b8c50ca2df2631cb8ba2453e8d95fcb17e4be9824\",\"dweb:/ipfs/QmR76hqtAcRqoFj33tmNjcWTLrgNsAaakYwnKZ8zoJtKei\"]},\"@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol\":{\"keccak256\":\"0xc3d946432c0ddbb1f846a0d3985be71299df331b91d06732152117f62f0be2b5\",\"license\":\"MIT\",\"urls\":[\"bzz-raw://4632c341a06ba5c079b51ca5a915efab4e6ab57735b37839b3e8365ff806a43e\",\"dweb:/ipfs/QmTHT3xHYed2wajEoA5qu7ii2BxLpPhQZHwAhtLK5Z7ANK\"]},\"@openzeppelin/contracts/utils/Address.sol\":{\"keccak256\":\"0x2ccf9d2313a313d41a791505f2b5abfdc62191b5d4334f7f7a82691c088a1c87\",\"license\":\"MIT\",\"urls\":[\"bzz-raw://b3a57d0854b2fdce6ebff933a48dca2445643d1eccfc27f00292e937f26c6a58\",\"dweb:/ipfs/QmW45rZooS9TqR4YXUbjRbtf2Bpb5ouSarBvfW1LdGprvV\"]},\"@openzeppelin/contracts/utils/Context.sol\":{\"keccak256\":\"0xe2e337e6dde9ef6b680e07338c493ebea1b5fd09b43424112868e9cc1706bca7\",\"license\":\"MIT\",\"urls\":[\"bzz-raw://6df0ddf21ce9f58271bdfaa85cde98b200ef242a05a3f85c2bc10a8294800a92\",\"dweb:/ipfs/QmRK2Y5Yc6BK7tGKkgsgn3aJEQGi5aakeSPZvS65PV8Xp3\"]},\"@openzeppelin/contracts/utils/cryptography/MerkleProof.sol\":{\"keccak256\":\"0xea64fbaccbf9d8c235cf6838240ddcebb97f9fc383660289e9dff32e4fb85f7a\",\"license\":\"MIT\",\"urls\":[\"bzz-raw://1e8a1dd0eac2fa865dc9a052bee01eec31677d7bc01b5b5aa825d820f3f1b343\",\"dweb:/ipfs/QmR8WuNeoAvJhnL7msQfQwaZEkwVnNyNDUNBL3Y616ohYa\"]},\"@openzeppelin/contracts/utils/math/SafeMath.sol\":{\"keccak256\":\"0xa2f576be637946f767aa56601c26d717f48a0aff44f82e46f13807eea1009a21\",\"license\":\"MIT\",\"urls\":[\"bzz-raw://973868f808e88e21a1a0a01d4839314515ee337ad096286c88e41b74dcc11fc2\",\"dweb:/ipfs/QmfYuZxRfx2J2xdk4EXN7jKg4bUYEMTaYk9BAw9Bqn4o2Y\"]},\"@openzeppelin/contracts/utils/math/SignedSafeMath.sol\":{\"keccak256\":\"0x62f53f262fabbbc6d8ab49488d8fce36370351aff2b8d3898d499d68995a71c2\",\"license\":\"MIT\",\"urls\":[\"bzz-raw://efd599513c2f313a3f5e9536beb2b80a0d2b3dd34202c174a707d81b7dc751ce\",\"dweb:/ipfs/QmdDiENVFSyWjfFskNLnViMH77DHg3oDthkSZk7dMzNNKB\"]},\"@uma/core/contracts/common/implementation/AncillaryData.sol\":{\"keccak256\":\"0x8ff33ac32d3e6de25de9e0ac2c0ff9a621f187fa97e9ee84092b327471baa3ce\",\"license\":\"AGPL-3.0-only\",\"urls\":[\"bzz-raw://0bbaed49756e8cf7ef405e132f441cd7a735ac6186a200b0179147e7d137b74a\",\"dweb:/ipfs/QmeSBJX5a61LZPxbkUKS2NF4LSxemgDwjD65fCAmyP7PX2\"]},\"@uma/core/contracts/common/implementation/FixedPoint.sol\":{\"keccak256\":\"0x996b97cc4fa5da4064e3aee500edc6972485d59a9334ceec81155e2c2f484dae\",\"license\":\"AGPL-3.0-only\",\"urls\":[\"bzz-raw://8d7c028926dc2b27e7dc103363dca8a43f60b3351f4a14bcb702660f95c68663\",\"dweb:/ipfs/QmXz4ieFjP5RxJ35F8GbPryYEGvFmxc4Gqx8EK7N57ixzT\"]},\"@uma/core/contracts/common/implementation/MultiCaller.sol\":{\"keccak256\":\"0x31f18055b14fd9eeb459c6d6a88d1a60921bf3755031f6db4b709c3e01d078f7\",\"urls\":[\"bzz-raw://1a002084305bc747b23e69e24cfd1f3aa730adc22dd76d1e077dc72bcffc41f0\",\"dweb:/ipfs/Qmb611uGKzhc2MHkMhqW3NG49FY3Tg1udh7zXttmPtfU2s\"]},\"@uma/core/contracts/common/implementation/Testable.sol\":{\"keccak256\":\"0x0254b45747293bb800373a58d123969adec0428f7be79dc941cab10fcad09918\",\"license\":\"AGPL-3.0-only\",\"urls\":[\"bzz-raw://537d694e3753596f507d071f283be9caeaad0010c444c9c9955d729affeb4907\",\"dweb:/ipfs/QmZ1WfVTBao11QaN6aygMhnt45UjRq77ZwfKPFmHiVSdaJ\"]},\"@uma/core/contracts/common/implementation/Timer.sol\":{\"keccak256\":\"0x9e0dd7389718bd5d1da910273a6f4cee98ee22bfc0c92bde0f0955c0e23adb5e\",\"license\":\"AGPL-3.0-only\",\"urls\":[\"bzz-raw://7ddac8d3cb76f8811156a11a7702d7c05b15a0f18c22b5abdc318723193f9266\",\"dweb:/ipfs/QmPxL7AU8NkURJaZ6WxXNcw88wGMSoPX4jbt7SMdPJqtYv\"]},\"@uma/core/contracts/common/interfaces/AddressWhitelistInterface.sol\":{\"keccak256\":\"0x22fb8588dff1d5cff76a28111d6c9b190765d99facd93c8ff3b54771f245c0d8\",\"license\":\"AGPL-3.0-only\",\"urls\":[\"bzz-raw://5ecd993f00de290a3c7bf21da23a9439cf2ccb22028316df92b79780ac8aa533\",\"dweb:/ipfs/QmTZ7x7U4EEzTacqapzSdFs2np5WNsqm4XeUBqzQxxDJei\"]},\"@uma/core/contracts/common/interfaces/ExpandedIERC20.sol\":{\"keccak256\":\"0xb8252039cba45f1c19cd677f150a9823a5d6e1845cad90e3041d97c96f273c26\",\"license\":\"AGPL-3.0-only\",\"urls\":[\"bzz-raw://95106656c95e12c30a2a4c482a859df6df55c3b56bb9f7835eb5c685ca3175d3\",\"dweb:/ipfs/QmcuJoX7T53vTCDcQK8WcCJdT1LzHS35vPmSVfg1DG32cd\"]},\"@uma/core/contracts/oracle/implementation/Constants.sol\":{\"keccak256\":\"0x36dcec83c5ac265b759b6a5559ec76088ce24854bf590ba66f808e8ecb59b97e\",\"license\":\"AGPL-3.0-only\",\"urls\":[\"bzz-raw://b6f16b1705220fe3692cca201d65993046b4cbb6dddbc35508c489606575bfc2\",\"dweb:/ipfs/QmdHvPibiSD7j9VJg73DaDPFBsCsWSxKpZJnVCSTErVTHC\"]},\"@uma/core/contracts/oracle/interfaces/FinderInterface.sol\":{\"keccak256\":\"0x9166fbfe08e954eb86d33c114fcde7ce4fd0dda5d9d28b31210582bfc769fa86\",\"license\":\"AGPL-3.0-only\",\"urls\":[\"bzz-raw://e611e12bcaaebfdf65b67c566ff1d34708e757f01a445bd87c55862e89383b81\",\"dweb:/ipfs/QmYNSq5oopTShdS6j4VWKqoLxmQSRKmWebCxw6K4LfmKrf\"]},\"@uma/core/contracts/oracle/interfaces/IdentifierWhitelistInterface.sol\":{\"keccak256\":\"0x9ae86a30dd1a8c03fb2c6d27be570bb30c4c0b13ac63cde8620b7e4b51d88dc9\",\"license\":\"AGPL-3.0-only\",\"urls\":[\"bzz-raw://a71d2aff48e075ecab56a9c9767775d1d77e04ec9191fed124e71003220549e3\",\"dweb:/ipfs/QmYPWsZXro6fzqpZY6UxQ5X8znEXfLp2sun8oXzdz8bTyc\"]},\"@uma/core/contracts/oracle/interfaces/OptimisticOracleInterface.sol\":{\"keccak256\":\"0x92e7280c1abd5f0c4fcd20247fc1b8428aaf4eeea59439c074d15fdaf9c64989\",\"license\":\"AGPL-3.0-only\",\"urls\":[\"bzz-raw://8d12bbcf0a91cef63c4767bffd047254599c5a1fce38e5e81d3005e102fdeef8\",\"dweb:/ipfs/QmTkd3AG9gdvBZq3HKCUW8eErvkguM2QqE3nUDGfvye3Yi\"]},\"@uma/core/contracts/oracle/interfaces/SkinnyOptimisticOracleInterface.sol\":{\"keccak256\":\"0x91d21e44a97b719106e8f97b99399a3d8dc3697badd01df06518892f38fe033f\",\"license\":\"AGPL-3.0-only\",\"urls\":[\"bzz-raw://68c350c822b256b43543ac4dd3dd1413ed95f25a9415d5dba4c562cd11d55716\",\"dweb:/ipfs/QmZyYeBnM59oPmWcK1KERNayg7xuHv12sLzzmqC42Lq76a\"]},\"@uma/core/contracts/oracle/interfaces/StoreInterface.sol\":{\"keccak256\":\"0xbb73671684309c91ad5ef3da1474051d03f2e7d5882bed7f5c4317e5d4c768df\",\"license\":\"AGPL-3.0-only\",\"urls\":[\"bzz-raw://32386544d3119fd0187a8c4e8b01c739f508ab863faa04345cabc2544081f9e8\",\"dweb:/ipfs/QmYszDURs1x75rsejZkGt9zCkASXnJtufbNsL3XHe2eJPQ\"]},\"contracts/HubPool.sol\":{\"keccak256\":\"0x2cb8242153ffcbc356e368c83b0182b428335ab3ce65cc1bef1224f9496a011f\",\"license\":\"GPL-3.0-only\",\"urls\":[\"bzz-raw://fe2e8c151710f3ebaf4fd9df6aec73fe18c848e4005c8a5d5ed5b67fd740920d\",\"dweb:/ipfs/QmRPLeRkw3ZkapGJu7ssJkg69PkFUkH6W2d2hamCYKNkaH\"]},\"contracts/HubPoolInterface.sol\":{\"keccak256\":\"0x990c28fe43a929f5d0524ebabed269965d759d1294df4e75880b9d30b34397ed\",\"license\":\"GPL-3.0-only\",\"urls\":[\"bzz-raw://22547221c38380e2c621e089d62084973d3e221bba9a0ad11cb1ae4a53a73e52\",\"dweb:/ipfs/QmfKenohv25a8G5knWaJzvJLQVFuyJzHR9Smc45VHV6gEH\"]},\"contracts/Lockable.sol\":{\"keccak256\":\"0xef490be5cb859c97c6f600f3b0db0d50c6e18f334d3c74c6d9e693a260eaec3e\",\"license\":\"AGPL-3.0-only\",\"urls\":[\"bzz-raw://ff9fc27e0d0046034b06552411f1be06a0a6f1060291e259b9905616482f9382\",\"dweb:/ipfs/QmV7GNM5PztsfSnpnzJ5pcoPi4czE8SnxRWSz3QNKrzMx6\"]},\"contracts/MerkleLib.sol\":{\"keccak256\":\"0xfec238b342924f5226ab994aa108a9917bc840a89cd34c2ee6c6806161ef3e0c\",\"license\":\"GPL-3.0-only\",\"urls\":[\"bzz-raw://7ba9cce91ae72dbf4224ded58ba26428cccc4bbd7bcdf930d71912bbcb1e478f\",\"dweb:/ipfs/QmWPpy7DHjSjk1evvTMN6XhPdBsTh6BRJnjVdHZ3D7fiNY\"]},\"contracts/SpokePoolInterface.sol\":{\"keccak256\":\"0x33257e146b1f3aecadcefded630c6a8d1308518d1992d84b963a734745ab96a5\",\"license\":\"GPL-3.0-only\",\"urls\":[\"bzz-raw://adc8273eb1fdd62b2e095b903733f4310637e9e396f26d6784c5d17cd498e264\",\"dweb:/ipfs/QmYoW47bnNVGvSKLWNrgoSrAkb9vHrDPvHDwEncYALBvVj\"]},\"contracts/interfaces/AdapterInterface.sol\":{\"keccak256\":\"0x60e1ed2205f90655fe4152a90709be15bc9550fb3faeaf9835fee22c095bab11\",\"license\":\"AGPL-3.0-only\",\"urls\":[\"bzz-raw://98cb02fd21defa131082d7f433abdc5d872044caf19aee0b6d253b3561249dcc\",\"dweb:/ipfs/QmbqrocBKc7z4Ne1syg9J2TuAqdZTUFmWAqxR3CzW3Nk92\"]},\"contracts/interfaces/LpTokenFactoryInterface.sol\":{\"keccak256\":\"0xbff9f636f087e2c5acc05be2da6fe26d3558f0ff6d270f8738bd8027b4ac8eff\",\"license\":\"AGPL-3.0-only\",\"urls\":[\"bzz-raw://15632b718000ab8036a2bbfea107515f5cf7102009728c6280e969ef402f4c15\",\"dweb:/ipfs/QmdsMySHkCVWUWGRw7RgfVV9H6cE1t6YcQt85owGCMTJdC\"]},\"contracts/interfaces/WETH9.sol\":{\"keccak256\":\"0x7b444d0840b1f76eee9bf39d74830f70644395613b96cce2d80fc50785a82eaa\",\"license\":\"GPL-3.0-only\",\"urls\":[\"bzz-raw://9241f8ea371edb800af4529a224c5ecc791b517b20a60cea69e2ebc51f7481ce\",\"dweb:/ipfs/QmTkRUXUrqhEvKBs1dcUypQ9n8ai9i8jH6AG1ziBRJTNvS\"]}},\"version\":1}", - "bytecode": "0x60806040527f49535f4143524f53535f56325f42554e444c455f56414c494400000000000000600d5565015d3ef79800600e556014805463ffffffff1916611c201790553480156200005057600080fd5b5060405162004f5a38038062004f5a833981016040819052620000739162000166565b600080546001600160a81b0319166001600160a01b03831617600160a01b179055620000a6620000a03390565b620000fb565b50600b80546001600160a01b03199081166001600160a01b0395861617909155600c8054821693851693909317909255600a8054831691841691909117905560015460108054919093169116179055620001ce565b600180546001600160a01b038381166001600160a01b0319831681179093556040519116919082907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e090600090a35050565b6001600160a01b03811681146200016357600080fd5b50565b600080600080608085870312156200017d57600080fd5b84516200018a816200014d565b60208601519094506200019d816200014d565b6040860151909350620001b0816200014d565b6060860151909250620001c3816200014d565b939692955090935050565b614d7c80620001de6000396000f3fe60806040526004361061025e5760003560e01c806369b6250211610144578063ad68eda5116100b6578063dd70e5e81161007a578063dd70e5e8146107a3578063e0f339e3146107c3578063e40064d7146107e3578063e460e35c14610810578063f0056a7d14610830578063f2fde38b146108d55761026d565b8063ad68eda514610703578063b60c2d7d14610723578063b9a3c84c14610743578063c28f439214610763578063cd949995146107835761026d565b806380f323a71161010857806380f323a71461064f5780638bda0c00146106655780638da5cb5b14610685578063a16fd6e9146106a3578063a5841194146106c3578063ac9650d8146106e35761026d565b806369b625021461026b5780636ad0690a146105d2578063715018a61461060457806376ec08dd146106195780637998a1c4146106395761026d565b806322395aaa116101dd57806333dc09ca116101a157806333dc09ca146104a357806338b9e2ce146104c35780633fc8cef3146104e35780634144fd61146105035780634f7473ff146105a957806356688700146105bf5761026d565b806322395aaa1461041957806322f8e5661461042e578063240f475f1461044e57806329cb924d1461046e5780632d0f6f84146104835761026d565b80630c501af9116102245780630c501af91461036b5780630ee28a881461038b57806311cfc159146103ab5780631b107ee0146103c15780631c39c38d146103e15761026d565b8062660b5314610275578062c9920614610295578063084d0513146102b557806309474ae2146102e85780630a2dc9ec146103495761026d565b3661026d5761026b6108f5565b005b61026b6108f5565b34801561028157600080fd5b5061026b610290366004613ee8565b610973565b3480156102a157600080fd5b5061026b6102b0366004613f14565b610a51565b3480156102c157600080fd5b506102d56102d0366004613ee8565b610c34565b6040519081526020015b60405180910390f35b3480156102f457600080fd5b50610329610303366004613f14565b600960205260009081526040902080546001909101546001600160a01b03918216911682565b604080516001600160a01b039384168152929091166020830152016102df565b34801561035557600080fd5b5061035e610c60565b6040516102df9190613f85565b34801561037757600080fd5b5061026b610386366004613f98565b610e2f565b34801561039757600080fd5b5061026b6103a6366004613fc3565b610ec1565b3480156103b757600080fd5b506102d5600e5481565b3480156103cd57600080fd5b5061026b6103dc366004614005565b611083565b3480156103ed57600080fd5b50600054610401906001600160a01b031681565b6040516001600160a01b0390911681526020016102df565b34801561042557600080fd5b5061026b6111e4565b34801561043a57600080fd5b5061026b610449366004613f14565b611599565b34801561045a57600080fd5b50601054610401906001600160a01b031681565b34801561047a57600080fd5b506102d56115f4565b34801561048f57600080fd5b5061026b61049e366004613f98565b611680565b3480156104af57600080fd5b5061026b6104be366004613ee8565b61171f565b3480156104cf57600080fd5b5061026b6104de3660046141d5565b611930565b3480156104ef57600080fd5b50600a54610401906001600160a01b031681565b34801561050f57600080fd5b5060025460035460045460055460065461055a94939291906001600160a01b0381169060ff600160a01b8204811691600160a81b81049091169063ffffffff600160b01b9091041688565b6040805198895260208901979097529587019490945260608601929092526001600160a01b03166080850152151560a084015260ff1660c083015263ffffffff1660e0820152610100016102df565b3480156105b557600080fd5b506102d560115481565b61026b6105cd366004613ee8565b611c11565b3480156105de57600080fd5b506014546105ef9063ffffffff1681565b60405163ffffffff90911681526020016102df565b34801561061057600080fd5b5061026b611ea2565b34801561062557600080fd5b50600b54610401906001600160a01b031681565b34801561064557600080fd5b506102d5600d5481565b34801561065b57600080fd5b506102d560135481565b34801561067157600080fd5b5061026b6106803660046142ed565b611ed6565b34801561069157600080fd5b506001546001600160a01b0316610401565b3480156106af57600080fd5b506102d56106be366004613f98565b61204d565b3480156106cf57600080fd5b5061026b6106de366004613f98565b612079565b6106f66106f1366004614354565b61209a565b6040516102df91906143c8565b34801561070f57600080fd5b5061040161071e36600461442a565b61223f565b34801561072f57600080fd5b5061026b61073e366004613f98565b612274565b34801561074f57600080fd5b50600c54610401906001600160a01b031681565b34801561076f57600080fd5b50601254610401906001600160a01b031681565b34801561078f57600080fd5b5061026b61079e366004614462565b612434565b3480156107af57600080fd5b5061026b6107be3660046144af565b6124f2565b3480156107cf57600080fd5b506102d56107de366004613f98565b61253e565b3480156107ef57600080fd5b506102d56107fe366004613f98565b600f6020526000908152604090205481565b34801561081c57600080fd5b5061026b61082b366004614533565b612559565b34801561083c57600080fd5b5061089361084b366004613f98565b60086020526000908152604090208054600182015460028301546003909301546001600160a01b03831693600160a01b840460ff1693600160a81b900463ffffffff16929186565b604080516001600160a01b039097168752941515602087015263ffffffff909316938501939093526060840152608083019190915260a082015260c0016102df565b3480156108e157600080fd5b5061026b6108f0366004613f98565b61261f565b600054600160a01b900460ff161561097157600a60009054906101000a90046001600160a01b03166001600160a01b031663d0e30db0346040518263ffffffff1660e01b81526004016000604051808303818588803b15801561095757600080fd5b505af115801561096b573d6000803e3d6000fd5b50505050505b565b6001546001600160a01b031633146109a65760405162461bcd60e51b815260040161099d9061456a565b60405180910390fd5b670de0b6b3a76400008111156109fe5760405162461bcd60e51b815260206004820152601960248201527f4261642070726f746f636f6c4665654361707475726550637400000000000000604482015260640161099d565b601080546001600160a01b0319166001600160a01b03841690811790915560118290556040518291907fc1993b89fd79a19ece7beb067ddc8534ca26d29c0ff94ea2f53b4a508d1eedc990600090a35050565b6001546001600160a01b03163314610a7b5760405162461bcd60e51b815260040161099d9061456a565b600654600160a81b900460ff1615610aa55760405162461bcd60e51b815260040161099d9061459f565b610aad6126b7565b610ab5612710565b600c546040516302abf57960e61b8152721259195b9d1a599a595c95da1a5d195b1a5cdd606a1b60048201526000916001600160a01b03169063aafd5e4090602401602060405180830381865afa158015610b14573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610b3891906145d6565b6040516390978d1b60e01b8152600481018490529091506001600160a01b038216906390978d1b90602401602060405180830381865afa158015610b80573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610ba491906145f3565b610bf05760405162461bcd60e51b815260206004820152601860248201527f4964656e746966696572206e6f7420737570706f727465640000000000000000604482015260640161099d565b600d8290556040518281527ff45367c278fcceff23d601ce4bdd191e5bd61687ff9f29dc7276a08fe54c0c5d9060200160405180910390a150610c3161271f565b50565b6000610c3e6126b7565b610c46612710565b610c508383612734565b9050610c5a61271f565b92915050565b6040805160208082018352600082528251808401909352601a83527f7265717565737445787069726174696f6e54696d657374616d7000000000000090830152600654606092610cbd9291600160b01b900463ffffffff16612829565b60408051808201909152601f81527f756e636c61696d6564506f6f6c526562616c616e63654c656166436f756e74006020820152600654919250610d0d91839190600160a81b900460ff16612829565b9050610d4881604051806040016040528060118152602001701c1bdbdb149958985b185b98d9549bdbdd607a1b81525060026000015461286f565b9050610d8381604051806040016040528060118152602001701c995b185e595c9499599d5b99149bdbdd607a1b81525060026001015461286f565b9050610db9816040518060400160405280600d81526020016c1cdb1bddd4995b185e549bdbdd609a1b815250600280015461286f565b9050610df0816040518060400160405280600d81526020016c0636c61696d65644269744d617609c1b815250600260030154612829565b604080518082019091526008815267383937b837b9b2b960c11b6020820152600654919250610e2a918391906001600160a01b031661288a565b905090565b6001546001600160a01b03163314610e595760405162461bcd60e51b815260040161099d9061456a565b6001600160a01b03818116600081815260086020908152604091829020805460ff60a01b1981169091558251938452909316928201929092527fac111b3b527b307393c94d98f26140effb71411054466818be97912d2d65f77691015b60405180910390a150565b610ec96126b7565b610ed1612710565b600a546001600160a01b0384811691161480610eeb575080155b610f275760405162461bcd60e51b815260206004820152600d60248201526c086c2dce840e6cadcc840cae8d609b1b604482015260640161099d565b6000670de0b6b3a7640000610f3b856128a5565b610f459085614626565b610f4f919061465b565b6001600160a01b038581166000908152600860205260409081902054905163079cc67960e41b81523360048201526024810187905292935016906379cc6790906044016020604051808303816000875af1158015610fb1573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610fd591906145f3565b506001600160a01b0384166000908152600860205260408120600201805483929061100190849061466f565b9091555050811561101b57611016338261299d565b61102f565b61102f6001600160a01b0385163383612a58565b604080518281526020810185905233916001600160a01b038716917fcda1185f28599e6bd14ab8a68b3c30a11e1dce4256b5e67e94dd3fd846a6c589910160405180910390a35061107e61271f565b505050565b6001546001600160a01b031633146110ad5760405162461bcd60e51b815260040161099d9061456a565b6110b56126b7565b6110bd612710565b801561110a5781600760006110d3888789612abb565b815260200190815260200160002060006101000a8154816001600160a01b0302191690836001600160a01b03160217905550611138565b60076000611119878688612abb565b8152602081019190915260400160002080546001600160a01b03191690555b6040516001600160a01b038416602482015260448101859052811515606482015261119190869060840160408051601f198184030181529190526020810180516001600160e01b031663272751c760e01b179052612afb565b604080516001600160a01b0384811682528315156020830152851691869188917f6b6ad6b78778f6301df516688e316a2d4183a1ea99adae498c8e119debe9b146910160405180910390a461096b61271f565b6111ec6126b7565b6111f4612710565b60006111fe6115f4565b60065490915063ffffffff600160b01b909104811690821611156112645760405162461bcd60e51b815260206004820152601760248201527f5265717565737420706173736564206c6976656e657373000000000000000000604482015260640161099d565b600061126e610c60565b9050600061127a612c66565b90506013548111156112975761128f82612d4e565b505050611572565b60006112a1612e34565b6013546012549192506112bf916001600160a01b0316908390612eba565b806001600160a01b031663af355d1e600d548686601260009054906101000a90046001600160a01b03166000886013546112f9919061466f565b6014546006546040516001600160e01b031960e08b901b1681526113409897969594939263ffffffff16916001600160a01b031690670de0b6b3a764000090600401614686565b6020604051808303816000875af192505050801561137b575060408051601f3d908101601f19168201909252611378918101906146f1565b60015b6113915761138883612d4e565b50505050611572565b6012546113a9906001600160a01b0316836000612f72565b5060408051610160810182526006546001600160a01b0390811682526000602083018190526012549091169282019290925260608101829052670de0b6b3a7640000608082015260a0810182905260145460c082019061140f9063ffffffff168861470a565b63ffffffff1681526020016000815260200184815260200184601354611435919061466f565b815260145463ffffffff90811660209092019190915260135460125492935061146c926001600160a01b0316913391309161308716565b601354601254611489916001600160a01b03909116908490612eba565b600d5460405163139c641960e31b81526001600160a01b03841691639ce320c8916114c1919089908990879033903090600401614732565b6020604051808303816000875af11580156114e0573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061150491906146f1565b50336001600160a01b03167f4c789f44a7398cb63bf580e03ad5a7ec8228ea4935d3c1a1135eb449f0bb301b8686604051611540929190614831565b60405180910390a2505060006002819055600381905560048190556005555050600680546001600160d01b0319169055505b61159161157d612e34565b6012546001600160a01b0316906000612f72565b61097161271f565b6000546001600160a01b03166115ae57600080fd5b60005460405163117c72b360e11b8152600481018390526001600160a01b03909116906322f8e56690602401600060405180830381600087803b15801561095757600080fd5b600080546001600160a01b03161561167b5760008054906101000a90046001600160a01b03166001600160a01b03166329cb924d6040518163ffffffff1660e01b8152600401602060405180830381865afa158015611657573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610e2a91906146f1565b504290565b6116886126b7565b611690612710565b6010546001600160a01b038281166000818152600f60205260409020546116bc93919290911690612a58565b6001600160a01b0381166000818152600f60205260408082205490519092917f74740239d7d696c84422b720e125e1f47c4138c66d1f4d2a48e99f4197cdb79c91a36001600160a01b0381166000908152600f6020526040812055610c3161271f565b6001546001600160a01b031633146117495760405162461bcd60e51b815260040161099d9061456a565b600654600160a81b900460ff16156117735760405162461bcd60e51b815260040161099d9061459f565b61177b6126b7565b611783612710565b600c546040516302abf57960e61b81527210dbdb1b185d195c985b15da1a5d195b1a5cdd606a1b60048201526000916001600160a01b03169063aafd5e4090602401602060405180830381865afa1580156117e2573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061180691906145d6565b604051631d1d5b3960e11b81526001600160a01b03858116600483015291925090821690633a3ab67290602401602060405180830381865afa158015611850573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061187491906145f3565b6118b35760405162461bcd60e51b815260206004820152601060248201526f139bdd081bdb881dda1a5d195b1a5cdd60821b604482015260640161099d565b601280546001600160a01b0319166001600160a01b0385161790556118d6612c66565b6118e09083614850565b60138190556040519081526001600160a01b038416907fbfa9a96010167e98ce8c004f718932cbbfd33a58d681c752e693be7d457a1b3b9060200160405180910390a25061192c61271f565b5050565b6119386126b7565b611940612710565b600654600160b01b900463ffffffff166119586115f4565b1161199b5760405162461bcd60e51b81526020600482015260136024820152724e6f7420706173736564206c6976656e65737360681b604482015260640161099d565b6005546080830151600160ff9091161b90811614156119ee5760405162461bcd60e51b815260206004820152600f60248201526e105b1c9958591e4818db185a5b5959608a1b604482015260640161099d565b6002546119fc9083836130bf565b611a345760405162461bcd60e51b81526020600482015260096024820152682130b210283937b7b360b91b604482015260640161099d565b81516000908152600960205260409020546001600160a01b0316611a915760405162461bcd60e51b815260206004820152601460248201527327379030b230b83a32b9103337b91031b430b4b760611b604482015260640161099d565b81516000908152600960205260409020600101546001600160a01b031680611afb5760405162461bcd60e51b815260206004820152601860248201527f556e696e697469616c697a65642073706f6b6520706f6f6c0000000000000000604482015260640161099d565b611b11600260030154846080015160ff166130fa565b60055560068054600160a81b900460ff16906015611b2e83614868565b91906101000a81548160ff021916908360ff16021790555050611b648184600001518560a001518660400151876020015161315d565b611b72818460000151613439565b600654600160a81b900460ff16611ba457600654601354601254611ba4926001600160a01b0391821692911690612a58565b336001600160a01b03168360000151846080015160ff167f269bcb1817facd431d586b474ce46fe1ca2921cd1a19314c01a606804ea8b9458660a00151876020015188604001518960600151604051611c0094939291906148f9565b60405180910390a45061192c61271f565b611c196126b7565b611c21612710565b6001600160a01b038216600090815260086020526040902054600160a01b900460ff16611c845760405162461bcd60e51b8152602060048201526011602482015270151bdad95b881b9bdd08195b98589b1959607a1b604482015260640161099d565b600a546001600160a01b038381169116148015611ca057508034145b80611ca9575034155b611ce55760405162461bcd60e51b815260206004820152600d60248201526c426164206d73672e76616c756560981b604482015260640161099d565b6000611cf0836128a5565b611d0283670de0b6b3a7640000614626565b611d0c919061465b565b6001600160a01b03848116600090815260086020526040908190205490516340c10f1960e01b81523360048201526024810184905292935016906340c10f19906044016020604051808303816000875af1158015611d6e573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611d9291906145f3565b506001600160a01b03831660009081526008602052604081206002018054849290611dbe908490614850565b9091555050600a546001600160a01b038481169116148015611de05750600034115b15611e3e57826001600160a01b031663d0e30db0346040518263ffffffff1660e01b81526004016000604051808303818588803b158015611e2057600080fd5b505af1158015611e34573d6000803e3d6000fd5b5050505050611e53565b611e536001600160a01b038416333085613087565b604080518381526020810183905233916001600160a01b038616917f3c69701a61c79a92ef9692903aaa0068bce8771361ecb09547391e4fb4df8537910160405180910390a35061192c61271f565b6001546001600160a01b03163314611ecc5760405162461bcd60e51b815260040161099d9061456a565b6109716000613542565b611ede6126b7565b611ee6612710565b600654600160a81b900460ff1615611f105760405162461bcd60e51b815260040161099d9061459f565b60008460ff1611611f635760405162461bcd60e51b815260206004820181905260248201527f42756e646c65206d7573742068617665206174206c656173742031206c656166604482015260640161099d565b60145460009063ffffffff16611f776115f4565b611f81919061470a565b60006005556006805460028790556003869055600485905560ff8816600160a81b0263ffffffff808516600160b01b0260ff60a81b19166001600160d01b031990931692909217176001600160a01b03191633908117909255601354601254939450611ffb936001600160a01b0316929130919061308716565b336001600160a01b031683857f50e585dd6361c7cb2613ce2334814bb2a789f5a8ad4b161fe0e248043737d1d284898b8860405161203c9493929190614946565b60405180910390a45061096b61271f565b60006120576126b7565b61205f612710565b61206a826000612734565b905061207461271f565b919050565b6120816126b7565b612089612710565b61209281613594565b610c3161271f565b606034156120ea5760405162461bcd60e51b815260206004820152601b60248201527f4f6e6c79206d756c746963616c6c207769746820302076616c75650000000000604482015260640161099d565b816001600160401b0381111561210257612102614064565b60405190808252806020026020018201604052801561213557816020015b60608152602001906001900390816121205790505b50905060005b8281101561223857600080308686858181106121595761215961497f565b905060200281019061216b9190614995565b6040516121799291906149e2565b600060405180830381855af49150503d80600081146121b4576040519150601f19603f3d011682016040523d82523d6000602084013e6121b9565b606091505b509150915081612205576044815110156121d257600080fd5b600481019050808060200190518101906121ec91906149f2565b60405162461bcd60e51b815260040161099d9190613f85565b808484815181106122185761221861497f565b60200260200101819052505050808061223090614a5f565b91505061213b565b5092915050565b600060076000612250868686612abb565b81526020810191909152604001600020546001600160a01b031690505b9392505050565b6001546001600160a01b0316331461229e5760405162461bcd60e51b815260040161099d9061456a565b6122a66126b7565b6122ae612710565b6001600160a01b038181166000908152600860205260409020541661236d57600b54604051637e178db760e11b81526001600160a01b0383811660048301529091169063fc2f1b6e906024016020604051808303816000875af1158015612319573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061233d91906145d6565b6001600160a01b03828116600090815260086020526040902080546001600160a01b031916929091169190911790555b6001600160a01b0381166000908152600860205260409020805460ff60a01b1916600160a01b17905561239e6115f4565b6001600160a01b0380831660009081526008602052604090819020805463ffffffff94909416600160a81b0263ffffffff60a81b198516811790915590517f04e291c80180d65a57b5bf1bed775777ec0d6f283ef34bcf130712714d8bb7f7936124249386938116911617906001600160a01b0392831681529116602082015260400190565b60405180910390a1610c3161271f565b6001546001600160a01b0316331461245e5760405162461bcd60e51b815260040161099d9061456a565b6102588163ffffffff16116124aa5760405162461bcd60e51b8152602060048201526012602482015271131a5d995b995cdcc81d1bdbc81cda1bdc9d60721b604482015260640161099d565b6014805463ffffffff191663ffffffff83169081179091556040519081527f04dd1d84d387f404568a7954b5e398518bdd716e1a8f4a790be9a1a225ad934790602001610eb6565b6001546001600160a01b0316331461251c5760405162461bcd60e51b815260040161099d9061456a565b6125246126b7565b61252c612710565b6125368282612afb565b61192c61271f565b60006125486126b7565b612550612710565b61206a826128a5565b6001546001600160a01b031633146125835760405162461bcd60e51b815260040161099d9061456a565b6040805180820182526001600160a01b03848116808352848216602080850182815260008a815260098352879020955186549086166001600160a01b031991821617875590516001909601805496909516951694909417909255835187815292830152918101919091527f36050d958750e6ac3aa674ac7bbe8d0ae6a2f7d4b808e8c2c42c1f22fc9fc4bb9060600160405180910390a1505050565b6001546001600160a01b031633146126495760405162461bcd60e51b815260040161099d9061456a565b6001600160a01b0381166126ae5760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201526564647265737360d01b606482015260840161099d565b610c3181613542565b600054600160a01b900460ff166109715760405162461bcd60e51b815260206004820152601f60248201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c00604482015260640161099d565b6000805460ff60a01b19169055565b6000805460ff60a01b1916600160a01b179055565b600061273f83613594565b6001600160a01b038381166000908152600860209081526040808320815160c08101835281549586168152600160a01b860460ff16151593810193909352600160a81b90940463ffffffff16908201526001830154606082018190526002840154608083015260039093015460a08201529181126127be5760006127c4565b81606001515b905060006127d28286614850565b905060008284608001516127e69190614850565b90508061280157670de0b6b3a7640000945050505050610c5a565b8061281483670de0b6b3a7640000614626565b61281e919061465b565b979650505050505050565b6060600061283785856136e3565b9050848161284485613725565b60405160200161285693929190614a7a565b6040516020818303038152906040529150509392505050565b6060600061287d85856136e3565b905084816128448561384d565b6060600061289885856136e3565b905084816128448561388e565b6001600160a01b038082166000908152600860209081526040808320805482516318160ddd60e01b8152925194959194869491909216926318160ddd92600480830193928290030181865afa158015612902573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061292691906146f1565b90508061293e5750670de0b6b3a76400009392505050565b612947826138e5565b61295084613594565b600082600301548360010154846002015461296b9190614abd565b6129759190614afe565b90508161298a82670de0b6b3a7640000614626565b612994919061465b565b95945050505050565b6001600160a01b0382163b156129c457600a5461192c906001600160a01b03168383612a58565b600a54604051632e1a7d4d60e01b8152600481018390526001600160a01b0390911690632e1a7d4d90602401600060405180830381600087803b158015612a0a57600080fd5b505af1158015612a1e573d6000803e3d6000fd5b50506040516001600160a01b038516925083156108fc02915083906000818181858888f1935050505015801561107e573d6000803e3d6000fd5b6040516001600160a01b03831660248201526044810182905261107e90849063a9059cbb60e01b906064015b60408051601f198184030181529190526020810180516001600160e01b03166001600160e01b03199093169290921790915261394d565b604080516020808201959095526001600160a01b039390931683820152606080840192909252805180840390920182526080909201909152805191012090565b6000828152600960205260409020546001600160a01b031680612b605760405162461bcd60e51b815260206004820152601760248201527f41646170746572206e6f7420696e697469616c697a6564000000000000000000604482015260640161099d565b6000838152600960205260408082206001015490516001600160a01b0380851692612b92929116908690602401614b3d565b60408051601f198184030181529181526020820180516001600160e01b0316637375c56f60e11b17905251612bc79190614b61565b600060405180830381855af49150503d8060008114612c02576040519150601f19603f3d011682016040523d82523d6000602084013e612c07565b606091505b5050905080612c285760405162461bcd60e51b815260040161099d90614b7d565b837f218987b934c2f6bc596136829fbf43a5fef4d6fafce41f3f6254d9a870c2deec84604051612c589190613f85565b60405180910390a250505050565b600c546040516302abf57960e61b81526453746f726560d81b60048201526000916001600160a01b03169063aafd5e4090602401602060405180830381865afa158015612cb7573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190612cdb91906145d6565b601254604051635b97aadd60e01b81526001600160a01b039182166004820152911690635b97aadd90602401602060405180830381865afa158015612d24573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190612d489190614baa565b51919050565b60125460065460135460405163a9059cbb60e01b81526001600160a01b039283166004820152602481019190915291169063a9059cbb906044016020604051808303816000875af1158015612da7573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190612dcb91906145f3565b506000600281905560038190556004819055600555600680546001600160d01b0319169055337f1d2f9274429d71a4bfb9fe52ed39d766c4d0f7b072f0989cf7072229fbc63328612e1a6115f4565b83604051612e29929190614beb565b60405180910390a250565b600c546040516302abf57960e61b815275536b696e6e794f7074696d69737469634f7261636c6560501b60048201526000916001600160a01b03169063aafd5e4090602401602060405180830381865afa158015612e96573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610e2a91906145d6565b604051636eb1769f60e11b81523060048201526001600160a01b038381166024830152600091839186169063dd62ed3e90604401602060405180830381865afa158015612f0b573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190612f2f91906146f1565b612f399190614850565b6040516001600160a01b038516602482015260448101829052909150612f6c90859063095ea7b360e01b90606401612a84565b50505050565b801580612fec5750604051636eb1769f60e11b81523060048201526001600160a01b03838116602483015284169063dd62ed3e90604401602060405180830381865afa158015612fc6573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190612fea91906146f1565b155b6130575760405162461bcd60e51b815260206004820152603660248201527f5361666545524332303a20617070726f76652066726f6d206e6f6e2d7a65726f60448201527520746f206e6f6e2d7a65726f20616c6c6f77616e636560501b606482015260840161099d565b6040516001600160a01b03831660248201526044810182905261107e90849063095ea7b360e01b90606401612a84565b6040516001600160a01b0380851660248301528316604482015260648101829052612f6c9085906323b872dd60e01b90608401612a84565b60006130f28285856040516020016130d79190614c04565b60405160208183030381529060405280519060200120613a1f565b949350505050565b600060ff8211156131435760405162461bcd60e51b8152602060048201526013602482015272496e646578206f7574206f6620626f756e647360681b604482015260640161099d565b61314f61010083614c90565b6001901b8317905092915050565b6000848152600960205260408120546001600160a01b0316905b84518163ffffffff161015613430576000858263ffffffff16815181106131a0576131a061497f565b602002602001015190506000600760006131bb46858c612abb565b81526020810191909152604001600020546001600160a01b031690508061321c5760405162461bcd60e51b8152602060048201526015602482015274149bdd5d19481b9bdd081dda1a5d195b1a5cdd1959605a1b604482015260640161099d565b6000868463ffffffff16815181106132365761323661497f565b602002602001015113156133f2576000846001600160a01b03168383898763ffffffff168151811061326a5761326a61497f565b60209081029190910101516040516001600160a01b03938416602482015291831660448301526064820152908c16608482015260a40160408051601f198184030181529181526020820180516001600160e01b03166314b231d760e21b179052516132d59190614b61565b600060405180830381855af49150503d8060008114613310576040519150601f19603f3d011682016040523d82523d6000602084013e613315565b606091505b50509050806133365760405162461bcd60e51b815260040161099d90614b7d565b868463ffffffff168151811061334e5761334e61497f565b602002602001015160086000856001600160a01b03166001600160a01b03168152602001908152602001600020600101600082825461338d9190614abd565b92505081905550868463ffffffff16815181106133ac576133ac61497f565b602002602001015160086000856001600160a01b03166001600160a01b0316815260200190815260200160002060020160008282546133eb919061466f565b9091555050505b61341b82868563ffffffff168151811061340e5761340e61497f565b6020026020010151613a35565b5050808061342890614ca4565b915050613177565b50505050505050565b600081815260096020526040808220546003546004549251602481019190915260448101929092526001600160a01b031691908290859060640160408051601f198184030181529181526020820180516001600160e01b031663124e93e160e21b179052516134ac929190602401614b3d565b60408051601f198184030181529181526020820180516001600160e01b0316637375c56f60e11b179052516134e19190614b61565b600060405180830381855af49150503d806000811461351c576040519150601f19603f3d011682016040523d82523d6000602084013e613521565b606091505b5050905080612f6c5760405162461bcd60e51b815260040161099d90614b7d565b600180546001600160a01b038381166001600160a01b0319831681179093556040519116919082907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e090600090a35050565b6040516370a0823160e01b81523060048201526000906001600160a01b038316906370a0823190602401602060405180830381865afa1580156135db573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906135ff91906146f1565b6012549091506000906001600160a01b03848116911614801561362d5750600654600160a81b900460ff1615155b6136375781613644565b601354613644908361466f565b6001600160a01b03841660009081526008602052604090206002015490915081111561107e576001600160a01b038316600090815260086020526040902060020154613690908261466f565b6001600160a01b038416600090815260086020526040812060010180549091906136bb908490614afe565b90915550506001600160a01b0383166000908152600860205260409020600201819055505050565b81516060901561371457816040516020016136fe9190614cc8565b6040516020818303038152906040529050610c5a565b816040516020016136fe9190614cfc565b6060816137495750506040805180820190915260018152600360fc1b602082015290565b8160005b8115613773578061375d81614a5f565b915061376c9050600a8361465b565b915061374d565b6000816001600160401b0381111561378d5761378d614064565b6040519080825280601f01601f1916602001820160405280156137b7576020820181803683370190505b509050815b8515613844576137cd60018261466f565b905060006137dc600a8861465b565b6137e790600a614626565b6137f1908861466f565b6137fc906030614d21565b905060008160f81b9050808484815181106138195761381961497f565b60200101906001600160f81b031916908160001a90535061383b600a8961465b565b975050506137bc565b50949350505050565b606061385c608083901c613b08565b61386583613b08565b6040805160208101939093528201526060015b6040516020818303038152906040529050919050565b60606138a66001600160801b03602084901c16613b08565b6138c18360601b6bffffffffffffffffffffffff1916613b08565b6040516020016138789291909182526001600160c01b031916602082015260280190565b6003810154815460009161390591600160a81b900463ffffffff16613ca1565b90508082600301600082825461391b919061466f565b9091555061392990506115f4565b825463ffffffff91909116600160a81b0263ffffffff60a81b199091161790915550565b60006139a2826040518060400160405280602081526020017f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c6564815250856001600160a01b0316613cf69092919063ffffffff16565b80519091501561107e57808060200190518101906139c091906145f3565b61107e5760405162461bcd60e51b815260206004820152602a60248201527f5361666545524332303a204552433230206f7065726174696f6e20646964206e6044820152691bdd081cdd58d8d9595960b21b606482015260840161099d565b600082613a2c8584613d05565b14949350505050565b6000670de0b6b3a764000060115483613a4e9190614626565b613a58919061465b565b90506000613a66828461466f565b90508015613acf576001600160a01b03841660009081526008602052604081206003018054839290613a99908490614850565b90915550506001600160a01b03841660009081526008602052604081206001018054839290613ac9908490614abd565b90915550505b8115612f6c576001600160a01b0384166000908152600f602052604081208054849290613afd908490614850565b909155505050505050565b6000808260001c9050806001600160801b03169050806801000000000000000002811777ffffffffffffffff0000000000000000ffffffffffffffff169050806401000000000281177bffffffff00000000ffffffff00000000ffffffff00000000ffffffff16905080620100000281177dffff0000ffff0000ffff0000ffff0000ffff0000ffff0000ffff0000ffff169050806101000281177eff00ff00ff00ff00ff00ff00ff00ff00ff00ff00ff00ff00ff00ff00ff00ff1690508060100281177f0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f16905060006008827f08080808080808080808080808080808080808080808080808080808080808081681613c2357613c23614645565b0460047f040404040404040404040404040404040404040404040404040404040404040484160460027f020202020202020202020202020202020202020202020202020202020202020285160417166027029091017f3030303030303030303030303030303030303030303030303030303030303030019392505050565b60008082613cad6115f4565b613cb7919061466f565b90506000670de0b6b3a764000082600e5487613cd39190614626565b613cdd9190614626565b613ce7919061465b565b90508481106130f25784612994565b60606130f28484600085613d79565b600081815b8451811015613d71576000858281518110613d2757613d2761497f565b60200260200101519050808311613d4d5760008381526020829052604090209250613d5e565b600081815260208490526040902092505b5080613d6981614a5f565b915050613d0a565b509392505050565b606082471015613dda5760405162461bcd60e51b815260206004820152602660248201527f416464726573733a20696e73756666696369656e742062616c616e636520666f6044820152651c8818d85b1b60d21b606482015260840161099d565b6001600160a01b0385163b613e315760405162461bcd60e51b815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e7472616374000000604482015260640161099d565b600080866001600160a01b03168587604051613e4d9190614b61565b60006040518083038185875af1925050503d8060008114613e8a576040519150601f19603f3d011682016040523d82523d6000602084013e613e8f565b606091505b509150915061281e82828660608315613ea957508161226d565b825115613eb95782518084602001fd5b8160405162461bcd60e51b815260040161099d9190613f85565b6001600160a01b0381168114610c3157600080fd5b60008060408385031215613efb57600080fd5b8235613f0681613ed3565b946020939093013593505050565b600060208284031215613f2657600080fd5b5035919050565b60005b83811015613f48578181015183820152602001613f30565b83811115612f6c5750506000910152565b60008151808452613f71816020860160208601613f2d565b601f01601f19169290920160200192915050565b60208152600061226d6020830184613f59565b600060208284031215613faa57600080fd5b813561226d81613ed3565b8015158114610c3157600080fd5b600080600060608486031215613fd857600080fd5b8335613fe381613ed3565b9250602084013591506040840135613ffa81613fb5565b809150509250925092565b600080600080600060a0868803121561401d57600080fd5b8535945060208601359350604086013561403681613ed3565b9250606086013561404681613ed3565b9150608086013561405681613fb5565b809150509295509295909350565b634e487b7160e01b600052604160045260246000fd5b60405160c081016001600160401b038111828210171561409c5761409c614064565b60405290565b604051601f8201601f191681016001600160401b03811182821017156140ca576140ca614064565b604052919050565b60006001600160401b038211156140eb576140eb614064565b5060051b60200190565b600082601f83011261410657600080fd5b8135602061411b614116836140d2565b6140a2565b82815260059290921b8401810191818101908684111561413a57600080fd5b8286015b84811015614155578035835291830191830161413e565b509695505050505050565b803560ff8116811461207457600080fd5b600082601f83011261418257600080fd5b81356020614192614116836140d2565b82815260059290921b840181019181810190868411156141b157600080fd5b8286015b848110156141555780356141c881613ed3565b83529183019183016141b5565b600080604083850312156141e857600080fd5b82356001600160401b03808211156141ff57600080fd5b9084019060c0828703121561421357600080fd5b61421b61407a565b8235815260208301358281111561423157600080fd5b61423d888286016140f5565b60208301525060408301358281111561425557600080fd5b614261888286016140f5565b60408301525060608301358281111561427957600080fd5b614285888286016140f5565b60608301525061429760808401614160565b608082015260a0830135828111156142ae57600080fd5b6142ba88828601614171565b60a083015250935060208501359150808211156142d657600080fd5b506142e3858286016140f5565b9150509250929050565b600080600080600060a0868803121561430557600080fd5b85356001600160401b0381111561431b57600080fd5b614327888289016140f5565b95505061433660208701614160565b94979496505050506040830135926060810135926080909101359150565b6000806020838503121561436757600080fd5b82356001600160401b038082111561437e57600080fd5b818501915085601f83011261439257600080fd5b8135818111156143a157600080fd5b8660208260051b85010111156143b657600080fd5b60209290920196919550909350505050565b6000602080830181845280855180835260408601915060408160051b870101925083870160005b8281101561441d57603f1988860301845261440b858351613f59565b945092850192908501906001016143ef565b5092979650505050505050565b60008060006060848603121561443f57600080fd5b83359250602084013561445181613ed3565b929592945050506040919091013590565b60006020828403121561447457600080fd5b813563ffffffff8116811461226d57600080fd5b60006001600160401b038211156144a1576144a1614064565b50601f01601f191660200190565b600080604083850312156144c257600080fd5b8235915060208301356001600160401b038111156144df57600080fd5b8301601f810185136144f057600080fd5b80356144fe61411682614488565b81815286602083850101111561451357600080fd5b816020840160208301376000602083830101528093505050509250929050565b60008060006060848603121561454857600080fd5b83359250602084013561455a81613ed3565b91506040840135613ffa81613ed3565b6020808252818101527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604082015260600190565b6020808252601c908201527f70726f706f73616c2068617320756e636c61696d6564206c6561667300000000604082015260600190565b6000602082840312156145e857600080fd5b815161226d81613ed3565b60006020828403121561460557600080fd5b815161226d81613fb5565b634e487b7160e01b600052601160045260246000fd5b600081600019048311821515161561464057614640614610565b500290565b634e487b7160e01b600052601260045260246000fd5b60008261466a5761466a614645565b500490565b60008282101561468157614681614610565b500390565b60006101208b835263ffffffff808c1660208501528160408501526146ad8285018c613f59565b6001600160a01b039a8b166060860152608085019990995260a084019790975250509290931660c083015290931660e0840152610100909201919091529392505050565b60006020828403121561470357600080fd5b5051919050565b600063ffffffff80831681851680830382111561472957614729614610565b01949350505050565b600061020088835263ffffffff8816602084015280604084015261475881840188613f59565b9150506147716060830186516001600160a01b03169052565b60208501516001600160a01b03811660808401525060408501516001600160a01b03811660a084015250606085015180151560c084015250608085015160e083015260a0850151610100818185015260c08701519150610120828186015260e0880151925061014083818701528289015161016087015281890151610180870152808901516101a0870152505050506148166101c08301856001600160a01b03169052565b6001600160a01b0383166101e0830152979650505050505050565b63ffffffff831681526040602082015260006130f26040830184613f59565b6000821982111561486357614863614610565b500190565b600060ff82168061487b5761487b614610565b6000190192915050565b600081518084526020808501945080840160005b838110156148be5781516001600160a01b031687529582019590820190600101614899565b509495945050505050565b600081518084526020808501945080840160005b838110156148be578151875295820195908201906001016148dd565b60808152600061490c6080830187614885565b828103602084015261491e81876148c9565b9050828103604084015261493281866148c9565b9050828103606084015261281e81856148c9565b63ffffffff8516815260ff8416602082015260806040820152600061496e60808301856148c9565b905082606083015295945050505050565b634e487b7160e01b600052603260045260246000fd5b6000808335601e198436030181126149ac57600080fd5b8301803591506001600160401b038211156149c657600080fd5b6020019150368190038213156149db57600080fd5b9250929050565b8183823760009101908152919050565b600060208284031215614a0457600080fd5b81516001600160401b03811115614a1a57600080fd5b8201601f81018413614a2b57600080fd5b8051614a3961411682614488565b818152856020838501011115614a4e57600080fd5b612994826020830160208601613f2d565b6000600019821415614a7357614a73614610565b5060010190565b60008451614a8c818460208901613f2d565b845190830190614aa0818360208901613f2d565b8451910190614ab3818360208801613f2d565b0195945050505050565b600080821280156001600160ff1b0384900385131615614adf57614adf614610565b600160ff1b8390038412811615614af857614af8614610565b50500190565b60008083128015600160ff1b850184121615614b1c57614b1c614610565b6001600160ff1b0384018313811615614b3757614b37614610565b50500390565b6001600160a01b03831681526040602082018190526000906130f290830184613f59565b60008251614b73818460208701613f2d565b9190910192915050565b60208082526013908201527219195b1959d85d1958d85b1b0819985a5b1959606a1b604082015260600190565b600060208284031215614bbc57600080fd5b604051602081018181106001600160401b0382111715614bde57614bde614064565b6040529151825250919050565b8281526040602082015260006130f26040830184613f59565b60208152815160208201526000602083015160c06040840152614c2a60e08401826148c9565b90506040840151601f1980858403016060860152614c4883836148c9565b92506060860151915080858403016080860152614c6583836148c9565b925060ff60808701511660a086015260a08601519150808584030160c0860152506129948282614885565b600082614c9f57614c9f614645565b500690565b600063ffffffff80831681811415614cbe57614cbe614610565b6001019392505050565b600b60fa1b815260008251614ce4816001850160208701613f2d565b601d60f91b6001939091019283015250600201919050565b60008251614d0e818460208701613f2d565b601d60f91b920191825250600101919050565b600060ff821660ff84168060ff03821115614d3e57614d3e614610565b01939250505056fea264697066735822122018ecb84138bf41ed94efe9330099bad847451a1bfec9eb53b69b8aa07c44740c64736f6c634300080b0033", - "deployedBytecode": "0x60806040526004361061025e5760003560e01c806369b6250211610144578063ad68eda5116100b6578063dd70e5e81161007a578063dd70e5e8146107a3578063e0f339e3146107c3578063e40064d7146107e3578063e460e35c14610810578063f0056a7d14610830578063f2fde38b146108d55761026d565b8063ad68eda514610703578063b60c2d7d14610723578063b9a3c84c14610743578063c28f439214610763578063cd949995146107835761026d565b806380f323a71161010857806380f323a71461064f5780638bda0c00146106655780638da5cb5b14610685578063a16fd6e9146106a3578063a5841194146106c3578063ac9650d8146106e35761026d565b806369b625021461026b5780636ad0690a146105d2578063715018a61461060457806376ec08dd146106195780637998a1c4146106395761026d565b806322395aaa116101dd57806333dc09ca116101a157806333dc09ca146104a357806338b9e2ce146104c35780633fc8cef3146104e35780634144fd61146105035780634f7473ff146105a957806356688700146105bf5761026d565b806322395aaa1461041957806322f8e5661461042e578063240f475f1461044e57806329cb924d1461046e5780632d0f6f84146104835761026d565b80630c501af9116102245780630c501af91461036b5780630ee28a881461038b57806311cfc159146103ab5780631b107ee0146103c15780631c39c38d146103e15761026d565b8062660b5314610275578062c9920614610295578063084d0513146102b557806309474ae2146102e85780630a2dc9ec146103495761026d565b3661026d5761026b6108f5565b005b61026b6108f5565b34801561028157600080fd5b5061026b610290366004613ee8565b610973565b3480156102a157600080fd5b5061026b6102b0366004613f14565b610a51565b3480156102c157600080fd5b506102d56102d0366004613ee8565b610c34565b6040519081526020015b60405180910390f35b3480156102f457600080fd5b50610329610303366004613f14565b600960205260009081526040902080546001909101546001600160a01b03918216911682565b604080516001600160a01b039384168152929091166020830152016102df565b34801561035557600080fd5b5061035e610c60565b6040516102df9190613f85565b34801561037757600080fd5b5061026b610386366004613f98565b610e2f565b34801561039757600080fd5b5061026b6103a6366004613fc3565b610ec1565b3480156103b757600080fd5b506102d5600e5481565b3480156103cd57600080fd5b5061026b6103dc366004614005565b611083565b3480156103ed57600080fd5b50600054610401906001600160a01b031681565b6040516001600160a01b0390911681526020016102df565b34801561042557600080fd5b5061026b6111e4565b34801561043a57600080fd5b5061026b610449366004613f14565b611599565b34801561045a57600080fd5b50601054610401906001600160a01b031681565b34801561047a57600080fd5b506102d56115f4565b34801561048f57600080fd5b5061026b61049e366004613f98565b611680565b3480156104af57600080fd5b5061026b6104be366004613ee8565b61171f565b3480156104cf57600080fd5b5061026b6104de3660046141d5565b611930565b3480156104ef57600080fd5b50600a54610401906001600160a01b031681565b34801561050f57600080fd5b5060025460035460045460055460065461055a94939291906001600160a01b0381169060ff600160a01b8204811691600160a81b81049091169063ffffffff600160b01b9091041688565b6040805198895260208901979097529587019490945260608601929092526001600160a01b03166080850152151560a084015260ff1660c083015263ffffffff1660e0820152610100016102df565b3480156105b557600080fd5b506102d560115481565b61026b6105cd366004613ee8565b611c11565b3480156105de57600080fd5b506014546105ef9063ffffffff1681565b60405163ffffffff90911681526020016102df565b34801561061057600080fd5b5061026b611ea2565b34801561062557600080fd5b50600b54610401906001600160a01b031681565b34801561064557600080fd5b506102d5600d5481565b34801561065b57600080fd5b506102d560135481565b34801561067157600080fd5b5061026b6106803660046142ed565b611ed6565b34801561069157600080fd5b506001546001600160a01b0316610401565b3480156106af57600080fd5b506102d56106be366004613f98565b61204d565b3480156106cf57600080fd5b5061026b6106de366004613f98565b612079565b6106f66106f1366004614354565b61209a565b6040516102df91906143c8565b34801561070f57600080fd5b5061040161071e36600461442a565b61223f565b34801561072f57600080fd5b5061026b61073e366004613f98565b612274565b34801561074f57600080fd5b50600c54610401906001600160a01b031681565b34801561076f57600080fd5b50601254610401906001600160a01b031681565b34801561078f57600080fd5b5061026b61079e366004614462565b612434565b3480156107af57600080fd5b5061026b6107be3660046144af565b6124f2565b3480156107cf57600080fd5b506102d56107de366004613f98565b61253e565b3480156107ef57600080fd5b506102d56107fe366004613f98565b600f6020526000908152604090205481565b34801561081c57600080fd5b5061026b61082b366004614533565b612559565b34801561083c57600080fd5b5061089361084b366004613f98565b60086020526000908152604090208054600182015460028301546003909301546001600160a01b03831693600160a01b840460ff1693600160a81b900463ffffffff16929186565b604080516001600160a01b039097168752941515602087015263ffffffff909316938501939093526060840152608083019190915260a082015260c0016102df565b3480156108e157600080fd5b5061026b6108f0366004613f98565b61261f565b600054600160a01b900460ff161561097157600a60009054906101000a90046001600160a01b03166001600160a01b031663d0e30db0346040518263ffffffff1660e01b81526004016000604051808303818588803b15801561095757600080fd5b505af115801561096b573d6000803e3d6000fd5b50505050505b565b6001546001600160a01b031633146109a65760405162461bcd60e51b815260040161099d9061456a565b60405180910390fd5b670de0b6b3a76400008111156109fe5760405162461bcd60e51b815260206004820152601960248201527f4261642070726f746f636f6c4665654361707475726550637400000000000000604482015260640161099d565b601080546001600160a01b0319166001600160a01b03841690811790915560118290556040518291907fc1993b89fd79a19ece7beb067ddc8534ca26d29c0ff94ea2f53b4a508d1eedc990600090a35050565b6001546001600160a01b03163314610a7b5760405162461bcd60e51b815260040161099d9061456a565b600654600160a81b900460ff1615610aa55760405162461bcd60e51b815260040161099d9061459f565b610aad6126b7565b610ab5612710565b600c546040516302abf57960e61b8152721259195b9d1a599a595c95da1a5d195b1a5cdd606a1b60048201526000916001600160a01b03169063aafd5e4090602401602060405180830381865afa158015610b14573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610b3891906145d6565b6040516390978d1b60e01b8152600481018490529091506001600160a01b038216906390978d1b90602401602060405180830381865afa158015610b80573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610ba491906145f3565b610bf05760405162461bcd60e51b815260206004820152601860248201527f4964656e746966696572206e6f7420737570706f727465640000000000000000604482015260640161099d565b600d8290556040518281527ff45367c278fcceff23d601ce4bdd191e5bd61687ff9f29dc7276a08fe54c0c5d9060200160405180910390a150610c3161271f565b50565b6000610c3e6126b7565b610c46612710565b610c508383612734565b9050610c5a61271f565b92915050565b6040805160208082018352600082528251808401909352601a83527f7265717565737445787069726174696f6e54696d657374616d7000000000000090830152600654606092610cbd9291600160b01b900463ffffffff16612829565b60408051808201909152601f81527f756e636c61696d6564506f6f6c526562616c616e63654c656166436f756e74006020820152600654919250610d0d91839190600160a81b900460ff16612829565b9050610d4881604051806040016040528060118152602001701c1bdbdb149958985b185b98d9549bdbdd607a1b81525060026000015461286f565b9050610d8381604051806040016040528060118152602001701c995b185e595c9499599d5b99149bdbdd607a1b81525060026001015461286f565b9050610db9816040518060400160405280600d81526020016c1cdb1bddd4995b185e549bdbdd609a1b815250600280015461286f565b9050610df0816040518060400160405280600d81526020016c0636c61696d65644269744d617609c1b815250600260030154612829565b604080518082019091526008815267383937b837b9b2b960c11b6020820152600654919250610e2a918391906001600160a01b031661288a565b905090565b6001546001600160a01b03163314610e595760405162461bcd60e51b815260040161099d9061456a565b6001600160a01b03818116600081815260086020908152604091829020805460ff60a01b1981169091558251938452909316928201929092527fac111b3b527b307393c94d98f26140effb71411054466818be97912d2d65f77691015b60405180910390a150565b610ec96126b7565b610ed1612710565b600a546001600160a01b0384811691161480610eeb575080155b610f275760405162461bcd60e51b815260206004820152600d60248201526c086c2dce840e6cadcc840cae8d609b1b604482015260640161099d565b6000670de0b6b3a7640000610f3b856128a5565b610f459085614626565b610f4f919061465b565b6001600160a01b038581166000908152600860205260409081902054905163079cc67960e41b81523360048201526024810187905292935016906379cc6790906044016020604051808303816000875af1158015610fb1573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610fd591906145f3565b506001600160a01b0384166000908152600860205260408120600201805483929061100190849061466f565b9091555050811561101b57611016338261299d565b61102f565b61102f6001600160a01b0385163383612a58565b604080518281526020810185905233916001600160a01b038716917fcda1185f28599e6bd14ab8a68b3c30a11e1dce4256b5e67e94dd3fd846a6c589910160405180910390a35061107e61271f565b505050565b6001546001600160a01b031633146110ad5760405162461bcd60e51b815260040161099d9061456a565b6110b56126b7565b6110bd612710565b801561110a5781600760006110d3888789612abb565b815260200190815260200160002060006101000a8154816001600160a01b0302191690836001600160a01b03160217905550611138565b60076000611119878688612abb565b8152602081019190915260400160002080546001600160a01b03191690555b6040516001600160a01b038416602482015260448101859052811515606482015261119190869060840160408051601f198184030181529190526020810180516001600160e01b031663272751c760e01b179052612afb565b604080516001600160a01b0384811682528315156020830152851691869188917f6b6ad6b78778f6301df516688e316a2d4183a1ea99adae498c8e119debe9b146910160405180910390a461096b61271f565b6111ec6126b7565b6111f4612710565b60006111fe6115f4565b60065490915063ffffffff600160b01b909104811690821611156112645760405162461bcd60e51b815260206004820152601760248201527f5265717565737420706173736564206c6976656e657373000000000000000000604482015260640161099d565b600061126e610c60565b9050600061127a612c66565b90506013548111156112975761128f82612d4e565b505050611572565b60006112a1612e34565b6013546012549192506112bf916001600160a01b0316908390612eba565b806001600160a01b031663af355d1e600d548686601260009054906101000a90046001600160a01b03166000886013546112f9919061466f565b6014546006546040516001600160e01b031960e08b901b1681526113409897969594939263ffffffff16916001600160a01b031690670de0b6b3a764000090600401614686565b6020604051808303816000875af192505050801561137b575060408051601f3d908101601f19168201909252611378918101906146f1565b60015b6113915761138883612d4e565b50505050611572565b6012546113a9906001600160a01b0316836000612f72565b5060408051610160810182526006546001600160a01b0390811682526000602083018190526012549091169282019290925260608101829052670de0b6b3a7640000608082015260a0810182905260145460c082019061140f9063ffffffff168861470a565b63ffffffff1681526020016000815260200184815260200184601354611435919061466f565b815260145463ffffffff90811660209092019190915260135460125492935061146c926001600160a01b0316913391309161308716565b601354601254611489916001600160a01b03909116908490612eba565b600d5460405163139c641960e31b81526001600160a01b03841691639ce320c8916114c1919089908990879033903090600401614732565b6020604051808303816000875af11580156114e0573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061150491906146f1565b50336001600160a01b03167f4c789f44a7398cb63bf580e03ad5a7ec8228ea4935d3c1a1135eb449f0bb301b8686604051611540929190614831565b60405180910390a2505060006002819055600381905560048190556005555050600680546001600160d01b0319169055505b61159161157d612e34565b6012546001600160a01b0316906000612f72565b61097161271f565b6000546001600160a01b03166115ae57600080fd5b60005460405163117c72b360e11b8152600481018390526001600160a01b03909116906322f8e56690602401600060405180830381600087803b15801561095757600080fd5b600080546001600160a01b03161561167b5760008054906101000a90046001600160a01b03166001600160a01b03166329cb924d6040518163ffffffff1660e01b8152600401602060405180830381865afa158015611657573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610e2a91906146f1565b504290565b6116886126b7565b611690612710565b6010546001600160a01b038281166000818152600f60205260409020546116bc93919290911690612a58565b6001600160a01b0381166000818152600f60205260408082205490519092917f74740239d7d696c84422b720e125e1f47c4138c66d1f4d2a48e99f4197cdb79c91a36001600160a01b0381166000908152600f6020526040812055610c3161271f565b6001546001600160a01b031633146117495760405162461bcd60e51b815260040161099d9061456a565b600654600160a81b900460ff16156117735760405162461bcd60e51b815260040161099d9061459f565b61177b6126b7565b611783612710565b600c546040516302abf57960e61b81527210dbdb1b185d195c985b15da1a5d195b1a5cdd606a1b60048201526000916001600160a01b03169063aafd5e4090602401602060405180830381865afa1580156117e2573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061180691906145d6565b604051631d1d5b3960e11b81526001600160a01b03858116600483015291925090821690633a3ab67290602401602060405180830381865afa158015611850573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061187491906145f3565b6118b35760405162461bcd60e51b815260206004820152601060248201526f139bdd081bdb881dda1a5d195b1a5cdd60821b604482015260640161099d565b601280546001600160a01b0319166001600160a01b0385161790556118d6612c66565b6118e09083614850565b60138190556040519081526001600160a01b038416907fbfa9a96010167e98ce8c004f718932cbbfd33a58d681c752e693be7d457a1b3b9060200160405180910390a25061192c61271f565b5050565b6119386126b7565b611940612710565b600654600160b01b900463ffffffff166119586115f4565b1161199b5760405162461bcd60e51b81526020600482015260136024820152724e6f7420706173736564206c6976656e65737360681b604482015260640161099d565b6005546080830151600160ff9091161b90811614156119ee5760405162461bcd60e51b815260206004820152600f60248201526e105b1c9958591e4818db185a5b5959608a1b604482015260640161099d565b6002546119fc9083836130bf565b611a345760405162461bcd60e51b81526020600482015260096024820152682130b210283937b7b360b91b604482015260640161099d565b81516000908152600960205260409020546001600160a01b0316611a915760405162461bcd60e51b815260206004820152601460248201527327379030b230b83a32b9103337b91031b430b4b760611b604482015260640161099d565b81516000908152600960205260409020600101546001600160a01b031680611afb5760405162461bcd60e51b815260206004820152601860248201527f556e696e697469616c697a65642073706f6b6520706f6f6c0000000000000000604482015260640161099d565b611b11600260030154846080015160ff166130fa565b60055560068054600160a81b900460ff16906015611b2e83614868565b91906101000a81548160ff021916908360ff16021790555050611b648184600001518560a001518660400151876020015161315d565b611b72818460000151613439565b600654600160a81b900460ff16611ba457600654601354601254611ba4926001600160a01b0391821692911690612a58565b336001600160a01b03168360000151846080015160ff167f269bcb1817facd431d586b474ce46fe1ca2921cd1a19314c01a606804ea8b9458660a00151876020015188604001518960600151604051611c0094939291906148f9565b60405180910390a45061192c61271f565b611c196126b7565b611c21612710565b6001600160a01b038216600090815260086020526040902054600160a01b900460ff16611c845760405162461bcd60e51b8152602060048201526011602482015270151bdad95b881b9bdd08195b98589b1959607a1b604482015260640161099d565b600a546001600160a01b038381169116148015611ca057508034145b80611ca9575034155b611ce55760405162461bcd60e51b815260206004820152600d60248201526c426164206d73672e76616c756560981b604482015260640161099d565b6000611cf0836128a5565b611d0283670de0b6b3a7640000614626565b611d0c919061465b565b6001600160a01b03848116600090815260086020526040908190205490516340c10f1960e01b81523360048201526024810184905292935016906340c10f19906044016020604051808303816000875af1158015611d6e573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611d9291906145f3565b506001600160a01b03831660009081526008602052604081206002018054849290611dbe908490614850565b9091555050600a546001600160a01b038481169116148015611de05750600034115b15611e3e57826001600160a01b031663d0e30db0346040518263ffffffff1660e01b81526004016000604051808303818588803b158015611e2057600080fd5b505af1158015611e34573d6000803e3d6000fd5b5050505050611e53565b611e536001600160a01b038416333085613087565b604080518381526020810183905233916001600160a01b038616917f3c69701a61c79a92ef9692903aaa0068bce8771361ecb09547391e4fb4df8537910160405180910390a35061192c61271f565b6001546001600160a01b03163314611ecc5760405162461bcd60e51b815260040161099d9061456a565b6109716000613542565b611ede6126b7565b611ee6612710565b600654600160a81b900460ff1615611f105760405162461bcd60e51b815260040161099d9061459f565b60008460ff1611611f635760405162461bcd60e51b815260206004820181905260248201527f42756e646c65206d7573742068617665206174206c656173742031206c656166604482015260640161099d565b60145460009063ffffffff16611f776115f4565b611f81919061470a565b60006005556006805460028790556003869055600485905560ff8816600160a81b0263ffffffff808516600160b01b0260ff60a81b19166001600160d01b031990931692909217176001600160a01b03191633908117909255601354601254939450611ffb936001600160a01b0316929130919061308716565b336001600160a01b031683857f50e585dd6361c7cb2613ce2334814bb2a789f5a8ad4b161fe0e248043737d1d284898b8860405161203c9493929190614946565b60405180910390a45061096b61271f565b60006120576126b7565b61205f612710565b61206a826000612734565b905061207461271f565b919050565b6120816126b7565b612089612710565b61209281613594565b610c3161271f565b606034156120ea5760405162461bcd60e51b815260206004820152601b60248201527f4f6e6c79206d756c746963616c6c207769746820302076616c75650000000000604482015260640161099d565b816001600160401b0381111561210257612102614064565b60405190808252806020026020018201604052801561213557816020015b60608152602001906001900390816121205790505b50905060005b8281101561223857600080308686858181106121595761215961497f565b905060200281019061216b9190614995565b6040516121799291906149e2565b600060405180830381855af49150503d80600081146121b4576040519150601f19603f3d011682016040523d82523d6000602084013e6121b9565b606091505b509150915081612205576044815110156121d257600080fd5b600481019050808060200190518101906121ec91906149f2565b60405162461bcd60e51b815260040161099d9190613f85565b808484815181106122185761221861497f565b60200260200101819052505050808061223090614a5f565b91505061213b565b5092915050565b600060076000612250868686612abb565b81526020810191909152604001600020546001600160a01b031690505b9392505050565b6001546001600160a01b0316331461229e5760405162461bcd60e51b815260040161099d9061456a565b6122a66126b7565b6122ae612710565b6001600160a01b038181166000908152600860205260409020541661236d57600b54604051637e178db760e11b81526001600160a01b0383811660048301529091169063fc2f1b6e906024016020604051808303816000875af1158015612319573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061233d91906145d6565b6001600160a01b03828116600090815260086020526040902080546001600160a01b031916929091169190911790555b6001600160a01b0381166000908152600860205260409020805460ff60a01b1916600160a01b17905561239e6115f4565b6001600160a01b0380831660009081526008602052604090819020805463ffffffff94909416600160a81b0263ffffffff60a81b198516811790915590517f04e291c80180d65a57b5bf1bed775777ec0d6f283ef34bcf130712714d8bb7f7936124249386938116911617906001600160a01b0392831681529116602082015260400190565b60405180910390a1610c3161271f565b6001546001600160a01b0316331461245e5760405162461bcd60e51b815260040161099d9061456a565b6102588163ffffffff16116124aa5760405162461bcd60e51b8152602060048201526012602482015271131a5d995b995cdcc81d1bdbc81cda1bdc9d60721b604482015260640161099d565b6014805463ffffffff191663ffffffff83169081179091556040519081527f04dd1d84d387f404568a7954b5e398518bdd716e1a8f4a790be9a1a225ad934790602001610eb6565b6001546001600160a01b0316331461251c5760405162461bcd60e51b815260040161099d9061456a565b6125246126b7565b61252c612710565b6125368282612afb565b61192c61271f565b60006125486126b7565b612550612710565b61206a826128a5565b6001546001600160a01b031633146125835760405162461bcd60e51b815260040161099d9061456a565b6040805180820182526001600160a01b03848116808352848216602080850182815260008a815260098352879020955186549086166001600160a01b031991821617875590516001909601805496909516951694909417909255835187815292830152918101919091527f36050d958750e6ac3aa674ac7bbe8d0ae6a2f7d4b808e8c2c42c1f22fc9fc4bb9060600160405180910390a1505050565b6001546001600160a01b031633146126495760405162461bcd60e51b815260040161099d9061456a565b6001600160a01b0381166126ae5760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201526564647265737360d01b606482015260840161099d565b610c3181613542565b600054600160a01b900460ff166109715760405162461bcd60e51b815260206004820152601f60248201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c00604482015260640161099d565b6000805460ff60a01b19169055565b6000805460ff60a01b1916600160a01b179055565b600061273f83613594565b6001600160a01b038381166000908152600860209081526040808320815160c08101835281549586168152600160a01b860460ff16151593810193909352600160a81b90940463ffffffff16908201526001830154606082018190526002840154608083015260039093015460a08201529181126127be5760006127c4565b81606001515b905060006127d28286614850565b905060008284608001516127e69190614850565b90508061280157670de0b6b3a7640000945050505050610c5a565b8061281483670de0b6b3a7640000614626565b61281e919061465b565b979650505050505050565b6060600061283785856136e3565b9050848161284485613725565b60405160200161285693929190614a7a565b6040516020818303038152906040529150509392505050565b6060600061287d85856136e3565b905084816128448561384d565b6060600061289885856136e3565b905084816128448561388e565b6001600160a01b038082166000908152600860209081526040808320805482516318160ddd60e01b8152925194959194869491909216926318160ddd92600480830193928290030181865afa158015612902573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061292691906146f1565b90508061293e5750670de0b6b3a76400009392505050565b612947826138e5565b61295084613594565b600082600301548360010154846002015461296b9190614abd565b6129759190614afe565b90508161298a82670de0b6b3a7640000614626565b612994919061465b565b95945050505050565b6001600160a01b0382163b156129c457600a5461192c906001600160a01b03168383612a58565b600a54604051632e1a7d4d60e01b8152600481018390526001600160a01b0390911690632e1a7d4d90602401600060405180830381600087803b158015612a0a57600080fd5b505af1158015612a1e573d6000803e3d6000fd5b50506040516001600160a01b038516925083156108fc02915083906000818181858888f1935050505015801561107e573d6000803e3d6000fd5b6040516001600160a01b03831660248201526044810182905261107e90849063a9059cbb60e01b906064015b60408051601f198184030181529190526020810180516001600160e01b03166001600160e01b03199093169290921790915261394d565b604080516020808201959095526001600160a01b039390931683820152606080840192909252805180840390920182526080909201909152805191012090565b6000828152600960205260409020546001600160a01b031680612b605760405162461bcd60e51b815260206004820152601760248201527f41646170746572206e6f7420696e697469616c697a6564000000000000000000604482015260640161099d565b6000838152600960205260408082206001015490516001600160a01b0380851692612b92929116908690602401614b3d565b60408051601f198184030181529181526020820180516001600160e01b0316637375c56f60e11b17905251612bc79190614b61565b600060405180830381855af49150503d8060008114612c02576040519150601f19603f3d011682016040523d82523d6000602084013e612c07565b606091505b5050905080612c285760405162461bcd60e51b815260040161099d90614b7d565b837f218987b934c2f6bc596136829fbf43a5fef4d6fafce41f3f6254d9a870c2deec84604051612c589190613f85565b60405180910390a250505050565b600c546040516302abf57960e61b81526453746f726560d81b60048201526000916001600160a01b03169063aafd5e4090602401602060405180830381865afa158015612cb7573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190612cdb91906145d6565b601254604051635b97aadd60e01b81526001600160a01b039182166004820152911690635b97aadd90602401602060405180830381865afa158015612d24573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190612d489190614baa565b51919050565b60125460065460135460405163a9059cbb60e01b81526001600160a01b039283166004820152602481019190915291169063a9059cbb906044016020604051808303816000875af1158015612da7573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190612dcb91906145f3565b506000600281905560038190556004819055600555600680546001600160d01b0319169055337f1d2f9274429d71a4bfb9fe52ed39d766c4d0f7b072f0989cf7072229fbc63328612e1a6115f4565b83604051612e29929190614beb565b60405180910390a250565b600c546040516302abf57960e61b815275536b696e6e794f7074696d69737469634f7261636c6560501b60048201526000916001600160a01b03169063aafd5e4090602401602060405180830381865afa158015612e96573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610e2a91906145d6565b604051636eb1769f60e11b81523060048201526001600160a01b038381166024830152600091839186169063dd62ed3e90604401602060405180830381865afa158015612f0b573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190612f2f91906146f1565b612f399190614850565b6040516001600160a01b038516602482015260448101829052909150612f6c90859063095ea7b360e01b90606401612a84565b50505050565b801580612fec5750604051636eb1769f60e11b81523060048201526001600160a01b03838116602483015284169063dd62ed3e90604401602060405180830381865afa158015612fc6573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190612fea91906146f1565b155b6130575760405162461bcd60e51b815260206004820152603660248201527f5361666545524332303a20617070726f76652066726f6d206e6f6e2d7a65726f60448201527520746f206e6f6e2d7a65726f20616c6c6f77616e636560501b606482015260840161099d565b6040516001600160a01b03831660248201526044810182905261107e90849063095ea7b360e01b90606401612a84565b6040516001600160a01b0380851660248301528316604482015260648101829052612f6c9085906323b872dd60e01b90608401612a84565b60006130f28285856040516020016130d79190614c04565b60405160208183030381529060405280519060200120613a1f565b949350505050565b600060ff8211156131435760405162461bcd60e51b8152602060048201526013602482015272496e646578206f7574206f6620626f756e647360681b604482015260640161099d565b61314f61010083614c90565b6001901b8317905092915050565b6000848152600960205260408120546001600160a01b0316905b84518163ffffffff161015613430576000858263ffffffff16815181106131a0576131a061497f565b602002602001015190506000600760006131bb46858c612abb565b81526020810191909152604001600020546001600160a01b031690508061321c5760405162461bcd60e51b8152602060048201526015602482015274149bdd5d19481b9bdd081dda1a5d195b1a5cdd1959605a1b604482015260640161099d565b6000868463ffffffff16815181106132365761323661497f565b602002602001015113156133f2576000846001600160a01b03168383898763ffffffff168151811061326a5761326a61497f565b60209081029190910101516040516001600160a01b03938416602482015291831660448301526064820152908c16608482015260a40160408051601f198184030181529181526020820180516001600160e01b03166314b231d760e21b179052516132d59190614b61565b600060405180830381855af49150503d8060008114613310576040519150601f19603f3d011682016040523d82523d6000602084013e613315565b606091505b50509050806133365760405162461bcd60e51b815260040161099d90614b7d565b868463ffffffff168151811061334e5761334e61497f565b602002602001015160086000856001600160a01b03166001600160a01b03168152602001908152602001600020600101600082825461338d9190614abd565b92505081905550868463ffffffff16815181106133ac576133ac61497f565b602002602001015160086000856001600160a01b03166001600160a01b0316815260200190815260200160002060020160008282546133eb919061466f565b9091555050505b61341b82868563ffffffff168151811061340e5761340e61497f565b6020026020010151613a35565b5050808061342890614ca4565b915050613177565b50505050505050565b600081815260096020526040808220546003546004549251602481019190915260448101929092526001600160a01b031691908290859060640160408051601f198184030181529181526020820180516001600160e01b031663124e93e160e21b179052516134ac929190602401614b3d565b60408051601f198184030181529181526020820180516001600160e01b0316637375c56f60e11b179052516134e19190614b61565b600060405180830381855af49150503d806000811461351c576040519150601f19603f3d011682016040523d82523d6000602084013e613521565b606091505b5050905080612f6c5760405162461bcd60e51b815260040161099d90614b7d565b600180546001600160a01b038381166001600160a01b0319831681179093556040519116919082907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e090600090a35050565b6040516370a0823160e01b81523060048201526000906001600160a01b038316906370a0823190602401602060405180830381865afa1580156135db573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906135ff91906146f1565b6012549091506000906001600160a01b03848116911614801561362d5750600654600160a81b900460ff1615155b6136375781613644565b601354613644908361466f565b6001600160a01b03841660009081526008602052604090206002015490915081111561107e576001600160a01b038316600090815260086020526040902060020154613690908261466f565b6001600160a01b038416600090815260086020526040812060010180549091906136bb908490614afe565b90915550506001600160a01b0383166000908152600860205260409020600201819055505050565b81516060901561371457816040516020016136fe9190614cc8565b6040516020818303038152906040529050610c5a565b816040516020016136fe9190614cfc565b6060816137495750506040805180820190915260018152600360fc1b602082015290565b8160005b8115613773578061375d81614a5f565b915061376c9050600a8361465b565b915061374d565b6000816001600160401b0381111561378d5761378d614064565b6040519080825280601f01601f1916602001820160405280156137b7576020820181803683370190505b509050815b8515613844576137cd60018261466f565b905060006137dc600a8861465b565b6137e790600a614626565b6137f1908861466f565b6137fc906030614d21565b905060008160f81b9050808484815181106138195761381961497f565b60200101906001600160f81b031916908160001a90535061383b600a8961465b565b975050506137bc565b50949350505050565b606061385c608083901c613b08565b61386583613b08565b6040805160208101939093528201526060015b6040516020818303038152906040529050919050565b60606138a66001600160801b03602084901c16613b08565b6138c18360601b6bffffffffffffffffffffffff1916613b08565b6040516020016138789291909182526001600160c01b031916602082015260280190565b6003810154815460009161390591600160a81b900463ffffffff16613ca1565b90508082600301600082825461391b919061466f565b9091555061392990506115f4565b825463ffffffff91909116600160a81b0263ffffffff60a81b199091161790915550565b60006139a2826040518060400160405280602081526020017f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c6564815250856001600160a01b0316613cf69092919063ffffffff16565b80519091501561107e57808060200190518101906139c091906145f3565b61107e5760405162461bcd60e51b815260206004820152602a60248201527f5361666545524332303a204552433230206f7065726174696f6e20646964206e6044820152691bdd081cdd58d8d9595960b21b606482015260840161099d565b600082613a2c8584613d05565b14949350505050565b6000670de0b6b3a764000060115483613a4e9190614626565b613a58919061465b565b90506000613a66828461466f565b90508015613acf576001600160a01b03841660009081526008602052604081206003018054839290613a99908490614850565b90915550506001600160a01b03841660009081526008602052604081206001018054839290613ac9908490614abd565b90915550505b8115612f6c576001600160a01b0384166000908152600f602052604081208054849290613afd908490614850565b909155505050505050565b6000808260001c9050806001600160801b03169050806801000000000000000002811777ffffffffffffffff0000000000000000ffffffffffffffff169050806401000000000281177bffffffff00000000ffffffff00000000ffffffff00000000ffffffff16905080620100000281177dffff0000ffff0000ffff0000ffff0000ffff0000ffff0000ffff0000ffff169050806101000281177eff00ff00ff00ff00ff00ff00ff00ff00ff00ff00ff00ff00ff00ff00ff00ff1690508060100281177f0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f16905060006008827f08080808080808080808080808080808080808080808080808080808080808081681613c2357613c23614645565b0460047f040404040404040404040404040404040404040404040404040404040404040484160460027f020202020202020202020202020202020202020202020202020202020202020285160417166027029091017f3030303030303030303030303030303030303030303030303030303030303030019392505050565b60008082613cad6115f4565b613cb7919061466f565b90506000670de0b6b3a764000082600e5487613cd39190614626565b613cdd9190614626565b613ce7919061465b565b90508481106130f25784612994565b60606130f28484600085613d79565b600081815b8451811015613d71576000858281518110613d2757613d2761497f565b60200260200101519050808311613d4d5760008381526020829052604090209250613d5e565b600081815260208490526040902092505b5080613d6981614a5f565b915050613d0a565b509392505050565b606082471015613dda5760405162461bcd60e51b815260206004820152602660248201527f416464726573733a20696e73756666696369656e742062616c616e636520666f6044820152651c8818d85b1b60d21b606482015260840161099d565b6001600160a01b0385163b613e315760405162461bcd60e51b815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e7472616374000000604482015260640161099d565b600080866001600160a01b03168587604051613e4d9190614b61565b60006040518083038185875af1925050503d8060008114613e8a576040519150601f19603f3d011682016040523d82523d6000602084013e613e8f565b606091505b509150915061281e82828660608315613ea957508161226d565b825115613eb95782518084602001fd5b8160405162461bcd60e51b815260040161099d9190613f85565b6001600160a01b0381168114610c3157600080fd5b60008060408385031215613efb57600080fd5b8235613f0681613ed3565b946020939093013593505050565b600060208284031215613f2657600080fd5b5035919050565b60005b83811015613f48578181015183820152602001613f30565b83811115612f6c5750506000910152565b60008151808452613f71816020860160208601613f2d565b601f01601f19169290920160200192915050565b60208152600061226d6020830184613f59565b600060208284031215613faa57600080fd5b813561226d81613ed3565b8015158114610c3157600080fd5b600080600060608486031215613fd857600080fd5b8335613fe381613ed3565b9250602084013591506040840135613ffa81613fb5565b809150509250925092565b600080600080600060a0868803121561401d57600080fd5b8535945060208601359350604086013561403681613ed3565b9250606086013561404681613ed3565b9150608086013561405681613fb5565b809150509295509295909350565b634e487b7160e01b600052604160045260246000fd5b60405160c081016001600160401b038111828210171561409c5761409c614064565b60405290565b604051601f8201601f191681016001600160401b03811182821017156140ca576140ca614064565b604052919050565b60006001600160401b038211156140eb576140eb614064565b5060051b60200190565b600082601f83011261410657600080fd5b8135602061411b614116836140d2565b6140a2565b82815260059290921b8401810191818101908684111561413a57600080fd5b8286015b84811015614155578035835291830191830161413e565b509695505050505050565b803560ff8116811461207457600080fd5b600082601f83011261418257600080fd5b81356020614192614116836140d2565b82815260059290921b840181019181810190868411156141b157600080fd5b8286015b848110156141555780356141c881613ed3565b83529183019183016141b5565b600080604083850312156141e857600080fd5b82356001600160401b03808211156141ff57600080fd5b9084019060c0828703121561421357600080fd5b61421b61407a565b8235815260208301358281111561423157600080fd5b61423d888286016140f5565b60208301525060408301358281111561425557600080fd5b614261888286016140f5565b60408301525060608301358281111561427957600080fd5b614285888286016140f5565b60608301525061429760808401614160565b608082015260a0830135828111156142ae57600080fd5b6142ba88828601614171565b60a083015250935060208501359150808211156142d657600080fd5b506142e3858286016140f5565b9150509250929050565b600080600080600060a0868803121561430557600080fd5b85356001600160401b0381111561431b57600080fd5b614327888289016140f5565b95505061433660208701614160565b94979496505050506040830135926060810135926080909101359150565b6000806020838503121561436757600080fd5b82356001600160401b038082111561437e57600080fd5b818501915085601f83011261439257600080fd5b8135818111156143a157600080fd5b8660208260051b85010111156143b657600080fd5b60209290920196919550909350505050565b6000602080830181845280855180835260408601915060408160051b870101925083870160005b8281101561441d57603f1988860301845261440b858351613f59565b945092850192908501906001016143ef565b5092979650505050505050565b60008060006060848603121561443f57600080fd5b83359250602084013561445181613ed3565b929592945050506040919091013590565b60006020828403121561447457600080fd5b813563ffffffff8116811461226d57600080fd5b60006001600160401b038211156144a1576144a1614064565b50601f01601f191660200190565b600080604083850312156144c257600080fd5b8235915060208301356001600160401b038111156144df57600080fd5b8301601f810185136144f057600080fd5b80356144fe61411682614488565b81815286602083850101111561451357600080fd5b816020840160208301376000602083830101528093505050509250929050565b60008060006060848603121561454857600080fd5b83359250602084013561455a81613ed3565b91506040840135613ffa81613ed3565b6020808252818101527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604082015260600190565b6020808252601c908201527f70726f706f73616c2068617320756e636c61696d6564206c6561667300000000604082015260600190565b6000602082840312156145e857600080fd5b815161226d81613ed3565b60006020828403121561460557600080fd5b815161226d81613fb5565b634e487b7160e01b600052601160045260246000fd5b600081600019048311821515161561464057614640614610565b500290565b634e487b7160e01b600052601260045260246000fd5b60008261466a5761466a614645565b500490565b60008282101561468157614681614610565b500390565b60006101208b835263ffffffff808c1660208501528160408501526146ad8285018c613f59565b6001600160a01b039a8b166060860152608085019990995260a084019790975250509290931660c083015290931660e0840152610100909201919091529392505050565b60006020828403121561470357600080fd5b5051919050565b600063ffffffff80831681851680830382111561472957614729614610565b01949350505050565b600061020088835263ffffffff8816602084015280604084015261475881840188613f59565b9150506147716060830186516001600160a01b03169052565b60208501516001600160a01b03811660808401525060408501516001600160a01b03811660a084015250606085015180151560c084015250608085015160e083015260a0850151610100818185015260c08701519150610120828186015260e0880151925061014083818701528289015161016087015281890151610180870152808901516101a0870152505050506148166101c08301856001600160a01b03169052565b6001600160a01b0383166101e0830152979650505050505050565b63ffffffff831681526040602082015260006130f26040830184613f59565b6000821982111561486357614863614610565b500190565b600060ff82168061487b5761487b614610565b6000190192915050565b600081518084526020808501945080840160005b838110156148be5781516001600160a01b031687529582019590820190600101614899565b509495945050505050565b600081518084526020808501945080840160005b838110156148be578151875295820195908201906001016148dd565b60808152600061490c6080830187614885565b828103602084015261491e81876148c9565b9050828103604084015261493281866148c9565b9050828103606084015261281e81856148c9565b63ffffffff8516815260ff8416602082015260806040820152600061496e60808301856148c9565b905082606083015295945050505050565b634e487b7160e01b600052603260045260246000fd5b6000808335601e198436030181126149ac57600080fd5b8301803591506001600160401b038211156149c657600080fd5b6020019150368190038213156149db57600080fd5b9250929050565b8183823760009101908152919050565b600060208284031215614a0457600080fd5b81516001600160401b03811115614a1a57600080fd5b8201601f81018413614a2b57600080fd5b8051614a3961411682614488565b818152856020838501011115614a4e57600080fd5b612994826020830160208601613f2d565b6000600019821415614a7357614a73614610565b5060010190565b60008451614a8c818460208901613f2d565b845190830190614aa0818360208901613f2d565b8451910190614ab3818360208801613f2d565b0195945050505050565b600080821280156001600160ff1b0384900385131615614adf57614adf614610565b600160ff1b8390038412811615614af857614af8614610565b50500190565b60008083128015600160ff1b850184121615614b1c57614b1c614610565b6001600160ff1b0384018313811615614b3757614b37614610565b50500390565b6001600160a01b03831681526040602082018190526000906130f290830184613f59565b60008251614b73818460208701613f2d565b9190910192915050565b60208082526013908201527219195b1959d85d1958d85b1b0819985a5b1959606a1b604082015260600190565b600060208284031215614bbc57600080fd5b604051602081018181106001600160401b0382111715614bde57614bde614064565b6040529151825250919050565b8281526040602082015260006130f26040830184613f59565b60208152815160208201526000602083015160c06040840152614c2a60e08401826148c9565b90506040840151601f1980858403016060860152614c4883836148c9565b92506060860151915080858403016080860152614c6583836148c9565b925060ff60808701511660a086015260a08601519150808584030160c0860152506129948282614885565b600082614c9f57614c9f614645565b500690565b600063ffffffff80831681811415614cbe57614cbe614610565b6001019392505050565b600b60fa1b815260008251614ce4816001850160208701613f2d565b601d60f91b6001939091019283015250600201919050565b60008251614d0e818460208701613f2d565b601d60f91b920191825250600101919050565b600060ff821660ff84168060ff03821115614d3e57614d3e614610565b01939250505056fea264697066735822122018ecb84138bf41ed94efe9330099bad847451a1bfec9eb53b69b8aa07c44740c64736f6c634300080b0033", + "solcInputHash": "2fe6c4b637a440a1380be3adbf7d9e12", + "metadata": "{\"compiler\":{\"version\":\"0.8.13+commit.abaa5c0e\"},\"language\":\"Solidity\",\"output\":{\"abi\":[{\"inputs\":[{\"internalType\":\"contract LpTokenFactoryInterface\",\"name\":\"_lpTokenFactory\",\"type\":\"address\"},{\"internalType\":\"contract FinderInterface\",\"name\":\"_finder\",\"type\":\"address\"},{\"internalType\":\"contract WETH9\",\"name\":\"_weth\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"_timer\",\"type\":\"address\"}],\"stateMutability\":\"nonpayable\",\"type\":\"constructor\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"newBondToken\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"newBondAmount\",\"type\":\"uint256\"}],\"name\":\"BondSet\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"l2ChainId\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"address\",\"name\":\"adapter\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"address\",\"name\":\"spokePool\",\"type\":\"address\"}],\"name\":\"CrossChainContractsSet\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"bytes32\",\"name\":\"poolRebalanceRoot\",\"type\":\"bytes32\"},{\"indexed\":true,\"internalType\":\"bytes32\",\"name\":\"relayerRefundRoot\",\"type\":\"bytes32\"},{\"indexed\":false,\"internalType\":\"bytes32\",\"name\":\"slowRelayRoot\",\"type\":\"bytes32\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"proposer\",\"type\":\"address\"}],\"name\":\"EmergencyRootBundleDeleted\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"bytes32\",\"name\":\"newIdentifier\",\"type\":\"bytes32\"}],\"name\":\"IdentifierSet\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"address\",\"name\":\"l1Token\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"address\",\"name\":\"lpToken\",\"type\":\"address\"}],\"name\":\"L1TokenEnabledForLiquidityProvision\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"address\",\"name\":\"l1Token\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"address\",\"name\":\"lpToken\",\"type\":\"address\"}],\"name\":\"L2TokenDisabledForLiquidityProvision\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"l1Token\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"lpTokensMinted\",\"type\":\"uint256\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"liquidityProvider\",\"type\":\"address\"}],\"name\":\"LiquidityAdded\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"l1Token\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"lpTokensBurnt\",\"type\":\"uint256\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"liquidityProvider\",\"type\":\"address\"}],\"name\":\"LiquidityRemoved\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"newLiveness\",\"type\":\"uint256\"}],\"name\":\"LivenessSet\",\"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\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"bool\",\"name\":\"isPaused\",\"type\":\"bool\"}],\"name\":\"Paused\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"uint32\",\"name\":\"requestExpirationTimestamp\",\"type\":\"uint32\"},{\"indexed\":false,\"internalType\":\"uint64\",\"name\":\"unclaimedPoolRebalanceLeafCount\",\"type\":\"uint64\"},{\"indexed\":false,\"internalType\":\"uint256[]\",\"name\":\"bundleEvaluationBlockNumbers\",\"type\":\"uint256[]\"},{\"indexed\":true,\"internalType\":\"bytes32\",\"name\":\"poolRebalanceRoot\",\"type\":\"bytes32\"},{\"indexed\":true,\"internalType\":\"bytes32\",\"name\":\"relayerRefundRoot\",\"type\":\"bytes32\"},{\"indexed\":false,\"internalType\":\"bytes32\",\"name\":\"slowRelayRoot\",\"type\":\"bytes32\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"proposer\",\"type\":\"address\"}],\"name\":\"ProposeRootBundle\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"newProtocolFeeCaptureAddress\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"uint256\",\"name\":\"newProtocolFeeCapturePct\",\"type\":\"uint256\"}],\"name\":\"ProtocolFeeCaptureSet\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"l1Token\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"uint256\",\"name\":\"accumulatedFees\",\"type\":\"uint256\"}],\"name\":\"ProtocolFeesCapturedClaimed\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"disputer\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"requestTime\",\"type\":\"uint256\"}],\"name\":\"RootBundleCanceled\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"disputer\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"requestTime\",\"type\":\"uint256\"}],\"name\":\"RootBundleDisputed\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"groupIndex\",\"type\":\"uint256\"},{\"indexed\":true,\"internalType\":\"uint256\",\"name\":\"leafId\",\"type\":\"uint256\"},{\"indexed\":true,\"internalType\":\"uint256\",\"name\":\"chainId\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"address[]\",\"name\":\"l1Token\",\"type\":\"address[]\"},{\"indexed\":false,\"internalType\":\"uint256[]\",\"name\":\"bundleLpFees\",\"type\":\"uint256[]\"},{\"indexed\":false,\"internalType\":\"int256[]\",\"name\":\"netSendAmount\",\"type\":\"int256[]\"},{\"indexed\":false,\"internalType\":\"int256[]\",\"name\":\"runningBalance\",\"type\":\"int256[]\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"caller\",\"type\":\"address\"}],\"name\":\"RootBundleExecuted\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"uint256\",\"name\":\"originChainId\",\"type\":\"uint256\"},{\"indexed\":true,\"internalType\":\"uint256\",\"name\":\"destinationChainId\",\"type\":\"uint256\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"originToken\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"bool\",\"name\":\"depositsEnabled\",\"type\":\"bool\"}],\"name\":\"SetEnableDepositRoute\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"uint256\",\"name\":\"destinationChainId\",\"type\":\"uint256\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"l1Token\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"destinationToken\",\"type\":\"address\"}],\"name\":\"SetPoolRebalanceRoute\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"uint256\",\"name\":\"chainId\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"bytes\",\"name\":\"message\",\"type\":\"bytes\"}],\"name\":\"SpokePoolAdminFunctionTriggered\",\"type\":\"event\"},{\"stateMutability\":\"payable\",\"type\":\"fallback\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"l1Token\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"l1TokenAmount\",\"type\":\"uint256\"}],\"name\":\"addLiquidity\",\"outputs\":[],\"stateMutability\":\"payable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"bondAmount\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"bondToken\",\"outputs\":[{\"internalType\":\"contract IERC20\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"l1Token\",\"type\":\"address\"}],\"name\":\"claimProtocolFeesCaptured\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"name\":\"crossChainContracts\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"adapter\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"spokePool\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"l1Token\",\"type\":\"address\"}],\"name\":\"disableL1TokenForLiquidityProvision\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"disputeRootBundle\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"emergencyDeleteProposal\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"l1Token\",\"type\":\"address\"}],\"name\":\"enableL1TokenForLiquidityProvision\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"l1Token\",\"type\":\"address\"}],\"name\":\"exchangeRateCurrent\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"chainId\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"groupIndex\",\"type\":\"uint256\"},{\"internalType\":\"uint256[]\",\"name\":\"bundleLpFees\",\"type\":\"uint256[]\"},{\"internalType\":\"int256[]\",\"name\":\"netSendAmounts\",\"type\":\"int256[]\"},{\"internalType\":\"int256[]\",\"name\":\"runningBalances\",\"type\":\"int256[]\"},{\"internalType\":\"uint8\",\"name\":\"leafId\",\"type\":\"uint8\"},{\"internalType\":\"address[]\",\"name\":\"l1Tokens\",\"type\":\"address[]\"},{\"internalType\":\"bytes32[]\",\"name\":\"proof\",\"type\":\"bytes32[]\"}],\"name\":\"executeRootBundle\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"finder\",\"outputs\":[{\"internalType\":\"contract FinderInterface\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"getCurrentTime\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"identifier\",\"outputs\":[{\"internalType\":\"bytes32\",\"name\":\"\",\"type\":\"bytes32\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"l1Token\",\"type\":\"address\"}],\"name\":\"liquidityUtilizationCurrent\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"l1Token\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"relayedAmount\",\"type\":\"uint256\"}],\"name\":\"liquidityUtilizationPostRelay\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"liveness\",\"outputs\":[{\"internalType\":\"uint32\",\"name\":\"\",\"type\":\"uint32\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"loadEthForL2Calls\",\"outputs\":[],\"stateMutability\":\"payable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"lpFeeRatePerSecond\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"lpTokenFactory\",\"outputs\":[{\"internalType\":\"contract LpTokenFactoryInterface\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes[]\",\"name\":\"data\",\"type\":\"bytes[]\"}],\"name\":\"multicall\",\"outputs\":[{\"internalType\":\"bytes[]\",\"name\":\"results\",\"type\":\"bytes[]\"}],\"stateMutability\":\"payable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"owner\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"paused\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"destinationChainId\",\"type\":\"uint256\"},{\"internalType\":\"address\",\"name\":\"l1Token\",\"type\":\"address\"}],\"name\":\"poolRebalanceRoute\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"destinationToken\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"name\":\"pooledTokens\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"lpToken\",\"type\":\"address\"},{\"internalType\":\"bool\",\"name\":\"isEnabled\",\"type\":\"bool\"},{\"internalType\":\"uint32\",\"name\":\"lastLpFeeUpdate\",\"type\":\"uint32\"},{\"internalType\":\"int256\",\"name\":\"utilizedReserves\",\"type\":\"int256\"},{\"internalType\":\"uint256\",\"name\":\"liquidReserves\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"undistributedLpFees\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256[]\",\"name\":\"bundleEvaluationBlockNumbers\",\"type\":\"uint256[]\"},{\"internalType\":\"uint8\",\"name\":\"poolRebalanceLeafCount\",\"type\":\"uint8\"},{\"internalType\":\"bytes32\",\"name\":\"poolRebalanceRoot\",\"type\":\"bytes32\"},{\"internalType\":\"bytes32\",\"name\":\"relayerRefundRoot\",\"type\":\"bytes32\"},{\"internalType\":\"bytes32\",\"name\":\"slowRelayRoot\",\"type\":\"bytes32\"}],\"name\":\"proposeRootBundle\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"protocolFeeCaptureAddress\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"protocolFeeCapturePct\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"chainId\",\"type\":\"uint256\"},{\"internalType\":\"bytes\",\"name\":\"functionData\",\"type\":\"bytes\"}],\"name\":\"relaySpokePoolAdminFunction\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"l1Token\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"lpTokenAmount\",\"type\":\"uint256\"},{\"internalType\":\"bool\",\"name\":\"sendEth\",\"type\":\"bool\"}],\"name\":\"removeLiquidity\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"renounceOwnership\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"rootBundleProposal\",\"outputs\":[{\"internalType\":\"bytes32\",\"name\":\"poolRebalanceRoot\",\"type\":\"bytes32\"},{\"internalType\":\"bytes32\",\"name\":\"relayerRefundRoot\",\"type\":\"bytes32\"},{\"internalType\":\"bytes32\",\"name\":\"slowRelayRoot\",\"type\":\"bytes32\"},{\"internalType\":\"uint256\",\"name\":\"claimedBitMap\",\"type\":\"uint256\"},{\"internalType\":\"address\",\"name\":\"proposer\",\"type\":\"address\"},{\"internalType\":\"uint8\",\"name\":\"unclaimedPoolRebalanceLeafCount\",\"type\":\"uint8\"},{\"internalType\":\"uint32\",\"name\":\"requestExpirationTimestamp\",\"type\":\"uint32\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"contract IERC20\",\"name\":\"newBondToken\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"newBondAmount\",\"type\":\"uint256\"}],\"name\":\"setBond\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"l2ChainId\",\"type\":\"uint256\"},{\"internalType\":\"address\",\"name\":\"adapter\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"spokePool\",\"type\":\"address\"}],\"name\":\"setCrossChainContracts\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"time\",\"type\":\"uint256\"}],\"name\":\"setCurrentTime\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"originChainId\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"destinationChainId\",\"type\":\"uint256\"},{\"internalType\":\"address\",\"name\":\"originToken\",\"type\":\"address\"},{\"internalType\":\"bool\",\"name\":\"depositsEnabled\",\"type\":\"bool\"}],\"name\":\"setDepositRoute\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"newIdentifier\",\"type\":\"bytes32\"}],\"name\":\"setIdentifier\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint32\",\"name\":\"newLiveness\",\"type\":\"uint32\"}],\"name\":\"setLiveness\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bool\",\"name\":\"pause\",\"type\":\"bool\"}],\"name\":\"setPaused\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"destinationChainId\",\"type\":\"uint256\"},{\"internalType\":\"address\",\"name\":\"l1Token\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"destinationToken\",\"type\":\"address\"}],\"name\":\"setPoolRebalanceRoute\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"newProtocolFeeCaptureAddress\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"newProtocolFeeCapturePct\",\"type\":\"uint256\"}],\"name\":\"setProtocolFeeCapture\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"l1Token\",\"type\":\"address\"}],\"name\":\"sync\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"timerAddress\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"newOwner\",\"type\":\"address\"}],\"name\":\"transferOwnership\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"name\":\"unclaimedAccumulatedProtocolFees\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"weth\",\"outputs\":[{\"internalType\":\"contract WETH9\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"stateMutability\":\"payable\",\"type\":\"receive\"}],\"devdoc\":{\"details\":\"This contract should be deprecated by the year 2106, at which point uint32 timestamps will roll over. This is an issue for this contract because fee calculations will become bizarre when multiplying by negative time deltas. Before this date, this contract should be paused from accepting new root bundles and all LP tokens should be disabled by the admin.\",\"kind\":\"dev\",\"methods\":{\"addLiquidity(address,uint256)\":{\"params\":{\"l1Token\":\"Token to deposit into this contract.\",\"l1TokenAmount\":\"Amount of liquidity to provide.\"}},\"claimProtocolFeesCaptured(address)\":{\"params\":{\"l1Token\":\"Token whose protocol fees the caller wants to disburse.\"}},\"constructor\":{\"params\":{\"_finder\":\"Finder address.\",\"_lpTokenFactory\":\"LP Token factory address used to deploy LP tokens for new collateral types.\",\"_timer\":\"Timer address.\",\"_weth\":\"WETH address.\"}},\"disableL1TokenForLiquidityProvision(address)\":{\"params\":{\"l1Token\":\"Token to disable liquidity provision for.\"}},\"emergencyDeleteProposal()\":{\"details\":\"This is primarily intended to rectify situations where an unexecutable bundle gets through liveness in the case of a non-malicious bug in the proposal/dispute code. Without this function, the contract would be indefinitely blocked, migration would be required, and in-progress transfers would never be repaid.\"},\"enableL1TokenForLiquidityProvision(address)\":{\"params\":{\"l1Token\":\"Token to provide liquidity for.\"}},\"exchangeRateCurrent(address)\":{\"params\":{\"l1Token\":\"L1 token redeemable by burning LP token.\"},\"returns\":{\"_0\":\"Amount of L1 tokens redeemable for 1 unit LP token.\"}},\"executeRootBundle(uint256,uint256,uint256[],int256[],int256[],uint8,address[],bytes32[])\":{\"details\":\"In some cases, will instruct spokePool to send funds back to L1.\",\"params\":{\"bundleLpFees\":\"Array representing the total LP fee amount per token in this bundle for all bundled relays.\",\"chainId\":\"ChainId number of the target spoke pool on which the bundle is executed.\",\"groupIndex\":\"If set to 0, then relay roots to SpokePool via cross chain bridge. Used by off-chain validator to organize leaves with the same chain ID and also set which leaves should result in relayed messages.\",\"l1Tokens\":\"Array of all the tokens associated with the bundleLpFees, nedSendAmounts and runningBalances.\",\"leafId\":\"Index of this executed leaf within the poolRebalance tree.\",\"netSendAmounts\":\"Array representing the amount of tokens to send to the SpokePool on the target chainId.\",\"proof\":\"Inclusion proof for this leaf in pool rebalance root in root bundle.\",\"runningBalances\":\"Array used to track any unsent tokens that are not included in the netSendAmounts.\"}},\"getCurrentTime()\":{\"returns\":{\"_0\":\"uint for the current Testable timestamp.\"}},\"liquidityUtilizationCurrent(address)\":{\"params\":{\"l1Token\":\"L1 token to query utilization for.\"},\"returns\":{\"_0\":\"% of liquid reserves currently being \\\"used\\\" and sitting in SpokePools.\"}},\"liquidityUtilizationPostRelay(address,uint256)\":{\"params\":{\"l1Token\":\"L1 token to query utilization for.\",\"relayedAmount\":\"The higher this amount, the higher the utilization.\"},\"returns\":{\"_0\":\"% of liquid reserves currently being \\\"used\\\" and sitting in SpokePools plus the relayedAmount.\"}},\"loadEthForL2Calls()\":{\"details\":\"This function cannot be included in a multicall transaction call because it is payable. A realistic situation where this might be an issue is if the caller is executing a PoolRebalanceLeaf that needs to relay messages to Arbitrum. Relaying messages to Arbitrum requires that this contract has an ETH balance, so in this case the caller would need to pre-load this contract with ETH before multicall-executing the leaf.\"},\"owner()\":{\"details\":\"Returns the address of the current owner.\"},\"poolRebalanceRoute(uint256,address)\":{\"params\":{\"destinationChainId\":\"Where destination token is deployed.\",\"l1Token\":\"Ethereum version token.\"},\"returns\":{\"destinationToken\":\"address The destination token that is sent to spoke pools after this contract bridges the l1Token to the destination chain.\"}},\"proposeRootBundle(uint256[],uint8,bytes32,bytes32,bytes32)\":{\"params\":{\"bundleEvaluationBlockNumbers\":\"should contain the latest block number for all chains, even if there are no relays contained on some of them. The usage of this variable should be defined in an off chain UMIP.\",\"poolRebalanceLeafCount\":\"Number of leaves contained in pool rebalance root. Max is # of whitelisted chains.\",\"poolRebalanceRoot\":\"Pool rebalance root containing leaves that sends tokens from this contract to SpokePool.\",\"relayerRefundRoot\":\"Relayer refund root to publish to SpokePool where a data worker can execute leaves to refund relayers on their chosen refund chainId.\",\"slowRelayRoot\":\"Slow relay root to publish to Spoke Pool where a data worker can execute leaves to fulfill slow relays.\"}},\"relaySpokePoolAdminFunction(uint256,bytes)\":{\"details\":\"This function has permission to call onlyAdmin functions on the SpokePool, so it's imperative that this contract only allows the owner to call this method directly or indirectly.\",\"params\":{\"chainId\":\"Chain with SpokePool to send message to.\",\"functionData\":\"ABI encoded function call to send to SpokePool, but can be any arbitrary data technically.\"}},\"removeLiquidity(address,uint256,bool)\":{\"params\":{\"l1Token\":\"Token to redeem LP share for.\",\"lpTokenAmount\":\"Amount of LP tokens to burn. Exchange rate between L1 token and LP token can be queried via public exchangeRateCurrent method.\",\"sendEth\":\"Set to True if L1 token is WETH and user wants to receive ETH. Note that if caller is a contract, then the contract should have a way to receive ETH if this value is set to True. Similarly, if this value is set to False, then the calling contract should have a way to handle WETH.\"}},\"renounceOwnership()\":{\"details\":\"Leaves the contract without owner. It will not be possible to call `onlyOwner` functions anymore. Can only be called by the current owner. NOTE: Renouncing ownership will leave the contract without an owner, thereby removing any functionality that is only available to the owner.\"},\"setBond(address,uint256)\":{\"params\":{\"newBondAmount\":\"New bond amount.\",\"newBondToken\":\"New bond currency.\"}},\"setCrossChainContracts(uint256,address,address)\":{\"details\":\"We do not block setting the adapter or SpokePool to invalid/zero addresses because we want to allow the admin to block relaying roots to the spoke pool for emergency recovery purposes.\",\"params\":{\"adapter\":\"Adapter used to relay messages and tokens to spoke pool. Deployed on current chain.\",\"l2ChainId\":\"Chain to set contracts for.\",\"spokePool\":\"Recipient of relayed messages and tokens on spoke pool. Deployed on l2ChainId.\"}},\"setCurrentTime(uint256)\":{\"details\":\"Will revert if not running in test mode.\",\"params\":{\"time\":\"timestamp to set current Testable time to.\"}},\"setDepositRoute(uint256,uint256,address,bool)\":{\"details\":\"Admin is responsible for ensuring that `originToken` is linked to some L1 token on this contract, via poolRebalanceRoutes(), and that this L1 token also has a counterpart on the destination chain. If either condition fails, then the deposit will be unrelayable by off-chain relayers because they will not know which token to relay to recipients on the destination chain, and data workers wouldn't know which L1 token to send to the destination chain to refund the relayer.\",\"params\":{\"depositsEnabled\":\"Set to true to whitelist this route for deposits, set to false if caller just wants to map the origin token + destination ID to the destination token address on the origin chain's SpokePool.\",\"destinationChainId\":\"Chain where token depositor wants to receive funds.\",\"originChainId\":\"Chain where token deposit occurs.\",\"originToken\":\"Token sent in deposit.\"}},\"setIdentifier(bytes32)\":{\"params\":{\"newIdentifier\":\"New identifier.\"}},\"setLiveness(uint32)\":{\"params\":{\"newLiveness\":\"New liveness period.\"}},\"setPaused(bool)\":{\"params\":{\"pause\":\"true if the call is meant to pause the system, false if the call is meant to unpause it.\"}},\"setPoolRebalanceRoute(uint256,address,address)\":{\"details\":\"Admin can set destinationToken to 0x0 to effectively disable executing any root bundles with leaves containing this l1 token + destination chain ID combination.\",\"params\":{\"destinationChainId\":\"Destination chain where destination token resides.\",\"destinationToken\":\"Destination chain counterpart of L1 token.\",\"l1Token\":\"Token enabled for liquidity in this pool, and the L1 counterpart to the destination token on the destination chain ID.\"}},\"setProtocolFeeCapture(address,uint256)\":{\"params\":{\"newProtocolFeeCaptureAddress\":\"New protocol fee capture address.\",\"newProtocolFeeCapturePct\":\"New protocol fee capture %.\"}},\"transferOwnership(address)\":{\"details\":\"Transfers ownership of the contract to a new account (`newOwner`). Can only be called by the current owner.\"}},\"version\":1},\"userdoc\":{\"kind\":\"user\",\"methods\":{\"addLiquidity(address,uint256)\":{\"notice\":\"Deposit liquidity into this contract to earn LP fees in exchange for funding relays on SpokePools. Caller is essentially loaning their funds to be sent from this contract to the SpokePool, where it will be used to repay a relayer, and ultimately receives their loan back after the tokens are bridged back to this contract via the canonical token bridge. Then, the caller's loans are used again. This loan cycle repeats continuously and the caller, or \\\"liquidity provider\\\" earns a continuous fee for their credit that they are extending relayers.Caller will receive an LP token representing their share of this pool. The LP token's redemption value increments from the time that they enter the pool to reflect their accrued fees.The caller of this function must approve this contract to spend l1TokenAmount of l1Token.\"},\"claimProtocolFeesCaptured(address)\":{\"notice\":\"Send unclaimed accumulated protocol fees to fee capture address.\"},\"constructor\":{\"notice\":\"Construct HubPool.\"},\"disableL1TokenForLiquidityProvision(address)\":{\"notice\":\"Disables LPs from providing liquidity for L1 token. Callable only by owner.\"},\"disputeRootBundle()\":{\"notice\":\"Caller stakes a bond to dispute the current root bundle proposal assuming it has not passed liveness yet. The proposal is deleted, allowing a follow-up proposal to be submitted, and the dispute is sent to the optimistic oracle to be adjudicated. Can only be called within the liveness period of the current proposal.The caller of this function must approve this contract to spend bondAmount of l1Token.\"},\"emergencyDeleteProposal()\":{\"notice\":\"This allows for the deletion of the active proposal in case of emergency.\"},\"enableL1TokenForLiquidityProvision(address)\":{\"notice\":\"Enables LPs to provide liquidity for L1 token. Deploys new LP token for L1 token if appropriate. Callable only by owner.\"},\"exchangeRateCurrent(address)\":{\"notice\":\"Returns exchange rate of L1 token to LP token.\"},\"executeRootBundle(uint256,uint256,uint256[],int256[],int256[],uint8,address[],bytes32[])\":{\"notice\":\"Executes a pool rebalance leaf as part of the currently published root bundle. Will bridge any tokens from this contract to the SpokePool designated in the leaf, and will also publish relayer refund and slow relay roots to the SpokePool on the network specified in the leaf.Deletes the published root bundle if this is the last leaf to be executed in the root bundle.\"},\"getCurrentTime()\":{\"notice\":\"Gets the current time. Will return the last time set in `setCurrentTime` if running in test mode. Otherwise, it will return the block timestamp.\"},\"liquidityUtilizationCurrent(address)\":{\"notice\":\"Returns % of liquid reserves currently being \\\"used\\\" and sitting in SpokePools.\"},\"liquidityUtilizationPostRelay(address,uint256)\":{\"notice\":\"Returns % of liquid reserves currently being \\\"used\\\" and sitting in SpokePools and accounting for relayedAmount of tokens to be withdrawn from the pool.\"},\"loadEthForL2Calls()\":{\"notice\":\"This function allows a caller to load the contract with raw ETH to perform L2 calls. This is needed for Arbitrum calls, but may also be needed for others.\"},\"poolRebalanceRoute(uint256,address)\":{\"notice\":\"Conveniently queries which destination token is mapped to the hash of an l1 token + destination chain ID.\"},\"proposeRootBundle(uint256[],uint8,bytes32,bytes32,bytes32)\":{\"notice\":\"Publish a new root bundle along with all of the block numbers that the merkle roots are relevant for. This is used to aid off-chain validators in evaluating the correctness of this bundle. Caller stakes a bond that can be slashed if the root bundle proposal is invalid, and they will receive it back if accepted.After proposeRootBundle is called, if the any props are wrong then this proposal can be challenged. Once the challenge period passes, then the roots are no longer disputable, and only executeRootBundle can be called; moreover, this method can't be called again until all leaves are executed.The caller of this function must approve this contract to spend bondAmount of bondToken.\"},\"relaySpokePoolAdminFunction(uint256,bytes)\":{\"notice\":\"Sends message to SpokePool from this contract. Callable only by owner.\"},\"removeLiquidity(address,uint256,bool)\":{\"notice\":\"Burns LP share to redeem for underlying l1Token original deposit amount plus fees.\"},\"setBond(address,uint256)\":{\"notice\":\"Sets bond token and amount. Callable only by owner.\"},\"setCrossChainContracts(uint256,address,address)\":{\"notice\":\"Sets cross chain relay helper contracts for L2 chain ID. Callable only by owner.\"},\"setCurrentTime(uint256)\":{\"notice\":\"Sets the current time.\"},\"setDepositRoute(uint256,uint256,address,bool)\":{\"notice\":\"Sends cross-chain message to SpokePool on originChainId to enable or disable deposit route from that SpokePool to another one. Callable only by owner.\"},\"setIdentifier(bytes32)\":{\"notice\":\"Sets identifier for root bundle disputes. Callable only by owner.\"},\"setLiveness(uint32)\":{\"notice\":\"Sets root bundle proposal liveness period. Callable only by owner.\"},\"setPaused(bool)\":{\"notice\":\"Pauses the bundle proposal and execution process. This is intended to be used during upgrades or when something goes awry.\"},\"setPoolRebalanceRoute(uint256,address,address)\":{\"notice\":\"Store canonical destination token counterpart for l1 token. Callable only by owner.\"},\"setProtocolFeeCapture(address,uint256)\":{\"notice\":\"Sets protocolFeeCaptureAddress and protocolFeeCapturePct. Callable only by owner.\"},\"sync(address)\":{\"notice\":\"Synchronize any balance changes in this contract with the utilized & liquid reserves. This should be done at the conclusion of a L2->L1 token transfer via the canonical token bridge, when this contract's reserves do not reflect its true balance due to new tokens being dropped onto the contract at the conclusion of a bridging action.\"}},\"notice\":\"Contract deployed on Ethereum that houses L1 token liquidity for all SpokePools. A dataworker can interact with merkle roots stored in this contract via inclusion proofs to instruct this contract to send tokens to L2 SpokePools via \\\"pool rebalances\\\" that can be used to pay out relayers on those networks. This contract is also responsible for publishing relayer refund and slow relay merkle roots to SpokePools.This contract is meant to act as the cross chain administrator and owner of all L2 spoke pools, so all governance actions and pool rebalances originate from here and bridge instructions to L2s.\",\"version\":1}},\"settings\":{\"compilationTarget\":{\"contracts/HubPool.sol\":\"HubPool\"},\"evmVersion\":\"london\",\"libraries\":{},\"metadata\":{\"bytecodeHash\":\"ipfs\"},\"optimizer\":{\"enabled\":true,\"runs\":200},\"remappings\":[]},\"sources\":{\"@openzeppelin/contracts/access/Ownable.sol\":{\"keccak256\":\"0x24e0364e503a9bbde94c715d26573a76f14cd2a202d45f96f52134ab806b67b9\",\"license\":\"MIT\",\"urls\":[\"bzz-raw://e12cbaa7378fd9b62280e4e1d164bedcb4399ce238f5f98fc0eefb7e50577981\",\"dweb:/ipfs/QmXRoFGUgfsaRkoPT5bxNMtSayKTQ8GZATLPXf69HcRA51\"]},\"@openzeppelin/contracts/token/ERC20/IERC20.sol\":{\"keccak256\":\"0xbbc8ac883ac3c0078ce5ad3e288fbb3ffcc8a30c3a98c0fda0114d64fc44fca2\",\"license\":\"MIT\",\"urls\":[\"bzz-raw://87a7a5d2f6f63f84598af02b8c50ca2df2631cb8ba2453e8d95fcb17e4be9824\",\"dweb:/ipfs/QmR76hqtAcRqoFj33tmNjcWTLrgNsAaakYwnKZ8zoJtKei\"]},\"@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol\":{\"keccak256\":\"0xc3d946432c0ddbb1f846a0d3985be71299df331b91d06732152117f62f0be2b5\",\"license\":\"MIT\",\"urls\":[\"bzz-raw://4632c341a06ba5c079b51ca5a915efab4e6ab57735b37839b3e8365ff806a43e\",\"dweb:/ipfs/QmTHT3xHYed2wajEoA5qu7ii2BxLpPhQZHwAhtLK5Z7ANK\"]},\"@openzeppelin/contracts/utils/Address.sol\":{\"keccak256\":\"0x2ccf9d2313a313d41a791505f2b5abfdc62191b5d4334f7f7a82691c088a1c87\",\"license\":\"MIT\",\"urls\":[\"bzz-raw://b3a57d0854b2fdce6ebff933a48dca2445643d1eccfc27f00292e937f26c6a58\",\"dweb:/ipfs/QmW45rZooS9TqR4YXUbjRbtf2Bpb5ouSarBvfW1LdGprvV\"]},\"@openzeppelin/contracts/utils/Context.sol\":{\"keccak256\":\"0xe2e337e6dde9ef6b680e07338c493ebea1b5fd09b43424112868e9cc1706bca7\",\"license\":\"MIT\",\"urls\":[\"bzz-raw://6df0ddf21ce9f58271bdfaa85cde98b200ef242a05a3f85c2bc10a8294800a92\",\"dweb:/ipfs/QmRK2Y5Yc6BK7tGKkgsgn3aJEQGi5aakeSPZvS65PV8Xp3\"]},\"@openzeppelin/contracts/utils/cryptography/MerkleProof.sol\":{\"keccak256\":\"0xea64fbaccbf9d8c235cf6838240ddcebb97f9fc383660289e9dff32e4fb85f7a\",\"license\":\"MIT\",\"urls\":[\"bzz-raw://1e8a1dd0eac2fa865dc9a052bee01eec31677d7bc01b5b5aa825d820f3f1b343\",\"dweb:/ipfs/QmR8WuNeoAvJhnL7msQfQwaZEkwVnNyNDUNBL3Y616ohYa\"]},\"@openzeppelin/contracts/utils/math/SafeMath.sol\":{\"keccak256\":\"0xa2f576be637946f767aa56601c26d717f48a0aff44f82e46f13807eea1009a21\",\"license\":\"MIT\",\"urls\":[\"bzz-raw://973868f808e88e21a1a0a01d4839314515ee337ad096286c88e41b74dcc11fc2\",\"dweb:/ipfs/QmfYuZxRfx2J2xdk4EXN7jKg4bUYEMTaYk9BAw9Bqn4o2Y\"]},\"@openzeppelin/contracts/utils/math/SignedSafeMath.sol\":{\"keccak256\":\"0x62f53f262fabbbc6d8ab49488d8fce36370351aff2b8d3898d499d68995a71c2\",\"license\":\"MIT\",\"urls\":[\"bzz-raw://efd599513c2f313a3f5e9536beb2b80a0d2b3dd34202c174a707d81b7dc751ce\",\"dweb:/ipfs/QmdDiENVFSyWjfFskNLnViMH77DHg3oDthkSZk7dMzNNKB\"]},\"@uma/core/contracts/common/implementation/AncillaryData.sol\":{\"keccak256\":\"0x8ff33ac32d3e6de25de9e0ac2c0ff9a621f187fa97e9ee84092b327471baa3ce\",\"license\":\"AGPL-3.0-only\",\"urls\":[\"bzz-raw://0bbaed49756e8cf7ef405e132f441cd7a735ac6186a200b0179147e7d137b74a\",\"dweb:/ipfs/QmeSBJX5a61LZPxbkUKS2NF4LSxemgDwjD65fCAmyP7PX2\"]},\"@uma/core/contracts/common/implementation/FixedPoint.sol\":{\"keccak256\":\"0x996b97cc4fa5da4064e3aee500edc6972485d59a9334ceec81155e2c2f484dae\",\"license\":\"AGPL-3.0-only\",\"urls\":[\"bzz-raw://8d7c028926dc2b27e7dc103363dca8a43f60b3351f4a14bcb702660f95c68663\",\"dweb:/ipfs/QmXz4ieFjP5RxJ35F8GbPryYEGvFmxc4Gqx8EK7N57ixzT\"]},\"@uma/core/contracts/common/implementation/MultiCaller.sol\":{\"keccak256\":\"0x31f18055b14fd9eeb459c6d6a88d1a60921bf3755031f6db4b709c3e01d078f7\",\"urls\":[\"bzz-raw://1a002084305bc747b23e69e24cfd1f3aa730adc22dd76d1e077dc72bcffc41f0\",\"dweb:/ipfs/Qmb611uGKzhc2MHkMhqW3NG49FY3Tg1udh7zXttmPtfU2s\"]},\"@uma/core/contracts/common/implementation/Testable.sol\":{\"keccak256\":\"0x0254b45747293bb800373a58d123969adec0428f7be79dc941cab10fcad09918\",\"license\":\"AGPL-3.0-only\",\"urls\":[\"bzz-raw://537d694e3753596f507d071f283be9caeaad0010c444c9c9955d729affeb4907\",\"dweb:/ipfs/QmZ1WfVTBao11QaN6aygMhnt45UjRq77ZwfKPFmHiVSdaJ\"]},\"@uma/core/contracts/common/implementation/Timer.sol\":{\"keccak256\":\"0x9e0dd7389718bd5d1da910273a6f4cee98ee22bfc0c92bde0f0955c0e23adb5e\",\"license\":\"AGPL-3.0-only\",\"urls\":[\"bzz-raw://7ddac8d3cb76f8811156a11a7702d7c05b15a0f18c22b5abdc318723193f9266\",\"dweb:/ipfs/QmPxL7AU8NkURJaZ6WxXNcw88wGMSoPX4jbt7SMdPJqtYv\"]},\"@uma/core/contracts/common/interfaces/AddressWhitelistInterface.sol\":{\"keccak256\":\"0x22fb8588dff1d5cff76a28111d6c9b190765d99facd93c8ff3b54771f245c0d8\",\"license\":\"AGPL-3.0-only\",\"urls\":[\"bzz-raw://5ecd993f00de290a3c7bf21da23a9439cf2ccb22028316df92b79780ac8aa533\",\"dweb:/ipfs/QmTZ7x7U4EEzTacqapzSdFs2np5WNsqm4XeUBqzQxxDJei\"]},\"@uma/core/contracts/common/interfaces/ExpandedIERC20.sol\":{\"keccak256\":\"0xb8252039cba45f1c19cd677f150a9823a5d6e1845cad90e3041d97c96f273c26\",\"license\":\"AGPL-3.0-only\",\"urls\":[\"bzz-raw://95106656c95e12c30a2a4c482a859df6df55c3b56bb9f7835eb5c685ca3175d3\",\"dweb:/ipfs/QmcuJoX7T53vTCDcQK8WcCJdT1LzHS35vPmSVfg1DG32cd\"]},\"@uma/core/contracts/oracle/implementation/Constants.sol\":{\"keccak256\":\"0x36dcec83c5ac265b759b6a5559ec76088ce24854bf590ba66f808e8ecb59b97e\",\"license\":\"AGPL-3.0-only\",\"urls\":[\"bzz-raw://b6f16b1705220fe3692cca201d65993046b4cbb6dddbc35508c489606575bfc2\",\"dweb:/ipfs/QmdHvPibiSD7j9VJg73DaDPFBsCsWSxKpZJnVCSTErVTHC\"]},\"@uma/core/contracts/oracle/interfaces/FinderInterface.sol\":{\"keccak256\":\"0x9166fbfe08e954eb86d33c114fcde7ce4fd0dda5d9d28b31210582bfc769fa86\",\"license\":\"AGPL-3.0-only\",\"urls\":[\"bzz-raw://e611e12bcaaebfdf65b67c566ff1d34708e757f01a445bd87c55862e89383b81\",\"dweb:/ipfs/QmYNSq5oopTShdS6j4VWKqoLxmQSRKmWebCxw6K4LfmKrf\"]},\"@uma/core/contracts/oracle/interfaces/IdentifierWhitelistInterface.sol\":{\"keccak256\":\"0x9ae86a30dd1a8c03fb2c6d27be570bb30c4c0b13ac63cde8620b7e4b51d88dc9\",\"license\":\"AGPL-3.0-only\",\"urls\":[\"bzz-raw://a71d2aff48e075ecab56a9c9767775d1d77e04ec9191fed124e71003220549e3\",\"dweb:/ipfs/QmYPWsZXro6fzqpZY6UxQ5X8znEXfLp2sun8oXzdz8bTyc\"]},\"@uma/core/contracts/oracle/interfaces/OptimisticOracleInterface.sol\":{\"keccak256\":\"0x92e7280c1abd5f0c4fcd20247fc1b8428aaf4eeea59439c074d15fdaf9c64989\",\"license\":\"AGPL-3.0-only\",\"urls\":[\"bzz-raw://8d12bbcf0a91cef63c4767bffd047254599c5a1fce38e5e81d3005e102fdeef8\",\"dweb:/ipfs/QmTkd3AG9gdvBZq3HKCUW8eErvkguM2QqE3nUDGfvye3Yi\"]},\"@uma/core/contracts/oracle/interfaces/SkinnyOptimisticOracleInterface.sol\":{\"keccak256\":\"0x91d21e44a97b719106e8f97b99399a3d8dc3697badd01df06518892f38fe033f\",\"license\":\"AGPL-3.0-only\",\"urls\":[\"bzz-raw://68c350c822b256b43543ac4dd3dd1413ed95f25a9415d5dba4c562cd11d55716\",\"dweb:/ipfs/QmZyYeBnM59oPmWcK1KERNayg7xuHv12sLzzmqC42Lq76a\"]},\"@uma/core/contracts/oracle/interfaces/StoreInterface.sol\":{\"keccak256\":\"0xbb73671684309c91ad5ef3da1474051d03f2e7d5882bed7f5c4317e5d4c768df\",\"license\":\"AGPL-3.0-only\",\"urls\":[\"bzz-raw://32386544d3119fd0187a8c4e8b01c739f508ab863faa04345cabc2544081f9e8\",\"dweb:/ipfs/QmYszDURs1x75rsejZkGt9zCkASXnJtufbNsL3XHe2eJPQ\"]},\"contracts/HubPool.sol\":{\"keccak256\":\"0x15d7acdb5efa93d253a9bbe19bb262c05247cae31a9be00327b9ee52fa977759\",\"license\":\"GPL-3.0-only\",\"urls\":[\"bzz-raw://ef0985abd398be2138017319d96f26cf5a7c8c3ae62b42b68db1b34fa747932e\",\"dweb:/ipfs/Qma2Quw2Eoa3pohHPTzGbbxYY7RzvA1bN5iTQyAQfRssxy\"]},\"contracts/HubPoolInterface.sol\":{\"keccak256\":\"0x71b427ffd4a1e8c0cc681bafe050c536d79464f12559e90172681e6745f2e7bc\",\"license\":\"GPL-3.0-only\",\"urls\":[\"bzz-raw://ec8e6649ba75c2adbbb4b31b758dfb93dc175a763ce707585d392b86af4a51a1\",\"dweb:/ipfs/QmWqohvT4c9x8XqMgrYaGjyQpYzrxHT5qgwZQZ58NtaiVn\"]},\"contracts/Lockable.sol\":{\"keccak256\":\"0xef490be5cb859c97c6f600f3b0db0d50c6e18f334d3c74c6d9e693a260eaec3e\",\"license\":\"AGPL-3.0-only\",\"urls\":[\"bzz-raw://ff9fc27e0d0046034b06552411f1be06a0a6f1060291e259b9905616482f9382\",\"dweb:/ipfs/QmV7GNM5PztsfSnpnzJ5pcoPi4czE8SnxRWSz3QNKrzMx6\"]},\"contracts/MerkleLib.sol\":{\"keccak256\":\"0x5b49211d8b8e5a2792d08adb818fddc2ad8abaef45822f91ca678ceb7ea018ea\",\"license\":\"GPL-3.0-only\",\"urls\":[\"bzz-raw://0fe42462005b1ac62fe4eac31901bdcb2a1516489cbd0c061d0b99afbb8028c5\",\"dweb:/ipfs/QmZnAWBwPDnqgSK9cftJvQEXJfRjjCDR4ok8LiCB8VDqbX\"]},\"contracts/SpokePoolInterface.sol\":{\"keccak256\":\"0xe0ae593c1cd9c8204f0b7a3f226a5d4bd30d580692d2ecb2a33548b5b4e75f12\",\"license\":\"GPL-3.0-only\",\"urls\":[\"bzz-raw://b0c106a893a4de24bac6b59f85dc1e0eb8eb64c433f1d91bace911f14d62f093\",\"dweb:/ipfs/QmbttLUsuJQH9kvBcdb12r17DTi8M4eyStbuFP2QwMdJET\"]},\"contracts/interfaces/AdapterInterface.sol\":{\"keccak256\":\"0xbd7091006acbdfe72b21ce985f964f0682a2316d9d3b38967beeb55f4ae5118c\",\"license\":\"AGPL-3.0-only\",\"urls\":[\"bzz-raw://e9e59e0b5396d7d3f75e367d2b1892efd1e704a96823a95eabe67b5d91df2821\",\"dweb:/ipfs/QmXsyx77ZKLGigeiS425jhXJJiu7tbtEbnBxe3RaSiFqk6\"]},\"contracts/interfaces/LpTokenFactoryInterface.sol\":{\"keccak256\":\"0x9cf1d6df25bb1bdf34db2473f3caaa4264b628ae2fc0f0a5a0256fd41214b47d\",\"license\":\"AGPL-3.0-only\",\"urls\":[\"bzz-raw://446f2e36f2ebf2220253f1626e5ee9f8291b717733fbe720bd90f8fa8c8ffefc\",\"dweb:/ipfs/QmYX7HeRao7gGsNwLxfCKDicLJi7EnDBJtYSCdYmDxdx34\"]},\"contracts/interfaces/WETH9.sol\":{\"keccak256\":\"0x7b444d0840b1f76eee9bf39d74830f70644395613b96cce2d80fc50785a82eaa\",\"license\":\"GPL-3.0-only\",\"urls\":[\"bzz-raw://9241f8ea371edb800af4529a224c5ecc791b517b20a60cea69e2ebc51f7481ce\",\"dweb:/ipfs/QmTkRUXUrqhEvKBs1dcUypQ9n8ai9i8jH6AG1ziBRJTNvS\"]}},\"version\":1}", + "bytecode": "0x60e06040527f49535f4143524f53535f56325f42554e444c455f56414c494400000000000000600b5565015d3ef79800600c556012805463ffffffff1916611c201790553480156200005057600080fd5b5060405162004c2a38038062004c2a833981016040819052620000739162000149565b600080546001600160a81b0319166001600160a01b03831617600160a01b179055620000a6620000a03390565b620000de565b506001600160a01b0392831660a05290821660c0528116608052600154600e80546001600160a01b03191691909216179055620001b1565b600180546001600160a01b038381166001600160a01b0319831681179093556040519116919082907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e090600090a35050565b6001600160a01b03811681146200014657600080fd5b50565b600080600080608085870312156200016057600080fd5b84516200016d8162000130565b6020860151909450620001808162000130565b6040860151909350620001938162000130565b6060860151909250620001a68162000130565b939692955090935050565b60805160a05160c051614a0362000227600039600081816107e601528181610c010152818161184001528181612d8a0152612f800152600081816106a8015261266d015260008181610514015281816109ae01528181610e5f01528181610fc801528181611a580152611bbe0152614a036000f3fe60806040526004361061027f5760003560e01c8063625997c01161014f578063a5841194116100c1578063dd70e5e81161007a578063dd70e5e814610848578063e0f339e314610868578063e40064d714610888578063e460e35c146108b5578063f0056a7d146108d5578063f2fde38b1461097a5761028e565b8063a584119414610774578063ac9650d814610794578063b60c2d7d146107b4578063b9a3c84c146107d4578063c28f439214610808578063cd949995146108285761028e565b80637998a1c4116101135780637998a1c4146106ca57806380c09a82146106e057806380f323a7146107005780638bda0c00146107165780638da5cb5b14610736578063a16fd6e9146107545761028e565b8063625997c01461063a57806369b625021461028c5780636ad0690a1461064f578063715018a61461068157806376ec08dd146106965761028e565b806322f8e566116101f35780633fc8cef3116101ac5780633fc8cef3146105025780634144fd61146105365780634f7473ff146105c757806356688700146105dd57806356864f38146105f05780635c975abb146106105761028e565b806322f8e5661461044d578063240f475f1461046d57806329cb924d1461048d5780632d0f6f84146104a25780632d32d557146104c257806333dc09ca146104e25761028e565b80630ee28a88116102455780630ee28a881461038a57806310b99527146103aa57806311cfc159146103ca57806316c38b3c146103e05780631c39c38d1461040057806322395aaa146104385761028e565b8062660b5314610296578062c99206146102b6578063084d0513146102d657806309474ae2146103095780630c501af91461036a5761028e565b3661028e5761028c61099a565b005b61028c61099a565b3480156102a257600080fd5b5061028c6102b1366004613cf9565b610a23565b3480156102c257600080fd5b5061028c6102d1366004613d25565b610b6f565b3480156102e257600080fd5b506102f66102f1366004613cf9565b610d70565b6040519081526020015b60405180910390f35b34801561031557600080fd5b5061034a610324366004613d25565b600a60205260009081526040902080546001909101546001600160a01b03918216911682565b604080516001600160a01b03938416815292909116602083015201610300565b34801561037657600080fd5b5061028c610385366004613d3e565b610d9c565b34801561039657600080fd5b5061028c6103a5366004613d69565b610e43565b3480156103b657600080fd5b5061028c6103c5366004613dab565b6110c7565b3480156103d657600080fd5b506102f6600c5481565b3480156103ec57600080fd5b5061028c6103fb366004613de2565b611175565b34801561040c57600080fd5b50600054610420906001600160a01b031681565b6040516001600160a01b039091168152602001610300565b34801561044457600080fd5b5061028c6111f1565b34801561045957600080fd5b5061028c610468366004613d25565b6115c3565b34801561047957600080fd5b50600e54610420906001600160a01b031681565b34801561049957600080fd5b506102f661161e565b3480156104ae57600080fd5b5061028c6104bd366004613d3e565b6116af565b3480156104ce57600080fd5b506104206104dd366004613dff565b61172d565b3480156104ee57600080fd5b5061028c6104fd366004613cf9565b61175e565b34801561050e57600080fd5b506104207f000000000000000000000000000000000000000000000000000000000000000081565b34801561054257600080fd5b5060025460035460045460055460065461058094939291906001600160a01b03811690600160a01b810460ff1690600160a81b900463ffffffff1687565b6040805197885260208801969096529486019390935260608501919091526001600160a01b0316608084015260ff1660a083015263ffffffff1660c082015260e001610300565b3480156105d357600080fd5b506102f6600f5481565b61028c6105eb366004613cf9565b6119d9565b3480156105fc57600080fd5b5061028c61060b366004613e2f565b611cb5565b34801561061c57600080fd5b5060075461062a9060ff1681565b6040519015158152602001610300565b34801561064657600080fd5b5061028c611d9d565b34801561065b57600080fd5b5060125461066c9063ffffffff1681565b60405163ffffffff9091168152602001610300565b34801561068d57600080fd5b5061028c611e81565b3480156106a257600080fd5b506104207f000000000000000000000000000000000000000000000000000000000000000081565b3480156106d657600080fd5b506102f6600b5481565b3480156106ec57600080fd5b5061028c6106fb366004613fc4565b611eb5565b34801561070c57600080fd5b506102f660115481565b34801561072257600080fd5b5061028c6107313660046140ba565b612238565b34801561074257600080fd5b506001546001600160a01b0316610420565b34801561076057600080fd5b506102f661076f366004613d3e565b612402565b34801561078057600080fd5b5061028c61078f366004613d3e565b61242e565b6107a76107a2366004614122565b61244f565b60405161030091906141ef565b3480156107c057600080fd5b5061028c6107cf366004613d3e565b6125f5565b3480156107e057600080fd5b506104207f000000000000000000000000000000000000000000000000000000000000000081565b34801561081457600080fd5b50601054610420906001600160a01b031681565b34801561083457600080fd5b5061028c610843366004614251565b6127b4565b34801561085457600080fd5b5061028c61086336600461429f565b612882565b34801561087457600080fd5b506102f6610883366004613d3e565b6128ce565b34801561089457600080fd5b506102f66108a3366004613d3e565b600d6020526000908152604090205481565b3480156108c157600080fd5b5061028c6108d0366004613dab565b6128e9565b3480156108e157600080fd5b506109386108f0366004613d3e565b60096020526000908152604090208054600182015460028301546003909301546001600160a01b03831693600160a01b840460ff1693600160a81b900463ffffffff16929186565b604080516001600160a01b039097168752941515602087015263ffffffff909316938501939093526060840152608083019190915260a082015260c001610300565b34801561098657600080fd5b5061028c610995366004613d3e565b6129c2565b600054600160a01b900460ff1615610a21577f00000000000000000000000000000000000000000000000000000000000000006001600160a01b031663d0e30db0346040518263ffffffff1660e01b81526004016000604051808303818588803b158015610a0757600080fd5b505af1158015610a1b573d6000803e3d6000fd5b50505050505b565b6001546001600160a01b03163314610a565760405162461bcd60e51b8152600401610a4d90614324565b60405180910390fd5b610a5e612a5a565b610a66612ab3565b670de0b6b3a7640000811115610abe5760405162461bcd60e51b815260206004820152601960248201527f4261642070726f746f636f6c46656543617074757265506374000000000000006044820152606401610a4d565b6001600160a01b038216610b145760405162461bcd60e51b815260206004820152601d60248201527f4261642070726f746f636f6c46656543617074757265416464726573730000006044820152606401610a4d565b600e80546001600160a01b0319166001600160a01b038416908117909155600f8290556040518291907fc1993b89fd79a19ece7beb067ddc8534ca26d29c0ff94ea2f53b4a508d1eedc990600090a3610b6b612ac2565b5050565b6001546001600160a01b03163314610b995760405162461bcd60e51b8152600401610a4d90614324565b600654600160a01b900460ff1615610bc35760405162461bcd60e51b8152600401610a4d90614359565b610bcb612a5a565b610bd3612ab3565b6040516302abf57960e61b8152721259195b9d1a599a595c95da1a5d195b1a5cdd606a1b60048201526000907f00000000000000000000000000000000000000000000000000000000000000006001600160a01b03169063aafd5e4090602401602060405180830381865afa158015610c50573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610c749190614390565b6040516390978d1b60e01b8152600481018490529091506001600160a01b038216906390978d1b90602401602060405180830381865afa158015610cbc573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610ce091906143ad565b610d2c5760405162461bcd60e51b815260206004820152601860248201527f4964656e746966696572206e6f7420737570706f7274656400000000000000006044820152606401610a4d565b600b8290556040518281527ff45367c278fcceff23d601ce4bdd191e5bd61687ff9f29dc7276a08fe54c0c5d9060200160405180910390a150610d6d612ac2565b50565b6000610d7a612a5a565b610d82612ab3565b610d8c8383612ad7565b9050610d96612ac2565b92915050565b6001546001600160a01b03163314610dc65760405162461bcd60e51b8152600401610a4d90614324565b610dce612a5a565b610dd6612ab3565b6001600160a01b03818116600081815260096020908152604091829020805460ff60a01b1981169091558251938452909316928201929092527fac111b3b527b307393c94d98f26140effb71411054466818be97912d2d65f77691015b60405180910390a1610d6d612ac2565b610e4b612a5a565b610e53612ab3565b826001600160a01b03167f00000000000000000000000000000000000000000000000000000000000000006001600160a01b03161480610e91575080155b610ecd5760405162461bcd60e51b815260206004820152600d60248201526c086c2dce840e6cadcc840cae8d609b1b6044820152606401610a4d565b6000670de0b6b3a7640000610ee185612bcf565b610eeb90856143e0565b610ef59190614415565b6001600160a01b038581166000908152600960205260409081902054905163079cc67960e41b81523360048201526024810187905292935016906379cc6790906044016020604051808303816000875af1158015610f57573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610f7b91906143ad565b506001600160a01b03841660009081526009602052604081206002018054839290610fa7908490614429565b9091555050811561105f57604051632e1a7d4d60e01b8152600481018290527f00000000000000000000000000000000000000000000000000000000000000006001600160a01b031690632e1a7d4d90602401600060405180830381600087803b15801561101457600080fd5b505af1158015611028573d6000803e3d6000fd5b505060405133925083156108fc02915083906000818181858888f19350505050158015611059573d6000803e3d6000fd5b50611073565b6110736001600160a01b0385163383612cca565b604080518281526020810185905233916001600160a01b038716917fcda1185f28599e6bd14ab8a68b3c30a11e1dce4256b5e67e94dd3fd846a6c589910160405180910390a3506110c2612ac2565b505050565b6001546001600160a01b031633146110f15760405162461bcd60e51b8152600401610a4d90614324565b6110f9612a5a565b611101612ab3565b80600860006111108587612d2d565b815260208101919091526040908101600090812080546001600160a01b0319166001600160a01b0394851617905590518383169285169186917f234e7af08f77827792cc909447f27d2e6a3e2d839b04e26b50b71704a131c8a89190a46110c2612ac2565b6001546001600160a01b0316331461119f5760405162461bcd60e51b8152600401610a4d90614324565b6111a7612a5a565b6111af612ab3565b6007805460ff19168215159081179091556040517f0e2fb031ee032dc02d8011dc50b816eb450cf856abd8261680dac74f72165bd290600090a2610d6d612ac2565b6111f9612a5a565b611201612ab3565b600061120b61161e565b60065490915063ffffffff600160a81b909104811690821611156112715760405162461bcd60e51b815260206004820152601760248201527f5265717565737420706173736564206c6976656e6573730000000000000000006044820152606401610a4d565b600061127b612d6a565b905060115481106112955761128e612e70565b505061159c565b600061129f612f4f565b6011546010549192506112bd916001600160a01b0316908390612ff3565b806001600160a01b031663af355d1e600b5485601060009054906101000a90046001600160a01b03166000876011546112f69190614429565b60125460065460405160e089901b6001600160e01b0319168152600481019790975263ffffffff9586166024880152610120604488015260006101248801526001600160a01b039485166064880152608487019390935260a48601919091529290921660c48401521660e4820152670de0b6b3a7640000610104820152610144016020604051808303816000875af19250505080156113b2575060408051601f3d908101601f191682019092526113af91810190614440565b60015b6113c6576113be612e70565b50505061159c565b6010546113de906001600160a01b03168360006130a5565b5060408051610160810182526006546001600160a01b0390811682526000602083018190526010549091169282019290925260608101829052670de0b6b3a7640000608082015260a0810182905260125460c08201906114449063ffffffff1687614459565b63ffffffff168152602001600081526020018481526020018460115461146a9190614429565b815260125463ffffffff9081166020909201919091526000600281905560038190556004819055600555600680546001600160c81b03191690556011546010549293506114c5926001600160a01b031691339130916131ba16565b6011546010546114e2916001600160a01b03909116908490612ff3565b600b5460405163139c641960e31b81526001600160a01b03841691639ce320c89161151891908890869033903090600401614481565b6020604051808303816000875af1158015611537573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061155b9190614440565b5060405163ffffffff8516815233907f15951cb2ef6993bc23a55912e7d0bcac13e4797c432aaa334816aed6914a7a909060200160405180910390a2505050505b6115bb6115a7612f4f565b6010546001600160a01b03169060006130a5565b610a21612ac2565b6000546001600160a01b03166115d857600080fd5b60005460405163117c72b360e11b8152600481018390526001600160a01b03909116906322f8e56690602401600060405180830381600087803b158015610a0757600080fd5b600080546001600160a01b0316156116aa5760008054906101000a90046001600160a01b03166001600160a01b03166329cb924d6040518163ffffffff1660e01b8152600401602060405180830381865afa158015611681573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906116a59190614440565b905090565b504290565b6116b7612a5a565b6116bf612ab3565b6001600160a01b038082166000818152600d602052604081208054919055600e5490926116ee92911683612cca565b60405181906001600160a01b038416907f74740239d7d696c84422b720e125e1f47c4138c66d1f4d2a48e99f4197cdb79c90600090a350610d6d612ac2565b60006008600061173d8486612d2d565b81526020810191909152604001600020546001600160a01b03169392505050565b6001546001600160a01b031633146117885760405162461bcd60e51b8152600401610a4d90614324565b600654600160a01b900460ff16156117b25760405162461bcd60e51b8152600401610a4d90614359565b6117ba612a5a565b6117c2612ab3565b806000036118125760405162461bcd60e51b815260206004820152601760248201527f626f6e6420657175616c20746f2066696e616c206665650000000000000000006044820152606401610a4d565b6040516302abf57960e61b81527210dbdb1b185d195c985b15da1a5d195b1a5cdd606a1b60048201526000907f00000000000000000000000000000000000000000000000000000000000000006001600160a01b03169063aafd5e4090602401602060405180830381865afa15801561188f573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906118b39190614390565b604051631d1d5b3960e11b81526001600160a01b03858116600483015291925090821690633a3ab67290602401602060405180830381865afa1580156118fd573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061192191906143ad565b6119605760405162461bcd60e51b815260206004820152601060248201526f139bdd081bdb881dda1a5d195b1a5cdd60821b6044820152606401610a4d565b601080546001600160a01b0319166001600160a01b038516179055611983612d6a565b61198d9083614574565b60118190556040519081526001600160a01b038416907fbfa9a96010167e98ce8c004f718932cbbfd33a58d681c752e693be7d457a1b3b9060200160405180910390a250610b6b612ac2565b6119e1612a5a565b6119e9612ab3565b6001600160a01b038216600090815260096020526040902054600160a01b900460ff16611a4c5760405162461bcd60e51b8152602060048201526011602482015270151bdad95b881b9bdd08195b98589b1959607a1b6044820152606401610a4d565b816001600160a01b03167f00000000000000000000000000000000000000000000000000000000000000006001600160a01b0316148015611a8c57508034145b80611a95575034155b611ad15760405162461bcd60e51b815260206004820152600d60248201526c426164206d73672e76616c756560981b6044820152606401610a4d565b6000611adc83612bcf565b611aee83670de0b6b3a76400006143e0565b611af89190614415565b6001600160a01b038416600090815260096020526040812060020180549293508492909190611b28908490614574565b90915550506001600160a01b03838116600090815260096020526040908190205490516340c10f1960e01b8152336004820152602481018490529116906340c10f19906044016020604051808303816000875af1158015611b8d573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611bb191906143ad565b50826001600160a01b03167f00000000000000000000000000000000000000000000000000000000000000006001600160a01b0316148015611bf35750600034115b15611c5157826001600160a01b031663d0e30db0346040518263ffffffff1660e01b81526004016000604051808303818588803b158015611c3357600080fd5b505af1158015611c47573d6000803e3d6000fd5b5050505050611c66565b611c666001600160a01b0384163330856131ba565b604080518381526020810183905233916001600160a01b038616917f3c69701a61c79a92ef9692903aaa0068bce8771361ecb09547391e4fb4df8537910160405180910390a350610b6b612ac2565b611cbd612a5a565b611cc5612ab3565b6001546001600160a01b03163314611cef5760405162461bcd60e51b8152600401610a4d90614324565b6040516001600160a01b0383166024820152604481018490528115156064820152611d4890859060840160408051601f198184030181529190526020810180516001600160e01b031663272751c760e01b1790526131f2565b816001600160a01b031683857fb7d00a563842efb2c121a0eb02b7bb7ba1a34625bbc3d65057f1f0dbec0ec2a184604051611d87911515815260200190565b60405180910390a4611d97612ac2565b50505050565b6001546001600160a01b03163314611dc75760405162461bcd60e51b8152600401610a4d90614324565b611dcf612a5a565b611dd7612ab3565b600654600160a01b900460ff1615611e0a57600654601154601054611e0a926001600160a01b0391821692911690612cca565b6006546003546002546004546040519081526001600160a01b03909316927f993cba33f9b140c9ce20ba10d7eda92128d5beb6df856f064916108a11647a739060200160405180910390a46000600281905560038190556004819055600555600680546001600160c81b0319169055610a21612ac2565b6001546001600160a01b03163314611eab5760405162461bcd60e51b8152600401610a4d90614324565b610a2160006132f6565b611ebd612a5a565b611ec5612ab3565b60075460ff1615611f185760405162461bcd60e51b815260206004820181905260248201527f50726f706f73616c2070726f6365737320686173206265656e207061757365646044820152606401610a4d565b600654600160a81b900463ffffffff16611f3061161e565b11611f735760405162461bcd60e51b81526020600482015260136024820152724e6f7420706173736564206c6976656e65737360681b6044820152606401610a4d565b600554600160ff85161b90811603611fbf5760405162461bcd60e51b815260206004820152600f60248201526e105b1c9958591e4818db185a5b5959608a1b6044820152606401610a4d565b6120046002600001546040518060e001604052808b81526020018981526020018881526020018781526020018a81526020018660ff1681526020018581525083613348565b61203c5760405162461bcd60e51b81526020600482015260096024820152682130b210283937b7b360b91b6044820152606401610a4d565b6000806120488a613385565b9150915061205b60026003015486613451565b60055560068054600160a01b900460ff169060146120788361458c565b91906101000a81548160ff021916908360ff1602179055505061209f82828c878b8d613474565b886000036121a157600354600454604051602481019290925260448201526000906001600160a01b03841690839060640160408051601f198184030181529181526020820180516001600160e01b031663124e93e160e21b179052516121099291906024016145a9565b60408051601f198184030181529181526020820180516001600160e01b0316637375c56f60e11b1790525161213e91906145cd565b600060405180830381855af49150503d8060008114612179576040519150601f19603f3d011682016040523d82523d6000602084013e61217e565b606091505b505090508061219f5760405162461bcd60e51b8152600401610a4d906145e9565b505b600654600160a01b900460ff166000036121d6576006546011546010546121d6926001600160a01b0391821692911690612cca565b336001600160a01b03168a8660ff167ff652dd63b1aedbf9e740f3152fb67b0d94d069cf1182811ebd88921850d935678c888d8d8d60405161221c95949392919061468a565b60405180910390a4505061222e612ac2565b5050505050505050565b612240612a5a565b612248612ab3565b600654600160a01b900460ff16156122725760405162461bcd60e51b8152600401610a4d90614359565b60075460ff16156122c55760405162461bcd60e51b815260206004820181905260248201527f50726f706f73616c2070726f6365737320686173206265656e207061757365646044820152606401610a4d565b60008460ff16116123185760405162461bcd60e51b815260206004820181905260248201527f42756e646c65206d7573742068617665206174206c656173742031206c6561666044820152606401610a4d565b60125460009063ffffffff1661232c61161e565b6123369190614459565b60006005556006805460028790556003869055600485905560ff8816600160a01b0263ffffffff808516600160a81b0260ff60a01b19166001600160c81b031990931692909217176001600160a01b031916339081179092556011546010549394506123b0936001600160a01b031692913091906131ba16565b336001600160a01b031683857f50e585dd6361c7cb2613ce2334814bb2a789f5a8ad4b161fe0e248043737d1d284898b886040516123f194939291906146e9565b60405180910390a450610a1b612ac2565b600061240c612a5a565b612414612ab3565b61241f826000612ad7565b9050612429612ac2565b919050565b612436612a5a565b61243e612ab3565b61244781613738565b610d6d612ac2565b6060341561249f5760405162461bcd60e51b815260206004820152601b60248201527f4f6e6c79206d756c746963616c6c207769746820302076616c756500000000006044820152606401610a4d565b8167ffffffffffffffff8111156124b8576124b8613e79565b6040519080825280602002602001820160405280156124eb57816020015b60608152602001906001900390816124d65790505b50905060005b828110156125ee576000803086868581811061250f5761250f614722565b90506020028101906125219190614738565b60405161252f929190614786565b600060405180830381855af49150503d806000811461256a576040519150601f19603f3d011682016040523d82523d6000602084013e61256f565b606091505b5091509150816125bb5760448151101561258857600080fd5b600481019050808060200190518101906125a29190614796565b60405162461bcd60e51b8152600401610a4d9190614804565b808484815181106125ce576125ce614722565b6020026020010181905250505080806125e690614817565b9150506124f1565b5092915050565b6001546001600160a01b0316331461261f5760405162461bcd60e51b8152600401610a4d90614324565b612627612a5a565b61262f612ab3565b6001600160a01b038181166000908152600960205260409020541661274d57604051637e178db760e11b81526001600160a01b0382811660048301527f0000000000000000000000000000000000000000000000000000000000000000169063fc2f1b6e906024016020604051808303816000875af11580156126b6573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906126da9190614390565b6001600160a01b03828116600090815260096020526040902080546001600160a01b0319169290911691909117905561271161161e565b6001600160a01b0382166000908152600960205260409020805463ffffffff92909216600160a81b0263ffffffff60a81b199092169190911790555b6001600160a01b038181166000818152600960209081526040918290208054600160a01b60ff60a01b198216179091558251938452909316928201929092527f04e291c80180d65a57b5bf1bed775777ec0d6f283ef34bcf130712714d8bb7f79101610e33565b6001546001600160a01b031633146127de5760405162461bcd60e51b8152600401610a4d90614324565b6127e6612a5a565b6127ee612ab3565b6102588163ffffffff161161283a5760405162461bcd60e51b8152602060048201526012602482015271131a5d995b995cdcc81d1bdbc81cda1bdc9d60721b6044820152606401610a4d565b6012805463ffffffff191663ffffffff83169081179091556040519081527f04dd1d84d387f404568a7954b5e398518bdd716e1a8f4a790be9a1a225ad934790602001610e33565b6001546001600160a01b031633146128ac5760405162461bcd60e51b8152600401610a4d90614324565b6128b4612a5a565b6128bc612ab3565b6128c682826131f2565b610b6b612ac2565b60006128d8612a5a565b6128e0612ab3565b61241f82612bcf565b6001546001600160a01b031633146129135760405162461bcd60e51b8152600401610a4d90614324565b61291b612a5a565b612923612ab3565b6040805180820182526001600160a01b03848116808352848216602080850182815260008a8152600a8352879020955186549086166001600160a01b031991821617875590516001909601805496909516951694909417909255835187815292830152918101919091527f36050d958750e6ac3aa674ac7bbe8d0ae6a2f7d4b808e8c2c42c1f22fc9fc4bb9060600160405180910390a16110c2612ac2565b6001546001600160a01b031633146129ec5760405162461bcd60e51b8152600401610a4d90614324565b6001600160a01b038116612a515760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201526564647265737360d01b6064820152608401610a4d565b610d6d816132f6565b600054600160a01b900460ff16610a215760405162461bcd60e51b815260206004820152601f60248201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c006044820152606401610a4d565b6000805460ff60a01b19169055565b6000805460ff60a01b1916600160a01b179055565b6000612ae283613738565b6001600160a01b038381166000908152600960209081526040808320815160c08101835281549586168152600160a01b860460ff16151593810193909352600160a81b90940463ffffffff16908201526001830154606082018190526002840154608083015260039093015460a0820152918112612b61576000612b67565b81606001515b90506000612b758286614574565b90506000828460800151612b899190614574565b905080600003612ba757670de0b6b3a7640000945050505050610d96565b80612bba83670de0b6b3a76400006143e0565b612bc49190614415565b979650505050505050565b6001600160a01b038082166000908152600960209081526040808320805482516318160ddd60e01b8152925194959194869491909216926318160ddd92600480830193928290030181865afa158015612c2c573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190612c509190614440565b905080600003612c6b5750670de0b6b3a76400009392505050565b612c7482613887565b612c7d84613738565b6000826003015483600101548460020154612c989190614830565b612ca29190614871565b905081612cb782670de0b6b3a76400006143e0565b612cc19190614415565b95945050505050565b6040516001600160a01b0383166024820152604481018290526110c290849063a9059cbb60e01b906064015b60408051601f198184030181529190526020810180516001600160e01b03166001600160e01b0319909316929092179091526138ef565b604080516001600160a01b038416602082015290810182905260009060600160405160208183030381529060405280519060200120905092915050565b6040516302abf57960e61b81526453746f726560d81b60048201526000907f00000000000000000000000000000000000000000000000000000000000000006001600160a01b03169063aafd5e4090602401602060405180830381865afa158015612dd9573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190612dfd9190614390565b601054604051635b97aadd60e01b81526001600160a01b039182166004820152911690635b97aadd90602401602060405180830381865afa158015612e46573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190612e6a91906148b0565b51919050565b60105460065460115460405163a9059cbb60e01b81526001600160a01b039283166004820152602481019190915291169063a9059cbb906044016020604051808303816000875af1158015612ec9573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190612eed91906143ad565b506000600281905560038190556004819055600555600680546001600160c81b0319169055337f0cfbbf45ab7f5225663454de7117b1b0ed5a7c133b61f54ccf367dcf8b6d4d59612f3c61161e565b60405190815260200160405180910390a2565b6040516302abf57960e61b815275536b696e6e794f7074696d69737469634f7261636c6560501b60048201526000907f00000000000000000000000000000000000000000000000000000000000000006001600160a01b03169063aafd5e4090602401602060405180830381865afa158015612fcf573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906116a59190614390565b604051636eb1769f60e11b81523060048201526001600160a01b038381166024830152600091839186169063dd62ed3e90604401602060405180830381865afa158015613044573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906130689190614440565b6130729190614574565b6040516001600160a01b038516602482015260448101829052909150611d9790859063095ea7b360e01b90606401612cf6565b80158061311f5750604051636eb1769f60e11b81523060048201526001600160a01b03838116602483015284169063dd62ed3e90604401602060405180830381865afa1580156130f9573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061311d9190614440565b155b61318a5760405162461bcd60e51b815260206004820152603660248201527f5361666545524332303a20617070726f76652066726f6d206e6f6e2d7a65726f60448201527520746f206e6f6e2d7a65726f20616c6c6f77616e636560501b6064820152608401610a4d565b6040516001600160a01b0383166024820152604481018290526110c290849063095ea7b360e01b90606401612cf6565b6040516001600160a01b0380851660248301528316604482015260648101829052611d979085906323b872dd60e01b90608401612cf6565b6000806131fe84613385565b915091506000826001600160a01b031682856040516024016132219291906145a9565b60408051601f198184030181529181526020820180516001600160e01b0316637375c56f60e11b1790525161325691906145cd565b600060405180830381855af49150503d8060008114613291576040519150601f19603f3d011682016040523d82523d6000602084013e613296565b606091505b50509050806132b75760405162461bcd60e51b8152600401610a4d906145e9565b847f218987b934c2f6bc596136829fbf43a5fef4d6fafce41f3f6254d9a870c2deec856040516132e79190614804565b60405180910390a25050505050565b600180546001600160a01b038381166001600160a01b0319831681179093556040519116919082907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e090600090a35050565b600061337b82858560405160200161336091906148f2565b604051602081830303815290604052805190602001206139c1565b90505b9392505050565b6000818152600a6020526040902080546001909101546001600160a01b039182169116806133f55760405162461bcd60e51b815260206004820152601960248201527f53706f6b65506f6f6c206e6f7420696e697469616c697a6564000000000000006044820152606401610a4d565b6001600160a01b0382163b61344c5760405162461bcd60e51b815260206004820152601760248201527f41646170746572206e6f7420696e697469616c697a65640000000000000000006044820152606401610a4d565b915091565b600061346261010060ff8416614989565b61ffff166001901b8317905092915050565b60005b83518163ffffffff16101561372f576000848263ffffffff16815181106134a0576134a0614722565b602002602001015190506000600860006134ba848a612d2d565b81526020810191909152604001600020546001600160a01b031690508061351b5760405162461bcd60e51b8152602060048201526015602482015274149bdd5d19481b9bdd081dda1a5d195b1a5cdd1959605a1b6044820152606401610a4d565b6000858463ffffffff168151811061353557613535614722565b602002602001015113156136f1576000896001600160a01b03168383888763ffffffff168151811061356957613569614722565b60209081029190910101516040516001600160a01b03938416602482015291831660448301526064820152908b16608482015260a40160408051601f198184030181529181526020820180516001600160e01b03166314b231d760e21b179052516135d491906145cd565b600060405180830381855af49150503d806000811461360f576040519150601f19603f3d011682016040523d82523d6000602084013e613614565b606091505b50509050806136355760405162461bcd60e51b8152600401610a4d906145e9565b858463ffffffff168151811061364d5761364d614722565b602002602001015160096000856001600160a01b03166001600160a01b03168152602001908152602001600020600101600082825461368c9190614830565b92505081905550858463ffffffff16815181106136ab576136ab614722565b602002602001015160096000856001600160a01b03166001600160a01b0316815260200190815260200160002060020160008282546136ea9190614429565b9091555050505b61371a82858563ffffffff168151811061370d5761370d614722565b60200260200101516139d7565b50508080613727906149aa565b915050613477565b50505050505050565b6040516370a0823160e01b81523060048201526000906001600160a01b038316906370a0823190602401602060405180830381865afa15801561377f573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906137a39190614440565b6010549091506000906001600160a01b0384811691161480156137d15750600654600160a01b900460ff1615155b6137db57816137e8565b6011546137e89083614429565b6001600160a01b0384166000908152600960205260409020600201549091508111156110c2576001600160a01b0383166000908152600960205260409020600201546138349082614429565b6001600160a01b0384166000908152600960205260408120600101805490919061385f908490614871565b90915550506001600160a01b0383166000908152600960205260409020600201819055505050565b600381015481546000916138a791600160a81b900463ffffffff16613aaa565b9050808260030160008282546138bd9190614429565b909155506138cb905061161e565b825463ffffffff91909116600160a81b0263ffffffff60a81b199091161790915550565b6000613944826040518060400160405280602081526020017f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c6564815250856001600160a01b0316613b079092919063ffffffff16565b8051909150156110c2578080602001905181019061396291906143ad565b6110c25760405162461bcd60e51b815260206004820152602a60248201527f5361666545524332303a204552433230206f7065726174696f6e20646964206e6044820152691bdd081cdd58d8d9595960b21b6064820152608401610a4d565b6000826139ce8584613b16565b14949350505050565b6000670de0b6b3a7640000600f54836139f091906143e0565b6139fa9190614415565b90506000613a088284614429565b90508015613a71576001600160a01b03841660009081526009602052604081206003018054839290613a3b908490614574565b90915550506001600160a01b03841660009081526009602052604081206001018054839290613a6b908490614830565b90915550505b8115611d97576001600160a01b0384166000908152600d602052604081208054849290613a9f908490614574565b909155505050505050565b60008082613ab661161e565b613ac09190614429565b90506000670de0b6b3a764000082600c5487613adc91906143e0565b613ae691906143e0565b613af09190614415565b9050848110613aff5784612cc1565b949350505050565b606061337b8484600085613b8a565b600081815b8451811015613b82576000858281518110613b3857613b38614722565b60200260200101519050808311613b5e5760008381526020829052604090209250613b6f565b600081815260208490526040902092505b5080613b7a81614817565b915050613b1b565b509392505050565b606082471015613beb5760405162461bcd60e51b815260206004820152602660248201527f416464726573733a20696e73756666696369656e742062616c616e636520666f6044820152651c8818d85b1b60d21b6064820152608401610a4d565b6001600160a01b0385163b613c425760405162461bcd60e51b815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e74726163740000006044820152606401610a4d565b600080866001600160a01b03168587604051613c5e91906145cd565b60006040518083038185875af1925050503d8060008114613c9b576040519150601f19603f3d011682016040523d82523d6000602084013e613ca0565b606091505b5091509150612bc482828660608315613cba57508161337e565b825115613cca5782518084602001fd5b8160405162461bcd60e51b8152600401610a4d9190614804565b6001600160a01b0381168114610d6d57600080fd5b60008060408385031215613d0c57600080fd5b8235613d1781613ce4565b946020939093013593505050565b600060208284031215613d3757600080fd5b5035919050565b600060208284031215613d5057600080fd5b813561337e81613ce4565b8015158114610d6d57600080fd5b600080600060608486031215613d7e57600080fd5b8335613d8981613ce4565b9250602084013591506040840135613da081613d5b565b809150509250925092565b600080600060608486031215613dc057600080fd5b833592506020840135613dd281613ce4565b91506040840135613da081613ce4565b600060208284031215613df457600080fd5b813561337e81613d5b565b60008060408385031215613e1257600080fd5b823591506020830135613e2481613ce4565b809150509250929050565b60008060008060808587031215613e4557600080fd5b84359350602085013592506040850135613e5e81613ce4565b91506060850135613e6e81613d5b565b939692955090935050565b634e487b7160e01b600052604160045260246000fd5b604051601f8201601f1916810167ffffffffffffffff81118282101715613eb857613eb8613e79565b604052919050565b600067ffffffffffffffff821115613eda57613eda613e79565b5060051b60200190565b600082601f830112613ef557600080fd5b81356020613f0a613f0583613ec0565b613e8f565b82815260059290921b84018101918181019086841115613f2957600080fd5b8286015b84811015613f445780358352918301918301613f2d565b509695505050505050565b803560ff8116811461242957600080fd5b600082601f830112613f7157600080fd5b81356020613f81613f0583613ec0565b82815260059290921b84018101918181019086841115613fa057600080fd5b8286015b84811015613f44578035613fb781613ce4565b8352918301918301613fa4565b600080600080600080600080610100898b031215613fe157600080fd5b8835975060208901359650604089013567ffffffffffffffff8082111561400757600080fd5b6140138c838d01613ee4565b975060608b013591508082111561402957600080fd5b6140358c838d01613ee4565b965060808b013591508082111561404b57600080fd5b6140578c838d01613ee4565b955061406560a08c01613f4f565b945060c08b013591508082111561407b57600080fd5b6140878c838d01613f60565b935060e08b013591508082111561409d57600080fd5b506140aa8b828c01613ee4565b9150509295985092959890939650565b600080600080600060a086880312156140d257600080fd5b853567ffffffffffffffff8111156140e957600080fd5b6140f588828901613ee4565b95505061410460208701613f4f565b94979496505050506040830135926060810135926080909101359150565b6000806020838503121561413557600080fd5b823567ffffffffffffffff8082111561414d57600080fd5b818501915085601f83011261416157600080fd5b81358181111561417057600080fd5b8660208260051b850101111561418557600080fd5b60209290920196919550909350505050565b60005b838110156141b257818101518382015260200161419a565b83811115611d975750506000910152565b600081518084526141db816020860160208601614197565b601f01601f19169290920160200192915050565b6000602080830181845280855180835260408601915060408160051b870101925083870160005b8281101561424457603f198886030184526142328583516141c3565b94509285019290850190600101614216565b5092979650505050505050565b60006020828403121561426357600080fd5b813563ffffffff8116811461337e57600080fd5b600067ffffffffffffffff82111561429157614291613e79565b50601f01601f191660200190565b600080604083850312156142b257600080fd5b82359150602083013567ffffffffffffffff8111156142d057600080fd5b8301601f810185136142e157600080fd5b80356142ef613f0582614277565b81815286602083850101111561430457600080fd5b816020840160208301376000602083830101528093505050509250929050565b6020808252818101527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604082015260600190565b6020808252601d908201527f50726f706f73616c2068617320756e636c61696d6564206c6561766573000000604082015260600190565b6000602082840312156143a257600080fd5b815161337e81613ce4565b6000602082840312156143bf57600080fd5b815161337e81613d5b565b634e487b7160e01b600052601160045260246000fd5b60008160001904831182151516156143fa576143fa6143ca565b500290565b634e487b7160e01b600052601260045260246000fd5b600082614424576144246143ff565b500490565b60008282101561443b5761443b6143ca565b500390565b60006020828403121561445257600080fd5b5051919050565b600063ffffffff808316818516808303821115614478576144786143ca565b01949350505050565b85815263ffffffff851660208201526102006040820181905260009082015283516001600160a01b03166060820152610220810160208501516001600160a01b03811660808401525060408501516001600160a01b03811660a084015250606085015180151560c084015250608085015160e083015260a0850151610100818185015260c08701519150610120828186015260e0880151925061014083818701528289015161016087015281890151610180870152808901516101a08701525050505061455a6101c08301856001600160a01b03169052565b6001600160a01b0383166101e08301529695505050505050565b60008219821115614587576145876143ca565b500190565b600060ff82168061459f5761459f6143ca565b6000190192915050565b6001600160a01b038316815260406020820181905260009061337b908301846141c3565b600082516145df818460208701614197565b9190910192915050565b60208082526013908201527219195b1959d85d1958d85b1b0819985a5b1959606a1b604082015260600190565b600081518084526020808501945080840160005b8381101561464f5781516001600160a01b03168752958201959082019060010161462a565b509495945050505050565b600081518084526020808501945080840160005b8381101561464f5781518752958201959082019060010161466e565b85815260a0602082015260006146a360a0830187614616565b82810360408401526146b5818761465a565b905082810360608401526146c9818661465a565b905082810360808401526146dd818561465a565b98975050505050505050565b63ffffffff8516815260ff84166020820152608060408201526000614711608083018561465a565b905082606083015295945050505050565b634e487b7160e01b600052603260045260246000fd5b6000808335601e1984360301811261474f57600080fd5b83018035915067ffffffffffffffff82111561476a57600080fd5b60200191503681900382131561477f57600080fd5b9250929050565b8183823760009101908152919050565b6000602082840312156147a857600080fd5b815167ffffffffffffffff8111156147bf57600080fd5b8201601f810184136147d057600080fd5b80516147de613f0582614277565b8181528560208385010111156147f357600080fd5b612cc1826020830160208601614197565b60208152600061337e60208301846141c3565b600060018201614829576148296143ca565b5060010190565b600080821280156001600160ff1b0384900385131615614852576148526143ca565b600160ff1b839003841281161561486b5761486b6143ca565b50500190565b60008083128015600160ff1b85018412161561488f5761488f6143ca565b6001600160ff1b03840183138116156148aa576148aa6143ca565b50500390565b6000602082840312156148c257600080fd5b6040516020810181811067ffffffffffffffff821117156148e5576148e5613e79565b6040529151825250919050565b60208152815160208201526000602083015160e0604084015261491961010084018261465a565b90506040840151601f1980858403016060860152614937838361465a565b92506060860151915080858403016080860152614954838361465a565b9250608086015160a086015260ff60a08701511660c086015260c08601519150808584030160e086015250612cc18282614616565b600061ffff8084168061499e5761499e6143ff565b92169190910692915050565b600063ffffffff8083168181036149c3576149c36143ca565b600101939250505056fea2646970667358221220c0f77367fbe7680ae33ec5e4f8cd016f3ab7286f7ccd46b4b1294ff178ce5ac664736f6c634300080d0033", + "deployedBytecode": "0x60806040526004361061027f5760003560e01c8063625997c01161014f578063a5841194116100c1578063dd70e5e81161007a578063dd70e5e814610848578063e0f339e314610868578063e40064d714610888578063e460e35c146108b5578063f0056a7d146108d5578063f2fde38b1461097a5761028e565b8063a584119414610774578063ac9650d814610794578063b60c2d7d146107b4578063b9a3c84c146107d4578063c28f439214610808578063cd949995146108285761028e565b80637998a1c4116101135780637998a1c4146106ca57806380c09a82146106e057806380f323a7146107005780638bda0c00146107165780638da5cb5b14610736578063a16fd6e9146107545761028e565b8063625997c01461063a57806369b625021461028c5780636ad0690a1461064f578063715018a61461068157806376ec08dd146106965761028e565b806322f8e566116101f35780633fc8cef3116101ac5780633fc8cef3146105025780634144fd61146105365780634f7473ff146105c757806356688700146105dd57806356864f38146105f05780635c975abb146106105761028e565b806322f8e5661461044d578063240f475f1461046d57806329cb924d1461048d5780632d0f6f84146104a25780632d32d557146104c257806333dc09ca146104e25761028e565b80630ee28a88116102455780630ee28a881461038a57806310b99527146103aa57806311cfc159146103ca57806316c38b3c146103e05780631c39c38d1461040057806322395aaa146104385761028e565b8062660b5314610296578062c99206146102b6578063084d0513146102d657806309474ae2146103095780630c501af91461036a5761028e565b3661028e5761028c61099a565b005b61028c61099a565b3480156102a257600080fd5b5061028c6102b1366004613cf9565b610a23565b3480156102c257600080fd5b5061028c6102d1366004613d25565b610b6f565b3480156102e257600080fd5b506102f66102f1366004613cf9565b610d70565b6040519081526020015b60405180910390f35b34801561031557600080fd5b5061034a610324366004613d25565b600a60205260009081526040902080546001909101546001600160a01b03918216911682565b604080516001600160a01b03938416815292909116602083015201610300565b34801561037657600080fd5b5061028c610385366004613d3e565b610d9c565b34801561039657600080fd5b5061028c6103a5366004613d69565b610e43565b3480156103b657600080fd5b5061028c6103c5366004613dab565b6110c7565b3480156103d657600080fd5b506102f6600c5481565b3480156103ec57600080fd5b5061028c6103fb366004613de2565b611175565b34801561040c57600080fd5b50600054610420906001600160a01b031681565b6040516001600160a01b039091168152602001610300565b34801561044457600080fd5b5061028c6111f1565b34801561045957600080fd5b5061028c610468366004613d25565b6115c3565b34801561047957600080fd5b50600e54610420906001600160a01b031681565b34801561049957600080fd5b506102f661161e565b3480156104ae57600080fd5b5061028c6104bd366004613d3e565b6116af565b3480156104ce57600080fd5b506104206104dd366004613dff565b61172d565b3480156104ee57600080fd5b5061028c6104fd366004613cf9565b61175e565b34801561050e57600080fd5b506104207f000000000000000000000000000000000000000000000000000000000000000081565b34801561054257600080fd5b5060025460035460045460055460065461058094939291906001600160a01b03811690600160a01b810460ff1690600160a81b900463ffffffff1687565b6040805197885260208801969096529486019390935260608501919091526001600160a01b0316608084015260ff1660a083015263ffffffff1660c082015260e001610300565b3480156105d357600080fd5b506102f6600f5481565b61028c6105eb366004613cf9565b6119d9565b3480156105fc57600080fd5b5061028c61060b366004613e2f565b611cb5565b34801561061c57600080fd5b5060075461062a9060ff1681565b6040519015158152602001610300565b34801561064657600080fd5b5061028c611d9d565b34801561065b57600080fd5b5060125461066c9063ffffffff1681565b60405163ffffffff9091168152602001610300565b34801561068d57600080fd5b5061028c611e81565b3480156106a257600080fd5b506104207f000000000000000000000000000000000000000000000000000000000000000081565b3480156106d657600080fd5b506102f6600b5481565b3480156106ec57600080fd5b5061028c6106fb366004613fc4565b611eb5565b34801561070c57600080fd5b506102f660115481565b34801561072257600080fd5b5061028c6107313660046140ba565b612238565b34801561074257600080fd5b506001546001600160a01b0316610420565b34801561076057600080fd5b506102f661076f366004613d3e565b612402565b34801561078057600080fd5b5061028c61078f366004613d3e565b61242e565b6107a76107a2366004614122565b61244f565b60405161030091906141ef565b3480156107c057600080fd5b5061028c6107cf366004613d3e565b6125f5565b3480156107e057600080fd5b506104207f000000000000000000000000000000000000000000000000000000000000000081565b34801561081457600080fd5b50601054610420906001600160a01b031681565b34801561083457600080fd5b5061028c610843366004614251565b6127b4565b34801561085457600080fd5b5061028c61086336600461429f565b612882565b34801561087457600080fd5b506102f6610883366004613d3e565b6128ce565b34801561089457600080fd5b506102f66108a3366004613d3e565b600d6020526000908152604090205481565b3480156108c157600080fd5b5061028c6108d0366004613dab565b6128e9565b3480156108e157600080fd5b506109386108f0366004613d3e565b60096020526000908152604090208054600182015460028301546003909301546001600160a01b03831693600160a01b840460ff1693600160a81b900463ffffffff16929186565b604080516001600160a01b039097168752941515602087015263ffffffff909316938501939093526060840152608083019190915260a082015260c001610300565b34801561098657600080fd5b5061028c610995366004613d3e565b6129c2565b600054600160a01b900460ff1615610a21577f00000000000000000000000000000000000000000000000000000000000000006001600160a01b031663d0e30db0346040518263ffffffff1660e01b81526004016000604051808303818588803b158015610a0757600080fd5b505af1158015610a1b573d6000803e3d6000fd5b50505050505b565b6001546001600160a01b03163314610a565760405162461bcd60e51b8152600401610a4d90614324565b60405180910390fd5b610a5e612a5a565b610a66612ab3565b670de0b6b3a7640000811115610abe5760405162461bcd60e51b815260206004820152601960248201527f4261642070726f746f636f6c46656543617074757265506374000000000000006044820152606401610a4d565b6001600160a01b038216610b145760405162461bcd60e51b815260206004820152601d60248201527f4261642070726f746f636f6c46656543617074757265416464726573730000006044820152606401610a4d565b600e80546001600160a01b0319166001600160a01b038416908117909155600f8290556040518291907fc1993b89fd79a19ece7beb067ddc8534ca26d29c0ff94ea2f53b4a508d1eedc990600090a3610b6b612ac2565b5050565b6001546001600160a01b03163314610b995760405162461bcd60e51b8152600401610a4d90614324565b600654600160a01b900460ff1615610bc35760405162461bcd60e51b8152600401610a4d90614359565b610bcb612a5a565b610bd3612ab3565b6040516302abf57960e61b8152721259195b9d1a599a595c95da1a5d195b1a5cdd606a1b60048201526000907f00000000000000000000000000000000000000000000000000000000000000006001600160a01b03169063aafd5e4090602401602060405180830381865afa158015610c50573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610c749190614390565b6040516390978d1b60e01b8152600481018490529091506001600160a01b038216906390978d1b90602401602060405180830381865afa158015610cbc573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610ce091906143ad565b610d2c5760405162461bcd60e51b815260206004820152601860248201527f4964656e746966696572206e6f7420737570706f7274656400000000000000006044820152606401610a4d565b600b8290556040518281527ff45367c278fcceff23d601ce4bdd191e5bd61687ff9f29dc7276a08fe54c0c5d9060200160405180910390a150610d6d612ac2565b50565b6000610d7a612a5a565b610d82612ab3565b610d8c8383612ad7565b9050610d96612ac2565b92915050565b6001546001600160a01b03163314610dc65760405162461bcd60e51b8152600401610a4d90614324565b610dce612a5a565b610dd6612ab3565b6001600160a01b03818116600081815260096020908152604091829020805460ff60a01b1981169091558251938452909316928201929092527fac111b3b527b307393c94d98f26140effb71411054466818be97912d2d65f77691015b60405180910390a1610d6d612ac2565b610e4b612a5a565b610e53612ab3565b826001600160a01b03167f00000000000000000000000000000000000000000000000000000000000000006001600160a01b03161480610e91575080155b610ecd5760405162461bcd60e51b815260206004820152600d60248201526c086c2dce840e6cadcc840cae8d609b1b6044820152606401610a4d565b6000670de0b6b3a7640000610ee185612bcf565b610eeb90856143e0565b610ef59190614415565b6001600160a01b038581166000908152600960205260409081902054905163079cc67960e41b81523360048201526024810187905292935016906379cc6790906044016020604051808303816000875af1158015610f57573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610f7b91906143ad565b506001600160a01b03841660009081526009602052604081206002018054839290610fa7908490614429565b9091555050811561105f57604051632e1a7d4d60e01b8152600481018290527f00000000000000000000000000000000000000000000000000000000000000006001600160a01b031690632e1a7d4d90602401600060405180830381600087803b15801561101457600080fd5b505af1158015611028573d6000803e3d6000fd5b505060405133925083156108fc02915083906000818181858888f19350505050158015611059573d6000803e3d6000fd5b50611073565b6110736001600160a01b0385163383612cca565b604080518281526020810185905233916001600160a01b038716917fcda1185f28599e6bd14ab8a68b3c30a11e1dce4256b5e67e94dd3fd846a6c589910160405180910390a3506110c2612ac2565b505050565b6001546001600160a01b031633146110f15760405162461bcd60e51b8152600401610a4d90614324565b6110f9612a5a565b611101612ab3565b80600860006111108587612d2d565b815260208101919091526040908101600090812080546001600160a01b0319166001600160a01b0394851617905590518383169285169186917f234e7af08f77827792cc909447f27d2e6a3e2d839b04e26b50b71704a131c8a89190a46110c2612ac2565b6001546001600160a01b0316331461119f5760405162461bcd60e51b8152600401610a4d90614324565b6111a7612a5a565b6111af612ab3565b6007805460ff19168215159081179091556040517f0e2fb031ee032dc02d8011dc50b816eb450cf856abd8261680dac74f72165bd290600090a2610d6d612ac2565b6111f9612a5a565b611201612ab3565b600061120b61161e565b60065490915063ffffffff600160a81b909104811690821611156112715760405162461bcd60e51b815260206004820152601760248201527f5265717565737420706173736564206c6976656e6573730000000000000000006044820152606401610a4d565b600061127b612d6a565b905060115481106112955761128e612e70565b505061159c565b600061129f612f4f565b6011546010549192506112bd916001600160a01b0316908390612ff3565b806001600160a01b031663af355d1e600b5485601060009054906101000a90046001600160a01b03166000876011546112f69190614429565b60125460065460405160e089901b6001600160e01b0319168152600481019790975263ffffffff9586166024880152610120604488015260006101248801526001600160a01b039485166064880152608487019390935260a48601919091529290921660c48401521660e4820152670de0b6b3a7640000610104820152610144016020604051808303816000875af19250505080156113b2575060408051601f3d908101601f191682019092526113af91810190614440565b60015b6113c6576113be612e70565b50505061159c565b6010546113de906001600160a01b03168360006130a5565b5060408051610160810182526006546001600160a01b0390811682526000602083018190526010549091169282019290925260608101829052670de0b6b3a7640000608082015260a0810182905260125460c08201906114449063ffffffff1687614459565b63ffffffff168152602001600081526020018481526020018460115461146a9190614429565b815260125463ffffffff9081166020909201919091526000600281905560038190556004819055600555600680546001600160c81b03191690556011546010549293506114c5926001600160a01b031691339130916131ba16565b6011546010546114e2916001600160a01b03909116908490612ff3565b600b5460405163139c641960e31b81526001600160a01b03841691639ce320c89161151891908890869033903090600401614481565b6020604051808303816000875af1158015611537573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061155b9190614440565b5060405163ffffffff8516815233907f15951cb2ef6993bc23a55912e7d0bcac13e4797c432aaa334816aed6914a7a909060200160405180910390a2505050505b6115bb6115a7612f4f565b6010546001600160a01b03169060006130a5565b610a21612ac2565b6000546001600160a01b03166115d857600080fd5b60005460405163117c72b360e11b8152600481018390526001600160a01b03909116906322f8e56690602401600060405180830381600087803b158015610a0757600080fd5b600080546001600160a01b0316156116aa5760008054906101000a90046001600160a01b03166001600160a01b03166329cb924d6040518163ffffffff1660e01b8152600401602060405180830381865afa158015611681573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906116a59190614440565b905090565b504290565b6116b7612a5a565b6116bf612ab3565b6001600160a01b038082166000818152600d602052604081208054919055600e5490926116ee92911683612cca565b60405181906001600160a01b038416907f74740239d7d696c84422b720e125e1f47c4138c66d1f4d2a48e99f4197cdb79c90600090a350610d6d612ac2565b60006008600061173d8486612d2d565b81526020810191909152604001600020546001600160a01b03169392505050565b6001546001600160a01b031633146117885760405162461bcd60e51b8152600401610a4d90614324565b600654600160a01b900460ff16156117b25760405162461bcd60e51b8152600401610a4d90614359565b6117ba612a5a565b6117c2612ab3565b806000036118125760405162461bcd60e51b815260206004820152601760248201527f626f6e6420657175616c20746f2066696e616c206665650000000000000000006044820152606401610a4d565b6040516302abf57960e61b81527210dbdb1b185d195c985b15da1a5d195b1a5cdd606a1b60048201526000907f00000000000000000000000000000000000000000000000000000000000000006001600160a01b03169063aafd5e4090602401602060405180830381865afa15801561188f573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906118b39190614390565b604051631d1d5b3960e11b81526001600160a01b03858116600483015291925090821690633a3ab67290602401602060405180830381865afa1580156118fd573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061192191906143ad565b6119605760405162461bcd60e51b815260206004820152601060248201526f139bdd081bdb881dda1a5d195b1a5cdd60821b6044820152606401610a4d565b601080546001600160a01b0319166001600160a01b038516179055611983612d6a565b61198d9083614574565b60118190556040519081526001600160a01b038416907fbfa9a96010167e98ce8c004f718932cbbfd33a58d681c752e693be7d457a1b3b9060200160405180910390a250610b6b612ac2565b6119e1612a5a565b6119e9612ab3565b6001600160a01b038216600090815260096020526040902054600160a01b900460ff16611a4c5760405162461bcd60e51b8152602060048201526011602482015270151bdad95b881b9bdd08195b98589b1959607a1b6044820152606401610a4d565b816001600160a01b03167f00000000000000000000000000000000000000000000000000000000000000006001600160a01b0316148015611a8c57508034145b80611a95575034155b611ad15760405162461bcd60e51b815260206004820152600d60248201526c426164206d73672e76616c756560981b6044820152606401610a4d565b6000611adc83612bcf565b611aee83670de0b6b3a76400006143e0565b611af89190614415565b6001600160a01b038416600090815260096020526040812060020180549293508492909190611b28908490614574565b90915550506001600160a01b03838116600090815260096020526040908190205490516340c10f1960e01b8152336004820152602481018490529116906340c10f19906044016020604051808303816000875af1158015611b8d573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611bb191906143ad565b50826001600160a01b03167f00000000000000000000000000000000000000000000000000000000000000006001600160a01b0316148015611bf35750600034115b15611c5157826001600160a01b031663d0e30db0346040518263ffffffff1660e01b81526004016000604051808303818588803b158015611c3357600080fd5b505af1158015611c47573d6000803e3d6000fd5b5050505050611c66565b611c666001600160a01b0384163330856131ba565b604080518381526020810183905233916001600160a01b038616917f3c69701a61c79a92ef9692903aaa0068bce8771361ecb09547391e4fb4df8537910160405180910390a350610b6b612ac2565b611cbd612a5a565b611cc5612ab3565b6001546001600160a01b03163314611cef5760405162461bcd60e51b8152600401610a4d90614324565b6040516001600160a01b0383166024820152604481018490528115156064820152611d4890859060840160408051601f198184030181529190526020810180516001600160e01b031663272751c760e01b1790526131f2565b816001600160a01b031683857fb7d00a563842efb2c121a0eb02b7bb7ba1a34625bbc3d65057f1f0dbec0ec2a184604051611d87911515815260200190565b60405180910390a4611d97612ac2565b50505050565b6001546001600160a01b03163314611dc75760405162461bcd60e51b8152600401610a4d90614324565b611dcf612a5a565b611dd7612ab3565b600654600160a01b900460ff1615611e0a57600654601154601054611e0a926001600160a01b0391821692911690612cca565b6006546003546002546004546040519081526001600160a01b03909316927f993cba33f9b140c9ce20ba10d7eda92128d5beb6df856f064916108a11647a739060200160405180910390a46000600281905560038190556004819055600555600680546001600160c81b0319169055610a21612ac2565b6001546001600160a01b03163314611eab5760405162461bcd60e51b8152600401610a4d90614324565b610a2160006132f6565b611ebd612a5a565b611ec5612ab3565b60075460ff1615611f185760405162461bcd60e51b815260206004820181905260248201527f50726f706f73616c2070726f6365737320686173206265656e207061757365646044820152606401610a4d565b600654600160a81b900463ffffffff16611f3061161e565b11611f735760405162461bcd60e51b81526020600482015260136024820152724e6f7420706173736564206c6976656e65737360681b6044820152606401610a4d565b600554600160ff85161b90811603611fbf5760405162461bcd60e51b815260206004820152600f60248201526e105b1c9958591e4818db185a5b5959608a1b6044820152606401610a4d565b6120046002600001546040518060e001604052808b81526020018981526020018881526020018781526020018a81526020018660ff1681526020018581525083613348565b61203c5760405162461bcd60e51b81526020600482015260096024820152682130b210283937b7b360b91b6044820152606401610a4d565b6000806120488a613385565b9150915061205b60026003015486613451565b60055560068054600160a01b900460ff169060146120788361458c565b91906101000a81548160ff021916908360ff1602179055505061209f82828c878b8d613474565b886000036121a157600354600454604051602481019290925260448201526000906001600160a01b03841690839060640160408051601f198184030181529181526020820180516001600160e01b031663124e93e160e21b179052516121099291906024016145a9565b60408051601f198184030181529181526020820180516001600160e01b0316637375c56f60e11b1790525161213e91906145cd565b600060405180830381855af49150503d8060008114612179576040519150601f19603f3d011682016040523d82523d6000602084013e61217e565b606091505b505090508061219f5760405162461bcd60e51b8152600401610a4d906145e9565b505b600654600160a01b900460ff166000036121d6576006546011546010546121d6926001600160a01b0391821692911690612cca565b336001600160a01b03168a8660ff167ff652dd63b1aedbf9e740f3152fb67b0d94d069cf1182811ebd88921850d935678c888d8d8d60405161221c95949392919061468a565b60405180910390a4505061222e612ac2565b5050505050505050565b612240612a5a565b612248612ab3565b600654600160a01b900460ff16156122725760405162461bcd60e51b8152600401610a4d90614359565b60075460ff16156122c55760405162461bcd60e51b815260206004820181905260248201527f50726f706f73616c2070726f6365737320686173206265656e207061757365646044820152606401610a4d565b60008460ff16116123185760405162461bcd60e51b815260206004820181905260248201527f42756e646c65206d7573742068617665206174206c656173742031206c6561666044820152606401610a4d565b60125460009063ffffffff1661232c61161e565b6123369190614459565b60006005556006805460028790556003869055600485905560ff8816600160a01b0263ffffffff808516600160a81b0260ff60a01b19166001600160c81b031990931692909217176001600160a01b031916339081179092556011546010549394506123b0936001600160a01b031692913091906131ba16565b336001600160a01b031683857f50e585dd6361c7cb2613ce2334814bb2a789f5a8ad4b161fe0e248043737d1d284898b886040516123f194939291906146e9565b60405180910390a450610a1b612ac2565b600061240c612a5a565b612414612ab3565b61241f826000612ad7565b9050612429612ac2565b919050565b612436612a5a565b61243e612ab3565b61244781613738565b610d6d612ac2565b6060341561249f5760405162461bcd60e51b815260206004820152601b60248201527f4f6e6c79206d756c746963616c6c207769746820302076616c756500000000006044820152606401610a4d565b8167ffffffffffffffff8111156124b8576124b8613e79565b6040519080825280602002602001820160405280156124eb57816020015b60608152602001906001900390816124d65790505b50905060005b828110156125ee576000803086868581811061250f5761250f614722565b90506020028101906125219190614738565b60405161252f929190614786565b600060405180830381855af49150503d806000811461256a576040519150601f19603f3d011682016040523d82523d6000602084013e61256f565b606091505b5091509150816125bb5760448151101561258857600080fd5b600481019050808060200190518101906125a29190614796565b60405162461bcd60e51b8152600401610a4d9190614804565b808484815181106125ce576125ce614722565b6020026020010181905250505080806125e690614817565b9150506124f1565b5092915050565b6001546001600160a01b0316331461261f5760405162461bcd60e51b8152600401610a4d90614324565b612627612a5a565b61262f612ab3565b6001600160a01b038181166000908152600960205260409020541661274d57604051637e178db760e11b81526001600160a01b0382811660048301527f0000000000000000000000000000000000000000000000000000000000000000169063fc2f1b6e906024016020604051808303816000875af11580156126b6573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906126da9190614390565b6001600160a01b03828116600090815260096020526040902080546001600160a01b0319169290911691909117905561271161161e565b6001600160a01b0382166000908152600960205260409020805463ffffffff92909216600160a81b0263ffffffff60a81b199092169190911790555b6001600160a01b038181166000818152600960209081526040918290208054600160a01b60ff60a01b198216179091558251938452909316928201929092527f04e291c80180d65a57b5bf1bed775777ec0d6f283ef34bcf130712714d8bb7f79101610e33565b6001546001600160a01b031633146127de5760405162461bcd60e51b8152600401610a4d90614324565b6127e6612a5a565b6127ee612ab3565b6102588163ffffffff161161283a5760405162461bcd60e51b8152602060048201526012602482015271131a5d995b995cdcc81d1bdbc81cda1bdc9d60721b6044820152606401610a4d565b6012805463ffffffff191663ffffffff83169081179091556040519081527f04dd1d84d387f404568a7954b5e398518bdd716e1a8f4a790be9a1a225ad934790602001610e33565b6001546001600160a01b031633146128ac5760405162461bcd60e51b8152600401610a4d90614324565b6128b4612a5a565b6128bc612ab3565b6128c682826131f2565b610b6b612ac2565b60006128d8612a5a565b6128e0612ab3565b61241f82612bcf565b6001546001600160a01b031633146129135760405162461bcd60e51b8152600401610a4d90614324565b61291b612a5a565b612923612ab3565b6040805180820182526001600160a01b03848116808352848216602080850182815260008a8152600a8352879020955186549086166001600160a01b031991821617875590516001909601805496909516951694909417909255835187815292830152918101919091527f36050d958750e6ac3aa674ac7bbe8d0ae6a2f7d4b808e8c2c42c1f22fc9fc4bb9060600160405180910390a16110c2612ac2565b6001546001600160a01b031633146129ec5760405162461bcd60e51b8152600401610a4d90614324565b6001600160a01b038116612a515760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201526564647265737360d01b6064820152608401610a4d565b610d6d816132f6565b600054600160a01b900460ff16610a215760405162461bcd60e51b815260206004820152601f60248201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c006044820152606401610a4d565b6000805460ff60a01b19169055565b6000805460ff60a01b1916600160a01b179055565b6000612ae283613738565b6001600160a01b038381166000908152600960209081526040808320815160c08101835281549586168152600160a01b860460ff16151593810193909352600160a81b90940463ffffffff16908201526001830154606082018190526002840154608083015260039093015460a0820152918112612b61576000612b67565b81606001515b90506000612b758286614574565b90506000828460800151612b899190614574565b905080600003612ba757670de0b6b3a7640000945050505050610d96565b80612bba83670de0b6b3a76400006143e0565b612bc49190614415565b979650505050505050565b6001600160a01b038082166000908152600960209081526040808320805482516318160ddd60e01b8152925194959194869491909216926318160ddd92600480830193928290030181865afa158015612c2c573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190612c509190614440565b905080600003612c6b5750670de0b6b3a76400009392505050565b612c7482613887565b612c7d84613738565b6000826003015483600101548460020154612c989190614830565b612ca29190614871565b905081612cb782670de0b6b3a76400006143e0565b612cc19190614415565b95945050505050565b6040516001600160a01b0383166024820152604481018290526110c290849063a9059cbb60e01b906064015b60408051601f198184030181529190526020810180516001600160e01b03166001600160e01b0319909316929092179091526138ef565b604080516001600160a01b038416602082015290810182905260009060600160405160208183030381529060405280519060200120905092915050565b6040516302abf57960e61b81526453746f726560d81b60048201526000907f00000000000000000000000000000000000000000000000000000000000000006001600160a01b03169063aafd5e4090602401602060405180830381865afa158015612dd9573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190612dfd9190614390565b601054604051635b97aadd60e01b81526001600160a01b039182166004820152911690635b97aadd90602401602060405180830381865afa158015612e46573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190612e6a91906148b0565b51919050565b60105460065460115460405163a9059cbb60e01b81526001600160a01b039283166004820152602481019190915291169063a9059cbb906044016020604051808303816000875af1158015612ec9573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190612eed91906143ad565b506000600281905560038190556004819055600555600680546001600160c81b0319169055337f0cfbbf45ab7f5225663454de7117b1b0ed5a7c133b61f54ccf367dcf8b6d4d59612f3c61161e565b60405190815260200160405180910390a2565b6040516302abf57960e61b815275536b696e6e794f7074696d69737469634f7261636c6560501b60048201526000907f00000000000000000000000000000000000000000000000000000000000000006001600160a01b03169063aafd5e4090602401602060405180830381865afa158015612fcf573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906116a59190614390565b604051636eb1769f60e11b81523060048201526001600160a01b038381166024830152600091839186169063dd62ed3e90604401602060405180830381865afa158015613044573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906130689190614440565b6130729190614574565b6040516001600160a01b038516602482015260448101829052909150611d9790859063095ea7b360e01b90606401612cf6565b80158061311f5750604051636eb1769f60e11b81523060048201526001600160a01b03838116602483015284169063dd62ed3e90604401602060405180830381865afa1580156130f9573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061311d9190614440565b155b61318a5760405162461bcd60e51b815260206004820152603660248201527f5361666545524332303a20617070726f76652066726f6d206e6f6e2d7a65726f60448201527520746f206e6f6e2d7a65726f20616c6c6f77616e636560501b6064820152608401610a4d565b6040516001600160a01b0383166024820152604481018290526110c290849063095ea7b360e01b90606401612cf6565b6040516001600160a01b0380851660248301528316604482015260648101829052611d979085906323b872dd60e01b90608401612cf6565b6000806131fe84613385565b915091506000826001600160a01b031682856040516024016132219291906145a9565b60408051601f198184030181529181526020820180516001600160e01b0316637375c56f60e11b1790525161325691906145cd565b600060405180830381855af49150503d8060008114613291576040519150601f19603f3d011682016040523d82523d6000602084013e613296565b606091505b50509050806132b75760405162461bcd60e51b8152600401610a4d906145e9565b847f218987b934c2f6bc596136829fbf43a5fef4d6fafce41f3f6254d9a870c2deec856040516132e79190614804565b60405180910390a25050505050565b600180546001600160a01b038381166001600160a01b0319831681179093556040519116919082907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e090600090a35050565b600061337b82858560405160200161336091906148f2565b604051602081830303815290604052805190602001206139c1565b90505b9392505050565b6000818152600a6020526040902080546001909101546001600160a01b039182169116806133f55760405162461bcd60e51b815260206004820152601960248201527f53706f6b65506f6f6c206e6f7420696e697469616c697a6564000000000000006044820152606401610a4d565b6001600160a01b0382163b61344c5760405162461bcd60e51b815260206004820152601760248201527f41646170746572206e6f7420696e697469616c697a65640000000000000000006044820152606401610a4d565b915091565b600061346261010060ff8416614989565b61ffff166001901b8317905092915050565b60005b83518163ffffffff16101561372f576000848263ffffffff16815181106134a0576134a0614722565b602002602001015190506000600860006134ba848a612d2d565b81526020810191909152604001600020546001600160a01b031690508061351b5760405162461bcd60e51b8152602060048201526015602482015274149bdd5d19481b9bdd081dda1a5d195b1a5cdd1959605a1b6044820152606401610a4d565b6000858463ffffffff168151811061353557613535614722565b602002602001015113156136f1576000896001600160a01b03168383888763ffffffff168151811061356957613569614722565b60209081029190910101516040516001600160a01b03938416602482015291831660448301526064820152908b16608482015260a40160408051601f198184030181529181526020820180516001600160e01b03166314b231d760e21b179052516135d491906145cd565b600060405180830381855af49150503d806000811461360f576040519150601f19603f3d011682016040523d82523d6000602084013e613614565b606091505b50509050806136355760405162461bcd60e51b8152600401610a4d906145e9565b858463ffffffff168151811061364d5761364d614722565b602002602001015160096000856001600160a01b03166001600160a01b03168152602001908152602001600020600101600082825461368c9190614830565b92505081905550858463ffffffff16815181106136ab576136ab614722565b602002602001015160096000856001600160a01b03166001600160a01b0316815260200190815260200160002060020160008282546136ea9190614429565b9091555050505b61371a82858563ffffffff168151811061370d5761370d614722565b60200260200101516139d7565b50508080613727906149aa565b915050613477565b50505050505050565b6040516370a0823160e01b81523060048201526000906001600160a01b038316906370a0823190602401602060405180830381865afa15801561377f573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906137a39190614440565b6010549091506000906001600160a01b0384811691161480156137d15750600654600160a01b900460ff1615155b6137db57816137e8565b6011546137e89083614429565b6001600160a01b0384166000908152600960205260409020600201549091508111156110c2576001600160a01b0383166000908152600960205260409020600201546138349082614429565b6001600160a01b0384166000908152600960205260408120600101805490919061385f908490614871565b90915550506001600160a01b0383166000908152600960205260409020600201819055505050565b600381015481546000916138a791600160a81b900463ffffffff16613aaa565b9050808260030160008282546138bd9190614429565b909155506138cb905061161e565b825463ffffffff91909116600160a81b0263ffffffff60a81b199091161790915550565b6000613944826040518060400160405280602081526020017f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c6564815250856001600160a01b0316613b079092919063ffffffff16565b8051909150156110c2578080602001905181019061396291906143ad565b6110c25760405162461bcd60e51b815260206004820152602a60248201527f5361666545524332303a204552433230206f7065726174696f6e20646964206e6044820152691bdd081cdd58d8d9595960b21b6064820152608401610a4d565b6000826139ce8584613b16565b14949350505050565b6000670de0b6b3a7640000600f54836139f091906143e0565b6139fa9190614415565b90506000613a088284614429565b90508015613a71576001600160a01b03841660009081526009602052604081206003018054839290613a3b908490614574565b90915550506001600160a01b03841660009081526009602052604081206001018054839290613a6b908490614830565b90915550505b8115611d97576001600160a01b0384166000908152600d602052604081208054849290613a9f908490614574565b909155505050505050565b60008082613ab661161e565b613ac09190614429565b90506000670de0b6b3a764000082600c5487613adc91906143e0565b613ae691906143e0565b613af09190614415565b9050848110613aff5784612cc1565b949350505050565b606061337b8484600085613b8a565b600081815b8451811015613b82576000858281518110613b3857613b38614722565b60200260200101519050808311613b5e5760008381526020829052604090209250613b6f565b600081815260208490526040902092505b5080613b7a81614817565b915050613b1b565b509392505050565b606082471015613beb5760405162461bcd60e51b815260206004820152602660248201527f416464726573733a20696e73756666696369656e742062616c616e636520666f6044820152651c8818d85b1b60d21b6064820152608401610a4d565b6001600160a01b0385163b613c425760405162461bcd60e51b815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e74726163740000006044820152606401610a4d565b600080866001600160a01b03168587604051613c5e91906145cd565b60006040518083038185875af1925050503d8060008114613c9b576040519150601f19603f3d011682016040523d82523d6000602084013e613ca0565b606091505b5091509150612bc482828660608315613cba57508161337e565b825115613cca5782518084602001fd5b8160405162461bcd60e51b8152600401610a4d9190614804565b6001600160a01b0381168114610d6d57600080fd5b60008060408385031215613d0c57600080fd5b8235613d1781613ce4565b946020939093013593505050565b600060208284031215613d3757600080fd5b5035919050565b600060208284031215613d5057600080fd5b813561337e81613ce4565b8015158114610d6d57600080fd5b600080600060608486031215613d7e57600080fd5b8335613d8981613ce4565b9250602084013591506040840135613da081613d5b565b809150509250925092565b600080600060608486031215613dc057600080fd5b833592506020840135613dd281613ce4565b91506040840135613da081613ce4565b600060208284031215613df457600080fd5b813561337e81613d5b565b60008060408385031215613e1257600080fd5b823591506020830135613e2481613ce4565b809150509250929050565b60008060008060808587031215613e4557600080fd5b84359350602085013592506040850135613e5e81613ce4565b91506060850135613e6e81613d5b565b939692955090935050565b634e487b7160e01b600052604160045260246000fd5b604051601f8201601f1916810167ffffffffffffffff81118282101715613eb857613eb8613e79565b604052919050565b600067ffffffffffffffff821115613eda57613eda613e79565b5060051b60200190565b600082601f830112613ef557600080fd5b81356020613f0a613f0583613ec0565b613e8f565b82815260059290921b84018101918181019086841115613f2957600080fd5b8286015b84811015613f445780358352918301918301613f2d565b509695505050505050565b803560ff8116811461242957600080fd5b600082601f830112613f7157600080fd5b81356020613f81613f0583613ec0565b82815260059290921b84018101918181019086841115613fa057600080fd5b8286015b84811015613f44578035613fb781613ce4565b8352918301918301613fa4565b600080600080600080600080610100898b031215613fe157600080fd5b8835975060208901359650604089013567ffffffffffffffff8082111561400757600080fd5b6140138c838d01613ee4565b975060608b013591508082111561402957600080fd5b6140358c838d01613ee4565b965060808b013591508082111561404b57600080fd5b6140578c838d01613ee4565b955061406560a08c01613f4f565b945060c08b013591508082111561407b57600080fd5b6140878c838d01613f60565b935060e08b013591508082111561409d57600080fd5b506140aa8b828c01613ee4565b9150509295985092959890939650565b600080600080600060a086880312156140d257600080fd5b853567ffffffffffffffff8111156140e957600080fd5b6140f588828901613ee4565b95505061410460208701613f4f565b94979496505050506040830135926060810135926080909101359150565b6000806020838503121561413557600080fd5b823567ffffffffffffffff8082111561414d57600080fd5b818501915085601f83011261416157600080fd5b81358181111561417057600080fd5b8660208260051b850101111561418557600080fd5b60209290920196919550909350505050565b60005b838110156141b257818101518382015260200161419a565b83811115611d975750506000910152565b600081518084526141db816020860160208601614197565b601f01601f19169290920160200192915050565b6000602080830181845280855180835260408601915060408160051b870101925083870160005b8281101561424457603f198886030184526142328583516141c3565b94509285019290850190600101614216565b5092979650505050505050565b60006020828403121561426357600080fd5b813563ffffffff8116811461337e57600080fd5b600067ffffffffffffffff82111561429157614291613e79565b50601f01601f191660200190565b600080604083850312156142b257600080fd5b82359150602083013567ffffffffffffffff8111156142d057600080fd5b8301601f810185136142e157600080fd5b80356142ef613f0582614277565b81815286602083850101111561430457600080fd5b816020840160208301376000602083830101528093505050509250929050565b6020808252818101527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604082015260600190565b6020808252601d908201527f50726f706f73616c2068617320756e636c61696d6564206c6561766573000000604082015260600190565b6000602082840312156143a257600080fd5b815161337e81613ce4565b6000602082840312156143bf57600080fd5b815161337e81613d5b565b634e487b7160e01b600052601160045260246000fd5b60008160001904831182151516156143fa576143fa6143ca565b500290565b634e487b7160e01b600052601260045260246000fd5b600082614424576144246143ff565b500490565b60008282101561443b5761443b6143ca565b500390565b60006020828403121561445257600080fd5b5051919050565b600063ffffffff808316818516808303821115614478576144786143ca565b01949350505050565b85815263ffffffff851660208201526102006040820181905260009082015283516001600160a01b03166060820152610220810160208501516001600160a01b03811660808401525060408501516001600160a01b03811660a084015250606085015180151560c084015250608085015160e083015260a0850151610100818185015260c08701519150610120828186015260e0880151925061014083818701528289015161016087015281890151610180870152808901516101a08701525050505061455a6101c08301856001600160a01b03169052565b6001600160a01b0383166101e08301529695505050505050565b60008219821115614587576145876143ca565b500190565b600060ff82168061459f5761459f6143ca565b6000190192915050565b6001600160a01b038316815260406020820181905260009061337b908301846141c3565b600082516145df818460208701614197565b9190910192915050565b60208082526013908201527219195b1959d85d1958d85b1b0819985a5b1959606a1b604082015260600190565b600081518084526020808501945080840160005b8381101561464f5781516001600160a01b03168752958201959082019060010161462a565b509495945050505050565b600081518084526020808501945080840160005b8381101561464f5781518752958201959082019060010161466e565b85815260a0602082015260006146a360a0830187614616565b82810360408401526146b5818761465a565b905082810360608401526146c9818661465a565b905082810360808401526146dd818561465a565b98975050505050505050565b63ffffffff8516815260ff84166020820152608060408201526000614711608083018561465a565b905082606083015295945050505050565b634e487b7160e01b600052603260045260246000fd5b6000808335601e1984360301811261474f57600080fd5b83018035915067ffffffffffffffff82111561476a57600080fd5b60200191503681900382131561477f57600080fd5b9250929050565b8183823760009101908152919050565b6000602082840312156147a857600080fd5b815167ffffffffffffffff8111156147bf57600080fd5b8201601f810184136147d057600080fd5b80516147de613f0582614277565b8181528560208385010111156147f357600080fd5b612cc1826020830160208601614197565b60208152600061337e60208301846141c3565b600060018201614829576148296143ca565b5060010190565b600080821280156001600160ff1b0384900385131615614852576148526143ca565b600160ff1b839003841281161561486b5761486b6143ca565b50500190565b60008083128015600160ff1b85018412161561488f5761488f6143ca565b6001600160ff1b03840183138116156148aa576148aa6143ca565b50500390565b6000602082840312156148c257600080fd5b6040516020810181811067ffffffffffffffff821117156148e5576148e5613e79565b6040529151825250919050565b60208152815160208201526000602083015160e0604084015261491961010084018261465a565b90506040840151601f1980858403016060860152614937838361465a565b92506060860151915080858403016080860152614954838361465a565b9250608086015160a086015260ff60a08701511660c086015260c08601519150808584030160e086015250612cc18282614616565b600061ffff8084168061499e5761499e6143ff565b92169190910692915050565b600063ffffffff8083168181036149c3576149c36143ca565b600101939250505056fea2646970667358221220c0f77367fbe7680ae33ec5e4f8cd016f3ab7286f7ccd46b4b1294ff178ce5ac664736f6c634300080d0033", "libraries": { - "MerkleLib": "0x0e4D1366bF08365B783e097D0Af6Ce5bF7DbD013" + "MerkleLib": "0x2C4f1527Ec183ccD25f65816Cfc3a45b26B626B8" } } diff --git a/deployments/kovan/LpTokenFactory.json b/deployments/kovan/LpTokenFactory.json index d77acdc61..32622921d 100644 --- a/deployments/kovan/LpTokenFactory.json +++ b/deployments/kovan/LpTokenFactory.json @@ -1,5 +1,5 @@ { - "address": "0x0e4D1366bF08365B783e097D0Af6Ce5bF7DbD013", + "address": "0x2C4f1527Ec183ccD25f65816Cfc3a45b26B626B8", "abi": [ { "inputs": [ @@ -21,28 +21,28 @@ "type": "function" } ], - "transactionHash": "0xc7de19626c35739dd84c1b6dd432d5917e2c12d5b1e1eaf47b56b8a798e6701d", + "transactionHash": "0x4bff3cd3a53086f0f15c80580386b06583397b5ba37e198687e41128f312b290", "receipt": { "to": null, "from": "0x9A8f92a830A5cB89a3816e3D267CB7791c16b04D", - "contractAddress": "0x0e4D1366bF08365B783e097D0Af6Ce5bF7DbD013", - "transactionIndex": 2, - "gasUsed": "2523579", + "contractAddress": "0x2C4f1527Ec183ccD25f65816Cfc3a45b26B626B8", + "transactionIndex": 4, + "gasUsed": "2546113", "logsBloom": "0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", - "blockHash": "0xefd814c44a5f4cf585d599898c98e078de5604c33edffd6a2944b594c71c23e3", - "transactionHash": "0xc7de19626c35739dd84c1b6dd432d5917e2c12d5b1e1eaf47b56b8a798e6701d", + "blockHash": "0xe00c7e9911d55aa8cf48ca44acd7ea6a6d2f39e2036903f6c8fda7fe292f2bd8", + "transactionHash": "0x4bff3cd3a53086f0f15c80580386b06583397b5ba37e198687e41128f312b290", "logs": [], - "blockNumber": 30251465, - "cumulativeGasUsed": "2657191", + "blockNumber": 30475927, + "cumulativeGasUsed": "3090551", "status": 1, "byzantium": true }, "args": [], "numDeployments": 1, - "solcInputHash": "d3cc7d49c45bf725b6aea61557b961e9", - "metadata": "{\"compiler\":{\"version\":\"0.8.11+commit.d7f03943\"},\"language\":\"Solidity\",\"output\":{\"abi\":[{\"inputs\":[{\"internalType\":\"address\",\"name\":\"l1Token\",\"type\":\"address\"}],\"name\":\"createLpToken\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"nonpayable\",\"type\":\"function\"}],\"devdoc\":{\"kind\":\"dev\",\"methods\":{\"createLpToken(address)\":{\"params\":{\"l1Token\":\"L1 token to name in LP token name.\"},\"returns\":{\"_0\":\"address of new LP token.\"}}},\"version\":1},\"userdoc\":{\"kind\":\"user\",\"methods\":{\"createLpToken(address)\":{\"notice\":\"Deploys new LP token for L1 token. Sets caller as minter and burner of token.\"}},\"notice\":\"Factory to create new LP ERC20 tokens that represent a liquidity provider's position. HubPool is the intended client of this contract.\",\"version\":1}},\"settings\":{\"compilationTarget\":{\"contracts/LpTokenFactory.sol\":\"LpTokenFactory\"},\"evmVersion\":\"london\",\"libraries\":{},\"metadata\":{\"bytecodeHash\":\"ipfs\",\"useLiteralContent\":true},\"optimizer\":{\"enabled\":true,\"runs\":1000000},\"remappings\":[]},\"sources\":{\"@openzeppelin/contracts/token/ERC20/ERC20.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.5.0) (token/ERC20/ERC20.sol)\\n\\npragma solidity ^0.8.0;\\n\\nimport \\\"./IERC20.sol\\\";\\nimport \\\"./extensions/IERC20Metadata.sol\\\";\\nimport \\\"../../utils/Context.sol\\\";\\n\\n/**\\n * @dev Implementation of the {IERC20} interface.\\n *\\n * This implementation is agnostic to the way tokens are created. This means\\n * that a supply mechanism has to be added in a derived contract using {_mint}.\\n * For a generic mechanism see {ERC20PresetMinterPauser}.\\n *\\n * TIP: For a detailed writeup see our guide\\n * https://forum.zeppelin.solutions/t/how-to-implement-erc20-supply-mechanisms/226[How\\n * to implement supply mechanisms].\\n *\\n * We have followed general OpenZeppelin Contracts guidelines: functions revert\\n * instead returning `false` on failure. This behavior is nonetheless\\n * conventional and does not conflict with the expectations of ERC20\\n * applications.\\n *\\n * Additionally, an {Approval} event is emitted on calls to {transferFrom}.\\n * This allows applications to reconstruct the allowance for all accounts just\\n * by listening to said events. Other implementations of the EIP may not emit\\n * these events, as it isn't required by the specification.\\n *\\n * Finally, the non-standard {decreaseAllowance} and {increaseAllowance}\\n * functions have been added to mitigate the well-known issues around setting\\n * allowances. See {IERC20-approve}.\\n */\\ncontract ERC20 is Context, IERC20, IERC20Metadata {\\n mapping(address => uint256) private _balances;\\n\\n mapping(address => mapping(address => uint256)) private _allowances;\\n\\n uint256 private _totalSupply;\\n\\n string private _name;\\n string private _symbol;\\n\\n /**\\n * @dev Sets the values for {name} and {symbol}.\\n *\\n * The default value of {decimals} is 18. To select a different value for\\n * {decimals} you should overload it.\\n *\\n * All two of these values are immutable: they can only be set once during\\n * construction.\\n */\\n constructor(string memory name_, string memory symbol_) {\\n _name = name_;\\n _symbol = symbol_;\\n }\\n\\n /**\\n * @dev Returns the name of the token.\\n */\\n function name() public view virtual override returns (string memory) {\\n return _name;\\n }\\n\\n /**\\n * @dev Returns the symbol of the token, usually a shorter version of the\\n * name.\\n */\\n function symbol() public view virtual override returns (string memory) {\\n return _symbol;\\n }\\n\\n /**\\n * @dev Returns the number of decimals used to get its user representation.\\n * For example, if `decimals` equals `2`, a balance of `505` tokens should\\n * be displayed to a user as `5.05` (`505 / 10 ** 2`).\\n *\\n * Tokens usually opt for a value of 18, imitating the relationship between\\n * Ether and Wei. This is the value {ERC20} uses, unless this function is\\n * overridden;\\n *\\n * NOTE: This information is only used for _display_ purposes: it in\\n * no way affects any of the arithmetic of the contract, including\\n * {IERC20-balanceOf} and {IERC20-transfer}.\\n */\\n function decimals() public view virtual override returns (uint8) {\\n return 18;\\n }\\n\\n /**\\n * @dev See {IERC20-totalSupply}.\\n */\\n function totalSupply() public view virtual override returns (uint256) {\\n return _totalSupply;\\n }\\n\\n /**\\n * @dev See {IERC20-balanceOf}.\\n */\\n function balanceOf(address account) public view virtual override returns (uint256) {\\n return _balances[account];\\n }\\n\\n /**\\n * @dev See {IERC20-transfer}.\\n *\\n * Requirements:\\n *\\n * - `to` cannot be the zero address.\\n * - the caller must have a balance of at least `amount`.\\n */\\n function transfer(address to, uint256 amount) public virtual override returns (bool) {\\n address owner = _msgSender();\\n _transfer(owner, to, amount);\\n return true;\\n }\\n\\n /**\\n * @dev See {IERC20-allowance}.\\n */\\n function allowance(address owner, address spender) public view virtual override returns (uint256) {\\n return _allowances[owner][spender];\\n }\\n\\n /**\\n * @dev See {IERC20-approve}.\\n *\\n * NOTE: If `amount` is the maximum `uint256`, the allowance is not updated on\\n * `transferFrom`. This is semantically equivalent to an infinite approval.\\n *\\n * Requirements:\\n *\\n * - `spender` cannot be the zero address.\\n */\\n function approve(address spender, uint256 amount) public virtual override returns (bool) {\\n address owner = _msgSender();\\n _approve(owner, spender, amount);\\n return true;\\n }\\n\\n /**\\n * @dev See {IERC20-transferFrom}.\\n *\\n * Emits an {Approval} event indicating the updated allowance. This is not\\n * required by the EIP. See the note at the beginning of {ERC20}.\\n *\\n * NOTE: Does not update the allowance if the current allowance\\n * is the maximum `uint256`.\\n *\\n * Requirements:\\n *\\n * - `from` and `to` cannot be the zero address.\\n * - `from` must have a balance of at least `amount`.\\n * - the caller must have allowance for ``from``'s tokens of at least\\n * `amount`.\\n */\\n function transferFrom(\\n address from,\\n address to,\\n uint256 amount\\n ) public virtual override returns (bool) {\\n address spender = _msgSender();\\n _spendAllowance(from, spender, amount);\\n _transfer(from, to, amount);\\n return true;\\n }\\n\\n /**\\n * @dev Atomically increases the allowance granted to `spender` by the caller.\\n *\\n * This is an alternative to {approve} that can be used as a mitigation for\\n * problems described in {IERC20-approve}.\\n *\\n * Emits an {Approval} event indicating the updated allowance.\\n *\\n * Requirements:\\n *\\n * - `spender` cannot be the zero address.\\n */\\n function increaseAllowance(address spender, uint256 addedValue) public virtual returns (bool) {\\n address owner = _msgSender();\\n _approve(owner, spender, _allowances[owner][spender] + addedValue);\\n return true;\\n }\\n\\n /**\\n * @dev Atomically decreases the allowance granted to `spender` by the caller.\\n *\\n * This is an alternative to {approve} that can be used as a mitigation for\\n * problems described in {IERC20-approve}.\\n *\\n * Emits an {Approval} event indicating the updated allowance.\\n *\\n * Requirements:\\n *\\n * - `spender` cannot be the zero address.\\n * - `spender` must have allowance for the caller of at least\\n * `subtractedValue`.\\n */\\n function decreaseAllowance(address spender, uint256 subtractedValue) public virtual returns (bool) {\\n address owner = _msgSender();\\n uint256 currentAllowance = _allowances[owner][spender];\\n require(currentAllowance >= subtractedValue, \\\"ERC20: decreased allowance below zero\\\");\\n unchecked {\\n _approve(owner, spender, currentAllowance - subtractedValue);\\n }\\n\\n return true;\\n }\\n\\n /**\\n * @dev Moves `amount` of tokens from `sender` to `recipient`.\\n *\\n * This internal function is equivalent to {transfer}, and can be used to\\n * e.g. implement automatic token fees, slashing mechanisms, etc.\\n *\\n * Emits a {Transfer} event.\\n *\\n * Requirements:\\n *\\n * - `from` cannot be the zero address.\\n * - `to` cannot be the zero address.\\n * - `from` must have a balance of at least `amount`.\\n */\\n function _transfer(\\n address from,\\n address to,\\n uint256 amount\\n ) internal virtual {\\n require(from != address(0), \\\"ERC20: transfer from the zero address\\\");\\n require(to != address(0), \\\"ERC20: transfer to the zero address\\\");\\n\\n _beforeTokenTransfer(from, to, amount);\\n\\n uint256 fromBalance = _balances[from];\\n require(fromBalance >= amount, \\\"ERC20: transfer amount exceeds balance\\\");\\n unchecked {\\n _balances[from] = fromBalance - amount;\\n }\\n _balances[to] += amount;\\n\\n emit Transfer(from, to, amount);\\n\\n _afterTokenTransfer(from, to, amount);\\n }\\n\\n /** @dev Creates `amount` tokens and assigns them to `account`, increasing\\n * the total supply.\\n *\\n * Emits a {Transfer} event with `from` set to the zero address.\\n *\\n * Requirements:\\n *\\n * - `account` cannot be the zero address.\\n */\\n function _mint(address account, uint256 amount) internal virtual {\\n require(account != address(0), \\\"ERC20: mint to the zero address\\\");\\n\\n _beforeTokenTransfer(address(0), account, amount);\\n\\n _totalSupply += amount;\\n _balances[account] += amount;\\n emit Transfer(address(0), account, amount);\\n\\n _afterTokenTransfer(address(0), account, amount);\\n }\\n\\n /**\\n * @dev Destroys `amount` tokens from `account`, reducing the\\n * total supply.\\n *\\n * Emits a {Transfer} event with `to` set to the zero address.\\n *\\n * Requirements:\\n *\\n * - `account` cannot be the zero address.\\n * - `account` must have at least `amount` tokens.\\n */\\n function _burn(address account, uint256 amount) internal virtual {\\n require(account != address(0), \\\"ERC20: burn from the zero address\\\");\\n\\n _beforeTokenTransfer(account, address(0), amount);\\n\\n uint256 accountBalance = _balances[account];\\n require(accountBalance >= amount, \\\"ERC20: burn amount exceeds balance\\\");\\n unchecked {\\n _balances[account] = accountBalance - amount;\\n }\\n _totalSupply -= amount;\\n\\n emit Transfer(account, address(0), amount);\\n\\n _afterTokenTransfer(account, address(0), amount);\\n }\\n\\n /**\\n * @dev Sets `amount` as the allowance of `spender` over the `owner` s tokens.\\n *\\n * This internal function is equivalent to `approve`, and can be used to\\n * e.g. set automatic allowances for certain subsystems, etc.\\n *\\n * Emits an {Approval} event.\\n *\\n * Requirements:\\n *\\n * - `owner` cannot be the zero address.\\n * - `spender` cannot be the zero address.\\n */\\n function _approve(\\n address owner,\\n address spender,\\n uint256 amount\\n ) internal virtual {\\n require(owner != address(0), \\\"ERC20: approve from the zero address\\\");\\n require(spender != address(0), \\\"ERC20: approve to the zero address\\\");\\n\\n _allowances[owner][spender] = amount;\\n emit Approval(owner, spender, amount);\\n }\\n\\n /**\\n * @dev Spend `amount` form the allowance of `owner` toward `spender`.\\n *\\n * Does not update the allowance amount in case of infinite allowance.\\n * Revert if not enough allowance is available.\\n *\\n * Might emit an {Approval} event.\\n */\\n function _spendAllowance(\\n address owner,\\n address spender,\\n uint256 amount\\n ) internal virtual {\\n uint256 currentAllowance = allowance(owner, spender);\\n if (currentAllowance != type(uint256).max) {\\n require(currentAllowance >= amount, \\\"ERC20: insufficient allowance\\\");\\n unchecked {\\n _approve(owner, spender, currentAllowance - amount);\\n }\\n }\\n }\\n\\n /**\\n * @dev Hook that is called before any transfer of tokens. This includes\\n * minting and burning.\\n *\\n * Calling conditions:\\n *\\n * - when `from` and `to` are both non-zero, `amount` of ``from``'s tokens\\n * will be transferred to `to`.\\n * - when `from` is zero, `amount` tokens will be minted for `to`.\\n * - when `to` is zero, `amount` of ``from``'s tokens will be burned.\\n * - `from` and `to` are never both zero.\\n *\\n * To learn more about hooks, head to xref:ROOT:extending-contracts.adoc#using-hooks[Using Hooks].\\n */\\n function _beforeTokenTransfer(\\n address from,\\n address to,\\n uint256 amount\\n ) internal virtual {}\\n\\n /**\\n * @dev Hook that is called after any transfer of tokens. This includes\\n * minting and burning.\\n *\\n * Calling conditions:\\n *\\n * - when `from` and `to` are both non-zero, `amount` of ``from``'s tokens\\n * has been transferred to `to`.\\n * - when `from` is zero, `amount` tokens have been minted for `to`.\\n * - when `to` is zero, `amount` of ``from``'s tokens have been burned.\\n * - `from` and `to` are never both zero.\\n *\\n * To learn more about hooks, head to xref:ROOT:extending-contracts.adoc#using-hooks[Using Hooks].\\n */\\n function _afterTokenTransfer(\\n address from,\\n address to,\\n uint256 amount\\n ) internal virtual {}\\n}\\n\",\"keccak256\":\"0xdadd41acb749920eccf40aeaa8d291adf9751399a7343561bad13e7a8d99be0b\",\"license\":\"MIT\"},\"@openzeppelin/contracts/token/ERC20/IERC20.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.5.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 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(\\n address from,\\n address to,\\n uint256 amount\\n ) external returns (bool);\\n\\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\",\"keccak256\":\"0xbbc8ac883ac3c0078ce5ad3e288fbb3ffcc8a30c3a98c0fda0114d64fc44fca2\",\"license\":\"MIT\"},\"@openzeppelin/contracts/token/ERC20/extensions/IERC20Metadata.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts v4.4.1 (token/ERC20/extensions/IERC20Metadata.sol)\\n\\npragma solidity ^0.8.0;\\n\\nimport \\\"../IERC20.sol\\\";\\n\\n/**\\n * @dev Interface for the optional metadata functions from the ERC20 standard.\\n *\\n * _Available since v4.1._\\n */\\ninterface IERC20Metadata is IERC20 {\\n /**\\n * @dev Returns the name of the token.\\n */\\n function name() external view returns (string memory);\\n\\n /**\\n * @dev Returns the symbol of the token.\\n */\\n function symbol() external view returns (string memory);\\n\\n /**\\n * @dev Returns the decimals places of the token.\\n */\\n function decimals() external view returns (uint8);\\n}\\n\",\"keccak256\":\"0x8de418a5503946cabe331f35fe242d3201a73f67f77aaeb7110acb1f30423aca\",\"license\":\"MIT\"},\"@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\",\"keccak256\":\"0xe2e337e6dde9ef6b680e07338c493ebea1b5fd09b43424112868e9cc1706bca7\",\"license\":\"MIT\"},\"@uma/core/contracts/common/implementation/ExpandedERC20.sol\":{\"content\":\"// SPDX-License-Identifier: AGPL-3.0-only\\npragma solidity ^0.8.0;\\n\\nimport \\\"@openzeppelin/contracts/token/ERC20/ERC20.sol\\\";\\nimport \\\"./MultiRole.sol\\\";\\nimport \\\"../interfaces/ExpandedIERC20.sol\\\";\\n\\n/**\\n * @title An ERC20 with permissioned burning and minting. The contract deployer will initially\\n * be the owner who is capable of adding new roles.\\n */\\ncontract ExpandedERC20 is ExpandedIERC20, ERC20, MultiRole {\\n enum Roles {\\n // Can set the minter and burner.\\n Owner,\\n // Addresses that can mint new tokens.\\n Minter,\\n // Addresses that can burn tokens that address owns.\\n Burner\\n }\\n\\n uint8 _decimals;\\n\\n /**\\n * @notice Constructs the ExpandedERC20.\\n * @param _tokenName The name which describes the new token.\\n * @param _tokenSymbol The ticker abbreviation of the name. Ideally < 5 chars.\\n * @param _tokenDecimals The number of decimals to define token precision.\\n */\\n constructor(\\n string memory _tokenName,\\n string memory _tokenSymbol,\\n uint8 _tokenDecimals\\n ) ERC20(_tokenName, _tokenSymbol) {\\n _decimals = _tokenDecimals;\\n _createExclusiveRole(uint256(Roles.Owner), uint256(Roles.Owner), msg.sender);\\n _createSharedRole(uint256(Roles.Minter), uint256(Roles.Owner), new address[](0));\\n _createSharedRole(uint256(Roles.Burner), uint256(Roles.Owner), new address[](0));\\n }\\n\\n function decimals() public view virtual override(ERC20) returns (uint8) {\\n return _decimals;\\n }\\n\\n /**\\n * @dev Mints `value` tokens to `recipient`, returning true on success.\\n * @param recipient address to mint to.\\n * @param value amount of tokens to mint.\\n * @return True if the mint succeeded, or False.\\n */\\n function mint(address recipient, uint256 value)\\n external\\n override\\n onlyRoleHolder(uint256(Roles.Minter))\\n returns (bool)\\n {\\n _mint(recipient, value);\\n return true;\\n }\\n\\n /**\\n * @dev Burns `value` tokens owned by `msg.sender`.\\n * @param value amount of tokens to burn.\\n */\\n function burn(uint256 value) external override onlyRoleHolder(uint256(Roles.Burner)) {\\n _burn(msg.sender, value);\\n }\\n\\n /**\\n * @dev Burns `value` tokens owned by `recipient`.\\n * @param recipient address to burn tokens from.\\n * @param value amount of tokens to burn.\\n * @return True if the burn succeeded, or False.\\n */\\n function burnFrom(address recipient, uint256 value)\\n external\\n override\\n onlyRoleHolder(uint256(Roles.Burner))\\n returns (bool)\\n {\\n _burn(recipient, value);\\n return true;\\n }\\n\\n /**\\n * @notice Add Minter role to account.\\n * @dev The caller must have the Owner role.\\n * @param account The address to which the Minter role is added.\\n */\\n function addMinter(address account) external virtual override {\\n addMember(uint256(Roles.Minter), account);\\n }\\n\\n /**\\n * @notice Add Burner role to account.\\n * @dev The caller must have the Owner role.\\n * @param account The address to which the Burner role is added.\\n */\\n function addBurner(address account) external virtual override {\\n addMember(uint256(Roles.Burner), account);\\n }\\n\\n /**\\n * @notice Reset Owner role to account.\\n * @dev The caller must have the Owner role.\\n * @param account The new holder of the Owner role.\\n */\\n function resetOwner(address account) external virtual override {\\n resetMember(uint256(Roles.Owner), account);\\n }\\n}\\n\",\"keccak256\":\"0x8201459d3f78a1f97da7c421f2fbb859924d4facfc5fc235ba65d85bf12b2229\",\"license\":\"AGPL-3.0-only\"},\"@uma/core/contracts/common/implementation/MultiRole.sol\":{\"content\":\"// SPDX-License-Identifier: AGPL-3.0-only\\npragma solidity ^0.8.0;\\n\\nlibrary Exclusive {\\n struct RoleMembership {\\n address member;\\n }\\n\\n function isMember(RoleMembership storage roleMembership, address memberToCheck) internal view returns (bool) {\\n return roleMembership.member == memberToCheck;\\n }\\n\\n function resetMember(RoleMembership storage roleMembership, address newMember) internal {\\n require(newMember != address(0x0), \\\"Cannot set an exclusive role to 0x0\\\");\\n roleMembership.member = newMember;\\n }\\n\\n function getMember(RoleMembership storage roleMembership) internal view returns (address) {\\n return roleMembership.member;\\n }\\n\\n function init(RoleMembership storage roleMembership, address initialMember) internal {\\n resetMember(roleMembership, initialMember);\\n }\\n}\\n\\nlibrary Shared {\\n struct RoleMembership {\\n mapping(address => bool) members;\\n }\\n\\n function isMember(RoleMembership storage roleMembership, address memberToCheck) internal view returns (bool) {\\n return roleMembership.members[memberToCheck];\\n }\\n\\n function addMember(RoleMembership storage roleMembership, address memberToAdd) internal {\\n require(memberToAdd != address(0x0), \\\"Cannot add 0x0 to a shared role\\\");\\n roleMembership.members[memberToAdd] = true;\\n }\\n\\n function removeMember(RoleMembership storage roleMembership, address memberToRemove) internal {\\n roleMembership.members[memberToRemove] = false;\\n }\\n\\n function init(RoleMembership storage roleMembership, address[] memory initialMembers) internal {\\n for (uint256 i = 0; i < initialMembers.length; i++) {\\n addMember(roleMembership, initialMembers[i]);\\n }\\n }\\n}\\n\\n/**\\n * @title Base class to manage permissions for the derived class.\\n */\\nabstract contract MultiRole {\\n using Exclusive for Exclusive.RoleMembership;\\n using Shared for Shared.RoleMembership;\\n\\n enum RoleType { Invalid, Exclusive, Shared }\\n\\n struct Role {\\n uint256 managingRole;\\n RoleType roleType;\\n Exclusive.RoleMembership exclusiveRoleMembership;\\n Shared.RoleMembership sharedRoleMembership;\\n }\\n\\n mapping(uint256 => Role) private roles;\\n\\n event ResetExclusiveMember(uint256 indexed roleId, address indexed newMember, address indexed manager);\\n event AddedSharedMember(uint256 indexed roleId, address indexed newMember, address indexed manager);\\n event RemovedSharedMember(uint256 indexed roleId, address indexed oldMember, address indexed manager);\\n\\n /**\\n * @notice Reverts unless the caller is a member of the specified roleId.\\n */\\n modifier onlyRoleHolder(uint256 roleId) {\\n require(holdsRole(roleId, msg.sender), \\\"Sender does not hold required role\\\");\\n _;\\n }\\n\\n /**\\n * @notice Reverts unless the caller is a member of the manager role for the specified roleId.\\n */\\n modifier onlyRoleManager(uint256 roleId) {\\n require(holdsRole(roles[roleId].managingRole, msg.sender), \\\"Can only be called by a role manager\\\");\\n _;\\n }\\n\\n /**\\n * @notice Reverts unless the roleId represents an initialized, exclusive roleId.\\n */\\n modifier onlyExclusive(uint256 roleId) {\\n require(roles[roleId].roleType == RoleType.Exclusive, \\\"Must be called on an initialized Exclusive role\\\");\\n _;\\n }\\n\\n /**\\n * @notice Reverts unless the roleId represents an initialized, shared roleId.\\n */\\n modifier onlyShared(uint256 roleId) {\\n require(roles[roleId].roleType == RoleType.Shared, \\\"Must be called on an initialized Shared role\\\");\\n _;\\n }\\n\\n /**\\n * @notice Whether `memberToCheck` is a member of roleId.\\n * @dev Reverts if roleId does not correspond to an initialized role.\\n * @param roleId the Role to check.\\n * @param memberToCheck the address to check.\\n * @return True if `memberToCheck` is a member of `roleId`.\\n */\\n function holdsRole(uint256 roleId, address memberToCheck) public view returns (bool) {\\n Role storage role = roles[roleId];\\n if (role.roleType == RoleType.Exclusive) {\\n return role.exclusiveRoleMembership.isMember(memberToCheck);\\n } else if (role.roleType == RoleType.Shared) {\\n return role.sharedRoleMembership.isMember(memberToCheck);\\n }\\n revert(\\\"Invalid roleId\\\");\\n }\\n\\n /**\\n * @notice Changes the exclusive role holder of `roleId` to `newMember`.\\n * @dev Reverts if the caller is not a member of the managing role for `roleId` or if `roleId` is not an\\n * initialized, ExclusiveRole.\\n * @param roleId the ExclusiveRole membership to modify.\\n * @param newMember the new ExclusiveRole member.\\n */\\n function resetMember(uint256 roleId, address newMember) public onlyExclusive(roleId) onlyRoleManager(roleId) {\\n roles[roleId].exclusiveRoleMembership.resetMember(newMember);\\n emit ResetExclusiveMember(roleId, newMember, msg.sender);\\n }\\n\\n /**\\n * @notice Gets the current holder of the exclusive role, `roleId`.\\n * @dev Reverts if `roleId` does not represent an initialized, exclusive role.\\n * @param roleId the ExclusiveRole membership to check.\\n * @return the address of the current ExclusiveRole member.\\n */\\n function getMember(uint256 roleId) public view onlyExclusive(roleId) returns (address) {\\n return roles[roleId].exclusiveRoleMembership.getMember();\\n }\\n\\n /**\\n * @notice Adds `newMember` to the shared role, `roleId`.\\n * @dev Reverts if `roleId` does not represent an initialized, SharedRole or if the caller is not a member of the\\n * managing role for `roleId`.\\n * @param roleId the SharedRole membership to modify.\\n * @param newMember the new SharedRole member.\\n */\\n function addMember(uint256 roleId, address newMember) public onlyShared(roleId) onlyRoleManager(roleId) {\\n roles[roleId].sharedRoleMembership.addMember(newMember);\\n emit AddedSharedMember(roleId, newMember, msg.sender);\\n }\\n\\n /**\\n * @notice Removes `memberToRemove` from the shared role, `roleId`.\\n * @dev Reverts if `roleId` does not represent an initialized, SharedRole or if the caller is not a member of the\\n * managing role for `roleId`.\\n * @param roleId the SharedRole membership to modify.\\n * @param memberToRemove the current SharedRole member to remove.\\n */\\n function removeMember(uint256 roleId, address memberToRemove) public onlyShared(roleId) onlyRoleManager(roleId) {\\n roles[roleId].sharedRoleMembership.removeMember(memberToRemove);\\n emit RemovedSharedMember(roleId, memberToRemove, msg.sender);\\n }\\n\\n /**\\n * @notice Removes caller from the role, `roleId`.\\n * @dev Reverts if the caller is not a member of the role for `roleId` or if `roleId` is not an\\n * initialized, SharedRole.\\n * @param roleId the SharedRole membership to modify.\\n */\\n function renounceMembership(uint256 roleId) public onlyShared(roleId) onlyRoleHolder(roleId) {\\n roles[roleId].sharedRoleMembership.removeMember(msg.sender);\\n emit RemovedSharedMember(roleId, msg.sender, msg.sender);\\n }\\n\\n /**\\n * @notice Reverts if `roleId` is not initialized.\\n */\\n modifier onlyValidRole(uint256 roleId) {\\n require(roles[roleId].roleType != RoleType.Invalid, \\\"Attempted to use an invalid roleId\\\");\\n _;\\n }\\n\\n /**\\n * @notice Reverts if `roleId` is initialized.\\n */\\n modifier onlyInvalidRole(uint256 roleId) {\\n require(roles[roleId].roleType == RoleType.Invalid, \\\"Cannot use a pre-existing role\\\");\\n _;\\n }\\n\\n /**\\n * @notice Internal method to initialize a shared role, `roleId`, which will be managed by `managingRoleId`.\\n * `initialMembers` will be immediately added to the role.\\n * @dev Should be called by derived contracts, usually at construction time. Will revert if the role is already\\n * initialized.\\n */\\n function _createSharedRole(\\n uint256 roleId,\\n uint256 managingRoleId,\\n address[] memory initialMembers\\n ) internal onlyInvalidRole(roleId) {\\n Role storage role = roles[roleId];\\n role.roleType = RoleType.Shared;\\n role.managingRole = managingRoleId;\\n role.sharedRoleMembership.init(initialMembers);\\n require(\\n roles[managingRoleId].roleType != RoleType.Invalid,\\n \\\"Attempted to use an invalid role to manage a shared role\\\"\\n );\\n }\\n\\n /**\\n * @notice Internal method to initialize an exclusive role, `roleId`, which will be managed by `managingRoleId`.\\n * `initialMember` will be immediately added to the role.\\n * @dev Should be called by derived contracts, usually at construction time. Will revert if the role is already\\n * initialized.\\n */\\n function _createExclusiveRole(\\n uint256 roleId,\\n uint256 managingRoleId,\\n address initialMember\\n ) internal onlyInvalidRole(roleId) {\\n Role storage role = roles[roleId];\\n role.roleType = RoleType.Exclusive;\\n role.managingRole = managingRoleId;\\n role.exclusiveRoleMembership.init(initialMember);\\n require(\\n roles[managingRoleId].roleType != RoleType.Invalid,\\n \\\"Attempted to use an invalid role to manage an exclusive role\\\"\\n );\\n }\\n}\\n\",\"keccak256\":\"0x134c5a2f847832705be631f2b4eb2a3e23a91a2f0e63560abb481e85eeebfae6\",\"license\":\"AGPL-3.0-only\"},\"@uma/core/contracts/common/interfaces/ExpandedIERC20.sol\":{\"content\":\"// SPDX-License-Identifier: AGPL-3.0-only\\npragma solidity ^0.8.0;\\n\\nimport \\\"@openzeppelin/contracts/token/ERC20/IERC20.sol\\\";\\n\\n/**\\n * @title ERC20 interface that includes burn and mint methods.\\n */\\nabstract contract ExpandedIERC20 is IERC20 {\\n /**\\n * @notice Burns a specific amount of the caller's tokens.\\n * @dev Only burns the caller's tokens, so it is safe to leave this method permissionless.\\n */\\n function burn(uint256 value) external virtual;\\n\\n /**\\n * @dev Burns `value` tokens owned by `recipient`.\\n * @param recipient address to burn tokens from.\\n * @param value amount of tokens to burn.\\n */\\n function burnFrom(address recipient, uint256 value) external virtual returns (bool);\\n\\n /**\\n * @notice Mints tokens and adds them to the balance of the `to` address.\\n * @dev This method should be permissioned to only allow designated parties to mint tokens.\\n */\\n function mint(address to, uint256 value) external virtual returns (bool);\\n\\n function addMinter(address account) external virtual;\\n\\n function addBurner(address account) external virtual;\\n\\n function resetOwner(address account) external virtual;\\n}\\n\",\"keccak256\":\"0xb8252039cba45f1c19cd677f150a9823a5d6e1845cad90e3041d97c96f273c26\",\"license\":\"AGPL-3.0-only\"},\"contracts/LpTokenFactory.sol\":{\"content\":\"// SPDX-License-Identifier: GPL-3.0-only\\npragma solidity ^0.8.0;\\n\\nimport \\\"./interfaces/LpTokenFactoryInterface.sol\\\";\\n\\nimport \\\"@uma/core/contracts/common/implementation/ExpandedERC20.sol\\\";\\n\\n/**\\n * @notice Factory to create new LP ERC20 tokens that represent a liquidity provider's position. HubPool is the\\n * intended client of this contract.\\n */\\ncontract LpTokenFactory is LpTokenFactoryInterface {\\n /**\\n * @notice Deploys new LP token for L1 token. Sets caller as minter and burner of token.\\n * @param l1Token L1 token to name in LP token name.\\n * @return address of new LP token.\\n */\\n function createLpToken(address l1Token) public returns (address) {\\n ExpandedERC20 lpToken = new ExpandedERC20(\\n _append(\\\"Across \\\", IERC20Metadata(l1Token).name(), \\\" LP Token\\\"), // LP Token Name\\n _append(\\\"Av2-\\\", IERC20Metadata(l1Token).symbol(), \\\"-LP\\\"), // LP Token Symbol\\n IERC20Metadata(l1Token).decimals() // LP Token Decimals\\n );\\n lpToken.addMember(1, msg.sender); // Set this contract as the LP Token's minter.\\n lpToken.addMember(2, msg.sender); // Set this contract as the LP Token's burner.\\n\\n return address(lpToken);\\n }\\n\\n function _append(\\n string memory a,\\n string memory b,\\n string memory c\\n ) internal pure returns (string memory) {\\n return string(abi.encodePacked(a, b, c));\\n }\\n}\\n\",\"keccak256\":\"0xad31a59d9fe21b175ba0e29e100bc1d746e779b7b1bafafbb6271f2a16cf01a7\",\"license\":\"GPL-3.0-only\"},\"contracts/interfaces/LpTokenFactoryInterface.sol\":{\"content\":\"// SPDX-License-Identifier: AGPL-3.0-only\\npragma solidity ^0.8.0;\\n\\nimport \\\"@openzeppelin/contracts/token/ERC20/IERC20.sol\\\";\\n\\ninterface LpTokenFactoryInterface {\\n function createLpToken(address l1Token) external returns (address);\\n}\\n\",\"keccak256\":\"0xbff9f636f087e2c5acc05be2da6fe26d3558f0ff6d270f8738bd8027b4ac8eff\",\"license\":\"AGPL-3.0-only\"}},\"version\":1}", - "bytecode": "0x608060405234801561001057600080fd5b50612d0e806100206000396000f3fe60806040523480156200001157600080fd5b50600436106200002e5760003560e01c8063fc2f1b6e1462000033575b600080fd5b6200004a620000443660046200048f565b62000073565b60405173ffffffffffffffffffffffffffffffffffffffff909116815260200160405180910390f35b600080620001806040518060400160405280600781526020017f4163726f737320000000000000000000000000000000000000000000000000008152508473ffffffffffffffffffffffffffffffffffffffff166306fdde036040518163ffffffff1660e01b8152600401600060405180830381865afa158015620000fc573d6000803e3d6000fd5b505050506040513d6000823e601f3d9081017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe016820160405262000144919081019062000530565b6040518060400160405280600981526020017f204c5020546f6b656e000000000000000000000000000000000000000000000081525062000450565b6200028a6040518060400160405280600481526020017f4176322d000000000000000000000000000000000000000000000000000000008152508573ffffffffffffffffffffffffffffffffffffffff166395d89b416040518163ffffffff1660e01b8152600401600060405180830381865afa15801562000206573d6000803e3d6000fd5b505050506040513d6000823e601f3d9081017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe01682016040526200024e919081019062000530565b6040518060400160405280600381526020017f2d4c50000000000000000000000000000000000000000000000000000000000081525062000450565b8473ffffffffffffffffffffffffffffffffffffffff1663313ce5676040518163ffffffff1660e01b8152600401602060405180830381865afa158015620002d6573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190620002fc919062000607565b6040516200030a9062000481565b620003189392919062000678565b604051809103906000f08015801562000335573d6000803e3d6000fd5b506040517f74d0a6760000000000000000000000000000000000000000000000000000000081526001600482015233602482015290915073ffffffffffffffffffffffffffffffffffffffff8216906374d0a67690604401600060405180830381600087803b158015620003a857600080fd5b505af1158015620003bd573d6000803e3d6000fd5b50506040517f74d0a6760000000000000000000000000000000000000000000000000000000081526002600482015233602482015273ffffffffffffffffffffffffffffffffffffffff841692506374d0a6769150604401600060405180830381600087803b1580156200043057600080fd5b505af115801562000445573d6000803e3d6000fd5b509295945050505050565b60608383836040516020016200046993929190620006b5565b60405160208183030381529060405290509392505050565b6125da80620006ff83390190565b600060208284031215620004a257600080fd5b813573ffffffffffffffffffffffffffffffffffffffff81168114620004c757600080fd5b9392505050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b60005b838110156200051a57818101518382015260200162000500565b838111156200052a576000848401525b50505050565b6000602082840312156200054357600080fd5b815167ffffffffffffffff808211156200055c57600080fd5b818401915084601f8301126200057157600080fd5b815181811115620005865762000586620004ce565b604051601f82017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0908116603f01168101908382118183101715620005cf57620005cf620004ce565b81604052828152876020848701011115620005e957600080fd5b620005fc836020830160208801620004fd565b979650505050505050565b6000602082840312156200061a57600080fd5b815160ff81168114620004c757600080fd5b6000815180845262000646816020860160208601620004fd565b601f017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0169290920160200192915050565b6060815260006200068d60608301866200062c565b8281036020840152620006a181866200062c565b91505060ff83166040830152949350505050565b60008451620006c9818460208901620004fd565b845190830190620006df818360208901620004fd565b8451910190620006f4818360208801620004fd565b019594505050505056fe60806040523480156200001157600080fd5b50604051620025da380380620025da833981016040819052620000349162000623565b8251839083906200004d906003906020850190620004b0565b50805162000063906004906020840190620004b0565b50506006805460ff191660ff8416179055506200008360008033620000b5565b620000a060015b6040805160008082526020820190925262000206565b620000ac60026200008a565b5050506200073b565b826000808281526005602052604090206001015460ff166002811115620000e057620000e0620006a8565b14620001335760405162461bcd60e51b815260206004820152601e60248201527f43616e6e6f74207573652061207072652d6578697374696e6720726f6c65000060448201526064015b60405180910390fd5b60008481526005602052604090206001808201805460ff1916828002179055508381556200017160028201846200034d602090811b6200111717901c565b60008481526005602052604081206001015460ff1660028111156200019a576200019a620006a8565b1415620001ff5760405162461bcd60e51b815260206004820152603c6024820152600080516020620025ba83398151915260448201527f20746f206d616e61676520616e206578636c757369766520726f6c650000000060648201526084016200012a565b5050505050565b826000808281526005602052604090206001015460ff166002811115620002315762000231620006a8565b14620002805760405162461bcd60e51b815260206004820152601e60248201527f43616e6e6f74207573652061207072652d6578697374696e6720726f6c65000060448201526064016200012a565b600084815260056020908152604090912060018101805460ff1916600217905584815590620002bf9060038301908590620011216200035d821b17901c565b60008481526005602052604081206001015460ff166002811115620002e857620002e8620006a8565b1415620001ff5760405162461bcd60e51b81526020600482015260386024820152600080516020620025ba83398151915260448201527f20746f206d616e61676520612073686172656420726f6c65000000000000000060648201526084016200012a565b620003598282620003b2565b5050565b60005b8151811015620003ad576200039883838381518110620003845762000384620006be565b60200260200101516200043360201b60201c565b80620003a481620006d4565b91505062000360565b505050565b6001600160a01b038116620004165760405162461bcd60e51b815260206004820152602360248201527f43616e6e6f742073657420616e206578636c757369766520726f6c6520746f2060448201526203078360ec1b60648201526084016200012a565b81546001600160a01b0319166001600160a01b0391909116179055565b6001600160a01b0381166200048b5760405162461bcd60e51b815260206004820152601f60248201527f43616e6e6f74206164642030783020746f20612073686172656420726f6c650060448201526064016200012a565b6001600160a01b0316600090815260209190915260409020805460ff19166001179055565b828054620004be90620006fe565b90600052602060002090601f016020900481019282620004e257600085556200052d565b82601f10620004fd57805160ff19168380011785556200052d565b828001600101855582156200052d579182015b828111156200052d57825182559160200191906001019062000510565b506200053b9291506200053f565b5090565b5b808211156200053b576000815560010162000540565b634e487b7160e01b600052604160045260246000fd5b600082601f8301126200057e57600080fd5b81516001600160401b03808211156200059b576200059b62000556565b604051601f8301601f19908116603f01168101908282118183101715620005c657620005c662000556565b81604052838152602092508683858801011115620005e357600080fd5b600091505b83821015620006075785820183015181830184015290820190620005e8565b83821115620006195760008385830101525b9695505050505050565b6000806000606084860312156200063957600080fd5b83516001600160401b03808211156200065157600080fd5b6200065f878388016200056c565b945060208601519150808211156200067657600080fd5b5062000685868287016200056c565b925050604084015160ff811681146200069d57600080fd5b809150509250925092565b634e487b7160e01b600052602160045260246000fd5b634e487b7160e01b600052603260045260246000fd5b6000600019821415620006f757634e487b7160e01b600052601160045260246000fd5b5060010190565b600181811c908216806200071357607f821691505b602082108114156200073557634e487b7160e01b600052602260045260246000fd5b50919050565b611e6f806200074b6000396000f3fe608060405234801561001057600080fd5b506004361061018d5760003560e01c806374d0a676116100e3578063a9059cbb1161008c578063d97c05be11610066578063d97c05be14610369578063dd62ed3e1461037c578063f44637ba146103c257600080fd5b8063a9059cbb1461030b578063aaa14ca31461031e578063ab3545e51461033157600080fd5b806395d89b41116100bd57806395d89b41146102dd578063983b2d56146102e5578063a457c2d7146102f857600080fd5b806374d0a676146102a457806379cc6790146102b75780637cdc1cb9146102ca57600080fd5b806339509351116101455780636be7658b1161011f5780636be7658b1461024857806370a082311461025b57806373cc802a1461029157600080fd5b8063395093511461020d57806340c10f191461022057806342966c681461023357600080fd5b806318160ddd1161017657806318160ddd146101d357806323b872dd146101e5578063313ce567146101f857600080fd5b806306fdde0314610192578063095ea7b3146101b0575b600080fd5b61019a6103d5565b6040516101a79190611b63565b60405180910390f35b6101c36101be366004611bff565b610467565b60405190151581526020016101a7565b6002545b6040519081526020016101a7565b6101c36101f3366004611c29565b610481565b60065460405160ff90911681526020016101a7565b6101c361021b366004611bff565b6104a5565b6101c361022e366004611bff565b6104f1565b610246610241366004611c65565b61059a565b005b610246610256366004611c7e565b610640565b6101d7610269366004611caa565b73ffffffffffffffffffffffffffffffffffffffff1660009081526020819052604090205490565b61024661029f366004611caa565b610827565b6102466102b2366004611c7e565b610835565b6101c36102c5366004611bff565b6109f7565b6101c36102d8366004611c7e565b610a9b565b61019a610ba5565b6102466102f3366004611caa565b610bb4565b6101c3610306366004611bff565b610bc0565b6101c3610319366004611bff565b610c91565b61024661032c366004611c65565b610c9f565b61034461033f366004611c65565b610e62565b60405173ffffffffffffffffffffffffffffffffffffffff90911681526020016101a7565b610246610377366004611c7e565b610f4b565b6101d761038a366004611ccc565b73ffffffffffffffffffffffffffffffffffffffff918216600090815260016020908152604080832093909416825291909152205490565b6102466103d0366004611caa565b61110d565b6060600380546103e490611cf6565b80601f016020809104026020016040519081016040528092919081815260200182805461041090611cf6565b801561045d5780601f106104325761010080835404028352916020019161045d565b820191906000526020600020905b81548152906001019060200180831161044057829003601f168201915b5050505050905090565b600033610475818585611167565b60019150505b92915050565b60003361048f85828561131a565b61049a8585856113f1565b506001949350505050565b33600081815260016020908152604080832073ffffffffffffffffffffffffffffffffffffffff8716845290915281205490919061047590829086906104ec908790611d73565b611167565b600060016104ff8133610a9b565b610590576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602260248201527f53656e64657220646f6573206e6f7420686f6c6420726571756972656420726f60448201527f6c6500000000000000000000000000000000000000000000000000000000000060648201526084015b60405180910390fd5b61047584846116a4565b60026105a68133610a9b565b610632576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602260248201527f53656e64657220646f6573206e6f7420686f6c6420726571756972656420726f60448201527f6c650000000000000000000000000000000000000000000000000000000000006064820152608401610587565b61063c33836117c4565b5050565b81600260008281526005602052604090206001015460ff16600281111561066957610669611d8b565b146106f6576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602c60248201527f4d7573742062652063616c6c6564206f6e20616e20696e697469616c697a656460448201527f2053686172656420726f6c6500000000000000000000000000000000000000006064820152608401610587565b60008381526005602052604090205483906107119033610a9b565b61079c576040517f08c379a0000000000000000000000000000000000000000000000000000000008152602060048201526024808201527f43616e206f6e6c792062652063616c6c6564206279206120726f6c65206d616e60448201527f61676572000000000000000000000000000000000000000000000000000000006064820152608401610587565b600084815260056020908152604080832073ffffffffffffffffffffffffffffffffffffffff8716808552600390910190925280832080547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0016905551339287917feb3e33034c392e69263b04ec0fa376dc12784a41b6676c7f31b936cbc0fbb5af9190a450505050565b610832600082610f4b565b50565b81600260008281526005602052604090206001015460ff16600281111561085e5761085e611d8b565b146108eb576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602c60248201527f4d7573742062652063616c6c6564206f6e20616e20696e697469616c697a656460448201527f2053686172656420726f6c6500000000000000000000000000000000000000006064820152608401610587565b60008381526005602052604090205483906109069033610a9b565b610991576040517f08c379a0000000000000000000000000000000000000000000000000000000008152602060048201526024808201527f43616e206f6e6c792062652063616c6c6564206279206120726f6c65206d616e60448201527f61676572000000000000000000000000000000000000000000000000000000006064820152608401610587565b60008481526005602052604090206109ac90600301846119b1565b604051339073ffffffffffffffffffffffffffffffffffffffff85169086907f63502af7324ff6db91ab38f8236a648727d9385ea6c782073dd4882d8a61a48f90600090a450505050565b60006002610a058133610a9b565b610a91576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602260248201527f53656e64657220646f6573206e6f7420686f6c6420726571756972656420726f60448201527f6c650000000000000000000000000000000000000000000000000000000000006064820152608401610587565b61047584846117c4565b600082815260056020526040812060018082015460ff166002811115610ac357610ac3611d8b565b1415610af257600281015473ffffffffffffffffffffffffffffffffffffffff8481169116145b91505061047b565b6002600182015460ff166002811115610b0d57610b0d611d8b565b1415610b435773ffffffffffffffffffffffffffffffffffffffff8316600090815260038201602052604090205460ff16610aea565b6040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152600e60248201527f496e76616c696420726f6c6549640000000000000000000000000000000000006044820152606401610587565b6060600480546103e490611cf6565b61083260015b82610835565b33600081815260016020908152604080832073ffffffffffffffffffffffffffffffffffffffff8716845290915281205490919083811015610c84576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602560248201527f45524332303a2064656372656173656420616c6c6f77616e63652062656c6f7760448201527f207a65726f0000000000000000000000000000000000000000000000000000006064820152608401610587565b61049a8286868403611167565b6000336104758185856113f1565b80600260008281526005602052604090206001015460ff166002811115610cc857610cc8611d8b565b14610d55576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602c60248201527f4d7573742062652063616c6c6564206f6e20616e20696e697469616c697a656460448201527f2053686172656420726f6c6500000000000000000000000000000000000000006064820152608401610587565b81610d608133610a9b565b610dec576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602260248201527f53656e64657220646f6573206e6f7420686f6c6420726571756972656420726f60448201527f6c650000000000000000000000000000000000000000000000000000000000006064820152608401610587565b6000838152600560209081526040808320338452600301909152902080547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff001690556040513390819085907feb3e33034c392e69263b04ec0fa376dc12784a41b6676c7f31b936cbc0fbb5af90600090a4505050565b600081600160008281526005602052604090206001015460ff166002811115610e8d57610e8d611d8b565b14610f1a576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602f60248201527f4d7573742062652063616c6c6564206f6e20616e20696e697469616c697a656460448201527f204578636c757369766520726f6c6500000000000000000000000000000000006064820152608401610587565b60008381526005602052604090206002015473ffffffffffffffffffffffffffffffffffffffff1691505b50919050565b81600160008281526005602052604090206001015460ff166002811115610f7457610f74611d8b565b14611001576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602f60248201527f4d7573742062652063616c6c6564206f6e20616e20696e697469616c697a656460448201527f204578636c757369766520726f6c6500000000000000000000000000000000006064820152608401610587565b600083815260056020526040902054839061101c9033610a9b565b6110a7576040517f08c379a0000000000000000000000000000000000000000000000000000000008152602060048201526024808201527f43616e206f6e6c792062652063616c6c6564206279206120726f6c65206d616e60448201527f61676572000000000000000000000000000000000000000000000000000000006064820152608401610587565b60008481526005602052604090206110c29060020184611a7e565b604051339073ffffffffffffffffffffffffffffffffffffffff85169086907f3b855c56b409b671c7112789d022675eb639d0bcb8896f1b6197c132f799e74690600090a450505050565b6108326002610bba565b61063c8282611a7e565b60005b8151811015611162576111508383838151811061114357611143611dba565b60200260200101516119b1565b8061115a81611de9565b915050611124565b505050565b73ffffffffffffffffffffffffffffffffffffffff8316611209576040517f08c379a0000000000000000000000000000000000000000000000000000000008152602060048201526024808201527f45524332303a20617070726f76652066726f6d20746865207a65726f2061646460448201527f72657373000000000000000000000000000000000000000000000000000000006064820152608401610587565b73ffffffffffffffffffffffffffffffffffffffff82166112ac576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602260248201527f45524332303a20617070726f766520746f20746865207a65726f20616464726560448201527f73730000000000000000000000000000000000000000000000000000000000006064820152608401610587565b73ffffffffffffffffffffffffffffffffffffffff83811660008181526001602090815260408083209487168084529482529182902085905590518481527f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925910160405180910390a3505050565b73ffffffffffffffffffffffffffffffffffffffff8381166000908152600160209081526040808320938616835292905220547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff81146113eb57818110156113de576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601d60248201527f45524332303a20696e73756666696369656e7420616c6c6f77616e63650000006044820152606401610587565b6113eb8484848403611167565b50505050565b73ffffffffffffffffffffffffffffffffffffffff8316611494576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602560248201527f45524332303a207472616e736665722066726f6d20746865207a65726f20616460448201527f64726573730000000000000000000000000000000000000000000000000000006064820152608401610587565b73ffffffffffffffffffffffffffffffffffffffff8216611537576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602360248201527f45524332303a207472616e7366657220746f20746865207a65726f206164647260448201527f65737300000000000000000000000000000000000000000000000000000000006064820152608401610587565b73ffffffffffffffffffffffffffffffffffffffff8316600090815260208190526040902054818110156115ed576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602660248201527f45524332303a207472616e7366657220616d6f756e742065786365656473206260448201527f616c616e636500000000000000000000000000000000000000000000000000006064820152608401610587565b73ffffffffffffffffffffffffffffffffffffffff808516600090815260208190526040808220858503905591851681529081208054849290611631908490611d73565b925050819055508273ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef8460405161169791815260200190565b60405180910390a36113eb565b73ffffffffffffffffffffffffffffffffffffffff8216611721576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601f60248201527f45524332303a206d696e7420746f20746865207a65726f2061646472657373006044820152606401610587565b80600260008282546117339190611d73565b909155505073ffffffffffffffffffffffffffffffffffffffff82166000908152602081905260408120805483929061176d908490611d73565b909155505060405181815273ffffffffffffffffffffffffffffffffffffffff8316906000907fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef9060200160405180910390a35050565b73ffffffffffffffffffffffffffffffffffffffff8216611867576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602160248201527f45524332303a206275726e2066726f6d20746865207a65726f2061646472657360448201527f73000000000000000000000000000000000000000000000000000000000000006064820152608401610587565b73ffffffffffffffffffffffffffffffffffffffff82166000908152602081905260409020548181101561191d576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602260248201527f45524332303a206275726e20616d6f756e7420657863656564732062616c616e60448201527f63650000000000000000000000000000000000000000000000000000000000006064820152608401610587565b73ffffffffffffffffffffffffffffffffffffffff83166000908152602081905260408120838303905560028054849290611959908490611e22565b909155505060405182815260009073ffffffffffffffffffffffffffffffffffffffff8516907fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef9060200160405180910390a3505050565b73ffffffffffffffffffffffffffffffffffffffff8116611a2e576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601f60248201527f43616e6e6f74206164642030783020746f20612073686172656420726f6c65006044820152606401610587565b73ffffffffffffffffffffffffffffffffffffffff1660009081526020919091526040902080547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff00166001179055565b73ffffffffffffffffffffffffffffffffffffffff8116611b21576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602360248201527f43616e6e6f742073657420616e206578636c757369766520726f6c6520746f2060448201527f30783000000000000000000000000000000000000000000000000000000000006064820152608401610587565b81547fffffffffffffffffffffffff00000000000000000000000000000000000000001673ffffffffffffffffffffffffffffffffffffffff91909116179055565b600060208083528351808285015260005b81811015611b9057858101830151858201604001528201611b74565b81811115611ba2576000604083870101525b50601f017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe016929092016040019392505050565b803573ffffffffffffffffffffffffffffffffffffffff81168114611bfa57600080fd5b919050565b60008060408385031215611c1257600080fd5b611c1b83611bd6565b946020939093013593505050565b600080600060608486031215611c3e57600080fd5b611c4784611bd6565b9250611c5560208501611bd6565b9150604084013590509250925092565b600060208284031215611c7757600080fd5b5035919050565b60008060408385031215611c9157600080fd5b82359150611ca160208401611bd6565b90509250929050565b600060208284031215611cbc57600080fd5b611cc582611bd6565b9392505050565b60008060408385031215611cdf57600080fd5b611ce883611bd6565b9150611ca160208401611bd6565b600181811c90821680611d0a57607f821691505b60208210811415610f45577f4e487b7100000000000000000000000000000000000000000000000000000000600052602260045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b60008219821115611d8657611d86611d44565b500190565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052602160045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b60007fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff821415611e1b57611e1b611d44565b5060010190565b600082821015611e3457611e34611d44565b50039056fea2646970667358221220b88b51795d5c57b2535ef67e7460280bf0f3a0c3616eb80de21b9bdbc79c347664736f6c634300080b0033417474656d7074656420746f2075736520616e20696e76616c696420726f6c65a2646970667358221220c6a95e9190fa33e0d1b970db0439176a02d06787dc29e55595f3509e3633756064736f6c634300080b0033", - "deployedBytecode": "0x60806040523480156200001157600080fd5b50600436106200002e5760003560e01c8063fc2f1b6e1462000033575b600080fd5b6200004a620000443660046200048f565b62000073565b60405173ffffffffffffffffffffffffffffffffffffffff909116815260200160405180910390f35b600080620001806040518060400160405280600781526020017f4163726f737320000000000000000000000000000000000000000000000000008152508473ffffffffffffffffffffffffffffffffffffffff166306fdde036040518163ffffffff1660e01b8152600401600060405180830381865afa158015620000fc573d6000803e3d6000fd5b505050506040513d6000823e601f3d9081017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe016820160405262000144919081019062000530565b6040518060400160405280600981526020017f204c5020546f6b656e000000000000000000000000000000000000000000000081525062000450565b6200028a6040518060400160405280600481526020017f4176322d000000000000000000000000000000000000000000000000000000008152508573ffffffffffffffffffffffffffffffffffffffff166395d89b416040518163ffffffff1660e01b8152600401600060405180830381865afa15801562000206573d6000803e3d6000fd5b505050506040513d6000823e601f3d9081017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe01682016040526200024e919081019062000530565b6040518060400160405280600381526020017f2d4c50000000000000000000000000000000000000000000000000000000000081525062000450565b8473ffffffffffffffffffffffffffffffffffffffff1663313ce5676040518163ffffffff1660e01b8152600401602060405180830381865afa158015620002d6573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190620002fc919062000607565b6040516200030a9062000481565b620003189392919062000678565b604051809103906000f08015801562000335573d6000803e3d6000fd5b506040517f74d0a6760000000000000000000000000000000000000000000000000000000081526001600482015233602482015290915073ffffffffffffffffffffffffffffffffffffffff8216906374d0a67690604401600060405180830381600087803b158015620003a857600080fd5b505af1158015620003bd573d6000803e3d6000fd5b50506040517f74d0a6760000000000000000000000000000000000000000000000000000000081526002600482015233602482015273ffffffffffffffffffffffffffffffffffffffff841692506374d0a6769150604401600060405180830381600087803b1580156200043057600080fd5b505af115801562000445573d6000803e3d6000fd5b509295945050505050565b60608383836040516020016200046993929190620006b5565b60405160208183030381529060405290509392505050565b6125da80620006ff83390190565b600060208284031215620004a257600080fd5b813573ffffffffffffffffffffffffffffffffffffffff81168114620004c757600080fd5b9392505050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b60005b838110156200051a57818101518382015260200162000500565b838111156200052a576000848401525b50505050565b6000602082840312156200054357600080fd5b815167ffffffffffffffff808211156200055c57600080fd5b818401915084601f8301126200057157600080fd5b815181811115620005865762000586620004ce565b604051601f82017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0908116603f01168101908382118183101715620005cf57620005cf620004ce565b81604052828152876020848701011115620005e957600080fd5b620005fc836020830160208801620004fd565b979650505050505050565b6000602082840312156200061a57600080fd5b815160ff81168114620004c757600080fd5b6000815180845262000646816020860160208601620004fd565b601f017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0169290920160200192915050565b6060815260006200068d60608301866200062c565b8281036020840152620006a181866200062c565b91505060ff83166040830152949350505050565b60008451620006c9818460208901620004fd565b845190830190620006df818360208901620004fd565b8451910190620006f4818360208801620004fd565b019594505050505056fe60806040523480156200001157600080fd5b50604051620025da380380620025da833981016040819052620000349162000623565b8251839083906200004d906003906020850190620004b0565b50805162000063906004906020840190620004b0565b50506006805460ff191660ff8416179055506200008360008033620000b5565b620000a060015b6040805160008082526020820190925262000206565b620000ac60026200008a565b5050506200073b565b826000808281526005602052604090206001015460ff166002811115620000e057620000e0620006a8565b14620001335760405162461bcd60e51b815260206004820152601e60248201527f43616e6e6f74207573652061207072652d6578697374696e6720726f6c65000060448201526064015b60405180910390fd5b60008481526005602052604090206001808201805460ff1916828002179055508381556200017160028201846200034d602090811b6200111717901c565b60008481526005602052604081206001015460ff1660028111156200019a576200019a620006a8565b1415620001ff5760405162461bcd60e51b815260206004820152603c6024820152600080516020620025ba83398151915260448201527f20746f206d616e61676520616e206578636c757369766520726f6c650000000060648201526084016200012a565b5050505050565b826000808281526005602052604090206001015460ff166002811115620002315762000231620006a8565b14620002805760405162461bcd60e51b815260206004820152601e60248201527f43616e6e6f74207573652061207072652d6578697374696e6720726f6c65000060448201526064016200012a565b600084815260056020908152604090912060018101805460ff1916600217905584815590620002bf9060038301908590620011216200035d821b17901c565b60008481526005602052604081206001015460ff166002811115620002e857620002e8620006a8565b1415620001ff5760405162461bcd60e51b81526020600482015260386024820152600080516020620025ba83398151915260448201527f20746f206d616e61676520612073686172656420726f6c65000000000000000060648201526084016200012a565b620003598282620003b2565b5050565b60005b8151811015620003ad576200039883838381518110620003845762000384620006be565b60200260200101516200043360201b60201c565b80620003a481620006d4565b91505062000360565b505050565b6001600160a01b038116620004165760405162461bcd60e51b815260206004820152602360248201527f43616e6e6f742073657420616e206578636c757369766520726f6c6520746f2060448201526203078360ec1b60648201526084016200012a565b81546001600160a01b0319166001600160a01b0391909116179055565b6001600160a01b0381166200048b5760405162461bcd60e51b815260206004820152601f60248201527f43616e6e6f74206164642030783020746f20612073686172656420726f6c650060448201526064016200012a565b6001600160a01b0316600090815260209190915260409020805460ff19166001179055565b828054620004be90620006fe565b90600052602060002090601f016020900481019282620004e257600085556200052d565b82601f10620004fd57805160ff19168380011785556200052d565b828001600101855582156200052d579182015b828111156200052d57825182559160200191906001019062000510565b506200053b9291506200053f565b5090565b5b808211156200053b576000815560010162000540565b634e487b7160e01b600052604160045260246000fd5b600082601f8301126200057e57600080fd5b81516001600160401b03808211156200059b576200059b62000556565b604051601f8301601f19908116603f01168101908282118183101715620005c657620005c662000556565b81604052838152602092508683858801011115620005e357600080fd5b600091505b83821015620006075785820183015181830184015290820190620005e8565b83821115620006195760008385830101525b9695505050505050565b6000806000606084860312156200063957600080fd5b83516001600160401b03808211156200065157600080fd5b6200065f878388016200056c565b945060208601519150808211156200067657600080fd5b5062000685868287016200056c565b925050604084015160ff811681146200069d57600080fd5b809150509250925092565b634e487b7160e01b600052602160045260246000fd5b634e487b7160e01b600052603260045260246000fd5b6000600019821415620006f757634e487b7160e01b600052601160045260246000fd5b5060010190565b600181811c908216806200071357607f821691505b602082108114156200073557634e487b7160e01b600052602260045260246000fd5b50919050565b611e6f806200074b6000396000f3fe608060405234801561001057600080fd5b506004361061018d5760003560e01c806374d0a676116100e3578063a9059cbb1161008c578063d97c05be11610066578063d97c05be14610369578063dd62ed3e1461037c578063f44637ba146103c257600080fd5b8063a9059cbb1461030b578063aaa14ca31461031e578063ab3545e51461033157600080fd5b806395d89b41116100bd57806395d89b41146102dd578063983b2d56146102e5578063a457c2d7146102f857600080fd5b806374d0a676146102a457806379cc6790146102b75780637cdc1cb9146102ca57600080fd5b806339509351116101455780636be7658b1161011f5780636be7658b1461024857806370a082311461025b57806373cc802a1461029157600080fd5b8063395093511461020d57806340c10f191461022057806342966c681461023357600080fd5b806318160ddd1161017657806318160ddd146101d357806323b872dd146101e5578063313ce567146101f857600080fd5b806306fdde0314610192578063095ea7b3146101b0575b600080fd5b61019a6103d5565b6040516101a79190611b63565b60405180910390f35b6101c36101be366004611bff565b610467565b60405190151581526020016101a7565b6002545b6040519081526020016101a7565b6101c36101f3366004611c29565b610481565b60065460405160ff90911681526020016101a7565b6101c361021b366004611bff565b6104a5565b6101c361022e366004611bff565b6104f1565b610246610241366004611c65565b61059a565b005b610246610256366004611c7e565b610640565b6101d7610269366004611caa565b73ffffffffffffffffffffffffffffffffffffffff1660009081526020819052604090205490565b61024661029f366004611caa565b610827565b6102466102b2366004611c7e565b610835565b6101c36102c5366004611bff565b6109f7565b6101c36102d8366004611c7e565b610a9b565b61019a610ba5565b6102466102f3366004611caa565b610bb4565b6101c3610306366004611bff565b610bc0565b6101c3610319366004611bff565b610c91565b61024661032c366004611c65565b610c9f565b61034461033f366004611c65565b610e62565b60405173ffffffffffffffffffffffffffffffffffffffff90911681526020016101a7565b610246610377366004611c7e565b610f4b565b6101d761038a366004611ccc565b73ffffffffffffffffffffffffffffffffffffffff918216600090815260016020908152604080832093909416825291909152205490565b6102466103d0366004611caa565b61110d565b6060600380546103e490611cf6565b80601f016020809104026020016040519081016040528092919081815260200182805461041090611cf6565b801561045d5780601f106104325761010080835404028352916020019161045d565b820191906000526020600020905b81548152906001019060200180831161044057829003601f168201915b5050505050905090565b600033610475818585611167565b60019150505b92915050565b60003361048f85828561131a565b61049a8585856113f1565b506001949350505050565b33600081815260016020908152604080832073ffffffffffffffffffffffffffffffffffffffff8716845290915281205490919061047590829086906104ec908790611d73565b611167565b600060016104ff8133610a9b565b610590576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602260248201527f53656e64657220646f6573206e6f7420686f6c6420726571756972656420726f60448201527f6c6500000000000000000000000000000000000000000000000000000000000060648201526084015b60405180910390fd5b61047584846116a4565b60026105a68133610a9b565b610632576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602260248201527f53656e64657220646f6573206e6f7420686f6c6420726571756972656420726f60448201527f6c650000000000000000000000000000000000000000000000000000000000006064820152608401610587565b61063c33836117c4565b5050565b81600260008281526005602052604090206001015460ff16600281111561066957610669611d8b565b146106f6576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602c60248201527f4d7573742062652063616c6c6564206f6e20616e20696e697469616c697a656460448201527f2053686172656420726f6c6500000000000000000000000000000000000000006064820152608401610587565b60008381526005602052604090205483906107119033610a9b565b61079c576040517f08c379a0000000000000000000000000000000000000000000000000000000008152602060048201526024808201527f43616e206f6e6c792062652063616c6c6564206279206120726f6c65206d616e60448201527f61676572000000000000000000000000000000000000000000000000000000006064820152608401610587565b600084815260056020908152604080832073ffffffffffffffffffffffffffffffffffffffff8716808552600390910190925280832080547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0016905551339287917feb3e33034c392e69263b04ec0fa376dc12784a41b6676c7f31b936cbc0fbb5af9190a450505050565b610832600082610f4b565b50565b81600260008281526005602052604090206001015460ff16600281111561085e5761085e611d8b565b146108eb576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602c60248201527f4d7573742062652063616c6c6564206f6e20616e20696e697469616c697a656460448201527f2053686172656420726f6c6500000000000000000000000000000000000000006064820152608401610587565b60008381526005602052604090205483906109069033610a9b565b610991576040517f08c379a0000000000000000000000000000000000000000000000000000000008152602060048201526024808201527f43616e206f6e6c792062652063616c6c6564206279206120726f6c65206d616e60448201527f61676572000000000000000000000000000000000000000000000000000000006064820152608401610587565b60008481526005602052604090206109ac90600301846119b1565b604051339073ffffffffffffffffffffffffffffffffffffffff85169086907f63502af7324ff6db91ab38f8236a648727d9385ea6c782073dd4882d8a61a48f90600090a450505050565b60006002610a058133610a9b565b610a91576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602260248201527f53656e64657220646f6573206e6f7420686f6c6420726571756972656420726f60448201527f6c650000000000000000000000000000000000000000000000000000000000006064820152608401610587565b61047584846117c4565b600082815260056020526040812060018082015460ff166002811115610ac357610ac3611d8b565b1415610af257600281015473ffffffffffffffffffffffffffffffffffffffff8481169116145b91505061047b565b6002600182015460ff166002811115610b0d57610b0d611d8b565b1415610b435773ffffffffffffffffffffffffffffffffffffffff8316600090815260038201602052604090205460ff16610aea565b6040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152600e60248201527f496e76616c696420726f6c6549640000000000000000000000000000000000006044820152606401610587565b6060600480546103e490611cf6565b61083260015b82610835565b33600081815260016020908152604080832073ffffffffffffffffffffffffffffffffffffffff8716845290915281205490919083811015610c84576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602560248201527f45524332303a2064656372656173656420616c6c6f77616e63652062656c6f7760448201527f207a65726f0000000000000000000000000000000000000000000000000000006064820152608401610587565b61049a8286868403611167565b6000336104758185856113f1565b80600260008281526005602052604090206001015460ff166002811115610cc857610cc8611d8b565b14610d55576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602c60248201527f4d7573742062652063616c6c6564206f6e20616e20696e697469616c697a656460448201527f2053686172656420726f6c6500000000000000000000000000000000000000006064820152608401610587565b81610d608133610a9b565b610dec576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602260248201527f53656e64657220646f6573206e6f7420686f6c6420726571756972656420726f60448201527f6c650000000000000000000000000000000000000000000000000000000000006064820152608401610587565b6000838152600560209081526040808320338452600301909152902080547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff001690556040513390819085907feb3e33034c392e69263b04ec0fa376dc12784a41b6676c7f31b936cbc0fbb5af90600090a4505050565b600081600160008281526005602052604090206001015460ff166002811115610e8d57610e8d611d8b565b14610f1a576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602f60248201527f4d7573742062652063616c6c6564206f6e20616e20696e697469616c697a656460448201527f204578636c757369766520726f6c6500000000000000000000000000000000006064820152608401610587565b60008381526005602052604090206002015473ffffffffffffffffffffffffffffffffffffffff1691505b50919050565b81600160008281526005602052604090206001015460ff166002811115610f7457610f74611d8b565b14611001576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602f60248201527f4d7573742062652063616c6c6564206f6e20616e20696e697469616c697a656460448201527f204578636c757369766520726f6c6500000000000000000000000000000000006064820152608401610587565b600083815260056020526040902054839061101c9033610a9b565b6110a7576040517f08c379a0000000000000000000000000000000000000000000000000000000008152602060048201526024808201527f43616e206f6e6c792062652063616c6c6564206279206120726f6c65206d616e60448201527f61676572000000000000000000000000000000000000000000000000000000006064820152608401610587565b60008481526005602052604090206110c29060020184611a7e565b604051339073ffffffffffffffffffffffffffffffffffffffff85169086907f3b855c56b409b671c7112789d022675eb639d0bcb8896f1b6197c132f799e74690600090a450505050565b6108326002610bba565b61063c8282611a7e565b60005b8151811015611162576111508383838151811061114357611143611dba565b60200260200101516119b1565b8061115a81611de9565b915050611124565b505050565b73ffffffffffffffffffffffffffffffffffffffff8316611209576040517f08c379a0000000000000000000000000000000000000000000000000000000008152602060048201526024808201527f45524332303a20617070726f76652066726f6d20746865207a65726f2061646460448201527f72657373000000000000000000000000000000000000000000000000000000006064820152608401610587565b73ffffffffffffffffffffffffffffffffffffffff82166112ac576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602260248201527f45524332303a20617070726f766520746f20746865207a65726f20616464726560448201527f73730000000000000000000000000000000000000000000000000000000000006064820152608401610587565b73ffffffffffffffffffffffffffffffffffffffff83811660008181526001602090815260408083209487168084529482529182902085905590518481527f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925910160405180910390a3505050565b73ffffffffffffffffffffffffffffffffffffffff8381166000908152600160209081526040808320938616835292905220547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff81146113eb57818110156113de576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601d60248201527f45524332303a20696e73756666696369656e7420616c6c6f77616e63650000006044820152606401610587565b6113eb8484848403611167565b50505050565b73ffffffffffffffffffffffffffffffffffffffff8316611494576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602560248201527f45524332303a207472616e736665722066726f6d20746865207a65726f20616460448201527f64726573730000000000000000000000000000000000000000000000000000006064820152608401610587565b73ffffffffffffffffffffffffffffffffffffffff8216611537576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602360248201527f45524332303a207472616e7366657220746f20746865207a65726f206164647260448201527f65737300000000000000000000000000000000000000000000000000000000006064820152608401610587565b73ffffffffffffffffffffffffffffffffffffffff8316600090815260208190526040902054818110156115ed576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602660248201527f45524332303a207472616e7366657220616d6f756e742065786365656473206260448201527f616c616e636500000000000000000000000000000000000000000000000000006064820152608401610587565b73ffffffffffffffffffffffffffffffffffffffff808516600090815260208190526040808220858503905591851681529081208054849290611631908490611d73565b925050819055508273ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef8460405161169791815260200190565b60405180910390a36113eb565b73ffffffffffffffffffffffffffffffffffffffff8216611721576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601f60248201527f45524332303a206d696e7420746f20746865207a65726f2061646472657373006044820152606401610587565b80600260008282546117339190611d73565b909155505073ffffffffffffffffffffffffffffffffffffffff82166000908152602081905260408120805483929061176d908490611d73565b909155505060405181815273ffffffffffffffffffffffffffffffffffffffff8316906000907fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef9060200160405180910390a35050565b73ffffffffffffffffffffffffffffffffffffffff8216611867576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602160248201527f45524332303a206275726e2066726f6d20746865207a65726f2061646472657360448201527f73000000000000000000000000000000000000000000000000000000000000006064820152608401610587565b73ffffffffffffffffffffffffffffffffffffffff82166000908152602081905260409020548181101561191d576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602260248201527f45524332303a206275726e20616d6f756e7420657863656564732062616c616e60448201527f63650000000000000000000000000000000000000000000000000000000000006064820152608401610587565b73ffffffffffffffffffffffffffffffffffffffff83166000908152602081905260408120838303905560028054849290611959908490611e22565b909155505060405182815260009073ffffffffffffffffffffffffffffffffffffffff8516907fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef9060200160405180910390a3505050565b73ffffffffffffffffffffffffffffffffffffffff8116611a2e576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601f60248201527f43616e6e6f74206164642030783020746f20612073686172656420726f6c65006044820152606401610587565b73ffffffffffffffffffffffffffffffffffffffff1660009081526020919091526040902080547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff00166001179055565b73ffffffffffffffffffffffffffffffffffffffff8116611b21576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602360248201527f43616e6e6f742073657420616e206578636c757369766520726f6c6520746f2060448201527f30783000000000000000000000000000000000000000000000000000000000006064820152608401610587565b81547fffffffffffffffffffffffff00000000000000000000000000000000000000001673ffffffffffffffffffffffffffffffffffffffff91909116179055565b600060208083528351808285015260005b81811015611b9057858101830151858201604001528201611b74565b81811115611ba2576000604083870101525b50601f017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe016929092016040019392505050565b803573ffffffffffffffffffffffffffffffffffffffff81168114611bfa57600080fd5b919050565b60008060408385031215611c1257600080fd5b611c1b83611bd6565b946020939093013593505050565b600080600060608486031215611c3e57600080fd5b611c4784611bd6565b9250611c5560208501611bd6565b9150604084013590509250925092565b600060208284031215611c7757600080fd5b5035919050565b60008060408385031215611c9157600080fd5b82359150611ca160208401611bd6565b90509250929050565b600060208284031215611cbc57600080fd5b611cc582611bd6565b9392505050565b60008060408385031215611cdf57600080fd5b611ce883611bd6565b9150611ca160208401611bd6565b600181811c90821680611d0a57607f821691505b60208210811415610f45577f4e487b7100000000000000000000000000000000000000000000000000000000600052602260045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b60008219821115611d8657611d86611d44565b500190565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052602160045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b60007fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff821415611e1b57611e1b611d44565b5060010190565b600082821015611e3457611e34611d44565b50039056fea2646970667358221220b88b51795d5c57b2535ef67e7460280bf0f3a0c3616eb80de21b9bdbc79c347664736f6c634300080b0033417474656d7074656420746f2075736520616e20696e76616c696420726f6c65a2646970667358221220c6a95e9190fa33e0d1b970db0439176a02d06787dc29e55595f3509e3633756064736f6c634300080b0033", + "solcInputHash": "c8b9349311d8b5049b613ac98eb998d0", + "metadata": "{\"compiler\":{\"version\":\"0.8.13+commit.abaa5c0e\"},\"language\":\"Solidity\",\"output\":{\"abi\":[{\"inputs\":[{\"internalType\":\"address\",\"name\":\"l1Token\",\"type\":\"address\"}],\"name\":\"createLpToken\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"nonpayable\",\"type\":\"function\"}],\"devdoc\":{\"kind\":\"dev\",\"methods\":{\"createLpToken(address)\":{\"params\":{\"l1Token\":\"L1 token to name in LP token name.\"},\"returns\":{\"_0\":\"address of new LP token.\"}}},\"version\":1},\"userdoc\":{\"kind\":\"user\",\"methods\":{\"createLpToken(address)\":{\"notice\":\"Deploys new LP token for L1 token. Sets caller as minter and burner of token.\"}},\"notice\":\"Factory to create new LP ERC20 tokens that represent a liquidity provider's position. HubPool is the intended client of this contract.\",\"version\":1}},\"settings\":{\"compilationTarget\":{\"contracts/LpTokenFactory.sol\":\"LpTokenFactory\"},\"evmVersion\":\"london\",\"libraries\":{},\"metadata\":{\"bytecodeHash\":\"ipfs\",\"useLiteralContent\":true},\"optimizer\":{\"enabled\":true,\"runs\":1000000},\"remappings\":[]},\"sources\":{\"@openzeppelin/contracts/token/ERC20/ERC20.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.5.0) (token/ERC20/ERC20.sol)\\n\\npragma solidity ^0.8.0;\\n\\nimport \\\"./IERC20.sol\\\";\\nimport \\\"./extensions/IERC20Metadata.sol\\\";\\nimport \\\"../../utils/Context.sol\\\";\\n\\n/**\\n * @dev Implementation of the {IERC20} interface.\\n *\\n * This implementation is agnostic to the way tokens are created. This means\\n * that a supply mechanism has to be added in a derived contract using {_mint}.\\n * For a generic mechanism see {ERC20PresetMinterPauser}.\\n *\\n * TIP: For a detailed writeup see our guide\\n * https://forum.zeppelin.solutions/t/how-to-implement-erc20-supply-mechanisms/226[How\\n * to implement supply mechanisms].\\n *\\n * We have followed general OpenZeppelin Contracts guidelines: functions revert\\n * instead returning `false` on failure. This behavior is nonetheless\\n * conventional and does not conflict with the expectations of ERC20\\n * applications.\\n *\\n * Additionally, an {Approval} event is emitted on calls to {transferFrom}.\\n * This allows applications to reconstruct the allowance for all accounts just\\n * by listening to said events. Other implementations of the EIP may not emit\\n * these events, as it isn't required by the specification.\\n *\\n * Finally, the non-standard {decreaseAllowance} and {increaseAllowance}\\n * functions have been added to mitigate the well-known issues around setting\\n * allowances. See {IERC20-approve}.\\n */\\ncontract ERC20 is Context, IERC20, IERC20Metadata {\\n mapping(address => uint256) private _balances;\\n\\n mapping(address => mapping(address => uint256)) private _allowances;\\n\\n uint256 private _totalSupply;\\n\\n string private _name;\\n string private _symbol;\\n\\n /**\\n * @dev Sets the values for {name} and {symbol}.\\n *\\n * The default value of {decimals} is 18. To select a different value for\\n * {decimals} you should overload it.\\n *\\n * All two of these values are immutable: they can only be set once during\\n * construction.\\n */\\n constructor(string memory name_, string memory symbol_) {\\n _name = name_;\\n _symbol = symbol_;\\n }\\n\\n /**\\n * @dev Returns the name of the token.\\n */\\n function name() public view virtual override returns (string memory) {\\n return _name;\\n }\\n\\n /**\\n * @dev Returns the symbol of the token, usually a shorter version of the\\n * name.\\n */\\n function symbol() public view virtual override returns (string memory) {\\n return _symbol;\\n }\\n\\n /**\\n * @dev Returns the number of decimals used to get its user representation.\\n * For example, if `decimals` equals `2`, a balance of `505` tokens should\\n * be displayed to a user as `5.05` (`505 / 10 ** 2`).\\n *\\n * Tokens usually opt for a value of 18, imitating the relationship between\\n * Ether and Wei. This is the value {ERC20} uses, unless this function is\\n * overridden;\\n *\\n * NOTE: This information is only used for _display_ purposes: it in\\n * no way affects any of the arithmetic of the contract, including\\n * {IERC20-balanceOf} and {IERC20-transfer}.\\n */\\n function decimals() public view virtual override returns (uint8) {\\n return 18;\\n }\\n\\n /**\\n * @dev See {IERC20-totalSupply}.\\n */\\n function totalSupply() public view virtual override returns (uint256) {\\n return _totalSupply;\\n }\\n\\n /**\\n * @dev See {IERC20-balanceOf}.\\n */\\n function balanceOf(address account) public view virtual override returns (uint256) {\\n return _balances[account];\\n }\\n\\n /**\\n * @dev See {IERC20-transfer}.\\n *\\n * Requirements:\\n *\\n * - `to` cannot be the zero address.\\n * - the caller must have a balance of at least `amount`.\\n */\\n function transfer(address to, uint256 amount) public virtual override returns (bool) {\\n address owner = _msgSender();\\n _transfer(owner, to, amount);\\n return true;\\n }\\n\\n /**\\n * @dev See {IERC20-allowance}.\\n */\\n function allowance(address owner, address spender) public view virtual override returns (uint256) {\\n return _allowances[owner][spender];\\n }\\n\\n /**\\n * @dev See {IERC20-approve}.\\n *\\n * NOTE: If `amount` is the maximum `uint256`, the allowance is not updated on\\n * `transferFrom`. This is semantically equivalent to an infinite approval.\\n *\\n * Requirements:\\n *\\n * - `spender` cannot be the zero address.\\n */\\n function approve(address spender, uint256 amount) public virtual override returns (bool) {\\n address owner = _msgSender();\\n _approve(owner, spender, amount);\\n return true;\\n }\\n\\n /**\\n * @dev See {IERC20-transferFrom}.\\n *\\n * Emits an {Approval} event indicating the updated allowance. This is not\\n * required by the EIP. See the note at the beginning of {ERC20}.\\n *\\n * NOTE: Does not update the allowance if the current allowance\\n * is the maximum `uint256`.\\n *\\n * Requirements:\\n *\\n * - `from` and `to` cannot be the zero address.\\n * - `from` must have a balance of at least `amount`.\\n * - the caller must have allowance for ``from``'s tokens of at least\\n * `amount`.\\n */\\n function transferFrom(\\n address from,\\n address to,\\n uint256 amount\\n ) public virtual override returns (bool) {\\n address spender = _msgSender();\\n _spendAllowance(from, spender, amount);\\n _transfer(from, to, amount);\\n return true;\\n }\\n\\n /**\\n * @dev Atomically increases the allowance granted to `spender` by the caller.\\n *\\n * This is an alternative to {approve} that can be used as a mitigation for\\n * problems described in {IERC20-approve}.\\n *\\n * Emits an {Approval} event indicating the updated allowance.\\n *\\n * Requirements:\\n *\\n * - `spender` cannot be the zero address.\\n */\\n function increaseAllowance(address spender, uint256 addedValue) public virtual returns (bool) {\\n address owner = _msgSender();\\n _approve(owner, spender, _allowances[owner][spender] + addedValue);\\n return true;\\n }\\n\\n /**\\n * @dev Atomically decreases the allowance granted to `spender` by the caller.\\n *\\n * This is an alternative to {approve} that can be used as a mitigation for\\n * problems described in {IERC20-approve}.\\n *\\n * Emits an {Approval} event indicating the updated allowance.\\n *\\n * Requirements:\\n *\\n * - `spender` cannot be the zero address.\\n * - `spender` must have allowance for the caller of at least\\n * `subtractedValue`.\\n */\\n function decreaseAllowance(address spender, uint256 subtractedValue) public virtual returns (bool) {\\n address owner = _msgSender();\\n uint256 currentAllowance = _allowances[owner][spender];\\n require(currentAllowance >= subtractedValue, \\\"ERC20: decreased allowance below zero\\\");\\n unchecked {\\n _approve(owner, spender, currentAllowance - subtractedValue);\\n }\\n\\n return true;\\n }\\n\\n /**\\n * @dev Moves `amount` of tokens from `sender` to `recipient`.\\n *\\n * This internal function is equivalent to {transfer}, and can be used to\\n * e.g. implement automatic token fees, slashing mechanisms, etc.\\n *\\n * Emits a {Transfer} event.\\n *\\n * Requirements:\\n *\\n * - `from` cannot be the zero address.\\n * - `to` cannot be the zero address.\\n * - `from` must have a balance of at least `amount`.\\n */\\n function _transfer(\\n address from,\\n address to,\\n uint256 amount\\n ) internal virtual {\\n require(from != address(0), \\\"ERC20: transfer from the zero address\\\");\\n require(to != address(0), \\\"ERC20: transfer to the zero address\\\");\\n\\n _beforeTokenTransfer(from, to, amount);\\n\\n uint256 fromBalance = _balances[from];\\n require(fromBalance >= amount, \\\"ERC20: transfer amount exceeds balance\\\");\\n unchecked {\\n _balances[from] = fromBalance - amount;\\n }\\n _balances[to] += amount;\\n\\n emit Transfer(from, to, amount);\\n\\n _afterTokenTransfer(from, to, amount);\\n }\\n\\n /** @dev Creates `amount` tokens and assigns them to `account`, increasing\\n * the total supply.\\n *\\n * Emits a {Transfer} event with `from` set to the zero address.\\n *\\n * Requirements:\\n *\\n * - `account` cannot be the zero address.\\n */\\n function _mint(address account, uint256 amount) internal virtual {\\n require(account != address(0), \\\"ERC20: mint to the zero address\\\");\\n\\n _beforeTokenTransfer(address(0), account, amount);\\n\\n _totalSupply += amount;\\n _balances[account] += amount;\\n emit Transfer(address(0), account, amount);\\n\\n _afterTokenTransfer(address(0), account, amount);\\n }\\n\\n /**\\n * @dev Destroys `amount` tokens from `account`, reducing the\\n * total supply.\\n *\\n * Emits a {Transfer} event with `to` set to the zero address.\\n *\\n * Requirements:\\n *\\n * - `account` cannot be the zero address.\\n * - `account` must have at least `amount` tokens.\\n */\\n function _burn(address account, uint256 amount) internal virtual {\\n require(account != address(0), \\\"ERC20: burn from the zero address\\\");\\n\\n _beforeTokenTransfer(account, address(0), amount);\\n\\n uint256 accountBalance = _balances[account];\\n require(accountBalance >= amount, \\\"ERC20: burn amount exceeds balance\\\");\\n unchecked {\\n _balances[account] = accountBalance - amount;\\n }\\n _totalSupply -= amount;\\n\\n emit Transfer(account, address(0), amount);\\n\\n _afterTokenTransfer(account, address(0), amount);\\n }\\n\\n /**\\n * @dev Sets `amount` as the allowance of `spender` over the `owner` s tokens.\\n *\\n * This internal function is equivalent to `approve`, and can be used to\\n * e.g. set automatic allowances for certain subsystems, etc.\\n *\\n * Emits an {Approval} event.\\n *\\n * Requirements:\\n *\\n * - `owner` cannot be the zero address.\\n * - `spender` cannot be the zero address.\\n */\\n function _approve(\\n address owner,\\n address spender,\\n uint256 amount\\n ) internal virtual {\\n require(owner != address(0), \\\"ERC20: approve from the zero address\\\");\\n require(spender != address(0), \\\"ERC20: approve to the zero address\\\");\\n\\n _allowances[owner][spender] = amount;\\n emit Approval(owner, spender, amount);\\n }\\n\\n /**\\n * @dev Spend `amount` form the allowance of `owner` toward `spender`.\\n *\\n * Does not update the allowance amount in case of infinite allowance.\\n * Revert if not enough allowance is available.\\n *\\n * Might emit an {Approval} event.\\n */\\n function _spendAllowance(\\n address owner,\\n address spender,\\n uint256 amount\\n ) internal virtual {\\n uint256 currentAllowance = allowance(owner, spender);\\n if (currentAllowance != type(uint256).max) {\\n require(currentAllowance >= amount, \\\"ERC20: insufficient allowance\\\");\\n unchecked {\\n _approve(owner, spender, currentAllowance - amount);\\n }\\n }\\n }\\n\\n /**\\n * @dev Hook that is called before any transfer of tokens. This includes\\n * minting and burning.\\n *\\n * Calling conditions:\\n *\\n * - when `from` and `to` are both non-zero, `amount` of ``from``'s tokens\\n * will be transferred to `to`.\\n * - when `from` is zero, `amount` tokens will be minted for `to`.\\n * - when `to` is zero, `amount` of ``from``'s tokens will be burned.\\n * - `from` and `to` are never both zero.\\n *\\n * To learn more about hooks, head to xref:ROOT:extending-contracts.adoc#using-hooks[Using Hooks].\\n */\\n function _beforeTokenTransfer(\\n address from,\\n address to,\\n uint256 amount\\n ) internal virtual {}\\n\\n /**\\n * @dev Hook that is called after any transfer of tokens. This includes\\n * minting and burning.\\n *\\n * Calling conditions:\\n *\\n * - when `from` and `to` are both non-zero, `amount` of ``from``'s tokens\\n * has been transferred to `to`.\\n * - when `from` is zero, `amount` tokens have been minted for `to`.\\n * - when `to` is zero, `amount` of ``from``'s tokens have been burned.\\n * - `from` and `to` are never both zero.\\n *\\n * To learn more about hooks, head to xref:ROOT:extending-contracts.adoc#using-hooks[Using Hooks].\\n */\\n function _afterTokenTransfer(\\n address from,\\n address to,\\n uint256 amount\\n ) internal virtual {}\\n}\\n\",\"keccak256\":\"0xdadd41acb749920eccf40aeaa8d291adf9751399a7343561bad13e7a8d99be0b\",\"license\":\"MIT\"},\"@openzeppelin/contracts/token/ERC20/IERC20.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.5.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 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(\\n address from,\\n address to,\\n uint256 amount\\n ) external returns (bool);\\n\\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\",\"keccak256\":\"0xbbc8ac883ac3c0078ce5ad3e288fbb3ffcc8a30c3a98c0fda0114d64fc44fca2\",\"license\":\"MIT\"},\"@openzeppelin/contracts/token/ERC20/extensions/IERC20Metadata.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts v4.4.1 (token/ERC20/extensions/IERC20Metadata.sol)\\n\\npragma solidity ^0.8.0;\\n\\nimport \\\"../IERC20.sol\\\";\\n\\n/**\\n * @dev Interface for the optional metadata functions from the ERC20 standard.\\n *\\n * _Available since v4.1._\\n */\\ninterface IERC20Metadata is IERC20 {\\n /**\\n * @dev Returns the name of the token.\\n */\\n function name() external view returns (string memory);\\n\\n /**\\n * @dev Returns the symbol of the token.\\n */\\n function symbol() external view returns (string memory);\\n\\n /**\\n * @dev Returns the decimals places of the token.\\n */\\n function decimals() external view returns (uint8);\\n}\\n\",\"keccak256\":\"0x8de418a5503946cabe331f35fe242d3201a73f67f77aaeb7110acb1f30423aca\",\"license\":\"MIT\"},\"@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\",\"keccak256\":\"0xe2e337e6dde9ef6b680e07338c493ebea1b5fd09b43424112868e9cc1706bca7\",\"license\":\"MIT\"},\"@uma/core/contracts/common/implementation/ExpandedERC20.sol\":{\"content\":\"// SPDX-License-Identifier: AGPL-3.0-only\\npragma solidity ^0.8.0;\\n\\nimport \\\"@openzeppelin/contracts/token/ERC20/ERC20.sol\\\";\\nimport \\\"./MultiRole.sol\\\";\\nimport \\\"../interfaces/ExpandedIERC20.sol\\\";\\n\\n/**\\n * @title An ERC20 with permissioned burning and minting. The contract deployer will initially\\n * be the owner who is capable of adding new roles.\\n */\\ncontract ExpandedERC20 is ExpandedIERC20, ERC20, MultiRole {\\n enum Roles {\\n // Can set the minter and burner.\\n Owner,\\n // Addresses that can mint new tokens.\\n Minter,\\n // Addresses that can burn tokens that address owns.\\n Burner\\n }\\n\\n uint8 _decimals;\\n\\n /**\\n * @notice Constructs the ExpandedERC20.\\n * @param _tokenName The name which describes the new token.\\n * @param _tokenSymbol The ticker abbreviation of the name. Ideally < 5 chars.\\n * @param _tokenDecimals The number of decimals to define token precision.\\n */\\n constructor(\\n string memory _tokenName,\\n string memory _tokenSymbol,\\n uint8 _tokenDecimals\\n ) ERC20(_tokenName, _tokenSymbol) {\\n _decimals = _tokenDecimals;\\n _createExclusiveRole(uint256(Roles.Owner), uint256(Roles.Owner), msg.sender);\\n _createSharedRole(uint256(Roles.Minter), uint256(Roles.Owner), new address[](0));\\n _createSharedRole(uint256(Roles.Burner), uint256(Roles.Owner), new address[](0));\\n }\\n\\n function decimals() public view virtual override(ERC20) returns (uint8) {\\n return _decimals;\\n }\\n\\n /**\\n * @dev Mints `value` tokens to `recipient`, returning true on success.\\n * @param recipient address to mint to.\\n * @param value amount of tokens to mint.\\n * @return True if the mint succeeded, or False.\\n */\\n function mint(address recipient, uint256 value)\\n external\\n override\\n onlyRoleHolder(uint256(Roles.Minter))\\n returns (bool)\\n {\\n _mint(recipient, value);\\n return true;\\n }\\n\\n /**\\n * @dev Burns `value` tokens owned by `msg.sender`.\\n * @param value amount of tokens to burn.\\n */\\n function burn(uint256 value) external override onlyRoleHolder(uint256(Roles.Burner)) {\\n _burn(msg.sender, value);\\n }\\n\\n /**\\n * @dev Burns `value` tokens owned by `recipient`.\\n * @param recipient address to burn tokens from.\\n * @param value amount of tokens to burn.\\n * @return True if the burn succeeded, or False.\\n */\\n function burnFrom(address recipient, uint256 value)\\n external\\n override\\n onlyRoleHolder(uint256(Roles.Burner))\\n returns (bool)\\n {\\n _burn(recipient, value);\\n return true;\\n }\\n\\n /**\\n * @notice Add Minter role to account.\\n * @dev The caller must have the Owner role.\\n * @param account The address to which the Minter role is added.\\n */\\n function addMinter(address account) external virtual override {\\n addMember(uint256(Roles.Minter), account);\\n }\\n\\n /**\\n * @notice Add Burner role to account.\\n * @dev The caller must have the Owner role.\\n * @param account The address to which the Burner role is added.\\n */\\n function addBurner(address account) external virtual override {\\n addMember(uint256(Roles.Burner), account);\\n }\\n\\n /**\\n * @notice Reset Owner role to account.\\n * @dev The caller must have the Owner role.\\n * @param account The new holder of the Owner role.\\n */\\n function resetOwner(address account) external virtual override {\\n resetMember(uint256(Roles.Owner), account);\\n }\\n}\\n\",\"keccak256\":\"0x8201459d3f78a1f97da7c421f2fbb859924d4facfc5fc235ba65d85bf12b2229\",\"license\":\"AGPL-3.0-only\"},\"@uma/core/contracts/common/implementation/MultiRole.sol\":{\"content\":\"// SPDX-License-Identifier: AGPL-3.0-only\\npragma solidity ^0.8.0;\\n\\nlibrary Exclusive {\\n struct RoleMembership {\\n address member;\\n }\\n\\n function isMember(RoleMembership storage roleMembership, address memberToCheck) internal view returns (bool) {\\n return roleMembership.member == memberToCheck;\\n }\\n\\n function resetMember(RoleMembership storage roleMembership, address newMember) internal {\\n require(newMember != address(0x0), \\\"Cannot set an exclusive role to 0x0\\\");\\n roleMembership.member = newMember;\\n }\\n\\n function getMember(RoleMembership storage roleMembership) internal view returns (address) {\\n return roleMembership.member;\\n }\\n\\n function init(RoleMembership storage roleMembership, address initialMember) internal {\\n resetMember(roleMembership, initialMember);\\n }\\n}\\n\\nlibrary Shared {\\n struct RoleMembership {\\n mapping(address => bool) members;\\n }\\n\\n function isMember(RoleMembership storage roleMembership, address memberToCheck) internal view returns (bool) {\\n return roleMembership.members[memberToCheck];\\n }\\n\\n function addMember(RoleMembership storage roleMembership, address memberToAdd) internal {\\n require(memberToAdd != address(0x0), \\\"Cannot add 0x0 to a shared role\\\");\\n roleMembership.members[memberToAdd] = true;\\n }\\n\\n function removeMember(RoleMembership storage roleMembership, address memberToRemove) internal {\\n roleMembership.members[memberToRemove] = false;\\n }\\n\\n function init(RoleMembership storage roleMembership, address[] memory initialMembers) internal {\\n for (uint256 i = 0; i < initialMembers.length; i++) {\\n addMember(roleMembership, initialMembers[i]);\\n }\\n }\\n}\\n\\n/**\\n * @title Base class to manage permissions for the derived class.\\n */\\nabstract contract MultiRole {\\n using Exclusive for Exclusive.RoleMembership;\\n using Shared for Shared.RoleMembership;\\n\\n enum RoleType { Invalid, Exclusive, Shared }\\n\\n struct Role {\\n uint256 managingRole;\\n RoleType roleType;\\n Exclusive.RoleMembership exclusiveRoleMembership;\\n Shared.RoleMembership sharedRoleMembership;\\n }\\n\\n mapping(uint256 => Role) private roles;\\n\\n event ResetExclusiveMember(uint256 indexed roleId, address indexed newMember, address indexed manager);\\n event AddedSharedMember(uint256 indexed roleId, address indexed newMember, address indexed manager);\\n event RemovedSharedMember(uint256 indexed roleId, address indexed oldMember, address indexed manager);\\n\\n /**\\n * @notice Reverts unless the caller is a member of the specified roleId.\\n */\\n modifier onlyRoleHolder(uint256 roleId) {\\n require(holdsRole(roleId, msg.sender), \\\"Sender does not hold required role\\\");\\n _;\\n }\\n\\n /**\\n * @notice Reverts unless the caller is a member of the manager role for the specified roleId.\\n */\\n modifier onlyRoleManager(uint256 roleId) {\\n require(holdsRole(roles[roleId].managingRole, msg.sender), \\\"Can only be called by a role manager\\\");\\n _;\\n }\\n\\n /**\\n * @notice Reverts unless the roleId represents an initialized, exclusive roleId.\\n */\\n modifier onlyExclusive(uint256 roleId) {\\n require(roles[roleId].roleType == RoleType.Exclusive, \\\"Must be called on an initialized Exclusive role\\\");\\n _;\\n }\\n\\n /**\\n * @notice Reverts unless the roleId represents an initialized, shared roleId.\\n */\\n modifier onlyShared(uint256 roleId) {\\n require(roles[roleId].roleType == RoleType.Shared, \\\"Must be called on an initialized Shared role\\\");\\n _;\\n }\\n\\n /**\\n * @notice Whether `memberToCheck` is a member of roleId.\\n * @dev Reverts if roleId does not correspond to an initialized role.\\n * @param roleId the Role to check.\\n * @param memberToCheck the address to check.\\n * @return True if `memberToCheck` is a member of `roleId`.\\n */\\n function holdsRole(uint256 roleId, address memberToCheck) public view returns (bool) {\\n Role storage role = roles[roleId];\\n if (role.roleType == RoleType.Exclusive) {\\n return role.exclusiveRoleMembership.isMember(memberToCheck);\\n } else if (role.roleType == RoleType.Shared) {\\n return role.sharedRoleMembership.isMember(memberToCheck);\\n }\\n revert(\\\"Invalid roleId\\\");\\n }\\n\\n /**\\n * @notice Changes the exclusive role holder of `roleId` to `newMember`.\\n * @dev Reverts if the caller is not a member of the managing role for `roleId` or if `roleId` is not an\\n * initialized, ExclusiveRole.\\n * @param roleId the ExclusiveRole membership to modify.\\n * @param newMember the new ExclusiveRole member.\\n */\\n function resetMember(uint256 roleId, address newMember) public onlyExclusive(roleId) onlyRoleManager(roleId) {\\n roles[roleId].exclusiveRoleMembership.resetMember(newMember);\\n emit ResetExclusiveMember(roleId, newMember, msg.sender);\\n }\\n\\n /**\\n * @notice Gets the current holder of the exclusive role, `roleId`.\\n * @dev Reverts if `roleId` does not represent an initialized, exclusive role.\\n * @param roleId the ExclusiveRole membership to check.\\n * @return the address of the current ExclusiveRole member.\\n */\\n function getMember(uint256 roleId) public view onlyExclusive(roleId) returns (address) {\\n return roles[roleId].exclusiveRoleMembership.getMember();\\n }\\n\\n /**\\n * @notice Adds `newMember` to the shared role, `roleId`.\\n * @dev Reverts if `roleId` does not represent an initialized, SharedRole or if the caller is not a member of the\\n * managing role for `roleId`.\\n * @param roleId the SharedRole membership to modify.\\n * @param newMember the new SharedRole member.\\n */\\n function addMember(uint256 roleId, address newMember) public onlyShared(roleId) onlyRoleManager(roleId) {\\n roles[roleId].sharedRoleMembership.addMember(newMember);\\n emit AddedSharedMember(roleId, newMember, msg.sender);\\n }\\n\\n /**\\n * @notice Removes `memberToRemove` from the shared role, `roleId`.\\n * @dev Reverts if `roleId` does not represent an initialized, SharedRole or if the caller is not a member of the\\n * managing role for `roleId`.\\n * @param roleId the SharedRole membership to modify.\\n * @param memberToRemove the current SharedRole member to remove.\\n */\\n function removeMember(uint256 roleId, address memberToRemove) public onlyShared(roleId) onlyRoleManager(roleId) {\\n roles[roleId].sharedRoleMembership.removeMember(memberToRemove);\\n emit RemovedSharedMember(roleId, memberToRemove, msg.sender);\\n }\\n\\n /**\\n * @notice Removes caller from the role, `roleId`.\\n * @dev Reverts if the caller is not a member of the role for `roleId` or if `roleId` is not an\\n * initialized, SharedRole.\\n * @param roleId the SharedRole membership to modify.\\n */\\n function renounceMembership(uint256 roleId) public onlyShared(roleId) onlyRoleHolder(roleId) {\\n roles[roleId].sharedRoleMembership.removeMember(msg.sender);\\n emit RemovedSharedMember(roleId, msg.sender, msg.sender);\\n }\\n\\n /**\\n * @notice Reverts if `roleId` is not initialized.\\n */\\n modifier onlyValidRole(uint256 roleId) {\\n require(roles[roleId].roleType != RoleType.Invalid, \\\"Attempted to use an invalid roleId\\\");\\n _;\\n }\\n\\n /**\\n * @notice Reverts if `roleId` is initialized.\\n */\\n modifier onlyInvalidRole(uint256 roleId) {\\n require(roles[roleId].roleType == RoleType.Invalid, \\\"Cannot use a pre-existing role\\\");\\n _;\\n }\\n\\n /**\\n * @notice Internal method to initialize a shared role, `roleId`, which will be managed by `managingRoleId`.\\n * `initialMembers` will be immediately added to the role.\\n * @dev Should be called by derived contracts, usually at construction time. Will revert if the role is already\\n * initialized.\\n */\\n function _createSharedRole(\\n uint256 roleId,\\n uint256 managingRoleId,\\n address[] memory initialMembers\\n ) internal onlyInvalidRole(roleId) {\\n Role storage role = roles[roleId];\\n role.roleType = RoleType.Shared;\\n role.managingRole = managingRoleId;\\n role.sharedRoleMembership.init(initialMembers);\\n require(\\n roles[managingRoleId].roleType != RoleType.Invalid,\\n \\\"Attempted to use an invalid role to manage a shared role\\\"\\n );\\n }\\n\\n /**\\n * @notice Internal method to initialize an exclusive role, `roleId`, which will be managed by `managingRoleId`.\\n * `initialMember` will be immediately added to the role.\\n * @dev Should be called by derived contracts, usually at construction time. Will revert if the role is already\\n * initialized.\\n */\\n function _createExclusiveRole(\\n uint256 roleId,\\n uint256 managingRoleId,\\n address initialMember\\n ) internal onlyInvalidRole(roleId) {\\n Role storage role = roles[roleId];\\n role.roleType = RoleType.Exclusive;\\n role.managingRole = managingRoleId;\\n role.exclusiveRoleMembership.init(initialMember);\\n require(\\n roles[managingRoleId].roleType != RoleType.Invalid,\\n \\\"Attempted to use an invalid role to manage an exclusive role\\\"\\n );\\n }\\n}\\n\",\"keccak256\":\"0x134c5a2f847832705be631f2b4eb2a3e23a91a2f0e63560abb481e85eeebfae6\",\"license\":\"AGPL-3.0-only\"},\"@uma/core/contracts/common/interfaces/ExpandedIERC20.sol\":{\"content\":\"// SPDX-License-Identifier: AGPL-3.0-only\\npragma solidity ^0.8.0;\\n\\nimport \\\"@openzeppelin/contracts/token/ERC20/IERC20.sol\\\";\\n\\n/**\\n * @title ERC20 interface that includes burn and mint methods.\\n */\\nabstract contract ExpandedIERC20 is IERC20 {\\n /**\\n * @notice Burns a specific amount of the caller's tokens.\\n * @dev Only burns the caller's tokens, so it is safe to leave this method permissionless.\\n */\\n function burn(uint256 value) external virtual;\\n\\n /**\\n * @dev Burns `value` tokens owned by `recipient`.\\n * @param recipient address to burn tokens from.\\n * @param value amount of tokens to burn.\\n */\\n function burnFrom(address recipient, uint256 value) external virtual returns (bool);\\n\\n /**\\n * @notice Mints tokens and adds them to the balance of the `to` address.\\n * @dev This method should be permissioned to only allow designated parties to mint tokens.\\n */\\n function mint(address to, uint256 value) external virtual returns (bool);\\n\\n function addMinter(address account) external virtual;\\n\\n function addBurner(address account) external virtual;\\n\\n function resetOwner(address account) external virtual;\\n}\\n\",\"keccak256\":\"0xb8252039cba45f1c19cd677f150a9823a5d6e1845cad90e3041d97c96f273c26\",\"license\":\"AGPL-3.0-only\"},\"contracts/LpTokenFactory.sol\":{\"content\":\"// SPDX-License-Identifier: GPL-3.0-only\\npragma solidity ^0.8.0;\\n\\nimport \\\"./interfaces/LpTokenFactoryInterface.sol\\\";\\n\\nimport \\\"@uma/core/contracts/common/implementation/ExpandedERC20.sol\\\";\\n\\n/**\\n * @notice Factory to create new LP ERC20 tokens that represent a liquidity provider's position. HubPool is the\\n * intended client of this contract.\\n */\\ncontract LpTokenFactory is LpTokenFactoryInterface {\\n /**\\n * @notice Deploys new LP token for L1 token. Sets caller as minter and burner of token.\\n * @param l1Token L1 token to name in LP token name.\\n * @return address of new LP token.\\n */\\n function createLpToken(address l1Token) public returns (address) {\\n ExpandedERC20 lpToken = new ExpandedERC20(\\n _append(\\\"Across V2 \\\", IERC20Metadata(l1Token).name(), \\\" LP Token\\\"), // LP Token Name\\n _append(\\\"Av2-\\\", IERC20Metadata(l1Token).symbol(), \\\"-LP\\\"), // LP Token Symbol\\n IERC20Metadata(l1Token).decimals() // LP Token Decimals\\n );\\n lpToken.addMinter(msg.sender); // Set the caller as the LP Token's minter.\\n lpToken.addBurner(msg.sender); // Set the caller as the LP Token's burner.\\n lpToken.resetOwner(msg.sender); // Set the caller as the LP Token's owner.\\n\\n return address(lpToken);\\n }\\n\\n function _append(\\n string memory a,\\n string memory b,\\n string memory c\\n ) internal pure returns (string memory) {\\n return string(abi.encodePacked(a, b, c));\\n }\\n}\\n\",\"keccak256\":\"0x3af40092646f132fcdba4c42b51359abcd3797e5084fad627dd27ba47e0ca9c9\",\"license\":\"GPL-3.0-only\"},\"contracts/interfaces/LpTokenFactoryInterface.sol\":{\"content\":\"// SPDX-License-Identifier: AGPL-3.0-only\\npragma solidity ^0.8.0;\\n\\ninterface LpTokenFactoryInterface {\\n function createLpToken(address l1Token) external returns (address);\\n}\\n\",\"keccak256\":\"0x9cf1d6df25bb1bdf34db2473f3caaa4264b628ae2fc0f0a5a0256fd41214b47d\",\"license\":\"AGPL-3.0-only\"}},\"version\":1}", + "bytecode": "0x608060405234801561001057600080fd5b50612d78806100206000396000f3fe60806040523480156200001157600080fd5b50600436106200002e5760003560e01c8063fc2f1b6e1462000033575b600080fd5b6200004a6200004436600462000502565b62000073565b60405173ffffffffffffffffffffffffffffffffffffffff909116815260200160405180910390f35b600080620001806040518060400160405280600a81526020017f4163726f737320563220000000000000000000000000000000000000000000008152508473ffffffffffffffffffffffffffffffffffffffff166306fdde036040518163ffffffff1660e01b8152600401600060405180830381865afa158015620000fc573d6000803e3d6000fd5b505050506040513d6000823e601f3d9081017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0168201604052620001449190810190620005a3565b6040518060400160405280600981526020017f204c5020546f6b656e0000000000000000000000000000000000000000000000815250620004c3565b6200028a6040518060400160405280600481526020017f4176322d000000000000000000000000000000000000000000000000000000008152508573ffffffffffffffffffffffffffffffffffffffff166395d89b416040518163ffffffff1660e01b8152600401600060405180830381865afa15801562000206573d6000803e3d6000fd5b505050506040513d6000823e601f3d9081017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe01682016040526200024e9190810190620005a3565b6040518060400160405280600381526020017f2d4c500000000000000000000000000000000000000000000000000000000000815250620004c3565b8473ffffffffffffffffffffffffffffffffffffffff1663313ce5676040518163ffffffff1660e01b8152600401602060405180830381865afa158015620002d6573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190620002fc91906200067a565b6040516200030a90620004f4565b6200031893929190620006eb565b604051809103906000f08015801562000335573d6000803e3d6000fd5b506040517f983b2d5600000000000000000000000000000000000000000000000000000000815233600482015290915073ffffffffffffffffffffffffffffffffffffffff82169063983b2d5690602401600060405180830381600087803b158015620003a157600080fd5b505af1158015620003b6573d6000803e3d6000fd5b50506040517ff44637ba00000000000000000000000000000000000000000000000000000000815233600482015273ffffffffffffffffffffffffffffffffffffffff8416925063f44637ba9150602401600060405180830381600087803b1580156200042257600080fd5b505af115801562000437573d6000803e3d6000fd5b50506040517f73cc802a00000000000000000000000000000000000000000000000000000000815233600482015273ffffffffffffffffffffffffffffffffffffffff841692506373cc802a9150602401600060405180830381600087803b158015620004a357600080fd5b505af1158015620004b8573d6000803e3d6000fd5b509295945050505050565b6060838383604051602001620004dc9392919062000728565b60405160208183030381529060405290509392505050565b6125d1806200077283390190565b6000602082840312156200051557600080fd5b813573ffffffffffffffffffffffffffffffffffffffff811681146200053a57600080fd5b9392505050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b60005b838110156200058d57818101518382015260200162000573565b838111156200059d576000848401525b50505050565b600060208284031215620005b657600080fd5b815167ffffffffffffffff80821115620005cf57600080fd5b818401915084601f830112620005e457600080fd5b815181811115620005f957620005f962000541565b604051601f82017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0908116603f0116810190838211818310171562000642576200064262000541565b816040528281528760208487010111156200065c57600080fd5b6200066f83602083016020880162000570565b979650505050505050565b6000602082840312156200068d57600080fd5b815160ff811681146200053a57600080fd5b60008151808452620006b981602086016020860162000570565b601f017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0169290920160200192915050565b6060815260006200070060608301866200069f565b82810360208401526200071481866200069f565b91505060ff83166040830152949350505050565b600084516200073c81846020890162000570565b8451908301906200075281836020890162000570565b84519101906200076781836020880162000570565b019594505050505056fe60806040523480156200001157600080fd5b50604051620025d1380380620025d1833981016040819052620000349162000621565b8251839083906200004d906003906020850190620004ae565b50805162000063906004906020840190620004ae565b50506006805460ff191660ff8416179055506200008360008033620000b5565b620000a060015b6040805160008082526020820190925262000205565b620000ac60026200008a565b50505062000736565b826000808281526005602052604090206001015460ff166002811115620000e057620000e0620006a6565b14620001335760405162461bcd60e51b815260206004820152601e60248201527f43616e6e6f74207573652061207072652d6578697374696e6720726f6c65000060448201526064015b60405180910390fd5b60008481526005602052604090206001808201805460ff1916828002179055508381556200017160028201846200034b602090811b6200111517901c565b60008481526005602052604081206001015460ff1660028111156200019a576200019a620006a6565b03620001fe5760405162461bcd60e51b815260206004820152603c6024820152600080516020620025b183398151915260448201527f20746f206d616e61676520616e206578636c757369766520726f6c650000000060648201526084016200012a565b5050505050565b826000808281526005602052604090206001015460ff166002811115620002305762000230620006a6565b146200027f5760405162461bcd60e51b815260206004820152601e60248201527f43616e6e6f74207573652061207072652d6578697374696e6720726f6c65000060448201526064016200012a565b600084815260056020908152604090912060018101805460ff1916600217905584815590620002be90600383019085906200111f6200035b821b17901c565b60008481526005602052604081206001015460ff166002811115620002e757620002e7620006a6565b03620001fe5760405162461bcd60e51b81526020600482015260386024820152600080516020620025b183398151915260448201527f20746f206d616e61676520612073686172656420726f6c65000000000000000060648201526084016200012a565b620003578282620003b0565b5050565b60005b8151811015620003ab576200039683838381518110620003825762000382620006bc565b60200260200101516200043160201b60201c565b80620003a281620006d2565b9150506200035e565b505050565b6001600160a01b038116620004145760405162461bcd60e51b815260206004820152602360248201527f43616e6e6f742073657420616e206578636c757369766520726f6c6520746f2060448201526203078360ec1b60648201526084016200012a565b81546001600160a01b0319166001600160a01b0391909116179055565b6001600160a01b038116620004895760405162461bcd60e51b815260206004820152601f60248201527f43616e6e6f74206164642030783020746f20612073686172656420726f6c650060448201526064016200012a565b6001600160a01b0316600090815260209190915260409020805460ff19166001179055565b828054620004bc90620006fa565b90600052602060002090601f016020900481019282620004e057600085556200052b565b82601f10620004fb57805160ff19168380011785556200052b565b828001600101855582156200052b579182015b828111156200052b5782518255916020019190600101906200050e565b50620005399291506200053d565b5090565b5b808211156200053957600081556001016200053e565b634e487b7160e01b600052604160045260246000fd5b600082601f8301126200057c57600080fd5b81516001600160401b038082111562000599576200059962000554565b604051601f8301601f19908116603f01168101908282118183101715620005c457620005c462000554565b81604052838152602092508683858801011115620005e157600080fd5b600091505b83821015620006055785820183015181830184015290820190620005e6565b83821115620006175760008385830101525b9695505050505050565b6000806000606084860312156200063757600080fd5b83516001600160401b03808211156200064f57600080fd5b6200065d878388016200056a565b945060208601519150808211156200067457600080fd5b5062000683868287016200056a565b925050604084015160ff811681146200069b57600080fd5b809150509250925092565b634e487b7160e01b600052602160045260246000fd5b634e487b7160e01b600052603260045260246000fd5b600060018201620006f357634e487b7160e01b600052601160045260246000fd5b5060010190565b600181811c908216806200070f57607f821691505b6020821081036200073057634e487b7160e01b600052602260045260246000fd5b50919050565b611e6b80620007466000396000f3fe608060405234801561001057600080fd5b506004361061018d5760003560e01c806374d0a676116100e3578063a9059cbb1161008c578063d97c05be11610066578063d97c05be14610369578063dd62ed3e1461037c578063f44637ba146103c257600080fd5b8063a9059cbb1461030b578063aaa14ca31461031e578063ab3545e51461033157600080fd5b806395d89b41116100bd57806395d89b41146102dd578063983b2d56146102e5578063a457c2d7146102f857600080fd5b806374d0a676146102a457806379cc6790146102b75780637cdc1cb9146102ca57600080fd5b806339509351116101455780636be7658b1161011f5780636be7658b1461024857806370a082311461025b57806373cc802a1461029157600080fd5b8063395093511461020d57806340c10f191461022057806342966c681461023357600080fd5b806318160ddd1161017657806318160ddd146101d357806323b872dd146101e5578063313ce567146101f857600080fd5b806306fdde0314610192578063095ea7b3146101b0575b600080fd5b61019a6103d5565b6040516101a79190611b61565b60405180910390f35b6101c36101be366004611bfd565b610467565b60405190151581526020016101a7565b6002545b6040519081526020016101a7565b6101c36101f3366004611c27565b610481565b60065460405160ff90911681526020016101a7565b6101c361021b366004611bfd565b6104a5565b6101c361022e366004611bfd565b6104f1565b610246610241366004611c63565b61059a565b005b610246610256366004611c7c565b610640565b6101d7610269366004611ca8565b73ffffffffffffffffffffffffffffffffffffffff1660009081526020819052604090205490565b61024661029f366004611ca8565b610827565b6102466102b2366004611c7c565b610835565b6101c36102c5366004611bfd565b6109f7565b6101c36102d8366004611c7c565b610a9b565b61019a610ba3565b6102466102f3366004611ca8565b610bb2565b6101c3610306366004611bfd565b610bbe565b6101c3610319366004611bfd565b610c8f565b61024661032c366004611c63565b610c9d565b61034461033f366004611c63565b610e60565b60405173ffffffffffffffffffffffffffffffffffffffff90911681526020016101a7565b610246610377366004611c7c565b610f49565b6101d761038a366004611cca565b73ffffffffffffffffffffffffffffffffffffffff918216600090815260016020908152604080832093909416825291909152205490565b6102466103d0366004611ca8565b61110b565b6060600380546103e490611cf4565b80601f016020809104026020016040519081016040528092919081815260200182805461041090611cf4565b801561045d5780601f106104325761010080835404028352916020019161045d565b820191906000526020600020905b81548152906001019060200180831161044057829003601f168201915b5050505050905090565b600033610475818585611165565b60019150505b92915050565b60003361048f858285611318565b61049a8585856113ef565b506001949350505050565b33600081815260016020908152604080832073ffffffffffffffffffffffffffffffffffffffff8716845290915281205490919061047590829086906104ec908790611d70565b611165565b600060016104ff8133610a9b565b610590576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602260248201527f53656e64657220646f6573206e6f7420686f6c6420726571756972656420726f60448201527f6c6500000000000000000000000000000000000000000000000000000000000060648201526084015b60405180910390fd5b61047584846116a2565b60026105a68133610a9b565b610632576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602260248201527f53656e64657220646f6573206e6f7420686f6c6420726571756972656420726f60448201527f6c650000000000000000000000000000000000000000000000000000000000006064820152608401610587565b61063c33836117c2565b5050565b81600260008281526005602052604090206001015460ff16600281111561066957610669611d88565b146106f6576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602c60248201527f4d7573742062652063616c6c6564206f6e20616e20696e697469616c697a656460448201527f2053686172656420726f6c6500000000000000000000000000000000000000006064820152608401610587565b60008381526005602052604090205483906107119033610a9b565b61079c576040517f08c379a0000000000000000000000000000000000000000000000000000000008152602060048201526024808201527f43616e206f6e6c792062652063616c6c6564206279206120726f6c65206d616e60448201527f61676572000000000000000000000000000000000000000000000000000000006064820152608401610587565b600084815260056020908152604080832073ffffffffffffffffffffffffffffffffffffffff8716808552600390910190925280832080547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0016905551339287917feb3e33034c392e69263b04ec0fa376dc12784a41b6676c7f31b936cbc0fbb5af9190a450505050565b610832600082610f49565b50565b81600260008281526005602052604090206001015460ff16600281111561085e5761085e611d88565b146108eb576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602c60248201527f4d7573742062652063616c6c6564206f6e20616e20696e697469616c697a656460448201527f2053686172656420726f6c6500000000000000000000000000000000000000006064820152608401610587565b60008381526005602052604090205483906109069033610a9b565b610991576040517f08c379a0000000000000000000000000000000000000000000000000000000008152602060048201526024808201527f43616e206f6e6c792062652063616c6c6564206279206120726f6c65206d616e60448201527f61676572000000000000000000000000000000000000000000000000000000006064820152608401610587565b60008481526005602052604090206109ac90600301846119af565b604051339073ffffffffffffffffffffffffffffffffffffffff85169086907f63502af7324ff6db91ab38f8236a648727d9385ea6c782073dd4882d8a61a48f90600090a450505050565b60006002610a058133610a9b565b610a91576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602260248201527f53656e64657220646f6573206e6f7420686f6c6420726571756972656420726f60448201527f6c650000000000000000000000000000000000000000000000000000000000006064820152608401610587565b61047584846117c2565b600082815260056020526040812060018082015460ff166002811115610ac357610ac3611d88565b03610af157600281015473ffffffffffffffffffffffffffffffffffffffff8481169116145b91505061047b565b6002600182015460ff166002811115610b0c57610b0c611d88565b03610b415773ffffffffffffffffffffffffffffffffffffffff8316600090815260038201602052604090205460ff16610ae9565b6040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152600e60248201527f496e76616c696420726f6c6549640000000000000000000000000000000000006044820152606401610587565b6060600480546103e490611cf4565b61083260015b82610835565b33600081815260016020908152604080832073ffffffffffffffffffffffffffffffffffffffff8716845290915281205490919083811015610c82576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602560248201527f45524332303a2064656372656173656420616c6c6f77616e63652062656c6f7760448201527f207a65726f0000000000000000000000000000000000000000000000000000006064820152608401610587565b61049a8286868403611165565b6000336104758185856113ef565b80600260008281526005602052604090206001015460ff166002811115610cc657610cc6611d88565b14610d53576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602c60248201527f4d7573742062652063616c6c6564206f6e20616e20696e697469616c697a656460448201527f2053686172656420726f6c6500000000000000000000000000000000000000006064820152608401610587565b81610d5e8133610a9b565b610dea576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602260248201527f53656e64657220646f6573206e6f7420686f6c6420726571756972656420726f60448201527f6c650000000000000000000000000000000000000000000000000000000000006064820152608401610587565b6000838152600560209081526040808320338452600301909152902080547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff001690556040513390819085907feb3e33034c392e69263b04ec0fa376dc12784a41b6676c7f31b936cbc0fbb5af90600090a4505050565b600081600160008281526005602052604090206001015460ff166002811115610e8b57610e8b611d88565b14610f18576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602f60248201527f4d7573742062652063616c6c6564206f6e20616e20696e697469616c697a656460448201527f204578636c757369766520726f6c6500000000000000000000000000000000006064820152608401610587565b60008381526005602052604090206002015473ffffffffffffffffffffffffffffffffffffffff1691505b50919050565b81600160008281526005602052604090206001015460ff166002811115610f7257610f72611d88565b14610fff576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602f60248201527f4d7573742062652063616c6c6564206f6e20616e20696e697469616c697a656460448201527f204578636c757369766520726f6c6500000000000000000000000000000000006064820152608401610587565b600083815260056020526040902054839061101a9033610a9b565b6110a5576040517f08c379a0000000000000000000000000000000000000000000000000000000008152602060048201526024808201527f43616e206f6e6c792062652063616c6c6564206279206120726f6c65206d616e60448201527f61676572000000000000000000000000000000000000000000000000000000006064820152608401610587565b60008481526005602052604090206110c09060020184611a7c565b604051339073ffffffffffffffffffffffffffffffffffffffff85169086907f3b855c56b409b671c7112789d022675eb639d0bcb8896f1b6197c132f799e74690600090a450505050565b6108326002610bb8565b61063c8282611a7c565b60005b81518110156111605761114e8383838151811061114157611141611db7565b60200260200101516119af565b8061115881611de6565b915050611122565b505050565b73ffffffffffffffffffffffffffffffffffffffff8316611207576040517f08c379a0000000000000000000000000000000000000000000000000000000008152602060048201526024808201527f45524332303a20617070726f76652066726f6d20746865207a65726f2061646460448201527f72657373000000000000000000000000000000000000000000000000000000006064820152608401610587565b73ffffffffffffffffffffffffffffffffffffffff82166112aa576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602260248201527f45524332303a20617070726f766520746f20746865207a65726f20616464726560448201527f73730000000000000000000000000000000000000000000000000000000000006064820152608401610587565b73ffffffffffffffffffffffffffffffffffffffff83811660008181526001602090815260408083209487168084529482529182902085905590518481527f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925910160405180910390a3505050565b73ffffffffffffffffffffffffffffffffffffffff8381166000908152600160209081526040808320938616835292905220547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff81146113e957818110156113dc576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601d60248201527f45524332303a20696e73756666696369656e7420616c6c6f77616e63650000006044820152606401610587565b6113e98484848403611165565b50505050565b73ffffffffffffffffffffffffffffffffffffffff8316611492576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602560248201527f45524332303a207472616e736665722066726f6d20746865207a65726f20616460448201527f64726573730000000000000000000000000000000000000000000000000000006064820152608401610587565b73ffffffffffffffffffffffffffffffffffffffff8216611535576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602360248201527f45524332303a207472616e7366657220746f20746865207a65726f206164647260448201527f65737300000000000000000000000000000000000000000000000000000000006064820152608401610587565b73ffffffffffffffffffffffffffffffffffffffff8316600090815260208190526040902054818110156115eb576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602660248201527f45524332303a207472616e7366657220616d6f756e742065786365656473206260448201527f616c616e636500000000000000000000000000000000000000000000000000006064820152608401610587565b73ffffffffffffffffffffffffffffffffffffffff80851660009081526020819052604080822085850390559185168152908120805484929061162f908490611d70565b925050819055508273ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef8460405161169591815260200190565b60405180910390a36113e9565b73ffffffffffffffffffffffffffffffffffffffff821661171f576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601f60248201527f45524332303a206d696e7420746f20746865207a65726f2061646472657373006044820152606401610587565b80600260008282546117319190611d70565b909155505073ffffffffffffffffffffffffffffffffffffffff82166000908152602081905260408120805483929061176b908490611d70565b909155505060405181815273ffffffffffffffffffffffffffffffffffffffff8316906000907fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef9060200160405180910390a35050565b73ffffffffffffffffffffffffffffffffffffffff8216611865576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602160248201527f45524332303a206275726e2066726f6d20746865207a65726f2061646472657360448201527f73000000000000000000000000000000000000000000000000000000000000006064820152608401610587565b73ffffffffffffffffffffffffffffffffffffffff82166000908152602081905260409020548181101561191b576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602260248201527f45524332303a206275726e20616d6f756e7420657863656564732062616c616e60448201527f63650000000000000000000000000000000000000000000000000000000000006064820152608401610587565b73ffffffffffffffffffffffffffffffffffffffff83166000908152602081905260408120838303905560028054849290611957908490611e1e565b909155505060405182815260009073ffffffffffffffffffffffffffffffffffffffff8516907fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef9060200160405180910390a3505050565b73ffffffffffffffffffffffffffffffffffffffff8116611a2c576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601f60248201527f43616e6e6f74206164642030783020746f20612073686172656420726f6c65006044820152606401610587565b73ffffffffffffffffffffffffffffffffffffffff1660009081526020919091526040902080547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff00166001179055565b73ffffffffffffffffffffffffffffffffffffffff8116611b1f576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602360248201527f43616e6e6f742073657420616e206578636c757369766520726f6c6520746f2060448201527f30783000000000000000000000000000000000000000000000000000000000006064820152608401610587565b81547fffffffffffffffffffffffff00000000000000000000000000000000000000001673ffffffffffffffffffffffffffffffffffffffff91909116179055565b600060208083528351808285015260005b81811015611b8e57858101830151858201604001528201611b72565b81811115611ba0576000604083870101525b50601f017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe016929092016040019392505050565b803573ffffffffffffffffffffffffffffffffffffffff81168114611bf857600080fd5b919050565b60008060408385031215611c1057600080fd5b611c1983611bd4565b946020939093013593505050565b600080600060608486031215611c3c57600080fd5b611c4584611bd4565b9250611c5360208501611bd4565b9150604084013590509250925092565b600060208284031215611c7557600080fd5b5035919050565b60008060408385031215611c8f57600080fd5b82359150611c9f60208401611bd4565b90509250929050565b600060208284031215611cba57600080fd5b611cc382611bd4565b9392505050565b60008060408385031215611cdd57600080fd5b611ce683611bd4565b9150611c9f60208401611bd4565b600181811c90821680611d0857607f821691505b602082108103610f43577f4e487b7100000000000000000000000000000000000000000000000000000000600052602260045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b60008219821115611d8357611d83611d41565b500190565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052602160045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b60007fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff8203611e1757611e17611d41565b5060010190565b600082821015611e3057611e30611d41565b50039056fea2646970667358221220af62dd4c842a6ec357c4de2464fc459ad78dbb38819fa288eb99f4a3a869cfcb64736f6c634300080d0033417474656d7074656420746f2075736520616e20696e76616c696420726f6c65a26469706673582212209d0b7b3b71c235b34e79d5b72791522522cbfce906136557bf267400633999a264736f6c634300080d0033", + "deployedBytecode": "0x60806040523480156200001157600080fd5b50600436106200002e5760003560e01c8063fc2f1b6e1462000033575b600080fd5b6200004a6200004436600462000502565b62000073565b60405173ffffffffffffffffffffffffffffffffffffffff909116815260200160405180910390f35b600080620001806040518060400160405280600a81526020017f4163726f737320563220000000000000000000000000000000000000000000008152508473ffffffffffffffffffffffffffffffffffffffff166306fdde036040518163ffffffff1660e01b8152600401600060405180830381865afa158015620000fc573d6000803e3d6000fd5b505050506040513d6000823e601f3d9081017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0168201604052620001449190810190620005a3565b6040518060400160405280600981526020017f204c5020546f6b656e0000000000000000000000000000000000000000000000815250620004c3565b6200028a6040518060400160405280600481526020017f4176322d000000000000000000000000000000000000000000000000000000008152508573ffffffffffffffffffffffffffffffffffffffff166395d89b416040518163ffffffff1660e01b8152600401600060405180830381865afa15801562000206573d6000803e3d6000fd5b505050506040513d6000823e601f3d9081017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe01682016040526200024e9190810190620005a3565b6040518060400160405280600381526020017f2d4c500000000000000000000000000000000000000000000000000000000000815250620004c3565b8473ffffffffffffffffffffffffffffffffffffffff1663313ce5676040518163ffffffff1660e01b8152600401602060405180830381865afa158015620002d6573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190620002fc91906200067a565b6040516200030a90620004f4565b6200031893929190620006eb565b604051809103906000f08015801562000335573d6000803e3d6000fd5b506040517f983b2d5600000000000000000000000000000000000000000000000000000000815233600482015290915073ffffffffffffffffffffffffffffffffffffffff82169063983b2d5690602401600060405180830381600087803b158015620003a157600080fd5b505af1158015620003b6573d6000803e3d6000fd5b50506040517ff44637ba00000000000000000000000000000000000000000000000000000000815233600482015273ffffffffffffffffffffffffffffffffffffffff8416925063f44637ba9150602401600060405180830381600087803b1580156200042257600080fd5b505af115801562000437573d6000803e3d6000fd5b50506040517f73cc802a00000000000000000000000000000000000000000000000000000000815233600482015273ffffffffffffffffffffffffffffffffffffffff841692506373cc802a9150602401600060405180830381600087803b158015620004a357600080fd5b505af1158015620004b8573d6000803e3d6000fd5b509295945050505050565b6060838383604051602001620004dc9392919062000728565b60405160208183030381529060405290509392505050565b6125d1806200077283390190565b6000602082840312156200051557600080fd5b813573ffffffffffffffffffffffffffffffffffffffff811681146200053a57600080fd5b9392505050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b60005b838110156200058d57818101518382015260200162000573565b838111156200059d576000848401525b50505050565b600060208284031215620005b657600080fd5b815167ffffffffffffffff80821115620005cf57600080fd5b818401915084601f830112620005e457600080fd5b815181811115620005f957620005f962000541565b604051601f82017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0908116603f0116810190838211818310171562000642576200064262000541565b816040528281528760208487010111156200065c57600080fd5b6200066f83602083016020880162000570565b979650505050505050565b6000602082840312156200068d57600080fd5b815160ff811681146200053a57600080fd5b60008151808452620006b981602086016020860162000570565b601f017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0169290920160200192915050565b6060815260006200070060608301866200069f565b82810360208401526200071481866200069f565b91505060ff83166040830152949350505050565b600084516200073c81846020890162000570565b8451908301906200075281836020890162000570565b84519101906200076781836020880162000570565b019594505050505056fe60806040523480156200001157600080fd5b50604051620025d1380380620025d1833981016040819052620000349162000621565b8251839083906200004d906003906020850190620004ae565b50805162000063906004906020840190620004ae565b50506006805460ff191660ff8416179055506200008360008033620000b5565b620000a060015b6040805160008082526020820190925262000205565b620000ac60026200008a565b50505062000736565b826000808281526005602052604090206001015460ff166002811115620000e057620000e0620006a6565b14620001335760405162461bcd60e51b815260206004820152601e60248201527f43616e6e6f74207573652061207072652d6578697374696e6720726f6c65000060448201526064015b60405180910390fd5b60008481526005602052604090206001808201805460ff1916828002179055508381556200017160028201846200034b602090811b6200111517901c565b60008481526005602052604081206001015460ff1660028111156200019a576200019a620006a6565b03620001fe5760405162461bcd60e51b815260206004820152603c6024820152600080516020620025b183398151915260448201527f20746f206d616e61676520616e206578636c757369766520726f6c650000000060648201526084016200012a565b5050505050565b826000808281526005602052604090206001015460ff166002811115620002305762000230620006a6565b146200027f5760405162461bcd60e51b815260206004820152601e60248201527f43616e6e6f74207573652061207072652d6578697374696e6720726f6c65000060448201526064016200012a565b600084815260056020908152604090912060018101805460ff1916600217905584815590620002be90600383019085906200111f6200035b821b17901c565b60008481526005602052604081206001015460ff166002811115620002e757620002e7620006a6565b03620001fe5760405162461bcd60e51b81526020600482015260386024820152600080516020620025b183398151915260448201527f20746f206d616e61676520612073686172656420726f6c65000000000000000060648201526084016200012a565b620003578282620003b0565b5050565b60005b8151811015620003ab576200039683838381518110620003825762000382620006bc565b60200260200101516200043160201b60201c565b80620003a281620006d2565b9150506200035e565b505050565b6001600160a01b038116620004145760405162461bcd60e51b815260206004820152602360248201527f43616e6e6f742073657420616e206578636c757369766520726f6c6520746f2060448201526203078360ec1b60648201526084016200012a565b81546001600160a01b0319166001600160a01b0391909116179055565b6001600160a01b038116620004895760405162461bcd60e51b815260206004820152601f60248201527f43616e6e6f74206164642030783020746f20612073686172656420726f6c650060448201526064016200012a565b6001600160a01b0316600090815260209190915260409020805460ff19166001179055565b828054620004bc90620006fa565b90600052602060002090601f016020900481019282620004e057600085556200052b565b82601f10620004fb57805160ff19168380011785556200052b565b828001600101855582156200052b579182015b828111156200052b5782518255916020019190600101906200050e565b50620005399291506200053d565b5090565b5b808211156200053957600081556001016200053e565b634e487b7160e01b600052604160045260246000fd5b600082601f8301126200057c57600080fd5b81516001600160401b038082111562000599576200059962000554565b604051601f8301601f19908116603f01168101908282118183101715620005c457620005c462000554565b81604052838152602092508683858801011115620005e157600080fd5b600091505b83821015620006055785820183015181830184015290820190620005e6565b83821115620006175760008385830101525b9695505050505050565b6000806000606084860312156200063757600080fd5b83516001600160401b03808211156200064f57600080fd5b6200065d878388016200056a565b945060208601519150808211156200067457600080fd5b5062000683868287016200056a565b925050604084015160ff811681146200069b57600080fd5b809150509250925092565b634e487b7160e01b600052602160045260246000fd5b634e487b7160e01b600052603260045260246000fd5b600060018201620006f357634e487b7160e01b600052601160045260246000fd5b5060010190565b600181811c908216806200070f57607f821691505b6020821081036200073057634e487b7160e01b600052602260045260246000fd5b50919050565b611e6b80620007466000396000f3fe608060405234801561001057600080fd5b506004361061018d5760003560e01c806374d0a676116100e3578063a9059cbb1161008c578063d97c05be11610066578063d97c05be14610369578063dd62ed3e1461037c578063f44637ba146103c257600080fd5b8063a9059cbb1461030b578063aaa14ca31461031e578063ab3545e51461033157600080fd5b806395d89b41116100bd57806395d89b41146102dd578063983b2d56146102e5578063a457c2d7146102f857600080fd5b806374d0a676146102a457806379cc6790146102b75780637cdc1cb9146102ca57600080fd5b806339509351116101455780636be7658b1161011f5780636be7658b1461024857806370a082311461025b57806373cc802a1461029157600080fd5b8063395093511461020d57806340c10f191461022057806342966c681461023357600080fd5b806318160ddd1161017657806318160ddd146101d357806323b872dd146101e5578063313ce567146101f857600080fd5b806306fdde0314610192578063095ea7b3146101b0575b600080fd5b61019a6103d5565b6040516101a79190611b61565b60405180910390f35b6101c36101be366004611bfd565b610467565b60405190151581526020016101a7565b6002545b6040519081526020016101a7565b6101c36101f3366004611c27565b610481565b60065460405160ff90911681526020016101a7565b6101c361021b366004611bfd565b6104a5565b6101c361022e366004611bfd565b6104f1565b610246610241366004611c63565b61059a565b005b610246610256366004611c7c565b610640565b6101d7610269366004611ca8565b73ffffffffffffffffffffffffffffffffffffffff1660009081526020819052604090205490565b61024661029f366004611ca8565b610827565b6102466102b2366004611c7c565b610835565b6101c36102c5366004611bfd565b6109f7565b6101c36102d8366004611c7c565b610a9b565b61019a610ba3565b6102466102f3366004611ca8565b610bb2565b6101c3610306366004611bfd565b610bbe565b6101c3610319366004611bfd565b610c8f565b61024661032c366004611c63565b610c9d565b61034461033f366004611c63565b610e60565b60405173ffffffffffffffffffffffffffffffffffffffff90911681526020016101a7565b610246610377366004611c7c565b610f49565b6101d761038a366004611cca565b73ffffffffffffffffffffffffffffffffffffffff918216600090815260016020908152604080832093909416825291909152205490565b6102466103d0366004611ca8565b61110b565b6060600380546103e490611cf4565b80601f016020809104026020016040519081016040528092919081815260200182805461041090611cf4565b801561045d5780601f106104325761010080835404028352916020019161045d565b820191906000526020600020905b81548152906001019060200180831161044057829003601f168201915b5050505050905090565b600033610475818585611165565b60019150505b92915050565b60003361048f858285611318565b61049a8585856113ef565b506001949350505050565b33600081815260016020908152604080832073ffffffffffffffffffffffffffffffffffffffff8716845290915281205490919061047590829086906104ec908790611d70565b611165565b600060016104ff8133610a9b565b610590576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602260248201527f53656e64657220646f6573206e6f7420686f6c6420726571756972656420726f60448201527f6c6500000000000000000000000000000000000000000000000000000000000060648201526084015b60405180910390fd5b61047584846116a2565b60026105a68133610a9b565b610632576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602260248201527f53656e64657220646f6573206e6f7420686f6c6420726571756972656420726f60448201527f6c650000000000000000000000000000000000000000000000000000000000006064820152608401610587565b61063c33836117c2565b5050565b81600260008281526005602052604090206001015460ff16600281111561066957610669611d88565b146106f6576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602c60248201527f4d7573742062652063616c6c6564206f6e20616e20696e697469616c697a656460448201527f2053686172656420726f6c6500000000000000000000000000000000000000006064820152608401610587565b60008381526005602052604090205483906107119033610a9b565b61079c576040517f08c379a0000000000000000000000000000000000000000000000000000000008152602060048201526024808201527f43616e206f6e6c792062652063616c6c6564206279206120726f6c65206d616e60448201527f61676572000000000000000000000000000000000000000000000000000000006064820152608401610587565b600084815260056020908152604080832073ffffffffffffffffffffffffffffffffffffffff8716808552600390910190925280832080547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0016905551339287917feb3e33034c392e69263b04ec0fa376dc12784a41b6676c7f31b936cbc0fbb5af9190a450505050565b610832600082610f49565b50565b81600260008281526005602052604090206001015460ff16600281111561085e5761085e611d88565b146108eb576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602c60248201527f4d7573742062652063616c6c6564206f6e20616e20696e697469616c697a656460448201527f2053686172656420726f6c6500000000000000000000000000000000000000006064820152608401610587565b60008381526005602052604090205483906109069033610a9b565b610991576040517f08c379a0000000000000000000000000000000000000000000000000000000008152602060048201526024808201527f43616e206f6e6c792062652063616c6c6564206279206120726f6c65206d616e60448201527f61676572000000000000000000000000000000000000000000000000000000006064820152608401610587565b60008481526005602052604090206109ac90600301846119af565b604051339073ffffffffffffffffffffffffffffffffffffffff85169086907f63502af7324ff6db91ab38f8236a648727d9385ea6c782073dd4882d8a61a48f90600090a450505050565b60006002610a058133610a9b565b610a91576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602260248201527f53656e64657220646f6573206e6f7420686f6c6420726571756972656420726f60448201527f6c650000000000000000000000000000000000000000000000000000000000006064820152608401610587565b61047584846117c2565b600082815260056020526040812060018082015460ff166002811115610ac357610ac3611d88565b03610af157600281015473ffffffffffffffffffffffffffffffffffffffff8481169116145b91505061047b565b6002600182015460ff166002811115610b0c57610b0c611d88565b03610b415773ffffffffffffffffffffffffffffffffffffffff8316600090815260038201602052604090205460ff16610ae9565b6040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152600e60248201527f496e76616c696420726f6c6549640000000000000000000000000000000000006044820152606401610587565b6060600480546103e490611cf4565b61083260015b82610835565b33600081815260016020908152604080832073ffffffffffffffffffffffffffffffffffffffff8716845290915281205490919083811015610c82576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602560248201527f45524332303a2064656372656173656420616c6c6f77616e63652062656c6f7760448201527f207a65726f0000000000000000000000000000000000000000000000000000006064820152608401610587565b61049a8286868403611165565b6000336104758185856113ef565b80600260008281526005602052604090206001015460ff166002811115610cc657610cc6611d88565b14610d53576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602c60248201527f4d7573742062652063616c6c6564206f6e20616e20696e697469616c697a656460448201527f2053686172656420726f6c6500000000000000000000000000000000000000006064820152608401610587565b81610d5e8133610a9b565b610dea576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602260248201527f53656e64657220646f6573206e6f7420686f6c6420726571756972656420726f60448201527f6c650000000000000000000000000000000000000000000000000000000000006064820152608401610587565b6000838152600560209081526040808320338452600301909152902080547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff001690556040513390819085907feb3e33034c392e69263b04ec0fa376dc12784a41b6676c7f31b936cbc0fbb5af90600090a4505050565b600081600160008281526005602052604090206001015460ff166002811115610e8b57610e8b611d88565b14610f18576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602f60248201527f4d7573742062652063616c6c6564206f6e20616e20696e697469616c697a656460448201527f204578636c757369766520726f6c6500000000000000000000000000000000006064820152608401610587565b60008381526005602052604090206002015473ffffffffffffffffffffffffffffffffffffffff1691505b50919050565b81600160008281526005602052604090206001015460ff166002811115610f7257610f72611d88565b14610fff576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602f60248201527f4d7573742062652063616c6c6564206f6e20616e20696e697469616c697a656460448201527f204578636c757369766520726f6c6500000000000000000000000000000000006064820152608401610587565b600083815260056020526040902054839061101a9033610a9b565b6110a5576040517f08c379a0000000000000000000000000000000000000000000000000000000008152602060048201526024808201527f43616e206f6e6c792062652063616c6c6564206279206120726f6c65206d616e60448201527f61676572000000000000000000000000000000000000000000000000000000006064820152608401610587565b60008481526005602052604090206110c09060020184611a7c565b604051339073ffffffffffffffffffffffffffffffffffffffff85169086907f3b855c56b409b671c7112789d022675eb639d0bcb8896f1b6197c132f799e74690600090a450505050565b6108326002610bb8565b61063c8282611a7c565b60005b81518110156111605761114e8383838151811061114157611141611db7565b60200260200101516119af565b8061115881611de6565b915050611122565b505050565b73ffffffffffffffffffffffffffffffffffffffff8316611207576040517f08c379a0000000000000000000000000000000000000000000000000000000008152602060048201526024808201527f45524332303a20617070726f76652066726f6d20746865207a65726f2061646460448201527f72657373000000000000000000000000000000000000000000000000000000006064820152608401610587565b73ffffffffffffffffffffffffffffffffffffffff82166112aa576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602260248201527f45524332303a20617070726f766520746f20746865207a65726f20616464726560448201527f73730000000000000000000000000000000000000000000000000000000000006064820152608401610587565b73ffffffffffffffffffffffffffffffffffffffff83811660008181526001602090815260408083209487168084529482529182902085905590518481527f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925910160405180910390a3505050565b73ffffffffffffffffffffffffffffffffffffffff8381166000908152600160209081526040808320938616835292905220547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff81146113e957818110156113dc576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601d60248201527f45524332303a20696e73756666696369656e7420616c6c6f77616e63650000006044820152606401610587565b6113e98484848403611165565b50505050565b73ffffffffffffffffffffffffffffffffffffffff8316611492576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602560248201527f45524332303a207472616e736665722066726f6d20746865207a65726f20616460448201527f64726573730000000000000000000000000000000000000000000000000000006064820152608401610587565b73ffffffffffffffffffffffffffffffffffffffff8216611535576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602360248201527f45524332303a207472616e7366657220746f20746865207a65726f206164647260448201527f65737300000000000000000000000000000000000000000000000000000000006064820152608401610587565b73ffffffffffffffffffffffffffffffffffffffff8316600090815260208190526040902054818110156115eb576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602660248201527f45524332303a207472616e7366657220616d6f756e742065786365656473206260448201527f616c616e636500000000000000000000000000000000000000000000000000006064820152608401610587565b73ffffffffffffffffffffffffffffffffffffffff80851660009081526020819052604080822085850390559185168152908120805484929061162f908490611d70565b925050819055508273ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef8460405161169591815260200190565b60405180910390a36113e9565b73ffffffffffffffffffffffffffffffffffffffff821661171f576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601f60248201527f45524332303a206d696e7420746f20746865207a65726f2061646472657373006044820152606401610587565b80600260008282546117319190611d70565b909155505073ffffffffffffffffffffffffffffffffffffffff82166000908152602081905260408120805483929061176b908490611d70565b909155505060405181815273ffffffffffffffffffffffffffffffffffffffff8316906000907fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef9060200160405180910390a35050565b73ffffffffffffffffffffffffffffffffffffffff8216611865576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602160248201527f45524332303a206275726e2066726f6d20746865207a65726f2061646472657360448201527f73000000000000000000000000000000000000000000000000000000000000006064820152608401610587565b73ffffffffffffffffffffffffffffffffffffffff82166000908152602081905260409020548181101561191b576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602260248201527f45524332303a206275726e20616d6f756e7420657863656564732062616c616e60448201527f63650000000000000000000000000000000000000000000000000000000000006064820152608401610587565b73ffffffffffffffffffffffffffffffffffffffff83166000908152602081905260408120838303905560028054849290611957908490611e1e565b909155505060405182815260009073ffffffffffffffffffffffffffffffffffffffff8516907fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef9060200160405180910390a3505050565b73ffffffffffffffffffffffffffffffffffffffff8116611a2c576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601f60248201527f43616e6e6f74206164642030783020746f20612073686172656420726f6c65006044820152606401610587565b73ffffffffffffffffffffffffffffffffffffffff1660009081526020919091526040902080547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff00166001179055565b73ffffffffffffffffffffffffffffffffffffffff8116611b1f576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602360248201527f43616e6e6f742073657420616e206578636c757369766520726f6c6520746f2060448201527f30783000000000000000000000000000000000000000000000000000000000006064820152608401610587565b81547fffffffffffffffffffffffff00000000000000000000000000000000000000001673ffffffffffffffffffffffffffffffffffffffff91909116179055565b600060208083528351808285015260005b81811015611b8e57858101830151858201604001528201611b72565b81811115611ba0576000604083870101525b50601f017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe016929092016040019392505050565b803573ffffffffffffffffffffffffffffffffffffffff81168114611bf857600080fd5b919050565b60008060408385031215611c1057600080fd5b611c1983611bd4565b946020939093013593505050565b600080600060608486031215611c3c57600080fd5b611c4584611bd4565b9250611c5360208501611bd4565b9150604084013590509250925092565b600060208284031215611c7557600080fd5b5035919050565b60008060408385031215611c8f57600080fd5b82359150611c9f60208401611bd4565b90509250929050565b600060208284031215611cba57600080fd5b611cc382611bd4565b9392505050565b60008060408385031215611cdd57600080fd5b611ce683611bd4565b9150611c9f60208401611bd4565b600181811c90821680611d0857607f821691505b602082108103610f43577f4e487b7100000000000000000000000000000000000000000000000000000000600052602260045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b60008219821115611d8357611d83611d41565b500190565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052602160045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b60007fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff8203611e1757611e17611d41565b5060010190565b600082821015611e3057611e30611d41565b50039056fea2646970667358221220af62dd4c842a6ec357c4de2464fc459ad78dbb38819fa288eb99f4a3a869cfcb64736f6c634300080d0033417474656d7074656420746f2075736520616e20696e76616c696420726f6c65a26469706673582212209d0b7b3b71c235b34e79d5b72791522522cbfce906136557bf267400633999a264736f6c634300080d0033", "devdoc": { "kind": "dev", "methods": { diff --git a/deployments/kovan/Optimism_Adapter.json b/deployments/kovan/Optimism_Adapter.json index a5bb69e0b..492ffa1c5 100644 --- a/deployments/kovan/Optimism_Adapter.json +++ b/deployments/kovan/Optimism_Adapter.json @@ -1,5 +1,5 @@ { - "address": "0xaF239EF7336AD678Ba718eb20F9428F5F67d1340", + "address": "0xf0fF8f4811C055D40cd9222670cdD377f243D33E", "abi": [ { "inputs": [ @@ -22,32 +22,6 @@ "stateMutability": "nonpayable", "type": "constructor" }, - { - "anonymous": false, - "inputs": [ - { - "indexed": false, - "internalType": "address", - "name": "newHubPool", - "type": "address" - } - ], - "name": "HubPoolChanged", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": false, - "internalType": "uint32", - "name": "newGasLimit", - "type": "uint32" - } - ], - "name": "L2GasLimitSet", - "type": "event" - }, { "anonymous": false, "inputs": [ @@ -249,19 +223,19 @@ "type": "function" } ], - "transactionHash": "0x6881b156415a33cd6ff86a8684b47b565c30bb08243e29d1281f9558f9fbe671", + "transactionHash": "0x3688ab69ffcfd7a8a13c64e8e834bacf9ac9aba9c4e729997799ee3f7fc35848", "receipt": { "to": null, "from": "0x9A8f92a830A5cB89a3816e3D267CB7791c16b04D", - "contractAddress": "0xaF239EF7336AD678Ba718eb20F9428F5F67d1340", + "contractAddress": "0xf0fF8f4811C055D40cd9222670cdD377f243D33E", "transactionIndex": 3, - "gasUsed": "918341", + "gasUsed": "912742", "logsBloom": "0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", - "blockHash": "0x93cbb8efe61fec655c698c9d3bfa7e34f482c851c3a949ca04d77a10d48f7405", - "transactionHash": "0x6881b156415a33cd6ff86a8684b47b565c30bb08243e29d1281f9558f9fbe671", + "blockHash": "0x2b589c0b99bc413e75eea1cc751cfb8ca5056e83a311ca33fcba82035ec01c3f", + "transactionHash": "0x3688ab69ffcfd7a8a13c64e8e834bacf9ac9aba9c4e729997799ee3f7fc35848", "logs": [], - "blockNumber": 30251469, - "cumulativeGasUsed": "1179791", + "blockNumber": 30475930, + "cumulativeGasUsed": "1150006", "status": 1, "byzantium": true }, @@ -271,12 +245,12 @@ "0x22F24361D548e5FaAfb36d1437839f080363982B" ], "numDeployments": 1, - "solcInputHash": "d3cc7d49c45bf725b6aea61557b961e9", - "metadata": "{\"compiler\":{\"version\":\"0.8.11+commit.d7f03943\"},\"language\":\"Solidity\",\"output\":{\"abi\":[{\"inputs\":[{\"internalType\":\"contract WETH9\",\"name\":\"_l1Weth\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"_crossDomainMessenger\",\"type\":\"address\"},{\"internalType\":\"contract IL1StandardBridge\",\"name\":\"_l1StandardBridge\",\"type\":\"address\"}],\"stateMutability\":\"nonpayable\",\"type\":\"constructor\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"address\",\"name\":\"newHubPool\",\"type\":\"address\"}],\"name\":\"HubPoolChanged\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"uint32\",\"name\":\"newGasLimit\",\"type\":\"uint32\"}],\"name\":\"L2GasLimitSet\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"address\",\"name\":\"target\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"bytes\",\"name\":\"message\",\"type\":\"bytes\"}],\"name\":\"MessageRelayed\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"address\",\"name\":\"l1Token\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"address\",\"name\":\"l2Token\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"address\",\"name\":\"to\",\"type\":\"address\"}],\"name\":\"TokensRelayed\",\"type\":\"event\"},{\"inputs\":[],\"name\":\"dai\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"daiOptimismBridge\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"l1StandardBridge\",\"outputs\":[{\"internalType\":\"contract IL1StandardBridge\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"l1Weth\",\"outputs\":[{\"internalType\":\"contract WETH9\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"l2GasLimit\",\"outputs\":[{\"internalType\":\"uint32\",\"name\":\"\",\"type\":\"uint32\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"messenger\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"target\",\"type\":\"address\"},{\"internalType\":\"bytes\",\"name\":\"message\",\"type\":\"bytes\"}],\"name\":\"relayMessage\",\"outputs\":[],\"stateMutability\":\"payable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"l1Token\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"l2Token\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"},{\"internalType\":\"address\",\"name\":\"to\",\"type\":\"address\"}],\"name\":\"relayTokens\",\"outputs\":[],\"stateMutability\":\"payable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"snx\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"snxOptimismBridge\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"}],\"devdoc\":{\"details\":\"Public functions calling external contracts do not guard against reentrancy because they are expected to be called via delegatecall, which will execute this contract's logic within the context of the originating contract. For example, the HubPool will delegatecall these functions, therefore its only neccessary that the HubPool's methods that call this contract's logic guard against reentrancy.\",\"kind\":\"dev\",\"methods\":{\"constructor\":{\"params\":{\"_crossDomainMessenger\":\"XDomainMessenger Optimism system contract.\",\"_l1StandardBridge\":\"Standard bridge contract.\",\"_l1Weth\":\"WETH address on L1.\"}},\"relayMessage(address,bytes)\":{\"params\":{\"message\":\"Data to send to target.\",\"target\":\"Contract on Optimism that will receive message.\"}},\"relayTokens(address,address,uint256,address)\":{\"params\":{\"amount\":\"Amount of L1 tokens to deposit and L2 tokens to receive.\",\"l1Token\":\"L1 token to deposit.\",\"l2Token\":\"L2 token to receive.\",\"to\":\"Bridge recipient.\"}}},\"version\":1},\"userdoc\":{\"kind\":\"user\",\"methods\":{\"constructor\":{\"notice\":\"Constructs new Adapter.\"},\"relayMessage(address,bytes)\":{\"notice\":\"Send cross-chain message to target on Optimism.\"},\"relayTokens(address,address,uint256,address)\":{\"notice\":\"Bridge tokens to Optimism.\"}},\"notice\":\"Contract containing logic to send messages from L1 to Optimism.\",\"version\":1}},\"settings\":{\"compilationTarget\":{\"contracts/chain-adapters/Optimism_Adapter.sol\":\"Optimism_Adapter\"},\"evmVersion\":\"london\",\"libraries\":{},\"metadata\":{\"bytecodeHash\":\"ipfs\",\"useLiteralContent\":true},\"optimizer\":{\"enabled\":true,\"runs\":1000000},\"remappings\":[]},\"sources\":{\"@eth-optimism/contracts/L1/messaging/IL1ERC20Bridge.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >0.5.0 <0.9.0;\\n\\n/**\\n * @title IL1ERC20Bridge\\n */\\ninterface IL1ERC20Bridge {\\n /**********\\n * Events *\\n **********/\\n\\n event ERC20DepositInitiated(\\n address indexed _l1Token,\\n address indexed _l2Token,\\n address indexed _from,\\n address _to,\\n uint256 _amount,\\n bytes _data\\n );\\n\\n event ERC20WithdrawalFinalized(\\n address indexed _l1Token,\\n address indexed _l2Token,\\n address indexed _from,\\n address _to,\\n uint256 _amount,\\n bytes _data\\n );\\n\\n /********************\\n * Public Functions *\\n ********************/\\n\\n /**\\n * @dev get the address of the corresponding L2 bridge contract.\\n * @return Address of the corresponding L2 bridge contract.\\n */\\n function l2TokenBridge() external returns (address);\\n\\n /**\\n * @dev deposit an amount of the ERC20 to the caller's balance on L2.\\n * @param _l1Token Address of the L1 ERC20 we are depositing\\n * @param _l2Token Address of the L1 respective L2 ERC20\\n * @param _amount Amount of the ERC20 to deposit\\n * @param _l2Gas Gas limit required to complete the deposit on L2.\\n * @param _data Optional data to forward to L2. This data is provided\\n * solely as a convenience for external contracts. Aside from enforcing a maximum\\n * length, these contracts provide no guarantees about its content.\\n */\\n function depositERC20(\\n address _l1Token,\\n address _l2Token,\\n uint256 _amount,\\n uint32 _l2Gas,\\n bytes calldata _data\\n ) external;\\n\\n /**\\n * @dev deposit an amount of ERC20 to a recipient's balance on L2.\\n * @param _l1Token Address of the L1 ERC20 we are depositing\\n * @param _l2Token Address of the L1 respective L2 ERC20\\n * @param _to L2 address to credit the withdrawal to.\\n * @param _amount Amount of the ERC20 to deposit.\\n * @param _l2Gas Gas limit required to complete the deposit on L2.\\n * @param _data Optional data to forward to L2. This data is provided\\n * solely as a convenience for external contracts. Aside from enforcing a maximum\\n * length, these contracts provide no guarantees about its content.\\n */\\n function depositERC20To(\\n address _l1Token,\\n address _l2Token,\\n address _to,\\n uint256 _amount,\\n uint32 _l2Gas,\\n bytes calldata _data\\n ) external;\\n\\n /*************************\\n * Cross-chain Functions *\\n *************************/\\n\\n /**\\n * @dev Complete a withdrawal from L2 to L1, and credit funds to the recipient's balance of the\\n * L1 ERC20 token.\\n * This call will fail if the initialized withdrawal from L2 has not been finalized.\\n *\\n * @param _l1Token Address of L1 token to finalizeWithdrawal for.\\n * @param _l2Token Address of L2 token where withdrawal was initiated.\\n * @param _from L2 address initiating the transfer.\\n * @param _to L1 address to credit the withdrawal to.\\n * @param _amount Amount of the ERC20 to deposit.\\n * @param _data Data provided by the sender on L2. This data is provided\\n * solely as a convenience for external contracts. Aside from enforcing a maximum\\n * length, these contracts provide no guarantees about its content.\\n */\\n function finalizeERC20Withdrawal(\\n address _l1Token,\\n address _l2Token,\\n address _from,\\n address _to,\\n uint256 _amount,\\n bytes calldata _data\\n ) external;\\n}\\n\",\"keccak256\":\"0x69f831896dcbb6bef4f2d6c8be6cd1bf352f5910074d3ce973b9f8e0a4f4c1dd\",\"license\":\"MIT\"},\"@eth-optimism/contracts/L1/messaging/IL1StandardBridge.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >0.5.0 <0.9.0;\\n\\nimport \\\"./IL1ERC20Bridge.sol\\\";\\n\\n/**\\n * @title IL1StandardBridge\\n */\\ninterface IL1StandardBridge is IL1ERC20Bridge {\\n /**********\\n * Events *\\n **********/\\n event ETHDepositInitiated(\\n address indexed _from,\\n address indexed _to,\\n uint256 _amount,\\n bytes _data\\n );\\n\\n event ETHWithdrawalFinalized(\\n address indexed _from,\\n address indexed _to,\\n uint256 _amount,\\n bytes _data\\n );\\n\\n /********************\\n * Public Functions *\\n ********************/\\n\\n /**\\n * @dev Deposit an amount of the ETH to the caller's balance on L2.\\n * @param _l2Gas Gas limit required to complete the deposit on L2.\\n * @param _data Optional data to forward to L2. This data is provided\\n * solely as a convenience for external contracts. Aside from enforcing a maximum\\n * length, these contracts provide no guarantees about its content.\\n */\\n function depositETH(uint32 _l2Gas, bytes calldata _data) external payable;\\n\\n /**\\n * @dev Deposit an amount of ETH to a recipient's balance on L2.\\n * @param _to L2 address to credit the withdrawal to.\\n * @param _l2Gas Gas limit required to complete the deposit on L2.\\n * @param _data Optional data to forward to L2. This data is provided\\n * solely as a convenience for external contracts. Aside from enforcing a maximum\\n * length, these contracts provide no guarantees about its content.\\n */\\n function depositETHTo(\\n address _to,\\n uint32 _l2Gas,\\n bytes calldata _data\\n ) external payable;\\n\\n /*************************\\n * Cross-chain Functions *\\n *************************/\\n\\n /**\\n * @dev Complete a withdrawal from L2 to L1, and credit funds to the recipient's balance of the\\n * L1 ETH token. Since only the xDomainMessenger can call this function, it will never be called\\n * before the withdrawal is finalized.\\n * @param _from L2 address initiating the transfer.\\n * @param _to L1 address to credit the withdrawal to.\\n * @param _amount Amount of the ERC20 to deposit.\\n * @param _data Optional data to forward to L2. This data is provided\\n * solely as a convenience for external contracts. Aside from enforcing a maximum\\n * length, these contracts provide no guarantees about its content.\\n */\\n function finalizeETHWithdrawal(\\n address _from,\\n address _to,\\n uint256 _amount,\\n bytes calldata _data\\n ) external;\\n}\\n\",\"keccak256\":\"0x3d511f1bcea86aa88a9c41798926ea75b5b3f455c0377e63223a123a9e714ddc\",\"license\":\"MIT\"},\"@eth-optimism/contracts/libraries/bridge/ICrossDomainMessenger.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >0.5.0 <0.9.0;\\n\\n/**\\n * @title ICrossDomainMessenger\\n */\\ninterface ICrossDomainMessenger {\\n /**********\\n * Events *\\n **********/\\n\\n event SentMessage(\\n address indexed target,\\n address sender,\\n bytes message,\\n uint256 messageNonce,\\n uint256 gasLimit\\n );\\n event RelayedMessage(bytes32 indexed msgHash);\\n event FailedRelayedMessage(bytes32 indexed msgHash);\\n\\n /*************\\n * Variables *\\n *************/\\n\\n function xDomainMessageSender() external view returns (address);\\n\\n /********************\\n * Public Functions *\\n ********************/\\n\\n /**\\n * Sends a cross domain message to the target messenger.\\n * @param _target Target contract address.\\n * @param _message Message to send to the target.\\n * @param _gasLimit Gas limit for the provided message.\\n */\\n function sendMessage(\\n address _target,\\n bytes calldata _message,\\n uint32 _gasLimit\\n ) external;\\n}\\n\",\"keccak256\":\"0x8f29ae23021345a20ccac7b5edb3fc38268aef943b65adc8a32e74b80bf1833a\",\"license\":\"MIT\"},\"@openzeppelin/contracts/token/ERC20/IERC20.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.5.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 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(\\n address from,\\n address to,\\n uint256 amount\\n ) external returns (bool);\\n\\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\",\"keccak256\":\"0xbbc8ac883ac3c0078ce5ad3e288fbb3ffcc8a30c3a98c0fda0114d64fc44fca2\",\"license\":\"MIT\"},\"@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts v4.4.1 (token/ERC20/utils/SafeERC20.sol)\\n\\npragma solidity ^0.8.0;\\n\\nimport \\\"../IERC20.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 function safeTransfer(\\n IERC20 token,\\n address to,\\n uint256 value\\n ) internal {\\n _callOptionalReturn(token, abi.encodeWithSelector(token.transfer.selector, to, value));\\n }\\n\\n function safeTransferFrom(\\n IERC20 token,\\n address from,\\n address to,\\n uint256 value\\n ) 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(\\n IERC20 token,\\n address spender,\\n uint256 value\\n ) 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 function safeIncreaseAllowance(\\n IERC20 token,\\n address spender,\\n uint256 value\\n ) internal {\\n uint256 newAllowance = token.allowance(address(this), spender) + value;\\n _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, newAllowance));\\n }\\n\\n function safeDecreaseAllowance(\\n IERC20 token,\\n address spender,\\n uint256 value\\n ) internal {\\n unchecked {\\n uint256 oldAllowance = token.allowance(address(this), spender);\\n require(oldAllowance >= value, \\\"SafeERC20: decreased allowance below zero\\\");\\n uint256 newAllowance = oldAllowance - value;\\n _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, newAllowance));\\n }\\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 if (returndata.length > 0) {\\n // Return data is optional\\n require(abi.decode(returndata, (bool)), \\\"SafeERC20: ERC20 operation did not succeed\\\");\\n }\\n }\\n}\\n\",\"keccak256\":\"0xc3d946432c0ddbb1f846a0d3985be71299df331b91d06732152117f62f0be2b5\",\"license\":\"MIT\"},\"@openzeppelin/contracts/utils/Address.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.5.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 *\\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://diligence.consensys.net/posts/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.5.11/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 functionCall(target, data, \\\"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(\\n address target,\\n bytes memory data,\\n uint256 value\\n ) 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 require(isContract(target), \\\"Address: call to non-contract\\\");\\n\\n (bool success, bytes memory returndata) = target.call{value: value}(data);\\n return verifyCallResult(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 require(isContract(target), \\\"Address: static call to non-contract\\\");\\n\\n (bool success, bytes memory returndata) = target.staticcall(data);\\n return verifyCallResult(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 require(isContract(target), \\\"Address: delegate call to non-contract\\\");\\n\\n (bool success, bytes memory returndata) = target.delegatecall(data);\\n return verifyCallResult(success, returndata, errorMessage);\\n }\\n\\n /**\\n * @dev Tool to verifies that a low level call was successful, and revert if it wasn't, either by bubbling the\\n * revert reason 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 // 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\\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}\\n\",\"keccak256\":\"0x2ccf9d2313a313d41a791505f2b5abfdc62191b5d4334f7f7a82691c088a1c87\",\"license\":\"MIT\"},\"contracts/chain-adapters/CrossDomainEnabled.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >0.5.0 <0.9.0;\\n\\n/* Interface Imports */\\nimport { ICrossDomainMessenger } from \\\"@eth-optimism/contracts/libraries/bridge/ICrossDomainMessenger.sol\\\";\\n\\n/**\\n * @title CrossDomainEnabled\\n * @dev Helper contract for contracts performing cross-domain communications between L1 and Optimism.\\n * @dev This modifies the eth-optimism/CrossDomainEnabled contract only by changing state variables to be\\n * immutable for use in contracts like the Optimism_Adapter which use delegateCall().\\n */\\ncontract CrossDomainEnabled {\\n // Messenger contract used to send and recieve messages from the other domain.\\n address public immutable messenger;\\n\\n /**\\n * @param _messenger Address of the CrossDomainMessenger on the current layer.\\n */\\n constructor(address _messenger) {\\n messenger = _messenger;\\n }\\n\\n /**\\n * Enforces that the modified function is only callable by a specific cross-domain account.\\n * @param _sourceDomainAccount The only account on the originating domain which is\\n * authenticated to call this function.\\n */\\n modifier onlyFromCrossDomainAccount(address _sourceDomainAccount) {\\n require(msg.sender == address(getCrossDomainMessenger()), \\\"OVM_XCHAIN: messenger contract unauthenticated\\\");\\n\\n require(\\n getCrossDomainMessenger().xDomainMessageSender() == _sourceDomainAccount,\\n \\\"OVM_XCHAIN: wrong sender of cross-domain message\\\"\\n );\\n\\n _;\\n }\\n\\n /**\\n * Gets the messenger, usually from storage. This function is exposed in case a child contract\\n * needs to override.\\n * @return The address of the cross-domain messenger contract which should be used.\\n */\\n function getCrossDomainMessenger() internal virtual returns (ICrossDomainMessenger) {\\n return ICrossDomainMessenger(messenger);\\n }\\n\\n /**\\n * Sends a message to an account on another domain\\n * @param _crossDomainTarget The intended recipient on the destination domain\\n * @param _message The data to send to the target (usually calldata to a function with\\n * onlyFromCrossDomainAccount())\\n * @param _gasLimit The gasLimit for the receipt of the message on the target domain.\\n */\\n function sendCrossDomainMessage(\\n address _crossDomainTarget,\\n uint32 _gasLimit,\\n bytes memory _message\\n ) internal {\\n // slither-disable-next-line reentrancy-events, reentrancy-benign\\n getCrossDomainMessenger().sendMessage(_crossDomainTarget, _message, _gasLimit);\\n }\\n}\\n\",\"keccak256\":\"0xb9a90934f8e09dd581cb65fa9d2f7904bfcb0dfe86f45a8b31d0b3037a1facd3\",\"license\":\"MIT\"},\"contracts/chain-adapters/Optimism_Adapter.sol\":{\"content\":\"// SPDX-License-Identifier: AGPL-3.0-only\\npragma solidity ^0.8.0;\\n\\nimport \\\"../interfaces/AdapterInterface.sol\\\";\\nimport \\\"../interfaces/WETH9.sol\\\";\\n\\n// @dev Use local modified CrossDomainEnabled contract instead of one exported by eth-optimism because we need\\n// this contract's state variables to be `immutable` because of the delegateCall call.\\nimport \\\"./CrossDomainEnabled.sol\\\";\\nimport \\\"@eth-optimism/contracts/L1/messaging/IL1StandardBridge.sol\\\";\\n\\nimport \\\"@openzeppelin/contracts/token/ERC20/IERC20.sol\\\";\\nimport \\\"@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol\\\";\\n\\n/**\\n * @notice Contract containing logic to send messages from L1 to Optimism.\\n * @dev Public functions calling external contracts do not guard against reentrancy because they are expected to be\\n * called via delegatecall, which will execute this contract's logic within the context of the originating contract.\\n * For example, the HubPool will delegatecall these functions, therefore its only neccessary that the HubPool's methods\\n * that call this contract's logic guard against reentrancy.\\n */\\ncontract Optimism_Adapter is CrossDomainEnabled, AdapterInterface {\\n using SafeERC20 for IERC20;\\n uint32 public immutable l2GasLimit = 5_000_000;\\n\\n WETH9 public immutable l1Weth;\\n\\n IL1StandardBridge public immutable l1StandardBridge;\\n\\n // Optimism has the ability to support \\\"custom\\\" bridges. These bridges are not supported by the canonical bridge\\n // and so we need to store the address of the custom token and the associated bridge. In the event we want to\\n // support a new token that is not supported by Optimism, we can add a new custom bridge for it and re-deploy the\\n // adapter. A full list of custom optimism tokens and their associated bridges can be found here:\\n // https://github.com/ethereum-optimism/ethereum-optimism.github.io/blob/master/optimism.tokenlist.json\\n address public immutable dai = 0x6B175474E89094C44Da98b954EedeAC495271d0F;\\n address public immutable daiOptimismBridge = 0x10E6593CDda8c58a1d0f14C5164B376352a55f2F;\\n address public immutable snx = 0xC011a73ee8576Fb46F5E1c5751cA3B9Fe0af2a6F;\\n address public immutable snxOptimismBridge = 0xCd9D4988C0AE61887B075bA77f08cbFAd2b65068;\\n\\n event L2GasLimitSet(uint32 newGasLimit);\\n\\n /**\\n * @notice Constructs new Adapter.\\n * @param _l1Weth WETH address on L1.\\n * @param _crossDomainMessenger XDomainMessenger Optimism system contract.\\n * @param _l1StandardBridge Standard bridge contract.\\n */\\n constructor(\\n WETH9 _l1Weth,\\n address _crossDomainMessenger,\\n IL1StandardBridge _l1StandardBridge\\n ) CrossDomainEnabled(_crossDomainMessenger) {\\n l1Weth = _l1Weth;\\n l1StandardBridge = _l1StandardBridge;\\n }\\n\\n /**\\n * @notice Send cross-chain message to target on Optimism.\\n * @param target Contract on Optimism that will receive message.\\n * @param message Data to send to target.\\n */\\n function relayMessage(address target, bytes memory message) external payable override {\\n sendCrossDomainMessage(target, uint32(l2GasLimit), message);\\n emit MessageRelayed(target, message);\\n }\\n\\n /**\\n * @notice Bridge tokens to Optimism.\\n * @param l1Token L1 token to deposit.\\n * @param l2Token L2 token to receive.\\n * @param amount Amount of L1 tokens to deposit and L2 tokens to receive.\\n * @param to Bridge recipient.\\n */\\n function relayTokens(\\n address l1Token,\\n address l2Token,\\n uint256 amount,\\n address to\\n ) external payable override {\\n // If the l1Token is weth then unwrap it to ETH then send the ETH to the standard bridge.\\n if (l1Token == address(l1Weth)) {\\n l1Weth.withdraw(amount);\\n l1StandardBridge.depositETHTo{ value: amount }(to, l2GasLimit, \\\"\\\");\\n } else {\\n IL1StandardBridge _l1StandardBridge = l1StandardBridge;\\n\\n // Check if the L1 token requires a custom bridge. If so, use that bridge over the standard bridge.\\n if (l1Token == dai) _l1StandardBridge = IL1StandardBridge(daiOptimismBridge); // 1. DAI\\n if (l1Token == snx) _l1StandardBridge = IL1StandardBridge(snxOptimismBridge); // 2. SNX\\n\\n IERC20(l1Token).safeIncreaseAllowance(address(_l1StandardBridge), amount);\\n _l1StandardBridge.depositERC20To(l1Token, l2Token, to, amount, l2GasLimit, \\\"\\\");\\n }\\n emit TokensRelayed(l1Token, l2Token, amount, to);\\n }\\n}\\n\",\"keccak256\":\"0xd70cb8c741f6841d034285ac4b505fd4de40e197cf6daaffb1f5d25d13ea32e2\",\"license\":\"AGPL-3.0-only\"},\"contracts/interfaces/AdapterInterface.sol\":{\"content\":\"// SPDX-License-Identifier: AGPL-3.0-only\\npragma solidity ^0.8.0;\\n\\n/**\\n * @notice Sends cross chain messages and tokens to contracts on a specific L2 network.\\n */\\n\\ninterface AdapterInterface {\\n event HubPoolChanged(address newHubPool);\\n\\n event MessageRelayed(address target, bytes message);\\n\\n event TokensRelayed(address l1Token, address l2Token, uint256 amount, address to);\\n\\n function relayMessage(address target, bytes memory message) external payable;\\n\\n function relayTokens(\\n address l1Token,\\n address l2Token,\\n uint256 amount,\\n address to\\n ) external payable;\\n}\\n\",\"keccak256\":\"0x60e1ed2205f90655fe4152a90709be15bc9550fb3faeaf9835fee22c095bab11\",\"license\":\"AGPL-3.0-only\"},\"contracts/interfaces/WETH9.sol\":{\"content\":\"// SPDX-License-Identifier: GPL-3.0-only\\npragma solidity ^0.8.0;\\n\\ninterface WETH9 {\\n function withdraw(uint256 wad) external;\\n\\n function deposit() external payable;\\n\\n function balanceOf(address guy) external view returns (uint256 wad);\\n\\n function transfer(address guy, uint256 wad) external;\\n}\\n\",\"keccak256\":\"0x7b444d0840b1f76eee9bf39d74830f70644395613b96cce2d80fc50785a82eaa\",\"license\":\"GPL-3.0-only\"}},\"version\":1}", - "bytecode": "0x610180604052624c4b4060a052736b175474e89094c44da98b954eedeac495271d0f610100527310e6593cdda8c58a1d0f14c5164b376352a55f2f6101205273c011a73ee8576fb46f5e1c5751ca3b9fe0af2a6f6101405273cd9d4988c0ae61887b075ba77f08cbfad2b650686101605234801561007c57600080fd5b5060405161118b38038061118b83398101604081905261009b916100d0565b6001600160a01b0391821660805291811660c0521660e05261011d565b6001600160a01b03811681146100cd57600080fd5b50565b6000806000606084860312156100e557600080fd5b83516100f0816100b8565b6020850151909350610101816100b8565b6040850151909250610112816100b8565b809150509250925092565b60805160a05160c05160e05161010051610120516101405161016051610fb66101d56000396000818161015a015261058601526000818161026701526105310152600081816101d7015261050f01526000818161029b01526104ba01526000818160c80152818161042e0152610497015260008181610126015281816102bf015261034001526000818161020b015281816103f901528181610628015261070601526000818161018e01526108e00152610fb66000f3fe6080604052600436106100b15760003560e01c8063b708886d11610069578063e6eb8ade1161004e578063e6eb8ade14610242578063e7d2799814610255578063f4b9fa751461028957600080fd5b8063b708886d146101c5578063cf6e65b7146101f957600080fd5b806328f7c66b1161009a57806328f7c66b146101485780633cb747bf1461017c57806352c8c75c146101b057600080fd5b8063078f29cf146100b6578063146bf4b114610114575b600080fd5b3480156100c257600080fd5b506100ea7f000000000000000000000000000000000000000000000000000000000000000081565b60405173ffffffffffffffffffffffffffffffffffffffff90911681526020015b60405180910390f35b34801561012057600080fd5b506100ea7f000000000000000000000000000000000000000000000000000000000000000081565b34801561015457600080fd5b506100ea7f000000000000000000000000000000000000000000000000000000000000000081565b34801561018857600080fd5b506100ea7f000000000000000000000000000000000000000000000000000000000000000081565b6101c36101be366004610c91565b6102bd565b005b3480156101d157600080fd5b506100ea7f000000000000000000000000000000000000000000000000000000000000000081565b34801561020557600080fd5b5061022d7f000000000000000000000000000000000000000000000000000000000000000081565b60405163ffffffff909116815260200161010b565b6101c3610250366004610d0d565b610700565b34801561026157600080fd5b506100ea7f000000000000000000000000000000000000000000000000000000000000000081565b34801561029557600080fd5b506100ea7f000000000000000000000000000000000000000000000000000000000000000081565b7f000000000000000000000000000000000000000000000000000000000000000073ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff161415610493576040517f2e1a7d4d000000000000000000000000000000000000000000000000000000008152600481018390527f000000000000000000000000000000000000000000000000000000000000000073ffffffffffffffffffffffffffffffffffffffff1690632e1a7d4d90602401600060405180830381600087803b15801561039957600080fd5b505af11580156103ad573d6000803e3d6000fd5b50506040517f9a2ac6d500000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff848116600483015263ffffffff7f000000000000000000000000000000000000000000000000000000000000000016602483015260606044830152600060648301527f0000000000000000000000000000000000000000000000000000000000000000169250639a2ac6d5915084906084016000604051808303818588803b15801561047557600080fd5b505af1158015610489573d6000803e3d6000fd5b505050505061069b565b60007f000000000000000000000000000000000000000000000000000000000000000090507f000000000000000000000000000000000000000000000000000000000000000073ffffffffffffffffffffffffffffffffffffffff168573ffffffffffffffffffffffffffffffffffffffff16141561052f57507f00000000000000000000000000000000000000000000000000000000000000005b7f000000000000000000000000000000000000000000000000000000000000000073ffffffffffffffffffffffffffffffffffffffff168573ffffffffffffffffffffffffffffffffffffffff1614156105a657507f00000000000000000000000000000000000000000000000000000000000000005b6105c773ffffffffffffffffffffffffffffffffffffffff86168285610768565b6040517f838b252000000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff8681166004830152858116602483015283811660448301526064820185905263ffffffff7f000000000000000000000000000000000000000000000000000000000000000016608483015260c060a4830152600060c483015282169063838b25209060e401600060405180830381600087803b15801561068157600080fd5b505af1158015610695573d6000803e3d6000fd5b50505050505b6040805173ffffffffffffffffffffffffffffffffffffffff868116825285811660208301528183018590528316606082015290517fd7e09655439c3932e55857df3220186e5a7f0980825f20691c2b35d941dee75b9181900360800190a150505050565b61072b827f0000000000000000000000000000000000000000000000000000000000000000836108a3565b7f9e6c52944e331ba6270e7fe4cea2a4086bae8f7a27e1cdba07f416806f5d0ac4828260405161075c929190610e63565b60405180910390a15050565b6040517fdd62ed3e00000000000000000000000000000000000000000000000000000000815230600482015273ffffffffffffffffffffffffffffffffffffffff8381166024830152600091839186169063dd62ed3e90604401602060405180830381865afa1580156107df573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906108039190610e92565b61080d9190610eab565b6040805173ffffffffffffffffffffffffffffffffffffffff8616602482015260448082018490528251808303909101815260649091019091526020810180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff167f095ea7b30000000000000000000000000000000000000000000000000000000017905290915061089d908590610950565b50505050565b6040517f3dbb202b00000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff7f00000000000000000000000000000000000000000000000000000000000000001690633dbb202b9061091990869085908790600401610eea565b600060405180830381600087803b15801561093357600080fd5b505af1158015610947573d6000803e3d6000fd5b50505050505050565b60006109b2826040518060400160405280602081526020017f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c65648152508573ffffffffffffffffffffffffffffffffffffffff16610a669092919063ffffffff16565b805190915015610a6157808060200190518101906109d09190610f2f565b610a61576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602a60248201527f5361666545524332303a204552433230206f7065726174696f6e20646964206e60448201527f6f7420737563636565640000000000000000000000000000000000000000000060648201526084015b60405180910390fd5b505050565b6060610a758484600085610a7f565b90505b9392505050565b606082471015610b11576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602660248201527f416464726573733a20696e73756666696369656e742062616c616e636520666f60448201527f722063616c6c00000000000000000000000000000000000000000000000000006064820152608401610a58565b73ffffffffffffffffffffffffffffffffffffffff85163b610b8f576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e74726163740000006044820152606401610a58565b6000808673ffffffffffffffffffffffffffffffffffffffff168587604051610bb89190610f51565b60006040518083038185875af1925050503d8060008114610bf5576040519150601f19603f3d011682016040523d82523d6000602084013e610bfa565b606091505b5091509150610c0a828286610c15565b979650505050505050565b60608315610c24575081610a78565b825115610c345782518084602001fd5b816040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610a589190610f6d565b803573ffffffffffffffffffffffffffffffffffffffff81168114610c8c57600080fd5b919050565b60008060008060808587031215610ca757600080fd5b610cb085610c68565b9350610cbe60208601610c68565b925060408501359150610cd360608601610c68565b905092959194509250565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b60008060408385031215610d2057600080fd5b610d2983610c68565b9150602083013567ffffffffffffffff80821115610d4657600080fd5b818501915085601f830112610d5a57600080fd5b813581811115610d6c57610d6c610cde565b604051601f82017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0908116603f01168101908382118183101715610db257610db2610cde565b81604052828152886020848701011115610dcb57600080fd5b8260208601602083013760006020848301015280955050505050509250929050565b60005b83811015610e08578181015183820152602001610df0565b8381111561089d5750506000910152565b60008151808452610e31816020860160208601610ded565b601f017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0169290920160200192915050565b73ffffffffffffffffffffffffffffffffffffffff83168152604060208201526000610a756040830184610e19565b600060208284031215610ea457600080fd5b5051919050565b60008219821115610ee5577f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b500190565b73ffffffffffffffffffffffffffffffffffffffff84168152606060208201526000610f196060830185610e19565b905063ffffffff83166040830152949350505050565b600060208284031215610f4157600080fd5b81518015158114610a7857600080fd5b60008251610f63818460208701610ded565b9190910192915050565b602081526000610a786020830184610e1956fea264697066735822122022ec079012127a99c6feaf39bc9e88dcc0426b6e25883c873feaf8417ded97ab64736f6c634300080b0033", - "deployedBytecode": "0x6080604052600436106100b15760003560e01c8063b708886d11610069578063e6eb8ade1161004e578063e6eb8ade14610242578063e7d2799814610255578063f4b9fa751461028957600080fd5b8063b708886d146101c5578063cf6e65b7146101f957600080fd5b806328f7c66b1161009a57806328f7c66b146101485780633cb747bf1461017c57806352c8c75c146101b057600080fd5b8063078f29cf146100b6578063146bf4b114610114575b600080fd5b3480156100c257600080fd5b506100ea7f000000000000000000000000000000000000000000000000000000000000000081565b60405173ffffffffffffffffffffffffffffffffffffffff90911681526020015b60405180910390f35b34801561012057600080fd5b506100ea7f000000000000000000000000000000000000000000000000000000000000000081565b34801561015457600080fd5b506100ea7f000000000000000000000000000000000000000000000000000000000000000081565b34801561018857600080fd5b506100ea7f000000000000000000000000000000000000000000000000000000000000000081565b6101c36101be366004610c91565b6102bd565b005b3480156101d157600080fd5b506100ea7f000000000000000000000000000000000000000000000000000000000000000081565b34801561020557600080fd5b5061022d7f000000000000000000000000000000000000000000000000000000000000000081565b60405163ffffffff909116815260200161010b565b6101c3610250366004610d0d565b610700565b34801561026157600080fd5b506100ea7f000000000000000000000000000000000000000000000000000000000000000081565b34801561029557600080fd5b506100ea7f000000000000000000000000000000000000000000000000000000000000000081565b7f000000000000000000000000000000000000000000000000000000000000000073ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff161415610493576040517f2e1a7d4d000000000000000000000000000000000000000000000000000000008152600481018390527f000000000000000000000000000000000000000000000000000000000000000073ffffffffffffffffffffffffffffffffffffffff1690632e1a7d4d90602401600060405180830381600087803b15801561039957600080fd5b505af11580156103ad573d6000803e3d6000fd5b50506040517f9a2ac6d500000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff848116600483015263ffffffff7f000000000000000000000000000000000000000000000000000000000000000016602483015260606044830152600060648301527f0000000000000000000000000000000000000000000000000000000000000000169250639a2ac6d5915084906084016000604051808303818588803b15801561047557600080fd5b505af1158015610489573d6000803e3d6000fd5b505050505061069b565b60007f000000000000000000000000000000000000000000000000000000000000000090507f000000000000000000000000000000000000000000000000000000000000000073ffffffffffffffffffffffffffffffffffffffff168573ffffffffffffffffffffffffffffffffffffffff16141561052f57507f00000000000000000000000000000000000000000000000000000000000000005b7f000000000000000000000000000000000000000000000000000000000000000073ffffffffffffffffffffffffffffffffffffffff168573ffffffffffffffffffffffffffffffffffffffff1614156105a657507f00000000000000000000000000000000000000000000000000000000000000005b6105c773ffffffffffffffffffffffffffffffffffffffff86168285610768565b6040517f838b252000000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff8681166004830152858116602483015283811660448301526064820185905263ffffffff7f000000000000000000000000000000000000000000000000000000000000000016608483015260c060a4830152600060c483015282169063838b25209060e401600060405180830381600087803b15801561068157600080fd5b505af1158015610695573d6000803e3d6000fd5b50505050505b6040805173ffffffffffffffffffffffffffffffffffffffff868116825285811660208301528183018590528316606082015290517fd7e09655439c3932e55857df3220186e5a7f0980825f20691c2b35d941dee75b9181900360800190a150505050565b61072b827f0000000000000000000000000000000000000000000000000000000000000000836108a3565b7f9e6c52944e331ba6270e7fe4cea2a4086bae8f7a27e1cdba07f416806f5d0ac4828260405161075c929190610e63565b60405180910390a15050565b6040517fdd62ed3e00000000000000000000000000000000000000000000000000000000815230600482015273ffffffffffffffffffffffffffffffffffffffff8381166024830152600091839186169063dd62ed3e90604401602060405180830381865afa1580156107df573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906108039190610e92565b61080d9190610eab565b6040805173ffffffffffffffffffffffffffffffffffffffff8616602482015260448082018490528251808303909101815260649091019091526020810180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff167f095ea7b30000000000000000000000000000000000000000000000000000000017905290915061089d908590610950565b50505050565b6040517f3dbb202b00000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff7f00000000000000000000000000000000000000000000000000000000000000001690633dbb202b9061091990869085908790600401610eea565b600060405180830381600087803b15801561093357600080fd5b505af1158015610947573d6000803e3d6000fd5b50505050505050565b60006109b2826040518060400160405280602081526020017f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c65648152508573ffffffffffffffffffffffffffffffffffffffff16610a669092919063ffffffff16565b805190915015610a6157808060200190518101906109d09190610f2f565b610a61576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602a60248201527f5361666545524332303a204552433230206f7065726174696f6e20646964206e60448201527f6f7420737563636565640000000000000000000000000000000000000000000060648201526084015b60405180910390fd5b505050565b6060610a758484600085610a7f565b90505b9392505050565b606082471015610b11576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602660248201527f416464726573733a20696e73756666696369656e742062616c616e636520666f60448201527f722063616c6c00000000000000000000000000000000000000000000000000006064820152608401610a58565b73ffffffffffffffffffffffffffffffffffffffff85163b610b8f576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e74726163740000006044820152606401610a58565b6000808673ffffffffffffffffffffffffffffffffffffffff168587604051610bb89190610f51565b60006040518083038185875af1925050503d8060008114610bf5576040519150601f19603f3d011682016040523d82523d6000602084013e610bfa565b606091505b5091509150610c0a828286610c15565b979650505050505050565b60608315610c24575081610a78565b825115610c345782518084602001fd5b816040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610a589190610f6d565b803573ffffffffffffffffffffffffffffffffffffffff81168114610c8c57600080fd5b919050565b60008060008060808587031215610ca757600080fd5b610cb085610c68565b9350610cbe60208601610c68565b925060408501359150610cd360608601610c68565b905092959194509250565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b60008060408385031215610d2057600080fd5b610d2983610c68565b9150602083013567ffffffffffffffff80821115610d4657600080fd5b818501915085601f830112610d5a57600080fd5b813581811115610d6c57610d6c610cde565b604051601f82017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0908116603f01168101908382118183101715610db257610db2610cde565b81604052828152886020848701011115610dcb57600080fd5b8260208601602083013760006020848301015280955050505050509250929050565b60005b83811015610e08578181015183820152602001610df0565b8381111561089d5750506000910152565b60008151808452610e31816020860160208601610ded565b601f017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0169290920160200192915050565b73ffffffffffffffffffffffffffffffffffffffff83168152604060208201526000610a756040830184610e19565b600060208284031215610ea457600080fd5b5051919050565b60008219821115610ee5577f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b500190565b73ffffffffffffffffffffffffffffffffffffffff84168152606060208201526000610f196060830185610e19565b905063ffffffff83166040830152949350505050565b600060208284031215610f4157600080fd5b81518015158114610a7857600080fd5b60008251610f63818460208701610ded565b9190910192915050565b602081526000610a786020830184610e1956fea264697066735822122022ec079012127a99c6feaf39bc9e88dcc0426b6e25883c873feaf8417ded97ab64736f6c634300080b0033", + "solcInputHash": "c8b9349311d8b5049b613ac98eb998d0", + "metadata": "{\"compiler\":{\"version\":\"0.8.13+commit.abaa5c0e\"},\"language\":\"Solidity\",\"output\":{\"abi\":[{\"inputs\":[{\"internalType\":\"contract WETH9\",\"name\":\"_l1Weth\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"_crossDomainMessenger\",\"type\":\"address\"},{\"internalType\":\"contract IL1StandardBridge\",\"name\":\"_l1StandardBridge\",\"type\":\"address\"}],\"stateMutability\":\"nonpayable\",\"type\":\"constructor\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"address\",\"name\":\"target\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"bytes\",\"name\":\"message\",\"type\":\"bytes\"}],\"name\":\"MessageRelayed\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"address\",\"name\":\"l1Token\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"address\",\"name\":\"l2Token\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"address\",\"name\":\"to\",\"type\":\"address\"}],\"name\":\"TokensRelayed\",\"type\":\"event\"},{\"inputs\":[],\"name\":\"dai\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"daiOptimismBridge\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"l1StandardBridge\",\"outputs\":[{\"internalType\":\"contract IL1StandardBridge\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"l1Weth\",\"outputs\":[{\"internalType\":\"contract WETH9\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"l2GasLimit\",\"outputs\":[{\"internalType\":\"uint32\",\"name\":\"\",\"type\":\"uint32\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"messenger\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"target\",\"type\":\"address\"},{\"internalType\":\"bytes\",\"name\":\"message\",\"type\":\"bytes\"}],\"name\":\"relayMessage\",\"outputs\":[],\"stateMutability\":\"payable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"l1Token\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"l2Token\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"},{\"internalType\":\"address\",\"name\":\"to\",\"type\":\"address\"}],\"name\":\"relayTokens\",\"outputs\":[],\"stateMutability\":\"payable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"snx\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"snxOptimismBridge\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"}],\"devdoc\":{\"details\":\"Public functions calling external contracts do not guard against reentrancy because they are expected to be called via delegatecall, which will execute this contract's logic within the context of the originating contract. For example, the HubPool will delegatecall these functions, therefore its only necessary that the HubPool's methods that call this contract's logic guard against reentrancy.\",\"kind\":\"dev\",\"methods\":{\"constructor\":{\"params\":{\"_crossDomainMessenger\":\"XDomainMessenger Optimism system contract.\",\"_l1StandardBridge\":\"Standard bridge contract.\",\"_l1Weth\":\"WETH address on L1.\"}},\"relayMessage(address,bytes)\":{\"params\":{\"message\":\"Data to send to target.\",\"target\":\"Contract on Optimism that will receive message.\"}},\"relayTokens(address,address,uint256,address)\":{\"params\":{\"amount\":\"Amount of L1 tokens to deposit and L2 tokens to receive.\",\"l1Token\":\"L1 token to deposit.\",\"l2Token\":\"L2 token to receive.\",\"to\":\"Bridge recipient.\"}}},\"version\":1},\"userdoc\":{\"kind\":\"user\",\"methods\":{\"constructor\":{\"notice\":\"Constructs new Adapter.\"},\"relayMessage(address,bytes)\":{\"notice\":\"Send cross-chain message to target on Optimism.\"},\"relayTokens(address,address,uint256,address)\":{\"notice\":\"Bridge tokens to Optimism.\"}},\"notice\":\"Contract containing logic to send messages from L1 to Optimism.\",\"version\":1}},\"settings\":{\"compilationTarget\":{\"contracts/chain-adapters/Optimism_Adapter.sol\":\"Optimism_Adapter\"},\"evmVersion\":\"london\",\"libraries\":{},\"metadata\":{\"bytecodeHash\":\"ipfs\",\"useLiteralContent\":true},\"optimizer\":{\"enabled\":true,\"runs\":1000000},\"remappings\":[]},\"sources\":{\"@eth-optimism/contracts/L1/messaging/IL1ERC20Bridge.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >0.5.0 <0.9.0;\\n\\n/**\\n * @title IL1ERC20Bridge\\n */\\ninterface IL1ERC20Bridge {\\n /**********\\n * Events *\\n **********/\\n\\n event ERC20DepositInitiated(\\n address indexed _l1Token,\\n address indexed _l2Token,\\n address indexed _from,\\n address _to,\\n uint256 _amount,\\n bytes _data\\n );\\n\\n event ERC20WithdrawalFinalized(\\n address indexed _l1Token,\\n address indexed _l2Token,\\n address indexed _from,\\n address _to,\\n uint256 _amount,\\n bytes _data\\n );\\n\\n /********************\\n * Public Functions *\\n ********************/\\n\\n /**\\n * @dev get the address of the corresponding L2 bridge contract.\\n * @return Address of the corresponding L2 bridge contract.\\n */\\n function l2TokenBridge() external returns (address);\\n\\n /**\\n * @dev deposit an amount of the ERC20 to the caller's balance on L2.\\n * @param _l1Token Address of the L1 ERC20 we are depositing\\n * @param _l2Token Address of the L1 respective L2 ERC20\\n * @param _amount Amount of the ERC20 to deposit\\n * @param _l2Gas Gas limit required to complete the deposit on L2.\\n * @param _data Optional data to forward to L2. This data is provided\\n * solely as a convenience for external contracts. Aside from enforcing a maximum\\n * length, these contracts provide no guarantees about its content.\\n */\\n function depositERC20(\\n address _l1Token,\\n address _l2Token,\\n uint256 _amount,\\n uint32 _l2Gas,\\n bytes calldata _data\\n ) external;\\n\\n /**\\n * @dev deposit an amount of ERC20 to a recipient's balance on L2.\\n * @param _l1Token Address of the L1 ERC20 we are depositing\\n * @param _l2Token Address of the L1 respective L2 ERC20\\n * @param _to L2 address to credit the withdrawal to.\\n * @param _amount Amount of the ERC20 to deposit.\\n * @param _l2Gas Gas limit required to complete the deposit on L2.\\n * @param _data Optional data to forward to L2. This data is provided\\n * solely as a convenience for external contracts. Aside from enforcing a maximum\\n * length, these contracts provide no guarantees about its content.\\n */\\n function depositERC20To(\\n address _l1Token,\\n address _l2Token,\\n address _to,\\n uint256 _amount,\\n uint32 _l2Gas,\\n bytes calldata _data\\n ) external;\\n\\n /*************************\\n * Cross-chain Functions *\\n *************************/\\n\\n /**\\n * @dev Complete a withdrawal from L2 to L1, and credit funds to the recipient's balance of the\\n * L1 ERC20 token.\\n * This call will fail if the initialized withdrawal from L2 has not been finalized.\\n *\\n * @param _l1Token Address of L1 token to finalizeWithdrawal for.\\n * @param _l2Token Address of L2 token where withdrawal was initiated.\\n * @param _from L2 address initiating the transfer.\\n * @param _to L1 address to credit the withdrawal to.\\n * @param _amount Amount of the ERC20 to deposit.\\n * @param _data Data provided by the sender on L2. This data is provided\\n * solely as a convenience for external contracts. Aside from enforcing a maximum\\n * length, these contracts provide no guarantees about its content.\\n */\\n function finalizeERC20Withdrawal(\\n address _l1Token,\\n address _l2Token,\\n address _from,\\n address _to,\\n uint256 _amount,\\n bytes calldata _data\\n ) external;\\n}\\n\",\"keccak256\":\"0x69f831896dcbb6bef4f2d6c8be6cd1bf352f5910074d3ce973b9f8e0a4f4c1dd\",\"license\":\"MIT\"},\"@eth-optimism/contracts/L1/messaging/IL1StandardBridge.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >0.5.0 <0.9.0;\\n\\nimport \\\"./IL1ERC20Bridge.sol\\\";\\n\\n/**\\n * @title IL1StandardBridge\\n */\\ninterface IL1StandardBridge is IL1ERC20Bridge {\\n /**********\\n * Events *\\n **********/\\n event ETHDepositInitiated(\\n address indexed _from,\\n address indexed _to,\\n uint256 _amount,\\n bytes _data\\n );\\n\\n event ETHWithdrawalFinalized(\\n address indexed _from,\\n address indexed _to,\\n uint256 _amount,\\n bytes _data\\n );\\n\\n /********************\\n * Public Functions *\\n ********************/\\n\\n /**\\n * @dev Deposit an amount of the ETH to the caller's balance on L2.\\n * @param _l2Gas Gas limit required to complete the deposit on L2.\\n * @param _data Optional data to forward to L2. This data is provided\\n * solely as a convenience for external contracts. Aside from enforcing a maximum\\n * length, these contracts provide no guarantees about its content.\\n */\\n function depositETH(uint32 _l2Gas, bytes calldata _data) external payable;\\n\\n /**\\n * @dev Deposit an amount of ETH to a recipient's balance on L2.\\n * @param _to L2 address to credit the withdrawal to.\\n * @param _l2Gas Gas limit required to complete the deposit on L2.\\n * @param _data Optional data to forward to L2. This data is provided\\n * solely as a convenience for external contracts. Aside from enforcing a maximum\\n * length, these contracts provide no guarantees about its content.\\n */\\n function depositETHTo(\\n address _to,\\n uint32 _l2Gas,\\n bytes calldata _data\\n ) external payable;\\n\\n /*************************\\n * Cross-chain Functions *\\n *************************/\\n\\n /**\\n * @dev Complete a withdrawal from L2 to L1, and credit funds to the recipient's balance of the\\n * L1 ETH token. Since only the xDomainMessenger can call this function, it will never be called\\n * before the withdrawal is finalized.\\n * @param _from L2 address initiating the transfer.\\n * @param _to L1 address to credit the withdrawal to.\\n * @param _amount Amount of the ERC20 to deposit.\\n * @param _data Optional data to forward to L2. This data is provided\\n * solely as a convenience for external contracts. Aside from enforcing a maximum\\n * length, these contracts provide no guarantees about its content.\\n */\\n function finalizeETHWithdrawal(\\n address _from,\\n address _to,\\n uint256 _amount,\\n bytes calldata _data\\n ) external;\\n}\\n\",\"keccak256\":\"0x3d511f1bcea86aa88a9c41798926ea75b5b3f455c0377e63223a123a9e714ddc\",\"license\":\"MIT\"},\"@eth-optimism/contracts/libraries/bridge/ICrossDomainMessenger.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >0.5.0 <0.9.0;\\n\\n/**\\n * @title ICrossDomainMessenger\\n */\\ninterface ICrossDomainMessenger {\\n /**********\\n * Events *\\n **********/\\n\\n event SentMessage(\\n address indexed target,\\n address sender,\\n bytes message,\\n uint256 messageNonce,\\n uint256 gasLimit\\n );\\n event RelayedMessage(bytes32 indexed msgHash);\\n event FailedRelayedMessage(bytes32 indexed msgHash);\\n\\n /*************\\n * Variables *\\n *************/\\n\\n function xDomainMessageSender() external view returns (address);\\n\\n /********************\\n * Public Functions *\\n ********************/\\n\\n /**\\n * Sends a cross domain message to the target messenger.\\n * @param _target Target contract address.\\n * @param _message Message to send to the target.\\n * @param _gasLimit Gas limit for the provided message.\\n */\\n function sendMessage(\\n address _target,\\n bytes calldata _message,\\n uint32 _gasLimit\\n ) external;\\n}\\n\",\"keccak256\":\"0x8f29ae23021345a20ccac7b5edb3fc38268aef943b65adc8a32e74b80bf1833a\",\"license\":\"MIT\"},\"@openzeppelin/contracts/token/ERC20/IERC20.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.5.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 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(\\n address from,\\n address to,\\n uint256 amount\\n ) external returns (bool);\\n\\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\",\"keccak256\":\"0xbbc8ac883ac3c0078ce5ad3e288fbb3ffcc8a30c3a98c0fda0114d64fc44fca2\",\"license\":\"MIT\"},\"@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts v4.4.1 (token/ERC20/utils/SafeERC20.sol)\\n\\npragma solidity ^0.8.0;\\n\\nimport \\\"../IERC20.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 function safeTransfer(\\n IERC20 token,\\n address to,\\n uint256 value\\n ) internal {\\n _callOptionalReturn(token, abi.encodeWithSelector(token.transfer.selector, to, value));\\n }\\n\\n function safeTransferFrom(\\n IERC20 token,\\n address from,\\n address to,\\n uint256 value\\n ) 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(\\n IERC20 token,\\n address spender,\\n uint256 value\\n ) 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 function safeIncreaseAllowance(\\n IERC20 token,\\n address spender,\\n uint256 value\\n ) internal {\\n uint256 newAllowance = token.allowance(address(this), spender) + value;\\n _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, newAllowance));\\n }\\n\\n function safeDecreaseAllowance(\\n IERC20 token,\\n address spender,\\n uint256 value\\n ) internal {\\n unchecked {\\n uint256 oldAllowance = token.allowance(address(this), spender);\\n require(oldAllowance >= value, \\\"SafeERC20: decreased allowance below zero\\\");\\n uint256 newAllowance = oldAllowance - value;\\n _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, newAllowance));\\n }\\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 if (returndata.length > 0) {\\n // Return data is optional\\n require(abi.decode(returndata, (bool)), \\\"SafeERC20: ERC20 operation did not succeed\\\");\\n }\\n }\\n}\\n\",\"keccak256\":\"0xc3d946432c0ddbb1f846a0d3985be71299df331b91d06732152117f62f0be2b5\",\"license\":\"MIT\"},\"@openzeppelin/contracts/utils/Address.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.5.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 *\\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://diligence.consensys.net/posts/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.5.11/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 functionCall(target, data, \\\"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(\\n address target,\\n bytes memory data,\\n uint256 value\\n ) 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 require(isContract(target), \\\"Address: call to non-contract\\\");\\n\\n (bool success, bytes memory returndata) = target.call{value: value}(data);\\n return verifyCallResult(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 require(isContract(target), \\\"Address: static call to non-contract\\\");\\n\\n (bool success, bytes memory returndata) = target.staticcall(data);\\n return verifyCallResult(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 require(isContract(target), \\\"Address: delegate call to non-contract\\\");\\n\\n (bool success, bytes memory returndata) = target.delegatecall(data);\\n return verifyCallResult(success, returndata, errorMessage);\\n }\\n\\n /**\\n * @dev Tool to verifies that a low level call was successful, and revert if it wasn't, either by bubbling the\\n * revert reason 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 // 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\\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}\\n\",\"keccak256\":\"0x2ccf9d2313a313d41a791505f2b5abfdc62191b5d4334f7f7a82691c088a1c87\",\"license\":\"MIT\"},\"contracts/chain-adapters/CrossDomainEnabled.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >0.5.0 <0.9.0;\\n\\n/* Interface Imports */\\nimport { ICrossDomainMessenger } from \\\"@eth-optimism/contracts/libraries/bridge/ICrossDomainMessenger.sol\\\";\\n\\n/**\\n * @title CrossDomainEnabled\\n * @dev Helper contract for contracts performing cross-domain communications between L1 and Optimism.\\n * @dev This modifies the eth-optimism/CrossDomainEnabled contract only by changing state variables to be\\n * immutable for use in contracts like the Optimism_Adapter which use delegateCall().\\n */\\ncontract CrossDomainEnabled {\\n // Messenger contract used to send and recieve messages from the other domain.\\n address public immutable messenger;\\n\\n /**\\n * @param _messenger Address of the CrossDomainMessenger on the current layer.\\n */\\n constructor(address _messenger) {\\n messenger = _messenger;\\n }\\n\\n /**\\n * Enforces that the modified function is only callable by a specific cross-domain account.\\n * @param _sourceDomainAccount The only account on the originating domain which is\\n * authenticated to call this function.\\n */\\n modifier onlyFromCrossDomainAccount(address _sourceDomainAccount) {\\n require(msg.sender == address(getCrossDomainMessenger()), \\\"OVM_XCHAIN: messenger contract unauthenticated\\\");\\n\\n require(\\n getCrossDomainMessenger().xDomainMessageSender() == _sourceDomainAccount,\\n \\\"OVM_XCHAIN: wrong sender of cross-domain message\\\"\\n );\\n\\n _;\\n }\\n\\n /**\\n * Gets the messenger, usually from storage. This function is exposed in case a child contract\\n * needs to override.\\n * @return The address of the cross-domain messenger contract which should be used.\\n */\\n function getCrossDomainMessenger() internal virtual returns (ICrossDomainMessenger) {\\n return ICrossDomainMessenger(messenger);\\n }\\n\\n /**\\n * Sends a message to an account on another domain\\n * @param _crossDomainTarget The intended recipient on the destination domain\\n * @param _message The data to send to the target (usually calldata to a function with\\n * onlyFromCrossDomainAccount())\\n * @param _gasLimit The gasLimit for the receipt of the message on the target domain.\\n */\\n function sendCrossDomainMessage(\\n address _crossDomainTarget,\\n uint32 _gasLimit,\\n bytes memory _message\\n ) internal {\\n // slither-disable-next-line reentrancy-events, reentrancy-benign\\n getCrossDomainMessenger().sendMessage(_crossDomainTarget, _message, _gasLimit);\\n }\\n}\\n\",\"keccak256\":\"0xb9a90934f8e09dd581cb65fa9d2f7904bfcb0dfe86f45a8b31d0b3037a1facd3\",\"license\":\"MIT\"},\"contracts/chain-adapters/Optimism_Adapter.sol\":{\"content\":\"// SPDX-License-Identifier: AGPL-3.0-only\\npragma solidity ^0.8.0;\\n\\nimport \\\"../interfaces/AdapterInterface.sol\\\";\\nimport \\\"../interfaces/WETH9.sol\\\";\\n\\n// @dev Use local modified CrossDomainEnabled contract instead of one exported by eth-optimism because we need\\n// this contract's state variables to be `immutable` because of the delegateCall call.\\nimport \\\"./CrossDomainEnabled.sol\\\";\\nimport \\\"@eth-optimism/contracts/L1/messaging/IL1StandardBridge.sol\\\";\\n\\nimport \\\"@openzeppelin/contracts/token/ERC20/IERC20.sol\\\";\\nimport \\\"@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol\\\";\\n\\n/**\\n * @notice Contract containing logic to send messages from L1 to Optimism.\\n * @dev Public functions calling external contracts do not guard against reentrancy because they are expected to be\\n * called via delegatecall, which will execute this contract's logic within the context of the originating contract.\\n * For example, the HubPool will delegatecall these functions, therefore its only necessary that the HubPool's methods\\n * that call this contract's logic guard against reentrancy.\\n */\\ncontract Optimism_Adapter is CrossDomainEnabled, AdapterInterface {\\n using SafeERC20 for IERC20;\\n uint32 public immutable l2GasLimit = 5_000_000;\\n\\n WETH9 public immutable l1Weth;\\n\\n IL1StandardBridge public immutable l1StandardBridge;\\n\\n // Optimism has the ability to support \\\"custom\\\" bridges. These bridges are not supported by the canonical bridge\\n // and so we need to store the address of the custom token and the associated bridge. In the event we want to\\n // support a new token that is not supported by Optimism, we can add a new custom bridge for it and re-deploy the\\n // adapter. A full list of custom optimism tokens and their associated bridges can be found here:\\n // https://github.com/ethereum-optimism/ethereum-optimism.github.io/blob/master/optimism.tokenlist.json\\n address public immutable dai = 0x6B175474E89094C44Da98b954EedeAC495271d0F;\\n address public immutable daiOptimismBridge = 0x10E6593CDda8c58a1d0f14C5164B376352a55f2F;\\n address public immutable snx = 0xC011a73ee8576Fb46F5E1c5751cA3B9Fe0af2a6F;\\n address public immutable snxOptimismBridge = 0xCd9D4988C0AE61887B075bA77f08cbFAd2b65068;\\n\\n /**\\n * @notice Constructs new Adapter.\\n * @param _l1Weth WETH address on L1.\\n * @param _crossDomainMessenger XDomainMessenger Optimism system contract.\\n * @param _l1StandardBridge Standard bridge contract.\\n */\\n constructor(\\n WETH9 _l1Weth,\\n address _crossDomainMessenger,\\n IL1StandardBridge _l1StandardBridge\\n ) CrossDomainEnabled(_crossDomainMessenger) {\\n l1Weth = _l1Weth;\\n l1StandardBridge = _l1StandardBridge;\\n }\\n\\n /**\\n * @notice Send cross-chain message to target on Optimism.\\n * @param target Contract on Optimism that will receive message.\\n * @param message Data to send to target.\\n */\\n function relayMessage(address target, bytes memory message) external payable override {\\n sendCrossDomainMessage(target, uint32(l2GasLimit), message);\\n emit MessageRelayed(target, message);\\n }\\n\\n /**\\n * @notice Bridge tokens to Optimism.\\n * @param l1Token L1 token to deposit.\\n * @param l2Token L2 token to receive.\\n * @param amount Amount of L1 tokens to deposit and L2 tokens to receive.\\n * @param to Bridge recipient.\\n */\\n function relayTokens(\\n address l1Token,\\n address l2Token,\\n uint256 amount,\\n address to\\n ) external payable override {\\n // If the l1Token is weth then unwrap it to ETH then send the ETH to the standard bridge.\\n if (l1Token == address(l1Weth)) {\\n l1Weth.withdraw(amount);\\n l1StandardBridge.depositETHTo{ value: amount }(to, l2GasLimit, \\\"\\\");\\n } else {\\n IL1StandardBridge _l1StandardBridge = l1StandardBridge;\\n\\n // Check if the L1 token requires a custom bridge. If so, use that bridge over the standard bridge.\\n if (l1Token == dai) _l1StandardBridge = IL1StandardBridge(daiOptimismBridge); // 1. DAI\\n if (l1Token == snx) _l1StandardBridge = IL1StandardBridge(snxOptimismBridge); // 2. SNX\\n\\n IERC20(l1Token).safeIncreaseAllowance(address(_l1StandardBridge), amount);\\n _l1StandardBridge.depositERC20To(l1Token, l2Token, to, amount, l2GasLimit, \\\"\\\");\\n }\\n emit TokensRelayed(l1Token, l2Token, amount, to);\\n }\\n}\\n\",\"keccak256\":\"0x0d38de11bc73db08f7406261d9b64b2985faa06cbd48aa8cc28042efd284e4d9\",\"license\":\"AGPL-3.0-only\"},\"contracts/interfaces/AdapterInterface.sol\":{\"content\":\"// SPDX-License-Identifier: AGPL-3.0-only\\npragma solidity ^0.8.0;\\n\\n/**\\n * @notice Sends cross chain messages and tokens to contracts on a specific L2 network.\\n */\\n\\ninterface AdapterInterface {\\n event MessageRelayed(address target, bytes message);\\n\\n event TokensRelayed(address l1Token, address l2Token, uint256 amount, address to);\\n\\n function relayMessage(address target, bytes memory message) external payable;\\n\\n function relayTokens(\\n address l1Token,\\n address l2Token,\\n uint256 amount,\\n address to\\n ) external payable;\\n}\\n\",\"keccak256\":\"0xbd7091006acbdfe72b21ce985f964f0682a2316d9d3b38967beeb55f4ae5118c\",\"license\":\"AGPL-3.0-only\"},\"contracts/interfaces/WETH9.sol\":{\"content\":\"// SPDX-License-Identifier: GPL-3.0-only\\npragma solidity ^0.8.0;\\n\\ninterface WETH9 {\\n function withdraw(uint256 wad) external;\\n\\n function deposit() external payable;\\n\\n function balanceOf(address guy) external view returns (uint256 wad);\\n\\n function transfer(address guy, uint256 wad) external;\\n}\\n\",\"keccak256\":\"0x7b444d0840b1f76eee9bf39d74830f70644395613b96cce2d80fc50785a82eaa\",\"license\":\"GPL-3.0-only\"}},\"version\":1}", + "bytecode": "0x610180604052624c4b4060a052736b175474e89094c44da98b954eedeac495271d0f610100527310e6593cdda8c58a1d0f14c5164b376352a55f2f6101205273c011a73ee8576fb46f5e1c5751ca3b9fe0af2a6f6101405273cd9d4988c0ae61887b075ba77f08cbfad2b650686101605234801561007c57600080fd5b5060405161117138038061117183398101604081905261009b916100d0565b6001600160a01b0391821660805291811660c0521660e05261011d565b6001600160a01b03811681146100cd57600080fd5b50565b6000806000606084860312156100e557600080fd5b83516100f0816100b8565b6020850151909350610101816100b8565b6040850151909250610112816100b8565b809150509250925092565b60805160a05160c05160e05161010051610120516101405161016051610f9c6101d56000396000818161015a015261056c01526000818161026701526105180152600081816101d701526104f601526000818161029b01526104ca01526000818160c80152818161042d0152610494015260008181610126015281816102bf015261033f01526000818161020b015281816103f80152818161060e01526106ec01526000818161018e01526108c60152610f9c6000f3fe6080604052600436106100b15760003560e01c8063b708886d11610069578063e6eb8ade1161004e578063e6eb8ade14610242578063e7d2799814610255578063f4b9fa751461028957600080fd5b8063b708886d146101c5578063cf6e65b7146101f957600080fd5b806328f7c66b1161009a57806328f7c66b146101485780633cb747bf1461017c57806352c8c75c146101b057600080fd5b8063078f29cf146100b6578063146bf4b114610114575b600080fd5b3480156100c257600080fd5b506100ea7f000000000000000000000000000000000000000000000000000000000000000081565b60405173ffffffffffffffffffffffffffffffffffffffff90911681526020015b60405180910390f35b34801561012057600080fd5b506100ea7f000000000000000000000000000000000000000000000000000000000000000081565b34801561015457600080fd5b506100ea7f000000000000000000000000000000000000000000000000000000000000000081565b34801561018857600080fd5b506100ea7f000000000000000000000000000000000000000000000000000000000000000081565b6101c36101be366004610c77565b6102bd565b005b3480156101d157600080fd5b506100ea7f000000000000000000000000000000000000000000000000000000000000000081565b34801561020557600080fd5b5061022d7f000000000000000000000000000000000000000000000000000000000000000081565b60405163ffffffff909116815260200161010b565b6101c3610250366004610cf3565b6106e6565b34801561026157600080fd5b506100ea7f000000000000000000000000000000000000000000000000000000000000000081565b34801561029557600080fd5b506100ea7f000000000000000000000000000000000000000000000000000000000000000081565b7f000000000000000000000000000000000000000000000000000000000000000073ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff1603610492576040517f2e1a7d4d000000000000000000000000000000000000000000000000000000008152600481018390527f000000000000000000000000000000000000000000000000000000000000000073ffffffffffffffffffffffffffffffffffffffff1690632e1a7d4d90602401600060405180830381600087803b15801561039857600080fd5b505af11580156103ac573d6000803e3d6000fd5b50506040517f9a2ac6d500000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff848116600483015263ffffffff7f000000000000000000000000000000000000000000000000000000000000000016602483015260606044830152600060648301527f0000000000000000000000000000000000000000000000000000000000000000169250639a2ac6d5915084906084016000604051808303818588803b15801561047457600080fd5b505af1158015610488573d6000803e3d6000fd5b5050505050610681565b7f000000000000000000000000000000000000000000000000000000000000000073ffffffffffffffffffffffffffffffffffffffff7f000000000000000000000000000000000000000000000000000000000000000081169086160361051657507f00000000000000000000000000000000000000000000000000000000000000005b7f000000000000000000000000000000000000000000000000000000000000000073ffffffffffffffffffffffffffffffffffffffff168573ffffffffffffffffffffffffffffffffffffffff160361058c57507f00000000000000000000000000000000000000000000000000000000000000005b6105ad73ffffffffffffffffffffffffffffffffffffffff8616828561074e565b6040517f838b252000000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff8681166004830152858116602483015283811660448301526064820185905263ffffffff7f000000000000000000000000000000000000000000000000000000000000000016608483015260c060a4830152600060c483015282169063838b25209060e401600060405180830381600087803b15801561066757600080fd5b505af115801561067b573d6000803e3d6000fd5b50505050505b6040805173ffffffffffffffffffffffffffffffffffffffff868116825285811660208301528183018590528316606082015290517fd7e09655439c3932e55857df3220186e5a7f0980825f20691c2b35d941dee75b9181900360800190a150505050565b610711827f000000000000000000000000000000000000000000000000000000000000000083610889565b7f9e6c52944e331ba6270e7fe4cea2a4086bae8f7a27e1cdba07f416806f5d0ac48282604051610742929190610e49565b60405180910390a15050565b6040517fdd62ed3e00000000000000000000000000000000000000000000000000000000815230600482015273ffffffffffffffffffffffffffffffffffffffff8381166024830152600091839186169063dd62ed3e90604401602060405180830381865afa1580156107c5573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906107e99190610e78565b6107f39190610e91565b6040805173ffffffffffffffffffffffffffffffffffffffff8616602482015260448082018490528251808303909101815260649091019091526020810180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff167f095ea7b300000000000000000000000000000000000000000000000000000000179052909150610883908590610936565b50505050565b6040517f3dbb202b00000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff7f00000000000000000000000000000000000000000000000000000000000000001690633dbb202b906108ff90869085908790600401610ed0565b600060405180830381600087803b15801561091957600080fd5b505af115801561092d573d6000803e3d6000fd5b50505050505050565b6000610998826040518060400160405280602081526020017f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c65648152508573ffffffffffffffffffffffffffffffffffffffff16610a4c9092919063ffffffff16565b805190915015610a4757808060200190518101906109b69190610f15565b610a47576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602a60248201527f5361666545524332303a204552433230206f7065726174696f6e20646964206e60448201527f6f7420737563636565640000000000000000000000000000000000000000000060648201526084015b60405180910390fd5b505050565b6060610a5b8484600085610a65565b90505b9392505050565b606082471015610af7576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602660248201527f416464726573733a20696e73756666696369656e742062616c616e636520666f60448201527f722063616c6c00000000000000000000000000000000000000000000000000006064820152608401610a3e565b73ffffffffffffffffffffffffffffffffffffffff85163b610b75576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e74726163740000006044820152606401610a3e565b6000808673ffffffffffffffffffffffffffffffffffffffff168587604051610b9e9190610f37565b60006040518083038185875af1925050503d8060008114610bdb576040519150601f19603f3d011682016040523d82523d6000602084013e610be0565b606091505b5091509150610bf0828286610bfb565b979650505050505050565b60608315610c0a575081610a5e565b825115610c1a5782518084602001fd5b816040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610a3e9190610f53565b803573ffffffffffffffffffffffffffffffffffffffff81168114610c7257600080fd5b919050565b60008060008060808587031215610c8d57600080fd5b610c9685610c4e565b9350610ca460208601610c4e565b925060408501359150610cb960608601610c4e565b905092959194509250565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b60008060408385031215610d0657600080fd5b610d0f83610c4e565b9150602083013567ffffffffffffffff80821115610d2c57600080fd5b818501915085601f830112610d4057600080fd5b813581811115610d5257610d52610cc4565b604051601f82017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0908116603f01168101908382118183101715610d9857610d98610cc4565b81604052828152886020848701011115610db157600080fd5b8260208601602083013760006020848301015280955050505050509250929050565b60005b83811015610dee578181015183820152602001610dd6565b838111156108835750506000910152565b60008151808452610e17816020860160208601610dd3565b601f017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0169290920160200192915050565b73ffffffffffffffffffffffffffffffffffffffff83168152604060208201526000610a5b6040830184610dff565b600060208284031215610e8a57600080fd5b5051919050565b60008219821115610ecb577f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b500190565b73ffffffffffffffffffffffffffffffffffffffff84168152606060208201526000610eff6060830185610dff565b905063ffffffff83166040830152949350505050565b600060208284031215610f2757600080fd5b81518015158114610a5e57600080fd5b60008251610f49818460208701610dd3565b9190910192915050565b602081526000610a5e6020830184610dff56fea2646970667358221220b439c41917b515109464c40d4dc8343a6f6e68157bca87353f5213176038c50a64736f6c634300080d0033", + "deployedBytecode": "0x6080604052600436106100b15760003560e01c8063b708886d11610069578063e6eb8ade1161004e578063e6eb8ade14610242578063e7d2799814610255578063f4b9fa751461028957600080fd5b8063b708886d146101c5578063cf6e65b7146101f957600080fd5b806328f7c66b1161009a57806328f7c66b146101485780633cb747bf1461017c57806352c8c75c146101b057600080fd5b8063078f29cf146100b6578063146bf4b114610114575b600080fd5b3480156100c257600080fd5b506100ea7f000000000000000000000000000000000000000000000000000000000000000081565b60405173ffffffffffffffffffffffffffffffffffffffff90911681526020015b60405180910390f35b34801561012057600080fd5b506100ea7f000000000000000000000000000000000000000000000000000000000000000081565b34801561015457600080fd5b506100ea7f000000000000000000000000000000000000000000000000000000000000000081565b34801561018857600080fd5b506100ea7f000000000000000000000000000000000000000000000000000000000000000081565b6101c36101be366004610c77565b6102bd565b005b3480156101d157600080fd5b506100ea7f000000000000000000000000000000000000000000000000000000000000000081565b34801561020557600080fd5b5061022d7f000000000000000000000000000000000000000000000000000000000000000081565b60405163ffffffff909116815260200161010b565b6101c3610250366004610cf3565b6106e6565b34801561026157600080fd5b506100ea7f000000000000000000000000000000000000000000000000000000000000000081565b34801561029557600080fd5b506100ea7f000000000000000000000000000000000000000000000000000000000000000081565b7f000000000000000000000000000000000000000000000000000000000000000073ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff1603610492576040517f2e1a7d4d000000000000000000000000000000000000000000000000000000008152600481018390527f000000000000000000000000000000000000000000000000000000000000000073ffffffffffffffffffffffffffffffffffffffff1690632e1a7d4d90602401600060405180830381600087803b15801561039857600080fd5b505af11580156103ac573d6000803e3d6000fd5b50506040517f9a2ac6d500000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff848116600483015263ffffffff7f000000000000000000000000000000000000000000000000000000000000000016602483015260606044830152600060648301527f0000000000000000000000000000000000000000000000000000000000000000169250639a2ac6d5915084906084016000604051808303818588803b15801561047457600080fd5b505af1158015610488573d6000803e3d6000fd5b5050505050610681565b7f000000000000000000000000000000000000000000000000000000000000000073ffffffffffffffffffffffffffffffffffffffff7f000000000000000000000000000000000000000000000000000000000000000081169086160361051657507f00000000000000000000000000000000000000000000000000000000000000005b7f000000000000000000000000000000000000000000000000000000000000000073ffffffffffffffffffffffffffffffffffffffff168573ffffffffffffffffffffffffffffffffffffffff160361058c57507f00000000000000000000000000000000000000000000000000000000000000005b6105ad73ffffffffffffffffffffffffffffffffffffffff8616828561074e565b6040517f838b252000000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff8681166004830152858116602483015283811660448301526064820185905263ffffffff7f000000000000000000000000000000000000000000000000000000000000000016608483015260c060a4830152600060c483015282169063838b25209060e401600060405180830381600087803b15801561066757600080fd5b505af115801561067b573d6000803e3d6000fd5b50505050505b6040805173ffffffffffffffffffffffffffffffffffffffff868116825285811660208301528183018590528316606082015290517fd7e09655439c3932e55857df3220186e5a7f0980825f20691c2b35d941dee75b9181900360800190a150505050565b610711827f000000000000000000000000000000000000000000000000000000000000000083610889565b7f9e6c52944e331ba6270e7fe4cea2a4086bae8f7a27e1cdba07f416806f5d0ac48282604051610742929190610e49565b60405180910390a15050565b6040517fdd62ed3e00000000000000000000000000000000000000000000000000000000815230600482015273ffffffffffffffffffffffffffffffffffffffff8381166024830152600091839186169063dd62ed3e90604401602060405180830381865afa1580156107c5573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906107e99190610e78565b6107f39190610e91565b6040805173ffffffffffffffffffffffffffffffffffffffff8616602482015260448082018490528251808303909101815260649091019091526020810180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff167f095ea7b300000000000000000000000000000000000000000000000000000000179052909150610883908590610936565b50505050565b6040517f3dbb202b00000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff7f00000000000000000000000000000000000000000000000000000000000000001690633dbb202b906108ff90869085908790600401610ed0565b600060405180830381600087803b15801561091957600080fd5b505af115801561092d573d6000803e3d6000fd5b50505050505050565b6000610998826040518060400160405280602081526020017f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c65648152508573ffffffffffffffffffffffffffffffffffffffff16610a4c9092919063ffffffff16565b805190915015610a4757808060200190518101906109b69190610f15565b610a47576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602a60248201527f5361666545524332303a204552433230206f7065726174696f6e20646964206e60448201527f6f7420737563636565640000000000000000000000000000000000000000000060648201526084015b60405180910390fd5b505050565b6060610a5b8484600085610a65565b90505b9392505050565b606082471015610af7576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602660248201527f416464726573733a20696e73756666696369656e742062616c616e636520666f60448201527f722063616c6c00000000000000000000000000000000000000000000000000006064820152608401610a3e565b73ffffffffffffffffffffffffffffffffffffffff85163b610b75576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e74726163740000006044820152606401610a3e565b6000808673ffffffffffffffffffffffffffffffffffffffff168587604051610b9e9190610f37565b60006040518083038185875af1925050503d8060008114610bdb576040519150601f19603f3d011682016040523d82523d6000602084013e610be0565b606091505b5091509150610bf0828286610bfb565b979650505050505050565b60608315610c0a575081610a5e565b825115610c1a5782518084602001fd5b816040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610a3e9190610f53565b803573ffffffffffffffffffffffffffffffffffffffff81168114610c7257600080fd5b919050565b60008060008060808587031215610c8d57600080fd5b610c9685610c4e565b9350610ca460208601610c4e565b925060408501359150610cb960608601610c4e565b905092959194509250565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b60008060408385031215610d0657600080fd5b610d0f83610c4e565b9150602083013567ffffffffffffffff80821115610d2c57600080fd5b818501915085601f830112610d4057600080fd5b813581811115610d5257610d52610cc4565b604051601f82017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0908116603f01168101908382118183101715610d9857610d98610cc4565b81604052828152886020848701011115610db157600080fd5b8260208601602083013760006020848301015280955050505050509250929050565b60005b83811015610dee578181015183820152602001610dd6565b838111156108835750506000910152565b60008151808452610e17816020860160208601610dd3565b601f017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0169290920160200192915050565b73ffffffffffffffffffffffffffffffffffffffff83168152604060208201526000610a5b6040830184610dff565b600060208284031215610e8a57600080fd5b5051919050565b60008219821115610ecb577f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b500190565b73ffffffffffffffffffffffffffffffffffffffff84168152606060208201526000610eff6060830185610dff565b905063ffffffff83166040830152949350505050565b600060208284031215610f2757600080fd5b81518015158114610a5e57600080fd5b60008251610f49818460208701610dd3565b9190910192915050565b602081526000610a5e6020830184610dff56fea2646970667358221220b439c41917b515109464c40d4dc8343a6f6e68157bca87353f5213176038c50a64736f6c634300080d0033", "devdoc": { - "details": "Public functions calling external contracts do not guard against reentrancy because they are expected to be called via delegatecall, which will execute this contract's logic within the context of the originating contract. For example, the HubPool will delegatecall these functions, therefore its only neccessary that the HubPool's methods that call this contract's logic guard against reentrancy.", + "details": "Public functions calling external contracts do not guard against reentrancy because they are expected to be called via delegatecall, which will execute this contract's logic within the context of the originating contract. For example, the HubPool will delegatecall these functions, therefore its only necessary that the HubPool's methods that call this contract's logic guard against reentrancy.", "kind": "dev", "methods": { "constructor": { diff --git a/deployments/kovan/PolygonTokenBridger.json b/deployments/kovan/PolygonTokenBridger.json new file mode 100644 index 000000000..bf31b0ce6 --- /dev/null +++ b/deployments/kovan/PolygonTokenBridger.json @@ -0,0 +1,182 @@ +{ + "address": "0x6C9cb9a525aED1f6EEbF5321A1f35DF3ec3dfe84", + "abi": [ + { + "inputs": [ + { + "internalType": "address", + "name": "_destination", + "type": "address" + }, + { + "internalType": "contract WETH9", + "name": "_l1Weth", + "type": "address" + } + ], + "stateMutability": "nonpayable", + "type": "constructor" + }, + { + "inputs": [], + "name": "destination", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "l1Weth", + "outputs": [ + { + "internalType": "contract WETH9", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "maticToken", + "outputs": [ + { + "internalType": "contract MaticToken", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "contract IERC20", + "name": "token", + "type": "address" + } + ], + "name": "retrieve", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "contract PolygonIERC20", + "name": "token", + "type": "address" + }, + { + "internalType": "uint256", + "name": "amount", + "type": "uint256" + }, + { + "internalType": "bool", + "name": "isWrappedMatic", + "type": "bool" + } + ], + "name": "send", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "stateMutability": "payable", + "type": "receive" + } + ], + "transactionHash": "0xd3c0b4a20db9aee3f65d8db5d10d5eac0974d1aa2a03d7d3c53e999a0fd333b5", + "receipt": { + "to": "0x4e59b44847b379578588920cA78FbF26c0B4956C", + "from": "0x9A8f92a830A5cB89a3816e3D267CB7791c16b04D", + "contractAddress": null, + "transactionIndex": 2, + "gasUsed": "677458", + "logsBloom": "0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", + "blockHash": "0xb9e0e7a6484c47e7d942482a489c5524adf4f6c4f47644f69a1e8360e7d29fe4", + "transactionHash": "0xd3c0b4a20db9aee3f65d8db5d10d5eac0974d1aa2a03d7d3c53e999a0fd333b5", + "logs": [], + "blockNumber": 30475940, + "cumulativeGasUsed": "761832", + "status": 1, + "byzantium": true + }, + "args": ["0xD449Af45a032Df413b497A709EeD3E8C112EbcE3", "0xd0A1E359811322d97991E03f863a0C30C2cF029C"], + "numDeployments": 1, + "solcInputHash": "c8b9349311d8b5049b613ac98eb998d0", + "metadata": "{\"compiler\":{\"version\":\"0.8.13+commit.abaa5c0e\"},\"language\":\"Solidity\",\"output\":{\"abi\":[{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_destination\",\"type\":\"address\"},{\"internalType\":\"contract WETH9\",\"name\":\"_l1Weth\",\"type\":\"address\"}],\"stateMutability\":\"nonpayable\",\"type\":\"constructor\"},{\"inputs\":[],\"name\":\"destination\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"l1Weth\",\"outputs\":[{\"internalType\":\"contract WETH9\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"maticToken\",\"outputs\":[{\"internalType\":\"contract MaticToken\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"contract IERC20\",\"name\":\"token\",\"type\":\"address\"}],\"name\":\"retrieve\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"contract PolygonIERC20\",\"name\":\"token\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"},{\"internalType\":\"bool\",\"name\":\"isWrappedMatic\",\"type\":\"bool\"}],\"name\":\"send\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"stateMutability\":\"payable\",\"type\":\"receive\"}],\"devdoc\":{\"details\":\"Because Polygon only allows withdrawals from a particular address to go to that same address on mainnet, we need to have some sort of contract that can guarantee identical addresses on Polygon and Ethereum. This contract is intended to be completely immutable, so it's guaranteed that the contract on each side is configured identically as long as it is created via create2. create2 is an alternative creation method that uses a different address determination mechanism from normal create. Normal create: address = hash(deployer_address, deployer_nonce) create2: address = hash(0xFF, sender, salt, bytecode) This ultimately allows create2 to generate deterministic addresses that don't depend on the transaction count of the sender.\",\"kind\":\"dev\",\"methods\":{\"constructor\":{\"params\":{\"_destination\":\"Where to send tokens to for this network.\",\"_l1Weth\":\"Ethereum WETH address.\"}},\"retrieve(address)\":{\"params\":{\"token\":\"Token to send to destination.\"}},\"send(address,uint256,bool)\":{\"params\":{\"amount\":\"Amount to bridge.\",\"isWrappedMatic\":\"True if token is WMATIC.\",\"token\":\"Token to bridge.\"}}},\"version\":1},\"userdoc\":{\"kind\":\"user\",\"methods\":{\"constructor\":{\"notice\":\"Constructs Token Bridger contract.\"},\"retrieve(address)\":{\"notice\":\"Called by someone to send tokens to the destination, which should be set to the HubPool.\"},\"send(address,uint256,bool)\":{\"notice\":\"Called by Polygon SpokePool to send tokens over bridge to contract with the same address as this.The caller of this function must approve this contract to spend amount of token.\"}},\"notice\":\"Contract deployed on Ethereum and Polygon to facilitate token transfers from Polygon to the HubPool and back.\",\"version\":1}},\"settings\":{\"compilationTarget\":{\"contracts/PolygonTokenBridger.sol\":\"PolygonTokenBridger\"},\"evmVersion\":\"london\",\"libraries\":{},\"metadata\":{\"bytecodeHash\":\"ipfs\",\"useLiteralContent\":true},\"optimizer\":{\"enabled\":true,\"runs\":1000000},\"remappings\":[]},\"sources\":{\"@openzeppelin/contracts/token/ERC20/IERC20.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.5.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 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(\\n address from,\\n address to,\\n uint256 amount\\n ) external returns (bool);\\n\\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\",\"keccak256\":\"0xbbc8ac883ac3c0078ce5ad3e288fbb3ffcc8a30c3a98c0fda0114d64fc44fca2\",\"license\":\"MIT\"},\"@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts v4.4.1 (token/ERC20/utils/SafeERC20.sol)\\n\\npragma solidity ^0.8.0;\\n\\nimport \\\"../IERC20.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 function safeTransfer(\\n IERC20 token,\\n address to,\\n uint256 value\\n ) internal {\\n _callOptionalReturn(token, abi.encodeWithSelector(token.transfer.selector, to, value));\\n }\\n\\n function safeTransferFrom(\\n IERC20 token,\\n address from,\\n address to,\\n uint256 value\\n ) 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(\\n IERC20 token,\\n address spender,\\n uint256 value\\n ) 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 function safeIncreaseAllowance(\\n IERC20 token,\\n address spender,\\n uint256 value\\n ) internal {\\n uint256 newAllowance = token.allowance(address(this), spender) + value;\\n _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, newAllowance));\\n }\\n\\n function safeDecreaseAllowance(\\n IERC20 token,\\n address spender,\\n uint256 value\\n ) internal {\\n unchecked {\\n uint256 oldAllowance = token.allowance(address(this), spender);\\n require(oldAllowance >= value, \\\"SafeERC20: decreased allowance below zero\\\");\\n uint256 newAllowance = oldAllowance - value;\\n _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, newAllowance));\\n }\\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 if (returndata.length > 0) {\\n // Return data is optional\\n require(abi.decode(returndata, (bool)), \\\"SafeERC20: ERC20 operation did not succeed\\\");\\n }\\n }\\n}\\n\",\"keccak256\":\"0xc3d946432c0ddbb1f846a0d3985be71299df331b91d06732152117f62f0be2b5\",\"license\":\"MIT\"},\"@openzeppelin/contracts/utils/Address.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.5.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 *\\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://diligence.consensys.net/posts/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.5.11/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 functionCall(target, data, \\\"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(\\n address target,\\n bytes memory data,\\n uint256 value\\n ) 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 require(isContract(target), \\\"Address: call to non-contract\\\");\\n\\n (bool success, bytes memory returndata) = target.call{value: value}(data);\\n return verifyCallResult(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 require(isContract(target), \\\"Address: static call to non-contract\\\");\\n\\n (bool success, bytes memory returndata) = target.staticcall(data);\\n return verifyCallResult(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 require(isContract(target), \\\"Address: delegate call to non-contract\\\");\\n\\n (bool success, bytes memory returndata) = target.delegatecall(data);\\n return verifyCallResult(success, returndata, errorMessage);\\n }\\n\\n /**\\n * @dev Tool to verifies that a low level call was successful, and revert if it wasn't, either by bubbling the\\n * revert reason 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 // 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\\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}\\n\",\"keccak256\":\"0x2ccf9d2313a313d41a791505f2b5abfdc62191b5d4334f7f7a82691c088a1c87\",\"license\":\"MIT\"},\"contracts/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 * @dev The reason why we use this local contract instead of importing from uma/contracts is because of the addition\\n * of the internal method `functionCallStackOriginatesFromOutsideThisContract` which doesn't exist in the one exported\\n * by uma/contracts.\\n */\\ncontract Lockable {\\n bool internal _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 /**\\n * @dev Returns true if the contract is currently in a non-entered state, meaning that the origination of the call\\n * came from outside the contract. This is relevant with fallback/receive methods to see if the call came from ETH\\n * being dropped onto the contract externally or due to ETH dropped on the the contract from within a method in this\\n * contract, such as unwrapping WETH to ETH within the contract.\\n */\\n function functionCallStackOriginatesFromOutsideThisContract() internal view returns (bool) {\\n return _notEntered;\\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\",\"keccak256\":\"0xef490be5cb859c97c6f600f3b0db0d50c6e18f334d3c74c6d9e693a260eaec3e\",\"license\":\"AGPL-3.0-only\"},\"contracts/PolygonTokenBridger.sol\":{\"content\":\"// SPDX-License-Identifier: AGPL-3.0-only\\npragma solidity ^0.8.0;\\n\\nimport \\\"./Lockable.sol\\\";\\nimport \\\"./interfaces/WETH9.sol\\\";\\n\\nimport \\\"@openzeppelin/contracts/token/ERC20/IERC20.sol\\\";\\nimport \\\"@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol\\\";\\n\\n// ERC20s (on polygon) compatible with polygon's bridge have a withdraw method.\\ninterface PolygonIERC20 is IERC20 {\\n function withdraw(uint256 amount) external;\\n}\\n\\ninterface MaticToken {\\n function withdraw(uint256 amount) external payable;\\n}\\n\\n/**\\n * @notice Contract deployed on Ethereum and Polygon to facilitate token transfers from Polygon to the HubPool and back.\\n * @dev Because Polygon only allows withdrawals from a particular address to go to that same address on mainnet, we need to\\n * have some sort of contract that can guarantee identical addresses on Polygon and Ethereum. This contract is intended\\n * to be completely immutable, so it's guaranteed that the contract on each side is configured identically as long as\\n * it is created via create2. create2 is an alternative creation method that uses a different address determination\\n * mechanism from normal create.\\n * Normal create: address = hash(deployer_address, deployer_nonce)\\n * create2: address = hash(0xFF, sender, salt, bytecode)\\n * This ultimately allows create2 to generate deterministic addresses that don't depend on the transaction count of the\\n * sender.\\n */\\ncontract PolygonTokenBridger is Lockable {\\n using SafeERC20 for PolygonIERC20;\\n using SafeERC20 for IERC20;\\n\\n // Gas token for Polygon.\\n MaticToken public constant maticToken = MaticToken(0x0000000000000000000000000000000000001010);\\n\\n // Should be set to HubPool on Ethereum, or unused on Polygon.\\n address public immutable destination;\\n\\n // WETH contract on Ethereum.\\n WETH9 public immutable l1Weth;\\n\\n /**\\n * @notice Constructs Token Bridger contract.\\n * @param _destination Where to send tokens to for this network.\\n * @param _l1Weth Ethereum WETH address.\\n */\\n constructor(address _destination, WETH9 _l1Weth) {\\n destination = _destination;\\n l1Weth = _l1Weth;\\n }\\n\\n /**\\n * @notice Called by Polygon SpokePool to send tokens over bridge to contract with the same address as this.\\n * @notice The caller of this function must approve this contract to spend amount of token.\\n * @param token Token to bridge.\\n * @param amount Amount to bridge.\\n * @param isWrappedMatic True if token is WMATIC.\\n */\\n function send(\\n PolygonIERC20 token,\\n uint256 amount,\\n bool isWrappedMatic\\n ) public nonReentrant {\\n token.safeTransferFrom(msg.sender, address(this), amount);\\n\\n // In the wMatic case, this unwraps. For other ERC20s, this is the burn/send action.\\n token.withdraw(amount);\\n\\n // This takes the token that was withdrawn and calls withdraw on the \\\"native\\\" ERC20.\\n if (isWrappedMatic) maticToken.withdraw{ value: amount }(amount);\\n }\\n\\n /**\\n * @notice Called by someone to send tokens to the destination, which should be set to the HubPool.\\n * @param token Token to send to destination.\\n */\\n function retrieve(IERC20 token) public nonReentrant {\\n token.safeTransfer(destination, token.balanceOf(address(this)));\\n }\\n\\n receive() external payable {\\n // Note: this should only happen on the mainnet side where ETH is sent to the contract directly by the bridge.\\n if (functionCallStackOriginatesFromOutsideThisContract()) l1Weth.deposit{ value: address(this).balance }();\\n }\\n}\\n\",\"keccak256\":\"0x79b3a0f440bf429abcb41d4d808892d0bd73e890334585f3ab1dd67a2bbe32cd\",\"license\":\"AGPL-3.0-only\"},\"contracts/interfaces/WETH9.sol\":{\"content\":\"// SPDX-License-Identifier: GPL-3.0-only\\npragma solidity ^0.8.0;\\n\\ninterface WETH9 {\\n function withdraw(uint256 wad) external;\\n\\n function deposit() external payable;\\n\\n function balanceOf(address guy) external view returns (uint256 wad);\\n\\n function transfer(address guy, uint256 wad) external;\\n}\\n\",\"keccak256\":\"0x7b444d0840b1f76eee9bf39d74830f70644395613b96cce2d80fc50785a82eaa\",\"license\":\"GPL-3.0-only\"}},\"version\":1}", + "bytecode": "0x60c060405234801561001057600080fd5b50604051610bbd380380610bbd83398101604081905261002f9161006b565b6000805460ff191660011790556001600160a01b039182166080521660a0526100a5565b6001600160a01b038116811461006857600080fd5b50565b6000806040838503121561007e57600080fd5b825161008981610053565b602084015190925061009a81610053565b809150509250929050565b60805160a051610ae66100d7600039600081816070015261012901526000818161018601526102450152610ae66000f3fe60806040526004361061005e5760003560e01c8063b269681d11610043578063b269681d14610174578063d124dc4f146101a8578063dc354296146101c857600080fd5b80630a79309b146100f7578063146bf4b11461011757600080fd5b366100f25760005460ff16156100f0577f000000000000000000000000000000000000000000000000000000000000000073ffffffffffffffffffffffffffffffffffffffff1663d0e30db0476040518263ffffffff1660e01b81526004016000604051808303818588803b1580156100d657600080fd5b505af11580156100ea573d6000803e3d6000fd5b50505050505b005b600080fd5b34801561010357600080fd5b506100f0610112366004610974565b6101de565b34801561012357600080fd5b5061014b7f000000000000000000000000000000000000000000000000000000000000000081565b60405173ffffffffffffffffffffffffffffffffffffffff909116815260200160405180910390f35b34801561018057600080fd5b5061014b7f000000000000000000000000000000000000000000000000000000000000000081565b3480156101b457600080fd5b506100f06101c336600461099f565b610318565b3480156101d457600080fd5b5061014b61101081565b6101e6610499565b610213600080547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff00169055565b6040517f70a082310000000000000000000000000000000000000000000000000000000081523060048201526102e5907f00000000000000000000000000000000000000000000000000000000000000009073ffffffffffffffffffffffffffffffffffffffff8416906370a0823190602401602060405180830381865afa1580156102a3573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906102c791906109e1565b73ffffffffffffffffffffffffffffffffffffffff8416919061050c565b610315600080547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff00166001179055565b50565b610320610499565b61034d600080547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff00169055565b61036f73ffffffffffffffffffffffffffffffffffffffff84163330856105e0565b6040517f2e1a7d4d0000000000000000000000000000000000000000000000000000000081526004810183905273ffffffffffffffffffffffffffffffffffffffff841690632e1a7d4d90602401600060405180830381600087803b1580156103d757600080fd5b505af11580156103eb573d6000803e3d6000fd5b505050508015610464576040517f2e1a7d4d0000000000000000000000000000000000000000000000000000000081526004810183905261101090632e1a7d4d9084906024016000604051808303818588803b15801561044a57600080fd5b505af115801561045e573d6000803e3d6000fd5b50505050505b610494600080547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff00166001179055565b505050565b60005460ff1661050a576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601f60248201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c0060448201526064015b60405180910390fd5b565b60405173ffffffffffffffffffffffffffffffffffffffff83166024820152604481018290526104949084907fa9059cbb00000000000000000000000000000000000000000000000000000000906064015b604080517fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe08184030181529190526020810180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff167fffffffff0000000000000000000000000000000000000000000000000000000090931692909217909152610644565b60405173ffffffffffffffffffffffffffffffffffffffff8085166024830152831660448201526064810182905261063e9085907f23b872dd000000000000000000000000000000000000000000000000000000009060840161055e565b50505050565b60006106a6826040518060400160405280602081526020017f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c65648152508573ffffffffffffffffffffffffffffffffffffffff166107509092919063ffffffff16565b80519091501561049457808060200190518101906106c491906109fa565b610494576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602a60248201527f5361666545524332303a204552433230206f7065726174696f6e20646964206e60448201527f6f742073756363656564000000000000000000000000000000000000000000006064820152608401610501565b606061075f8484600085610769565b90505b9392505050565b6060824710156107fb576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602660248201527f416464726573733a20696e73756666696369656e742062616c616e636520666f60448201527f722063616c6c00000000000000000000000000000000000000000000000000006064820152608401610501565b73ffffffffffffffffffffffffffffffffffffffff85163b610879576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e74726163740000006044820152606401610501565b6000808673ffffffffffffffffffffffffffffffffffffffff1685876040516108a29190610a43565b60006040518083038185875af1925050503d80600081146108df576040519150601f19603f3d011682016040523d82523d6000602084013e6108e4565b606091505b50915091506108f48282866108ff565b979650505050505050565b6060831561090e575081610762565b82511561091e5782518084602001fd5b816040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016105019190610a5f565b73ffffffffffffffffffffffffffffffffffffffff8116811461031557600080fd5b60006020828403121561098657600080fd5b813561076281610952565b801515811461031557600080fd5b6000806000606084860312156109b457600080fd5b83356109bf81610952565b92506020840135915060408401356109d681610991565b809150509250925092565b6000602082840312156109f357600080fd5b5051919050565b600060208284031215610a0c57600080fd5b815161076281610991565b60005b83811015610a32578181015183820152602001610a1a565b8381111561063e5750506000910152565b60008251610a55818460208701610a17565b9190910192915050565b6020815260008251806020840152610a7e816040850160208701610a17565b601f017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe016919091016040019291505056fea2646970667358221220a6bfbc7a1aefd28bea6fd266df05752c1c618d43ebe6b51f137c909303fc674f64736f6c634300080d0033", + "deployedBytecode": "0x60806040526004361061005e5760003560e01c8063b269681d11610043578063b269681d14610174578063d124dc4f146101a8578063dc354296146101c857600080fd5b80630a79309b146100f7578063146bf4b11461011757600080fd5b366100f25760005460ff16156100f0577f000000000000000000000000000000000000000000000000000000000000000073ffffffffffffffffffffffffffffffffffffffff1663d0e30db0476040518263ffffffff1660e01b81526004016000604051808303818588803b1580156100d657600080fd5b505af11580156100ea573d6000803e3d6000fd5b50505050505b005b600080fd5b34801561010357600080fd5b506100f0610112366004610974565b6101de565b34801561012357600080fd5b5061014b7f000000000000000000000000000000000000000000000000000000000000000081565b60405173ffffffffffffffffffffffffffffffffffffffff909116815260200160405180910390f35b34801561018057600080fd5b5061014b7f000000000000000000000000000000000000000000000000000000000000000081565b3480156101b457600080fd5b506100f06101c336600461099f565b610318565b3480156101d457600080fd5b5061014b61101081565b6101e6610499565b610213600080547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff00169055565b6040517f70a082310000000000000000000000000000000000000000000000000000000081523060048201526102e5907f00000000000000000000000000000000000000000000000000000000000000009073ffffffffffffffffffffffffffffffffffffffff8416906370a0823190602401602060405180830381865afa1580156102a3573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906102c791906109e1565b73ffffffffffffffffffffffffffffffffffffffff8416919061050c565b610315600080547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff00166001179055565b50565b610320610499565b61034d600080547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff00169055565b61036f73ffffffffffffffffffffffffffffffffffffffff84163330856105e0565b6040517f2e1a7d4d0000000000000000000000000000000000000000000000000000000081526004810183905273ffffffffffffffffffffffffffffffffffffffff841690632e1a7d4d90602401600060405180830381600087803b1580156103d757600080fd5b505af11580156103eb573d6000803e3d6000fd5b505050508015610464576040517f2e1a7d4d0000000000000000000000000000000000000000000000000000000081526004810183905261101090632e1a7d4d9084906024016000604051808303818588803b15801561044a57600080fd5b505af115801561045e573d6000803e3d6000fd5b50505050505b610494600080547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff00166001179055565b505050565b60005460ff1661050a576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601f60248201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c0060448201526064015b60405180910390fd5b565b60405173ffffffffffffffffffffffffffffffffffffffff83166024820152604481018290526104949084907fa9059cbb00000000000000000000000000000000000000000000000000000000906064015b604080517fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe08184030181529190526020810180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff167fffffffff0000000000000000000000000000000000000000000000000000000090931692909217909152610644565b60405173ffffffffffffffffffffffffffffffffffffffff8085166024830152831660448201526064810182905261063e9085907f23b872dd000000000000000000000000000000000000000000000000000000009060840161055e565b50505050565b60006106a6826040518060400160405280602081526020017f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c65648152508573ffffffffffffffffffffffffffffffffffffffff166107509092919063ffffffff16565b80519091501561049457808060200190518101906106c491906109fa565b610494576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602a60248201527f5361666545524332303a204552433230206f7065726174696f6e20646964206e60448201527f6f742073756363656564000000000000000000000000000000000000000000006064820152608401610501565b606061075f8484600085610769565b90505b9392505050565b6060824710156107fb576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602660248201527f416464726573733a20696e73756666696369656e742062616c616e636520666f60448201527f722063616c6c00000000000000000000000000000000000000000000000000006064820152608401610501565b73ffffffffffffffffffffffffffffffffffffffff85163b610879576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e74726163740000006044820152606401610501565b6000808673ffffffffffffffffffffffffffffffffffffffff1685876040516108a29190610a43565b60006040518083038185875af1925050503d80600081146108df576040519150601f19603f3d011682016040523d82523d6000602084013e6108e4565b606091505b50915091506108f48282866108ff565b979650505050505050565b6060831561090e575081610762565b82511561091e5782518084602001fd5b816040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016105019190610a5f565b73ffffffffffffffffffffffffffffffffffffffff8116811461031557600080fd5b60006020828403121561098657600080fd5b813561076281610952565b801515811461031557600080fd5b6000806000606084860312156109b457600080fd5b83356109bf81610952565b92506020840135915060408401356109d681610991565b809150509250925092565b6000602082840312156109f357600080fd5b5051919050565b600060208284031215610a0c57600080fd5b815161076281610991565b60005b83811015610a32578181015183820152602001610a1a565b8381111561063e5750506000910152565b60008251610a55818460208701610a17565b9190910192915050565b6020815260008251806020840152610a7e816040850160208701610a17565b601f017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe016919091016040019291505056fea2646970667358221220a6bfbc7a1aefd28bea6fd266df05752c1c618d43ebe6b51f137c909303fc674f64736f6c634300080d0033", + "devdoc": { + "details": "Because Polygon only allows withdrawals from a particular address to go to that same address on mainnet, we need to have some sort of contract that can guarantee identical addresses on Polygon and Ethereum. This contract is intended to be completely immutable, so it's guaranteed that the contract on each side is configured identically as long as it is created via create2. create2 is an alternative creation method that uses a different address determination mechanism from normal create. Normal create: address = hash(deployer_address, deployer_nonce) create2: address = hash(0xFF, sender, salt, bytecode) This ultimately allows create2 to generate deterministic addresses that don't depend on the transaction count of the sender.", + "kind": "dev", + "methods": { + "constructor": { + "params": { + "_destination": "Where to send tokens to for this network.", + "_l1Weth": "Ethereum WETH address." + } + }, + "retrieve(address)": { + "params": { + "token": "Token to send to destination." + } + }, + "send(address,uint256,bool)": { + "params": { + "amount": "Amount to bridge.", + "isWrappedMatic": "True if token is WMATIC.", + "token": "Token to bridge." + } + } + }, + "version": 1 + }, + "userdoc": { + "kind": "user", + "methods": { + "constructor": { + "notice": "Constructs Token Bridger contract." + }, + "retrieve(address)": { + "notice": "Called by someone to send tokens to the destination, which should be set to the HubPool." + }, + "send(address,uint256,bool)": { + "notice": "Called by Polygon SpokePool to send tokens over bridge to contract with the same address as this.The caller of this function must approve this contract to spend amount of token." + } + }, + "notice": "Contract deployed on Ethereum and Polygon to facilitate token transfers from Polygon to the HubPool and back.", + "version": 1 + }, + "storageLayout": { + "storage": [ + { + "astId": 7084, + "contract": "contracts/PolygonTokenBridger.sol:PolygonTokenBridger", + "label": "_notEntered", + "offset": 0, + "slot": "0", + "type": "t_bool" + } + ], + "types": { + "t_bool": { + "encoding": "inplace", + "label": "bool", + "numberOfBytes": "1" + } + } + } +} diff --git a/deployments/kovan/Polygon_Adapter.json b/deployments/kovan/Polygon_Adapter.json new file mode 100644 index 000000000..ca950c6f9 --- /dev/null +++ b/deployments/kovan/Polygon_Adapter.json @@ -0,0 +1,235 @@ +{ + "address": "0x3aa1b039252ee320bd551875213AFA4996c00b85", + "abi": [ + { + "inputs": [ + { + "internalType": "contract IRootChainManager", + "name": "_rootChainManager", + "type": "address" + }, + { + "internalType": "contract IFxStateSender", + "name": "_fxStateSender", + "type": "address" + }, + { + "internalType": "contract WETH9", + "name": "_l1Weth", + "type": "address" + } + ], + "stateMutability": "nonpayable", + "type": "constructor" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "address", + "name": "target", + "type": "address" + }, + { + "indexed": false, + "internalType": "bytes", + "name": "message", + "type": "bytes" + } + ], + "name": "MessageRelayed", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "address", + "name": "l1Token", + "type": "address" + }, + { + "indexed": false, + "internalType": "address", + "name": "l2Token", + "type": "address" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "amount", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "address", + "name": "to", + "type": "address" + } + ], + "name": "TokensRelayed", + "type": "event" + }, + { + "inputs": [], + "name": "fxStateSender", + "outputs": [ + { + "internalType": "contract IFxStateSender", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "l1Weth", + "outputs": [ + { + "internalType": "contract WETH9", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "target", + "type": "address" + }, + { + "internalType": "bytes", + "name": "message", + "type": "bytes" + } + ], + "name": "relayMessage", + "outputs": [], + "stateMutability": "payable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "l1Token", + "type": "address" + }, + { + "internalType": "address", + "name": "l2Token", + "type": "address" + }, + { + "internalType": "uint256", + "name": "amount", + "type": "uint256" + }, + { + "internalType": "address", + "name": "to", + "type": "address" + } + ], + "name": "relayTokens", + "outputs": [], + "stateMutability": "payable", + "type": "function" + }, + { + "inputs": [], + "name": "rootChainManager", + "outputs": [ + { + "internalType": "contract IRootChainManager", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + } + ], + "transactionHash": "0x7a9bab1e4ea7756b15bdf8db91e7c8a5bb87cdaabc2955ab3d9fbb44fcb3bc44", + "receipt": { + "to": null, + "from": "0x9A8f92a830A5cB89a3816e3D267CB7791c16b04D", + "contractAddress": "0x3aa1b039252ee320bd551875213AFA4996c00b85", + "transactionIndex": 1, + "gasUsed": "755477", + "logsBloom": "0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", + "blockHash": "0xd91e94c82456c763fb8f0608b9852c0ad167b03894be0b40ab10b90ba2d28891", + "transactionHash": "0x7a9bab1e4ea7756b15bdf8db91e7c8a5bb87cdaabc2955ab3d9fbb44fcb3bc44", + "logs": [], + "blockNumber": 30475943, + "cumulativeGasUsed": "866044", + "status": 1, + "byzantium": true + }, + "args": [ + "0xBbD7cBFA79faee899Eaf900F13C9065bF03B1A74", + "0x3d1d3E34f7fB6D26245E6640E1c50710eFFf15bA", + "0xd0A1E359811322d97991E03f863a0C30C2cF029C" + ], + "numDeployments": 1, + "solcInputHash": "c8b9349311d8b5049b613ac98eb998d0", + "metadata": "{\"compiler\":{\"version\":\"0.8.13+commit.abaa5c0e\"},\"language\":\"Solidity\",\"output\":{\"abi\":[{\"inputs\":[{\"internalType\":\"contract IRootChainManager\",\"name\":\"_rootChainManager\",\"type\":\"address\"},{\"internalType\":\"contract IFxStateSender\",\"name\":\"_fxStateSender\",\"type\":\"address\"},{\"internalType\":\"contract WETH9\",\"name\":\"_l1Weth\",\"type\":\"address\"}],\"stateMutability\":\"nonpayable\",\"type\":\"constructor\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"address\",\"name\":\"target\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"bytes\",\"name\":\"message\",\"type\":\"bytes\"}],\"name\":\"MessageRelayed\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"address\",\"name\":\"l1Token\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"address\",\"name\":\"l2Token\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"address\",\"name\":\"to\",\"type\":\"address\"}],\"name\":\"TokensRelayed\",\"type\":\"event\"},{\"inputs\":[],\"name\":\"fxStateSender\",\"outputs\":[{\"internalType\":\"contract IFxStateSender\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"l1Weth\",\"outputs\":[{\"internalType\":\"contract WETH9\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"target\",\"type\":\"address\"},{\"internalType\":\"bytes\",\"name\":\"message\",\"type\":\"bytes\"}],\"name\":\"relayMessage\",\"outputs\":[],\"stateMutability\":\"payable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"l1Token\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"l2Token\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"},{\"internalType\":\"address\",\"name\":\"to\",\"type\":\"address\"}],\"name\":\"relayTokens\",\"outputs\":[],\"stateMutability\":\"payable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"rootChainManager\",\"outputs\":[{\"internalType\":\"contract IRootChainManager\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"}],\"devdoc\":{\"details\":\"Public functions calling external contracts do not guard against reentrancy because they are expected to be called via delegatecall, which will execute this contract's logic within the context of the originating contract. For example, the HubPool will delegatecall these functions, therefore its only necessary that the HubPool's methods that call this contract's logic guard against reentrancy.\",\"kind\":\"dev\",\"methods\":{\"constructor\":{\"params\":{\"_fxStateSender\":\"FxStateSender Polygon system helper contract.\",\"_l1Weth\":\"WETH address on L1.\",\"_rootChainManager\":\"RootChainManager Polygon system helper contract.\"}},\"relayMessage(address,bytes)\":{\"params\":{\"message\":\"Data to send to target.\",\"target\":\"Contract on Polygon that will receive message.\"}},\"relayTokens(address,address,uint256,address)\":{\"params\":{\"amount\":\"Amount of L1 tokens to deposit and L2 tokens to receive.\",\"l1Token\":\"L1 token to deposit.\",\"l2Token\":\"L2 token to receive.\",\"to\":\"Bridge recipient.\"}}},\"version\":1},\"userdoc\":{\"kind\":\"user\",\"methods\":{\"constructor\":{\"notice\":\"Constructs new Adapter.\"},\"relayMessage(address,bytes)\":{\"notice\":\"Send cross-chain message to target on Polygon.\"},\"relayTokens(address,address,uint256,address)\":{\"notice\":\"Bridge tokens to Polygon.\"}},\"notice\":\"Sends cross chain messages Polygon L2 network.\",\"version\":1}},\"settings\":{\"compilationTarget\":{\"contracts/chain-adapters/Polygon_Adapter.sol\":\"Polygon_Adapter\"},\"evmVersion\":\"london\",\"libraries\":{},\"metadata\":{\"bytecodeHash\":\"ipfs\",\"useLiteralContent\":true},\"optimizer\":{\"enabled\":true,\"runs\":1000000},\"remappings\":[]},\"sources\":{\"@openzeppelin/contracts/token/ERC20/IERC20.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.5.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 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(\\n address from,\\n address to,\\n uint256 amount\\n ) external returns (bool);\\n\\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\",\"keccak256\":\"0xbbc8ac883ac3c0078ce5ad3e288fbb3ffcc8a30c3a98c0fda0114d64fc44fca2\",\"license\":\"MIT\"},\"@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts v4.4.1 (token/ERC20/utils/SafeERC20.sol)\\n\\npragma solidity ^0.8.0;\\n\\nimport \\\"../IERC20.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 function safeTransfer(\\n IERC20 token,\\n address to,\\n uint256 value\\n ) internal {\\n _callOptionalReturn(token, abi.encodeWithSelector(token.transfer.selector, to, value));\\n }\\n\\n function safeTransferFrom(\\n IERC20 token,\\n address from,\\n address to,\\n uint256 value\\n ) 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(\\n IERC20 token,\\n address spender,\\n uint256 value\\n ) 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 function safeIncreaseAllowance(\\n IERC20 token,\\n address spender,\\n uint256 value\\n ) internal {\\n uint256 newAllowance = token.allowance(address(this), spender) + value;\\n _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, newAllowance));\\n }\\n\\n function safeDecreaseAllowance(\\n IERC20 token,\\n address spender,\\n uint256 value\\n ) internal {\\n unchecked {\\n uint256 oldAllowance = token.allowance(address(this), spender);\\n require(oldAllowance >= value, \\\"SafeERC20: decreased allowance below zero\\\");\\n uint256 newAllowance = oldAllowance - value;\\n _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, newAllowance));\\n }\\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 if (returndata.length > 0) {\\n // Return data is optional\\n require(abi.decode(returndata, (bool)), \\\"SafeERC20: ERC20 operation did not succeed\\\");\\n }\\n }\\n}\\n\",\"keccak256\":\"0xc3d946432c0ddbb1f846a0d3985be71299df331b91d06732152117f62f0be2b5\",\"license\":\"MIT\"},\"@openzeppelin/contracts/utils/Address.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.5.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 *\\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://diligence.consensys.net/posts/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.5.11/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 functionCall(target, data, \\\"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(\\n address target,\\n bytes memory data,\\n uint256 value\\n ) 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 require(isContract(target), \\\"Address: call to non-contract\\\");\\n\\n (bool success, bytes memory returndata) = target.call{value: value}(data);\\n return verifyCallResult(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 require(isContract(target), \\\"Address: static call to non-contract\\\");\\n\\n (bool success, bytes memory returndata) = target.staticcall(data);\\n return verifyCallResult(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 require(isContract(target), \\\"Address: delegate call to non-contract\\\");\\n\\n (bool success, bytes memory returndata) = target.delegatecall(data);\\n return verifyCallResult(success, returndata, errorMessage);\\n }\\n\\n /**\\n * @dev Tool to verifies that a low level call was successful, and revert if it wasn't, either by bubbling the\\n * revert reason 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 // 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\\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}\\n\",\"keccak256\":\"0x2ccf9d2313a313d41a791505f2b5abfdc62191b5d4334f7f7a82691c088a1c87\",\"license\":\"MIT\"},\"contracts/chain-adapters/Polygon_Adapter.sol\":{\"content\":\"// SPDX-License-Identifier: AGPL-3.0-only\\npragma solidity ^0.8.0;\\n\\nimport \\\"../interfaces/AdapterInterface.sol\\\";\\nimport \\\"../interfaces/WETH9.sol\\\";\\n\\nimport \\\"@openzeppelin/contracts/token/ERC20/IERC20.sol\\\";\\nimport \\\"@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol\\\";\\n\\ninterface IRootChainManager {\\n function depositEtherFor(address user) external payable;\\n\\n function depositFor(\\n address user,\\n address rootToken,\\n bytes calldata depositData\\n ) external;\\n}\\n\\ninterface IFxStateSender {\\n function sendMessageToChild(address _receiver, bytes calldata _data) external;\\n}\\n\\n/**\\n * @notice Sends cross chain messages Polygon L2 network.\\n * @dev Public functions calling external contracts do not guard against reentrancy because they are expected to be\\n * called via delegatecall, which will execute this contract's logic within the context of the originating contract.\\n * For example, the HubPool will delegatecall these functions, therefore its only necessary that the HubPool's methods\\n * that call this contract's logic guard against reentrancy.\\n */\\ncontract Polygon_Adapter is AdapterInterface {\\n using SafeERC20 for IERC20;\\n IRootChainManager public immutable rootChainManager;\\n IFxStateSender public immutable fxStateSender;\\n WETH9 public immutable l1Weth;\\n\\n /**\\n * @notice Constructs new Adapter.\\n * @param _rootChainManager RootChainManager Polygon system helper contract.\\n * @param _fxStateSender FxStateSender Polygon system helper contract.\\n * @param _l1Weth WETH address on L1.\\n */\\n constructor(\\n IRootChainManager _rootChainManager,\\n IFxStateSender _fxStateSender,\\n WETH9 _l1Weth\\n ) {\\n rootChainManager = _rootChainManager;\\n fxStateSender = _fxStateSender;\\n l1Weth = _l1Weth;\\n }\\n\\n /**\\n * @notice Send cross-chain message to target on Polygon.\\n * @param target Contract on Polygon that will receive message.\\n * @param message Data to send to target.\\n */\\n\\n function relayMessage(address target, bytes memory message) external payable override {\\n fxStateSender.sendMessageToChild(target, message);\\n emit MessageRelayed(target, message);\\n }\\n\\n /**\\n * @notice Bridge tokens to Polygon.\\n * @param l1Token L1 token to deposit.\\n * @param l2Token L2 token to receive.\\n * @param amount Amount of L1 tokens to deposit and L2 tokens to receive.\\n * @param to Bridge recipient.\\n */\\n function relayTokens(\\n address l1Token,\\n address l2Token,\\n uint256 amount,\\n address to\\n ) external payable override {\\n // If the l1Token is weth then unwrap it to ETH then send the ETH to the standard bridge.\\n if (l1Token == address(l1Weth)) {\\n l1Weth.withdraw(amount);\\n rootChainManager.depositEtherFor{ value: amount }(to);\\n } else {\\n IERC20(l1Token).safeIncreaseAllowance(address(rootChainManager), amount);\\n rootChainManager.depositFor(to, l1Token, abi.encode(amount));\\n }\\n emit TokensRelayed(l1Token, l2Token, amount, to);\\n }\\n}\\n\",\"keccak256\":\"0x0d47c68dbc8612ab9959918f1d085461bc6765e033efad68e95f2ae4e2441cf6\",\"license\":\"AGPL-3.0-only\"},\"contracts/interfaces/AdapterInterface.sol\":{\"content\":\"// SPDX-License-Identifier: AGPL-3.0-only\\npragma solidity ^0.8.0;\\n\\n/**\\n * @notice Sends cross chain messages and tokens to contracts on a specific L2 network.\\n */\\n\\ninterface AdapterInterface {\\n event MessageRelayed(address target, bytes message);\\n\\n event TokensRelayed(address l1Token, address l2Token, uint256 amount, address to);\\n\\n function relayMessage(address target, bytes memory message) external payable;\\n\\n function relayTokens(\\n address l1Token,\\n address l2Token,\\n uint256 amount,\\n address to\\n ) external payable;\\n}\\n\",\"keccak256\":\"0xbd7091006acbdfe72b21ce985f964f0682a2316d9d3b38967beeb55f4ae5118c\",\"license\":\"AGPL-3.0-only\"},\"contracts/interfaces/WETH9.sol\":{\"content\":\"// SPDX-License-Identifier: GPL-3.0-only\\npragma solidity ^0.8.0;\\n\\ninterface WETH9 {\\n function withdraw(uint256 wad) external;\\n\\n function deposit() external payable;\\n\\n function balanceOf(address guy) external view returns (uint256 wad);\\n\\n function transfer(address guy, uint256 wad) external;\\n}\\n\",\"keccak256\":\"0x7b444d0840b1f76eee9bf39d74830f70644395613b96cce2d80fc50785a82eaa\",\"license\":\"GPL-3.0-only\"}},\"version\":1}", + "bytecode": "0x60e060405234801561001057600080fd5b50604051610dc7380380610dc783398101604081905261002f91610064565b6001600160a01b0392831660805290821660a0521660c0526100b1565b6001600160a01b038116811461006157600080fd5b50565b60008060006060848603121561007957600080fd5b83516100848161004c565b60208501519093506100958161004c565b60408501519092506100a68161004c565b809150509250925092565b60805160a05160c051610cbf6101086000396000818160710152818161014e01526101ce01526000818160e3015261047b0152600081816101170152818161028201528181610303015261032a0152610cbf6000f3fe60806040526004361061005a5760003560e01c8063a996cabb11610043578063a996cabb146100d1578063bd07018d14610105578063e6eb8ade1461013957600080fd5b8063146bf4b11461005f57806352c8c75c146100bc575b600080fd5b34801561006b57600080fd5b506100937f000000000000000000000000000000000000000000000000000000000000000081565b60405173ffffffffffffffffffffffffffffffffffffffff909116815260200160405180910390f35b6100cf6100ca36600461099d565b61014c565b005b3480156100dd57600080fd5b506100937f000000000000000000000000000000000000000000000000000000000000000081565b34801561011157600080fd5b506100937f000000000000000000000000000000000000000000000000000000000000000081565b6100cf610147366004610a19565b61043e565b7f000000000000000000000000000000000000000000000000000000000000000073ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff16036102e7576040517f2e1a7d4d000000000000000000000000000000000000000000000000000000008152600481018390527f000000000000000000000000000000000000000000000000000000000000000073ffffffffffffffffffffffffffffffffffffffff1690632e1a7d4d90602401600060405180830381600087803b15801561022757600080fd5b505af115801561023b573d6000803e3d6000fd5b50506040517f4faa8a2600000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff84811660048301527f0000000000000000000000000000000000000000000000000000000000000000169250634faa8a26915084906024016000604051808303818588803b1580156102c957600080fd5b505af11580156102dd573d6000803e3d6000fd5b50505050506103d9565b61032873ffffffffffffffffffffffffffffffffffffffff85167f000000000000000000000000000000000000000000000000000000000000000084610521565b7f000000000000000000000000000000000000000000000000000000000000000073ffffffffffffffffffffffffffffffffffffffff1663e3dec8fb82868560405160200161037991815260200190565b6040516020818303038152906040526040518463ffffffff1660e01b81526004016103a693929190610b6f565b600060405180830381600087803b1580156103c057600080fd5b505af11580156103d4573d6000803e3d6000fd5b505050505b6040805173ffffffffffffffffffffffffffffffffffffffff868116825285811660208301528183018590528316606082015290517fd7e09655439c3932e55857df3220186e5a7f0980825f20691c2b35d941dee75b9181900360800190a150505050565b6040517fb472047700000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff7f0000000000000000000000000000000000000000000000000000000000000000169063b4720477906104b29085908590600401610bb1565b600060405180830381600087803b1580156104cc57600080fd5b505af11580156104e0573d6000803e3d6000fd5b505050507f9e6c52944e331ba6270e7fe4cea2a4086bae8f7a27e1cdba07f416806f5d0ac48282604051610515929190610bb1565b60405180910390a15050565b6040517fdd62ed3e00000000000000000000000000000000000000000000000000000000815230600482015273ffffffffffffffffffffffffffffffffffffffff8381166024830152600091839186169063dd62ed3e90604401602060405180830381865afa158015610598573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906105bc9190610be0565b6105c69190610bf9565b6040805173ffffffffffffffffffffffffffffffffffffffff8616602482015260448082018490528251808303909101815260649091019091526020810180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff167f095ea7b30000000000000000000000000000000000000000000000000000000017905290915061065690859061065c565b50505050565b60006106be826040518060400160405280602081526020017f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c65648152508573ffffffffffffffffffffffffffffffffffffffff166107729092919063ffffffff16565b80519091501561076d57808060200190518101906106dc9190610c38565b61076d576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602a60248201527f5361666545524332303a204552433230206f7065726174696f6e20646964206e60448201527f6f7420737563636565640000000000000000000000000000000000000000000060648201526084015b60405180910390fd5b505050565b6060610781848460008561078b565b90505b9392505050565b60608247101561081d576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602660248201527f416464726573733a20696e73756666696369656e742062616c616e636520666f60448201527f722063616c6c00000000000000000000000000000000000000000000000000006064820152608401610764565b73ffffffffffffffffffffffffffffffffffffffff85163b61089b576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e74726163740000006044820152606401610764565b6000808673ffffffffffffffffffffffffffffffffffffffff1685876040516108c49190610c5a565b60006040518083038185875af1925050503d8060008114610901576040519150601f19603f3d011682016040523d82523d6000602084013e610906565b606091505b5091509150610916828286610921565b979650505050505050565b60608315610930575081610784565b8251156109405782518084602001fd5b816040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016107649190610c76565b803573ffffffffffffffffffffffffffffffffffffffff8116811461099857600080fd5b919050565b600080600080608085870312156109b357600080fd5b6109bc85610974565b93506109ca60208601610974565b9250604085013591506109df60608601610974565b905092959194509250565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b60008060408385031215610a2c57600080fd5b610a3583610974565b9150602083013567ffffffffffffffff80821115610a5257600080fd5b818501915085601f830112610a6657600080fd5b813581811115610a7857610a786109ea565b604051601f82017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0908116603f01168101908382118183101715610abe57610abe6109ea565b81604052828152886020848701011115610ad757600080fd5b8260208601602083013760006020848301015280955050505050509250929050565b60005b83811015610b14578181015183820152602001610afc565b838111156106565750506000910152565b60008151808452610b3d816020860160208601610af9565b601f017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0169290920160200192915050565b600073ffffffffffffffffffffffffffffffffffffffff808616835280851660208401525060606040830152610ba86060830184610b25565b95945050505050565b73ffffffffffffffffffffffffffffffffffffffff831681526040602082015260006107816040830184610b25565b600060208284031215610bf257600080fd5b5051919050565b60008219821115610c33577f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b500190565b600060208284031215610c4a57600080fd5b8151801515811461078457600080fd5b60008251610c6c818460208701610af9565b9190910192915050565b6020815260006107846020830184610b2556fea2646970667358221220314a1e3672715e1c9fd64c503fc29f347e18573590a2881a1f8a69e6e8bfabd264736f6c634300080d0033", + "deployedBytecode": "0x60806040526004361061005a5760003560e01c8063a996cabb11610043578063a996cabb146100d1578063bd07018d14610105578063e6eb8ade1461013957600080fd5b8063146bf4b11461005f57806352c8c75c146100bc575b600080fd5b34801561006b57600080fd5b506100937f000000000000000000000000000000000000000000000000000000000000000081565b60405173ffffffffffffffffffffffffffffffffffffffff909116815260200160405180910390f35b6100cf6100ca36600461099d565b61014c565b005b3480156100dd57600080fd5b506100937f000000000000000000000000000000000000000000000000000000000000000081565b34801561011157600080fd5b506100937f000000000000000000000000000000000000000000000000000000000000000081565b6100cf610147366004610a19565b61043e565b7f000000000000000000000000000000000000000000000000000000000000000073ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff16036102e7576040517f2e1a7d4d000000000000000000000000000000000000000000000000000000008152600481018390527f000000000000000000000000000000000000000000000000000000000000000073ffffffffffffffffffffffffffffffffffffffff1690632e1a7d4d90602401600060405180830381600087803b15801561022757600080fd5b505af115801561023b573d6000803e3d6000fd5b50506040517f4faa8a2600000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff84811660048301527f0000000000000000000000000000000000000000000000000000000000000000169250634faa8a26915084906024016000604051808303818588803b1580156102c957600080fd5b505af11580156102dd573d6000803e3d6000fd5b50505050506103d9565b61032873ffffffffffffffffffffffffffffffffffffffff85167f000000000000000000000000000000000000000000000000000000000000000084610521565b7f000000000000000000000000000000000000000000000000000000000000000073ffffffffffffffffffffffffffffffffffffffff1663e3dec8fb82868560405160200161037991815260200190565b6040516020818303038152906040526040518463ffffffff1660e01b81526004016103a693929190610b6f565b600060405180830381600087803b1580156103c057600080fd5b505af11580156103d4573d6000803e3d6000fd5b505050505b6040805173ffffffffffffffffffffffffffffffffffffffff868116825285811660208301528183018590528316606082015290517fd7e09655439c3932e55857df3220186e5a7f0980825f20691c2b35d941dee75b9181900360800190a150505050565b6040517fb472047700000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff7f0000000000000000000000000000000000000000000000000000000000000000169063b4720477906104b29085908590600401610bb1565b600060405180830381600087803b1580156104cc57600080fd5b505af11580156104e0573d6000803e3d6000fd5b505050507f9e6c52944e331ba6270e7fe4cea2a4086bae8f7a27e1cdba07f416806f5d0ac48282604051610515929190610bb1565b60405180910390a15050565b6040517fdd62ed3e00000000000000000000000000000000000000000000000000000000815230600482015273ffffffffffffffffffffffffffffffffffffffff8381166024830152600091839186169063dd62ed3e90604401602060405180830381865afa158015610598573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906105bc9190610be0565b6105c69190610bf9565b6040805173ffffffffffffffffffffffffffffffffffffffff8616602482015260448082018490528251808303909101815260649091019091526020810180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff167f095ea7b30000000000000000000000000000000000000000000000000000000017905290915061065690859061065c565b50505050565b60006106be826040518060400160405280602081526020017f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c65648152508573ffffffffffffffffffffffffffffffffffffffff166107729092919063ffffffff16565b80519091501561076d57808060200190518101906106dc9190610c38565b61076d576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602a60248201527f5361666545524332303a204552433230206f7065726174696f6e20646964206e60448201527f6f7420737563636565640000000000000000000000000000000000000000000060648201526084015b60405180910390fd5b505050565b6060610781848460008561078b565b90505b9392505050565b60608247101561081d576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602660248201527f416464726573733a20696e73756666696369656e742062616c616e636520666f60448201527f722063616c6c00000000000000000000000000000000000000000000000000006064820152608401610764565b73ffffffffffffffffffffffffffffffffffffffff85163b61089b576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e74726163740000006044820152606401610764565b6000808673ffffffffffffffffffffffffffffffffffffffff1685876040516108c49190610c5a565b60006040518083038185875af1925050503d8060008114610901576040519150601f19603f3d011682016040523d82523d6000602084013e610906565b606091505b5091509150610916828286610921565b979650505050505050565b60608315610930575081610784565b8251156109405782518084602001fd5b816040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016107649190610c76565b803573ffffffffffffffffffffffffffffffffffffffff8116811461099857600080fd5b919050565b600080600080608085870312156109b357600080fd5b6109bc85610974565b93506109ca60208601610974565b9250604085013591506109df60608601610974565b905092959194509250565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b60008060408385031215610a2c57600080fd5b610a3583610974565b9150602083013567ffffffffffffffff80821115610a5257600080fd5b818501915085601f830112610a6657600080fd5b813581811115610a7857610a786109ea565b604051601f82017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0908116603f01168101908382118183101715610abe57610abe6109ea565b81604052828152886020848701011115610ad757600080fd5b8260208601602083013760006020848301015280955050505050509250929050565b60005b83811015610b14578181015183820152602001610afc565b838111156106565750506000910152565b60008151808452610b3d816020860160208601610af9565b601f017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0169290920160200192915050565b600073ffffffffffffffffffffffffffffffffffffffff808616835280851660208401525060606040830152610ba86060830184610b25565b95945050505050565b73ffffffffffffffffffffffffffffffffffffffff831681526040602082015260006107816040830184610b25565b600060208284031215610bf257600080fd5b5051919050565b60008219821115610c33577f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b500190565b600060208284031215610c4a57600080fd5b8151801515811461078457600080fd5b60008251610c6c818460208701610af9565b9190910192915050565b6020815260006107846020830184610b2556fea2646970667358221220314a1e3672715e1c9fd64c503fc29f347e18573590a2881a1f8a69e6e8bfabd264736f6c634300080d0033", + "devdoc": { + "details": "Public functions calling external contracts do not guard against reentrancy because they are expected to be called via delegatecall, which will execute this contract's logic within the context of the originating contract. For example, the HubPool will delegatecall these functions, therefore its only necessary that the HubPool's methods that call this contract's logic guard against reentrancy.", + "kind": "dev", + "methods": { + "constructor": { + "params": { + "_fxStateSender": "FxStateSender Polygon system helper contract.", + "_l1Weth": "WETH address on L1.", + "_rootChainManager": "RootChainManager Polygon system helper contract." + } + }, + "relayMessage(address,bytes)": { + "params": { + "message": "Data to send to target.", + "target": "Contract on Polygon that will receive message." + } + }, + "relayTokens(address,address,uint256,address)": { + "params": { + "amount": "Amount of L1 tokens to deposit and L2 tokens to receive.", + "l1Token": "L1 token to deposit.", + "l2Token": "L2 token to receive.", + "to": "Bridge recipient." + } + } + }, + "version": 1 + }, + "userdoc": { + "kind": "user", + "methods": { + "constructor": { + "notice": "Constructs new Adapter." + }, + "relayMessage(address,bytes)": { + "notice": "Send cross-chain message to target on Polygon." + }, + "relayTokens(address,address,uint256,address)": { + "notice": "Bridge tokens to Polygon." + } + }, + "notice": "Sends cross chain messages Polygon L2 network.", + "version": 1 + }, + "storageLayout": { + "storage": [], + "types": null + } +} diff --git a/deployments/kovan/solcInputs/abccea57e702a2494fadb0e94bc8fd72.json b/deployments/kovan/solcInputs/2fe6c4b637a440a1380be3adbf7d9e12.json similarity index 61% rename from deployments/kovan/solcInputs/abccea57e702a2494fadb0e94bc8fd72.json rename to deployments/kovan/solcInputs/2fe6c4b637a440a1380be3adbf7d9e12.json index 2a89f5d2d..582dc2eab 100644 --- a/deployments/kovan/solcInputs/abccea57e702a2494fadb0e94bc8fd72.json +++ b/deployments/kovan/solcInputs/2fe6c4b637a440a1380be3adbf7d9e12.json @@ -2,22 +2,19 @@ "language": "Solidity", "sources": { "contracts/HubPool.sol": { - "content": "// SPDX-License-Identifier: GPL-3.0-only\npragma solidity ^0.8.0;\n\nimport \"./MerkleLib.sol\";\nimport \"./HubPoolInterface.sol\";\nimport \"./Lockable.sol\";\n\nimport \"./interfaces/AdapterInterface.sol\";\nimport \"./interfaces/LpTokenFactoryInterface.sol\";\nimport \"./interfaces/WETH9.sol\";\n\nimport \"@uma/core/contracts/common/implementation/Testable.sol\";\nimport \"@uma/core/contracts/common/implementation/MultiCaller.sol\";\nimport \"@uma/core/contracts/oracle/implementation/Constants.sol\";\nimport \"@uma/core/contracts/common/implementation/AncillaryData.sol\";\nimport \"@uma/core/contracts/common/interfaces/AddressWhitelistInterface.sol\";\nimport \"@uma/core/contracts/oracle/interfaces/IdentifierWhitelistInterface.sol\";\n\nimport \"@uma/core/contracts/oracle/interfaces/FinderInterface.sol\";\nimport \"@uma/core/contracts/oracle/interfaces/StoreInterface.sol\";\nimport \"@uma/core/contracts/oracle/interfaces/SkinnyOptimisticOracleInterface.sol\";\nimport \"@uma/core/contracts/common/interfaces/ExpandedIERC20.sol\";\n\nimport \"@openzeppelin/contracts/access/Ownable.sol\";\nimport \"@openzeppelin/contracts/token/ERC20/IERC20.sol\";\nimport \"@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol\";\nimport \"@openzeppelin/contracts/utils/Address.sol\";\n\n/**\n * @notice Contract deployed on Ethereum that houses L1 token liquidity for all SpokePools. A dataworker can interact\n * with merkle roots stored in this contract via inclusion proofs to instruct this contract to send tokens to L2\n * SpokePools via \"pool rebalances\" that can be used to pay out relayers on those networks. This contract is also\n * responsible for publishing relayer refund and slow relay merkle roots to SpokePools.\n * @notice This contract is meant to act as the cross chain administrator and owner of all L2 spoke pools, so all\n * governance actions and pool rebalances originate from here and bridge instructions to L2s.\n */\ncontract HubPool is HubPoolInterface, Testable, Lockable, MultiCaller, Ownable {\n using SafeERC20 for IERC20;\n using Address for address;\n\n // A data worker can optimistically store several merkle roots on this contract by staking a bond and calling\n // proposeRootBundle. By staking a bond, the data worker is alleging that the merkle roots all\n // contain valid leaves that can be executed later to:\n // - Send funds from this contract to a SpokePool or vice versa\n // - Send funds from a SpokePool to Relayer as a refund for a relayed deposit\n // - Send funds from a SpokePool to a deposit recipient to fulfill a \"slow\" relay\n // Anyone can dispute this struct if the merkle roots contain invalid leaves before the\n // requestExpirationTimestamp. Once the expiration timestamp is passed, executeRootBundle to execute a leaf\n // from the poolRebalanceRoot on this contract and it will simultaneously publish the relayerRefundRoot and\n // slowRelayRoot to a SpokePool. The latter two roots, once published to the SpokePool, contain\n // leaves that can be executed on the SpokePool to pay relayers or recipients.\n struct RootBundle {\n // Contains leaves instructing this contract to send funds to SpokePools.\n bytes32 poolRebalanceRoot;\n // Relayer refund merkle root to be published to a SpokePool.\n bytes32 relayerRefundRoot;\n // Slow relay merkle root to be published to a SpokePool.\n bytes32 slowRelayRoot;\n // This is a 1D bitmap, with max size of 256 elements, limiting us to 256 chainsIds.\n uint256 claimedBitMap;\n // Proposer of this root bundle.\n address proposer;\n // Whether bond has been repaid to successful root bundle proposer.\n bool proposerBondRepaid;\n // Number of pool rebalance leaves to execute in the poolRebalanceRoot. After this number\n // of leaves are executed, a new root bundle can be proposed\n uint8 unclaimedPoolRebalanceLeafCount;\n // When root bundle challenge period passes and this root bundle becomes executable.\n uint32 requestExpirationTimestamp;\n }\n\n // Only one root bundle can be stored at a time. Once all pool rebalance leaves are executed, a new proposal\n // can be submitted.\n RootBundle public rootBundleProposal;\n\n // Whitelist of origin token + ID to destination token routings to be used by off-chain agents. The notion of a\n // route does not need to include L1; it can be L2->L2 route. i.e USDC on Arbitrum -> USDC on Optimism as a \"route\".\n mapping(bytes32 => address) private whitelistedRoutes;\n\n struct PooledToken {\n // LP token given to LPs of a specific L1 token.\n address lpToken;\n // True if accepting new LP's.\n bool isEnabled;\n // Timestamp of last LP fee update.\n uint32 lastLpFeeUpdate;\n // Number of LP funds sent via pool rebalances to SpokePools and are expected to be sent\n // back later.\n int256 utilizedReserves;\n // Number of LP funds held in contract less utilized reserves.\n uint256 liquidReserves;\n // Number of LP funds reserved to pay out to LPs as fees.\n uint256 undistributedLpFees;\n }\n\n // Mapping of L1 token addresses to the associated pool information.\n mapping(address => PooledToken) public pooledTokens;\n\n // Heler contracts to facilitate cross chain actions between HubPool and SpokePool for a specific network.\n struct CrossChainContract {\n AdapterInterface adapter;\n address spokePool;\n }\n // Mapping of chainId to the associated adapter and spokePool contracts.\n mapping(uint256 => CrossChainContract) public crossChainContracts;\n\n // WETH contract for Ethereum.\n WETH9 public weth;\n\n // Helper factory to deploy new LP tokens for enabled L1 tokens\n LpTokenFactoryInterface public lpTokenFactory;\n\n // Finder contract for this network.\n FinderInterface public finder;\n\n // When root bundles are disputed a price request is enqueued with the DVM to resolve the resolution.\n bytes32 public identifier = \"IS_ACROSS_V2_BUNDLE_VALID\";\n\n // Interest rate payment that scales the amount of pending fees per second paid to LPs. 0.0000015e18 will pay out\n // the full amount of fees entitled to LPs in ~ 7.72 days, just over the standard L2 7 day liveness.\n uint256 public lpFeeRatePerSecond = 1500000000000;\n\n mapping(address => uint256) public unclaimedAccumulatedProtocolFees;\n\n // Address that captures protocol fees. Accumulated protocol fees can be claimed by this address.\n address public protocolFeeCaptureAddress;\n\n // Percentage of lpFees that are captured by the protocol and claimable by the protocolFeeCaptureAddress.\n uint256 public protocolFeeCapturePct;\n\n // Token used to bond the data worker for proposing relayer refund bundles.\n IERC20 public bondToken;\n\n // The computed bond amount as the UMA Store's final fee multiplied by the bondTokenFinalFeeMultiplier.\n uint256 public bondAmount;\n\n // Each root bundle proposal must stay in liveness for this period of time before it can be considered finalized.\n // It can be disputed only during this period of time. Defaults to 2 hours, like the rest of the UMA ecosystem.\n uint32 public liveness = 7200;\n\n event ProtocolFeeCaptureSet(address indexed newProtocolFeeCaptureAddress, uint256 indexed newProtocolFeeCapturePct);\n\n event ProtocolFeesCapturedClaimed(address indexed l1Token, uint256 indexed accumulatedFees);\n\n event BondSet(address indexed newBondToken, uint256 newBondAmount);\n\n event LivenessSet(uint256 newLiveness);\n\n event IdentifierSet(bytes32 newIdentifier);\n\n event CrossChainContractsSet(uint256 l2ChainId, address adapter, address spokePool);\n\n event L1TokenEnabledForLiquidityProvision(address l1Token, address lpToken);\n\n event L2TokenDisabledForLiquidityProvision(address l1Token, address lpToken);\n\n event LiquidityAdded(\n address indexed l1Token,\n uint256 amount,\n uint256 lpTokensMinted,\n address indexed liquidityProvider\n );\n event LiquidityRemoved(\n address indexed l1Token,\n uint256 amount,\n uint256 lpTokensBurnt,\n address indexed liquidityProvider\n );\n event WhitelistRoute(\n uint256 indexed originChainId,\n uint256 indexed destinationChainId,\n address indexed originToken,\n address destinationToken,\n bool enableRoute\n );\n\n event ProposeRootBundle(\n uint32 requestExpirationTimestamp,\n uint64 unclaimedPoolRebalanceLeafCount,\n uint256[] bundleEvaluationBlockNumbers,\n bytes32 indexed poolRebalanceRoot,\n bytes32 indexed relayerRefundRoot,\n bytes32 slowRelayRoot,\n address indexed proposer\n );\n event RootBundleExecuted(\n uint256 indexed leafId,\n uint256 indexed chainId,\n address[] l1Token,\n uint256[] bundleLpFees,\n int256[] netSendAmount,\n int256[] runningBalance,\n address indexed caller\n );\n event SpokePoolAdminFunctionTriggered(uint256 indexed chainId, bytes message);\n\n event RootBundleDisputed(address indexed disputer, uint256 requestTime, bytes disputedAncillaryData);\n\n event RootBundleCanceled(address indexed disputer, uint256 requestTime, bytes disputedAncillaryData);\n\n modifier noActiveRequests() {\n require(!_activeRequest(), \"proposal has unclaimed leafs\");\n _;\n }\n\n modifier zeroOptimisticOracleApproval() {\n _;\n bondToken.safeApprove(address(_getOptimisticOracle()), 0);\n }\n\n /**\n * @notice Construct HubPool.\n * @param _lpTokenFactory LP Token factory address used to deploy LP tokens for new collateral types.\n * @param _finder Finder address.\n * @param _weth WETH address.\n * @param _timer Timer address.\n */\n constructor(\n LpTokenFactoryInterface _lpTokenFactory,\n FinderInterface _finder,\n WETH9 _weth,\n address _timer\n ) Testable(_timer) {\n lpTokenFactory = _lpTokenFactory;\n finder = _finder;\n weth = _weth;\n protocolFeeCaptureAddress = owner();\n }\n\n /*************************************************\n * ADMIN FUNCTIONS *\n *************************************************/\n\n /**\n * @notice Sends message to SpokePool from this contract. Callable only by owner.\n * @dev This function has permission to call onlyAdmin functions on the SpokePool, so its imperative\n * that this contract only allows the owner to call this method directly or indirectly.\n * @param chainId Chain with SpokePool to send message to.\n * @param functionData ABI encoded function call to send to SpokePool, but can be any arbitrary data technically.\n */\n function relaySpokePoolAdminFunction(uint256 chainId, bytes memory functionData)\n public\n override\n onlyOwner\n nonReentrant\n {\n _relaySpokePoolAdminFunction(chainId, functionData);\n }\n\n /**\n * @notice Sets protocolFeeCaptureAddress and protocolFeeCapturePct. Callable only by owner.\n * @param newProtocolFeeCaptureAddress New protocol fee capture address.\n * @param newProtocolFeeCapturePct New protocol fee capture %.\n */\n function setProtocolFeeCapture(address newProtocolFeeCaptureAddress, uint256 newProtocolFeeCapturePct)\n public\n override\n onlyOwner\n {\n require(newProtocolFeeCapturePct <= 1e18, \"Bad protocolFeeCapturePct\");\n protocolFeeCaptureAddress = newProtocolFeeCaptureAddress;\n protocolFeeCapturePct = newProtocolFeeCapturePct;\n emit ProtocolFeeCaptureSet(newProtocolFeeCaptureAddress, newProtocolFeeCapturePct);\n }\n\n /**\n * @notice Sets bond token and amount. Callable only by owner.\n * @param newBondToken New bond currency.\n * @param newBondAmount New bond amount.\n */\n function setBond(IERC20 newBondToken, uint256 newBondAmount)\n public\n override\n onlyOwner\n noActiveRequests\n nonReentrant\n {\n // Check that this token is on the whitelist.\n AddressWhitelistInterface addressWhitelist = AddressWhitelistInterface(\n finder.getImplementationAddress(OracleInterfaces.CollateralWhitelist)\n );\n require(addressWhitelist.isOnWhitelist(address(newBondToken)), \"Not on whitelist\");\n\n // The bond should be the passed in bondAmount + the final fee.\n bondToken = newBondToken;\n bondAmount = newBondAmount + _getBondTokenFinalFee();\n emit BondSet(address(newBondToken), bondAmount);\n }\n\n /**\n * @notice Sets root bundle proposal liveness period. Callable only by owner.\n * @param newLiveness New liveness period.\n */\n function setLiveness(uint32 newLiveness) public override onlyOwner {\n require(newLiveness > 10 minutes, \"Liveness too short\");\n liveness = newLiveness;\n emit LivenessSet(newLiveness);\n }\n\n /**\n * @notice Sets identifier for root bundle disputes.. Callable only by owner.\n * @param newIdentifier New identifier.\n */\n function setIdentifier(bytes32 newIdentifier) public override onlyOwner noActiveRequests nonReentrant {\n IdentifierWhitelistInterface identifierWhitelist = IdentifierWhitelistInterface(\n finder.getImplementationAddress(OracleInterfaces.IdentifierWhitelist)\n );\n require(identifierWhitelist.isIdentifierSupported(newIdentifier), \"Identifier not supported\");\n identifier = newIdentifier;\n emit IdentifierSet(newIdentifier);\n }\n\n /**\n * @notice Sets cross chain relay helper contracts for L2 chain ID. Callable only by owner.\n * @param l2ChainId Chain to set contracts for.\n * @param adapter Adapter used to relay messages and tokens to spoke pool.\n * @param spokePool Recipient of relayed messages and tokens on SpokePool.\n */\n\n function setCrossChainContracts(\n uint256 l2ChainId,\n address adapter,\n address spokePool\n ) public override onlyOwner {\n crossChainContracts[l2ChainId] = CrossChainContract(AdapterInterface(adapter), spokePool);\n emit CrossChainContractsSet(l2ChainId, adapter, spokePool);\n }\n\n /**\n * @notice Whitelist an origin chain ID + token <-> destination token route. Callable only by owner.\n * @param originChainId Chain where deposit occurs.\n * @param destinationChainId Chain where depositor wants to receive funds.\n * @param originToken Deposited token.\n * @param destinationToken Token that depositor wants to receive on destination chain. Unused if `enableRoute` is\n * False.\n * @param enableRoute Set to true to enable route on L2 and whitelist new destination token, or False to disable\n * route on L2 and delete destination token mapping on this contract.\n */\n function whitelistRoute(\n uint256 originChainId,\n uint256 destinationChainId,\n address originToken,\n address destinationToken,\n bool enableRoute\n ) public override onlyOwner nonReentrant {\n if (enableRoute)\n whitelistedRoutes[_whitelistedRouteKey(originChainId, originToken, destinationChainId)] = destinationToken;\n else delete whitelistedRoutes[_whitelistedRouteKey(originChainId, originToken, destinationChainId)];\n\n // Whitelist the same route on the origin network.\n _relaySpokePoolAdminFunction(\n originChainId,\n abi.encodeWithSignature(\n \"setEnableRoute(address,uint256,bool)\",\n originToken,\n destinationChainId,\n enableRoute\n )\n );\n\n // @dev Client should ignore `destinationToken` value if `enableRoute == False`.\n emit WhitelistRoute(originChainId, destinationChainId, originToken, destinationToken, enableRoute);\n }\n\n /**\n * @notice Enables LPs to provide liquidity for L1 token. Deploys new LP token for L1 token if appropriate.\n * Callable only by owner.\n * @param l1Token Token to provide liquidity for.\n */\n function enableL1TokenForLiquidityProvision(address l1Token) public override onlyOwner nonReentrant {\n if (pooledTokens[l1Token].lpToken == address(0))\n pooledTokens[l1Token].lpToken = lpTokenFactory.createLpToken(l1Token);\n\n pooledTokens[l1Token].isEnabled = true;\n pooledTokens[l1Token].lastLpFeeUpdate = uint32(getCurrentTime());\n\n emit L1TokenEnabledForLiquidityProvision(l1Token, pooledTokens[l1Token].lpToken);\n }\n\n /**\n * @notice Disables LPs from providing liquidity for L1 token. Callable only by owner.\n * @param l1Token Token to disable liquidity provision for.\n */\n function disableL1TokenForLiquidityProvision(address l1Token) public override onlyOwner {\n pooledTokens[l1Token].isEnabled = false;\n emit L2TokenDisabledForLiquidityProvision(l1Token, pooledTokens[l1Token].lpToken);\n }\n\n /*************************************************\n * LIQUIDITY PROVIDER FUNCTIONS *\n *************************************************/\n\n /**\n * @notice Deposit liquidity into this contract to earn LP fees in exchange for funding relays on SpokePools.\n * Caller is essentially loaning their funds to be sent from this contract to the SpokePool, where it will be used\n * to repay a relayer, and ultimately receives their loan back after the tokens are bridged back to this contract\n * via the canonical token bridge. Then, the caller's loans are used for again. This loan cycle repeats continuously\n * and the caller, or \"liquidity provider\" earns a continuous fee for their credit that they are extending relayers.\n * @notice Caller will receive an LP token representing their share of this pool. The LP token's redemption value\n * increments from the time that they enter the pool to reflect their accrued fees.\n * @param l1Token Token to deposit into this contract.\n * @param l1TokenAmount Amount of liquidity to provide.\n */\n function addLiquidity(address l1Token, uint256 l1TokenAmount) public payable override nonReentrant {\n require(pooledTokens[l1Token].isEnabled, \"Token not enabled\");\n // If this is the weth pool and the caller sends msg.value then the msg.value must match the l1TokenAmount.\n // Else, msg.value must be set to 0.\n require(((address(weth) == l1Token) && msg.value == l1TokenAmount) || msg.value == 0, \"Bad msg.value\");\n\n // Since _exchangeRateCurrent() reads this contract's balance and updates contract state using it, it must be\n // first before transferring any tokens to this contract to ensure synchronization.\n uint256 lpTokensToMint = (l1TokenAmount * 1e18) / _exchangeRateCurrent(l1Token);\n ExpandedIERC20(pooledTokens[l1Token].lpToken).mint(msg.sender, lpTokensToMint);\n pooledTokens[l1Token].liquidReserves += l1TokenAmount;\n\n if (address(weth) == l1Token && msg.value > 0) WETH9(address(l1Token)).deposit{ value: msg.value }();\n else IERC20(l1Token).safeTransferFrom(msg.sender, address(this), l1TokenAmount);\n\n emit LiquidityAdded(l1Token, l1TokenAmount, lpTokensToMint, msg.sender);\n }\n\n /**\n * @notice Burns LP share to redeem for underlying l1Token original deposit amount plus fees.\n * @param l1Token Token to redeem LP share for.\n * @param lpTokenAmount Amount of LP tokens to burn. Exchange rate between L1 token and LP token can be queried\n * via public exchangeRateCurrent method.\n * @param sendEth Set to True if L1 token is WETH and user wants to receive ETH.\n */\n function removeLiquidity(\n address l1Token,\n uint256 lpTokenAmount,\n bool sendEth\n ) public override nonReentrant {\n require(address(weth) == l1Token || !sendEth, \"Cant send eth\");\n uint256 l1TokensToReturn = (lpTokenAmount * _exchangeRateCurrent(l1Token)) / 1e18;\n\n ExpandedIERC20(pooledTokens[l1Token].lpToken).burnFrom(msg.sender, lpTokenAmount);\n // Note this method does not make any liquidity utilization checks before letting the LP redeem their LP tokens.\n // If they try access more funds that available (i.e l1TokensToReturn > liquidReserves) this will underflow.\n pooledTokens[l1Token].liquidReserves -= l1TokensToReturn;\n\n if (sendEth) _unwrapWETHTo(payable(msg.sender), l1TokensToReturn);\n else IERC20(l1Token).safeTransfer(msg.sender, l1TokensToReturn);\n\n emit LiquidityRemoved(l1Token, l1TokensToReturn, lpTokenAmount, msg.sender);\n }\n\n /**\n * @notice Returns exchange rate of L1 token to LP token.\n * @param l1Token L1 token redeemable by burning LP token.\n * @return Amount of L1 tokens redeemable for 1 unit LP token.\n */\n function exchangeRateCurrent(address l1Token) public override nonReentrant returns (uint256) {\n return _exchangeRateCurrent(l1Token);\n }\n\n /**\n * @notice Returns % of liquid reserves currently being \"used\" and sitting in SpokePools.\n * @param l1Token L1 token to query utilization for.\n * @return % of liquid reserves currently being \"used\" and sitting in SpokePools.\n */\n function liquidityUtilizationCurrent(address l1Token) public override nonReentrant returns (uint256) {\n return _liquidityUtilizationPostRelay(l1Token, 0);\n }\n\n /**\n * @notice Returns % of liquid reserves currently being \"used\" and sitting in SpokePools and accounting for\n * relayedAmount of tokens to be withdrawn from the pool.\n * @param l1Token L1 token to query utilization for.\n * @param relayedAmount The higher this amount, the higher the utilization.\n * @return % of liquid reserves currently being \"used\" and sitting in SpokePools plus the relayedAmount.\n */\n function liquidityUtilizationPostRelay(address l1Token, uint256 relayedAmount)\n public\n nonReentrant\n returns (uint256)\n {\n return _liquidityUtilizationPostRelay(l1Token, relayedAmount);\n }\n\n /**\n * @notice Synchronize any balance changes in this contract with the utilized & liquid reserves. This should be done\n * at the conclusion of a L2->L1 token transfer via the canonical token bridge, when this contract's reserves do not\n * reflect its true balance due to new tokens being dropped onto the contract at the conclusion of a bridging action.\n */\n function sync(address l1Token) public override nonReentrant {\n _sync(l1Token);\n }\n\n /*************************************************\n * DATA WORKER FUNCTIONS *\n *************************************************/\n\n /**\n * @notice Publish a new root bundle to along with all of the block numbers that the merkle roots are relevant for.\n * This is used to aid off-chain validators in evaluating the correctness of this bundle. Caller stakes a bond that\n * can be slashed if the root bundle proposal is invalid, and they will receive it back if accepted.\n * @notice After proposeRootBundle is called, if the any props are wrong then this proposal can be challenged.\n * Once the challenge period passes, then the roots are no longer disputable, and only executeRootBundle can be\n * called; moreover, this method can't be called again until all leafs are executed.\n * @param bundleEvaluationBlockNumbers should contain the latest block number for all chains, even if there are no\n * relays contained on some of them. The usage of this variable should be defined in an off chain UMIP.\n * @param poolRebalanceLeafCount Number of leaves contained in pool rebalance root. Max is the number of whitelisted chains.\n * @param poolRebalanceRoot Pool rebalance root containing leaves that will send tokens from this contract to a SpokePool.\n * @param relayerRefundRoot Relayer refund root to publish to SpokePool where a data worker can execute leaves to\n * refund relayers on their chosen refund chainId.\n * @param slowRelayRoot Slow relay root to publish to Spoke Pool where a data worker can execute leaves to\n * fulfill slow relays.\n */\n function proposeRootBundle(\n uint256[] memory bundleEvaluationBlockNumbers,\n uint8 poolRebalanceLeafCount,\n bytes32 poolRebalanceRoot,\n bytes32 relayerRefundRoot,\n bytes32 slowRelayRoot\n ) public override nonReentrant noActiveRequests {\n // Note: this is to prevent \"empty block\" style attacks where someone can make empty proposals that are\n // technically valid but not useful. This could also potentially be enforced at the UMIP-level.\n require(poolRebalanceLeafCount > 0, \"Bundle must have at least 1 leaf\");\n\n uint32 requestExpirationTimestamp = uint32(getCurrentTime()) + liveness;\n\n delete rootBundleProposal; // Only one bundle of roots can be executed at a time.\n\n rootBundleProposal.requestExpirationTimestamp = requestExpirationTimestamp;\n rootBundleProposal.unclaimedPoolRebalanceLeafCount = poolRebalanceLeafCount;\n rootBundleProposal.poolRebalanceRoot = poolRebalanceRoot;\n rootBundleProposal.relayerRefundRoot = relayerRefundRoot;\n rootBundleProposal.slowRelayRoot = slowRelayRoot;\n rootBundleProposal.proposer = msg.sender;\n\n // Pull bondAmount of bondToken from the caller.\n bondToken.safeTransferFrom(msg.sender, address(this), bondAmount);\n\n emit ProposeRootBundle(\n requestExpirationTimestamp,\n poolRebalanceLeafCount,\n bundleEvaluationBlockNumbers,\n poolRebalanceRoot,\n relayerRefundRoot,\n slowRelayRoot,\n msg.sender\n );\n }\n\n /**\n * @notice Executes a pool rebalance leaf as part of the currently published root bundle. Will bridge any tokens\n * from this contract to the SpokePool designated in the leaf, and will also publish relayer refund and slow\n * relay roots to the SpokePool on the network specified in the leaf.\n * @dev In some cases, will instruct spokePool to send funds back to L1.\n * @notice Deletes the published root bundle if this is the last leaf to be executed in the root bundle.\n * @param poolRebalanceLeaf Contains all data neccessary to reconstruct leaf contained in root bundle and to\n * bridge tokens to HubPool. This data structure is explained in detail in the HubPoolInterface.\n * @param proof Inclusion proof for this leaf in pool rebalance root in root bundle.\n */\n function executeRootBundle(PoolRebalanceLeaf memory poolRebalanceLeaf, bytes32[] memory proof) public nonReentrant {\n require(getCurrentTime() > rootBundleProposal.requestExpirationTimestamp, \"Not passed liveness\");\n\n // Verify the leafId in the poolRebalanceLeaf has not yet been claimed.\n require(!MerkleLib.isClaimed1D(rootBundleProposal.claimedBitMap, poolRebalanceLeaf.leafId), \"Already claimed\");\n\n // Verify the props provided generate a leaf that, along with the proof, are included in the merkle root.\n require(\n MerkleLib.verifyPoolRebalance(rootBundleProposal.poolRebalanceRoot, poolRebalanceLeaf, proof),\n \"Bad Proof\"\n );\n\n // Before interacting with a particular chain's adapter, ensure that the adapter is set.\n require(address(crossChainContracts[poolRebalanceLeaf.chainId].adapter) != address(0), \"No adapter for chain\");\n\n // Make sure SpokePool address is initialized since _sendTokensToChainAndUpdatePooledTokenTrackers() will not\n // revert if its accidentally set to address(0). We don't make the same check on the adapter for this\n // chainId because the internal method's delegatecall() to the adapter will revert if its address is set\n // incorrectly.\n address spokePool = crossChainContracts[poolRebalanceLeaf.chainId].spokePool;\n require(spokePool != address(0), \"Uninitialized spoke pool\");\n\n // Set the leafId in the claimed bitmap.\n rootBundleProposal.claimedBitMap = MerkleLib.setClaimed1D(\n rootBundleProposal.claimedBitMap,\n poolRebalanceLeaf.leafId\n );\n\n // Decrement the unclaimedPoolRebalanceLeafCount.\n rootBundleProposal.unclaimedPoolRebalanceLeafCount--;\n\n _sendTokensToChainAndUpdatePooledTokenTrackers(\n spokePool,\n poolRebalanceLeaf.chainId,\n poolRebalanceLeaf.l1Tokens,\n poolRebalanceLeaf.netSendAmounts,\n poolRebalanceLeaf.bundleLpFees\n );\n _relayRootBundleToSpokePool(spokePool, poolRebalanceLeaf.chainId);\n\n // Transfer the bondAmount to back to the proposer, if this the last executed leaf. Only sending this once all\n // leafs have been executed acts to force the data worker to execute all bundles or they wont receive their bond.\n if (rootBundleProposal.unclaimedPoolRebalanceLeafCount == 0)\n bondToken.safeTransfer(rootBundleProposal.proposer, bondAmount);\n\n emit RootBundleExecuted(\n poolRebalanceLeaf.leafId,\n poolRebalanceLeaf.chainId,\n poolRebalanceLeaf.l1Tokens,\n poolRebalanceLeaf.bundleLpFees,\n poolRebalanceLeaf.netSendAmounts,\n poolRebalanceLeaf.runningBalances,\n msg.sender\n );\n }\n\n /**\n * @notice Caller stakes a bond to dispute the current root bundle proposal assuming it has not passed liveness\n * yet. The proposal is deleted, allowing a follow-up proposal to be submitted, and the dispute is sent to the\n * optimistic oracle to be adjudicated. Can only be called within the liveness period of the current proposal.\n */\n function disputeRootBundle() public nonReentrant zeroOptimisticOracleApproval {\n uint32 currentTime = uint32(getCurrentTime());\n require(currentTime <= rootBundleProposal.requestExpirationTimestamp, \"Request passed liveness\");\n\n // Request price from OO and dispute it.\n bytes memory requestAncillaryData = getRootBundleProposalAncillaryData();\n uint256 finalFee = _getBondTokenFinalFee();\n\n // If the finalFee is larger than the bond amount, the bond amount needs to be reset before a request can go\n // through. Cancel to avoid a revert.\n if (finalFee > bondAmount) {\n _cancelBundle(requestAncillaryData);\n return;\n }\n\n SkinnyOptimisticOracleInterface optimisticOracle = _getOptimisticOracle();\n\n // Only approve exact tokens to avoid more tokens than expected being pulled into the OptimisticOracle.\n bondToken.safeIncreaseAllowance(address(optimisticOracle), bondAmount);\n try\n optimisticOracle.requestAndProposePriceFor(\n identifier,\n currentTime,\n requestAncillaryData,\n bondToken,\n // Set reward to 0, since we'll settle proposer reward payouts directly from this contract after a root\n // proposal has passed the challenge period.\n 0,\n // Set the Optimistic oracle proposer bond for the price request.\n bondAmount - finalFee,\n // Set the Optimistic oracle liveness for the price request.\n liveness,\n rootBundleProposal.proposer,\n // Canonical value representing \"True\"; i.e. the proposed relay is valid.\n int256(1e18)\n )\n returns (uint256) {\n // Ensure that approval == 0 after the call so the increaseAllowance call below doesn't allow more tokens\n // to transfer than intended.\n bondToken.safeApprove(address(optimisticOracle), 0);\n } catch {\n // Cancel the bundle since the proposal failed.\n _cancelBundle(requestAncillaryData);\n return;\n }\n\n // Dispute the request that we just sent.\n SkinnyOptimisticOracleInterface.Request memory ooPriceRequest = SkinnyOptimisticOracleInterface.Request({\n proposer: rootBundleProposal.proposer,\n disputer: address(0),\n currency: bondToken,\n settled: false,\n proposedPrice: int256(1e18),\n resolvedPrice: 0,\n expirationTime: currentTime + liveness,\n reward: 0,\n finalFee: finalFee,\n bond: bondAmount - finalFee,\n customLiveness: liveness\n });\n\n bondToken.safeTransferFrom(msg.sender, address(this), bondAmount);\n bondToken.safeIncreaseAllowance(address(optimisticOracle), bondAmount);\n optimisticOracle.disputePriceFor(\n identifier,\n currentTime,\n requestAncillaryData,\n ooPriceRequest,\n msg.sender,\n address(this)\n );\n\n emit RootBundleDisputed(msg.sender, currentTime, requestAncillaryData);\n\n // Finally, delete the state pertaining to the active proposal so that another proposer can submit a new bundle.\n delete rootBundleProposal;\n }\n\n /**\n * @notice Send unclaimed accumulated protocol fees to fee capture address.\n * @param l1Token Token whose protocol fees the caller wants to disburse.\n */\n function claimProtocolFeesCaptured(address l1Token) public override nonReentrant {\n IERC20(l1Token).safeTransfer(protocolFeeCaptureAddress, unclaimedAccumulatedProtocolFees[l1Token]);\n emit ProtocolFeesCapturedClaimed(l1Token, unclaimedAccumulatedProtocolFees[l1Token]);\n unclaimedAccumulatedProtocolFees[l1Token] = 0;\n }\n\n /**\n * @notice Returns ancillary data containing all relevant root bundle data that voters can format into UTF8 and\n * use to determine if the root bundle proposal is valid.\n * @return ancillaryData Ancillary data that can be decoded into UTF8.\n */\n function getRootBundleProposalAncillaryData() public view override returns (bytes memory ancillaryData) {\n ancillaryData = AncillaryData.appendKeyValueUint(\n \"\",\n \"requestExpirationTimestamp\",\n rootBundleProposal.requestExpirationTimestamp\n );\n\n ancillaryData = AncillaryData.appendKeyValueUint(\n ancillaryData,\n \"unclaimedPoolRebalanceLeafCount\",\n rootBundleProposal.unclaimedPoolRebalanceLeafCount\n );\n ancillaryData = AncillaryData.appendKeyValueBytes32(\n ancillaryData,\n \"poolRebalanceRoot\",\n rootBundleProposal.poolRebalanceRoot\n );\n ancillaryData = AncillaryData.appendKeyValueBytes32(\n ancillaryData,\n \"relayerRefundRoot\",\n rootBundleProposal.relayerRefundRoot\n );\n ancillaryData = AncillaryData.appendKeyValueBytes32(\n ancillaryData,\n \"slowRelayRoot\",\n rootBundleProposal.slowRelayRoot\n );\n ancillaryData = AncillaryData.appendKeyValueUint(\n ancillaryData,\n \"claimedBitMap\",\n rootBundleProposal.claimedBitMap\n );\n ancillaryData = AncillaryData.appendKeyValueAddress(ancillaryData, \"proposer\", rootBundleProposal.proposer);\n }\n\n /**\n * @notice Conveniently queries whether an origin chain + token => destination chain ID is whitelisted and returns\n * the whitelisted destination token.\n * @param originChainId Deposit chain.\n * @param originToken Deposited token.\n * @param destinationChainId Where depositor can receive funds.\n * @return address Depositor can receive this token on destination chain ID.\n */\n function whitelistedRoute(\n uint256 originChainId,\n address originToken,\n uint256 destinationChainId\n ) public view override returns (address) {\n return whitelistedRoutes[_whitelistedRouteKey(originChainId, originToken, destinationChainId)];\n }\n\n /**\n * @notice This function allows a caller to load the contract with raw ETH to perform L2 calls. This is needed for arbitrum\n * calls, but may also be needed for others.\n */\n function loadEthForL2Calls() public payable override {}\n\n /*************************************************\n * INTERNAL FUNCTIONS *\n *************************************************/\n\n // Called when a dispute fails due to parameter changes. This effectively resets the state and cancels the request\n // with no loss of funds, thereby enabling a new bundle to be added.\n function _cancelBundle(bytes memory ancillaryData) internal {\n bondToken.transfer(rootBundleProposal.proposer, bondAmount);\n delete rootBundleProposal;\n emit RootBundleCanceled(msg.sender, getCurrentTime(), ancillaryData);\n }\n\n // Unwraps ETH and does a transfer to a recipient address. If the recipient is a smart contract then sends WETH.\n function _unwrapWETHTo(address payable to, uint256 amount) internal {\n if (address(to).isContract()) {\n IERC20(address(weth)).safeTransfer(to, amount);\n } else {\n weth.withdraw(amount);\n to.transfer(amount);\n }\n }\n\n function _getOptimisticOracle() internal view returns (SkinnyOptimisticOracleInterface) {\n return\n SkinnyOptimisticOracleInterface(finder.getImplementationAddress(OracleInterfaces.SkinnyOptimisticOracle));\n }\n\n function _getBondTokenFinalFee() internal view returns (uint256) {\n return\n StoreInterface(finder.getImplementationAddress(OracleInterfaces.Store))\n .computeFinalFee(address(bondToken))\n .rawValue;\n }\n\n // Note this method does a lot and wraps together the sending of tokens and updating the pooled token trackers. This\n // is done as a gas saving so we don't need to iterate over the l1Tokens multiple times.\n function _sendTokensToChainAndUpdatePooledTokenTrackers(\n address spokePool,\n uint256 chainId,\n address[] memory l1Tokens,\n int256[] memory netSendAmounts,\n uint256[] memory bundleLpFees\n ) internal {\n AdapterInterface adapter = crossChainContracts[chainId].adapter;\n\n for (uint32 i = 0; i < l1Tokens.length; i++) {\n address l1Token = l1Tokens[i];\n // Validate the L1 -> L2 token route is whitelisted. If it is not then the output of the bridging action\n // could send tokens to the 0x0 address on the L2.\n address l2Token = whitelistedRoutes[_whitelistedRouteKey(block.chainid, l1Token, chainId)];\n require(l2Token != address(0), \"Route not whitelisted\");\n\n // If the net send amount for this token is positive then: 1) send tokens from L1->L2 to facilitate the L2\n // relayer refund, 2) Update the liquidity trackers for the associated pooled tokens.\n if (netSendAmounts[i] > 0) {\n // Perform delegatecall to use the adapter's code with this contract's context. Opt for delegatecall's\n // complexity in exchange for lower gas costs.\n (bool success, ) = address(adapter).delegatecall(\n abi.encodeWithSignature(\n \"relayTokens(address,address,uint256,address)\",\n l1Token, // l1Token.\n l2Token, // l2Token.\n uint256(netSendAmounts[i]), // amount.\n spokePool // to. This should be the spokePool.\n )\n );\n require(success, \"delegatecall failed\");\n\n // Liquid reserves is decreased by the amount sent. utilizedReserves is increased by the amount sent.\n pooledTokens[l1Token].utilizedReserves += netSendAmounts[i];\n pooledTokens[l1Token].liquidReserves -= uint256(netSendAmounts[i]);\n }\n\n // Allocate LP fees and protocol fees from the bundle to the associated pooled token trackers.\n _allocateLpAndProtocolFees(l1Token, bundleLpFees[i]);\n }\n }\n\n function _relayRootBundleToSpokePool(address spokePool, uint256 chainId) internal {\n AdapterInterface adapter = crossChainContracts[chainId].adapter;\n\n // Perform delegatecall to use the adapter's code with this contract's context.\n (bool success, ) = address(adapter).delegatecall(\n abi.encodeWithSignature(\n \"relayMessage(address,bytes)\",\n spokePool, // target. This should be the spokePool on the L2.\n abi.encodeWithSignature(\n \"relayRootBundle(bytes32,bytes32)\",\n rootBundleProposal.relayerRefundRoot,\n rootBundleProposal.slowRelayRoot\n ) // message\n )\n );\n require(success, \"delegatecall failed\");\n }\n\n function _exchangeRateCurrent(address l1Token) internal returns (uint256) {\n PooledToken storage pooledToken = pooledTokens[l1Token]; // Note this is storage so the state can be modified.\n uint256 lpTokenTotalSupply = IERC20(pooledToken.lpToken).totalSupply();\n if (lpTokenTotalSupply == 0) return 1e18; // initial rate is 1:1 between LP tokens and collateral.\n\n // First, update fee counters and local accounting of finalized transfers from L2 -> L1.\n _updateAccumulatedLpFees(pooledToken); // Accumulate all allocated fees from the last time this method was called.\n _sync(l1Token); // Fetch any balance changes due to token bridging finalization and factor them in.\n\n // ExchangeRate := (liquidReserves + utilizedReserves - undistributedLpFees) / lpTokenSupply\n // Both utilizedReserves and undistributedLpFees contain assigned LP fees. UndistributedLpFees is gradually\n // decreased over the smear duration using _updateAccumulatedLpFees. This means that the exchange rate will\n // gradually increase over time as undistributedLpFees goes to zero.\n // utilizedReserves can be negative. If this is the case, then liquidReserves is offset by an equal\n // and opposite size. LiquidReserves + utilizedReserves will always be larger than undistributedLpFees so this\n // int will always be positive so there is no risk in underflow in type casting in the return line.\n int256 numerator = int256(pooledToken.liquidReserves) +\n pooledToken.utilizedReserves -\n int256(pooledToken.undistributedLpFees);\n return (uint256(numerator) * 1e18) / lpTokenTotalSupply;\n }\n\n // Update internal fee counters by adding in any accumulated fees from the last time this logic was called.\n function _updateAccumulatedLpFees(PooledToken storage pooledToken) internal {\n uint256 accumulatedFees = _getAccumulatedFees(pooledToken.undistributedLpFees, pooledToken.lastLpFeeUpdate);\n pooledToken.undistributedLpFees -= accumulatedFees;\n pooledToken.lastLpFeeUpdate = uint32(getCurrentTime());\n }\n\n // Calculate the unallocated accumulatedFees from the last time the contract was called.\n function _getAccumulatedFees(uint256 undistributedLpFees, uint256 lastLpFeeUpdate) internal view returns (uint256) {\n // accumulatedFees := min(undistributedLpFees * lpFeeRatePerSecond * timeFromLastInteraction, undistributedLpFees)\n // The min acts to pay out all fees in the case the equation returns more than the remaining a fees.\n uint256 timeFromLastInteraction = getCurrentTime() - lastLpFeeUpdate;\n uint256 maxUndistributedLpFees = (undistributedLpFees * lpFeeRatePerSecond * timeFromLastInteraction) / (1e18);\n return maxUndistributedLpFees < undistributedLpFees ? maxUndistributedLpFees : undistributedLpFees;\n }\n\n function _sync(address l1Token) internal {\n // Check if the l1Token balance of the contract is greater than the liquidReserves. If it is then the bridging\n // action from L2 -> L1 has concluded and the local accounting can be updated.\n // Note: this calculation must take into account the bond when it's acting on the bond token and there's an\n // active request.\n uint256 balance = IERC20(l1Token).balanceOf(address(this));\n uint256 balanceSansBond = l1Token == address(bondToken) && _activeRequest() ? balance - bondAmount : balance;\n if (balanceSansBond > pooledTokens[l1Token].liquidReserves) {\n // Note the numerical operation below can send utilizedReserves to negative. This can occur when tokens are\n // dropped onto the contract, exceeding the liquidReserves.\n pooledTokens[l1Token].utilizedReserves -= int256(balanceSansBond - pooledTokens[l1Token].liquidReserves);\n pooledTokens[l1Token].liquidReserves = balanceSansBond;\n }\n }\n\n function _liquidityUtilizationPostRelay(address l1Token, uint256 relayedAmount) internal returns (uint256) {\n _sync(l1Token); // Fetch any balance changes due to token bridging finalization and factor them in.\n\n // liquidityUtilizationRatio := (relayedAmount + max(utilizedReserves,0)) / (liquidReserves + max(utilizedReserves,0))\n // UtilizedReserves has a dual meaning: if it's greater than zero then it represents funds pending in the bridge\n // that will flow from L2 to L1. In this case, we can use it normally in the equation. However, if it is\n // negative, then it is already counted in liquidReserves. This occurs if tokens are transferred directly to the\n // contract. In this case, ignore it as it is captured in liquid reserves and has no meaning in the numerator.\n PooledToken memory pooledToken = pooledTokens[l1Token]; // Note this is storage so the state can be modified.\n uint256 flooredUtilizedReserves = pooledToken.utilizedReserves > 0 ? uint256(pooledToken.utilizedReserves) : 0;\n uint256 numerator = relayedAmount + flooredUtilizedReserves;\n uint256 denominator = pooledToken.liquidReserves + flooredUtilizedReserves;\n\n // If the denominator equals zero, return 1e18 (max utilization).\n if (denominator == 0) return 1e18;\n\n // In all other cases, return the utilization ratio.\n return (numerator * 1e18) / denominator;\n }\n\n function _allocateLpAndProtocolFees(address l1Token, uint256 bundleLpFees) internal {\n // Calculate the fraction of bundledLpFees that are allocated to the protocol and to the LPs.\n uint256 protocolFeesCaptured = (bundleLpFees * protocolFeeCapturePct) / 1e18;\n uint256 lpFeesCaptured = bundleLpFees - protocolFeesCaptured;\n\n // Assign any LP fees included into the bundle to the pooled token. These LP fees are tracked in the\n // undistributedLpFees and within the utilizedReserves. undistributedLpFees is gradually decrease\n // over the smear duration to give the LPs their rewards over a period of time. Adding to utilizedReserves\n // acts to track these rewards after the smear duration. See _exchangeRateCurrent for more details.\n if (lpFeesCaptured > 0) {\n pooledTokens[l1Token].undistributedLpFees += lpFeesCaptured;\n pooledTokens[l1Token].utilizedReserves += int256(lpFeesCaptured);\n }\n\n // If there are any protocol fees, allocate them to the unclaimed protocol tracker amount.\n if (protocolFeesCaptured > 0) unclaimedAccumulatedProtocolFees[l1Token] += protocolFeesCaptured;\n }\n\n function _relaySpokePoolAdminFunction(uint256 chainId, bytes memory functionData) internal {\n AdapterInterface adapter = crossChainContracts[chainId].adapter;\n require(address(adapter) != address(0), \"Adapter not initialized\");\n\n // Perform delegatecall to use the adapter's code with this contract's context.\n (bool success, ) = address(adapter).delegatecall(\n abi.encodeWithSignature(\n \"relayMessage(address,bytes)\",\n crossChainContracts[chainId].spokePool, // target. This should be the spokePool on the L2.\n functionData\n )\n );\n require(success, \"delegatecall failed\");\n emit SpokePoolAdminFunctionTriggered(chainId, functionData);\n }\n\n function _whitelistedRouteKey(\n uint256 originChainId,\n address originToken,\n uint256 destinationChainId\n ) internal pure returns (bytes32) {\n return keccak256(abi.encode(originChainId, originToken, destinationChainId));\n }\n\n function _activeRequest() internal view returns (bool) {\n return rootBundleProposal.unclaimedPoolRebalanceLeafCount != 0;\n }\n\n // If functionCallStackOriginatesFromOutsideThisContract is true then this was called by the callback function\n // by dropping ETH onto the contract. In this case, deposit the ETH into WETH. This would happen if ETH was sent\n // over the optimism bridge, for example. If false then this was set as a result of unwinding LP tokens, with the\n // intention of sending ETH to the LP. In this case, do nothing as we intend on sending the ETH to the LP.\n function _depositEthToWeth() internal {\n if (functionCallStackOriginatesFromOutsideThisContract()) weth.deposit{ value: msg.value }();\n }\n\n // Added to enable the HubPool to receive ETH. This will occur both when the HubPool unwraps WETH to send to LPs and\n // when ETH is send over the canonical Optimism bridge, which sends ETH.\n fallback() external payable {\n _depositEthToWeth();\n }\n\n receive() external payable {\n _depositEthToWeth();\n }\n}\n" + "content": "// SPDX-License-Identifier: GPL-3.0-only\npragma solidity ^0.8.0;\n\nimport \"./MerkleLib.sol\";\nimport \"./HubPoolInterface.sol\";\nimport \"./Lockable.sol\";\n\nimport \"./interfaces/LpTokenFactoryInterface.sol\";\nimport \"./interfaces/WETH9.sol\";\n\nimport \"@uma/core/contracts/common/implementation/Testable.sol\";\nimport \"@uma/core/contracts/common/implementation/MultiCaller.sol\";\nimport \"@uma/core/contracts/oracle/implementation/Constants.sol\";\nimport \"@uma/core/contracts/common/implementation/AncillaryData.sol\";\nimport \"@uma/core/contracts/common/interfaces/AddressWhitelistInterface.sol\";\nimport \"@uma/core/contracts/oracle/interfaces/IdentifierWhitelistInterface.sol\";\n\nimport \"@uma/core/contracts/oracle/interfaces/FinderInterface.sol\";\nimport \"@uma/core/contracts/oracle/interfaces/StoreInterface.sol\";\nimport \"@uma/core/contracts/oracle/interfaces/SkinnyOptimisticOracleInterface.sol\";\nimport \"@uma/core/contracts/common/interfaces/ExpandedIERC20.sol\";\n\nimport \"@openzeppelin/contracts/access/Ownable.sol\";\nimport \"@openzeppelin/contracts/token/ERC20/IERC20.sol\";\nimport \"@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol\";\nimport \"@openzeppelin/contracts/utils/Address.sol\";\n\n/**\n * @notice Contract deployed on Ethereum that houses L1 token liquidity for all SpokePools. A dataworker can interact\n * with merkle roots stored in this contract via inclusion proofs to instruct this contract to send tokens to L2\n * SpokePools via \"pool rebalances\" that can be used to pay out relayers on those networks. This contract is also\n * responsible for publishing relayer refund and slow relay merkle roots to SpokePools.\n * @notice This contract is meant to act as the cross chain administrator and owner of all L2 spoke pools, so all\n * governance actions and pool rebalances originate from here and bridge instructions to L2s.\n * @dev This contract should be deprecated by the year 2106, at which point uint32 timestamps will roll over. This is\n * an issue for this contract because fee calculations will become bizarre when multiplying by negative time deltas.\n * Before this date, this contract should be paused from accepting new root bundles and all LP tokens should be\n * disabled by the admin.\n */\ncontract HubPool is HubPoolInterface, Testable, Lockable, MultiCaller, Ownable {\n using SafeERC20 for IERC20;\n using Address for address;\n\n // Only one root bundle can be stored at a time. Once all pool rebalance leaves are executed, a new proposal\n // can be submitted.\n RootBundle public rootBundleProposal;\n\n // Whether the bundle proposal process is paused.\n bool public paused;\n\n // Stores paths from L1 token + destination ID to destination token. Since different tokens on L1 might map to\n // to the same address on different destinations, we hash (L1 token address, destination ID) to\n // use as a key that maps to a destination token. This mapping is used to direct pool rebalances from\n // HubPool to SpokePool, and also is designed to be used as a lookup for off-chain data workers to determine\n // which L1 tokens to relay to SpokePools to refund relayers. The admin can set the \"destination token\"\n // to 0x0 to disable a pool rebalance route and block executeRootBundle() from executing.\n mapping(bytes32 => address) private poolRebalanceRoutes;\n\n // Mapping of L1 token addresses to the associated pool information.\n mapping(address => PooledToken) public pooledTokens;\n\n // Mapping of chainId to the associated adapter and spokePool contracts.\n mapping(uint256 => CrossChainContract) public crossChainContracts;\n\n // WETH contract for Ethereum.\n WETH9 public immutable weth;\n\n // Helper factory to deploy new LP tokens for enabled L1 tokens\n LpTokenFactoryInterface public immutable lpTokenFactory;\n\n // Finder contract for this network.\n FinderInterface public immutable finder;\n\n // When root bundles are disputed a price request is enqueued with the DVM to resolve the resolution.\n bytes32 public identifier = \"IS_ACROSS_V2_BUNDLE_VALID\";\n\n // Interest rate payment that scales the amount of pending fees per second paid to LPs. 0.0000015e18 will pay out\n // the full amount of fees entitled to LPs in ~ 7.72 days, just over the standard L2 7 day liveness.\n uint256 public lpFeeRatePerSecond = 1500000000000;\n\n // Mapping of l1TokenAddress to cumulative unclaimed protocol tokens that can be sent to the protocolFeeCaptureAddress\n // at any time. This enables the protocol to reallocate some percentage of LP fees elsewhere.\n mapping(address => uint256) public unclaimedAccumulatedProtocolFees;\n\n // Address that captures protocol fees. Accumulated protocol fees can be claimed by this address.\n address public protocolFeeCaptureAddress;\n\n // Percentage of lpFees that are captured by the protocol and claimable by the protocolFeeCaptureAddress.\n uint256 public protocolFeeCapturePct;\n\n // Token used to bond the data worker for proposing relayer refund bundles.\n IERC20 public bondToken;\n\n // The computed bond amount as the UMA Store's final fee multiplied by the bondTokenFinalFeeMultiplier.\n uint256 public bondAmount;\n\n // Each root bundle proposal must stay in liveness for this period of time before it can be considered finalized.\n // It can be disputed only during this period of time. Defaults to 2 hours, like the rest of the UMA ecosystem.\n uint32 public liveness = 7200;\n\n event Paused(bool indexed isPaused);\n\n event EmergencyRootBundleDeleted(\n bytes32 indexed poolRebalanceRoot,\n bytes32 indexed relayerRefundRoot,\n bytes32 slowRelayRoot,\n address indexed proposer\n );\n\n event ProtocolFeeCaptureSet(address indexed newProtocolFeeCaptureAddress, uint256 indexed newProtocolFeeCapturePct);\n\n event ProtocolFeesCapturedClaimed(address indexed l1Token, uint256 indexed accumulatedFees);\n\n event BondSet(address indexed newBondToken, uint256 newBondAmount);\n\n event LivenessSet(uint256 newLiveness);\n\n event IdentifierSet(bytes32 newIdentifier);\n\n event CrossChainContractsSet(uint256 l2ChainId, address adapter, address spokePool);\n\n event L1TokenEnabledForLiquidityProvision(address l1Token, address lpToken);\n\n event L2TokenDisabledForLiquidityProvision(address l1Token, address lpToken);\n\n event LiquidityAdded(\n address indexed l1Token,\n uint256 amount,\n uint256 lpTokensMinted,\n address indexed liquidityProvider\n );\n event LiquidityRemoved(\n address indexed l1Token,\n uint256 amount,\n uint256 lpTokensBurnt,\n address indexed liquidityProvider\n );\n event SetPoolRebalanceRoute(\n uint256 indexed destinationChainId,\n address indexed l1Token,\n address indexed destinationToken\n );\n event SetEnableDepositRoute(\n uint256 indexed originChainId,\n uint256 indexed destinationChainId,\n address indexed originToken,\n bool depositsEnabled\n );\n event ProposeRootBundle(\n uint32 requestExpirationTimestamp,\n uint64 unclaimedPoolRebalanceLeafCount,\n uint256[] bundleEvaluationBlockNumbers,\n bytes32 indexed poolRebalanceRoot,\n bytes32 indexed relayerRefundRoot,\n bytes32 slowRelayRoot,\n address indexed proposer\n );\n event RootBundleExecuted(\n uint256 groupIndex,\n uint256 indexed leafId,\n uint256 indexed chainId,\n address[] l1Token,\n uint256[] bundleLpFees,\n int256[] netSendAmount,\n int256[] runningBalance,\n address indexed caller\n );\n event SpokePoolAdminFunctionTriggered(uint256 indexed chainId, bytes message);\n\n event RootBundleDisputed(address indexed disputer, uint256 requestTime);\n\n event RootBundleCanceled(address indexed disputer, uint256 requestTime);\n\n modifier noActiveRequests() {\n require(!_activeRequest(), \"Proposal has unclaimed leaves\");\n _;\n }\n\n modifier unpaused() {\n require(!paused, \"Proposal process has been paused\");\n _;\n }\n\n modifier zeroOptimisticOracleApproval() {\n _;\n bondToken.safeApprove(address(_getOptimisticOracle()), 0);\n }\n\n /**\n * @notice Construct HubPool.\n * @param _lpTokenFactory LP Token factory address used to deploy LP tokens for new collateral types.\n * @param _finder Finder address.\n * @param _weth WETH address.\n * @param _timer Timer address.\n */\n constructor(\n LpTokenFactoryInterface _lpTokenFactory,\n FinderInterface _finder,\n WETH9 _weth,\n address _timer\n ) Testable(_timer) {\n lpTokenFactory = _lpTokenFactory;\n finder = _finder;\n weth = _weth;\n protocolFeeCaptureAddress = owner();\n }\n\n /*************************************************\n * ADMIN FUNCTIONS *\n *************************************************/\n\n /**\n * @notice Pauses the bundle proposal and execution process. This is intended to be used during upgrades or when\n * something goes awry.\n * @param pause true if the call is meant to pause the system, false if the call is meant to unpause it.\n */\n function setPaused(bool pause) public onlyOwner nonReentrant {\n paused = pause;\n emit Paused(pause);\n }\n\n /**\n * @notice This allows for the deletion of the active proposal in case of emergency.\n * @dev This is primarily intended to rectify situations where an unexecutable bundle gets through liveness in the\n * case of a non-malicious bug in the proposal/dispute code. Without this function, the contract would be\n * indefinitely blocked, migration would be required, and in-progress transfers would never be repaid.\n */\n function emergencyDeleteProposal() public onlyOwner nonReentrant {\n if (rootBundleProposal.unclaimedPoolRebalanceLeafCount > 0)\n bondToken.safeTransfer(rootBundleProposal.proposer, bondAmount);\n emit EmergencyRootBundleDeleted(\n rootBundleProposal.poolRebalanceRoot,\n rootBundleProposal.relayerRefundRoot,\n rootBundleProposal.slowRelayRoot,\n rootBundleProposal.proposer\n );\n delete rootBundleProposal;\n }\n\n /**\n * @notice Sends message to SpokePool from this contract. Callable only by owner.\n * @dev This function has permission to call onlyAdmin functions on the SpokePool, so it's imperative that this\n * contract only allows the owner to call this method directly or indirectly.\n * @param chainId Chain with SpokePool to send message to.\n * @param functionData ABI encoded function call to send to SpokePool, but can be any arbitrary data technically.\n */\n function relaySpokePoolAdminFunction(uint256 chainId, bytes memory functionData)\n public\n override\n onlyOwner\n nonReentrant\n {\n _relaySpokePoolAdminFunction(chainId, functionData);\n }\n\n /**\n * @notice Sets protocolFeeCaptureAddress and protocolFeeCapturePct. Callable only by owner.\n * @param newProtocolFeeCaptureAddress New protocol fee capture address.\n * @param newProtocolFeeCapturePct New protocol fee capture %.\n */\n function setProtocolFeeCapture(address newProtocolFeeCaptureAddress, uint256 newProtocolFeeCapturePct)\n public\n override\n onlyOwner\n nonReentrant\n {\n require(newProtocolFeeCapturePct <= 1e18, \"Bad protocolFeeCapturePct\");\n require(newProtocolFeeCaptureAddress != address(0), \"Bad protocolFeeCaptureAddress\");\n protocolFeeCaptureAddress = newProtocolFeeCaptureAddress;\n protocolFeeCapturePct = newProtocolFeeCapturePct;\n emit ProtocolFeeCaptureSet(newProtocolFeeCaptureAddress, newProtocolFeeCapturePct);\n }\n\n /**\n * @notice Sets bond token and amount. Callable only by owner.\n * @param newBondToken New bond currency.\n * @param newBondAmount New bond amount.\n */\n function setBond(IERC20 newBondToken, uint256 newBondAmount)\n public\n override\n onlyOwner\n noActiveRequests\n nonReentrant\n {\n // Bond should not be great than final fee otherwise every proposal will get cancelled in a dispute.\n // In practice we expect that bond amounts are set >> final fees so this shouldn't be an inconvenience.\n // The only way for the bond amount to be equal to the final fee is if the newBondAmount == 0.\n require(newBondAmount != 0, \"bond equal to final fee\");\n\n // Check that this token is on the whitelist.\n AddressWhitelistInterface addressWhitelist = AddressWhitelistInterface(\n finder.getImplementationAddress(OracleInterfaces.CollateralWhitelist)\n );\n require(addressWhitelist.isOnWhitelist(address(newBondToken)), \"Not on whitelist\");\n\n // The bond should be the passed in bondAmount + the final fee.\n bondToken = newBondToken;\n bondAmount = newBondAmount + _getBondTokenFinalFee();\n emit BondSet(address(newBondToken), bondAmount);\n }\n\n /**\n * @notice Sets root bundle proposal liveness period. Callable only by owner.\n * @param newLiveness New liveness period.\n */\n function setLiveness(uint32 newLiveness) public override onlyOwner nonReentrant {\n require(newLiveness > 10 minutes, \"Liveness too short\");\n liveness = newLiveness;\n emit LivenessSet(newLiveness);\n }\n\n /**\n * @notice Sets identifier for root bundle disputes. Callable only by owner.\n * @param newIdentifier New identifier.\n */\n function setIdentifier(bytes32 newIdentifier) public override onlyOwner noActiveRequests nonReentrant {\n IdentifierWhitelistInterface identifierWhitelist = IdentifierWhitelistInterface(\n finder.getImplementationAddress(OracleInterfaces.IdentifierWhitelist)\n );\n require(identifierWhitelist.isIdentifierSupported(newIdentifier), \"Identifier not supported\");\n identifier = newIdentifier;\n emit IdentifierSet(newIdentifier);\n }\n\n /**\n * @notice Sets cross chain relay helper contracts for L2 chain ID. Callable only by owner.\n * @dev We do not block setting the adapter or SpokePool to invalid/zero addresses because we want to allow the\n * admin to block relaying roots to the spoke pool for emergency recovery purposes.\n * @param l2ChainId Chain to set contracts for.\n * @param adapter Adapter used to relay messages and tokens to spoke pool. Deployed on current chain.\n * @param spokePool Recipient of relayed messages and tokens on spoke pool. Deployed on l2ChainId.\n */\n\n function setCrossChainContracts(\n uint256 l2ChainId,\n address adapter,\n address spokePool\n ) public override onlyOwner nonReentrant {\n crossChainContracts[l2ChainId] = CrossChainContract(adapter, spokePool);\n emit CrossChainContractsSet(l2ChainId, adapter, spokePool);\n }\n\n /**\n * @notice Store canonical destination token counterpart for l1 token. Callable only by owner.\n * @dev Admin can set destinationToken to 0x0 to effectively disable executing any root bundles with leaves\n * containing this l1 token + destination chain ID combination.\n * @param destinationChainId Destination chain where destination token resides.\n * @param l1Token Token enabled for liquidity in this pool, and the L1 counterpart to the destination token on the\n * destination chain ID.\n * @param destinationToken Destination chain counterpart of L1 token.\n */\n function setPoolRebalanceRoute(\n uint256 destinationChainId,\n address l1Token,\n address destinationToken\n ) public override onlyOwner nonReentrant {\n poolRebalanceRoutes[_poolRebalanceRouteKey(l1Token, destinationChainId)] = destinationToken;\n emit SetPoolRebalanceRoute(destinationChainId, l1Token, destinationToken);\n }\n\n /**\n * @notice Sends cross-chain message to SpokePool on originChainId to enable or disable deposit route from that\n * SpokePool to another one. Callable only by owner.\n * @dev Admin is responsible for ensuring that `originToken` is linked to some L1 token on this contract, via\n * poolRebalanceRoutes(), and that this L1 token also has a counterpart on the destination chain. If either\n * condition fails, then the deposit will be unrelayable by off-chain relayers because they will not know which\n * token to relay to recipients on the destination chain, and data workers wouldn't know which L1 token to send\n * to the destination chain to refund the relayer.\n * @param originChainId Chain where token deposit occurs.\n * @param destinationChainId Chain where token depositor wants to receive funds.\n * @param originToken Token sent in deposit.\n * @param depositsEnabled Set to true to whitelist this route for deposits, set to false if caller just wants to\n * map the origin token + destination ID to the destination token address on the origin chain's SpokePool.\n */\n function setDepositRoute(\n uint256 originChainId,\n uint256 destinationChainId,\n address originToken,\n bool depositsEnabled\n ) public override nonReentrant onlyOwner {\n _relaySpokePoolAdminFunction(\n originChainId,\n abi.encodeWithSignature(\n \"setEnableRoute(address,uint256,bool)\",\n originToken,\n destinationChainId,\n depositsEnabled\n )\n );\n emit SetEnableDepositRoute(originChainId, destinationChainId, originToken, depositsEnabled);\n }\n\n /**\n * @notice Enables LPs to provide liquidity for L1 token. Deploys new LP token for L1 token if appropriate.\n * Callable only by owner.\n * @param l1Token Token to provide liquidity for.\n */\n function enableL1TokenForLiquidityProvision(address l1Token) public override onlyOwner nonReentrant {\n // If token is being enabled for the first time, create a new LP token and set the timestamp once. We don't\n // want to ever reset this timestamp otherwise fees that have accrued will be lost since the last update. This\n // could happen for example if an L1 token is enabled, disabled, and then enabled again.\n if (pooledTokens[l1Token].lpToken == address(0)) {\n pooledTokens[l1Token].lpToken = lpTokenFactory.createLpToken(l1Token);\n pooledTokens[l1Token].lastLpFeeUpdate = uint32(getCurrentTime());\n }\n\n pooledTokens[l1Token].isEnabled = true;\n\n emit L1TokenEnabledForLiquidityProvision(l1Token, pooledTokens[l1Token].lpToken);\n }\n\n /**\n * @notice Disables LPs from providing liquidity for L1 token. Callable only by owner.\n * @param l1Token Token to disable liquidity provision for.\n */\n function disableL1TokenForLiquidityProvision(address l1Token) public override onlyOwner nonReentrant {\n pooledTokens[l1Token].isEnabled = false;\n emit L2TokenDisabledForLiquidityProvision(l1Token, pooledTokens[l1Token].lpToken);\n }\n\n /*************************************************\n * LIQUIDITY PROVIDER FUNCTIONS *\n *************************************************/\n\n /**\n * @notice Deposit liquidity into this contract to earn LP fees in exchange for funding relays on SpokePools.\n * Caller is essentially loaning their funds to be sent from this contract to the SpokePool, where it will be used\n * to repay a relayer, and ultimately receives their loan back after the tokens are bridged back to this contract\n * via the canonical token bridge. Then, the caller's loans are used again. This loan cycle repeats continuously\n * and the caller, or \"liquidity provider\" earns a continuous fee for their credit that they are extending relayers.\n * @notice Caller will receive an LP token representing their share of this pool. The LP token's redemption value\n * increments from the time that they enter the pool to reflect their accrued fees.\n * @notice The caller of this function must approve this contract to spend l1TokenAmount of l1Token.\n * @param l1Token Token to deposit into this contract.\n * @param l1TokenAmount Amount of liquidity to provide.\n */\n function addLiquidity(address l1Token, uint256 l1TokenAmount) public payable override nonReentrant {\n require(pooledTokens[l1Token].isEnabled, \"Token not enabled\");\n // If this is the weth pool and the caller sends msg.value then the msg.value must match the l1TokenAmount.\n // Else, msg.value must be set to 0.\n require(((address(weth) == l1Token) && msg.value == l1TokenAmount) || msg.value == 0, \"Bad msg.value\");\n\n // Since _exchangeRateCurrent() reads this contract's balance and updates contract state using it, it must be\n // first before transferring any tokens to this contract to ensure synchronization.\n uint256 lpTokensToMint = (l1TokenAmount * 1e18) / _exchangeRateCurrent(l1Token);\n pooledTokens[l1Token].liquidReserves += l1TokenAmount;\n ExpandedIERC20(pooledTokens[l1Token].lpToken).mint(msg.sender, lpTokensToMint);\n\n if (address(weth) == l1Token && msg.value > 0) WETH9(address(l1Token)).deposit{ value: msg.value }();\n else IERC20(l1Token).safeTransferFrom(msg.sender, address(this), l1TokenAmount);\n\n emit LiquidityAdded(l1Token, l1TokenAmount, lpTokensToMint, msg.sender);\n }\n\n /**\n * @notice Burns LP share to redeem for underlying l1Token original deposit amount plus fees.\n * @param l1Token Token to redeem LP share for.\n * @param lpTokenAmount Amount of LP tokens to burn. Exchange rate between L1 token and LP token can be queried\n * via public exchangeRateCurrent method.\n * @param sendEth Set to True if L1 token is WETH and user wants to receive ETH. Note that if caller\n * is a contract, then the contract should have a way to receive ETH if this value is set to True. Similarly,\n * if this value is set to False, then the calling contract should have a way to handle WETH.\n */\n function removeLiquidity(\n address l1Token,\n uint256 lpTokenAmount,\n bool sendEth\n ) public override nonReentrant {\n require(address(weth) == l1Token || !sendEth, \"Cant send eth\");\n uint256 l1TokensToReturn = (lpTokenAmount * _exchangeRateCurrent(l1Token)) / 1e18;\n\n ExpandedIERC20(pooledTokens[l1Token].lpToken).burnFrom(msg.sender, lpTokenAmount);\n // Note this method does not make any liquidity utilization checks before letting the LP redeem their LP tokens.\n // If they try access more funds than available (i.e l1TokensToReturn > liquidReserves) this will underflow.\n pooledTokens[l1Token].liquidReserves -= l1TokensToReturn;\n\n if (sendEth) {\n weth.withdraw(l1TokensToReturn);\n payable(msg.sender).transfer(l1TokensToReturn); // This will revert if the caller is a contract that does not implement a fallback function.\n } else {\n IERC20(address(l1Token)).safeTransfer(msg.sender, l1TokensToReturn);\n }\n emit LiquidityRemoved(l1Token, l1TokensToReturn, lpTokenAmount, msg.sender);\n }\n\n /**\n * @notice Returns exchange rate of L1 token to LP token.\n * @param l1Token L1 token redeemable by burning LP token.\n * @return Amount of L1 tokens redeemable for 1 unit LP token.\n */\n function exchangeRateCurrent(address l1Token) public override nonReentrant returns (uint256) {\n return _exchangeRateCurrent(l1Token);\n }\n\n /**\n * @notice Returns % of liquid reserves currently being \"used\" and sitting in SpokePools.\n * @param l1Token L1 token to query utilization for.\n * @return % of liquid reserves currently being \"used\" and sitting in SpokePools.\n */\n function liquidityUtilizationCurrent(address l1Token) public override nonReentrant returns (uint256) {\n return _liquidityUtilizationPostRelay(l1Token, 0);\n }\n\n /**\n * @notice Returns % of liquid reserves currently being \"used\" and sitting in SpokePools and accounting for\n * relayedAmount of tokens to be withdrawn from the pool.\n * @param l1Token L1 token to query utilization for.\n * @param relayedAmount The higher this amount, the higher the utilization.\n * @return % of liquid reserves currently being \"used\" and sitting in SpokePools plus the relayedAmount.\n */\n function liquidityUtilizationPostRelay(address l1Token, uint256 relayedAmount)\n public\n nonReentrant\n returns (uint256)\n {\n return _liquidityUtilizationPostRelay(l1Token, relayedAmount);\n }\n\n /**\n * @notice Synchronize any balance changes in this contract with the utilized & liquid reserves. This should be done\n * at the conclusion of a L2->L1 token transfer via the canonical token bridge, when this contract's reserves do not\n * reflect its true balance due to new tokens being dropped onto the contract at the conclusion of a bridging action.\n */\n function sync(address l1Token) public override nonReentrant {\n _sync(l1Token);\n }\n\n /*************************************************\n * DATA WORKER FUNCTIONS *\n *************************************************/\n\n /**\n * @notice Publish a new root bundle along with all of the block numbers that the merkle roots are relevant for.\n * This is used to aid off-chain validators in evaluating the correctness of this bundle. Caller stakes a bond that\n * can be slashed if the root bundle proposal is invalid, and they will receive it back if accepted.\n * @notice After proposeRootBundle is called, if the any props are wrong then this proposal can be challenged.\n * Once the challenge period passes, then the roots are no longer disputable, and only executeRootBundle can be\n * called; moreover, this method can't be called again until all leaves are executed.\n * @param bundleEvaluationBlockNumbers should contain the latest block number for all chains, even if there are no\n * relays contained on some of them. The usage of this variable should be defined in an off chain UMIP.\n * @notice The caller of this function must approve this contract to spend bondAmount of bondToken.\n * @param poolRebalanceLeafCount Number of leaves contained in pool rebalance root. Max is # of whitelisted chains.\n * @param poolRebalanceRoot Pool rebalance root containing leaves that sends tokens from this contract to SpokePool.\n * @param relayerRefundRoot Relayer refund root to publish to SpokePool where a data worker can execute leaves to\n * refund relayers on their chosen refund chainId.\n * @param slowRelayRoot Slow relay root to publish to Spoke Pool where a data worker can execute leaves to\n * fulfill slow relays.\n */\n function proposeRootBundle(\n uint256[] memory bundleEvaluationBlockNumbers,\n uint8 poolRebalanceLeafCount,\n bytes32 poolRebalanceRoot,\n bytes32 relayerRefundRoot,\n bytes32 slowRelayRoot\n ) public override nonReentrant noActiveRequests unpaused {\n // Note: this is to prevent \"empty block\" style attacks where someone can make empty proposals that are\n // technically valid but not useful. This could also potentially be enforced at the UMIP-level.\n require(poolRebalanceLeafCount > 0, \"Bundle must have at least 1 leaf\");\n\n uint32 requestExpirationTimestamp = uint32(getCurrentTime()) + liveness;\n\n delete rootBundleProposal; // Only one bundle of roots can be executed at a time.\n\n rootBundleProposal.requestExpirationTimestamp = requestExpirationTimestamp;\n rootBundleProposal.unclaimedPoolRebalanceLeafCount = poolRebalanceLeafCount;\n rootBundleProposal.poolRebalanceRoot = poolRebalanceRoot;\n rootBundleProposal.relayerRefundRoot = relayerRefundRoot;\n rootBundleProposal.slowRelayRoot = slowRelayRoot;\n rootBundleProposal.proposer = msg.sender;\n\n // Pull bondAmount of bondToken from the caller.\n bondToken.safeTransferFrom(msg.sender, address(this), bondAmount);\n\n emit ProposeRootBundle(\n requestExpirationTimestamp,\n poolRebalanceLeafCount,\n bundleEvaluationBlockNumbers,\n poolRebalanceRoot,\n relayerRefundRoot,\n slowRelayRoot,\n msg.sender\n );\n }\n\n /**\n * @notice Executes a pool rebalance leaf as part of the currently published root bundle. Will bridge any tokens\n * from this contract to the SpokePool designated in the leaf, and will also publish relayer refund and slow\n * relay roots to the SpokePool on the network specified in the leaf.\n * @dev In some cases, will instruct spokePool to send funds back to L1.\n * @notice Deletes the published root bundle if this is the last leaf to be executed in the root bundle.\n * @param chainId ChainId number of the target spoke pool on which the bundle is executed.\n * @param groupIndex If set to 0, then relay roots to SpokePool via cross chain bridge. Used by off-chain validator\n * to organize leaves with the same chain ID and also set which leaves should result in relayed messages.\n * @param bundleLpFees Array representing the total LP fee amount per token in this bundle for all bundled relays.\n * @param netSendAmounts Array representing the amount of tokens to send to the SpokePool on the target chainId.\n * @param runningBalances Array used to track any unsent tokens that are not included in the netSendAmounts.\n * @param leafId Index of this executed leaf within the poolRebalance tree.\n * @param l1Tokens Array of all the tokens associated with the bundleLpFees, nedSendAmounts and runningBalances.\n * @param proof Inclusion proof for this leaf in pool rebalance root in root bundle.\n */\n\n function executeRootBundle(\n uint256 chainId,\n uint256 groupIndex,\n uint256[] memory bundleLpFees,\n int256[] memory netSendAmounts,\n int256[] memory runningBalances,\n uint8 leafId,\n address[] memory l1Tokens,\n bytes32[] memory proof\n ) public nonReentrant unpaused {\n require(getCurrentTime() > rootBundleProposal.requestExpirationTimestamp, \"Not passed liveness\");\n\n // Verify the leafId in the poolRebalanceLeaf has not yet been claimed.\n require(!MerkleLib.isClaimed1D(rootBundleProposal.claimedBitMap, leafId), \"Already claimed\");\n\n // Verify the props provided generate a leaf that, along with the proof, are included in the merkle root.\n require(\n MerkleLib.verifyPoolRebalance(\n rootBundleProposal.poolRebalanceRoot,\n PoolRebalanceLeaf({\n chainId: chainId,\n groupIndex: groupIndex,\n bundleLpFees: bundleLpFees,\n netSendAmounts: netSendAmounts,\n runningBalances: runningBalances,\n leafId: leafId,\n l1Tokens: l1Tokens\n }),\n proof\n ),\n \"Bad Proof\"\n );\n\n // Get cross chain helpers for leaf's destination chain ID. This internal method will revert if either helper\n // is set improperly.\n (address adapter, address spokePool) = _getInitializedCrossChainContracts(chainId);\n\n // Set the leafId in the claimed bitmap.\n rootBundleProposal.claimedBitMap = MerkleLib.setClaimed1D(rootBundleProposal.claimedBitMap, leafId);\n\n // Decrement the unclaimedPoolRebalanceLeafCount.\n rootBundleProposal.unclaimedPoolRebalanceLeafCount--;\n\n // Relay each L1 token to destination chain.\n\n // Note: if any of the keccak256(l1Tokens, chainId) combinations are not mapped to a destination token address,\n // then this internal method will revert. In this case the admin will have to associate a destination token\n // with each l1 token. If the destination token mapping was missing at the time of the proposal, we assume\n // that the root bundle would have been disputed because the off-chain data worker would have been unable to\n // determine if the relayers used the correct destination token for a given origin token.\n _sendTokensToChainAndUpdatePooledTokenTrackers(\n adapter,\n spokePool,\n chainId,\n l1Tokens,\n netSendAmounts,\n bundleLpFees\n );\n\n // Check bool used by data worker to prevent relaying redundant roots to SpokePool.\n if (groupIndex == 0) {\n // Relay root bundles to spoke pool on destination chain by\n // performing delegatecall to use the adapter's code with this contract's context.\n (bool success, ) = adapter.delegatecall(\n abi.encodeWithSignature(\n \"relayMessage(address,bytes)\",\n spokePool, // target. This should be the spokePool on the L2.\n abi.encodeWithSignature(\n \"relayRootBundle(bytes32,bytes32)\",\n rootBundleProposal.relayerRefundRoot,\n rootBundleProposal.slowRelayRoot\n ) // message\n )\n );\n require(success, \"delegatecall failed\");\n }\n\n // Transfer the bondAmount back to the proposer, if this the last executed leaf. Only sending this once all\n // leaves have been executed acts to force the data worker to execute all bundles or they won't receive their bond.\n if (rootBundleProposal.unclaimedPoolRebalanceLeafCount == 0)\n bondToken.safeTransfer(rootBundleProposal.proposer, bondAmount);\n\n emit RootBundleExecuted(\n groupIndex,\n leafId,\n chainId,\n l1Tokens,\n bundleLpFees,\n netSendAmounts,\n runningBalances,\n msg.sender\n );\n }\n\n /**\n * @notice Caller stakes a bond to dispute the current root bundle proposal assuming it has not passed liveness\n * yet. The proposal is deleted, allowing a follow-up proposal to be submitted, and the dispute is sent to the\n * optimistic oracle to be adjudicated. Can only be called within the liveness period of the current proposal.\n * @notice The caller of this function must approve this contract to spend bondAmount of l1Token.\n */\n function disputeRootBundle() public nonReentrant zeroOptimisticOracleApproval {\n uint32 currentTime = uint32(getCurrentTime());\n require(currentTime <= rootBundleProposal.requestExpirationTimestamp, \"Request passed liveness\");\n\n // Request price from OO and dispute it.\n uint256 finalFee = _getBondTokenFinalFee();\n\n // This method will request a price from the OO and dispute it. Note that we set the ancillary data to\n // the empty string (\"\"). The root bundle that is being disputed was the most recently proposed one with a\n // block number less than or equal to the dispute block time. All of this root bundle data can be found in\n // the ProposeRootBundle event params. Moreover, the optimistic oracle will stamp the requester's address\n // (i.e. this contract address) meaning that ancillary data for a dispute originating from another HubPool\n // will always be distinct from a dispute originating from this HubPool. Moreover, since\n // bundleEvaluationNumbers for a root bundle proposal are not stored in this contract, DVM voters will always\n // have to look up the ProposeRootBundle event to evaluate a dispute, therefore there is no point emitting extra\n // data in this ancillary data that is already included in the ProposeRootBundle event.\n\n // If the finalFee is larger than the bond amount, the bond amount needs to be reset before a request can go\n // through. Cancel to avoid a revert. Similarly, if the final fee == bond amount, then the proposer bond\n // set in the optimistic oracle would be 0. The optimistic oracle would then default the bond to be equal\n // to the final fee, which would mean that the allowance set to the bondAmount would be insufficient and the\n // requestAndProposePriceFor() call would revert. Source: https://github.com/UMAprotocol/protocol/blob/5b37ea818a28479c01e458389a83c3e736306b17/packages/core/contracts/oracle/implementation/SkinnyOptimisticOracle.sol#L321\n if (finalFee >= bondAmount) {\n _cancelBundle();\n return;\n }\n\n SkinnyOptimisticOracleInterface optimisticOracle = _getOptimisticOracle();\n\n // Only approve exact tokens to avoid more tokens than expected being pulled into the OptimisticOracle.\n bondToken.safeIncreaseAllowance(address(optimisticOracle), bondAmount);\n try\n optimisticOracle.requestAndProposePriceFor(\n identifier,\n currentTime,\n \"\",\n bondToken,\n // Set reward to 0, since we'll settle proposer reward payouts directly from this contract after a root\n // proposal has passed the challenge period.\n 0,\n // Set the Optimistic oracle proposer bond for the request. We can assume that bondAmount > finalFee.\n bondAmount - finalFee,\n // Set the Optimistic oracle liveness for the price request.\n liveness,\n rootBundleProposal.proposer,\n // Canonical value representing \"True\"; i.e. the proposed relay is valid.\n int256(1e18)\n )\n returns (uint256) {\n // Ensure that approval == 0 after the call so the increaseAllowance call below doesn't allow more tokens\n // to transfer than intended.\n bondToken.safeApprove(address(optimisticOracle), 0);\n } catch {\n // Cancel the bundle since the proposal failed.\n _cancelBundle();\n return;\n }\n\n // Dispute the request that we just sent.\n SkinnyOptimisticOracleInterface.Request memory ooPriceRequest = SkinnyOptimisticOracleInterface.Request({\n proposer: rootBundleProposal.proposer,\n disputer: address(0),\n currency: bondToken,\n settled: false,\n proposedPrice: int256(1e18),\n resolvedPrice: 0,\n expirationTime: currentTime + liveness,\n reward: 0,\n finalFee: finalFee,\n bond: bondAmount - finalFee,\n customLiveness: liveness\n });\n\n // Finally, delete the state pertaining to the active proposal so that another proposer can submit a new bundle.\n delete rootBundleProposal;\n\n bondToken.safeTransferFrom(msg.sender, address(this), bondAmount);\n bondToken.safeIncreaseAllowance(address(optimisticOracle), bondAmount);\n optimisticOracle.disputePriceFor(identifier, currentTime, \"\", ooPriceRequest, msg.sender, address(this));\n\n emit RootBundleDisputed(msg.sender, currentTime);\n }\n\n /**\n * @notice Send unclaimed accumulated protocol fees to fee capture address.\n * @param l1Token Token whose protocol fees the caller wants to disburse.\n */\n function claimProtocolFeesCaptured(address l1Token) public override nonReentrant {\n uint256 _unclaimedAccumulatedProtocolFees = unclaimedAccumulatedProtocolFees[l1Token];\n unclaimedAccumulatedProtocolFees[l1Token] = 0;\n IERC20(l1Token).safeTransfer(protocolFeeCaptureAddress, _unclaimedAccumulatedProtocolFees);\n emit ProtocolFeesCapturedClaimed(l1Token, _unclaimedAccumulatedProtocolFees);\n }\n\n /**\n * @notice Conveniently queries which destination token is mapped to the hash of an l1 token + destination chain ID.\n * @param destinationChainId Where destination token is deployed.\n * @param l1Token Ethereum version token.\n * @return destinationToken address The destination token that is sent to spoke pools after this contract bridges\n * the l1Token to the destination chain.\n */\n function poolRebalanceRoute(uint256 destinationChainId, address l1Token)\n external\n view\n override\n returns (address destinationToken)\n {\n return poolRebalanceRoutes[_poolRebalanceRouteKey(l1Token, destinationChainId)];\n }\n\n /**\n * @notice This function allows a caller to load the contract with raw ETH to perform L2 calls. This is needed for\n * Arbitrum calls, but may also be needed for others.\n * @dev This function cannot be included in a multicall transaction call because it is payable. A realistic\n * situation where this might be an issue is if the caller is executing a PoolRebalanceLeaf that needs to relay\n * messages to Arbitrum. Relaying messages to Arbitrum requires that this contract has an ETH balance, so in this\n * case the caller would need to pre-load this contract with ETH before multicall-executing the leaf.\n */\n function loadEthForL2Calls() public payable override {}\n\n /*************************************************\n * INTERNAL FUNCTIONS *\n *************************************************/\n\n // Called when a dispute fails due to parameter changes. This effectively resets the state and cancels the request\n // with no loss of funds, thereby enabling a new bundle to be added.\n function _cancelBundle() internal {\n bondToken.transfer(rootBundleProposal.proposer, bondAmount);\n delete rootBundleProposal;\n emit RootBundleCanceled(msg.sender, getCurrentTime());\n }\n\n function _getOptimisticOracle() internal view returns (SkinnyOptimisticOracleInterface) {\n return\n SkinnyOptimisticOracleInterface(finder.getImplementationAddress(OracleInterfaces.SkinnyOptimisticOracle));\n }\n\n function _getBondTokenFinalFee() internal view returns (uint256) {\n return\n StoreInterface(finder.getImplementationAddress(OracleInterfaces.Store))\n .computeFinalFee(address(bondToken))\n .rawValue;\n }\n\n // Note this method does a lot and wraps together the sending of tokens and updating the pooled token trackers. This\n // is done as a gas saving so we don't need to iterate over the l1Tokens multiple times.\n function _sendTokensToChainAndUpdatePooledTokenTrackers(\n address adapter,\n address spokePool,\n uint256 chainId,\n address[] memory l1Tokens,\n int256[] memory netSendAmounts,\n uint256[] memory bundleLpFees\n ) internal {\n for (uint32 i = 0; i < l1Tokens.length; i++) {\n address l1Token = l1Tokens[i];\n // Validate the L1 -> L2 token route is stored. If it is not then the output of the bridging action\n // could send tokens to the 0x0 address on the L2.\n address l2Token = poolRebalanceRoutes[_poolRebalanceRouteKey(l1Token, chainId)];\n require(l2Token != address(0), \"Route not whitelisted\");\n\n // If the net send amount for this token is positive then: 1) send tokens from L1->L2 to facilitate the L2\n // relayer refund, 2) Update the liquidity trackers for the associated pooled tokens.\n if (netSendAmounts[i] > 0) {\n // Perform delegatecall to use the adapter's code with this contract's context. Opt for delegatecall's\n // complexity in exchange for lower gas costs.\n (bool success, ) = adapter.delegatecall(\n abi.encodeWithSignature(\n \"relayTokens(address,address,uint256,address)\",\n l1Token, // l1Token.\n l2Token, // l2Token.\n uint256(netSendAmounts[i]), // amount.\n spokePool // to. This should be the spokePool.\n )\n );\n require(success, \"delegatecall failed\");\n\n // Liquid reserves is decreased by the amount sent. utilizedReserves is increased by the amount sent.\n pooledTokens[l1Token].utilizedReserves += netSendAmounts[i];\n pooledTokens[l1Token].liquidReserves -= uint256(netSendAmounts[i]);\n }\n\n // Allocate LP fees and protocol fees from the bundle to the associated pooled token trackers.\n _allocateLpAndProtocolFees(l1Token, bundleLpFees[i]);\n }\n }\n\n function _exchangeRateCurrent(address l1Token) internal returns (uint256) {\n PooledToken storage pooledToken = pooledTokens[l1Token]; // Note this is storage so the state can be modified.\n uint256 lpTokenTotalSupply = IERC20(pooledToken.lpToken).totalSupply();\n if (lpTokenTotalSupply == 0) return 1e18; // initial rate is 1:1 between LP tokens and collateral.\n\n // First, update fee counters and local accounting of finalized transfers from L2 -> L1.\n _updateAccumulatedLpFees(pooledToken); // Accumulate all allocated fees from the last time this method was called.\n _sync(l1Token); // Fetch any balance changes due to token bridging finalization and factor them in.\n\n // ExchangeRate := (liquidReserves + utilizedReserves - undistributedLpFees) / lpTokenSupply\n // Both utilizedReserves and undistributedLpFees contain assigned LP fees. UndistributedLpFees is gradually\n // decreased over the smear duration using _updateAccumulatedLpFees. This means that the exchange rate will\n // gradually increase over time as undistributedLpFees goes to zero.\n // utilizedReserves can be negative. If this is the case, then liquidReserves is offset by an equal\n // and opposite size. LiquidReserves + utilizedReserves will always be larger than undistributedLpFees so this\n // int will always be positive so there is no risk in underflow in type casting in the return line.\n int256 numerator = int256(pooledToken.liquidReserves) +\n pooledToken.utilizedReserves -\n int256(pooledToken.undistributedLpFees);\n return (uint256(numerator) * 1e18) / lpTokenTotalSupply;\n }\n\n // Update internal fee counters by adding in any accumulated fees from the last time this logic was called.\n function _updateAccumulatedLpFees(PooledToken storage pooledToken) internal {\n uint256 accumulatedFees = _getAccumulatedFees(pooledToken.undistributedLpFees, pooledToken.lastLpFeeUpdate);\n pooledToken.undistributedLpFees -= accumulatedFees;\n pooledToken.lastLpFeeUpdate = uint32(getCurrentTime());\n }\n\n // Calculate the unallocated accumulatedFees from the last time the contract was called.\n function _getAccumulatedFees(uint256 undistributedLpFees, uint256 lastLpFeeUpdate) internal view returns (uint256) {\n // accumulatedFees := min(undistributedLpFees * lpFeeRatePerSecond * timeFromLastInteraction, undistributedLpFees)\n // The min acts to pay out all fees in the case the equation returns more than the remaining fees.\n uint256 timeFromLastInteraction = getCurrentTime() - lastLpFeeUpdate;\n uint256 maxUndistributedLpFees = (undistributedLpFees * lpFeeRatePerSecond * timeFromLastInteraction) / (1e18);\n return maxUndistributedLpFees < undistributedLpFees ? maxUndistributedLpFees : undistributedLpFees;\n }\n\n function _sync(address l1Token) internal {\n // Check if the l1Token balance of the contract is greater than the liquidReserves. If it is then the bridging\n // action from L2 -> L1 has concluded and the local accounting can be updated.\n // Note: this calculation must take into account the bond when it's acting on the bond token and there's an\n // active request.\n uint256 balance = IERC20(l1Token).balanceOf(address(this));\n uint256 balanceSansBond = l1Token == address(bondToken) && _activeRequest() ? balance - bondAmount : balance;\n if (balanceSansBond > pooledTokens[l1Token].liquidReserves) {\n // Note the numerical operation below can send utilizedReserves to negative. This can occur when tokens are\n // dropped onto the contract, exceeding the liquidReserves.\n pooledTokens[l1Token].utilizedReserves -= int256(balanceSansBond - pooledTokens[l1Token].liquidReserves);\n pooledTokens[l1Token].liquidReserves = balanceSansBond;\n }\n }\n\n function _liquidityUtilizationPostRelay(address l1Token, uint256 relayedAmount) internal returns (uint256) {\n _sync(l1Token); // Fetch any balance changes due to token bridging finalization and factor them in.\n\n // liquidityUtilizationRatio := (relayedAmount + max(utilizedReserves,0)) / (liquidReserves + max(utilizedReserves,0))\n // UtilizedReserves has a dual meaning: if it's greater than zero then it represents funds pending in the bridge\n // that will flow from L2 to L1. In this case, we can use it normally in the equation. However, if it is\n // negative, then it is already counted in liquidReserves. This occurs if tokens are transferred directly to the\n // contract. In this case, ignore it as it is captured in liquid reserves and has no meaning in the numerator.\n PooledToken memory pooledToken = pooledTokens[l1Token]; // Note this is storage so the state can be modified.\n uint256 flooredUtilizedReserves = pooledToken.utilizedReserves > 0 ? uint256(pooledToken.utilizedReserves) : 0;\n uint256 numerator = relayedAmount + flooredUtilizedReserves;\n uint256 denominator = pooledToken.liquidReserves + flooredUtilizedReserves;\n\n // If the denominator equals zero, return 1e18 (max utilization).\n if (denominator == 0) return 1e18;\n\n // In all other cases, return the utilization ratio.\n return (numerator * 1e18) / denominator;\n }\n\n function _allocateLpAndProtocolFees(address l1Token, uint256 bundleLpFees) internal {\n // Calculate the fraction of bundledLpFees that are allocated to the protocol and to the LPs.\n uint256 protocolFeesCaptured = (bundleLpFees * protocolFeeCapturePct) / 1e18;\n uint256 lpFeesCaptured = bundleLpFees - protocolFeesCaptured;\n\n // Assign any LP fees included into the bundle to the pooled token. These LP fees are tracked in the\n // undistributedLpFees and within the utilizedReserves. undistributedLpFees is gradually decreased\n // over the smear duration to give the LPs their rewards over a period of time. Adding to utilizedReserves\n // acts to track these rewards after the smear duration. See _exchangeRateCurrent for more details.\n if (lpFeesCaptured > 0) {\n pooledTokens[l1Token].undistributedLpFees += lpFeesCaptured;\n pooledTokens[l1Token].utilizedReserves += int256(lpFeesCaptured);\n }\n\n // If there are any protocol fees, allocate them to the unclaimed protocol tracker amount.\n if (protocolFeesCaptured > 0) unclaimedAccumulatedProtocolFees[l1Token] += protocolFeesCaptured;\n }\n\n function _relaySpokePoolAdminFunction(uint256 chainId, bytes memory functionData) internal {\n (address adapter, address spokePool) = _getInitializedCrossChainContracts(chainId);\n\n // Perform delegatecall to use the adapter's code with this contract's context.\n (bool success, ) = adapter.delegatecall(\n abi.encodeWithSignature(\n \"relayMessage(address,bytes)\",\n spokePool, // target. This should be the spokePool on the L2.\n functionData\n )\n );\n require(success, \"delegatecall failed\");\n emit SpokePoolAdminFunctionTriggered(chainId, functionData);\n }\n\n function _poolRebalanceRouteKey(address l1Token, uint256 destinationChainId) internal pure returns (bytes32) {\n return keccak256(abi.encode(l1Token, destinationChainId));\n }\n\n function _getInitializedCrossChainContracts(uint256 chainId)\n internal\n view\n returns (address adapter, address spokePool)\n {\n adapter = crossChainContracts[chainId].adapter;\n spokePool = crossChainContracts[chainId].spokePool;\n require(spokePool != address(0), \"SpokePool not initialized\");\n require(adapter.isContract(), \"Adapter not initialized\");\n }\n\n function _activeRequest() internal view returns (bool) {\n return rootBundleProposal.unclaimedPoolRebalanceLeafCount != 0;\n }\n\n // If functionCallStackOriginatesFromOutsideThisContract is true then this was called by the callback function\n // by dropping ETH onto the contract. In this case, deposit the ETH into WETH. This would happen if ETH was sent\n // over the optimism bridge, for example. If false then this was set as a result of unwinding LP tokens, with the\n // intention of sending ETH to the LP. In this case, do nothing as we intend on sending the ETH to the LP.\n function _depositEthToWeth() internal {\n if (functionCallStackOriginatesFromOutsideThisContract()) weth.deposit{ value: msg.value }();\n }\n\n // Added to enable the HubPool to receive ETH. This will occur both when the HubPool unwraps WETH to send to LPs and\n // when ETH is sent over the canonical Optimism bridge, which sends ETH.\n fallback() external payable {\n _depositEthToWeth();\n }\n\n receive() external payable {\n _depositEthToWeth();\n }\n}\n" }, "contracts/MerkleLib.sol": { - "content": "// SPDX-License-Identifier: GPL-3.0-only\npragma solidity ^0.8.0;\n\nimport \"@openzeppelin/contracts/utils/cryptography/MerkleProof.sol\";\nimport \"./SpokePoolInterface.sol\";\nimport \"./HubPoolInterface.sol\";\n\n/**\n * @notice Library to help with merkle roots, proofs, and claims.\n */\nlibrary MerkleLib {\n /**\n * @notice Verifies that a repayment is contained within a merkle root.\n * @param root the merkle root.\n * @param rebalance the rebalance struct.\n * @param proof the merkle proof.\n */\n function verifyPoolRebalance(\n bytes32 root,\n HubPoolInterface.PoolRebalanceLeaf memory rebalance,\n bytes32[] memory proof\n ) internal pure returns (bool) {\n return MerkleProof.verify(proof, root, keccak256(abi.encode(rebalance)));\n }\n\n /**\n * @notice Verifies that a relayer refund is contained within a merkle root.\n * @param root the merkle root.\n * @param refund the refund struct.\n * @param proof the merkle proof.\n */\n function verifyRelayerRefund(\n bytes32 root,\n SpokePoolInterface.RelayerRefundLeaf memory refund,\n bytes32[] memory proof\n ) internal pure returns (bool) {\n return MerkleProof.verify(proof, root, keccak256(abi.encode(refund)));\n }\n\n /**\n * @notice Verifies that a distribution is contained within a merkle root.\n * @param root the merkle root.\n * @param slowRelayFulfillment the relayData fulfullment struct.\n * @param proof the merkle proof.\n */\n function verifySlowRelayFulfillment(\n bytes32 root,\n SpokePoolInterface.RelayData memory slowRelayFulfillment,\n bytes32[] memory proof\n ) internal pure returns (bool) {\n return MerkleProof.verify(proof, root, keccak256(abi.encode(slowRelayFulfillment)));\n }\n\n // The following functions are primarily copied from\n // https://github.com/Uniswap/merkle-distributor/blob/master/contracts/MerkleDistributor.sol with minor changes.\n\n /**\n * @notice Tests whether a claim is contained within a claimedBitMap mapping.\n * @param claimedBitMap a simple uint256 mapping in storage used as a bitmap.\n * @param index the index to check in the bitmap.\n * @return bool indicating if the index within the claimedBitMap has been marked as claimed.\n */\n function isClaimed(mapping(uint256 => uint256) storage claimedBitMap, uint256 index) internal view returns (bool) {\n uint256 claimedWordIndex = index / 256;\n uint256 claimedBitIndex = index % 256;\n uint256 claimedWord = claimedBitMap[claimedWordIndex];\n uint256 mask = (1 << claimedBitIndex);\n return claimedWord & mask == mask;\n }\n\n /**\n * @notice Marks an index in a claimedBitMap as claimed.\n * @param claimedBitMap a simple uint256 mapping in storage used as a bitmap.\n * @param index the index to mark in the bitmap.\n */\n function setClaimed(mapping(uint256 => uint256) storage claimedBitMap, uint256 index) internal {\n uint256 claimedWordIndex = index / 256;\n uint256 claimedBitIndex = index % 256;\n claimedBitMap[claimedWordIndex] = claimedBitMap[claimedWordIndex] | (1 << claimedBitIndex);\n }\n\n /**\n * @notice Tests whether a claim is contained within a 1D claimedBitMap mapping.\n * @param claimedBitMap a simple uint256 value, encoding a 1D bitmap.\n * @param index the index to check in the bitmap.\n \\* @return bool indicating if the index within the claimedBitMap has been marked as claimed.\n */\n function isClaimed1D(uint256 claimedBitMap, uint256 index) internal pure returns (bool) {\n uint256 mask = (1 << index);\n return claimedBitMap & mask == mask;\n }\n\n /**\n * @notice Marks an index in a claimedBitMap as claimed.\n * @param claimedBitMap a simple uint256 mapping in storage used as a bitmap.\n * @param index the index to mark in the bitmap.\n */\n function setClaimed1D(uint256 claimedBitMap, uint256 index) internal pure returns (uint256) {\n require(index <= 255, \"Index out of bounds\");\n return claimedBitMap | (1 << index % 256);\n }\n}\n" + "content": "// SPDX-License-Identifier: GPL-3.0-only\npragma solidity ^0.8.0;\n\nimport \"./SpokePoolInterface.sol\";\nimport \"./HubPoolInterface.sol\";\n\nimport \"@openzeppelin/contracts/utils/cryptography/MerkleProof.sol\";\n\n/**\n * @notice Library to help with merkle roots, proofs, and claims.\n */\nlibrary MerkleLib {\n /**\n * @notice Verifies that a repayment is contained within a merkle root.\n * @param root the merkle root.\n * @param rebalance the rebalance struct.\n * @param proof the merkle proof.\n * @return bool to signal if the pool rebalance proof correctly shows inclusion of the rebalance within the tree.\n */\n function verifyPoolRebalance(\n bytes32 root,\n HubPoolInterface.PoolRebalanceLeaf memory rebalance,\n bytes32[] memory proof\n ) internal pure returns (bool) {\n return MerkleProof.verify(proof, root, keccak256(abi.encode(rebalance)));\n }\n\n /**\n * @notice Verifies that a relayer refund is contained within a merkle root.\n * @param root the merkle root.\n * @param refund the refund struct.\n * @param proof the merkle proof.\n * @return bool to signal if the relayer refund proof correctly shows inclusion of the refund within the tree.\n */\n function verifyRelayerRefund(\n bytes32 root,\n SpokePoolInterface.RelayerRefundLeaf memory refund,\n bytes32[] memory proof\n ) internal pure returns (bool) {\n return MerkleProof.verify(proof, root, keccak256(abi.encode(refund)));\n }\n\n /**\n * @notice Verifies that a distribution is contained within a merkle root.\n * @param root the merkle root.\n * @param slowRelayFulfillment the relayData fulfillment struct.\n * @param proof the merkle proof.\n * @return bool to signal if the slow relay's proof correctly shows inclusion of the slow relay within the tree.\n */\n function verifySlowRelayFulfillment(\n bytes32 root,\n SpokePoolInterface.RelayData memory slowRelayFulfillment,\n bytes32[] memory proof\n ) internal pure returns (bool) {\n return MerkleProof.verify(proof, root, keccak256(abi.encode(slowRelayFulfillment)));\n }\n\n // The following functions are primarily copied from\n // https://github.com/Uniswap/merkle-distributor/blob/master/contracts/MerkleDistributor.sol with minor changes.\n\n /**\n * @notice Tests whether a claim is contained within a claimedBitMap mapping.\n * @param claimedBitMap a simple uint256 mapping in storage used as a bitmap.\n * @param index the index to check in the bitmap.\n * @return bool indicating if the index within the claimedBitMap has been marked as claimed.\n */\n function isClaimed(mapping(uint256 => uint256) storage claimedBitMap, uint256 index) internal view returns (bool) {\n uint256 claimedWordIndex = index / 256;\n uint256 claimedBitIndex = index % 256;\n uint256 claimedWord = claimedBitMap[claimedWordIndex];\n uint256 mask = (1 << claimedBitIndex);\n return claimedWord & mask == mask;\n }\n\n /**\n * @notice Marks an index in a claimedBitMap as claimed.\n * @param claimedBitMap a simple uint256 mapping in storage used as a bitmap.\n * @param index the index to mark in the bitmap.\n */\n function setClaimed(mapping(uint256 => uint256) storage claimedBitMap, uint256 index) internal {\n uint256 claimedWordIndex = index / 256;\n uint256 claimedBitIndex = index % 256;\n claimedBitMap[claimedWordIndex] = claimedBitMap[claimedWordIndex] | (1 << claimedBitIndex);\n }\n\n /**\n * @notice Tests whether a claim is contained within a 1D claimedBitMap mapping.\n * @param claimedBitMap a simple uint256 value, encoding a 1D bitmap.\n * @param index the index to check in the bitmap. Uint8 type enforces that index can't be > 255.\n * @return bool indicating if the index within the claimedBitMap has been marked as claimed.\n */\n function isClaimed1D(uint256 claimedBitMap, uint8 index) internal pure returns (bool) {\n uint256 mask = (1 << index);\n return claimedBitMap & mask == mask;\n }\n\n /**\n * @notice Marks an index in a claimedBitMap as claimed.\n * @param claimedBitMap a simple uint256 mapping in storage used as a bitmap. Uint8 type enforces that index\n * can't be > 255.\n * @param index the index to mark in the bitmap.\n * @return uint256 representing the modified input claimedBitMap with the index set to true.\n */\n function setClaimed1D(uint256 claimedBitMap, uint8 index) internal pure returns (uint256) {\n return claimedBitMap | (1 << index % 256);\n }\n}\n" }, "contracts/HubPoolInterface.sol": { - "content": "// SPDX-License-Identifier: GPL-3.0-only\npragma solidity ^0.8.0;\n\nimport \"@openzeppelin/contracts/token/ERC20/IERC20.sol\";\nimport \"./interfaces/AdapterInterface.sol\";\n\n/**\n * @notice Concise list of functions in HubPool implementation.\n */\ninterface HubPoolInterface {\n // This leaf is meant to be decoded in the HubPool to rebalance tokens between HubPool and SpokePool.\n struct PoolRebalanceLeaf {\n // This is used to know which chain to send cross-chain transactions to (and which SpokePool to sent to).\n uint256 chainId;\n // Total LP fee amount per token in this bundle, encompassing all associated bundled relays.\n uint256[] bundleLpFees;\n // This array is grouped with the two above, and it represents the amount to send or request back from the\n // SpokePool. If positive, the pool will pay the SpokePool. If negative the SpokePool will pay the HubPool.\n // There can be arbitrarily complex rebalancing rules defined offchain. This number is only nonzero\n // when the rules indicate that a rebalancing action should occur. When a rebalance does not occur,\n // runningBalances for this token should change by the total relays - deposits in this bundle. When a rebalance\n // does occur, runningBalances should be set to zero for this token and the netSendAmounts should be set to the\n // previous runningBalances + relays - deposits in this bundle.\n int256[] netSendAmounts;\n // This is only here to be emitted in an event to track a running unpaid balance between the L2 pool and the L1 pool.\n // A positive number indicates that the HubPool owes the SpokePool funds. A negative number indicates that the\n // SpokePool owes the HubPool funds. See the comment above for the dynamics of this and netSendAmounts\n int256[] runningBalances;\n // Used as the index in the bitmap to track whether this leaf has been executed or not.\n uint8 leafId;\n // The following arrays are required to be the same length. They are parallel arrays for the given chainId and\n // should be ordered by the l1Tokens field. All whitelisted tokens with nonzero relays on this chain in this\n // bundle in the order of whitelisting.\n address[] l1Tokens;\n }\n\n function relaySpokePoolAdminFunction(uint256 chainId, bytes memory functionData) external;\n\n function setProtocolFeeCapture(address newProtocolFeeCaptureAddress, uint256 newProtocolFeeCapturePct) external;\n\n function setBond(IERC20 newBondToken, uint256 newBondAmount) external;\n\n function setLiveness(uint32 newLiveness) external;\n\n function setIdentifier(bytes32 newIdentifier) external;\n\n function setCrossChainContracts(\n uint256 l2ChainId,\n address adapter,\n address spokePool\n ) external;\n\n function whitelistRoute(\n uint256 originChainId,\n uint256 destinationChainId,\n address originToken,\n address destinationToken,\n bool enableRoute\n ) external;\n\n function enableL1TokenForLiquidityProvision(address l1Token) external;\n\n function disableL1TokenForLiquidityProvision(address l1Token) external;\n\n function addLiquidity(address l1Token, uint256 l1TokenAmount) external payable;\n\n function removeLiquidity(\n address l1Token,\n uint256 lpTokenAmount,\n bool sendEth\n ) external;\n\n function exchangeRateCurrent(address l1Token) external returns (uint256);\n\n function liquidityUtilizationCurrent(address l1Token) external returns (uint256);\n\n function liquidityUtilizationPostRelay(address token, uint256 relayedAmount) external returns (uint256);\n\n function sync(address l1Token) external;\n\n function proposeRootBundle(\n uint256[] memory bundleEvaluationBlockNumbers,\n uint8 poolRebalanceLeafCount,\n bytes32 poolRebalanceRoot,\n bytes32 relayerRefundRoot,\n bytes32 slowRelayRoot\n ) external;\n\n function executeRootBundle(PoolRebalanceLeaf memory poolRebalanceLeaf, bytes32[] memory proof) external;\n\n function disputeRootBundle() external;\n\n function claimProtocolFeesCaptured(address l1Token) external;\n\n function getRootBundleProposalAncillaryData() external view returns (bytes memory ancillaryData);\n\n function whitelistedRoute(\n uint256 originChainId,\n address originToken,\n uint256 destinationChainId\n ) external view returns (address);\n\n function loadEthForL2Calls() external payable;\n}\n" + "content": "// SPDX-License-Identifier: GPL-3.0-only\npragma solidity ^0.8.0;\n\nimport \"./interfaces/AdapterInterface.sol\";\n\nimport \"@openzeppelin/contracts/token/ERC20/IERC20.sol\";\n\n/**\n * @notice Concise list of functions in HubPool implementation.\n */\ninterface HubPoolInterface {\n // This leaf is meant to be decoded in the HubPool to rebalance tokens between HubPool and SpokePool.\n struct PoolRebalanceLeaf {\n // This is used to know which chain to send cross-chain transactions to (and which SpokePool to send to).\n uint256 chainId;\n // Total LP fee amount per token in this bundle, encompassing all associated bundled relays.\n uint256[] bundleLpFees;\n // This array is grouped with the two above, and it represents the amount to send or request back from the\n // SpokePool. If positive, the pool will pay the SpokePool. If negative the SpokePool will pay the HubPool.\n // There can be arbitrarily complex rebalancing rules defined offchain. This number is only nonzero when the\n // rules indicate that a rebalancing action should occur. When a rebalance does occur, runningBalances should be\n // set to zero for this token and the netSendAmounts should be set to the previous runningBalances + relays -\n // deposits in this bundle. If non-zero then it must be set on the SpokePool's RelayerRefundLeaf amountToReturn\n // as -1 * this value to indicate if funds are being sent from or to the SpokePool.\n int256[] netSendAmounts;\n // This is only here to be emitted in an event to track a running unpaid balance between the L2 pool and the L1\n // pool. A positive number indicates that the HubPool owes the SpokePool funds. A negative number indicates that\n // the SpokePool owes the HubPool funds. See the comment above for the dynamics of this and netSendAmounts.\n int256[] runningBalances;\n // Used by data worker to mark which leaves should relay roots to SpokePools, and to otherwise organize leaves.\n // For example, each leaf should contain all the rebalance information for a single chain, but in the case where\n // the list of l1Tokens is very large such that they all can't fit into a single leaf that can be executed under\n // the block gas limit, then the data worker can use this groupIndex to organize them. Any leaves with\n // a groupIndex equal to 0 will relay roots to the SpokePool, so the data worker should ensure that only one\n // leaf for a specific chainId should have a groupIndex equal to 0.\n uint256 groupIndex;\n // Used as the index in the bitmap to track whether this leaf has been executed or not.\n uint8 leafId;\n // The following arrays are required to be the same length. They are parallel arrays for the given chainId and\n // should be ordered by the l1Tokens field. All whitelisted tokens with nonzero relays on this chain in this\n // bundle in the order of whitelisting.\n address[] l1Tokens;\n }\n\n // A data worker can optimistically store several merkle roots on this contract by staking a bond and calling\n // proposeRootBundle. By staking a bond, the data worker is alleging that the merkle roots all contain valid leaves\n // that can be executed later to:\n // - Send funds from this contract to a SpokePool or vice versa\n // - Send funds from a SpokePool to Relayer as a refund for a relayed deposit\n // - Send funds from a SpokePool to a deposit recipient to fulfill a \"slow\" relay\n // Anyone can dispute this struct if the merkle roots contain invalid leaves before the\n // requestExpirationTimestamp. Once the expiration timestamp is passed, executeRootBundle to execute a leaf\n // from the poolRebalanceRoot on this contract and it will simultaneously publish the relayerRefundRoot and\n // slowRelayRoot to a SpokePool. The latter two roots, once published to the SpokePool, contain\n // leaves that can be executed on the SpokePool to pay relayers or recipients.\n struct RootBundle {\n // Contains leaves instructing this contract to send funds to SpokePools.\n bytes32 poolRebalanceRoot;\n // Relayer refund merkle root to be published to a SpokePool.\n bytes32 relayerRefundRoot;\n // Slow relay merkle root to be published to a SpokePool.\n bytes32 slowRelayRoot;\n // This is a 1D bitmap, with max size of 256 elements, limiting us to 256 chainsIds.\n uint256 claimedBitMap;\n // Proposer of this root bundle.\n address proposer;\n // Number of pool rebalance leaves to execute in the poolRebalanceRoot. After this number\n // of leaves are executed, a new root bundle can be proposed\n uint8 unclaimedPoolRebalanceLeafCount;\n // When root bundle challenge period passes and this root bundle becomes executable.\n uint32 requestExpirationTimestamp;\n }\n\n // Each whitelisted L1 token has an associated pooledToken struct that contains all information used to track the\n // cumulative LP positions and if this token is enabled for deposits.\n struct PooledToken {\n // LP token given to LPs of a specific L1 token.\n address lpToken;\n // True if accepting new LP's.\n bool isEnabled;\n // Timestamp of last LP fee update.\n uint32 lastLpFeeUpdate;\n // Number of LP funds sent via pool rebalances to SpokePools and are expected to be sent\n // back later.\n int256 utilizedReserves;\n // Number of LP funds held in contract less utilized reserves.\n uint256 liquidReserves;\n // Number of LP funds reserved to pay out to LPs as fees.\n uint256 undistributedLpFees;\n }\n\n // Helper contracts to facilitate cross chain actions between HubPool and SpokePool for a specific network.\n struct CrossChainContract {\n address adapter;\n address spokePool;\n }\n\n function setPaused(bool pause) external;\n\n function emergencyDeleteProposal() external;\n\n function relaySpokePoolAdminFunction(uint256 chainId, bytes memory functionData) external;\n\n function setProtocolFeeCapture(address newProtocolFeeCaptureAddress, uint256 newProtocolFeeCapturePct) external;\n\n function setBond(IERC20 newBondToken, uint256 newBondAmount) external;\n\n function setLiveness(uint32 newLiveness) external;\n\n function setIdentifier(bytes32 newIdentifier) external;\n\n function setCrossChainContracts(\n uint256 l2ChainId,\n address adapter,\n address spokePool\n ) external;\n\n function enableL1TokenForLiquidityProvision(address l1Token) external;\n\n function disableL1TokenForLiquidityProvision(address l1Token) external;\n\n function addLiquidity(address l1Token, uint256 l1TokenAmount) external payable;\n\n function removeLiquidity(\n address l1Token,\n uint256 lpTokenAmount,\n bool sendEth\n ) external;\n\n function exchangeRateCurrent(address l1Token) external returns (uint256);\n\n function liquidityUtilizationCurrent(address l1Token) external returns (uint256);\n\n function liquidityUtilizationPostRelay(address token, uint256 relayedAmount) external returns (uint256);\n\n function sync(address l1Token) external;\n\n function proposeRootBundle(\n uint256[] memory bundleEvaluationBlockNumbers,\n uint8 poolRebalanceLeafCount,\n bytes32 poolRebalanceRoot,\n bytes32 relayerRefundRoot,\n bytes32 slowRelayRoot\n ) external;\n\n function executeRootBundle(\n uint256 chainId,\n uint256 groupIndex,\n uint256[] memory bundleLpFees,\n int256[] memory netSendAmounts,\n int256[] memory runningBalances,\n uint8 leafId,\n address[] memory l1Tokens,\n bytes32[] memory proof\n ) external;\n\n function disputeRootBundle() external;\n\n function claimProtocolFeesCaptured(address l1Token) external;\n\n function setPoolRebalanceRoute(\n uint256 destinationChainId,\n address l1Token,\n address destinationToken\n ) external;\n\n function setDepositRoute(\n uint256 originChainId,\n uint256 destinationChainId,\n address originToken,\n bool depositsEnabled\n ) external;\n\n function poolRebalanceRoute(uint256 destinationChainId, address l1Token)\n external\n view\n returns (address destinationToken);\n\n function loadEthForL2Calls() external payable;\n}\n" }, "contracts/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 * @dev The reason why we use this local contract instead of importing from uma/contracts is because of the addition\n * of the internal method `functionCallStackOriginatesFromOutsideThisContract` which doesn't exist in the one exported\n * by uma/contracts.\n */\ncontract Lockable {\n bool internal _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 /**\n * @dev Returns true if the contract is currently in a non-entered state, meaning that the origination of the call\n * came from outside the contract. This is relevant with fallback/receive methods to see if the call came from ETH\n * being dropped onto the contract externally or due to ETH dropped on the the contract from within a method in this\n * contract, such as unwrapping WETH to ETH within the contract.\n */\n function functionCallStackOriginatesFromOutsideThisContract() internal view returns (bool) {\n return _notEntered;\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" }, - "contracts/interfaces/AdapterInterface.sol": { - "content": "// SPDX-License-Identifier: AGPL-3.0-only\npragma solidity ^0.8.0;\n\n/**\n * @notice Sends cross chain messages and tokens to contracts on a specific L2 network.\n */\n\ninterface AdapterInterface {\n event HubPoolChanged(address newHubPool);\n\n event MessageRelayed(address target, bytes message);\n\n event TokensRelayed(address l1Token, address l2Token, uint256 amount, address to);\n\n function relayMessage(address target, bytes memory message) external payable;\n\n function relayTokens(\n address l1Token,\n address l2Token,\n uint256 amount,\n address to\n ) external payable;\n}\n" - }, "contracts/interfaces/LpTokenFactoryInterface.sol": { - "content": "// SPDX-License-Identifier: AGPL-3.0-only\npragma solidity ^0.8.0;\n\nimport \"@openzeppelin/contracts/token/ERC20/IERC20.sol\";\n\ninterface LpTokenFactoryInterface {\n function createLpToken(address l1Token) external returns (address);\n}\n" + "content": "// SPDX-License-Identifier: AGPL-3.0-only\npragma solidity ^0.8.0;\n\ninterface LpTokenFactoryInterface {\n function createLpToken(address l1Token) external returns (address);\n}\n" }, "contracts/interfaces/WETH9.sol": { "content": "// SPDX-License-Identifier: GPL-3.0-only\npragma solidity ^0.8.0;\n\ninterface WETH9 {\n function withdraw(uint256 wad) external;\n\n function deposit() external payable;\n\n function balanceOf(address guy) external view returns (uint256 wad);\n\n function transfer(address guy, uint256 wad) external;\n}\n" @@ -64,11 +61,14 @@ "@openzeppelin/contracts/utils/Address.sol": { "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.5.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 *\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://diligence.consensys.net/posts/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.5.11/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 functionCall(target, data, \"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(\n address target,\n bytes memory data,\n uint256 value\n ) 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 require(isContract(target), \"Address: call to non-contract\");\n\n (bool success, bytes memory returndata) = target.call{value: value}(data);\n return verifyCallResult(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 require(isContract(target), \"Address: static call to non-contract\");\n\n (bool success, bytes memory returndata) = target.staticcall(data);\n return verifyCallResult(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 require(isContract(target), \"Address: delegate call to non-contract\");\n\n (bool success, bytes memory returndata) = target.delegatecall(data);\n return verifyCallResult(success, returndata, errorMessage);\n }\n\n /**\n * @dev Tool to verifies that a low level call was successful, and revert if it wasn't, either by bubbling the\n * revert reason 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 // 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\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}\n" }, + "contracts/SpokePoolInterface.sol": { + "content": "// SPDX-License-Identifier: GPL-3.0-only\npragma solidity ^0.8.0;\n\n/**\n * @notice Contains common data structures and functions used by all SpokePool implementations.\n */\ninterface SpokePoolInterface {\n // This leaf is meant to be decoded in the SpokePool to pay out successful relayers.\n struct RelayerRefundLeaf {\n // This is the amount to return to the HubPool. This occurs when there is a PoolRebalanceLeaf netSendAmount that\n // is negative. This is just the negative of this value.\n uint256 amountToReturn;\n // Used to verify that this is being executed on the correct destination chainId.\n uint256 chainId;\n // This array designates how much each of those addresses should be refunded.\n uint256[] refundAmounts;\n // Used as the index in the bitmap to track whether this leaf has been executed or not.\n uint32 leafId;\n // The associated L2TokenAddress that these claims apply to.\n address l2TokenAddress;\n // Must be same length as refundAmounts and designates each address that must be refunded.\n address[] refundAddresses;\n }\n\n // This struct represents the data to fully specify a relay. If any portion of this data differs, the relay is\n // considered to be completely distinct. Only one relay for a particular depositId, chainId pair should be\n // considered valid and repaid. This data is hashed and inserted into the slow relay merkle root so that an off\n // chain validator can choose when to refund slow relayers.\n struct RelayData {\n // The address that made the deposit on the origin chain.\n address depositor;\n // The recipient address on the destination chain.\n address recipient;\n // The corresponding token address on the destination chain.\n address destinationToken;\n // The total relay amount before fees are taken out.\n uint256 amount;\n // Origin chain id.\n uint256 originChainId;\n // Destination chain id.\n uint256 destinationChainId;\n // The LP Fee percentage computed by the relayer based on the deposit's quote timestamp\n // and the HubPool's utilization.\n uint64 realizedLpFeePct;\n // The relayer fee percentage specified in the deposit.\n uint64 relayerFeePct;\n // The id uniquely identifying this deposit on the origin chain.\n uint32 depositId;\n }\n\n // Stores collection of merkle roots that can be published to this contract from the HubPool, which are referenced\n // by \"data workers\" via inclusion proofs to execute leaves in the roots.\n struct RootBundle {\n // Merkle root of slow relays that were not fully filled and whose recipient is still owed funds from the LP pool.\n bytes32 slowRelayRoot;\n // Merkle root of relayer refunds for successful relays.\n bytes32 relayerRefundRoot;\n // This is a 2D bitmap tracking which leaves in the relayer refund root have been claimed, with max size of\n // 256x256 leaves per root.\n mapping(uint256 => uint256) claimedBitmap;\n }\n\n function setCrossDomainAdmin(address newCrossDomainAdmin) external;\n\n function setHubPool(address newHubPool) external;\n\n function setEnableRoute(\n address originToken,\n uint256 destinationChainId,\n bool enable\n ) external;\n\n function setDepositQuoteTimeBuffer(uint32 buffer) external;\n\n function relayRootBundle(bytes32 relayerRefundRoot, bytes32 slowRelayRoot) external;\n\n function emergencyDeleteRootBundle(uint256 rootBundleId) external;\n\n function deposit(\n address recipient,\n address originToken,\n uint256 amount,\n uint256 destinationChainId,\n uint64 relayerFeePct,\n uint32 quoteTimestamp\n ) external payable;\n\n function speedUpDeposit(\n address depositor,\n uint64 newRelayerFeePct,\n uint32 depositId,\n bytes memory depositorSignature\n ) external;\n\n function fillRelay(\n address depositor,\n address recipient,\n address destinationToken,\n uint256 amount,\n uint256 maxTokensToSend,\n uint256 repaymentChainId,\n uint256 originChainId,\n uint64 realizedLpFeePct,\n uint64 relayerFeePct,\n uint32 depositId\n ) external;\n\n function fillRelayWithUpdatedFee(\n address depositor,\n address recipient,\n address destinationToken,\n uint256 amount,\n uint256 maxTokensToSend,\n uint256 repaymentChainId,\n uint256 originChainId,\n uint64 realizedLpFeePct,\n uint64 relayerFeePct,\n uint64 newRelayerFeePct,\n uint32 depositId,\n bytes memory depositorSignature\n ) external;\n\n function executeSlowRelayRoot(\n address depositor,\n address recipient,\n address destinationToken,\n uint256 amount,\n uint256 originChainId,\n uint64 realizedLpFeePct,\n uint64 relayerFeePct,\n uint32 depositId,\n uint32 rootBundleId,\n bytes32[] memory proof\n ) external;\n\n function executeRelayerRefundRoot(\n uint32 rootBundleId,\n SpokePoolInterface.RelayerRefundLeaf memory relayerRefundLeaf,\n bytes32[] memory proof\n ) external;\n\n function chainId() external view returns (uint256);\n}\n" + }, "@openzeppelin/contracts/utils/cryptography/MerkleProof.sol": { "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.5.0) (utils/cryptography/MerkleProof.sol)\n\npragma solidity ^0.8.0;\n\n/**\n * @dev These functions deal with verification of Merkle Trees proofs.\n *\n * The proofs can be generated using the JavaScript library\n * https://github.com/miguelmota/merkletreejs[merkletreejs].\n * Note: the hashing algorithm should be keccak256 and pair sorting should be enabled.\n *\n * See `test/utils/cryptography/MerkleProof.test.js` for some examples.\n */\nlibrary MerkleProof {\n /**\n * @dev Returns true if a `leaf` can be proved to be a part of a Merkle tree\n * defined by `root`. For this, a `proof` must be provided, containing\n * sibling hashes on the branch from the leaf to the root of the tree. Each\n * pair of leaves and each pair of pre-images are assumed to be sorted.\n */\n function verify(\n bytes32[] memory proof,\n bytes32 root,\n bytes32 leaf\n ) internal pure returns (bool) {\n return processProof(proof, leaf) == root;\n }\n\n /**\n * @dev Returns the rebuilt hash obtained by traversing a Merklee tree up\n * from `leaf` using `proof`. A `proof` is valid if and only if the rebuilt\n * hash matches the root of the tree. When processing the proof, the pairs\n * of leafs & pre-images are assumed to be sorted.\n *\n * _Available since v4.4._\n */\n function processProof(bytes32[] memory proof, bytes32 leaf) internal pure returns (bytes32) {\n bytes32 computedHash = leaf;\n for (uint256 i = 0; i < proof.length; i++) {\n bytes32 proofElement = proof[i];\n if (computedHash <= proofElement) {\n // Hash(current computed hash + current element of the proof)\n computedHash = _efficientHash(computedHash, proofElement);\n } else {\n // Hash(current element of the proof + current computed hash)\n computedHash = _efficientHash(proofElement, computedHash);\n }\n }\n return computedHash;\n }\n\n function _efficientHash(bytes32 a, bytes32 b) private pure returns (bytes32 value) {\n assembly {\n mstore(0x00, a)\n mstore(0x20, b)\n value := keccak256(0x00, 0x40)\n }\n }\n}\n" }, - "contracts/SpokePoolInterface.sol": { - "content": "// SPDX-License-Identifier: GPL-3.0-only\npragma solidity ^0.8.0;\n\n/**\n * @notice Contains common data structures and functions used by all SpokePool implementations.\n */\ninterface SpokePoolInterface {\n // This leaf is meant to be decoded in the SpokePool to pay out successful relayers.\n struct RelayerRefundLeaf {\n // This is the amount to return to the HubPool. This occurs when there is a PoolRebalanceLeaf netSendAmount that is\n // negative. This is just that value inverted.\n uint256 amountToReturn;\n // Used to verify that this is being executed on the correct destination chainId.\n uint256 chainId;\n // This array designates how much each of those addresses should be refunded.\n uint256[] refundAmounts;\n // Used as the index in the bitmap to track whether this leaf has been executed or not.\n uint32 leafId;\n // The associated L2TokenAddress that these claims apply to.\n address l2TokenAddress;\n // Must be same length as refundAmounts and designates each address that must be refunded.\n address[] refundAddresses;\n }\n\n // This struct represents the data to fully specify a relay. If any portion of this data differs, the relay is\n // considered to be completely distinct. Only one relay for a particular depositId, chainId pair should be\n // considered valid and repaid. This data is hashed and inserted into a the slow relay merkle root so that an off\n // chain validator can choose when to refund slow relayers.\n struct RelayData {\n // The address that made the deposit on the origin chain.\n address depositor;\n // The recipient address on the destination chain.\n address recipient;\n // The corresponding token address on the destination chain.\n address destinationToken;\n // The total relay amount before fees are taken out.\n uint256 amount;\n // Origin chain id.\n uint256 originChainId;\n // The LP Fee percentage computed by the relayer based on the deposit's quote timestamp\n // and the HubPool's utilization.\n uint64 realizedLpFeePct;\n // The relayer fee percentage specified in the deposit.\n uint64 relayerFeePct;\n // The id uniquely identifying this deposit on the origin chain.\n uint32 depositId;\n }\n\n function setCrossDomainAdmin(address newCrossDomainAdmin) external;\n\n function setHubPool(address newHubPool) external;\n\n function setEnableRoute(\n address originToken,\n uint256 destinationChainId,\n bool enable\n ) external;\n\n function setDepositQuoteTimeBuffer(uint32 buffer) external;\n\n function relayRootBundle(bytes32 relayerRefundRoot, bytes32 slowRelayRoot) external;\n\n function deposit(\n address recipient,\n address originToken,\n uint256 amount,\n uint256 destinationChainId,\n uint64 relayerFeePct,\n uint32 quoteTimestamp\n ) external payable;\n\n function speedUpDeposit(\n address depositor,\n uint64 newRelayerFeePct,\n uint32 depositId,\n bytes memory depositorSignature\n ) external;\n\n function fillRelay(\n address depositor,\n address recipient,\n address destinationToken,\n uint256 amount,\n uint256 maxTokensToSend,\n uint256 repaymentChainId,\n uint256 originChainId,\n uint64 realizedLpFeePct,\n uint64 relayerFeePct,\n uint32 depositId\n ) external;\n\n function fillRelayWithUpdatedFee(\n address depositor,\n address recipient,\n address destinationToken,\n uint256 amount,\n uint256 maxTokensToSend,\n uint256 repaymentChainId,\n uint256 originChainId,\n uint64 realizedLpFeePct,\n uint64 relayerFeePct,\n uint64 newRelayerFeePct,\n uint32 depositId,\n bytes memory depositorSignature\n ) external;\n\n function executeSlowRelayRoot(\n address depositor,\n address recipient,\n address destinationToken,\n uint256 amount,\n uint256 originChainId,\n uint64 realizedLpFeePct,\n uint64 relayerFeePct,\n uint32 depositId,\n uint32 rootBundleId,\n bytes32[] memory proof\n ) external;\n\n function executeRelayerRefundRoot(\n uint32 rootBundleId,\n SpokePoolInterface.RelayerRefundLeaf memory relayerRefundLeaf,\n bytes32[] memory proof\n ) external;\n\n function chainId() external view returns (uint256);\n}\n" + "contracts/interfaces/AdapterInterface.sol": { + "content": "// SPDX-License-Identifier: AGPL-3.0-only\npragma solidity ^0.8.0;\n\n/**\n * @notice Sends cross chain messages and tokens to contracts on a specific L2 network.\n */\n\ninterface AdapterInterface {\n event MessageRelayed(address target, bytes message);\n\n event TokensRelayed(address l1Token, address l2Token, uint256 amount, address to);\n\n function relayMessage(address target, bytes memory message) external payable;\n\n function relayTokens(\n address l1Token,\n address l2Token,\n uint256 amount,\n address to\n ) external payable;\n}\n" }, "@uma/core/contracts/common/implementation/Timer.sol": { "content": "// SPDX-License-Identifier: AGPL-3.0-only\npragma solidity ^0.8.0;\n\n/**\n * @title Universal store of current contract time for testing environments.\n */\ncontract Timer {\n uint256 private currentTime;\n\n constructor() {\n currentTime = block.timestamp; // solhint-disable-line not-rely-on-time\n }\n\n /**\n * @notice Sets the current time.\n * @dev Will revert if not running in test mode.\n * @param time timestamp to set `currentTime` to.\n */\n function setCurrentTime(uint256 time) external {\n currentTime = time;\n }\n\n /**\n * @notice Gets the currentTime variable set in the Timer.\n * @return uint256 for the current Testable timestamp.\n */\n function getCurrentTime() public view returns (uint256) {\n return currentTime;\n }\n}\n" diff --git a/deployments/kovan/solcInputs/d3cc7d49c45bf725b6aea61557b961e9.json b/deployments/kovan/solcInputs/c8b9349311d8b5049b613ac98eb998d0.json similarity index 64% rename from deployments/kovan/solcInputs/d3cc7d49c45bf725b6aea61557b961e9.json rename to deployments/kovan/solcInputs/c8b9349311d8b5049b613ac98eb998d0.json index 572746276..dfb09219e 100644 --- a/deployments/kovan/solcInputs/d3cc7d49c45bf725b6aea61557b961e9.json +++ b/deployments/kovan/solcInputs/c8b9349311d8b5049b613ac98eb998d0.json @@ -2,20 +2,23 @@ "language": "Solidity", "sources": { "contracts/Arbitrum_SpokePool.sol": { - "content": "// SPDX-License-Identifier: GPL-3.0-only\npragma solidity ^0.8.0;\n\nimport \"./SpokePool.sol\";\nimport \"./SpokePoolInterface.sol\";\n\ninterface StandardBridgeLike {\n function outboundTransfer(\n address _l1Token,\n address _to,\n uint256 _amount,\n bytes calldata _data\n ) external payable returns (bytes memory);\n}\n\n/**\n * @notice AVM specific SpokePool. Uses AVM cross-domain-enabled logic to implement admin only access to functions.\n */\ncontract Arbitrum_SpokePool is SpokePool {\n // Address of the Arbitrum L2 token gateway to send funds to L1.\n address public l2GatewayRouter;\n\n // Admin controlled mapping of arbitrum tokens to L1 counterpart. L1 counterpart addresses\n // are neccessary params used when bridging tokens to L1.\n mapping(address => address) public whitelistedTokens;\n\n event ArbitrumTokensBridged(address indexed l1Token, address target, uint256 numberOfTokensBridged);\n event SetL2GatewayRouter(address indexed newL2GatewayRouter);\n event WhitelistedTokens(address indexed l2Token, address indexed l1Token);\n\n /**\n * @notice Construct the AVM SpokePool.\n * @param _l2GatewayRouter Address of L2 token gateway. Can be reset by admin.\n * @param _crossDomainAdmin Cross domain admin to set. Can be changed by admin.\n * @param _hubPool Hub pool address to set. Can be changed by admin.\n * @param _wethAddress Weth address for this network to set.\n * @param timerAddress Timer address to set.\n */\n constructor(\n address _l2GatewayRouter,\n address _crossDomainAdmin,\n address _hubPool,\n address _wethAddress,\n address timerAddress\n ) SpokePool(_crossDomainAdmin, _hubPool, _wethAddress, timerAddress) {\n _setL2GatewayRouter(_l2GatewayRouter);\n }\n\n modifier onlyFromCrossDomainAdmin() {\n require(msg.sender == _applyL1ToL2Alias(crossDomainAdmin), \"ONLY_COUNTERPART_GATEWAY\");\n _;\n }\n\n /********************************************************\n * ARBITRUM-SPECIFIC CROSS-CHAIN ADMIN FUNCTIONS *\n ********************************************************/\n\n /**\n * @notice Change L2 gateway router. Callable only by admin.\n * @param newL2GatewayRouter New L2 gateway router.\n */\n function setL2GatewayRouter(address newL2GatewayRouter) public onlyAdmin {\n _setL2GatewayRouter(newL2GatewayRouter);\n }\n\n /**\n * @notice Add L2 -> L1 token mapping. Callable only by admin.\n * @param l2Token Arbitrum token.\n * @param l1Token Ethereum version of l2Token.\n */\n function whitelistToken(address l2Token, address l1Token) public onlyAdmin {\n _whitelistToken(l2Token, l1Token);\n }\n\n /**************************************\n * INTERNAL FUNCTIONS *\n **************************************/\n\n function _bridgeTokensToHubPool(RelayerRefundLeaf memory relayerRefundLeaf) internal override {\n StandardBridgeLike(l2GatewayRouter).outboundTransfer(\n whitelistedTokens[relayerRefundLeaf.l2TokenAddress], // _l1Token. Address of the L1 token to bridge over.\n hubPool, // _to. Withdraw, over the bridge, to the l1 hub pool contract.\n relayerRefundLeaf.amountToReturn, // _amount.\n \"\" // _data. We don't need to send any data for the bridging action.\n );\n emit ArbitrumTokensBridged(address(0), hubPool, relayerRefundLeaf.amountToReturn);\n }\n\n function _setL2GatewayRouter(address _l2GatewayRouter) internal {\n l2GatewayRouter = _l2GatewayRouter;\n emit SetL2GatewayRouter(l2GatewayRouter);\n }\n\n function _whitelistToken(address _l2Token, address _l1Token) internal {\n whitelistedTokens[_l2Token] = _l1Token;\n emit WhitelistedTokens(_l2Token, _l1Token);\n }\n\n // L1 addresses are transformed during l1->l2 calls.\n // See https://developer.offchainlabs.com/docs/l1_l2_messages#address-aliasing for more information.\n // This cannot be pulled directly from Arbitrum contracts because their contracts are not 0.8.X compatible and\n // this operation takes advantage of overflows, whose behavior changed in 0.8.0.\n function _applyL1ToL2Alias(address l1Address) internal pure returns (address l2Address) {\n // Allows overflows as explained above.\n unchecked {\n l2Address = address(uint160(l1Address) + uint160(0x1111000000000000000000000000000000001111));\n }\n }\n\n // Apply AVM-specific transformation to cross domain admin address on L1.\n function _requireAdminSender() internal override onlyFromCrossDomainAdmin {}\n}\n" + "content": "// SPDX-License-Identifier: GPL-3.0-only\npragma solidity ^0.8.0;\n\nimport \"./SpokePool.sol\";\n\ninterface StandardBridgeLike {\n function outboundTransfer(\n address _l1Token,\n address _to,\n uint256 _amount,\n bytes calldata _data\n ) external payable returns (bytes memory);\n}\n\n/**\n * @notice AVM specific SpokePool. Uses AVM cross-domain-enabled logic to implement admin only access to functions.\n */\ncontract Arbitrum_SpokePool is SpokePool {\n // Address of the Arbitrum L2 token gateway to send funds to L1.\n address public l2GatewayRouter;\n\n // Admin controlled mapping of arbitrum tokens to L1 counterpart. L1 counterpart addresses\n // are necessary params used when bridging tokens to L1.\n mapping(address => address) public whitelistedTokens;\n\n event ArbitrumTokensBridged(address indexed l1Token, address target, uint256 numberOfTokensBridged);\n event SetL2GatewayRouter(address indexed newL2GatewayRouter);\n event WhitelistedTokens(address indexed l2Token, address indexed l1Token);\n\n /**\n * @notice Construct the AVM SpokePool.\n * @param _l2GatewayRouter Address of L2 token gateway. Can be reset by admin.\n * @param _crossDomainAdmin Cross domain admin to set. Can be changed by admin.\n * @param _hubPool Hub pool address to set. Can be changed by admin.\n * @param _wethAddress Weth address for this network to set.\n * @param timerAddress Timer address to set.\n */\n constructor(\n address _l2GatewayRouter,\n address _crossDomainAdmin,\n address _hubPool,\n address _wethAddress,\n address timerAddress\n ) SpokePool(_crossDomainAdmin, _hubPool, _wethAddress, timerAddress) {\n _setL2GatewayRouter(_l2GatewayRouter);\n }\n\n modifier onlyFromCrossDomainAdmin() {\n require(msg.sender == _applyL1ToL2Alias(crossDomainAdmin), \"ONLY_COUNTERPART_GATEWAY\");\n _;\n }\n\n /********************************************************\n * ARBITRUM-SPECIFIC CROSS-CHAIN ADMIN FUNCTIONS *\n ********************************************************/\n\n /**\n * @notice Change L2 gateway router. Callable only by admin.\n * @param newL2GatewayRouter New L2 gateway router.\n */\n function setL2GatewayRouter(address newL2GatewayRouter) public onlyAdmin nonReentrant {\n _setL2GatewayRouter(newL2GatewayRouter);\n }\n\n /**\n * @notice Add L2 -> L1 token mapping. Callable only by admin.\n * @param l2Token Arbitrum token.\n * @param l1Token Ethereum version of l2Token.\n */\n function whitelistToken(address l2Token, address l1Token) public onlyAdmin nonReentrant {\n _whitelistToken(l2Token, l1Token);\n }\n\n /**************************************\n * INTERNAL FUNCTIONS *\n **************************************/\n\n function _bridgeTokensToHubPool(RelayerRefundLeaf memory relayerRefundLeaf) internal override {\n // Check that the Ethereum counterpart of the L2 token is stored on this contract.\n address ethereumTokenToBridge = whitelistedTokens[relayerRefundLeaf.l2TokenAddress];\n require(ethereumTokenToBridge != address(0), \"Uninitialized mainnet token\");\n StandardBridgeLike(l2GatewayRouter).outboundTransfer(\n ethereumTokenToBridge, // _l1Token. Address of the L1 token to bridge over.\n hubPool, // _to. Withdraw, over the bridge, to the l1 hub pool contract.\n relayerRefundLeaf.amountToReturn, // _amount.\n \"\" // _data. We don't need to send any data for the bridging action.\n );\n emit ArbitrumTokensBridged(address(0), hubPool, relayerRefundLeaf.amountToReturn);\n }\n\n function _setL2GatewayRouter(address _l2GatewayRouter) internal {\n l2GatewayRouter = _l2GatewayRouter;\n emit SetL2GatewayRouter(l2GatewayRouter);\n }\n\n function _whitelistToken(address _l2Token, address _l1Token) internal {\n whitelistedTokens[_l2Token] = _l1Token;\n emit WhitelistedTokens(_l2Token, _l1Token);\n }\n\n // L1 addresses are transformed during l1->l2 calls.\n // See https://developer.offchainlabs.com/docs/l1_l2_messages#address-aliasing for more information.\n // This cannot be pulled directly from Arbitrum contracts because their contracts are not 0.8.X compatible and\n // this operation takes advantage of overflows, whose behavior changed in 0.8.0.\n function _applyL1ToL2Alias(address l1Address) internal pure returns (address l2Address) {\n // Allows overflows as explained above.\n unchecked {\n l2Address = address(uint160(l1Address) + uint160(0x1111000000000000000000000000000000001111));\n }\n }\n\n // Apply AVM-specific transformation to cross domain admin address on L1.\n function _requireAdminSender() internal override onlyFromCrossDomainAdmin {}\n}\n" }, "contracts/SpokePool.sol": { - "content": "// SPDX-License-Identifier: GPL-3.0-only\npragma solidity ^0.8.0;\n\nimport \"./MerkleLib.sol\";\nimport \"./interfaces/WETH9.sol\";\n\nimport \"@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol\";\nimport \"@openzeppelin/contracts/token/ERC20/IERC20.sol\";\nimport \"@openzeppelin/contracts/utils/Address.sol\";\n\nimport \"@openzeppelin/contracts/utils/cryptography/SignatureChecker.sol\";\nimport \"@openzeppelin/contracts/utils/cryptography/ECDSA.sol\";\n\nimport \"@uma/core/contracts/common/implementation/Testable.sol\";\nimport \"@uma/core/contracts/common/implementation/MultiCaller.sol\";\nimport \"./Lockable.sol\";\nimport \"./MerkleLib.sol\";\nimport \"./SpokePoolInterface.sol\";\n\n/**\n * @title SpokePool\n * @notice Base contract deployed on source and destination chains enabling depositors to transfer assets from source to\n * destination. Deposit orders are fulfilled by off-chain relayers who also interact with this contract. Deposited\n * tokens are locked on the source chain and relayers send the recipient the desired token currency and amount\n * on the destination chain. Locked source chain tokens are later sent over the canonical token bridge to L1 HubPool.\n * Relayers are refunded with destination tokens out of this contract after another off-chain actor, a \"data worker\",\n * submits a proof that the relayer correctly submitted a relay on this SpokePool.\n */\nabstract contract SpokePool is SpokePoolInterface, Testable, Lockable, MultiCaller {\n using SafeERC20 for IERC20;\n using Address for address;\n\n // Address of the L1 contract that acts as the owner of this SpokePool. If this contract is deployed on Ethereum,\n // then this address should be set to the same owner as the HubPool and the whole system.\n address public crossDomainAdmin;\n\n // Address of the L1 contract that will send tokens to and receive tokens from this contract to fund relayer\n // refunds and slow relays.\n address public hubPool;\n\n // Address of WETH contract for this network. If an origin token matches this, then the caller can optionally\n // instruct this contract to wrap ETH when depositing.\n WETH9 public weth;\n\n // Timestamp when contract was constructed. Relays cannot have a quote time before this.\n uint32 public deploymentTime;\n\n // Any deposit quote times greater than or less than this value to the current contract time is blocked. Forces\n // caller to use an approximately \"current\" realized fee. Defaults to 10 minutes.\n uint32 public depositQuoteTimeBuffer = 600;\n\n // Count of deposits is used to construct a unique deposit identifier for this spoke pool.\n uint32 public numberOfDeposits;\n\n // Origin token to destination token routings can be turned on or off, which can enable or disable deposits.\n // A reverse mapping is stored on the L1 HubPool to enable or disable rebalance transfers from the HubPool to this\n // contract.\n mapping(address => mapping(uint256 => bool)) public enabledDepositRoutes;\n\n // Stores collection of merkle roots that can be published to this contract from the HubPool, which are referenced\n // by \"data workers\" via inclusion proofs to execute leaves in the roots.\n struct RootBundle {\n // Merkle root of slow relays that were not fully filled and whose recipient is still owed funds from the LP pool.\n bytes32 slowRelayRoot;\n // Merkle root of relayer refunds for successful relays.\n bytes32 relayerRefundRoot;\n // This is a 2D bitmap tracking which leafs in the relayer refund root have been claimed, with max size of\n // 256x256 leaves per root.\n mapping(uint256 => uint256) claimedBitmap;\n }\n\n // This contract can store as many root bundles as the HubPool chooses to publish here.\n RootBundle[] public rootBundles;\n\n // Each relay is associated with the hash of parameters that uniquely identify the original deposit and a relay\n // attempt for that deposit. The relay itself is just represented as the amount filled so far. The total amount to\n // relay, the fees, and the agents are all parameters included in the hash key.\n mapping(bytes32 => uint256) public relayFills;\n\n /****************************************\n * EVENTS *\n ****************************************/\n event SetXDomainAdmin(address indexed newAdmin);\n event SetHubPool(address indexed newHubPool);\n event EnabledDepositRoute(address indexed originToken, uint256 indexed destinationChainId, bool enabled);\n event SetDepositQuoteTimeBuffer(uint32 newBuffer);\n event FundsDeposited(\n uint256 amount,\n uint256 destinationChainId,\n uint64 relayerFeePct,\n uint32 indexed depositId,\n uint32 quoteTimestamp,\n address indexed originToken,\n address recipient,\n address indexed depositor\n );\n event RequestedSpeedUpDeposit(\n uint64 newRelayerFeePct,\n uint32 indexed depositId,\n address indexed depositor,\n bytes depositorSignature\n );\n event FilledRelay(\n bytes32 indexed relayHash,\n uint256 amount,\n uint256 totalFilledAmount,\n uint256 fillAmount,\n uint256 repaymentChainId,\n uint256 originChainId,\n uint64 relayerFeePct,\n uint64 realizedLpFeePct,\n uint32 depositId,\n address destinationToken,\n address indexed relayer,\n address indexed depositor,\n address recipient,\n bool isSlowRelay\n );\n event RelayedRootBundle(uint32 indexed rootBundleId, bytes32 relayerRefundRoot, bytes32 slowRelayRoot);\n event ExecutedRelayerRefundRoot(\n uint256 amountToReturn,\n uint256 indexed chainId,\n uint256[] refundAmounts,\n uint32 indexed rootBundleId,\n uint32 indexed leafId,\n address l2TokenAddress,\n address[] refundAddresses,\n address caller\n );\n event TokensBridged(\n uint256 amountToReturn,\n uint256 indexed chainId,\n uint32 indexed leafId,\n address indexed l2TokenAddress,\n address caller\n );\n\n /**\n * @notice Construct the base SpokePool.\n * @param _crossDomainAdmin Cross domain admin to set. Can be changed by admin.\n * @param _hubPool Hub pool address to set. Can be changed by admin.\n * @param _wethAddress Weth address for this network to set.\n * @param timerAddress Timer address to set.\n */\n constructor(\n address _crossDomainAdmin,\n address _hubPool,\n address _wethAddress,\n address timerAddress\n ) Testable(timerAddress) {\n _setCrossDomainAdmin(_crossDomainAdmin);\n _setHubPool(_hubPool);\n deploymentTime = uint32(getCurrentTime());\n weth = WETH9(_wethAddress);\n }\n\n /****************************************\n * MODIFIERS *\n ****************************************/\n\n modifier onlyEnabledRoute(address originToken, uint256 destinationId) {\n require(enabledDepositRoutes[originToken][destinationId], \"Disabled route\");\n _;\n }\n\n // Implementing contract needs to override _requireAdminSender() to ensure that admin functions are protected\n // appropriately.\n modifier onlyAdmin() {\n _requireAdminSender();\n _;\n }\n\n /**************************************\n * ADMIN FUNCTIONS *\n **************************************/\n\n /**\n * @notice Change cross domain admin address. Callable by admin only.\n * @param newCrossDomainAdmin New cross domain admin.\n */\n function setCrossDomainAdmin(address newCrossDomainAdmin) public override onlyAdmin {\n _setCrossDomainAdmin(newCrossDomainAdmin);\n }\n\n /**\n * @notice Change L1 hub pool address. Callable by admin only.\n * @param newHubPool New hub pool.\n */\n function setHubPool(address newHubPool) public override onlyAdmin {\n _setHubPool(newHubPool);\n }\n\n /**\n * @notice Enable/Disable an origin token => destination chain ID route for deposits. Callable by admin only.\n * @param originToken Token that depositor can deposit to this contract.\n * @param destinationChainId Chain ID for where depositor wants to receive funds.\n * @param enabled True to enable deposits, False otherwise.\n */\n function setEnableRoute(\n address originToken,\n uint256 destinationChainId,\n bool enabled\n ) public override onlyAdmin {\n enabledDepositRoutes[originToken][destinationChainId] = enabled;\n emit EnabledDepositRoute(originToken, destinationChainId, enabled);\n }\n\n /**\n * @notice Change allowance for deposit quote time to differ from current block time. Callable by admin only.\n * @param newDepositQuoteTimeBuffer New quote time buffer.\n */\n function setDepositQuoteTimeBuffer(uint32 newDepositQuoteTimeBuffer) public override onlyAdmin {\n depositQuoteTimeBuffer = newDepositQuoteTimeBuffer;\n emit SetDepositQuoteTimeBuffer(newDepositQuoteTimeBuffer);\n }\n\n /**\n * @notice This method stores a new root bundle in this contract that can be executed to refund relayers, fulfill\n * slow relays, and send funds back to the HubPool on L1. This method can only be called by the admin and is\n * designed to be called as part of a cross-chain message from the HubPool's executeRootBundle method.\n * @param relayerRefundRoot Merkle root containing relayer refund leaves that can be individually executed via\n * executeRelayerRefundRoot().\n * @param slowRelayRoot Merkle root containing slow relay fulfillment leaves that can be individually executed via\n * executeSlowRelayRoot().\n */\n function relayRootBundle(bytes32 relayerRefundRoot, bytes32 slowRelayRoot) public override onlyAdmin {\n uint32 rootBundleId = uint32(rootBundles.length);\n RootBundle storage rootBundle = rootBundles.push();\n rootBundle.relayerRefundRoot = relayerRefundRoot;\n rootBundle.slowRelayRoot = slowRelayRoot;\n emit RelayedRootBundle(rootBundleId, relayerRefundRoot, slowRelayRoot);\n }\n\n /**************************************\n * DEPOSITOR FUNCTIONS *\n **************************************/\n\n /**\n * @notice Called by user to bridge funds from origin to destination chain. Depositor will effectively lock\n * tokens in this contract and receive a destination token on the destination chain. The origin => destination\n * token mapping is stored on the L1 HubPool.\n * @notice The caller must first approve this contract to spend amount of originToken.\n * @notice The originToken => destinationChainId must be enabled.\n * @notice This method is payable because the caller is able to deposit ETH if the originToken is WETH and this\n * function will handle wrapping ETH.\n * @param recipient Address to receive funds at on destination chain.\n * @param originToken Token to lock into this contract to initiate deposit.\n * @param amount Amount of tokens to deposit. Will be amount of tokens to receive less fees.\n * @param destinationChainId Denotes network where user will receive funds from SpokePool by a relayer.\n * @param relayerFeePct % of deposit amount taken out to incentivize a fast relayer.\n * @param quoteTimestamp Timestamp used by relayers to compute this deposit's realizedLPFeePct which is paid\n * to LP pool on HubPool.\n */\n function deposit(\n address recipient,\n address originToken,\n uint256 amount,\n uint256 destinationChainId,\n uint64 relayerFeePct,\n uint32 quoteTimestamp\n ) public payable override onlyEnabledRoute(originToken, destinationChainId) nonReentrant {\n // We limit the relay fees to prevent the user spending all their funds on fees.\n require(relayerFeePct < 0.5e18, \"invalid relayer fee\");\n // This function assumes that L2 timing cannot be compared accurately and consistently to L1 timing. Therefore,\n // block.timestamp is different from the L1 EVM's. Therefore, the quoteTimestamp must be within a configurable\n // buffer of this contract's block time to allow for this variance.\n // Note also that quoteTimestamp cannot be less than the buffer otherwise the following arithmetic can result\n // in underflow. This isn't a problem as the deposit will revert, but the error might be unexpected for clients.\n require(\n getCurrentTime() >= quoteTimestamp - depositQuoteTimeBuffer &&\n getCurrentTime() <= quoteTimestamp + depositQuoteTimeBuffer,\n \"invalid quote time\"\n );\n // If the address of the origin token is a WETH contract and there is a msg.value with the transaction\n // then the user is sending ETH. In this case, the ETH should be deposited to WETH.\n if (originToken == address(weth) && msg.value > 0) {\n require(msg.value == amount, \"msg.value must match amount\");\n weth.deposit{ value: msg.value }();\n // Else, it is a normal ERC20. In this case pull the token from the users wallet as per normal.\n // Note: this includes the case where the L2 user has WETH (already wrapped ETH) and wants to bridge them.\n // In this case the msg.value will be set to 0, indicating a \"normal\" ERC20 bridging action.\n } else IERC20(originToken).safeTransferFrom(msg.sender, address(this), amount);\n\n emit FundsDeposited(\n amount,\n destinationChainId,\n relayerFeePct,\n numberOfDeposits,\n quoteTimestamp,\n originToken,\n recipient,\n msg.sender\n );\n\n // Increment count of deposits so that deposit ID for this spoke pool is unique.\n numberOfDeposits += 1;\n }\n\n /**\n * @notice Convenience method that depositor can use to signal to relayer to use updated fee.\n * @notice Relayer should only use events emitted by this function to submit fills with updated fees, otherwise they\n * risk their fills getting disputed for being invalid, for example if the depositor never actually signed the\n * update fee message.\n * @notice This function will revert if the depositor did not sign a message containing the updated fee for the\n * deposit ID stored in this contract. If the deposit ID is for another contract, or the depositor address is\n * incorrect, or the updated fee is incorrect, then the signature will not match and this function will revert.\n * @param depositor Signer of the update fee message who originally submitted the deposit. If the deposit doesn't\n * exist, then the relayer will not be able to fill any relay, so the caller should validate that the depositor\n * did in fact submit a relay.\n * @param newRelayerFeePct New relayer fee that relayers can use.\n * @param depositId Deposit to update fee for that originated in this contract.\n * @param depositorSignature Signed message containing the depositor address, this contract chain ID, the updated\n * relayer fee %, and the deposit ID. This signature is produced by signing a hash of data according to the\n * EIP-191 standard. See more in the _verifyUpdateRelayerFeeMessage() comments.\n */\n function speedUpDeposit(\n address depositor,\n uint64 newRelayerFeePct,\n uint32 depositId,\n bytes memory depositorSignature\n ) public override nonReentrant {\n _verifyUpdateRelayerFeeMessage(depositor, chainId(), newRelayerFeePct, depositId, depositorSignature);\n\n // Assuming the above checks passed, a relayer can take the signature and the updated relayer fee information\n // from the following event to submit a fill with an updated fee %.\n emit RequestedSpeedUpDeposit(newRelayerFeePct, depositId, depositor, depositorSignature);\n }\n\n /**************************************\n * RELAYER FUNCTIONS *\n **************************************/\n\n /**\n * @notice Called by relayer to fulfill part of a deposit by sending destination tokens to the receipient.\n * Relayer is expected to pass in unique identifying information for deposit that they want to fulfill, and this\n * relay submission will be validated by off-chain data workers who can dispute this relay if any part is invalid.\n * If the relay is valid, then the relayer will be refunded on their desired repayment chain. If relay is invalid,\n * then relayer will not receive any refund.\n * @notice All of the deposit data can be found via on-chain events from the origin SpokePool, except for the\n * realizedLpFeePct which is a function of the HubPool's utilization at the deposit quote time. This fee %\n * is deterministic based on the quote time, so the relayer should just compute it using the canonical algorithm\n * as described in a UMIP linked to the HubPool's identifier.\n * @param depositor Depositor on origin chain who set this chain as the destination chain.\n * @param recipient Specified recipient on this chain.\n * @param destinationToken Token to send to recipient. Should be mapped to the origin token, origin chain ID\n * and this chain ID via a mapping on the HubPool.\n * @param amount Full size of the deposit.\n * @param maxTokensToSend Max amount of tokens to send recipient. If higher than amount, then caller will\n * send recipient the full relay amount.\n * @param repaymentChainId Chain of SpokePool where relayer wants to be refunded after the challenge window has\n * passed.\n * @param originChainId Chain of SpokePool where deposit originated.\n * @param realizedLpFeePct Fee % based on L1 HubPool utilization at deposit quote time. Deterministic based on\n * quote time.\n * @param relayerFeePct Fee % to keep as relayer, specified by depositor.\n * @param depositId Unique deposit ID on origin spoke pool.\n */\n function fillRelay(\n address depositor,\n address recipient,\n address destinationToken,\n uint256 amount,\n uint256 maxTokensToSend,\n uint256 repaymentChainId,\n uint256 originChainId,\n uint64 realizedLpFeePct,\n uint64 relayerFeePct,\n uint32 depositId\n ) public nonReentrant {\n // Each relay attempt is mapped to the hash of data uniquely identifying it, which includes the deposit data\n // such as the origin chain ID and the deposit ID, and the data in a relay attempt such as who the recipient\n // is, which chain and currency the recipient wants to receive funds on, and the relay fees.\n SpokePoolInterface.RelayData memory relayData = SpokePoolInterface.RelayData({\n depositor: depositor,\n recipient: recipient,\n destinationToken: destinationToken,\n amount: amount,\n realizedLpFeePct: realizedLpFeePct,\n relayerFeePct: relayerFeePct,\n depositId: depositId,\n originChainId: originChainId\n });\n bytes32 relayHash = _getRelayHash(relayData);\n\n uint256 fillAmountPreFees = _fillRelay(relayHash, relayData, maxTokensToSend, relayerFeePct, false);\n\n _emitFillRelay(relayHash, fillAmountPreFees, repaymentChainId, relayerFeePct, relayData, false);\n }\n\n /**\n * @notice Called by relayer to execute same logic as calling fillRelay except that relayer is using an updated\n * relayer fee %. The fee % must have been emitted in a message cryptographically signed by the depositor.\n * @notice By design, the depositor probably emitted the message with the updated fee by calling speedUpRelay().\n * @param depositor Depositor on origin chain who set this chain as the destination chain.\n * @param recipient Specified recipient on this chain.\n * @param destinationToken Token to send to recipient. Should be mapped to the origin token, origin chain ID\n * and this chain ID via a mapping on the HubPool.\n * @param amount Full size of the deposit.\n * @param maxTokensToSend Max amount of tokens to send recipient. If higher than amount, then caller will\n * send recipient the full relay amount.\n * @param repaymentChainId Chain of SpokePool where relayer wants to be refunded after the challenge window has\n * passed.\n * @param originChainId Chain of SpokePool where deposit originated.\n * @param realizedLpFeePct Fee % based on L1 HubPool utilization at deposit quote time. Deterministic based on\n * quote time.\n * @param relayerFeePct Original fee % to keep as relayer set by depositor.\n * @param newRelayerFeePct New fee % to keep as relayer also specified by depositor.\n * @param depositId Unique deposit ID on origin spoke pool.\n * @param depositorSignature Depositor-signed message containing updated fee %.\n */\n function fillRelayWithUpdatedFee(\n address depositor,\n address recipient,\n address destinationToken,\n uint256 amount,\n uint256 maxTokensToSend,\n uint256 repaymentChainId,\n uint256 originChainId,\n uint64 realizedLpFeePct,\n uint64 relayerFeePct,\n uint64 newRelayerFeePct,\n uint32 depositId,\n bytes memory depositorSignature\n ) public override nonReentrant {\n _verifyUpdateRelayerFeeMessage(depositor, originChainId, newRelayerFeePct, depositId, depositorSignature);\n\n // Now follow the default fillRelay flow with the updated fee and the original relay hash.\n RelayData memory relayData = RelayData({\n depositor: depositor,\n recipient: recipient,\n destinationToken: destinationToken,\n amount: amount,\n realizedLpFeePct: realizedLpFeePct,\n relayerFeePct: relayerFeePct,\n depositId: depositId,\n originChainId: originChainId\n });\n bytes32 relayHash = _getRelayHash(relayData);\n uint256 fillAmountPreFees = _fillRelay(relayHash, relayData, maxTokensToSend, newRelayerFeePct, false);\n\n _emitFillRelay(relayHash, fillAmountPreFees, repaymentChainId, newRelayerFeePct, relayData, false);\n }\n\n /**************************************\n * DATA WORKER FUNCTIONS *\n **************************************/\n\n /**\n * @notice Executes a slow relay leaf stored as part of a root bundle. Will send the full amount remaining in the\n * relay to the recipient, less fees.\n * @param depositor Depositor on origin chain who set this chain as the destination chain.\n * @param recipient Specified recipient on this chain.\n * @param destinationToken Token to send to recipient. Should be mapped to the origin token, origin chain ID\n * and this chain ID via a mapping on the HubPool.\n * @param amount Full size of the deposit.\n * @param originChainId Chain of SpokePool where deposit originated.\n * @param realizedLpFeePct Fee % based on L1 HubPool utilization at deposit quote time. Deterministic based on\n * quote time.\n * @param relayerFeePct Original fee % to keep as relayer set by depositor.\n * @param depositId Unique deposit ID on origin spoke pool.\n * @param rootBundleId Unique ID of root bundle containing slow relay root that this leaf is contained in.\n * @param proof Inclusion proof for this leaf in slow relay root in root bundle.\n */\n function executeSlowRelayRoot(\n address depositor,\n address recipient,\n address destinationToken,\n uint256 amount,\n uint256 originChainId,\n uint64 realizedLpFeePct,\n uint64 relayerFeePct,\n uint32 depositId,\n uint32 rootBundleId,\n bytes32[] memory proof\n ) public virtual override nonReentrant {\n _executeSlowRelayRoot(\n depositor,\n recipient,\n destinationToken,\n amount,\n originChainId,\n realizedLpFeePct,\n relayerFeePct,\n depositId,\n rootBundleId,\n proof\n );\n }\n\n /**\n * @notice Executes a relayer refund leaf stored as part of a root bundle. Will send the relayer the amount they\n * sent to the recipient plus a relayer fee.\n * @param rootBundleId Unique ID of root bundle containing relayer refund root that this leaf is contained in.\n * @param relayerRefundLeaf Contains all data neccessary to reconstruct leaf contained in root bundle and to\n * refund relayer. This data structure is explained in detail in the SpokePoolInterface.\n * @param proof Inclusion proof for this leaf in relayer refund root in root bundle.\n */\n function executeRelayerRefundRoot(\n uint32 rootBundleId,\n SpokePoolInterface.RelayerRefundLeaf memory relayerRefundLeaf,\n bytes32[] memory proof\n ) public virtual override nonReentrant {\n _executeRelayerRefundRoot(rootBundleId, relayerRefundLeaf, proof);\n }\n\n /**************************************\n * VIEW FUNCTIONS *\n **************************************/\n\n /**\n * @notice Returns chain ID for this network.\n * @dev Some L2s like ZKSync don't support the CHAIN_ID opcode so we allow the implementer to override this.\n */\n function chainId() public view override returns (uint256) {\n return block.chainid;\n }\n\n /**************************************\n * INTERNAL FUNCTIONS *\n **************************************/\n\n // Verifies inclusion proof of leaf in root, sends relayer their refund, and sends to HubPool any rebalance\n // transfers.\n function _executeRelayerRefundRoot(\n uint32 rootBundleId,\n SpokePoolInterface.RelayerRefundLeaf memory relayerRefundLeaf,\n bytes32[] memory proof\n ) internal {\n // Check integrity of leaf structure:\n require(relayerRefundLeaf.chainId == chainId(), \"Invalid chainId\");\n require(relayerRefundLeaf.refundAddresses.length == relayerRefundLeaf.refundAmounts.length, \"invalid leaf\");\n\n RootBundle storage rootBundle = rootBundles[rootBundleId];\n\n // Check that inclusionProof proves that relayerRefundLeaf is contained within the relayer refund root.\n // Note: This should revert if the relayerRefundRoot is uninitialized.\n require(MerkleLib.verifyRelayerRefund(rootBundle.relayerRefundRoot, relayerRefundLeaf, proof), \"Bad Proof\");\n\n // Verify the leafId in the leaf has not yet been claimed.\n require(!MerkleLib.isClaimed(rootBundle.claimedBitmap, relayerRefundLeaf.leafId), \"Already claimed\");\n\n // Set leaf as claimed in bitmap. This is passed by reference to the storage rootBundle.\n MerkleLib.setClaimed(rootBundle.claimedBitmap, relayerRefundLeaf.leafId);\n\n // Send each relayer refund address the associated refundAmount for the L2 token address.\n // Note: Even if the L2 token is not enabled on this spoke pool, we should still refund relayers.\n for (uint32 i = 0; i < relayerRefundLeaf.refundAmounts.length; i++) {\n uint256 amount = relayerRefundLeaf.refundAmounts[i];\n if (amount > 0)\n IERC20(relayerRefundLeaf.l2TokenAddress).safeTransfer(relayerRefundLeaf.refundAddresses[i], amount);\n }\n\n // If leaf's amountToReturn is positive, then send L2 --> L1 message to bridge tokens back via\n // chain-specific bridging method.\n if (relayerRefundLeaf.amountToReturn > 0) {\n _bridgeTokensToHubPool(relayerRefundLeaf);\n\n emit TokensBridged(\n relayerRefundLeaf.amountToReturn,\n relayerRefundLeaf.chainId,\n relayerRefundLeaf.leafId,\n relayerRefundLeaf.l2TokenAddress,\n msg.sender\n );\n }\n\n emit ExecutedRelayerRefundRoot(\n relayerRefundLeaf.amountToReturn,\n relayerRefundLeaf.chainId,\n relayerRefundLeaf.refundAmounts,\n rootBundleId,\n relayerRefundLeaf.leafId,\n relayerRefundLeaf.l2TokenAddress,\n relayerRefundLeaf.refundAddresses,\n msg.sender\n );\n }\n\n // Verifies inclusion proof of leaf in root and sends recipient remainder of relay. Marks relay as filled.\n function _executeSlowRelayRoot(\n address depositor,\n address recipient,\n address destinationToken,\n uint256 amount,\n uint256 originChainId,\n uint64 realizedLpFeePct,\n uint64 relayerFeePct,\n uint32 depositId,\n uint32 rootBundleId,\n bytes32[] memory proof\n ) internal {\n RelayData memory relayData = RelayData({\n depositor: depositor,\n recipient: recipient,\n destinationToken: destinationToken,\n amount: amount,\n originChainId: originChainId,\n realizedLpFeePct: realizedLpFeePct,\n relayerFeePct: relayerFeePct,\n depositId: depositId\n });\n\n require(\n MerkleLib.verifySlowRelayFulfillment(rootBundles[rootBundleId].slowRelayRoot, relayData, proof),\n \"Invalid proof\"\n );\n\n bytes32 relayHash = _getRelayHash(relayData);\n\n // Note: use relayAmount as the max amount to send, so the relay is always completely filled by the contract's\n // funds in all cases. As this is a slow relay we set the relayerFeePct to 0. This effectively refunds the\n // relayer component of the relayerFee thereby only charging the depositor the LpFee.\n uint256 fillAmountPreFees = _fillRelay(relayHash, relayData, relayData.amount, 0, true);\n\n // Note: Set repayment chain ID to 0 to indicate that there is no repayment to be made. The off-chain data\n // worker can use repaymentChainId=0 as a signal to ignore such relays for refunds. Also, set the relayerFeePct\n // to 0 as slow relays do not pay the caller of this method (depositor is refunded this fee).\n _emitFillRelay(relayHash, fillAmountPreFees, 0, 0, relayData, true);\n }\n\n function _setCrossDomainAdmin(address newCrossDomainAdmin) internal {\n require(newCrossDomainAdmin != address(0), \"Bad bridge router address\");\n crossDomainAdmin = newCrossDomainAdmin;\n emit SetXDomainAdmin(crossDomainAdmin);\n }\n\n function _setHubPool(address newHubPool) internal {\n require(newHubPool != address(0), \"Bad hub pool address\");\n hubPool = newHubPool;\n emit SetHubPool(hubPool);\n }\n\n // Should be overriden by implementing contract depending on how L2 handles sending tokens to L1.\n function _bridgeTokensToHubPool(SpokePoolInterface.RelayerRefundLeaf memory relayerRefundLeaf) internal virtual;\n\n function _verifyUpdateRelayerFeeMessage(\n address depositor,\n uint256 originChainId,\n uint64 newRelayerFeePct,\n uint32 depositId,\n bytes memory depositorSignature\n ) internal view {\n // A depositor can request to speed up an un-relayed deposit by signing a hash containing the relayer\n // fee % to update to and information uniquely identifying the deposit to relay. This information ensures\n // that this signature cannot be re-used for other deposits. The version string is included as a precaution\n // in case this contract is upgraded.\n // Note: we use encode instead of encodePacked because it is more secure, more in the \"warning\" section\n // here: https://docs.soliditylang.org/en/v0.8.11/abi-spec.html#non-standard-packed-mode\n bytes32 expectedDepositorMessageHash = keccak256(\n abi.encode(\"ACROSS-V2-FEE-1.0\", newRelayerFeePct, depositId, originChainId)\n );\n\n // Check the hash corresponding to the https://eth.wiki/json-rpc/API#eth_sign[eth_sign]\n // JSON-RPC method as part of EIP-191. We use OZ's signature checker library which adds support for\n // EIP-1271 which can verify messages signed by smart contract wallets like Argent and Gnosis safes.\n // If the depositor signed a message with a different updated fee (or any other param included in the\n // above keccak156 hash), then this will revert.\n bytes32 ethSignedMessageHash = ECDSA.toEthSignedMessageHash(expectedDepositorMessageHash);\n\n _verifyDepositorUpdateFeeMessage(depositor, ethSignedMessageHash, depositorSignature);\n }\n\n // This function is isolated and made virtual to allow different L2's to implement chain specific recovery of\n // signers from signatures because some L2s might not support ecrecover, such as those with account abstraction\n // like ZKSync.\n function _verifyDepositorUpdateFeeMessage(\n address depositor,\n bytes32 ethSignedMessageHash,\n bytes memory depositorSignature\n ) internal view virtual {\n // Note: no need to worry about reentrancy from contract deployed at depositor address since\n // SignatureChecker.isValidSignatureNow is a non state-modifying STATICCALL:\n // - https://github.com/OpenZeppelin/openzeppelin-contracts/blob/63b466901fb015538913f811c5112a2775042177/contracts/utils/cryptography/SignatureChecker.sol#L35\n // - https://github.com/ethereum/EIPs/pull/214\n require(\n SignatureChecker.isValidSignatureNow(depositor, ethSignedMessageHash, depositorSignature),\n \"invalid signature\"\n );\n }\n\n function _computeAmountPreFees(uint256 amount, uint64 feesPct) private pure returns (uint256) {\n return (1e18 * amount) / (1e18 - feesPct);\n }\n\n function _computeAmountPostFees(uint256 amount, uint64 feesPct) private pure returns (uint256) {\n return (amount * (1e18 - feesPct)) / 1e18;\n }\n\n function _getRelayHash(SpokePoolInterface.RelayData memory relayData) private pure returns (bytes32) {\n return keccak256(abi.encode(relayData));\n }\n\n // Unwraps ETH and does a transfer to a recipient address. If the recipient is a smart contract then sends WETH.\n function _unwrapWETHTo(address payable to, uint256 amount) internal {\n if (address(to).isContract()) {\n IERC20(address(weth)).safeTransfer(to, amount);\n } else {\n weth.withdraw(amount);\n to.transfer(amount);\n }\n }\n\n // @notice Caller specifies the max amount of tokens to send to user. Based on this amount and the amount of the\n // relay remaining (as stored in the relayFills mapping), pull the amount of tokens from the caller ancillaryData\n // and send to the caller.\n // @dev relayFills keeps track of pre-fee fill amounts as a convenience to relayers who want to specify round\n // numbers for the maxTokensToSend parameter or convenient numbers like 100 (i.e. relayers who will fully\n // fill any relay up to 100 tokens, and partial fill with 100 tokens for larger relays).\n function _fillRelay(\n bytes32 relayHash,\n RelayData memory relayData,\n uint256 maxTokensToSend,\n uint64 updatableRelayerFeePct,\n bool useContractFunds\n ) internal returns (uint256 fillAmountPreFees) {\n // We limit the relay fees to prevent the user spending all their funds on fees. Note that 0.5e18 (i.e. 50%)\n // fees are just magic numbers. The important point is to prevent the total fee from being 100%, otherwise\n // computing the amount pre fees runs into divide-by-0 issues.\n require(updatableRelayerFeePct < 0.5e18 && relayData.realizedLpFeePct < 0.5e18, \"invalid fees\");\n\n // Check that the relay has not already been completely filled. Note that the relays mapping will point to\n // the amount filled so far for a particular relayHash, so this will start at 0 and increment with each fill.\n require(relayFills[relayHash] < relayData.amount, \"relay filled\");\n\n // Stores the equivalent amount to be sent by the relayer before fees have been taken out.\n if (maxTokensToSend == 0) return 0;\n\n // Derive the amount of the relay filled if the caller wants to send exactly maxTokensToSend tokens to\n // the recipient. For example, if the user wants to send 10 tokens to the recipient, the full relay amount\n // is 100, and the fee %'s total 5%, then this computation would return ~10.5, meaning that to fill 10.5/100\n // of the full relay size, the caller would need to send 10 tokens to the user.\n fillAmountPreFees = _computeAmountPreFees(\n maxTokensToSend,\n (relayData.realizedLpFeePct + updatableRelayerFeePct)\n );\n // If user's specified max amount to send is greater than the amount of the relay remaining pre-fees,\n // we'll pull exactly enough tokens to complete the relay.\n uint256 amountToSend = maxTokensToSend;\n uint256 amountRemainingInRelay = relayData.amount - relayFills[relayHash];\n if (amountRemainingInRelay < fillAmountPreFees) {\n fillAmountPreFees = amountRemainingInRelay;\n\n // The user will fulfill the remainder of the relay, so we need to compute exactly how many tokens post-fees\n // that they need to send to the recipient. Note that if the relayer is filled using contract funds then\n // this is a slow relay.\n amountToSend = _computeAmountPostFees(\n fillAmountPreFees,\n relayData.realizedLpFeePct + updatableRelayerFeePct\n );\n }\n\n // relayFills keeps track of pre-fee fill amounts as a convenience to relayers who want to specify round\n // numbers for the maxTokensToSend parameter or convenient numbers like 100 (i.e. relayers who will fully\n // fill any relay up to 100 tokens, and partial fill with 100 tokens for larger relays).\n relayFills[relayHash] += fillAmountPreFees;\n\n // If relay token is weth then unwrap and send eth.\n if (relayData.destinationToken == address(weth)) {\n // Note: useContractFunds is True if we want to send funds to the recipient directly out of this contract,\n // otherwise we expect the caller to send funds to the recipient. If useContractFunds is True and the\n // recipient wants WETH, then we can assume that WETH is already in the contract, otherwise we'll need the\n // the user to send WETH to this contract. Regardless, we'll need to unwrap it before sending to the user.\n if (!useContractFunds)\n IERC20(relayData.destinationToken).safeTransferFrom(msg.sender, address(this), amountToSend);\n _unwrapWETHTo(payable(relayData.recipient), amountToSend);\n // Else, this is a normal ERC20 token. Send to recipient.\n } else {\n // Note: Similar to note above, send token directly from the contract to the user in the slow relay case.\n if (!useContractFunds)\n IERC20(relayData.destinationToken).safeTransferFrom(msg.sender, relayData.recipient, amountToSend);\n else IERC20(relayData.destinationToken).safeTransfer(relayData.recipient, amountToSend);\n }\n }\n\n // The following internal methods emit events with many params to overcome solidity stack too deep issues.\n function _emitFillRelay(\n bytes32 relayHash,\n uint256 fillAmount,\n uint256 repaymentChainId,\n uint64 relayerFeePct,\n RelayData memory relayData,\n bool isSlowRelay\n ) internal {\n emit FilledRelay(\n relayHash,\n relayData.amount,\n relayFills[relayHash],\n fillAmount,\n repaymentChainId,\n relayData.originChainId,\n relayerFeePct,\n relayData.realizedLpFeePct,\n relayData.depositId,\n relayData.destinationToken,\n msg.sender,\n relayData.depositor,\n relayData.recipient,\n isSlowRelay\n );\n }\n\n // Implementing contract needs to override this to ensure that only the appropriate cross chain admin can execute\n // certain admin functions. For L2 contracts, the cross chain admin refers to some L1 address or contract, and for\n // L1, this would just be the same admin of the HubPool.\n function _requireAdminSender() internal virtual;\n\n // Added to enable the this contract to receive ETH. Used when unwrapping Weth.\n receive() external payable {}\n}\n" - }, - "contracts/SpokePoolInterface.sol": { - "content": "// SPDX-License-Identifier: GPL-3.0-only\npragma solidity ^0.8.0;\n\n/**\n * @notice Contains common data structures and functions used by all SpokePool implementations.\n */\ninterface SpokePoolInterface {\n // This leaf is meant to be decoded in the SpokePool to pay out successful relayers.\n struct RelayerRefundLeaf {\n // This is the amount to return to the HubPool. This occurs when there is a PoolRebalanceLeaf netSendAmount that is\n // negative. This is just that value inverted.\n uint256 amountToReturn;\n // Used to verify that this is being executed on the correct destination chainId.\n uint256 chainId;\n // This array designates how much each of those addresses should be refunded.\n uint256[] refundAmounts;\n // Used as the index in the bitmap to track whether this leaf has been executed or not.\n uint32 leafId;\n // The associated L2TokenAddress that these claims apply to.\n address l2TokenAddress;\n // Must be same length as refundAmounts and designates each address that must be refunded.\n address[] refundAddresses;\n }\n\n // This struct represents the data to fully specify a relay. If any portion of this data differs, the relay is\n // considered to be completely distinct. Only one relay for a particular depositId, chainId pair should be\n // considered valid and repaid. This data is hashed and inserted into a the slow relay merkle root so that an off\n // chain validator can choose when to refund slow relayers.\n struct RelayData {\n // The address that made the deposit on the origin chain.\n address depositor;\n // The recipient address on the destination chain.\n address recipient;\n // The corresponding token address on the destination chain.\n address destinationToken;\n // The total relay amount before fees are taken out.\n uint256 amount;\n // Origin chain id.\n uint256 originChainId;\n // The LP Fee percentage computed by the relayer based on the deposit's quote timestamp\n // and the HubPool's utilization.\n uint64 realizedLpFeePct;\n // The relayer fee percentage specified in the deposit.\n uint64 relayerFeePct;\n // The id uniquely identifying this deposit on the origin chain.\n uint32 depositId;\n }\n\n function setCrossDomainAdmin(address newCrossDomainAdmin) external;\n\n function setHubPool(address newHubPool) external;\n\n function setEnableRoute(\n address originToken,\n uint256 destinationChainId,\n bool enable\n ) external;\n\n function setDepositQuoteTimeBuffer(uint32 buffer) external;\n\n function relayRootBundle(bytes32 relayerRefundRoot, bytes32 slowRelayRoot) external;\n\n function deposit(\n address recipient,\n address originToken,\n uint256 amount,\n uint256 destinationChainId,\n uint64 relayerFeePct,\n uint32 quoteTimestamp\n ) external payable;\n\n function speedUpDeposit(\n address depositor,\n uint64 newRelayerFeePct,\n uint32 depositId,\n bytes memory depositorSignature\n ) external;\n\n function fillRelay(\n address depositor,\n address recipient,\n address destinationToken,\n uint256 amount,\n uint256 maxTokensToSend,\n uint256 repaymentChainId,\n uint256 originChainId,\n uint64 realizedLpFeePct,\n uint64 relayerFeePct,\n uint32 depositId\n ) external;\n\n function fillRelayWithUpdatedFee(\n address depositor,\n address recipient,\n address destinationToken,\n uint256 amount,\n uint256 maxTokensToSend,\n uint256 repaymentChainId,\n uint256 originChainId,\n uint64 realizedLpFeePct,\n uint64 relayerFeePct,\n uint64 newRelayerFeePct,\n uint32 depositId,\n bytes memory depositorSignature\n ) external;\n\n function executeSlowRelayRoot(\n address depositor,\n address recipient,\n address destinationToken,\n uint256 amount,\n uint256 originChainId,\n uint64 realizedLpFeePct,\n uint64 relayerFeePct,\n uint32 depositId,\n uint32 rootBundleId,\n bytes32[] memory proof\n ) external;\n\n function executeRelayerRefundRoot(\n uint32 rootBundleId,\n SpokePoolInterface.RelayerRefundLeaf memory relayerRefundLeaf,\n bytes32[] memory proof\n ) external;\n\n function chainId() external view returns (uint256);\n}\n" + "content": "// SPDX-License-Identifier: GPL-3.0-only\npragma solidity ^0.8.0;\n\nimport \"./MerkleLib.sol\";\nimport \"./interfaces/WETH9.sol\";\nimport \"./Lockable.sol\";\nimport \"./SpokePoolInterface.sol\";\n\nimport \"@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol\";\nimport \"@openzeppelin/contracts/token/ERC20/IERC20.sol\";\nimport \"@openzeppelin/contracts/utils/Address.sol\";\n\nimport \"@openzeppelin/contracts/utils/cryptography/ECDSA.sol\";\nimport \"@uma/core/contracts/common/implementation/Testable.sol\";\nimport \"@uma/core/contracts/common/implementation/MultiCaller.sol\";\n\n/**\n * @title SpokePool\n * @notice Base contract deployed on source and destination chains enabling depositors to transfer assets from source to\n * destination. Deposit orders are fulfilled by off-chain relayers who also interact with this contract. Deposited\n * tokens are locked on the source chain and relayers send the recipient the desired token currency and amount\n * on the destination chain. Locked source chain tokens are later sent over the canonical token bridge to L1 HubPool.\n * Relayers are refunded with destination tokens out of this contract after another off-chain actor, a \"data worker\",\n * submits a proof that the relayer correctly submitted a relay on this SpokePool.\n */\nabstract contract SpokePool is SpokePoolInterface, Testable, Lockable, MultiCaller {\n using SafeERC20 for IERC20;\n using Address for address;\n\n // Address of the L1 contract that acts as the owner of this SpokePool. If this contract is deployed on Ethereum,\n // then this address should be set to the same owner as the HubPool and the whole system.\n address public crossDomainAdmin;\n\n // Address of the L1 contract that will send tokens to and receive tokens from this contract to fund relayer\n // refunds and slow relays.\n address public hubPool;\n\n // Address of WETH contract for this network. If an origin token matches this, then the caller can optionally\n // instruct this contract to wrap ETH when depositing.\n WETH9 public immutable weth;\n\n // Any deposit quote times greater than or less than this value to the current contract time is blocked. Forces\n // caller to use an approximately \"current\" realized fee. Defaults to 10 minutes.\n uint32 public depositQuoteTimeBuffer = 600;\n\n // Count of deposits is used to construct a unique deposit identifier for this spoke pool.\n uint32 public numberOfDeposits;\n\n // Origin token to destination token routings can be turned on or off, which can enable or disable deposits.\n\n mapping(address => mapping(uint256 => bool)) public enabledDepositRoutes;\n\n // This contract can store as many root bundles as the HubPool chooses to publish here.\n RootBundle[] public rootBundles;\n\n // Each relay is associated with the hash of parameters that uniquely identify the original deposit and a relay\n // attempt for that deposit. The relay itself is just represented as the amount filled so far. The total amount to\n // relay, the fees, and the agents are all parameters included in the hash key.\n mapping(bytes32 => uint256) public relayFills;\n\n /****************************************\n * EVENTS *\n ****************************************/\n event SetXDomainAdmin(address indexed newAdmin);\n event SetHubPool(address indexed newHubPool);\n event EnabledDepositRoute(address indexed originToken, uint256 indexed destinationChainId, bool enabled);\n event SetDepositQuoteTimeBuffer(uint32 newBuffer);\n event FundsDeposited(\n uint256 amount,\n uint256 originChainId,\n uint256 destinationChainId,\n uint64 relayerFeePct,\n uint32 indexed depositId,\n uint32 quoteTimestamp,\n address indexed originToken,\n address recipient,\n address indexed depositor\n );\n event RequestedSpeedUpDeposit(\n uint64 newRelayerFeePct,\n uint32 indexed depositId,\n address indexed depositor,\n bytes depositorSignature\n );\n event FilledRelay(\n bytes32 indexed relayHash,\n uint256 amount,\n uint256 totalFilledAmount,\n uint256 fillAmount,\n uint256 repaymentChainId,\n uint256 originChainId,\n uint256 destinationChainId,\n uint64 relayerFeePct,\n uint64 realizedLpFeePct,\n uint32 depositId,\n address destinationToken,\n address indexed relayer,\n address indexed depositor,\n address recipient,\n bool isSlowRelay\n );\n event RelayedRootBundle(uint32 indexed rootBundleId, bytes32 relayerRefundRoot, bytes32 slowRelayRoot);\n event ExecutedRelayerRefundRoot(\n uint256 amountToReturn,\n uint256 indexed chainId,\n uint256[] refundAmounts,\n uint32 indexed rootBundleId,\n uint32 indexed leafId,\n address l2TokenAddress,\n address[] refundAddresses,\n address caller\n );\n event TokensBridged(\n uint256 amountToReturn,\n uint256 indexed chainId,\n uint32 indexed leafId,\n address indexed l2TokenAddress,\n address caller\n );\n event EmergencyDeleteRootBundle(uint256 indexed rootBundleId);\n\n /**\n * @notice Construct the base SpokePool.\n * @param _crossDomainAdmin Cross domain admin to set. Can be changed by admin.\n * @param _hubPool Hub pool address to set. Can be changed by admin.\n * @param _wethAddress Weth address for this network to set.\n * @param timerAddress Timer address to set.\n */\n constructor(\n address _crossDomainAdmin,\n address _hubPool,\n address _wethAddress,\n address timerAddress\n ) Testable(timerAddress) {\n _setCrossDomainAdmin(_crossDomainAdmin);\n _setHubPool(_hubPool);\n weth = WETH9(_wethAddress);\n }\n\n /****************************************\n * MODIFIERS *\n ****************************************/\n\n // Implementing contract needs to override _requireAdminSender() to ensure that admin functions are protected\n // appropriately.\n modifier onlyAdmin() {\n _requireAdminSender();\n _;\n }\n\n /**************************************\n * ADMIN FUNCTIONS *\n **************************************/\n\n /**\n * @notice Change cross domain admin address. Callable by admin only.\n * @param newCrossDomainAdmin New cross domain admin.\n */\n function setCrossDomainAdmin(address newCrossDomainAdmin) public override onlyAdmin nonReentrant {\n _setCrossDomainAdmin(newCrossDomainAdmin);\n }\n\n /**\n * @notice Change L1 hub pool address. Callable by admin only.\n * @param newHubPool New hub pool.\n */\n function setHubPool(address newHubPool) public override onlyAdmin nonReentrant {\n _setHubPool(newHubPool);\n }\n\n /**\n * @notice Enable/Disable an origin token => destination chain ID route for deposits. Callable by admin only.\n * @param originToken Token that depositor can deposit to this contract.\n * @param destinationChainId Chain ID for where depositor wants to receive funds.\n * @param enabled True to enable deposits, False otherwise.\n */\n function setEnableRoute(\n address originToken,\n uint256 destinationChainId,\n bool enabled\n ) public override onlyAdmin nonReentrant {\n enabledDepositRoutes[originToken][destinationChainId] = enabled;\n emit EnabledDepositRoute(originToken, destinationChainId, enabled);\n }\n\n /**\n * @notice Change allowance for deposit quote time to differ from current block time. Callable by admin only.\n * @param newDepositQuoteTimeBuffer New quote time buffer.\n */\n function setDepositQuoteTimeBuffer(uint32 newDepositQuoteTimeBuffer) public override onlyAdmin nonReentrant {\n depositQuoteTimeBuffer = newDepositQuoteTimeBuffer;\n emit SetDepositQuoteTimeBuffer(newDepositQuoteTimeBuffer);\n }\n\n /**\n * @notice This method stores a new root bundle in this contract that can be executed to refund relayers, fulfill\n * slow relays, and send funds back to the HubPool on L1. This method can only be called by the admin and is\n * designed to be called as part of a cross-chain message from the HubPool's executeRootBundle method.\n * @param relayerRefundRoot Merkle root containing relayer refund leaves that can be individually executed via\n * executeRelayerRefundRoot().\n * @param slowRelayRoot Merkle root containing slow relay fulfillment leaves that can be individually executed via\n * executeSlowRelayRoot().\n */\n function relayRootBundle(bytes32 relayerRefundRoot, bytes32 slowRelayRoot) public override onlyAdmin nonReentrant {\n uint32 rootBundleId = uint32(rootBundles.length);\n RootBundle storage rootBundle = rootBundles.push();\n rootBundle.relayerRefundRoot = relayerRefundRoot;\n rootBundle.slowRelayRoot = slowRelayRoot;\n emit RelayedRootBundle(rootBundleId, relayerRefundRoot, slowRelayRoot);\n }\n\n /**\n * @notice This method is intended to only be used in emergencies where a bad root bundle has reached the\n * SpokePool.\n * @param rootBundleId Index of the root bundle that needs to be deleted. Note: this is intentionally a uint256\n * to ensure that a small input range doesn't limit which indices this method is able to reach.\n */\n function emergencyDeleteRootBundle(uint256 rootBundleId) public override onlyAdmin nonReentrant {\n delete rootBundles[rootBundleId];\n emit EmergencyDeleteRootBundle(rootBundleId);\n }\n\n /**************************************\n * DEPOSITOR FUNCTIONS *\n **************************************/\n\n /**\n * @notice Called by user to bridge funds from origin to destination chain. Depositor will effectively lock\n * tokens in this contract and receive a destination token on the destination chain. The origin => destination\n * token mapping is stored on the L1 HubPool.\n * @notice The caller must first approve this contract to spend amount of originToken.\n * @notice The originToken => destinationChainId must be enabled.\n * @notice This method is payable because the caller is able to deposit ETH if the originToken is WETH and this\n * function will handle wrapping ETH.\n * @param recipient Address to receive funds at on destination chain.\n * @param originToken Token to lock into this contract to initiate deposit.\n * @param amount Amount of tokens to deposit. Will be amount of tokens to receive less fees.\n * @param destinationChainId Denotes network where user will receive funds from SpokePool by a relayer.\n * @param relayerFeePct % of deposit amount taken out to incentivize a fast relayer.\n * @param quoteTimestamp Timestamp used by relayers to compute this deposit's realizedLPFeePct which is paid\n * to LP pool on HubPool.\n */\n function deposit(\n address recipient,\n address originToken,\n uint256 amount,\n uint256 destinationChainId,\n uint64 relayerFeePct,\n uint32 quoteTimestamp\n ) public payable override nonReentrant {\n // Check that deposit route is enabled.\n require(enabledDepositRoutes[originToken][destinationChainId], \"Disabled route\");\n\n // We limit the relay fees to prevent the user spending all their funds on fees.\n require(relayerFeePct < 0.5e18, \"invalid relayer fee\");\n // This function assumes that L2 timing cannot be compared accurately and consistently to L1 timing. Therefore,\n // block.timestamp is different from the L1 EVM's. Therefore, the quoteTimestamp must be within a configurable\n // buffer of this contract's block time to allow for this variance.\n // Note also that quoteTimestamp cannot be less than the buffer otherwise the following arithmetic can result\n // in underflow. This isn't a problem as the deposit will revert, but the error might be unexpected for clients.\n require(\n getCurrentTime() >= quoteTimestamp - depositQuoteTimeBuffer &&\n getCurrentTime() <= quoteTimestamp + depositQuoteTimeBuffer,\n \"invalid quote time\"\n );\n // If the address of the origin token is a WETH contract and there is a msg.value with the transaction\n // then the user is sending ETH. In this case, the ETH should be deposited to WETH.\n if (originToken == address(weth) && msg.value > 0) {\n require(msg.value == amount, \"msg.value must match amount\");\n weth.deposit{ value: msg.value }();\n // Else, it is a normal ERC20. In this case pull the token from the user's wallet as per normal.\n // Note: this includes the case where the L2 user has WETH (already wrapped ETH) and wants to bridge them.\n // In this case the msg.value will be set to 0, indicating a \"normal\" ERC20 bridging action.\n } else IERC20(originToken).safeTransferFrom(msg.sender, address(this), amount);\n\n _emitDeposit(\n amount,\n chainId(),\n destinationChainId,\n relayerFeePct,\n numberOfDeposits,\n quoteTimestamp,\n originToken,\n recipient,\n msg.sender\n );\n\n // Increment count of deposits so that deposit ID for this spoke pool is unique.\n numberOfDeposits += 1;\n }\n\n /**\n * @notice Convenience method that depositor can use to signal to relayer to use updated fee.\n * @notice Relayer should only use events emitted by this function to submit fills with updated fees, otherwise they\n * risk their fills getting disputed for being invalid, for example if the depositor never actually signed the\n * update fee message.\n * @notice This function will revert if the depositor did not sign a message containing the updated fee for the\n * deposit ID stored in this contract. If the deposit ID is for another contract, or the depositor address is\n * incorrect, or the updated fee is incorrect, then the signature will not match and this function will revert.\n * @param depositor Signer of the update fee message who originally submitted the deposit. If the deposit doesn't\n * exist, then the relayer will not be able to fill any relay, so the caller should validate that the depositor\n * did in fact submit a relay.\n * @param newRelayerFeePct New relayer fee that relayers can use.\n * @param depositId Deposit to update fee for that originated in this contract.\n * @param depositorSignature Signed message containing the depositor address, this contract chain ID, the updated\n * relayer fee %, and the deposit ID. This signature is produced by signing a hash of data according to the\n * EIP-191 standard. See more in the _verifyUpdateRelayerFeeMessage() comments.\n */\n function speedUpDeposit(\n address depositor,\n uint64 newRelayerFeePct,\n uint32 depositId,\n bytes memory depositorSignature\n ) public override nonReentrant {\n require(newRelayerFeePct < 0.5e18, \"invalid relayer fee\");\n\n _verifyUpdateRelayerFeeMessage(depositor, chainId(), newRelayerFeePct, depositId, depositorSignature);\n\n // Assuming the above checks passed, a relayer can take the signature and the updated relayer fee information\n // from the following event to submit a fill with an updated fee %.\n emit RequestedSpeedUpDeposit(newRelayerFeePct, depositId, depositor, depositorSignature);\n }\n\n /**************************************\n * RELAYER FUNCTIONS *\n **************************************/\n\n /**\n * @notice Called by relayer to fulfill part of a deposit by sending destination tokens to the recipient.\n * Relayer is expected to pass in unique identifying information for deposit that they want to fulfill, and this\n * relay submission will be validated by off-chain data workers who can dispute this relay if any part is invalid.\n * If the relay is valid, then the relayer will be refunded on their desired repayment chain. If relay is invalid,\n * then relayer will not receive any refund.\n * @notice All of the deposit data can be found via on-chain events from the origin SpokePool, except for the\n * realizedLpFeePct which is a function of the HubPool's utilization at the deposit quote time. This fee %\n * is deterministic based on the quote time, so the relayer should just compute it using the canonical algorithm\n * as described in a UMIP linked to the HubPool's identifier.\n * @param depositor Depositor on origin chain who set this chain as the destination chain.\n * @param recipient Specified recipient on this chain.\n * @param destinationToken Token to send to recipient. Should be mapped to the origin token, origin chain ID\n * and this chain ID via a mapping on the HubPool.\n * @param amount Full size of the deposit.\n * @param maxTokensToSend Max amount of tokens to send recipient. If higher than amount, then caller will\n * send recipient the full relay amount.\n * @param repaymentChainId Chain of SpokePool where relayer wants to be refunded after the challenge window has\n * passed.\n * @param originChainId Chain of SpokePool where deposit originated.\n * @param realizedLpFeePct Fee % based on L1 HubPool utilization at deposit quote time. Deterministic based on\n * quote time.\n * @param relayerFeePct Fee % to keep as relayer, specified by depositor.\n * @param depositId Unique deposit ID on origin spoke pool.\n */\n function fillRelay(\n address depositor,\n address recipient,\n address destinationToken,\n uint256 amount,\n uint256 maxTokensToSend,\n uint256 repaymentChainId,\n uint256 originChainId,\n uint64 realizedLpFeePct,\n uint64 relayerFeePct,\n uint32 depositId\n ) public nonReentrant {\n // Each relay attempt is mapped to the hash of data uniquely identifying it, which includes the deposit data\n // such as the origin chain ID and the deposit ID, and the data in a relay attempt such as who the recipient\n // is, which chain and currency the recipient wants to receive funds on, and the relay fees.\n SpokePoolInterface.RelayData memory relayData = SpokePoolInterface.RelayData({\n depositor: depositor,\n recipient: recipient,\n destinationToken: destinationToken,\n amount: amount,\n realizedLpFeePct: realizedLpFeePct,\n relayerFeePct: relayerFeePct,\n depositId: depositId,\n originChainId: originChainId,\n destinationChainId: chainId()\n });\n bytes32 relayHash = _getRelayHash(relayData);\n\n uint256 fillAmountPreFees = _fillRelay(relayHash, relayData, maxTokensToSend, relayerFeePct, false);\n\n _emitFillRelay(relayHash, fillAmountPreFees, repaymentChainId, relayerFeePct, relayData, false);\n }\n\n /**\n * @notice Called by relayer to execute same logic as calling fillRelay except that relayer is using an updated\n * relayer fee %. The fee % must have been emitted in a message cryptographically signed by the depositor.\n * @notice By design, the depositor probably emitted the message with the updated fee by calling speedUpRelay().\n * @param depositor Depositor on origin chain who set this chain as the destination chain.\n * @param recipient Specified recipient on this chain.\n * @param destinationToken Token to send to recipient. Should be mapped to the origin token, origin chain ID\n * and this chain ID via a mapping on the HubPool.\n * @param amount Full size of the deposit.\n * @param maxTokensToSend Max amount of tokens to send recipient. If higher than amount, then caller will\n * send recipient the full relay amount.\n * @param repaymentChainId Chain of SpokePool where relayer wants to be refunded after the challenge window has\n * passed.\n * @param originChainId Chain of SpokePool where deposit originated.\n * @param realizedLpFeePct Fee % based on L1 HubPool utilization at deposit quote time. Deterministic based on\n * quote time.\n * @param relayerFeePct Original fee % to keep as relayer set by depositor.\n * @param newRelayerFeePct New fee % to keep as relayer also specified by depositor.\n * @param depositId Unique deposit ID on origin spoke pool.\n * @param depositorSignature Depositor-signed message containing updated fee %.\n */\n function fillRelayWithUpdatedFee(\n address depositor,\n address recipient,\n address destinationToken,\n uint256 amount,\n uint256 maxTokensToSend,\n uint256 repaymentChainId,\n uint256 originChainId,\n uint64 realizedLpFeePct,\n uint64 relayerFeePct,\n uint64 newRelayerFeePct,\n uint32 depositId,\n bytes memory depositorSignature\n ) public override nonReentrant {\n _verifyUpdateRelayerFeeMessage(depositor, originChainId, newRelayerFeePct, depositId, depositorSignature);\n\n // Now follow the default fillRelay flow with the updated fee and the original relay hash.\n RelayData memory relayData = RelayData({\n depositor: depositor,\n recipient: recipient,\n destinationToken: destinationToken,\n amount: amount,\n realizedLpFeePct: realizedLpFeePct,\n relayerFeePct: relayerFeePct,\n depositId: depositId,\n originChainId: originChainId,\n destinationChainId: chainId()\n });\n bytes32 relayHash = _getRelayHash(relayData);\n uint256 fillAmountPreFees = _fillRelay(relayHash, relayData, maxTokensToSend, newRelayerFeePct, false);\n\n _emitFillRelay(relayHash, fillAmountPreFees, repaymentChainId, newRelayerFeePct, relayData, false);\n }\n\n /**************************************\n * DATA WORKER FUNCTIONS *\n **************************************/\n\n /**\n * @notice Executes a slow relay leaf stored as part of a root bundle. Will send the full amount remaining in the\n * relay to the recipient, less fees.\n * @dev This function assumes that the relay's destination chain ID is the current chain ID, which prevents\n * the caller from executing a slow relay intended for another chain on this chain.\n * @param depositor Depositor on origin chain who set this chain as the destination chain.\n * @param recipient Specified recipient on this chain.\n * @param destinationToken Token to send to recipient. Should be mapped to the origin token, origin chain ID\n * and this chain ID via a mapping on the HubPool.\n * @param amount Full size of the deposit.\n * @param originChainId Chain of SpokePool where deposit originated.\n * @param realizedLpFeePct Fee % based on L1 HubPool utilization at deposit quote time. Deterministic based on\n * quote time.\n * @param relayerFeePct Original fee % to keep as relayer set by depositor.\n * @param depositId Unique deposit ID on origin spoke pool.\n * @param rootBundleId Unique ID of root bundle containing slow relay root that this leaf is contained in.\n * @param proof Inclusion proof for this leaf in slow relay root in root bundle.\n */\n function executeSlowRelayRoot(\n address depositor,\n address recipient,\n address destinationToken,\n uint256 amount,\n uint256 originChainId,\n uint64 realizedLpFeePct,\n uint64 relayerFeePct,\n uint32 depositId,\n uint32 rootBundleId,\n bytes32[] memory proof\n ) public virtual override nonReentrant {\n _executeSlowRelayRoot(\n depositor,\n recipient,\n destinationToken,\n amount,\n originChainId,\n chainId(),\n realizedLpFeePct,\n relayerFeePct,\n depositId,\n rootBundleId,\n proof\n );\n }\n\n /**\n * @notice Executes a relayer refund leaf stored as part of a root bundle. Will send the relayer the amount they\n * sent to the recipient plus a relayer fee.\n * @param rootBundleId Unique ID of root bundle containing relayer refund root that this leaf is contained in.\n * @param relayerRefundLeaf Contains all data necessary to reconstruct leaf contained in root bundle and to\n * refund relayer. This data structure is explained in detail in the SpokePoolInterface.\n * @param proof Inclusion proof for this leaf in relayer refund root in root bundle.\n */\n function executeRelayerRefundRoot(\n uint32 rootBundleId,\n SpokePoolInterface.RelayerRefundLeaf memory relayerRefundLeaf,\n bytes32[] memory proof\n ) public virtual override nonReentrant {\n _executeRelayerRefundRoot(rootBundleId, relayerRefundLeaf, proof);\n }\n\n /**************************************\n * VIEW FUNCTIONS *\n **************************************/\n\n /**\n * @notice Returns chain ID for this network.\n * @dev Some L2s like ZKSync don't support the CHAIN_ID opcode so we allow the implementer to override this.\n */\n function chainId() public view virtual override returns (uint256) {\n return block.chainid;\n }\n\n /**************************************\n * INTERNAL FUNCTIONS *\n **************************************/\n\n // Verifies inclusion proof of leaf in root, sends relayer their refund, and sends to HubPool any rebalance\n // transfers.\n function _executeRelayerRefundRoot(\n uint32 rootBundleId,\n SpokePoolInterface.RelayerRefundLeaf memory relayerRefundLeaf,\n bytes32[] memory proof\n ) internal {\n // Check integrity of leaf structure:\n require(relayerRefundLeaf.chainId == chainId(), \"Invalid chainId\");\n require(relayerRefundLeaf.refundAddresses.length == relayerRefundLeaf.refundAmounts.length, \"invalid leaf\");\n\n RootBundle storage rootBundle = rootBundles[rootBundleId];\n\n // Check that inclusionProof proves that relayerRefundLeaf is contained within the relayer refund root.\n // Note: This should revert if the relayerRefundRoot is uninitialized.\n require(MerkleLib.verifyRelayerRefund(rootBundle.relayerRefundRoot, relayerRefundLeaf, proof), \"Bad Proof\");\n\n // Verify the leafId in the leaf has not yet been claimed.\n require(!MerkleLib.isClaimed(rootBundle.claimedBitmap, relayerRefundLeaf.leafId), \"Already claimed\");\n\n // Set leaf as claimed in bitmap. This is passed by reference to the storage rootBundle.\n MerkleLib.setClaimed(rootBundle.claimedBitmap, relayerRefundLeaf.leafId);\n\n // Send each relayer refund address the associated refundAmount for the L2 token address.\n // Note: Even if the L2 token is not enabled on this spoke pool, we should still refund relayers.\n for (uint32 i = 0; i < relayerRefundLeaf.refundAmounts.length; i++) {\n uint256 amount = relayerRefundLeaf.refundAmounts[i];\n if (amount > 0)\n IERC20(relayerRefundLeaf.l2TokenAddress).safeTransfer(relayerRefundLeaf.refundAddresses[i], amount);\n }\n\n // If leaf's amountToReturn is positive, then send L2 --> L1 message to bridge tokens back via\n // chain-specific bridging method.\n if (relayerRefundLeaf.amountToReturn > 0) {\n _bridgeTokensToHubPool(relayerRefundLeaf);\n\n emit TokensBridged(\n relayerRefundLeaf.amountToReturn,\n relayerRefundLeaf.chainId,\n relayerRefundLeaf.leafId,\n relayerRefundLeaf.l2TokenAddress,\n msg.sender\n );\n }\n\n emit ExecutedRelayerRefundRoot(\n relayerRefundLeaf.amountToReturn,\n relayerRefundLeaf.chainId,\n relayerRefundLeaf.refundAmounts,\n rootBundleId,\n relayerRefundLeaf.leafId,\n relayerRefundLeaf.l2TokenAddress,\n relayerRefundLeaf.refundAddresses,\n msg.sender\n );\n }\n\n // Verifies inclusion proof of leaf in root and sends recipient remainder of relay. Marks relay as filled.\n function _executeSlowRelayRoot(\n address depositor,\n address recipient,\n address destinationToken,\n uint256 amount,\n uint256 originChainId,\n uint256 destinationChainId,\n uint64 realizedLpFeePct,\n uint64 relayerFeePct,\n uint32 depositId,\n uint32 rootBundleId,\n bytes32[] memory proof\n ) internal {\n RelayData memory relayData = RelayData({\n depositor: depositor,\n recipient: recipient,\n destinationToken: destinationToken,\n amount: amount,\n originChainId: originChainId,\n destinationChainId: destinationChainId,\n realizedLpFeePct: realizedLpFeePct,\n relayerFeePct: relayerFeePct,\n depositId: depositId\n });\n\n require(\n MerkleLib.verifySlowRelayFulfillment(rootBundles[rootBundleId].slowRelayRoot, relayData, proof),\n \"Invalid proof\"\n );\n\n bytes32 relayHash = _getRelayHash(relayData);\n\n // Note: use relayAmount as the max amount to send, so the relay is always completely filled by the contract's\n // funds in all cases. As this is a slow relay we set the relayerFeePct to 0. This effectively refunds the\n // relayer component of the relayerFee thereby only charging the depositor the LpFee.\n uint256 fillAmountPreFees = _fillRelay(relayHash, relayData, relayData.amount, 0, true);\n\n // Note: Set repayment chain ID to 0 to indicate that there is no repayment to be made. The off-chain data\n // worker can use repaymentChainId=0 as a signal to ignore such relays for refunds. Also, set the relayerFeePct\n // to 0 as slow relays do not pay the caller of this method (depositor is refunded this fee).\n _emitFillRelay(relayHash, fillAmountPreFees, 0, 0, relayData, true);\n }\n\n function _setCrossDomainAdmin(address newCrossDomainAdmin) internal {\n require(newCrossDomainAdmin != address(0), \"Bad bridge router address\");\n crossDomainAdmin = newCrossDomainAdmin;\n emit SetXDomainAdmin(crossDomainAdmin);\n }\n\n function _setHubPool(address newHubPool) internal {\n require(newHubPool != address(0), \"Bad hub pool address\");\n hubPool = newHubPool;\n emit SetHubPool(hubPool);\n }\n\n // Should be overriden by implementing contract depending on how L2 handles sending tokens to L1.\n function _bridgeTokensToHubPool(SpokePoolInterface.RelayerRefundLeaf memory relayerRefundLeaf) internal virtual;\n\n function _verifyUpdateRelayerFeeMessage(\n address depositor,\n uint256 originChainId,\n uint64 newRelayerFeePct,\n uint32 depositId,\n bytes memory depositorSignature\n ) internal view {\n // A depositor can request to speed up an un-relayed deposit by signing a hash containing the relayer\n // fee % to update to and information uniquely identifying the deposit to relay. This information ensures\n // that this signature cannot be re-used for other deposits. The version string is included as a precaution\n // in case this contract is upgraded.\n // Note: we use encode instead of encodePacked because it is more secure, more in the \"warning\" section\n // here: https://docs.soliditylang.org/en/v0.8.11/abi-spec.html#non-standard-packed-mode\n bytes32 expectedDepositorMessageHash = keccak256(\n abi.encode(\"ACROSS-V2-FEE-1.0\", newRelayerFeePct, depositId, originChainId)\n );\n\n // Check the hash corresponding to the https://eth.wiki/json-rpc/API#eth_sign[eth_sign]\n // If the depositor signed a message with a different updated fee (or any other param included in the\n // above keccak156 hash), then this will revert.\n bytes32 ethSignedMessageHash = ECDSA.toEthSignedMessageHash(expectedDepositorMessageHash);\n\n _verifyDepositorUpdateFeeMessage(depositor, ethSignedMessageHash, depositorSignature);\n }\n\n // This function is isolated and made virtual to allow different L2's to implement chain specific recovery of\n // signers from signatures because some L2s might not support ecrecover. To be safe, consider always reverting\n // this function for L2s where ecrecover is different from how it works on Ethereum, otherwise there is the\n // potential to forge a signature from the depositor using a different private key than the original depositor's.\n function _verifyDepositorUpdateFeeMessage(\n address depositor,\n bytes32 ethSignedMessageHash,\n bytes memory depositorSignature\n ) internal view virtual {\n // Note: We purposefully do not support EIP-191 signatures (meaning that multisigs and smart contract wallets\n // like Argent are not supported) because of the possibility that a multisig that signed a message on the origin\n // chain does not have a parallel on this destination chain.\n require(depositor == ECDSA.recover(ethSignedMessageHash, depositorSignature), \"invalid signature\");\n }\n\n function _computeAmountPreFees(uint256 amount, uint64 feesPct) private pure returns (uint256) {\n return (1e18 * amount) / (1e18 - feesPct);\n }\n\n function _computeAmountPostFees(uint256 amount, uint64 feesPct) private pure returns (uint256) {\n return (amount * (1e18 - feesPct)) / 1e18;\n }\n\n function _getRelayHash(SpokePoolInterface.RelayData memory relayData) private pure returns (bytes32) {\n return keccak256(abi.encode(relayData));\n }\n\n // Unwraps ETH and does a transfer to a recipient address. If the recipient is a smart contract then sends WETH.\n function _unwrapWETHTo(address payable to, uint256 amount) internal {\n if (address(to).isContract()) {\n IERC20(address(weth)).safeTransfer(to, amount);\n } else {\n weth.withdraw(amount);\n to.transfer(amount);\n }\n }\n\n /**\n * @notice Caller specifies the max amount of tokens to send to user. Based on this amount and the amount of the\n * relay remaining (as stored in the relayFills mapping), pull the amount of tokens from the caller\n * and send to the recipient.\n * @dev relayFills keeps track of pre-fee fill amounts as a convenience to relayers who want to specify round\n * numbers for the maxTokensToSend parameter or convenient numbers like 100 (i.e. relayers who will fully\n * fill any relay up to 100 tokens, and partial fill with 100 tokens for larger relays).\n * @dev Caller must approve this contract to transfer up to maxTokensToSend of the relayData.destinationToken.\n * The amount to be sent might end up less if there is insufficient relay amount remaining to be sent.\n */\n function _fillRelay(\n bytes32 relayHash,\n RelayData memory relayData,\n uint256 maxTokensToSend,\n uint64 updatableRelayerFeePct,\n bool useContractFunds\n ) internal returns (uint256 fillAmountPreFees) {\n // We limit the relay fees to prevent the user spending all their funds on fees. Note that 0.5e18 (i.e. 50%)\n // fees are just magic numbers. The important point is to prevent the total fee from being 100%, otherwise\n // computing the amount pre fees runs into divide-by-0 issues.\n require(updatableRelayerFeePct < 0.5e18 && relayData.realizedLpFeePct < 0.5e18, \"invalid fees\");\n\n // Check that the relay has not already been completely filled. Note that the relays mapping will point to\n // the amount filled so far for a particular relayHash, so this will start at 0 and increment with each fill.\n require(relayFills[relayHash] < relayData.amount, \"relay filled\");\n\n // Stores the equivalent amount to be sent by the relayer before fees have been taken out.\n if (maxTokensToSend == 0) return 0;\n\n // Derive the amount of the relay filled if the caller wants to send exactly maxTokensToSend tokens to\n // the recipient. For example, if the user wants to send 10 tokens to the recipient, the full relay amount\n // is 100, and the fee %'s total 5%, then this computation would return ~10.5, meaning that to fill 10.5/100\n // of the full relay size, the caller would need to send 10 tokens to the user.\n fillAmountPreFees = _computeAmountPreFees(\n maxTokensToSend,\n (relayData.realizedLpFeePct + updatableRelayerFeePct)\n );\n // If user's specified max amount to send is greater than the amount of the relay remaining pre-fees,\n // we'll pull exactly enough tokens to complete the relay.\n uint256 amountToSend = maxTokensToSend;\n uint256 amountRemainingInRelay = relayData.amount - relayFills[relayHash];\n if (amountRemainingInRelay < fillAmountPreFees) {\n fillAmountPreFees = amountRemainingInRelay;\n\n // The user will fulfill the remainder of the relay, so we need to compute exactly how many tokens post-fees\n // that they need to send to the recipient. Note that if the relayer is filled using contract funds then\n // this is a slow relay.\n amountToSend = _computeAmountPostFees(\n fillAmountPreFees,\n relayData.realizedLpFeePct + updatableRelayerFeePct\n );\n }\n\n // relayFills keeps track of pre-fee fill amounts as a convenience to relayers who want to specify round\n // numbers for the maxTokensToSend parameter or convenient numbers like 100 (i.e. relayers who will fully\n // fill any relay up to 100 tokens, and partial fill with 100 tokens for larger relays).\n relayFills[relayHash] += fillAmountPreFees;\n\n // If relay token is weth then unwrap and send eth.\n if (relayData.destinationToken == address(weth)) {\n // Note: useContractFunds is True if we want to send funds to the recipient directly out of this contract,\n // otherwise we expect the caller to send funds to the recipient. If useContractFunds is True and the\n // recipient wants WETH, then we can assume that WETH is already in the contract, otherwise we'll need the\n // the user to send WETH to this contract. Regardless, we'll need to unwrap it before sending to the user.\n if (!useContractFunds)\n IERC20(relayData.destinationToken).safeTransferFrom(msg.sender, address(this), amountToSend);\n _unwrapWETHTo(payable(relayData.recipient), amountToSend);\n // Else, this is a normal ERC20 token. Send to recipient.\n } else {\n // Note: Similar to note above, send token directly from the contract to the user in the slow relay case.\n if (!useContractFunds)\n IERC20(relayData.destinationToken).safeTransferFrom(msg.sender, relayData.recipient, amountToSend);\n else IERC20(relayData.destinationToken).safeTransfer(relayData.recipient, amountToSend);\n }\n }\n\n // The following internal methods emit events with many params to overcome solidity stack too deep issues.\n function _emitFillRelay(\n bytes32 relayHash,\n uint256 fillAmount,\n uint256 repaymentChainId,\n uint64 relayerFeePct,\n RelayData memory relayData,\n bool isSlowRelay\n ) internal {\n emit FilledRelay(\n relayHash,\n relayData.amount,\n relayFills[relayHash],\n fillAmount,\n repaymentChainId,\n relayData.originChainId,\n relayData.destinationChainId,\n relayerFeePct,\n relayData.realizedLpFeePct,\n relayData.depositId,\n relayData.destinationToken,\n msg.sender,\n relayData.depositor,\n relayData.recipient,\n isSlowRelay\n );\n }\n\n function _emitDeposit(\n uint256 amount,\n uint256 originChainId,\n uint256 destinationChainId,\n uint64 relayerFeePct,\n uint32 depositId,\n uint32 quoteTimestamp,\n address originToken,\n address recipient,\n address depositor\n ) internal {\n emit FundsDeposited(\n amount,\n originChainId,\n destinationChainId,\n relayerFeePct,\n depositId,\n quoteTimestamp,\n originToken,\n recipient,\n depositor\n );\n }\n\n // Implementing contract needs to override this to ensure that only the appropriate cross chain admin can execute\n // certain admin functions. For L2 contracts, the cross chain admin refers to some L1 address or contract, and for\n // L1, this would just be the same admin of the HubPool.\n function _requireAdminSender() internal virtual;\n\n // Added to enable the this contract to receive ETH. Used when unwrapping Weth.\n receive() external payable {}\n}\n" }, "contracts/MerkleLib.sol": { - "content": "// SPDX-License-Identifier: GPL-3.0-only\npragma solidity ^0.8.0;\n\nimport \"@openzeppelin/contracts/utils/cryptography/MerkleProof.sol\";\nimport \"./SpokePoolInterface.sol\";\nimport \"./HubPoolInterface.sol\";\n\n/**\n * @notice Library to help with merkle roots, proofs, and claims.\n */\nlibrary MerkleLib {\n /**\n * @notice Verifies that a repayment is contained within a merkle root.\n * @param root the merkle root.\n * @param rebalance the rebalance struct.\n * @param proof the merkle proof.\n */\n function verifyPoolRebalance(\n bytes32 root,\n HubPoolInterface.PoolRebalanceLeaf memory rebalance,\n bytes32[] memory proof\n ) internal pure returns (bool) {\n return MerkleProof.verify(proof, root, keccak256(abi.encode(rebalance)));\n }\n\n /**\n * @notice Verifies that a relayer refund is contained within a merkle root.\n * @param root the merkle root.\n * @param refund the refund struct.\n * @param proof the merkle proof.\n */\n function verifyRelayerRefund(\n bytes32 root,\n SpokePoolInterface.RelayerRefundLeaf memory refund,\n bytes32[] memory proof\n ) internal pure returns (bool) {\n return MerkleProof.verify(proof, root, keccak256(abi.encode(refund)));\n }\n\n /**\n * @notice Verifies that a distribution is contained within a merkle root.\n * @param root the merkle root.\n * @param slowRelayFulfillment the relayData fulfullment struct.\n * @param proof the merkle proof.\n */\n function verifySlowRelayFulfillment(\n bytes32 root,\n SpokePoolInterface.RelayData memory slowRelayFulfillment,\n bytes32[] memory proof\n ) internal pure returns (bool) {\n return MerkleProof.verify(proof, root, keccak256(abi.encode(slowRelayFulfillment)));\n }\n\n // The following functions are primarily copied from\n // https://github.com/Uniswap/merkle-distributor/blob/master/contracts/MerkleDistributor.sol with minor changes.\n\n /**\n * @notice Tests whether a claim is contained within a claimedBitMap mapping.\n * @param claimedBitMap a simple uint256 mapping in storage used as a bitmap.\n * @param index the index to check in the bitmap.\n * @return bool indicating if the index within the claimedBitMap has been marked as claimed.\n */\n function isClaimed(mapping(uint256 => uint256) storage claimedBitMap, uint256 index) internal view returns (bool) {\n uint256 claimedWordIndex = index / 256;\n uint256 claimedBitIndex = index % 256;\n uint256 claimedWord = claimedBitMap[claimedWordIndex];\n uint256 mask = (1 << claimedBitIndex);\n return claimedWord & mask == mask;\n }\n\n /**\n * @notice Marks an index in a claimedBitMap as claimed.\n * @param claimedBitMap a simple uint256 mapping in storage used as a bitmap.\n * @param index the index to mark in the bitmap.\n */\n function setClaimed(mapping(uint256 => uint256) storage claimedBitMap, uint256 index) internal {\n uint256 claimedWordIndex = index / 256;\n uint256 claimedBitIndex = index % 256;\n claimedBitMap[claimedWordIndex] = claimedBitMap[claimedWordIndex] | (1 << claimedBitIndex);\n }\n\n /**\n * @notice Tests whether a claim is contained within a 1D claimedBitMap mapping.\n * @param claimedBitMap a simple uint256 value, encoding a 1D bitmap.\n * @param index the index to check in the bitmap.\n \\* @return bool indicating if the index within the claimedBitMap has been marked as claimed.\n */\n function isClaimed1D(uint256 claimedBitMap, uint256 index) internal pure returns (bool) {\n uint256 mask = (1 << index);\n return claimedBitMap & mask == mask;\n }\n\n /**\n * @notice Marks an index in a claimedBitMap as claimed.\n * @param claimedBitMap a simple uint256 mapping in storage used as a bitmap.\n * @param index the index to mark in the bitmap.\n */\n function setClaimed1D(uint256 claimedBitMap, uint256 index) internal pure returns (uint256) {\n require(index <= 255, \"Index out of bounds\");\n return claimedBitMap | (1 << index % 256);\n }\n}\n" + "content": "// SPDX-License-Identifier: GPL-3.0-only\npragma solidity ^0.8.0;\n\nimport \"./SpokePoolInterface.sol\";\nimport \"./HubPoolInterface.sol\";\n\nimport \"@openzeppelin/contracts/utils/cryptography/MerkleProof.sol\";\n\n/**\n * @notice Library to help with merkle roots, proofs, and claims.\n */\nlibrary MerkleLib {\n /**\n * @notice Verifies that a repayment is contained within a merkle root.\n * @param root the merkle root.\n * @param rebalance the rebalance struct.\n * @param proof the merkle proof.\n * @return bool to signal if the pool rebalance proof correctly shows inclusion of the rebalance within the tree.\n */\n function verifyPoolRebalance(\n bytes32 root,\n HubPoolInterface.PoolRebalanceLeaf memory rebalance,\n bytes32[] memory proof\n ) internal pure returns (bool) {\n return MerkleProof.verify(proof, root, keccak256(abi.encode(rebalance)));\n }\n\n /**\n * @notice Verifies that a relayer refund is contained within a merkle root.\n * @param root the merkle root.\n * @param refund the refund struct.\n * @param proof the merkle proof.\n * @return bool to signal if the relayer refund proof correctly shows inclusion of the refund within the tree.\n */\n function verifyRelayerRefund(\n bytes32 root,\n SpokePoolInterface.RelayerRefundLeaf memory refund,\n bytes32[] memory proof\n ) internal pure returns (bool) {\n return MerkleProof.verify(proof, root, keccak256(abi.encode(refund)));\n }\n\n /**\n * @notice Verifies that a distribution is contained within a merkle root.\n * @param root the merkle root.\n * @param slowRelayFulfillment the relayData fulfillment struct.\n * @param proof the merkle proof.\n * @return bool to signal if the slow relay's proof correctly shows inclusion of the slow relay within the tree.\n */\n function verifySlowRelayFulfillment(\n bytes32 root,\n SpokePoolInterface.RelayData memory slowRelayFulfillment,\n bytes32[] memory proof\n ) internal pure returns (bool) {\n return MerkleProof.verify(proof, root, keccak256(abi.encode(slowRelayFulfillment)));\n }\n\n // The following functions are primarily copied from\n // https://github.com/Uniswap/merkle-distributor/blob/master/contracts/MerkleDistributor.sol with minor changes.\n\n /**\n * @notice Tests whether a claim is contained within a claimedBitMap mapping.\n * @param claimedBitMap a simple uint256 mapping in storage used as a bitmap.\n * @param index the index to check in the bitmap.\n * @return bool indicating if the index within the claimedBitMap has been marked as claimed.\n */\n function isClaimed(mapping(uint256 => uint256) storage claimedBitMap, uint256 index) internal view returns (bool) {\n uint256 claimedWordIndex = index / 256;\n uint256 claimedBitIndex = index % 256;\n uint256 claimedWord = claimedBitMap[claimedWordIndex];\n uint256 mask = (1 << claimedBitIndex);\n return claimedWord & mask == mask;\n }\n\n /**\n * @notice Marks an index in a claimedBitMap as claimed.\n * @param claimedBitMap a simple uint256 mapping in storage used as a bitmap.\n * @param index the index to mark in the bitmap.\n */\n function setClaimed(mapping(uint256 => uint256) storage claimedBitMap, uint256 index) internal {\n uint256 claimedWordIndex = index / 256;\n uint256 claimedBitIndex = index % 256;\n claimedBitMap[claimedWordIndex] = claimedBitMap[claimedWordIndex] | (1 << claimedBitIndex);\n }\n\n /**\n * @notice Tests whether a claim is contained within a 1D claimedBitMap mapping.\n * @param claimedBitMap a simple uint256 value, encoding a 1D bitmap.\n * @param index the index to check in the bitmap. Uint8 type enforces that index can't be > 255.\n * @return bool indicating if the index within the claimedBitMap has been marked as claimed.\n */\n function isClaimed1D(uint256 claimedBitMap, uint8 index) internal pure returns (bool) {\n uint256 mask = (1 << index);\n return claimedBitMap & mask == mask;\n }\n\n /**\n * @notice Marks an index in a claimedBitMap as claimed.\n * @param claimedBitMap a simple uint256 mapping in storage used as a bitmap. Uint8 type enforces that index\n * can't be > 255.\n * @param index the index to mark in the bitmap.\n * @return uint256 representing the modified input claimedBitMap with the index set to true.\n */\n function setClaimed1D(uint256 claimedBitMap, uint8 index) internal pure returns (uint256) {\n return claimedBitMap | (1 << index % 256);\n }\n}\n" }, "contracts/interfaces/WETH9.sol": { "content": "// SPDX-License-Identifier: GPL-3.0-only\npragma solidity ^0.8.0;\n\ninterface WETH9 {\n function withdraw(uint256 wad) external;\n\n function deposit() external payable;\n\n function balanceOf(address guy) external view returns (uint256 wad);\n\n function transfer(address guy, uint256 wad) external;\n}\n" }, + "contracts/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 * @dev The reason why we use this local contract instead of importing from uma/contracts is because of the addition\n * of the internal method `functionCallStackOriginatesFromOutsideThisContract` which doesn't exist in the one exported\n * by uma/contracts.\n */\ncontract Lockable {\n bool internal _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 /**\n * @dev Returns true if the contract is currently in a non-entered state, meaning that the origination of the call\n * came from outside the contract. This is relevant with fallback/receive methods to see if the call came from ETH\n * being dropped onto the contract externally or due to ETH dropped on the the contract from within a method in this\n * contract, such as unwrapping WETH to ETH within the contract.\n */\n function functionCallStackOriginatesFromOutsideThisContract() internal view returns (bool) {\n return _notEntered;\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" + }, + "contracts/SpokePoolInterface.sol": { + "content": "// SPDX-License-Identifier: GPL-3.0-only\npragma solidity ^0.8.0;\n\n/**\n * @notice Contains common data structures and functions used by all SpokePool implementations.\n */\ninterface SpokePoolInterface {\n // This leaf is meant to be decoded in the SpokePool to pay out successful relayers.\n struct RelayerRefundLeaf {\n // This is the amount to return to the HubPool. This occurs when there is a PoolRebalanceLeaf netSendAmount that\n // is negative. This is just the negative of this value.\n uint256 amountToReturn;\n // Used to verify that this is being executed on the correct destination chainId.\n uint256 chainId;\n // This array designates how much each of those addresses should be refunded.\n uint256[] refundAmounts;\n // Used as the index in the bitmap to track whether this leaf has been executed or not.\n uint32 leafId;\n // The associated L2TokenAddress that these claims apply to.\n address l2TokenAddress;\n // Must be same length as refundAmounts and designates each address that must be refunded.\n address[] refundAddresses;\n }\n\n // This struct represents the data to fully specify a relay. If any portion of this data differs, the relay is\n // considered to be completely distinct. Only one relay for a particular depositId, chainId pair should be\n // considered valid and repaid. This data is hashed and inserted into the slow relay merkle root so that an off\n // chain validator can choose when to refund slow relayers.\n struct RelayData {\n // The address that made the deposit on the origin chain.\n address depositor;\n // The recipient address on the destination chain.\n address recipient;\n // The corresponding token address on the destination chain.\n address destinationToken;\n // The total relay amount before fees are taken out.\n uint256 amount;\n // Origin chain id.\n uint256 originChainId;\n // Destination chain id.\n uint256 destinationChainId;\n // The LP Fee percentage computed by the relayer based on the deposit's quote timestamp\n // and the HubPool's utilization.\n uint64 realizedLpFeePct;\n // The relayer fee percentage specified in the deposit.\n uint64 relayerFeePct;\n // The id uniquely identifying this deposit on the origin chain.\n uint32 depositId;\n }\n\n // Stores collection of merkle roots that can be published to this contract from the HubPool, which are referenced\n // by \"data workers\" via inclusion proofs to execute leaves in the roots.\n struct RootBundle {\n // Merkle root of slow relays that were not fully filled and whose recipient is still owed funds from the LP pool.\n bytes32 slowRelayRoot;\n // Merkle root of relayer refunds for successful relays.\n bytes32 relayerRefundRoot;\n // This is a 2D bitmap tracking which leaves in the relayer refund root have been claimed, with max size of\n // 256x256 leaves per root.\n mapping(uint256 => uint256) claimedBitmap;\n }\n\n function setCrossDomainAdmin(address newCrossDomainAdmin) external;\n\n function setHubPool(address newHubPool) external;\n\n function setEnableRoute(\n address originToken,\n uint256 destinationChainId,\n bool enable\n ) external;\n\n function setDepositQuoteTimeBuffer(uint32 buffer) external;\n\n function relayRootBundle(bytes32 relayerRefundRoot, bytes32 slowRelayRoot) external;\n\n function emergencyDeleteRootBundle(uint256 rootBundleId) external;\n\n function deposit(\n address recipient,\n address originToken,\n uint256 amount,\n uint256 destinationChainId,\n uint64 relayerFeePct,\n uint32 quoteTimestamp\n ) external payable;\n\n function speedUpDeposit(\n address depositor,\n uint64 newRelayerFeePct,\n uint32 depositId,\n bytes memory depositorSignature\n ) external;\n\n function fillRelay(\n address depositor,\n address recipient,\n address destinationToken,\n uint256 amount,\n uint256 maxTokensToSend,\n uint256 repaymentChainId,\n uint256 originChainId,\n uint64 realizedLpFeePct,\n uint64 relayerFeePct,\n uint32 depositId\n ) external;\n\n function fillRelayWithUpdatedFee(\n address depositor,\n address recipient,\n address destinationToken,\n uint256 amount,\n uint256 maxTokensToSend,\n uint256 repaymentChainId,\n uint256 originChainId,\n uint64 realizedLpFeePct,\n uint64 relayerFeePct,\n uint64 newRelayerFeePct,\n uint32 depositId,\n bytes memory depositorSignature\n ) external;\n\n function executeSlowRelayRoot(\n address depositor,\n address recipient,\n address destinationToken,\n uint256 amount,\n uint256 originChainId,\n uint64 realizedLpFeePct,\n uint64 relayerFeePct,\n uint32 depositId,\n uint32 rootBundleId,\n bytes32[] memory proof\n ) external;\n\n function executeRelayerRefundRoot(\n uint32 rootBundleId,\n SpokePoolInterface.RelayerRefundLeaf memory relayerRefundLeaf,\n bytes32[] memory proof\n ) external;\n\n function chainId() external view returns (uint256);\n}\n" + }, "@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol": { "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts v4.4.1 (token/ERC20/utils/SafeERC20.sol)\n\npragma solidity ^0.8.0;\n\nimport \"../IERC20.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 function safeTransfer(\n IERC20 token,\n address to,\n uint256 value\n ) internal {\n _callOptionalReturn(token, abi.encodeWithSelector(token.transfer.selector, to, value));\n }\n\n function safeTransferFrom(\n IERC20 token,\n address from,\n address to,\n uint256 value\n ) 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(\n IERC20 token,\n address spender,\n uint256 value\n ) 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 function safeIncreaseAllowance(\n IERC20 token,\n address spender,\n uint256 value\n ) internal {\n uint256 newAllowance = token.allowance(address(this), spender) + value;\n _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, newAllowance));\n }\n\n function safeDecreaseAllowance(\n IERC20 token,\n address spender,\n uint256 value\n ) internal {\n unchecked {\n uint256 oldAllowance = token.allowance(address(this), spender);\n require(oldAllowance >= value, \"SafeERC20: decreased allowance below zero\");\n uint256 newAllowance = oldAllowance - value;\n _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, newAllowance));\n }\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 if (returndata.length > 0) {\n // Return data is optional\n require(abi.decode(returndata, (bool)), \"SafeERC20: ERC20 operation did not succeed\");\n }\n }\n}\n" }, @@ -25,9 +28,6 @@ "@openzeppelin/contracts/utils/Address.sol": { "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.5.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 *\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://diligence.consensys.net/posts/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.5.11/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 functionCall(target, data, \"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(\n address target,\n bytes memory data,\n uint256 value\n ) 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 require(isContract(target), \"Address: call to non-contract\");\n\n (bool success, bytes memory returndata) = target.call{value: value}(data);\n return verifyCallResult(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 require(isContract(target), \"Address: static call to non-contract\");\n\n (bool success, bytes memory returndata) = target.staticcall(data);\n return verifyCallResult(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 require(isContract(target), \"Address: delegate call to non-contract\");\n\n (bool success, bytes memory returndata) = target.delegatecall(data);\n return verifyCallResult(success, returndata, errorMessage);\n }\n\n /**\n * @dev Tool to verifies that a low level call was successful, and revert if it wasn't, either by bubbling the\n * revert reason 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 // 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\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}\n" }, - "@openzeppelin/contracts/utils/cryptography/SignatureChecker.sol": { - "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.5.0) (utils/cryptography/SignatureChecker.sol)\n\npragma solidity ^0.8.0;\n\nimport \"./ECDSA.sol\";\nimport \"../Address.sol\";\nimport \"../../interfaces/IERC1271.sol\";\n\n/**\n * @dev Signature verification helper that can be used instead of `ECDSA.recover` to seamlessly support both ECDSA\n * signatures from externally owned accounts (EOAs) as well as ERC1271 signatures from smart contract wallets like\n * Argent and Gnosis Safe.\n *\n * _Available since v4.1._\n */\nlibrary SignatureChecker {\n /**\n * @dev Checks if a signature is valid for a given signer and data hash. If the signer is a smart contract, the\n * signature is validated against that smart contract using ERC1271, otherwise it's validated using `ECDSA.recover`.\n *\n * NOTE: Unlike ECDSA signatures, contract signatures are revocable, and the outcome of this function can thus\n * change through time. It could return true at block N and false at block N+1 (or the opposite).\n */\n function isValidSignatureNow(\n address signer,\n bytes32 hash,\n bytes memory signature\n ) internal view returns (bool) {\n (address recovered, ECDSA.RecoverError error) = ECDSA.tryRecover(hash, signature);\n if (error == ECDSA.RecoverError.NoError && recovered == signer) {\n return true;\n }\n\n (bool success, bytes memory result) = signer.staticcall(\n abi.encodeWithSelector(IERC1271.isValidSignature.selector, hash, signature)\n );\n return (success && result.length == 32 && abi.decode(result, (bytes4)) == IERC1271.isValidSignature.selector);\n }\n}\n" - }, "@openzeppelin/contracts/utils/cryptography/ECDSA.sol": { "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.5.0) (utils/cryptography/ECDSA.sol)\n\npragma solidity ^0.8.0;\n\nimport \"../Strings.sol\";\n\n/**\n * @dev Elliptic Curve Digital Signature Algorithm (ECDSA) operations.\n *\n * These functions can be used to verify that a message was signed by the holder\n * of the private keys of a given address.\n */\nlibrary ECDSA {\n enum RecoverError {\n NoError,\n InvalidSignature,\n InvalidSignatureLength,\n InvalidSignatureS,\n InvalidSignatureV\n }\n\n function _throwError(RecoverError error) private pure {\n if (error == RecoverError.NoError) {\n return; // no error: do nothing\n } else if (error == RecoverError.InvalidSignature) {\n revert(\"ECDSA: invalid signature\");\n } else if (error == RecoverError.InvalidSignatureLength) {\n revert(\"ECDSA: invalid signature length\");\n } else if (error == RecoverError.InvalidSignatureS) {\n revert(\"ECDSA: invalid signature 's' value\");\n } else if (error == RecoverError.InvalidSignatureV) {\n revert(\"ECDSA: invalid signature 'v' value\");\n }\n }\n\n /**\n * @dev Returns the address that signed a hashed message (`hash`) with\n * `signature` or error string. This address can then be used for verification purposes.\n *\n * The `ecrecover` EVM opcode allows for malleable (non-unique) signatures:\n * this function rejects them by requiring the `s` value to be in the lower\n * half order, and the `v` value to be either 27 or 28.\n *\n * IMPORTANT: `hash` _must_ be the result of a hash operation for the\n * verification to be secure: it is possible to craft signatures that\n * recover to arbitrary addresses for non-hashed data. A safe way to ensure\n * this is by receiving a hash of the original message (which may otherwise\n * be too long), and then calling {toEthSignedMessageHash} on it.\n *\n * Documentation for signature generation:\n * - with https://web3js.readthedocs.io/en/v1.3.4/web3-eth-accounts.html#sign[Web3.js]\n * - with https://docs.ethers.io/v5/api/signer/#Signer-signMessage[ethers]\n *\n * _Available since v4.3._\n */\n function tryRecover(bytes32 hash, bytes memory signature) internal pure returns (address, RecoverError) {\n // Check the signature length\n // - case 65: r,s,v signature (standard)\n // - case 64: r,vs signature (cf https://eips.ethereum.org/EIPS/eip-2098) _Available since v4.1._\n if (signature.length == 65) {\n bytes32 r;\n bytes32 s;\n uint8 v;\n // ecrecover takes the signature parameters, and the only way to get them\n // currently is to use assembly.\n assembly {\n r := mload(add(signature, 0x20))\n s := mload(add(signature, 0x40))\n v := byte(0, mload(add(signature, 0x60)))\n }\n return tryRecover(hash, v, r, s);\n } else if (signature.length == 64) {\n bytes32 r;\n bytes32 vs;\n // ecrecover takes the signature parameters, and the only way to get them\n // currently is to use assembly.\n assembly {\n r := mload(add(signature, 0x20))\n vs := mload(add(signature, 0x40))\n }\n return tryRecover(hash, r, vs);\n } else {\n return (address(0), RecoverError.InvalidSignatureLength);\n }\n }\n\n /**\n * @dev Returns the address that signed a hashed message (`hash`) with\n * `signature`. This address can then be used for verification purposes.\n *\n * The `ecrecover` EVM opcode allows for malleable (non-unique) signatures:\n * this function rejects them by requiring the `s` value to be in the lower\n * half order, and the `v` value to be either 27 or 28.\n *\n * IMPORTANT: `hash` _must_ be the result of a hash operation for the\n * verification to be secure: it is possible to craft signatures that\n * recover to arbitrary addresses for non-hashed data. A safe way to ensure\n * this is by receiving a hash of the original message (which may otherwise\n * be too long), and then calling {toEthSignedMessageHash} on it.\n */\n function recover(bytes32 hash, bytes memory signature) internal pure returns (address) {\n (address recovered, RecoverError error) = tryRecover(hash, signature);\n _throwError(error);\n return recovered;\n }\n\n /**\n * @dev Overload of {ECDSA-tryRecover} that receives the `r` and `vs` short-signature fields separately.\n *\n * See https://eips.ethereum.org/EIPS/eip-2098[EIP-2098 short signatures]\n *\n * _Available since v4.3._\n */\n function tryRecover(\n bytes32 hash,\n bytes32 r,\n bytes32 vs\n ) internal pure returns (address, RecoverError) {\n bytes32 s = vs & bytes32(0x7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff);\n uint8 v = uint8((uint256(vs) >> 255) + 27);\n return tryRecover(hash, v, r, s);\n }\n\n /**\n * @dev Overload of {ECDSA-recover} that receives the `r and `vs` short-signature fields separately.\n *\n * _Available since v4.2._\n */\n function recover(\n bytes32 hash,\n bytes32 r,\n bytes32 vs\n ) internal pure returns (address) {\n (address recovered, RecoverError error) = tryRecover(hash, r, vs);\n _throwError(error);\n return recovered;\n }\n\n /**\n * @dev Overload of {ECDSA-tryRecover} that receives the `v`,\n * `r` and `s` signature fields separately.\n *\n * _Available since v4.3._\n */\n function tryRecover(\n bytes32 hash,\n uint8 v,\n bytes32 r,\n bytes32 s\n ) internal pure returns (address, RecoverError) {\n // EIP-2 still allows signature malleability for ecrecover(). Remove this possibility and make the signature\n // unique. Appendix F in the Ethereum Yellow paper (https://ethereum.github.io/yellowpaper/paper.pdf), defines\n // the valid range for s in (301): 0 < s < secp256k1n ÷ 2 + 1, and for v in (302): v ∈ {27, 28}. Most\n // signatures from current libraries generate a unique signature with an s-value in the lower half order.\n //\n // If your library generates malleable signatures, such as s-values in the upper range, calculate a new s-value\n // with 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFEBAAEDCE6AF48A03BBFD25E8CD0364141 - s1 and flip v from 27 to 28 or\n // vice versa. If your library also generates signatures with 0/1 for v instead 27/28, add 27 to v to accept\n // these malleable signatures as well.\n if (uint256(s) > 0x7FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF5D576E7357A4501DDFE92F46681B20A0) {\n return (address(0), RecoverError.InvalidSignatureS);\n }\n if (v != 27 && v != 28) {\n return (address(0), RecoverError.InvalidSignatureV);\n }\n\n // If the signature is valid (and not malleable), return the signer address\n address signer = ecrecover(hash, v, r, s);\n if (signer == address(0)) {\n return (address(0), RecoverError.InvalidSignature);\n }\n\n return (signer, RecoverError.NoError);\n }\n\n /**\n * @dev Overload of {ECDSA-recover} that receives the `v`,\n * `r` and `s` signature fields separately.\n */\n function recover(\n bytes32 hash,\n uint8 v,\n bytes32 r,\n bytes32 s\n ) internal pure returns (address) {\n (address recovered, RecoverError error) = tryRecover(hash, v, r, s);\n _throwError(error);\n return recovered;\n }\n\n /**\n * @dev Returns an Ethereum Signed Message, created from a `hash`. This\n * produces hash corresponding to the one signed with the\n * https://eth.wiki/json-rpc/API#eth_sign[`eth_sign`]\n * JSON-RPC method as part of EIP-191.\n *\n * See {recover}.\n */\n function toEthSignedMessageHash(bytes32 hash) internal pure returns (bytes32) {\n // 32 is the length in bytes of hash,\n // enforced by the type signature above\n return keccak256(abi.encodePacked(\"\\x19Ethereum Signed Message:\\n32\", hash));\n }\n\n /**\n * @dev Returns an Ethereum Signed Message, created from `s`. This\n * produces hash corresponding to the one signed with the\n * https://eth.wiki/json-rpc/API#eth_sign[`eth_sign`]\n * JSON-RPC method as part of EIP-191.\n *\n * See {recover}.\n */\n function toEthSignedMessageHash(bytes memory s) internal pure returns (bytes32) {\n return keccak256(abi.encodePacked(\"\\x19Ethereum Signed Message:\\n\", Strings.toString(s.length), s));\n }\n\n /**\n * @dev Returns an Ethereum Signed Typed Data, created from a\n * `domainSeparator` and a `structHash`. This produces hash corresponding\n * to the one signed with the\n * https://eips.ethereum.org/EIPS/eip-712[`eth_signTypedData`]\n * JSON-RPC method as part of EIP-712.\n *\n * See {recover}.\n */\n function toTypedDataHash(bytes32 domainSeparator, bytes32 structHash) internal pure returns (bytes32) {\n return keccak256(abi.encodePacked(\"\\x19\\x01\", domainSeparator, structHash));\n }\n}\n" }, @@ -37,20 +37,14 @@ "@uma/core/contracts/common/implementation/MultiCaller.sol": { "content": "// This contract is taken from Uniswaps'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.\npragma solidity ^0.8.0;\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 payable returns (bytes[] memory results) {\n require(msg.value == 0, \"Only multicall with 0 value\");\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/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 * @dev The reason why we use this local contract instead of importing from uma/contracts is because of the addition\n * of the internal method `functionCallStackOriginatesFromOutsideThisContract` which doesn't exist in the one exported\n * by uma/contracts.\n */\ncontract Lockable {\n bool internal _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 /**\n * @dev Returns true if the contract is currently in a non-entered state, meaning that the origination of the call\n * came from outside the contract. This is relevant with fallback/receive methods to see if the call came from ETH\n * being dropped onto the contract externally or due to ETH dropped on the the contract from within a method in this\n * contract, such as unwrapping WETH to ETH within the contract.\n */\n function functionCallStackOriginatesFromOutsideThisContract() internal view returns (bool) {\n return _notEntered;\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" + "contracts/HubPoolInterface.sol": { + "content": "// SPDX-License-Identifier: GPL-3.0-only\npragma solidity ^0.8.0;\n\nimport \"./interfaces/AdapterInterface.sol\";\n\nimport \"@openzeppelin/contracts/token/ERC20/IERC20.sol\";\n\n/**\n * @notice Concise list of functions in HubPool implementation.\n */\ninterface HubPoolInterface {\n // This leaf is meant to be decoded in the HubPool to rebalance tokens between HubPool and SpokePool.\n struct PoolRebalanceLeaf {\n // This is used to know which chain to send cross-chain transactions to (and which SpokePool to send to).\n uint256 chainId;\n // Total LP fee amount per token in this bundle, encompassing all associated bundled relays.\n uint256[] bundleLpFees;\n // This array is grouped with the two above, and it represents the amount to send or request back from the\n // SpokePool. If positive, the pool will pay the SpokePool. If negative the SpokePool will pay the HubPool.\n // There can be arbitrarily complex rebalancing rules defined offchain. This number is only nonzero when the\n // rules indicate that a rebalancing action should occur. When a rebalance does occur, runningBalances should be\n // set to zero for this token and the netSendAmounts should be set to the previous runningBalances + relays -\n // deposits in this bundle. If non-zero then it must be set on the SpokePool's RelayerRefundLeaf amountToReturn\n // as -1 * this value to indicate if funds are being sent from or to the SpokePool.\n int256[] netSendAmounts;\n // This is only here to be emitted in an event to track a running unpaid balance between the L2 pool and the L1\n // pool. A positive number indicates that the HubPool owes the SpokePool funds. A negative number indicates that\n // the SpokePool owes the HubPool funds. See the comment above for the dynamics of this and netSendAmounts.\n int256[] runningBalances;\n // Used by data worker to mark which leaves should relay roots to SpokePools, and to otherwise organize leaves.\n // For example, each leaf should contain all the rebalance information for a single chain, but in the case where\n // the list of l1Tokens is very large such that they all can't fit into a single leaf that can be executed under\n // the block gas limit, then the data worker can use this groupIndex to organize them. Any leaves with\n // a groupIndex equal to 0 will relay roots to the SpokePool, so the data worker should ensure that only one\n // leaf for a specific chainId should have a groupIndex equal to 0.\n uint256 groupIndex;\n // Used as the index in the bitmap to track whether this leaf has been executed or not.\n uint8 leafId;\n // The following arrays are required to be the same length. They are parallel arrays for the given chainId and\n // should be ordered by the l1Tokens field. All whitelisted tokens with nonzero relays on this chain in this\n // bundle in the order of whitelisting.\n address[] l1Tokens;\n }\n\n // A data worker can optimistically store several merkle roots on this contract by staking a bond and calling\n // proposeRootBundle. By staking a bond, the data worker is alleging that the merkle roots all contain valid leaves\n // that can be executed later to:\n // - Send funds from this contract to a SpokePool or vice versa\n // - Send funds from a SpokePool to Relayer as a refund for a relayed deposit\n // - Send funds from a SpokePool to a deposit recipient to fulfill a \"slow\" relay\n // Anyone can dispute this struct if the merkle roots contain invalid leaves before the\n // requestExpirationTimestamp. Once the expiration timestamp is passed, executeRootBundle to execute a leaf\n // from the poolRebalanceRoot on this contract and it will simultaneously publish the relayerRefundRoot and\n // slowRelayRoot to a SpokePool. The latter two roots, once published to the SpokePool, contain\n // leaves that can be executed on the SpokePool to pay relayers or recipients.\n struct RootBundle {\n // Contains leaves instructing this contract to send funds to SpokePools.\n bytes32 poolRebalanceRoot;\n // Relayer refund merkle root to be published to a SpokePool.\n bytes32 relayerRefundRoot;\n // Slow relay merkle root to be published to a SpokePool.\n bytes32 slowRelayRoot;\n // This is a 1D bitmap, with max size of 256 elements, limiting us to 256 chainsIds.\n uint256 claimedBitMap;\n // Proposer of this root bundle.\n address proposer;\n // Number of pool rebalance leaves to execute in the poolRebalanceRoot. After this number\n // of leaves are executed, a new root bundle can be proposed\n uint8 unclaimedPoolRebalanceLeafCount;\n // When root bundle challenge period passes and this root bundle becomes executable.\n uint32 requestExpirationTimestamp;\n }\n\n // Each whitelisted L1 token has an associated pooledToken struct that contains all information used to track the\n // cumulative LP positions and if this token is enabled for deposits.\n struct PooledToken {\n // LP token given to LPs of a specific L1 token.\n address lpToken;\n // True if accepting new LP's.\n bool isEnabled;\n // Timestamp of last LP fee update.\n uint32 lastLpFeeUpdate;\n // Number of LP funds sent via pool rebalances to SpokePools and are expected to be sent\n // back later.\n int256 utilizedReserves;\n // Number of LP funds held in contract less utilized reserves.\n uint256 liquidReserves;\n // Number of LP funds reserved to pay out to LPs as fees.\n uint256 undistributedLpFees;\n }\n\n // Helper contracts to facilitate cross chain actions between HubPool and SpokePool for a specific network.\n struct CrossChainContract {\n address adapter;\n address spokePool;\n }\n\n function setPaused(bool pause) external;\n\n function emergencyDeleteProposal() external;\n\n function relaySpokePoolAdminFunction(uint256 chainId, bytes memory functionData) external;\n\n function setProtocolFeeCapture(address newProtocolFeeCaptureAddress, uint256 newProtocolFeeCapturePct) external;\n\n function setBond(IERC20 newBondToken, uint256 newBondAmount) external;\n\n function setLiveness(uint32 newLiveness) external;\n\n function setIdentifier(bytes32 newIdentifier) external;\n\n function setCrossChainContracts(\n uint256 l2ChainId,\n address adapter,\n address spokePool\n ) external;\n\n function enableL1TokenForLiquidityProvision(address l1Token) external;\n\n function disableL1TokenForLiquidityProvision(address l1Token) external;\n\n function addLiquidity(address l1Token, uint256 l1TokenAmount) external payable;\n\n function removeLiquidity(\n address l1Token,\n uint256 lpTokenAmount,\n bool sendEth\n ) external;\n\n function exchangeRateCurrent(address l1Token) external returns (uint256);\n\n function liquidityUtilizationCurrent(address l1Token) external returns (uint256);\n\n function liquidityUtilizationPostRelay(address token, uint256 relayedAmount) external returns (uint256);\n\n function sync(address l1Token) external;\n\n function proposeRootBundle(\n uint256[] memory bundleEvaluationBlockNumbers,\n uint8 poolRebalanceLeafCount,\n bytes32 poolRebalanceRoot,\n bytes32 relayerRefundRoot,\n bytes32 slowRelayRoot\n ) external;\n\n function executeRootBundle(\n uint256 chainId,\n uint256 groupIndex,\n uint256[] memory bundleLpFees,\n int256[] memory netSendAmounts,\n int256[] memory runningBalances,\n uint8 leafId,\n address[] memory l1Tokens,\n bytes32[] memory proof\n ) external;\n\n function disputeRootBundle() external;\n\n function claimProtocolFeesCaptured(address l1Token) external;\n\n function setPoolRebalanceRoute(\n uint256 destinationChainId,\n address l1Token,\n address destinationToken\n ) external;\n\n function setDepositRoute(\n uint256 originChainId,\n uint256 destinationChainId,\n address originToken,\n bool depositsEnabled\n ) external;\n\n function poolRebalanceRoute(uint256 destinationChainId, address l1Token)\n external\n view\n returns (address destinationToken);\n\n function loadEthForL2Calls() external payable;\n}\n" }, "@openzeppelin/contracts/utils/cryptography/MerkleProof.sol": { "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.5.0) (utils/cryptography/MerkleProof.sol)\n\npragma solidity ^0.8.0;\n\n/**\n * @dev These functions deal with verification of Merkle Trees proofs.\n *\n * The proofs can be generated using the JavaScript library\n * https://github.com/miguelmota/merkletreejs[merkletreejs].\n * Note: the hashing algorithm should be keccak256 and pair sorting should be enabled.\n *\n * See `test/utils/cryptography/MerkleProof.test.js` for some examples.\n */\nlibrary MerkleProof {\n /**\n * @dev Returns true if a `leaf` can be proved to be a part of a Merkle tree\n * defined by `root`. For this, a `proof` must be provided, containing\n * sibling hashes on the branch from the leaf to the root of the tree. Each\n * pair of leaves and each pair of pre-images are assumed to be sorted.\n */\n function verify(\n bytes32[] memory proof,\n bytes32 root,\n bytes32 leaf\n ) internal pure returns (bool) {\n return processProof(proof, leaf) == root;\n }\n\n /**\n * @dev Returns the rebuilt hash obtained by traversing a Merklee tree up\n * from `leaf` using `proof`. A `proof` is valid if and only if the rebuilt\n * hash matches the root of the tree. When processing the proof, the pairs\n * of leafs & pre-images are assumed to be sorted.\n *\n * _Available since v4.4._\n */\n function processProof(bytes32[] memory proof, bytes32 leaf) internal pure returns (bytes32) {\n bytes32 computedHash = leaf;\n for (uint256 i = 0; i < proof.length; i++) {\n bytes32 proofElement = proof[i];\n if (computedHash <= proofElement) {\n // Hash(current computed hash + current element of the proof)\n computedHash = _efficientHash(computedHash, proofElement);\n } else {\n // Hash(current element of the proof + current computed hash)\n computedHash = _efficientHash(proofElement, computedHash);\n }\n }\n return computedHash;\n }\n\n function _efficientHash(bytes32 a, bytes32 b) private pure returns (bytes32 value) {\n assembly {\n mstore(0x00, a)\n mstore(0x20, b)\n value := keccak256(0x00, 0x40)\n }\n }\n}\n" }, - "contracts/HubPoolInterface.sol": { - "content": "// SPDX-License-Identifier: GPL-3.0-only\npragma solidity ^0.8.0;\n\nimport \"@openzeppelin/contracts/token/ERC20/IERC20.sol\";\nimport \"./interfaces/AdapterInterface.sol\";\n\n/**\n * @notice Concise list of functions in HubPool implementation.\n */\ninterface HubPoolInterface {\n // This leaf is meant to be decoded in the HubPool to rebalance tokens between HubPool and SpokePool.\n struct PoolRebalanceLeaf {\n // This is used to know which chain to send cross-chain transactions to (and which SpokePool to sent to).\n uint256 chainId;\n // Total LP fee amount per token in this bundle, encompassing all associated bundled relays.\n uint256[] bundleLpFees;\n // This array is grouped with the two above, and it represents the amount to send or request back from the\n // SpokePool. If positive, the pool will pay the SpokePool. If negative the SpokePool will pay the HubPool.\n // There can be arbitrarily complex rebalancing rules defined offchain. This number is only nonzero\n // when the rules indicate that a rebalancing action should occur. When a rebalance does not occur,\n // runningBalances for this token should change by the total relays - deposits in this bundle. When a rebalance\n // does occur, runningBalances should be set to zero for this token and the netSendAmounts should be set to the\n // previous runningBalances + relays - deposits in this bundle.\n int256[] netSendAmounts;\n // This is only here to be emitted in an event to track a running unpaid balance between the L2 pool and the L1 pool.\n // A positive number indicates that the HubPool owes the SpokePool funds. A negative number indicates that the\n // SpokePool owes the HubPool funds. See the comment above for the dynamics of this and netSendAmounts\n int256[] runningBalances;\n // Used as the index in the bitmap to track whether this leaf has been executed or not.\n uint8 leafId;\n // The following arrays are required to be the same length. They are parallel arrays for the given chainId and\n // should be ordered by the l1Tokens field. All whitelisted tokens with nonzero relays on this chain in this\n // bundle in the order of whitelisting.\n address[] l1Tokens;\n }\n\n function relaySpokePoolAdminFunction(uint256 chainId, bytes memory functionData) external;\n\n function setProtocolFeeCapture(address newProtocolFeeCaptureAddress, uint256 newProtocolFeeCapturePct) external;\n\n function setBond(IERC20 newBondToken, uint256 newBondAmount) external;\n\n function setLiveness(uint32 newLiveness) external;\n\n function setIdentifier(bytes32 newIdentifier) external;\n\n function setCrossChainContracts(\n uint256 l2ChainId,\n address adapter,\n address spokePool\n ) external;\n\n function whitelistRoute(\n uint256 originChainId,\n uint256 destinationChainId,\n address originToken,\n address destinationToken,\n bool enableRoute\n ) external;\n\n function enableL1TokenForLiquidityProvision(address l1Token) external;\n\n function disableL1TokenForLiquidityProvision(address l1Token) external;\n\n function addLiquidity(address l1Token, uint256 l1TokenAmount) external payable;\n\n function removeLiquidity(\n address l1Token,\n uint256 lpTokenAmount,\n bool sendEth\n ) external;\n\n function exchangeRateCurrent(address l1Token) external returns (uint256);\n\n function liquidityUtilizationCurrent(address l1Token) external returns (uint256);\n\n function liquidityUtilizationPostRelay(address token, uint256 relayedAmount) external returns (uint256);\n\n function sync(address l1Token) external;\n\n function proposeRootBundle(\n uint256[] memory bundleEvaluationBlockNumbers,\n uint8 poolRebalanceLeafCount,\n bytes32 poolRebalanceRoot,\n bytes32 relayerRefundRoot,\n bytes32 slowRelayRoot\n ) external;\n\n function executeRootBundle(PoolRebalanceLeaf memory poolRebalanceLeaf, bytes32[] memory proof) external;\n\n function disputeRootBundle() external;\n\n function claimProtocolFeesCaptured(address l1Token) external;\n\n function getRootBundleProposalAncillaryData() external view returns (bytes memory ancillaryData);\n\n function whitelistedRoute(\n uint256 originChainId,\n address originToken,\n uint256 destinationChainId\n ) external view returns (address);\n\n function loadEthForL2Calls() external payable;\n}\n" - }, "contracts/interfaces/AdapterInterface.sol": { - "content": "// SPDX-License-Identifier: AGPL-3.0-only\npragma solidity ^0.8.0;\n\n/**\n * @notice Sends cross chain messages and tokens to contracts on a specific L2 network.\n */\n\ninterface AdapterInterface {\n event HubPoolChanged(address newHubPool);\n\n event MessageRelayed(address target, bytes message);\n\n event TokensRelayed(address l1Token, address l2Token, uint256 amount, address to);\n\n function relayMessage(address target, bytes memory message) external payable;\n\n function relayTokens(\n address l1Token,\n address l2Token,\n uint256 amount,\n address to\n ) external payable;\n}\n" - }, - "@openzeppelin/contracts/interfaces/IERC1271.sol": { - "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts v4.4.1 (interfaces/IERC1271.sol)\n\npragma solidity ^0.8.0;\n\n/**\n * @dev Interface of the ERC1271 standard signature validation method for\n * contracts as defined in https://eips.ethereum.org/EIPS/eip-1271[ERC-1271].\n *\n * _Available since v4.1._\n */\ninterface IERC1271 {\n /**\n * @dev Should return whether the signature provided is valid for the provided data\n * @param hash Hash of the data to be signed\n * @param signature Signature byte array associated with _data\n */\n function isValidSignature(bytes32 hash, bytes memory signature) external view returns (bytes4 magicValue);\n}\n" + "content": "// SPDX-License-Identifier: AGPL-3.0-only\npragma solidity ^0.8.0;\n\n/**\n * @notice Sends cross chain messages and tokens to contracts on a specific L2 network.\n */\n\ninterface AdapterInterface {\n event MessageRelayed(address target, bytes message);\n\n event TokensRelayed(address l1Token, address l2Token, uint256 amount, address to);\n\n function relayMessage(address target, bytes memory message) external payable;\n\n function relayTokens(\n address l1Token,\n address l2Token,\n uint256 amount,\n address to\n ) external payable;\n}\n" }, "@openzeppelin/contracts/utils/Strings.sol": { "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts v4.4.1 (utils/Strings.sol)\n\npragma solidity ^0.8.0;\n\n/**\n * @dev String operations.\n */\nlibrary Strings {\n bytes16 private constant _HEX_SYMBOLS = \"0123456789abcdef\";\n\n /**\n * @dev Converts a `uint256` to its ASCII `string` decimal representation.\n */\n function toString(uint256 value) internal pure returns (string memory) {\n // Inspired by OraclizeAPI's implementation - MIT licence\n // https://github.com/oraclize/ethereum-api/blob/b42146b063c7d6ee1358846c198246239e9360e8/oraclizeAPI_0.4.25.sol\n\n if (value == 0) {\n return \"0\";\n }\n uint256 temp = value;\n uint256 digits;\n while (temp != 0) {\n digits++;\n temp /= 10;\n }\n bytes memory buffer = new bytes(digits);\n while (value != 0) {\n digits -= 1;\n buffer[digits] = bytes1(uint8(48 + uint256(value % 10)));\n value /= 10;\n }\n return string(buffer);\n }\n\n /**\n * @dev Converts a `uint256` to its ASCII `string` hexadecimal representation.\n */\n function toHexString(uint256 value) internal pure returns (string memory) {\n if (value == 0) {\n return \"0x00\";\n }\n uint256 temp = value;\n uint256 length = 0;\n while (temp != 0) {\n length++;\n temp >>= 8;\n }\n return toHexString(value, length);\n }\n\n /**\n * @dev Converts a `uint256` to its ASCII `string` hexadecimal representation with fixed length.\n */\n function toHexString(uint256 value, uint256 length) internal pure returns (string memory) {\n bytes memory buffer = new bytes(2 * length + 2);\n buffer[0] = \"0\";\n buffer[1] = \"x\";\n for (uint256 i = 2 * length + 1; i > 1; --i) {\n buffer[i] = _HEX_SYMBOLS[value & 0xf];\n value >>= 4;\n }\n require(value == 0, \"Strings: hex length insufficient\");\n return string(buffer);\n }\n}\n" @@ -59,13 +53,13 @@ "content": "// SPDX-License-Identifier: AGPL-3.0-only\npragma solidity ^0.8.0;\n\n/**\n * @title Universal store of current contract time for testing environments.\n */\ncontract Timer {\n uint256 private currentTime;\n\n constructor() {\n currentTime = block.timestamp; // solhint-disable-line not-rely-on-time\n }\n\n /**\n * @notice Sets the current time.\n * @dev Will revert if not running in test mode.\n * @param time timestamp to set `currentTime` to.\n */\n function setCurrentTime(uint256 time) external {\n currentTime = time;\n }\n\n /**\n * @notice Gets the currentTime variable set in the Timer.\n * @return uint256 for the current Testable timestamp.\n */\n function getCurrentTime() public view returns (uint256) {\n return currentTime;\n }\n}\n" }, "contracts/test/MockSpokePool.sol": { - "content": "//SPDX-License-Identifier: Unlicense\npragma solidity ^0.8.0;\n\nimport \"../SpokePool.sol\";\nimport \"../SpokePoolInterface.sol\";\n\n/**\n * @title MockSpokePool\n * @notice Implements abstract contract for testing.\n */\ncontract MockSpokePool is SpokePoolInterface, SpokePool {\n constructor(\n address _crossDomainAdmin,\n address _hubPool,\n address _wethAddress,\n address timerAddress\n ) SpokePool(_crossDomainAdmin, _hubPool, _wethAddress, timerAddress) {}\n\n function _bridgeTokensToHubPool(RelayerRefundLeaf memory relayerRefundLeaf) internal override {}\n\n function _requireAdminSender() internal override {}\n}\n" + "content": "//SPDX-License-Identifier: Unlicense\npragma solidity ^0.8.0;\n\nimport \"../SpokePool.sol\";\nimport \"../SpokePoolInterface.sol\";\n\n/**\n * @title MockSpokePool\n * @notice Implements abstract contract for testing.\n */\ncontract MockSpokePool is SpokePool {\n uint256 chainId_;\n\n constructor(\n address _crossDomainAdmin,\n address _hubPool,\n address _wethAddress,\n address timerAddress\n ) SpokePool(_crossDomainAdmin, _hubPool, _wethAddress, timerAddress) {}\n\n function _bridgeTokensToHubPool(RelayerRefundLeaf memory relayerRefundLeaf) internal override {}\n\n function _requireAdminSender() internal override {}\n\n function chainId() public view override(SpokePool) returns (uint256) {\n // If chainId_ is set then return it, else do nothing and return the parent chainId().\n return chainId_ == 0 ? super.chainId() : chainId_;\n }\n\n function setChainId(uint256 _chainId) public {\n chainId_ = _chainId;\n }\n}\n" }, - "contracts/Polygon_SpokePool.sol": { - "content": "// SPDX-License-Identifier: GPL-3.0-only\npragma solidity ^0.8.0;\n\nimport \"./interfaces/WETH9.sol\";\nimport \"@openzeppelin/contracts/token/ERC20/IERC20.sol\";\nimport \"@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol\";\nimport \"./SpokePool.sol\";\nimport \"./SpokePoolInterface.sol\";\nimport \"./PolygonTokenBridger.sol\";\n\n// IFxMessageProcessor represents interface to process messages.\ninterface IFxMessageProcessor {\n function processMessageFromRoot(\n uint256 stateId,\n address rootMessageSender,\n bytes calldata data\n ) external;\n}\n\n/**\n * @notice Polygon specific SpokePool.\n */\ncontract Polygon_SpokePool is IFxMessageProcessor, SpokePool {\n using SafeERC20 for PolygonIERC20;\n\n // Address of FxChild which sends and receives messages to and from L1.\n address public fxChild;\n\n // Contract deployed on L1 and L2 processes all cross-chain transfers between this contract and the the HubPool.\n // Required because bridging tokens from Polygon to Ethereum has special constraints.\n PolygonTokenBridger public polygonTokenBridger;\n\n // Internal variable that only flips temporarily to true upon receiving messages from L1. Used to authenticate that\n // the caller is the fxChild AND that the fxChild called processMessageFromRoot\n bool private callValidated = false;\n\n event PolygonTokensBridged(address indexed token, address indexed receiver, uint256 amount);\n event SetFxChild(address indexed newFxChild);\n event SetPolygonTokenBridger(address indexed polygonTokenBridger);\n\n // Note: validating calls this way ensures that strange calls coming from the fxChild won't be misinterpreted.\n // Put differently, just checking that msg.sender == fxChild is not sufficient.\n // All calls that have admin priviledges must be fired from within the processMessageFromRoot method that's gone\n // through validation where the sender is checked and the root (mainnet) sender is also validated.\n // This modifier sets the callValidated variable so this condition can be checked in _requireAdminSender().\n modifier validateInternalCalls() {\n // This sets a variable indicating that we're now inside a validated call.\n // Note: this is used by other methods to ensure that this call has been validated by this method and is not\n // spoofed. See\n callValidated = true;\n\n _;\n\n // Reset callValidated to false to disallow admin calls after this method exits.\n callValidated = false;\n }\n\n /**\n * @notice Construct the Polygon SpokePool.\n * @param _polygonTokenBridger Token routing contract that sends tokens from here to HubPool. Changeable by Admin.\n * @param _crossDomainAdmin Cross domain admin to set. Can be changed by admin.\n * @param _hubPool Hub pool address to set. Can be changed by admin.\n * @param _wmaticAddress Replaces _wethAddress for this network since MATIC is the gas token and sent via msg.value\n * on Polygon.\n * @param _fxChild FxChild contract, changeable by Admin.\n * @param timerAddress Timer address to set.\n */\n constructor(\n PolygonTokenBridger _polygonTokenBridger,\n address _crossDomainAdmin,\n address _hubPool,\n address _wmaticAddress, // Note: wmatic is used here since it is the token sent via msg.value on polygon.\n address _fxChild,\n address timerAddress\n ) SpokePool(_crossDomainAdmin, _hubPool, _wmaticAddress, timerAddress) {\n polygonTokenBridger = _polygonTokenBridger;\n fxChild = _fxChild;\n }\n\n /********************************************************\n * ARBITRUM-SPECIFIC CROSS-CHAIN ADMIN FUNCTIONS *\n ********************************************************/\n\n /**\n * @notice Change FxChild address. Callable only by admin via processMessageFromRoot.\n * @param newFxChild New FxChild.\n */\n function setFxChild(address newFxChild) public onlyAdmin {\n fxChild = newFxChild;\n emit SetFxChild(fxChild);\n }\n\n /**\n * @notice Change polygonTokenBridger address. Callable only by admin via processMessageFromRoot.\n * @param newPolygonTokenBridger New Polygon Token Bridger contract.\n */\n function setPolygonTokenBridger(address payable newPolygonTokenBridger) public onlyAdmin {\n polygonTokenBridger = PolygonTokenBridger(newPolygonTokenBridger);\n emit SetPolygonTokenBridger(address(polygonTokenBridger));\n }\n\n /**\n * @notice Called by FxChild upon receiving L1 message that targets this contract. Performs an additional check\n * that the L1 caller was the expected cross domain admin, and then delegate calls.\n * @notice Polygon bridge only executes this external function on the target Polygon contract when relaying\n * messages from L1, so all functions on this SpokePool are expected to originate via this call.\n * @dev stateId value isn't used because it isn't relevant for this method. It doesn't care what state sync\n * triggered this call.\n * @param rootMessageSender Original L1 sender of data.\n * @param data ABI encoded function call to execute on this contract.\n */\n function processMessageFromRoot(\n uint256, /*stateId*/\n address rootMessageSender,\n bytes calldata data\n ) public validateInternalCalls nonReentrant {\n // Validation logic.\n require(msg.sender == fxChild, \"Not from fxChild\");\n require(rootMessageSender == crossDomainAdmin, \"Not from mainnet admin\");\n\n // This uses delegatecall to take the information in the message and process it as a function call on this contract.\n (bool success, ) = address(this).delegatecall(data);\n require(success, \"delegatecall failed\");\n }\n\n /**************************************\n * INTERNAL FUNCTIONS *\n **************************************/\n\n function _bridgeTokensToHubPool(RelayerRefundLeaf memory relayerRefundLeaf) internal override {\n PolygonIERC20(relayerRefundLeaf.l2TokenAddress).safeIncreaseAllowance(\n address(polygonTokenBridger),\n relayerRefundLeaf.amountToReturn\n );\n\n // Note: WETH is WMATIC on matic, so this tells the tokenbridger that this is an unwrappable native token.\n polygonTokenBridger.send(\n PolygonIERC20(relayerRefundLeaf.l2TokenAddress),\n relayerRefundLeaf.amountToReturn,\n address(weth) == relayerRefundLeaf.l2TokenAddress\n );\n\n emit PolygonTokensBridged(relayerRefundLeaf.l2TokenAddress, address(this), relayerRefundLeaf.amountToReturn);\n }\n\n function _requireAdminSender() internal view override {\n require(callValidated, \"Must call processMessageFromRoot\");\n }\n}\n" + "contracts/test/MerkleLibTest.sol": { + "content": "// SPDX-License-Identifier: GPL-3.0-only\npragma solidity ^0.8.0;\n\nimport \"../MerkleLib.sol\";\nimport \"../HubPoolInterface.sol\";\nimport \"../SpokePoolInterface.sol\";\n\n/**\n * @notice Contract to test the MerkleLib.\n */\ncontract MerkleLibTest {\n mapping(uint256 => uint256) public claimedBitMap;\n\n uint256 public claimedBitMap1D;\n\n function verifyPoolRebalance(\n bytes32 root,\n HubPoolInterface.PoolRebalanceLeaf memory rebalance,\n bytes32[] memory proof\n ) public pure returns (bool) {\n return MerkleLib.verifyPoolRebalance(root, rebalance, proof);\n }\n\n function verifyRelayerRefund(\n bytes32 root,\n SpokePoolInterface.RelayerRefundLeaf memory refund,\n bytes32[] memory proof\n ) public pure returns (bool) {\n return MerkleLib.verifyRelayerRefund(root, refund, proof);\n }\n\n function verifySlowRelayFulfillment(\n bytes32 root,\n SpokePoolInterface.RelayData memory slowRelayFulfillment,\n bytes32[] memory proof\n ) public pure returns (bool) {\n return MerkleLib.verifySlowRelayFulfillment(root, slowRelayFulfillment, proof);\n }\n\n function isClaimed(uint256 index) public view returns (bool) {\n return MerkleLib.isClaimed(claimedBitMap, index);\n }\n\n function setClaimed(uint256 index) public {\n MerkleLib.setClaimed(claimedBitMap, index);\n }\n\n function isClaimed1D(uint8 index) public view returns (bool) {\n return MerkleLib.isClaimed1D(claimedBitMap1D, index);\n }\n\n function setClaimed1D(uint8 index) public {\n claimedBitMap1D = MerkleLib.setClaimed1D(claimedBitMap1D, index);\n }\n}\n" }, "contracts/PolygonTokenBridger.sol": { - "content": "// SPDX-License-Identifier: AGPL-3.0-only\npragma solidity ^0.8.0;\n\nimport \"@openzeppelin/contracts/token/ERC20/IERC20.sol\";\nimport \"@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol\";\nimport \"./Lockable.sol\";\nimport \"./interfaces/WETH9.sol\";\n\n// ERC20s (on polygon) compatible with polygon's bridge have a withdraw method.\ninterface PolygonIERC20 is IERC20 {\n function withdraw(uint256 amount) external;\n}\n\ninterface MaticToken {\n function withdraw(uint256 amount) external payable;\n}\n\n/**\n * @notice Contract deployed on Ethereum and Polygon to facilitate token transfers from Polygon to the HubPool and back.\n * @dev Because Polygon only allows withdrawals from a particular address to go to that same address on mainnet, we need to\n * have some sort of contract that can guarantee identical addresses on Polygon and Ethereum. This contract is intended\n * to be completely immutable, so it's guaranteed that the contract on each side is configured identically as long as\n * it is created via create2. create2 is an alternative creation method that uses a different address determination\n * mechanism from normal create.\n * Normal create: address = hash(deployer_address, deployer_nonce)\n * create2: address = hash(0xFF, sender, salt, bytecode)\n * This ultimately allows create2 to generate deterministic addresses that don't depend on the transaction count of the\n * sender.\n */\ncontract PolygonTokenBridger is Lockable {\n using SafeERC20 for PolygonIERC20;\n using SafeERC20 for IERC20;\n\n // Gas token for Polygon.\n MaticToken public constant maticToken = MaticToken(0x0000000000000000000000000000000000001010);\n\n // Should be set to HubPool on Ethereum, or unused on Polygon.\n address public immutable destination;\n\n // WETH contract on Ethereum.\n WETH9 public immutable l1Weth;\n\n /**\n * @notice Constructs Token Bridger contract.\n * @param _destination Where to send tokens to for this network.\n * @param _l1Weth Ethereum WETH address.\n */\n constructor(address _destination, WETH9 _l1Weth) {\n destination = _destination;\n l1Weth = _l1Weth;\n }\n\n /**\n * @notice Called by Polygon SpokePool to send tokens over bridge to contract with the same address as this.\n * @param token Token to bridge.\n * @param amount Amount to bridge.\n * @param isMatic True if token is MATIC.\n */\n function send(\n PolygonIERC20 token,\n uint256 amount,\n bool isMatic\n ) public nonReentrant {\n token.safeTransferFrom(msg.sender, address(this), amount);\n\n // In the wMatic case, this unwraps. For other ERC20s, this is the burn/send action.\n token.withdraw(amount);\n\n // This takes the token that was withdrawn and calls withdraw on the \"native\" ERC20.\n if (isMatic) maticToken.withdraw{ value: amount }(amount);\n }\n\n /**\n * @notice Called by someone to send tokens to the destination, which should be set to the HubPool.\n * @param token Token to send to destination.\n */\n function retrieve(IERC20 token) public nonReentrant {\n token.safeTransfer(destination, token.balanceOf(address(this)));\n }\n\n receive() external payable {\n // Note: this should only happen on the mainnet side where ETH is sent to the contract directly by the bridge.\n if (functionCallStackOriginatesFromOutsideThisContract()) l1Weth.deposit{ value: address(this).balance }();\n }\n}\n" + "content": "// SPDX-License-Identifier: AGPL-3.0-only\npragma solidity ^0.8.0;\n\nimport \"./Lockable.sol\";\nimport \"./interfaces/WETH9.sol\";\n\nimport \"@openzeppelin/contracts/token/ERC20/IERC20.sol\";\nimport \"@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol\";\n\n// ERC20s (on polygon) compatible with polygon's bridge have a withdraw method.\ninterface PolygonIERC20 is IERC20 {\n function withdraw(uint256 amount) external;\n}\n\ninterface MaticToken {\n function withdraw(uint256 amount) external payable;\n}\n\n/**\n * @notice Contract deployed on Ethereum and Polygon to facilitate token transfers from Polygon to the HubPool and back.\n * @dev Because Polygon only allows withdrawals from a particular address to go to that same address on mainnet, we need to\n * have some sort of contract that can guarantee identical addresses on Polygon and Ethereum. This contract is intended\n * to be completely immutable, so it's guaranteed that the contract on each side is configured identically as long as\n * it is created via create2. create2 is an alternative creation method that uses a different address determination\n * mechanism from normal create.\n * Normal create: address = hash(deployer_address, deployer_nonce)\n * create2: address = hash(0xFF, sender, salt, bytecode)\n * This ultimately allows create2 to generate deterministic addresses that don't depend on the transaction count of the\n * sender.\n */\ncontract PolygonTokenBridger is Lockable {\n using SafeERC20 for PolygonIERC20;\n using SafeERC20 for IERC20;\n\n // Gas token for Polygon.\n MaticToken public constant maticToken = MaticToken(0x0000000000000000000000000000000000001010);\n\n // Should be set to HubPool on Ethereum, or unused on Polygon.\n address public immutable destination;\n\n // WETH contract on Ethereum.\n WETH9 public immutable l1Weth;\n\n /**\n * @notice Constructs Token Bridger contract.\n * @param _destination Where to send tokens to for this network.\n * @param _l1Weth Ethereum WETH address.\n */\n constructor(address _destination, WETH9 _l1Weth) {\n destination = _destination;\n l1Weth = _l1Weth;\n }\n\n /**\n * @notice Called by Polygon SpokePool to send tokens over bridge to contract with the same address as this.\n * @notice The caller of this function must approve this contract to spend amount of token.\n * @param token Token to bridge.\n * @param amount Amount to bridge.\n * @param isWrappedMatic True if token is WMATIC.\n */\n function send(\n PolygonIERC20 token,\n uint256 amount,\n bool isWrappedMatic\n ) public nonReentrant {\n token.safeTransferFrom(msg.sender, address(this), amount);\n\n // In the wMatic case, this unwraps. For other ERC20s, this is the burn/send action.\n token.withdraw(amount);\n\n // This takes the token that was withdrawn and calls withdraw on the \"native\" ERC20.\n if (isWrappedMatic) maticToken.withdraw{ value: amount }(amount);\n }\n\n /**\n * @notice Called by someone to send tokens to the destination, which should be set to the HubPool.\n * @param token Token to send to destination.\n */\n function retrieve(IERC20 token) public nonReentrant {\n token.safeTransfer(destination, token.balanceOf(address(this)));\n }\n\n receive() external payable {\n // Note: this should only happen on the mainnet side where ETH is sent to the contract directly by the bridge.\n if (functionCallStackOriginatesFromOutsideThisContract()) l1Weth.deposit{ value: address(this).balance }();\n }\n}\n" }, "contracts/test/PolygonERC20Test.sol": { "content": "// SPDX-License-Identifier: AGPL-3.0-only\npragma solidity ^0.8.0;\n\nimport \"@uma/core/contracts/common/implementation/ExpandedERC20.sol\";\nimport \"../PolygonTokenBridger.sol\";\n\n/**\n * @notice Simulated Polygon ERC20 for use in testing PolygonTokenBridger.\n */\ncontract PolygonERC20Test is ExpandedERC20, PolygonIERC20 {\n constructor() ExpandedERC20(\"Polygon Test\", \"POLY_TEST\", 18) {}\n\n function withdraw(uint256 amount) public {\n _burn(msg.sender, amount);\n }\n}\n" @@ -88,60 +82,60 @@ "@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" }, - "@openzeppelin/contracts/access/Ownable.sol": { - "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts v4.4.1 (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 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 called by any account other than the owner.\n */\n modifier onlyOwner() {\n require(owner() == _msgSender(), \"Ownable: caller is not the owner\");\n _;\n }\n\n /**\n * @dev Leaves the contract without owner. It will not be possible to call\n * `onlyOwner` functions anymore. Can only be called by the current owner.\n *\n * NOTE: Renouncing ownership will leave the contract without an owner,\n * thereby removing 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" + "contracts/Polygon_SpokePool.sol": { + "content": "// SPDX-License-Identifier: GPL-3.0-only\npragma solidity ^0.8.0;\n\nimport \"./SpokePool.sol\";\nimport \"./PolygonTokenBridger.sol\";\nimport \"./interfaces/WETH9.sol\";\nimport \"./SpokePoolInterface.sol\";\n\nimport \"@openzeppelin/contracts/token/ERC20/IERC20.sol\";\nimport \"@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol\";\n\n// IFxMessageProcessor represents interface to process messages.\ninterface IFxMessageProcessor {\n function processMessageFromRoot(\n uint256 stateId,\n address rootMessageSender,\n bytes calldata data\n ) external;\n}\n\n/**\n * @notice Polygon specific SpokePool.\n */\ncontract Polygon_SpokePool is IFxMessageProcessor, SpokePool {\n using SafeERC20 for PolygonIERC20;\n\n // Address of FxChild which sends and receives messages to and from L1.\n address public fxChild;\n\n // Contract deployed on L1 and L2 processes all cross-chain transfers between this contract and the the HubPool.\n // Required because bridging tokens from Polygon to Ethereum has special constraints.\n PolygonTokenBridger public polygonTokenBridger;\n\n // Internal variable that only flips temporarily to true upon receiving messages from L1. Used to authenticate that\n // the caller is the fxChild AND that the fxChild called processMessageFromRoot\n bool private callValidated = false;\n\n event PolygonTokensBridged(address indexed token, address indexed receiver, uint256 amount);\n event SetFxChild(address indexed newFxChild);\n event SetPolygonTokenBridger(address indexed polygonTokenBridger);\n\n // Note: validating calls this way ensures that strange calls coming from the fxChild won't be misinterpreted.\n // Put differently, just checking that msg.sender == fxChild is not sufficient.\n // All calls that have admin privileges must be fired from within the processMessageFromRoot method that's gone\n // through validation where the sender is checked and the root (mainnet) sender is also validated.\n // This modifier sets the callValidated variable so this condition can be checked in _requireAdminSender().\n modifier validateInternalCalls() {\n // Make sure callValidated is set to True only once at beginning of processMessageFromRoot, which prevents\n // processMessageFromRoot from being re-entered.\n require(!callValidated, \"callValidated already set\");\n\n // This sets a variable indicating that we're now inside a validated call.\n // Note: this is used by other methods to ensure that this call has been validated by this method and is not\n // spoofed. See\n callValidated = true;\n\n _;\n\n // Reset callValidated to false to disallow admin calls after this method exits.\n callValidated = false;\n }\n\n /**\n * @notice Construct the Polygon SpokePool.\n * @param _polygonTokenBridger Token routing contract that sends tokens from here to HubPool. Changeable by Admin.\n * @param _crossDomainAdmin Cross domain admin to set. Can be changed by admin.\n * @param _hubPool Hub pool address to set. Can be changed by admin.\n * @param _wmaticAddress Replaces _wethAddress for this network since MATIC is the gas token and sent via msg.value\n * on Polygon.\n * @param _fxChild FxChild contract, changeable by Admin.\n * @param timerAddress Timer address to set.\n */\n constructor(\n PolygonTokenBridger _polygonTokenBridger,\n address _crossDomainAdmin,\n address _hubPool,\n address _wmaticAddress, // Note: wmatic is used here since it is the token sent via msg.value on polygon.\n address _fxChild,\n address timerAddress\n ) SpokePool(_crossDomainAdmin, _hubPool, _wmaticAddress, timerAddress) {\n polygonTokenBridger = _polygonTokenBridger;\n fxChild = _fxChild;\n }\n\n /********************************************************\n * ARBITRUM-SPECIFIC CROSS-CHAIN ADMIN FUNCTIONS *\n ********************************************************/\n\n /**\n * @notice Change FxChild address. Callable only by admin via processMessageFromRoot.\n * @param newFxChild New FxChild.\n */\n function setFxChild(address newFxChild) public onlyAdmin nonReentrant {\n fxChild = newFxChild;\n emit SetFxChild(fxChild);\n }\n\n /**\n * @notice Change polygonTokenBridger address. Callable only by admin via processMessageFromRoot.\n * @param newPolygonTokenBridger New Polygon Token Bridger contract.\n */\n function setPolygonTokenBridger(address payable newPolygonTokenBridger) public onlyAdmin nonReentrant {\n polygonTokenBridger = PolygonTokenBridger(newPolygonTokenBridger);\n emit SetPolygonTokenBridger(address(polygonTokenBridger));\n }\n\n /**\n * @notice Called by FxChild upon receiving L1 message that targets this contract. Performs an additional check\n * that the L1 caller was the expected cross domain admin, and then delegate calls.\n * @notice Polygon bridge only executes this external function on the target Polygon contract when relaying\n * messages from L1, so all functions on this SpokePool are expected to originate via this call.\n * @dev stateId value isn't used because it isn't relevant for this method. It doesn't care what state sync\n * triggered this call.\n * @param rootMessageSender Original L1 sender of data.\n * @param data ABI encoded function call to execute on this contract.\n */\n function processMessageFromRoot(\n uint256, /*stateId*/\n address rootMessageSender,\n bytes calldata data\n ) public validateInternalCalls {\n // Validation logic.\n require(msg.sender == fxChild, \"Not from fxChild\");\n require(rootMessageSender == crossDomainAdmin, \"Not from mainnet admin\");\n\n // This uses delegatecall to take the information in the message and process it as a function call on this contract.\n (bool success, ) = address(this).delegatecall(data);\n require(success, \"delegatecall failed\");\n }\n\n /**************************************\n * INTERNAL FUNCTIONS *\n **************************************/\n\n function _bridgeTokensToHubPool(RelayerRefundLeaf memory relayerRefundLeaf) internal override {\n PolygonIERC20(relayerRefundLeaf.l2TokenAddress).safeIncreaseAllowance(\n address(polygonTokenBridger),\n relayerRefundLeaf.amountToReturn\n );\n\n // Note: WETH is WMATIC on matic, so this tells the tokenbridger that this is an unwrappable native token.\n polygonTokenBridger.send(\n PolygonIERC20(relayerRefundLeaf.l2TokenAddress),\n relayerRefundLeaf.amountToReturn,\n address(weth) == relayerRefundLeaf.l2TokenAddress\n );\n\n emit PolygonTokensBridged(relayerRefundLeaf.l2TokenAddress, address(this), relayerRefundLeaf.amountToReturn);\n }\n\n // @dev: This contract will trigger admin functions internally via the `processMessageFromRoot`, which is why\n // the `callValidated` check is made below and why we use the `validateInternalCalls` modifier on\n // `processMessageFromRoot`. This prevents calling the admin functions from any other method besides\n // `processMessageFromRoot`.\n function _requireAdminSender() internal view override {\n require(callValidated, \"Must call processMessageFromRoot\");\n }\n}\n" }, - "contracts/chain-adapters/Polygon_Adapter.sol": { - "content": "// SPDX-License-Identifier: AGPL-3.0-only\npragma solidity ^0.8.0;\n\nimport \"../interfaces/AdapterInterface.sol\";\nimport \"../interfaces/WETH9.sol\";\nimport \"../Lockable.sol\";\n\nimport \"@eth-optimism/contracts/libraries/bridge/CrossDomainEnabled.sol\";\nimport \"@eth-optimism/contracts/L1/messaging/IL1StandardBridge.sol\";\nimport \"@openzeppelin/contracts/token/ERC20/IERC20.sol\";\nimport \"@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol\";\n\ninterface IRootChainManager {\n function depositEtherFor(address user) external payable;\n\n function depositFor(\n address user,\n address rootToken,\n bytes calldata depositData\n ) external;\n}\n\ninterface IFxStateSender {\n function sendMessageToChild(address _receiver, bytes calldata _data) external;\n}\n\n/**\n * @notice Sends cross chain messages Polygon L2 network.\n * @dev Public functions calling external contracts do not guard against reentrancy because they are expected to be\n * called via delegatecall, which will execute this contract's logic within the context of the originating contract.\n * For example, the HubPool will delegatecall these functions, therefore its only neccessary that the HubPool's methods\n * that call this contract's logic guard against reentrancy.\n */\ncontract Polygon_Adapter is AdapterInterface {\n using SafeERC20 for IERC20;\n IRootChainManager public immutable rootChainManager;\n IFxStateSender public immutable fxStateSender;\n WETH9 public immutable l1Weth;\n\n /**\n * @notice Constructs new Adapter.\n * @param _rootChainManager RootChainManager Polygon system helper contract.\n * @param _fxStateSender FxStateSender Polygon system helper contract.\n * @param _l1Weth WETH address on L1.\n */\n constructor(\n IRootChainManager _rootChainManager,\n IFxStateSender _fxStateSender,\n WETH9 _l1Weth\n ) {\n rootChainManager = _rootChainManager;\n fxStateSender = _fxStateSender;\n l1Weth = _l1Weth;\n }\n\n /**\n * @notice Send cross-chain message to target on Polygon.\n * @param target Contract on Polygon that will receive message.\n * @param message Data to send to target.\n */\n\n function relayMessage(address target, bytes memory message) external payable override {\n fxStateSender.sendMessageToChild(target, message);\n emit MessageRelayed(target, message);\n }\n\n /**\n * @notice Bridge tokens to Polygon.\n * @param l1Token L1 token to deposit.\n * @param l2Token L2 token to receive.\n * @param amount Amount of L1 tokens to deposit and L2 tokens to receive.\n * @param to Bridge recipient.\n */\n function relayTokens(\n address l1Token,\n address l2Token,\n uint256 amount,\n address to\n ) external payable override {\n // If the l1Token is weth then unwrap it to ETH then send the ETH to the standard bridge.\n if (l1Token == address(l1Weth)) {\n l1Weth.withdraw(amount);\n rootChainManager.depositEtherFor{ value: amount }(to);\n } else {\n IERC20(l1Token).safeIncreaseAllowance(address(rootChainManager), amount);\n rootChainManager.depositFor(to, l1Token, abi.encode(amount));\n }\n emit TokensRelayed(l1Token, l2Token, amount, to);\n }\n}\n" + "contracts/Optimism_SpokePool.sol": { + "content": "// SPDX-License-Identifier: GPL-3.0-only\npragma solidity ^0.8.0;\n\nimport \"./SpokePool.sol\";\nimport \"./interfaces/WETH9.sol\";\n\nimport \"@eth-optimism/contracts/libraries/bridge/CrossDomainEnabled.sol\";\nimport \"@eth-optimism/contracts/libraries/constants/Lib_PredeployAddresses.sol\";\nimport \"@eth-optimism/contracts/L2/messaging/IL2ERC20Bridge.sol\";\n\n/**\n * @notice OVM specific SpokePool. Uses OVM cross-domain-enabled logic to implement admin only access to functions.\n */\ncontract Optimism_SpokePool is CrossDomainEnabled, SpokePool {\n // \"l1Gas\" parameter used in call to bridge tokens from this contract back to L1 via IL2ERC20Bridge. Currently\n // unused by bridge but included for future compatibility.\n uint32 public l1Gas = 5_000_000;\n\n // ETH is an ERC20 on OVM.\n address public immutable l2Eth = address(Lib_PredeployAddresses.OVM_ETH);\n\n // Stores alternative token bridges to use for L2 tokens that don't go over the standard bridge. This is needed\n // to support non-standard ERC20 tokens on Optimism, such as DIA and SNX which both use custom bridges.\n mapping(address => address) public tokenBridges;\n\n event OptimismTokensBridged(address indexed l2Token, address target, uint256 numberOfTokensBridged, uint256 l1Gas);\n event SetL1Gas(uint32 indexed newL1Gas);\n event SetL2TokenBridge(address indexed l2Token, address indexed tokenBridge);\n\n /**\n * @notice Construct the OVM SpokePool.\n * @param _crossDomainAdmin Cross domain admin to set. Can be changed by admin.\n * @param _hubPool Hub pool address to set. Can be changed by admin.\n * @param timerAddress Timer address to set.\n */\n constructor(\n address _crossDomainAdmin,\n address _hubPool,\n address timerAddress\n )\n CrossDomainEnabled(Lib_PredeployAddresses.L2_CROSS_DOMAIN_MESSENGER)\n SpokePool(_crossDomainAdmin, _hubPool, 0x4200000000000000000000000000000000000006, timerAddress)\n {}\n\n /*******************************************\n * OPTIMISM-SPECIFIC ADMIN FUNCTIONS *\n *******************************************/\n\n /**\n * @notice Change L1 gas limit. Callable only by admin.\n * @param newl1Gas New L1 gas limit to set.\n */\n function setL1GasLimit(uint32 newl1Gas) public onlyAdmin nonReentrant {\n l1Gas = newl1Gas;\n emit SetL1Gas(newl1Gas);\n }\n\n /**\n * @notice Set bridge contract for L2 token used to withdraw back to L1.\n * @dev If this mapping isn't set for an L2 token, then the standard bridge will be used to bridge this token.\n * @param tokenBridge Address of token bridge\n */\n function setTokenBridge(address l2Token, address tokenBridge) public onlyAdmin nonReentrant {\n tokenBridges[l2Token] = tokenBridge;\n emit SetL2TokenBridge(l2Token, tokenBridge);\n }\n\n /**************************************\n * DATA WORKER FUNCTIONS *\n **************************************/\n\n /**\n * @notice Wraps any ETH into WETH before executing base function. This is necessary because SpokePool receives\n * ETH over the canonical token bridge instead of WETH.\n * @inheritdoc SpokePool\n */\n function executeSlowRelayRoot(\n address depositor,\n address recipient,\n address destinationToken,\n uint256 totalRelayAmount,\n uint256 originChainId,\n uint64 realizedLpFeePct,\n uint64 relayerFeePct,\n uint32 depositId,\n uint32 rootBundleId,\n bytes32[] memory proof\n ) public override(SpokePool) nonReentrant {\n if (destinationToken == address(weth)) _depositEthToWeth();\n\n _executeSlowRelayRoot(\n depositor,\n recipient,\n destinationToken,\n totalRelayAmount,\n originChainId,\n chainId(),\n realizedLpFeePct,\n relayerFeePct,\n depositId,\n rootBundleId,\n proof\n );\n }\n\n /**\n * @notice Wraps any ETH into WETH before executing base function. This is necessary because SpokePool receives\n * ETH over the canonical token bridge instead of WETH.\n * @inheritdoc SpokePool\n */\n function executeRelayerRefundRoot(\n uint32 rootBundleId,\n SpokePoolInterface.RelayerRefundLeaf memory relayerRefundLeaf,\n bytes32[] memory proof\n ) public override(SpokePool) nonReentrant {\n if (relayerRefundLeaf.l2TokenAddress == address(weth)) _depositEthToWeth();\n\n _executeRelayerRefundRoot(rootBundleId, relayerRefundLeaf, proof);\n }\n\n /**************************************\n * INTERNAL FUNCTIONS *\n **************************************/\n\n // Wrap any ETH owned by this contract so we can send expected L2 token to recipient. This is necessary because\n // this SpokePool will receive ETH from the canonical token bridge instead of WETH. Its not sufficient to execute\n // this logic inside a fallback method that executes when this contract receives ETH because ETH is an ERC20\n // on the OVM.\n function _depositEthToWeth() internal {\n if (address(this).balance > 0) weth.deposit{ value: address(this).balance }();\n }\n\n function _bridgeTokensToHubPool(RelayerRefundLeaf memory relayerRefundLeaf) internal override {\n // If the token being bridged is WETH then we need to first unwrap it to ETH and then send ETH over the\n // canonical bridge. On Optimism, this is address 0xDeadDeAddeAddEAddeadDEaDDEAdDeaDDeAD0000.\n if (relayerRefundLeaf.l2TokenAddress == address(weth)) {\n WETH9(relayerRefundLeaf.l2TokenAddress).withdraw(relayerRefundLeaf.amountToReturn); // Unwrap into ETH.\n relayerRefundLeaf.l2TokenAddress = l2Eth; // Set the l2TokenAddress to ETH.\n }\n IL2ERC20Bridge(\n tokenBridges[relayerRefundLeaf.l2TokenAddress] == address(0)\n ? Lib_PredeployAddresses.L2_STANDARD_BRIDGE\n : tokenBridges[relayerRefundLeaf.l2TokenAddress]\n ).withdrawTo(\n relayerRefundLeaf.l2TokenAddress, // _l2Token. Address of the L2 token to bridge over.\n hubPool, // _to. Withdraw, over the bridge, to the l1 pool contract.\n relayerRefundLeaf.amountToReturn, // _amount.\n l1Gas, // _l1Gas. Unused, but included for potential forward compatibility considerations\n \"\" // _data. We don't need to send any data for the bridging action.\n );\n\n emit OptimismTokensBridged(relayerRefundLeaf.l2TokenAddress, hubPool, relayerRefundLeaf.amountToReturn, l1Gas);\n }\n\n // Apply OVM-specific transformation to cross domain admin address on L1.\n function _requireAdminSender() internal override onlyFromCrossDomainAccount(crossDomainAdmin) {}\n}\n" }, "@eth-optimism/contracts/libraries/bridge/CrossDomainEnabled.sol": { "content": "// SPDX-License-Identifier: MIT\npragma solidity >0.5.0 <0.9.0;\n\n/* Interface Imports */\nimport { ICrossDomainMessenger } from \"./ICrossDomainMessenger.sol\";\n\n/**\n * @title CrossDomainEnabled\n * @dev Helper contract for contracts performing cross-domain communications\n *\n * Compiler used: defined by inheriting contract\n */\ncontract CrossDomainEnabled {\n /*************\n * Variables *\n *************/\n\n // Messenger contract used to send and recieve messages from the other domain.\n address public messenger;\n\n /***************\n * Constructor *\n ***************/\n\n /**\n * @param _messenger Address of the CrossDomainMessenger on the current layer.\n */\n constructor(address _messenger) {\n messenger = _messenger;\n }\n\n /**********************\n * Function Modifiers *\n **********************/\n\n /**\n * Enforces that the modified function is only callable by a specific cross-domain account.\n * @param _sourceDomainAccount The only account on the originating domain which is\n * authenticated to call this function.\n */\n modifier onlyFromCrossDomainAccount(address _sourceDomainAccount) {\n require(\n msg.sender == address(getCrossDomainMessenger()),\n \"OVM_XCHAIN: messenger contract unauthenticated\"\n );\n\n require(\n getCrossDomainMessenger().xDomainMessageSender() == _sourceDomainAccount,\n \"OVM_XCHAIN: wrong sender of cross-domain message\"\n );\n\n _;\n }\n\n /**********************\n * Internal Functions *\n **********************/\n\n /**\n * Gets the messenger, usually from storage. This function is exposed in case a child contract\n * needs to override.\n * @return The address of the cross-domain messenger contract which should be used.\n */\n function getCrossDomainMessenger() internal virtual returns (ICrossDomainMessenger) {\n return ICrossDomainMessenger(messenger);\n }\n\n /**q\n * Sends a message to an account on another domain\n * @param _crossDomainTarget The intended recipient on the destination domain\n * @param _message The data to send to the target (usually calldata to a function with\n * `onlyFromCrossDomainAccount()`)\n * @param _gasLimit The gasLimit for the receipt of the message on the target domain.\n */\n function sendCrossDomainMessage(\n address _crossDomainTarget,\n uint32 _gasLimit,\n bytes memory _message\n ) internal {\n // slither-disable-next-line reentrancy-events, reentrancy-benign\n getCrossDomainMessenger().sendMessage(_crossDomainTarget, _message, _gasLimit);\n }\n}\n" }, - "@eth-optimism/contracts/L1/messaging/IL1StandardBridge.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma solidity >0.5.0 <0.9.0;\n\nimport \"./IL1ERC20Bridge.sol\";\n\n/**\n * @title IL1StandardBridge\n */\ninterface IL1StandardBridge is IL1ERC20Bridge {\n /**********\n * Events *\n **********/\n event ETHDepositInitiated(\n address indexed _from,\n address indexed _to,\n uint256 _amount,\n bytes _data\n );\n\n event ETHWithdrawalFinalized(\n address indexed _from,\n address indexed _to,\n uint256 _amount,\n bytes _data\n );\n\n /********************\n * Public Functions *\n ********************/\n\n /**\n * @dev Deposit an amount of the ETH to the caller's balance on L2.\n * @param _l2Gas Gas limit required to complete the deposit on L2.\n * @param _data Optional data to forward to L2. This data is provided\n * solely as a convenience for external contracts. Aside from enforcing a maximum\n * length, these contracts provide no guarantees about its content.\n */\n function depositETH(uint32 _l2Gas, bytes calldata _data) external payable;\n\n /**\n * @dev Deposit an amount of ETH to a recipient's balance on L2.\n * @param _to L2 address to credit the withdrawal to.\n * @param _l2Gas Gas limit required to complete the deposit on L2.\n * @param _data Optional data to forward to L2. This data is provided\n * solely as a convenience for external contracts. Aside from enforcing a maximum\n * length, these contracts provide no guarantees about its content.\n */\n function depositETHTo(\n address _to,\n uint32 _l2Gas,\n bytes calldata _data\n ) external payable;\n\n /*************************\n * Cross-chain Functions *\n *************************/\n\n /**\n * @dev Complete a withdrawal from L2 to L1, and credit funds to the recipient's balance of the\n * L1 ETH token. Since only the xDomainMessenger can call this function, it will never be called\n * before the withdrawal is finalized.\n * @param _from L2 address initiating the transfer.\n * @param _to L1 address to credit the withdrawal to.\n * @param _amount Amount of the ERC20 to deposit.\n * @param _data Optional data to forward to L2. This data is provided\n * solely as a convenience for external contracts. Aside from enforcing a maximum\n * length, these contracts provide no guarantees about its content.\n */\n function finalizeETHWithdrawal(\n address _from,\n address _to,\n uint256 _amount,\n bytes calldata _data\n ) external;\n}\n" + "@eth-optimism/contracts/libraries/constants/Lib_PredeployAddresses.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.9;\n\n/**\n * @title Lib_PredeployAddresses\n */\nlibrary Lib_PredeployAddresses {\n address internal constant L2_TO_L1_MESSAGE_PASSER = 0x4200000000000000000000000000000000000000;\n address internal constant L1_MESSAGE_SENDER = 0x4200000000000000000000000000000000000001;\n address internal constant DEPLOYER_WHITELIST = 0x4200000000000000000000000000000000000002;\n address payable internal constant OVM_ETH = payable(0xDeadDeAddeAddEAddeadDEaDDEAdDeaDDeAD0000);\n address internal constant L2_CROSS_DOMAIN_MESSENGER =\n 0x4200000000000000000000000000000000000007;\n address internal constant LIB_ADDRESS_MANAGER = 0x4200000000000000000000000000000000000008;\n address internal constant PROXY_EOA = 0x4200000000000000000000000000000000000009;\n address internal constant L2_STANDARD_BRIDGE = 0x4200000000000000000000000000000000000010;\n address internal constant SEQUENCER_FEE_WALLET = 0x4200000000000000000000000000000000000011;\n address internal constant L2_STANDARD_TOKEN_FACTORY =\n 0x4200000000000000000000000000000000000012;\n address internal constant L1_BLOCK_NUMBER = 0x4200000000000000000000000000000000000013;\n}\n" + }, + "@eth-optimism/contracts/L2/messaging/IL2ERC20Bridge.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.9;\n\n/**\n * @title IL2ERC20Bridge\n */\ninterface IL2ERC20Bridge {\n /**********\n * Events *\n **********/\n\n event WithdrawalInitiated(\n address indexed _l1Token,\n address indexed _l2Token,\n address indexed _from,\n address _to,\n uint256 _amount,\n bytes _data\n );\n\n event DepositFinalized(\n address indexed _l1Token,\n address indexed _l2Token,\n address indexed _from,\n address _to,\n uint256 _amount,\n bytes _data\n );\n\n event DepositFailed(\n address indexed _l1Token,\n address indexed _l2Token,\n address indexed _from,\n address _to,\n uint256 _amount,\n bytes _data\n );\n\n /********************\n * Public Functions *\n ********************/\n\n /**\n * @dev get the address of the corresponding L1 bridge contract.\n * @return Address of the corresponding L1 bridge contract.\n */\n function l1TokenBridge() external returns (address);\n\n /**\n * @dev initiate a withdraw of some tokens to the caller's account on L1\n * @param _l2Token Address of L2 token where withdrawal was initiated.\n * @param _amount Amount of the token to withdraw.\n * param _l1Gas Unused, but included for potential forward compatibility considerations.\n * @param _data Optional data to forward to L1. This data is provided\n * solely as a convenience for external contracts. Aside from enforcing a maximum\n * length, these contracts provide no guarantees about its content.\n */\n function withdraw(\n address _l2Token,\n uint256 _amount,\n uint32 _l1Gas,\n bytes calldata _data\n ) external;\n\n /**\n * @dev initiate a withdraw of some token to a recipient's account on L1.\n * @param _l2Token Address of L2 token where withdrawal is initiated.\n * @param _to L1 adress to credit the withdrawal to.\n * @param _amount Amount of the token to withdraw.\n * param _l1Gas Unused, but included for potential forward compatibility considerations.\n * @param _data Optional data to forward to L1. This data is provided\n * solely as a convenience for external contracts. Aside from enforcing a maximum\n * length, these contracts provide no guarantees about its content.\n */\n function withdrawTo(\n address _l2Token,\n address _to,\n uint256 _amount,\n uint32 _l1Gas,\n bytes calldata _data\n ) external;\n\n /*************************\n * Cross-chain Functions *\n *************************/\n\n /**\n * @dev Complete a deposit from L1 to L2, and credits funds to the recipient's balance of this\n * L2 token. This call will fail if it did not originate from a corresponding deposit in\n * L1StandardTokenBridge.\n * @param _l1Token Address for the l1 token this is called with\n * @param _l2Token Address for the l2 token this is called with\n * @param _from Account to pull the deposit from on L2.\n * @param _to Address to receive the withdrawal at\n * @param _amount Amount of the token to withdraw\n * @param _data Data provider by the sender on L1. This data is provided\n * solely as a convenience for external contracts. Aside from enforcing a maximum\n * length, these contracts provide no guarantees about its content.\n */\n function finalizeDeposit(\n address _l1Token,\n address _l2Token,\n address _from,\n address _to,\n uint256 _amount,\n bytes calldata _data\n ) external;\n}\n" }, "@eth-optimism/contracts/libraries/bridge/ICrossDomainMessenger.sol": { "content": "// SPDX-License-Identifier: MIT\npragma solidity >0.5.0 <0.9.0;\n\n/**\n * @title ICrossDomainMessenger\n */\ninterface ICrossDomainMessenger {\n /**********\n * Events *\n **********/\n\n event SentMessage(\n address indexed target,\n address sender,\n bytes message,\n uint256 messageNonce,\n uint256 gasLimit\n );\n event RelayedMessage(bytes32 indexed msgHash);\n event FailedRelayedMessage(bytes32 indexed msgHash);\n\n /*************\n * Variables *\n *************/\n\n function xDomainMessageSender() external view returns (address);\n\n /********************\n * Public Functions *\n ********************/\n\n /**\n * Sends a cross domain message to the target messenger.\n * @param _target Target contract address.\n * @param _message Message to send to the target.\n * @param _gasLimit Gas limit for the provided message.\n */\n function sendMessage(\n address _target,\n bytes calldata _message,\n uint32 _gasLimit\n ) external;\n}\n" }, - "@eth-optimism/contracts/L1/messaging/IL1ERC20Bridge.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma solidity >0.5.0 <0.9.0;\n\n/**\n * @title IL1ERC20Bridge\n */\ninterface IL1ERC20Bridge {\n /**********\n * Events *\n **********/\n\n event ERC20DepositInitiated(\n address indexed _l1Token,\n address indexed _l2Token,\n address indexed _from,\n address _to,\n uint256 _amount,\n bytes _data\n );\n\n event ERC20WithdrawalFinalized(\n address indexed _l1Token,\n address indexed _l2Token,\n address indexed _from,\n address _to,\n uint256 _amount,\n bytes _data\n );\n\n /********************\n * Public Functions *\n ********************/\n\n /**\n * @dev get the address of the corresponding L2 bridge contract.\n * @return Address of the corresponding L2 bridge contract.\n */\n function l2TokenBridge() external returns (address);\n\n /**\n * @dev deposit an amount of the ERC20 to the caller's balance on L2.\n * @param _l1Token Address of the L1 ERC20 we are depositing\n * @param _l2Token Address of the L1 respective L2 ERC20\n * @param _amount Amount of the ERC20 to deposit\n * @param _l2Gas Gas limit required to complete the deposit on L2.\n * @param _data Optional data to forward to L2. This data is provided\n * solely as a convenience for external contracts. Aside from enforcing a maximum\n * length, these contracts provide no guarantees about its content.\n */\n function depositERC20(\n address _l1Token,\n address _l2Token,\n uint256 _amount,\n uint32 _l2Gas,\n bytes calldata _data\n ) external;\n\n /**\n * @dev deposit an amount of ERC20 to a recipient's balance on L2.\n * @param _l1Token Address of the L1 ERC20 we are depositing\n * @param _l2Token Address of the L1 respective L2 ERC20\n * @param _to L2 address to credit the withdrawal to.\n * @param _amount Amount of the ERC20 to deposit.\n * @param _l2Gas Gas limit required to complete the deposit on L2.\n * @param _data Optional data to forward to L2. This data is provided\n * solely as a convenience for external contracts. Aside from enforcing a maximum\n * length, these contracts provide no guarantees about its content.\n */\n function depositERC20To(\n address _l1Token,\n address _l2Token,\n address _to,\n uint256 _amount,\n uint32 _l2Gas,\n bytes calldata _data\n ) external;\n\n /*************************\n * Cross-chain Functions *\n *************************/\n\n /**\n * @dev Complete a withdrawal from L2 to L1, and credit funds to the recipient's balance of the\n * L1 ERC20 token.\n * This call will fail if the initialized withdrawal from L2 has not been finalized.\n *\n * @param _l1Token Address of L1 token to finalizeWithdrawal for.\n * @param _l2Token Address of L2 token where withdrawal was initiated.\n * @param _from L2 address initiating the transfer.\n * @param _to L1 address to credit the withdrawal to.\n * @param _amount Amount of the ERC20 to deposit.\n * @param _data Data provided by the sender on L2. This data is provided\n * solely as a convenience for external contracts. Aside from enforcing a maximum\n * length, these contracts provide no guarantees about its content.\n */\n function finalizeERC20Withdrawal(\n address _l1Token,\n address _l2Token,\n address _from,\n address _to,\n uint256 _amount,\n bytes calldata _data\n ) external;\n}\n" - }, - "contracts/chain-adapters/Optimism_Adapter.sol": { - "content": "// SPDX-License-Identifier: AGPL-3.0-only\npragma solidity ^0.8.0;\n\nimport \"../interfaces/AdapterInterface.sol\";\nimport \"../interfaces/WETH9.sol\";\n\n// @dev Use local modified CrossDomainEnabled contract instead of one exported by eth-optimism because we need\n// this contract's state variables to be `immutable` because of the delegateCall call.\nimport \"./CrossDomainEnabled.sol\";\nimport \"@eth-optimism/contracts/L1/messaging/IL1StandardBridge.sol\";\n\nimport \"@openzeppelin/contracts/token/ERC20/IERC20.sol\";\nimport \"@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol\";\n\n/**\n * @notice Contract containing logic to send messages from L1 to Optimism.\n * @dev Public functions calling external contracts do not guard against reentrancy because they are expected to be\n * called via delegatecall, which will execute this contract's logic within the context of the originating contract.\n * For example, the HubPool will delegatecall these functions, therefore its only neccessary that the HubPool's methods\n * that call this contract's logic guard against reentrancy.\n */\ncontract Optimism_Adapter is CrossDomainEnabled, AdapterInterface {\n using SafeERC20 for IERC20;\n uint32 public immutable l2GasLimit = 5_000_000;\n\n WETH9 public immutable l1Weth;\n\n IL1StandardBridge public immutable l1StandardBridge;\n\n // Optimism has the ability to support \"custom\" bridges. These bridges are not supported by the canonical bridge\n // and so we need to store the address of the custom token and the associated bridge. In the event we want to\n // support a new token that is not supported by Optimism, we can add a new custom bridge for it and re-deploy the\n // adapter. A full list of custom optimism tokens and their associated bridges can be found here:\n // https://github.com/ethereum-optimism/ethereum-optimism.github.io/blob/master/optimism.tokenlist.json\n address public immutable dai = 0x6B175474E89094C44Da98b954EedeAC495271d0F;\n address public immutable daiOptimismBridge = 0x10E6593CDda8c58a1d0f14C5164B376352a55f2F;\n address public immutable snx = 0xC011a73ee8576Fb46F5E1c5751cA3B9Fe0af2a6F;\n address public immutable snxOptimismBridge = 0xCd9D4988C0AE61887B075bA77f08cbFAd2b65068;\n\n event L2GasLimitSet(uint32 newGasLimit);\n\n /**\n * @notice Constructs new Adapter.\n * @param _l1Weth WETH address on L1.\n * @param _crossDomainMessenger XDomainMessenger Optimism system contract.\n * @param _l1StandardBridge Standard bridge contract.\n */\n constructor(\n WETH9 _l1Weth,\n address _crossDomainMessenger,\n IL1StandardBridge _l1StandardBridge\n ) CrossDomainEnabled(_crossDomainMessenger) {\n l1Weth = _l1Weth;\n l1StandardBridge = _l1StandardBridge;\n }\n\n /**\n * @notice Send cross-chain message to target on Optimism.\n * @param target Contract on Optimism that will receive message.\n * @param message Data to send to target.\n */\n function relayMessage(address target, bytes memory message) external payable override {\n sendCrossDomainMessage(target, uint32(l2GasLimit), message);\n emit MessageRelayed(target, message);\n }\n\n /**\n * @notice Bridge tokens to Optimism.\n * @param l1Token L1 token to deposit.\n * @param l2Token L2 token to receive.\n * @param amount Amount of L1 tokens to deposit and L2 tokens to receive.\n * @param to Bridge recipient.\n */\n function relayTokens(\n address l1Token,\n address l2Token,\n uint256 amount,\n address to\n ) external payable override {\n // If the l1Token is weth then unwrap it to ETH then send the ETH to the standard bridge.\n if (l1Token == address(l1Weth)) {\n l1Weth.withdraw(amount);\n l1StandardBridge.depositETHTo{ value: amount }(to, l2GasLimit, \"\");\n } else {\n IL1StandardBridge _l1StandardBridge = l1StandardBridge;\n\n // Check if the L1 token requires a custom bridge. If so, use that bridge over the standard bridge.\n if (l1Token == dai) _l1StandardBridge = IL1StandardBridge(daiOptimismBridge); // 1. DAI\n if (l1Token == snx) _l1StandardBridge = IL1StandardBridge(snxOptimismBridge); // 2. SNX\n\n IERC20(l1Token).safeIncreaseAllowance(address(_l1StandardBridge), amount);\n _l1StandardBridge.depositERC20To(l1Token, l2Token, to, amount, l2GasLimit, \"\");\n }\n emit TokensRelayed(l1Token, l2Token, amount, to);\n }\n}\n" - }, "contracts/chain-adapters/CrossDomainEnabled.sol": { "content": "// SPDX-License-Identifier: MIT\npragma solidity >0.5.0 <0.9.0;\n\n/* Interface Imports */\nimport { ICrossDomainMessenger } from \"@eth-optimism/contracts/libraries/bridge/ICrossDomainMessenger.sol\";\n\n/**\n * @title CrossDomainEnabled\n * @dev Helper contract for contracts performing cross-domain communications between L1 and Optimism.\n * @dev This modifies the eth-optimism/CrossDomainEnabled contract only by changing state variables to be\n * immutable for use in contracts like the Optimism_Adapter which use delegateCall().\n */\ncontract CrossDomainEnabled {\n // Messenger contract used to send and recieve messages from the other domain.\n address public immutable messenger;\n\n /**\n * @param _messenger Address of the CrossDomainMessenger on the current layer.\n */\n constructor(address _messenger) {\n messenger = _messenger;\n }\n\n /**\n * Enforces that the modified function is only callable by a specific cross-domain account.\n * @param _sourceDomainAccount The only account on the originating domain which is\n * authenticated to call this function.\n */\n modifier onlyFromCrossDomainAccount(address _sourceDomainAccount) {\n require(msg.sender == address(getCrossDomainMessenger()), \"OVM_XCHAIN: messenger contract unauthenticated\");\n\n require(\n getCrossDomainMessenger().xDomainMessageSender() == _sourceDomainAccount,\n \"OVM_XCHAIN: wrong sender of cross-domain message\"\n );\n\n _;\n }\n\n /**\n * Gets the messenger, usually from storage. This function is exposed in case a child contract\n * needs to override.\n * @return The address of the cross-domain messenger contract which should be used.\n */\n function getCrossDomainMessenger() internal virtual returns (ICrossDomainMessenger) {\n return ICrossDomainMessenger(messenger);\n }\n\n /**\n * Sends a message to an account on another domain\n * @param _crossDomainTarget The intended recipient on the destination domain\n * @param _message The data to send to the target (usually calldata to a function with\n * onlyFromCrossDomainAccount())\n * @param _gasLimit The gasLimit for the receipt of the message on the target domain.\n */\n function sendCrossDomainMessage(\n address _crossDomainTarget,\n uint32 _gasLimit,\n bytes memory _message\n ) internal {\n // slither-disable-next-line reentrancy-events, reentrancy-benign\n getCrossDomainMessenger().sendMessage(_crossDomainTarget, _message, _gasLimit);\n }\n}\n" }, - "contracts/Optimism_SpokePool.sol": { - "content": "// SPDX-License-Identifier: GPL-3.0-only\npragma solidity ^0.8.0;\n\nimport \"./interfaces/WETH9.sol\";\n\nimport \"@eth-optimism/contracts/libraries/bridge/CrossDomainEnabled.sol\";\nimport \"@eth-optimism/contracts/libraries/constants/Lib_PredeployAddresses.sol\";\nimport \"@eth-optimism/contracts/L2/messaging/IL2ERC20Bridge.sol\";\nimport \"./SpokePool.sol\";\nimport \"./SpokePoolInterface.sol\";\n\n/**\n * @notice OVM specific SpokePool. Uses OVM cross-domain-enabled logic to implement admin only access to functions.\n */\ncontract Optimism_SpokePool is CrossDomainEnabled, SpokePool {\n // \"l1Gas\" parameter used in call to bridge tokens from this contract back to L1 via IL2ERC20Bridge. Currently\n // unused by bridge but included for future compatibility.\n uint32 public l1Gas = 5_000_000;\n\n // ETH is an ERC20 on OVM.\n address public l2Eth = address(Lib_PredeployAddresses.OVM_ETH);\n\n // Stores alternative token bridges to use for L2 tokens that don't go over the standard bridge. This is needed\n // to support non-standard ERC20 tokens on Optimism, such as DIA and SNX which both use custom bridges.\n mapping(address => address) public tokenBridges;\n\n event OptimismTokensBridged(address indexed l2Token, address target, uint256 numberOfTokensBridged, uint256 l1Gas);\n event SetL1Gas(uint32 indexed newL1Gas);\n event SetL2TokenBridge(address indexed l2Token, address indexed tokenBridge);\n\n /**\n * @notice Construct the OVM SpokePool.\n * @param _crossDomainAdmin Cross domain admin to set. Can be changed by admin.\n * @param _hubPool Hub pool address to set. Can be changed by admin.\n * @param timerAddress Timer address to set.\n */\n constructor(\n address _crossDomainAdmin,\n address _hubPool,\n address timerAddress\n )\n CrossDomainEnabled(Lib_PredeployAddresses.L2_CROSS_DOMAIN_MESSENGER)\n SpokePool(_crossDomainAdmin, _hubPool, 0x4200000000000000000000000000000000000006, timerAddress)\n {}\n\n /*******************************************\n * OPTIMISM-SPECIFIC ADMIN FUNCTIONS *\n *******************************************/\n\n /**\n * @notice Change L1 gas limit. Callable only by admin.\n * @param newl1Gas New L1 gas limit to set.\n */\n function setL1GasLimit(uint32 newl1Gas) public onlyAdmin {\n l1Gas = newl1Gas;\n emit SetL1Gas(newl1Gas);\n }\n\n /**\n * @notice Set bridge contract for L2 token used to withdraw back to L1.\n * @dev If this mapping isn't set for an L2 token, then the standard bridge will be used to bridge this token.\n * @param tokenBridge Address of token bridge\n */\n function setTokenBridge(address l2Token, address tokenBridge) public onlyAdmin {\n tokenBridges[l2Token] = tokenBridge;\n emit SetL2TokenBridge(l2Token, tokenBridge);\n }\n\n /**************************************\n * DATA WORKER FUNCTIONS *\n **************************************/\n\n /**\n * @notice Wraps any ETH into WETH before executing base function. This is necessary because SpokePool receives\n * ETH over the canonical token bridge instead of WETH.\n * @inheritdoc SpokePool\n */\n function executeSlowRelayRoot(\n address depositor,\n address recipient,\n address destinationToken,\n uint256 totalRelayAmount,\n uint256 originChainId,\n uint64 realizedLpFeePct,\n uint64 relayerFeePct,\n uint32 depositId,\n uint32 rootBundleId,\n bytes32[] memory proof\n ) public override(SpokePool) nonReentrant {\n if (destinationToken == address(weth)) _depositEthToWeth();\n\n _executeSlowRelayRoot(\n depositor,\n recipient,\n destinationToken,\n totalRelayAmount,\n originChainId,\n realizedLpFeePct,\n relayerFeePct,\n depositId,\n rootBundleId,\n proof\n );\n }\n\n /**\n * @notice Wraps any ETH into WETH before executing base function. This is necessary because SpokePool receives\n * ETH over the canonical token bridge instead of WETH.\n * @inheritdoc SpokePool\n */\n function executeRelayerRefundRoot(\n uint32 rootBundleId,\n SpokePoolInterface.RelayerRefundLeaf memory relayerRefundLeaf,\n bytes32[] memory proof\n ) public override(SpokePool) nonReentrant {\n if (relayerRefundLeaf.l2TokenAddress == address(weth)) _depositEthToWeth();\n\n _executeRelayerRefundRoot(rootBundleId, relayerRefundLeaf, proof);\n }\n\n /**************************************\n * INTERNAL FUNCTIONS *\n **************************************/\n\n // Wrap any ETH owned by this contract so we can send expected L2 token to recipient. This is necessary because\n // this SpokePool will receive ETH from the canonical token bridge instead of WETH. Its not sufficient to execute\n // this logic inside a fallback method that executes when this contract receives ETH because ETH is an ERC20\n // on the OVM.\n function _depositEthToWeth() internal {\n if (address(this).balance > 0) weth.deposit{ value: address(this).balance }();\n }\n\n function _bridgeTokensToHubPool(RelayerRefundLeaf memory relayerRefundLeaf) internal override {\n // If the token being bridged is WETH then we need to first unwrap it to ETH and then send ETH over the\n // canonical bridge. On Optimism, this is address 0xDeadDeAddeAddEAddeadDEaDDEAdDeaDDeAD0000.\n if (relayerRefundLeaf.l2TokenAddress == address(weth)) {\n WETH9(relayerRefundLeaf.l2TokenAddress).withdraw(relayerRefundLeaf.amountToReturn); // Unwrap into ETH.\n relayerRefundLeaf.l2TokenAddress = l2Eth; // Set the l2TokenAddress to ETH.\n }\n IL2ERC20Bridge(\n tokenBridges[relayerRefundLeaf.l2TokenAddress] == address(0)\n ? Lib_PredeployAddresses.L2_STANDARD_BRIDGE\n : tokenBridges[relayerRefundLeaf.l2TokenAddress]\n ).withdrawTo(\n relayerRefundLeaf.l2TokenAddress, // _l2Token. Address of the L2 token to bridge over.\n hubPool, // _to. Withdraw, over the bridge, to the l1 pool contract.\n relayerRefundLeaf.amountToReturn, // _amount.\n l1Gas, // _l1Gas. Unused, but included for potential forward compatibility considerations\n \"\" // _data. We don't need to send any data for the bridging action.\n );\n\n emit OptimismTokensBridged(relayerRefundLeaf.l2TokenAddress, hubPool, relayerRefundLeaf.amountToReturn, l1Gas);\n }\n\n // Apply OVM-specific transformation to cross domain admin address on L1.\n function _requireAdminSender() internal override onlyFromCrossDomainAccount(crossDomainAdmin) {}\n}\n" - }, - "@eth-optimism/contracts/libraries/constants/Lib_PredeployAddresses.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.9;\n\n/**\n * @title Lib_PredeployAddresses\n */\nlibrary Lib_PredeployAddresses {\n address internal constant L2_TO_L1_MESSAGE_PASSER = 0x4200000000000000000000000000000000000000;\n address internal constant L1_MESSAGE_SENDER = 0x4200000000000000000000000000000000000001;\n address internal constant DEPLOYER_WHITELIST = 0x4200000000000000000000000000000000000002;\n address payable internal constant OVM_ETH = payable(0xDeadDeAddeAddEAddeadDEaDDEAdDeaDDeAD0000);\n address internal constant L2_CROSS_DOMAIN_MESSENGER =\n 0x4200000000000000000000000000000000000007;\n address internal constant LIB_ADDRESS_MANAGER = 0x4200000000000000000000000000000000000008;\n address internal constant PROXY_EOA = 0x4200000000000000000000000000000000000009;\n address internal constant L2_STANDARD_BRIDGE = 0x4200000000000000000000000000000000000010;\n address internal constant SEQUENCER_FEE_WALLET = 0x4200000000000000000000000000000000000011;\n address internal constant L2_STANDARD_TOKEN_FACTORY =\n 0x4200000000000000000000000000000000000012;\n address internal constant L1_BLOCK_NUMBER = 0x4200000000000000000000000000000000000013;\n}\n" + "contracts/chain-adapters/Optimism_Adapter.sol": { + "content": "// SPDX-License-Identifier: AGPL-3.0-only\npragma solidity ^0.8.0;\n\nimport \"../interfaces/AdapterInterface.sol\";\nimport \"../interfaces/WETH9.sol\";\n\n// @dev Use local modified CrossDomainEnabled contract instead of one exported by eth-optimism because we need\n// this contract's state variables to be `immutable` because of the delegateCall call.\nimport \"./CrossDomainEnabled.sol\";\nimport \"@eth-optimism/contracts/L1/messaging/IL1StandardBridge.sol\";\n\nimport \"@openzeppelin/contracts/token/ERC20/IERC20.sol\";\nimport \"@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol\";\n\n/**\n * @notice Contract containing logic to send messages from L1 to Optimism.\n * @dev Public functions calling external contracts do not guard against reentrancy because they are expected to be\n * called via delegatecall, which will execute this contract's logic within the context of the originating contract.\n * For example, the HubPool will delegatecall these functions, therefore its only necessary that the HubPool's methods\n * that call this contract's logic guard against reentrancy.\n */\ncontract Optimism_Adapter is CrossDomainEnabled, AdapterInterface {\n using SafeERC20 for IERC20;\n uint32 public immutable l2GasLimit = 5_000_000;\n\n WETH9 public immutable l1Weth;\n\n IL1StandardBridge public immutable l1StandardBridge;\n\n // Optimism has the ability to support \"custom\" bridges. These bridges are not supported by the canonical bridge\n // and so we need to store the address of the custom token and the associated bridge. In the event we want to\n // support a new token that is not supported by Optimism, we can add a new custom bridge for it and re-deploy the\n // adapter. A full list of custom optimism tokens and their associated bridges can be found here:\n // https://github.com/ethereum-optimism/ethereum-optimism.github.io/blob/master/optimism.tokenlist.json\n address public immutable dai = 0x6B175474E89094C44Da98b954EedeAC495271d0F;\n address public immutable daiOptimismBridge = 0x10E6593CDda8c58a1d0f14C5164B376352a55f2F;\n address public immutable snx = 0xC011a73ee8576Fb46F5E1c5751cA3B9Fe0af2a6F;\n address public immutable snxOptimismBridge = 0xCd9D4988C0AE61887B075bA77f08cbFAd2b65068;\n\n /**\n * @notice Constructs new Adapter.\n * @param _l1Weth WETH address on L1.\n * @param _crossDomainMessenger XDomainMessenger Optimism system contract.\n * @param _l1StandardBridge Standard bridge contract.\n */\n constructor(\n WETH9 _l1Weth,\n address _crossDomainMessenger,\n IL1StandardBridge _l1StandardBridge\n ) CrossDomainEnabled(_crossDomainMessenger) {\n l1Weth = _l1Weth;\n l1StandardBridge = _l1StandardBridge;\n }\n\n /**\n * @notice Send cross-chain message to target on Optimism.\n * @param target Contract on Optimism that will receive message.\n * @param message Data to send to target.\n */\n function relayMessage(address target, bytes memory message) external payable override {\n sendCrossDomainMessage(target, uint32(l2GasLimit), message);\n emit MessageRelayed(target, message);\n }\n\n /**\n * @notice Bridge tokens to Optimism.\n * @param l1Token L1 token to deposit.\n * @param l2Token L2 token to receive.\n * @param amount Amount of L1 tokens to deposit and L2 tokens to receive.\n * @param to Bridge recipient.\n */\n function relayTokens(\n address l1Token,\n address l2Token,\n uint256 amount,\n address to\n ) external payable override {\n // If the l1Token is weth then unwrap it to ETH then send the ETH to the standard bridge.\n if (l1Token == address(l1Weth)) {\n l1Weth.withdraw(amount);\n l1StandardBridge.depositETHTo{ value: amount }(to, l2GasLimit, \"\");\n } else {\n IL1StandardBridge _l1StandardBridge = l1StandardBridge;\n\n // Check if the L1 token requires a custom bridge. If so, use that bridge over the standard bridge.\n if (l1Token == dai) _l1StandardBridge = IL1StandardBridge(daiOptimismBridge); // 1. DAI\n if (l1Token == snx) _l1StandardBridge = IL1StandardBridge(snxOptimismBridge); // 2. SNX\n\n IERC20(l1Token).safeIncreaseAllowance(address(_l1StandardBridge), amount);\n _l1StandardBridge.depositERC20To(l1Token, l2Token, to, amount, l2GasLimit, \"\");\n }\n emit TokensRelayed(l1Token, l2Token, amount, to);\n }\n}\n" }, - "@eth-optimism/contracts/L2/messaging/IL2ERC20Bridge.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.9;\n\n/**\n * @title IL2ERC20Bridge\n */\ninterface IL2ERC20Bridge {\n /**********\n * Events *\n **********/\n\n event WithdrawalInitiated(\n address indexed _l1Token,\n address indexed _l2Token,\n address indexed _from,\n address _to,\n uint256 _amount,\n bytes _data\n );\n\n event DepositFinalized(\n address indexed _l1Token,\n address indexed _l2Token,\n address indexed _from,\n address _to,\n uint256 _amount,\n bytes _data\n );\n\n event DepositFailed(\n address indexed _l1Token,\n address indexed _l2Token,\n address indexed _from,\n address _to,\n uint256 _amount,\n bytes _data\n );\n\n /********************\n * Public Functions *\n ********************/\n\n /**\n * @dev get the address of the corresponding L1 bridge contract.\n * @return Address of the corresponding L1 bridge contract.\n */\n function l1TokenBridge() external returns (address);\n\n /**\n * @dev initiate a withdraw of some tokens to the caller's account on L1\n * @param _l2Token Address of L2 token where withdrawal was initiated.\n * @param _amount Amount of the token to withdraw.\n * param _l1Gas Unused, but included for potential forward compatibility considerations.\n * @param _data Optional data to forward to L1. This data is provided\n * solely as a convenience for external contracts. Aside from enforcing a maximum\n * length, these contracts provide no guarantees about its content.\n */\n function withdraw(\n address _l2Token,\n uint256 _amount,\n uint32 _l1Gas,\n bytes calldata _data\n ) external;\n\n /**\n * @dev initiate a withdraw of some token to a recipient's account on L1.\n * @param _l2Token Address of L2 token where withdrawal is initiated.\n * @param _to L1 adress to credit the withdrawal to.\n * @param _amount Amount of the token to withdraw.\n * param _l1Gas Unused, but included for potential forward compatibility considerations.\n * @param _data Optional data to forward to L1. This data is provided\n * solely as a convenience for external contracts. Aside from enforcing a maximum\n * length, these contracts provide no guarantees about its content.\n */\n function withdrawTo(\n address _l2Token,\n address _to,\n uint256 _amount,\n uint32 _l1Gas,\n bytes calldata _data\n ) external;\n\n /*************************\n * Cross-chain Functions *\n *************************/\n\n /**\n * @dev Complete a deposit from L1 to L2, and credits funds to the recipient's balance of this\n * L2 token. This call will fail if it did not originate from a corresponding deposit in\n * L1StandardTokenBridge.\n * @param _l1Token Address for the l1 token this is called with\n * @param _l2Token Address for the l2 token this is called with\n * @param _from Account to pull the deposit from on L2.\n * @param _to Address to receive the withdrawal at\n * @param _amount Amount of the token to withdraw\n * @param _data Data provider by the sender on L1. This data is provided\n * solely as a convenience for external contracts. Aside from enforcing a maximum\n * length, these contracts provide no guarantees about its content.\n */\n function finalizeDeposit(\n address _l1Token,\n address _l2Token,\n address _from,\n address _to,\n uint256 _amount,\n bytes calldata _data\n ) external;\n}\n" + "@eth-optimism/contracts/L1/messaging/IL1StandardBridge.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity >0.5.0 <0.9.0;\n\nimport \"./IL1ERC20Bridge.sol\";\n\n/**\n * @title IL1StandardBridge\n */\ninterface IL1StandardBridge is IL1ERC20Bridge {\n /**********\n * Events *\n **********/\n event ETHDepositInitiated(\n address indexed _from,\n address indexed _to,\n uint256 _amount,\n bytes _data\n );\n\n event ETHWithdrawalFinalized(\n address indexed _from,\n address indexed _to,\n uint256 _amount,\n bytes _data\n );\n\n /********************\n * Public Functions *\n ********************/\n\n /**\n * @dev Deposit an amount of the ETH to the caller's balance on L2.\n * @param _l2Gas Gas limit required to complete the deposit on L2.\n * @param _data Optional data to forward to L2. This data is provided\n * solely as a convenience for external contracts. Aside from enforcing a maximum\n * length, these contracts provide no guarantees about its content.\n */\n function depositETH(uint32 _l2Gas, bytes calldata _data) external payable;\n\n /**\n * @dev Deposit an amount of ETH to a recipient's balance on L2.\n * @param _to L2 address to credit the withdrawal to.\n * @param _l2Gas Gas limit required to complete the deposit on L2.\n * @param _data Optional data to forward to L2. This data is provided\n * solely as a convenience for external contracts. Aside from enforcing a maximum\n * length, these contracts provide no guarantees about its content.\n */\n function depositETHTo(\n address _to,\n uint32 _l2Gas,\n bytes calldata _data\n ) external payable;\n\n /*************************\n * Cross-chain Functions *\n *************************/\n\n /**\n * @dev Complete a withdrawal from L2 to L1, and credit funds to the recipient's balance of the\n * L1 ETH token. Since only the xDomainMessenger can call this function, it will never be called\n * before the withdrawal is finalized.\n * @param _from L2 address initiating the transfer.\n * @param _to L1 address to credit the withdrawal to.\n * @param _amount Amount of the ERC20 to deposit.\n * @param _data Optional data to forward to L2. This data is provided\n * solely as a convenience for external contracts. Aside from enforcing a maximum\n * length, these contracts provide no guarantees about its content.\n */\n function finalizeETHWithdrawal(\n address _from,\n address _to,\n uint256 _amount,\n bytes calldata _data\n ) external;\n}\n" }, - "contracts/Ethereum_SpokePool.sol": { - "content": "// SPDX-License-Identifier: GPL-3.0-only\npragma solidity ^0.8.0;\n\nimport \"./interfaces/WETH9.sol\";\n\nimport \"@openzeppelin/contracts/access/Ownable.sol\";\nimport \"@openzeppelin/contracts/token/ERC20/IERC20.sol\";\n\nimport \"./SpokePool.sol\";\nimport \"./SpokePoolInterface.sol\";\n\n/**\n * @notice Ethereum L1 specific SpokePool. Used on Ethereum L1 to facilitate L2->L1 transfers.\n */\ncontract Ethereum_SpokePool is SpokePool, Ownable {\n /**\n * @notice Construct the Ethereum SpokePool.\n * @param _hubPool Hub pool address to set. Can be changed by admin.\n * @param _wethAddress Weth address for this network to set.\n * @param timerAddress Timer address to set.\n */\n constructor(\n address _hubPool,\n address _wethAddress,\n address timerAddress\n ) SpokePool(msg.sender, _hubPool, _wethAddress, timerAddress) {}\n\n /**************************************\n * INTERNAL FUNCTIONS *\n **************************************/\n\n function _bridgeTokensToHubPool(RelayerRefundLeaf memory relayerRefundLeaf) internal override {\n IERC20(relayerRefundLeaf.l2TokenAddress).transfer(hubPool, relayerRefundLeaf.amountToReturn);\n }\n\n // Admin is simply owner which should be same account that owns the HubPool deployed on this network. A core\n // assumption of this contract system is that the HubPool is deployed on Ethereum.\n function _requireAdminSender() internal override onlyOwner {}\n}\n" + "@eth-optimism/contracts/L1/messaging/IL1ERC20Bridge.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity >0.5.0 <0.9.0;\n\n/**\n * @title IL1ERC20Bridge\n */\ninterface IL1ERC20Bridge {\n /**********\n * Events *\n **********/\n\n event ERC20DepositInitiated(\n address indexed _l1Token,\n address indexed _l2Token,\n address indexed _from,\n address _to,\n uint256 _amount,\n bytes _data\n );\n\n event ERC20WithdrawalFinalized(\n address indexed _l1Token,\n address indexed _l2Token,\n address indexed _from,\n address _to,\n uint256 _amount,\n bytes _data\n );\n\n /********************\n * Public Functions *\n ********************/\n\n /**\n * @dev get the address of the corresponding L2 bridge contract.\n * @return Address of the corresponding L2 bridge contract.\n */\n function l2TokenBridge() external returns (address);\n\n /**\n * @dev deposit an amount of the ERC20 to the caller's balance on L2.\n * @param _l1Token Address of the L1 ERC20 we are depositing\n * @param _l2Token Address of the L1 respective L2 ERC20\n * @param _amount Amount of the ERC20 to deposit\n * @param _l2Gas Gas limit required to complete the deposit on L2.\n * @param _data Optional data to forward to L2. This data is provided\n * solely as a convenience for external contracts. Aside from enforcing a maximum\n * length, these contracts provide no guarantees about its content.\n */\n function depositERC20(\n address _l1Token,\n address _l2Token,\n uint256 _amount,\n uint32 _l2Gas,\n bytes calldata _data\n ) external;\n\n /**\n * @dev deposit an amount of ERC20 to a recipient's balance on L2.\n * @param _l1Token Address of the L1 ERC20 we are depositing\n * @param _l2Token Address of the L1 respective L2 ERC20\n * @param _to L2 address to credit the withdrawal to.\n * @param _amount Amount of the ERC20 to deposit.\n * @param _l2Gas Gas limit required to complete the deposit on L2.\n * @param _data Optional data to forward to L2. This data is provided\n * solely as a convenience for external contracts. Aside from enforcing a maximum\n * length, these contracts provide no guarantees about its content.\n */\n function depositERC20To(\n address _l1Token,\n address _l2Token,\n address _to,\n uint256 _amount,\n uint32 _l2Gas,\n bytes calldata _data\n ) external;\n\n /*************************\n * Cross-chain Functions *\n *************************/\n\n /**\n * @dev Complete a withdrawal from L2 to L1, and credit funds to the recipient's balance of the\n * L1 ERC20 token.\n * This call will fail if the initialized withdrawal from L2 has not been finalized.\n *\n * @param _l1Token Address of L1 token to finalizeWithdrawal for.\n * @param _l2Token Address of L2 token where withdrawal was initiated.\n * @param _from L2 address initiating the transfer.\n * @param _to L1 address to credit the withdrawal to.\n * @param _amount Amount of the ERC20 to deposit.\n * @param _data Data provided by the sender on L2. This data is provided\n * solely as a convenience for external contracts. Aside from enforcing a maximum\n * length, these contracts provide no guarantees about its content.\n */\n function finalizeERC20Withdrawal(\n address _l1Token,\n address _l2Token,\n address _from,\n address _to,\n uint256 _amount,\n bytes calldata _data\n ) external;\n}\n" }, - "contracts/chain-adapters/Ethereum_Adapter.sol": { - "content": "// SPDX-License-Identifier: AGPL-3.0-only\npragma solidity ^0.8.0;\n\nimport \"../interfaces/AdapterInterface.sol\";\nimport \"../interfaces/WETH9.sol\";\n\nimport \"@openzeppelin/contracts/token/ERC20/IERC20.sol\";\nimport \"@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol\";\n\n/**\n * @notice Contract containing logic to send messages from L1 to Ethereum SpokePool.\n * @notice This contract should always be deployed on the same chain as the HubPool, as it acts as a pass-through\n * contract between HubPool and SpokePool on the same chain. Its named \"Ethereum_Adapter\" because a core assumption\n * is that the HubPool will be deployed on Ethereum, so this adapter will be used to communicate between HubPool\n * and the Ethereum_SpokePool.\n * @dev Public functions calling external contracts do not guard against reentrancy because they are expected to be\n * called via delegatecall, which will execute this contract's logic within the context of the originating contract.\n * For example, the HubPool will delegatecall these functions, therefore its only neccessary that the HubPool's methods\n * that call this contract's logic guard against reentrancy.\n */\ncontract Ethereum_Adapter is AdapterInterface {\n using SafeERC20 for IERC20;\n\n /**\n * @notice Send message to target on Ethereum.\n * @notice This function, and contract overall, is not useful in practice except that the HubPool\n * expects to interact with the SpokePool via an Adapter, so when communicating to the Ethereum_SpokePool, it must\n * send messages via this pass-through contract.\n * @param target Contract that will receive message.\n * @param message Data to send to target.\n */\n function relayMessage(address target, bytes memory message) external payable override {\n _executeCall(target, message);\n emit MessageRelayed(target, message);\n }\n\n /**\n * @notice Send tokens to target.\n * @param l1Token L1 token to send.\n * @param l2Token Unused parameter in this contract.\n * @param amount Amount of L1 tokens to send.\n * @param to recipient.\n */\n function relayTokens(\n address l1Token,\n address l2Token, // l2Token is unused for ethereum since we are assuming that the HubPool is only deployed\n // on this network.\n uint256 amount,\n address to\n ) external payable override {\n IERC20(l1Token).safeTransfer(to, amount);\n emit TokensRelayed(l1Token, l2Token, amount, to);\n }\n\n // Note: this snippet of code is copied from Governor.sol.\n function _executeCall(address to, bytes memory data) private {\n // Note: this snippet of code is copied from Governor.sol and modified to not include any \"value\" field.\n // solhint-disable-next-line no-inline-assembly\n\n bool success;\n assembly {\n let inputData := add(data, 0x20)\n let inputDataSize := mload(data)\n // Hardcode value to be 0 for relayed governance calls in order to avoid addressing complexity of bridging\n // value cross-chain.\n success := call(gas(), to, 0, inputData, inputDataSize, 0, 0)\n }\n require(success, \"execute call failed\");\n }\n}\n" + "contracts/chain-adapters/Polygon_Adapter.sol": { + "content": "// SPDX-License-Identifier: AGPL-3.0-only\npragma solidity ^0.8.0;\n\nimport \"../interfaces/AdapterInterface.sol\";\nimport \"../interfaces/WETH9.sol\";\n\nimport \"@openzeppelin/contracts/token/ERC20/IERC20.sol\";\nimport \"@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol\";\n\ninterface IRootChainManager {\n function depositEtherFor(address user) external payable;\n\n function depositFor(\n address user,\n address rootToken,\n bytes calldata depositData\n ) external;\n}\n\ninterface IFxStateSender {\n function sendMessageToChild(address _receiver, bytes calldata _data) external;\n}\n\n/**\n * @notice Sends cross chain messages Polygon L2 network.\n * @dev Public functions calling external contracts do not guard against reentrancy because they are expected to be\n * called via delegatecall, which will execute this contract's logic within the context of the originating contract.\n * For example, the HubPool will delegatecall these functions, therefore its only necessary that the HubPool's methods\n * that call this contract's logic guard against reentrancy.\n */\ncontract Polygon_Adapter is AdapterInterface {\n using SafeERC20 for IERC20;\n IRootChainManager public immutable rootChainManager;\n IFxStateSender public immutable fxStateSender;\n WETH9 public immutable l1Weth;\n\n /**\n * @notice Constructs new Adapter.\n * @param _rootChainManager RootChainManager Polygon system helper contract.\n * @param _fxStateSender FxStateSender Polygon system helper contract.\n * @param _l1Weth WETH address on L1.\n */\n constructor(\n IRootChainManager _rootChainManager,\n IFxStateSender _fxStateSender,\n WETH9 _l1Weth\n ) {\n rootChainManager = _rootChainManager;\n fxStateSender = _fxStateSender;\n l1Weth = _l1Weth;\n }\n\n /**\n * @notice Send cross-chain message to target on Polygon.\n * @param target Contract on Polygon that will receive message.\n * @param message Data to send to target.\n */\n\n function relayMessage(address target, bytes memory message) external payable override {\n fxStateSender.sendMessageToChild(target, message);\n emit MessageRelayed(target, message);\n }\n\n /**\n * @notice Bridge tokens to Polygon.\n * @param l1Token L1 token to deposit.\n * @param l2Token L2 token to receive.\n * @param amount Amount of L1 tokens to deposit and L2 tokens to receive.\n * @param to Bridge recipient.\n */\n function relayTokens(\n address l1Token,\n address l2Token,\n uint256 amount,\n address to\n ) external payable override {\n // If the l1Token is weth then unwrap it to ETH then send the ETH to the standard bridge.\n if (l1Token == address(l1Weth)) {\n l1Weth.withdraw(amount);\n rootChainManager.depositEtherFor{ value: amount }(to);\n } else {\n IERC20(l1Token).safeIncreaseAllowance(address(rootChainManager), amount);\n rootChainManager.depositFor(to, l1Token, abi.encode(amount));\n }\n emit TokensRelayed(l1Token, l2Token, amount, to);\n }\n}\n" }, "contracts/chain-adapters/Mock_Adapter.sol": { "content": "// SPDX-License-Identifier: AGPL-3.0-only\npragma solidity ^0.8.0;\n\nimport \"../interfaces/AdapterInterface.sol\";\nimport \"@openzeppelin/contracts/token/ERC20/IERC20.sol\";\n\n/**\n * @notice Contract used for testing communication between HubPool and Adapter.\n */\ncontract Mock_Adapter is AdapterInterface {\n event RelayMessageCalled(address target, bytes message, address caller);\n\n event RelayTokensCalled(address l1Token, address l2Token, uint256 amount, address to, address caller);\n\n Mock_Bridge public immutable bridge;\n\n constructor() {\n bridge = new Mock_Bridge();\n }\n\n function relayMessage(address target, bytes memory message) external payable override {\n bridge.bridgeMessage(target, message);\n emit RelayMessageCalled(target, message, msg.sender);\n }\n\n function relayTokens(\n address l1Token,\n address l2Token,\n uint256 amount,\n address to\n ) external payable override {\n IERC20(l1Token).approve(address(bridge), amount);\n bridge.bridgeTokens(l1Token, amount);\n emit RelayTokensCalled(l1Token, l2Token, amount, to, msg.sender);\n }\n}\n\n// This contract is intended to \"act like\" a simple version of an L2 bridge.\n// It's primarily meant to better reflect how a true L2 bridge interaction might work to give better gas estimates.\ncontract Mock_Bridge {\n event BridgedTokens(address token, uint256 amount);\n event BridgedMessage(address target, bytes message);\n\n mapping(address => uint256) deposits;\n\n function bridgeTokens(address token, uint256 amount) public {\n IERC20(token).transferFrom(msg.sender, address(this), amount);\n deposits[token] += amount;\n emit BridgedTokens(token, amount);\n }\n\n function bridgeMessage(address target, bytes memory message) public {\n emit BridgedMessage(target, message);\n }\n}\n" }, + "contracts/chain-adapters/Ethereum_Adapter.sol": { + "content": "// SPDX-License-Identifier: AGPL-3.0-only\npragma solidity ^0.8.0;\n\nimport \"../interfaces/AdapterInterface.sol\";\n\nimport \"@openzeppelin/contracts/token/ERC20/IERC20.sol\";\nimport \"@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol\";\n\n/**\n * @notice Contract containing logic to send messages from L1 to Ethereum SpokePool.\n * @notice This contract should always be deployed on the same chain as the HubPool, as it acts as a pass-through\n * contract between HubPool and SpokePool on the same chain. Its named \"Ethereum_Adapter\" because a core assumption\n * is that the HubPool will be deployed on Ethereum, so this adapter will be used to communicate between HubPool\n * and the Ethereum_SpokePool.\n * @dev Public functions calling external contracts do not guard against reentrancy because they are expected to be\n * called via delegatecall, which will execute this contract's logic within the context of the originating contract.\n * For example, the HubPool will delegatecall these functions, therefore its only necessary that the HubPool's methods\n * that call this contract's logic guard against reentrancy.\n */\ncontract Ethereum_Adapter is AdapterInterface {\n using SafeERC20 for IERC20;\n\n /**\n * @notice Send message to target on Ethereum.\n * @notice This function, and contract overall, is not useful in practice except that the HubPool\n * expects to interact with the SpokePool via an Adapter, so when communicating to the Ethereum_SpokePool, it must\n * send messages via this pass-through contract.\n * @param target Contract that will receive message.\n * @param message Data to send to target.\n */\n function relayMessage(address target, bytes memory message) external payable override {\n _executeCall(target, message);\n emit MessageRelayed(target, message);\n }\n\n /**\n * @notice Send tokens to target.\n * @param l1Token L1 token to send.\n * @param l2Token Unused parameter in this contract.\n * @param amount Amount of L1 tokens to send.\n * @param to recipient.\n */\n function relayTokens(\n address l1Token,\n address l2Token, // l2Token is unused for ethereum since we are assuming that the HubPool is only deployed\n // on this network.\n uint256 amount,\n address to\n ) external payable override {\n IERC20(l1Token).safeTransfer(to, amount);\n emit TokensRelayed(l1Token, l2Token, amount, to);\n }\n\n // Note: this snippet of code is copied from Governor.sol. Source: https://github.com/UMAprotocol/protocol/blob/5b37ea818a28479c01e458389a83c3e736306b17/packages/core/contracts/oracle/implementation/Governor.sol#L190-L207\n function _executeCall(address to, bytes memory data) private {\n // Note: this snippet of code is copied from Governor.sol and modified to not include any \"value\" field.\n // solhint-disable-next-line no-inline-assembly\n\n bool success;\n assembly {\n let inputData := add(data, 0x20)\n let inputDataSize := mload(data)\n // Hardcode value to be 0 for relayed governance calls in order to avoid addressing complexity of bridging\n // value cross-chain.\n success := call(gas(), to, 0, inputData, inputDataSize, 0, 0)\n }\n require(success, \"execute call failed\");\n }\n}\n" + }, "contracts/chain-adapters/Arbitrum_Adapter.sol": { - "content": "// SPDX-License-Identifier: AGPL-3.0-only\npragma solidity ^0.8.0;\n\nimport \"../interfaces/AdapterInterface.sol\";\nimport \"../interfaces/AdapterInterface.sol\";\nimport \"../interfaces/WETH9.sol\";\n\nimport \"@openzeppelin/contracts/token/ERC20/IERC20.sol\";\n\ninterface ArbitrumL1InboxLike {\n function createRetryableTicket(\n address destAddr,\n uint256 arbTxCallValue,\n uint256 maxSubmissionCost,\n address submissionRefundAddress,\n address valueRefundAddress,\n uint256 maxGas,\n uint256 gasPriceBid,\n bytes calldata data\n ) external payable returns (uint256);\n}\n\ninterface ArbitrumL1ERC20GatewayLike {\n function outboundTransfer(\n address _token,\n address _to,\n uint256 _amount,\n uint256 _maxGas,\n uint256 _gasPriceBid,\n bytes calldata _data\n ) external payable returns (bytes memory);\n}\n\n/**\n * @notice Contract containing logic to send messages from L1 to Arbitrum.\n * @dev Public functions calling external contracts do not guard against reentrancy because they are expected to be\n * called via delegatecall, which will execute this contract's logic within the context of the originating contract.\n * For example, the HubPool will delegatecall these functions, therefore its only neccessary that the HubPool's methods\n * that call this contract's logic guard against reentrancy.\n */\ncontract Arbitrum_Adapter is AdapterInterface {\n // Gas limit for immediate L2 execution attempt (can be estimated via NodeInterface.estimateRetryableTicket).\n // NodeInterface precompile interface exists at L2 address 0x00000000000000000000000000000000000000C8\n uint32 public immutable l2GasLimit = 5_000_000;\n\n // Amount of ETH allocated to pay for the base submission fee. The base submission fee is a parameter unique to\n // retryable transactions; the user is charged the base submission fee to cover the storage costs of keeping their\n // ticket’s calldata in the retry buffer. (current base submission fee is queryable via\n // ArbRetryableTx.getSubmissionPrice). ArbRetryableTicket precompile interface exists at L2 address\n // 0x000000000000000000000000000000000000006E.\n uint256 public immutable l2MaxSubmissionCost = 0.1e18;\n\n // L2 Gas price bid for immediate L2 execution attempt (queryable via standard eth*gasPrice RPC)\n uint256 public immutable l2GasPrice = 10e9; // 10 gWei\n\n // This address on L2 receives extra ETH that is left over after relaying a message via the inbox.\n address public immutable l2RefundL2Address;\n\n ArbitrumL1InboxLike public immutable l1Inbox;\n\n ArbitrumL1ERC20GatewayLike public immutable l1ERC20Gateway;\n\n event L2GasLimitSet(uint32 newL2GasLimit);\n\n event L2MaxSubmissionCostSet(uint256 newL2MaxSubmissionCost);\n\n event L2GasPriceSet(uint256 newL2GasPrice);\n\n event L2RefundL2AddressSet(address newL2RefundL2Address);\n\n /**\n * @notice Constructs new Adapter.\n * @param _l1ArbitrumInbox Inbox helper contract to send messages to Arbitrum.\n * @param _l1ERC20Gateway ERC20 gateway contract to send tokens to Arbitrum.\n */\n constructor(ArbitrumL1InboxLike _l1ArbitrumInbox, ArbitrumL1ERC20GatewayLike _l1ERC20Gateway) {\n l1Inbox = _l1ArbitrumInbox;\n l1ERC20Gateway = _l1ERC20Gateway;\n\n l2RefundL2Address = msg.sender;\n }\n\n /**\n * @notice Send cross-chain message to target on Arbitrum.\n * @notice This contract must hold at least getL1CallValue() amount of ETH to send a message via the Inbox\n * successfully, or the message will get stuck.\n * @param target Contract on Arbitrum that will receive message.\n * @param message Data to send to target.\n */\n function relayMessage(address target, bytes memory message) external payable override {\n uint256 requiredL1CallValue = getL1CallValue();\n require(address(this).balance >= requiredL1CallValue, \"Insufficient ETH balance\");\n\n l1Inbox.createRetryableTicket{ value: requiredL1CallValue }(\n target, // destAddr destination L2 contract address\n 0, // l2CallValue call value for retryable L2 message\n l2MaxSubmissionCost, // maxSubmissionCost Max gas deducted from user's L2 balance to cover base fee\n l2RefundL2Address, // excessFeeRefundAddress maxgas * gasprice - execution cost gets credited here on L2\n l2RefundL2Address, // callValueRefundAddress l2Callvalue gets credited here on L2 if retryable txn times out or gets cancelled\n l2GasLimit, // maxGas Max gas deducted from user's L2 balance to cover L2 execution\n l2GasPrice, // gasPriceBid price bid for L2 execution\n message // data ABI encoded data of L2 message\n );\n\n emit MessageRelayed(target, message);\n }\n\n /**\n * @notice Bridge tokens to Arbitrum.\n * @param l1Token L1 token to deposit.\n * @param l2Token L2 token to receive.\n * @param amount Amount of L1 tokens to deposit and L2 tokens to receive.\n * @param to Bridge recipient.\n */\n function relayTokens(\n address l1Token,\n address l2Token, // l2Token is unused for Arbitrum.\n uint256 amount,\n address to\n ) external payable override {\n l1ERC20Gateway.outboundTransfer(l1Token, to, amount, l2GasLimit, l2GasPrice, \"\");\n emit TokensRelayed(l1Token, l2Token, amount, to);\n }\n\n /**\n * @notice Returns required amount of ETH to send a message via the Inbox.\n * @return amount of ETH that this contract needs to hold in order for relayMessage to succeed.\n */\n function getL1CallValue() public pure returns (uint256) {\n return l2MaxSubmissionCost + l2GasPrice * l2GasLimit;\n }\n}\n" + "content": "// SPDX-License-Identifier: AGPL-3.0-only\npragma solidity ^0.8.0;\n\nimport \"../interfaces/AdapterInterface.sol\";\n\ninterface ArbitrumL1InboxLike {\n function createRetryableTicket(\n address destAddr,\n uint256 arbTxCallValue,\n uint256 maxSubmissionCost,\n address submissionRefundAddress,\n address valueRefundAddress,\n uint256 maxGas,\n uint256 gasPriceBid,\n bytes calldata data\n ) external payable returns (uint256);\n}\n\ninterface ArbitrumL1ERC20GatewayLike {\n function outboundTransfer(\n address _token,\n address _to,\n uint256 _amount,\n uint256 _maxGas,\n uint256 _gasPriceBid,\n bytes calldata _data\n ) external payable returns (bytes memory);\n}\n\n/**\n * @notice Contract containing logic to send messages from L1 to Arbitrum.\n * @dev Public functions calling external contracts do not guard against reentrancy because they are expected to be\n * called via delegatecall, which will execute this contract's logic within the context of the originating contract.\n * For example, the HubPool will delegatecall these functions, therefore its only necessary that the HubPool's methods\n * that call this contract's logic guard against reentrancy.\n */\ncontract Arbitrum_Adapter is AdapterInterface {\n // Gas limit for immediate L2 execution attempt (can be estimated via NodeInterface.estimateRetryableTicket).\n // NodeInterface precompile interface exists at L2 address 0x00000000000000000000000000000000000000C8\n uint32 public immutable l2GasLimit = 5_000_000;\n\n // Amount of ETH allocated to pay for the base submission fee. The base submission fee is a parameter unique to\n // retryable transactions; the user is charged the base submission fee to cover the storage costs of keeping their\n // ticket’s calldata in the retry buffer. (current base submission fee is queryable via\n // ArbRetryableTx.getSubmissionPrice). ArbRetryableTicket precompile interface exists at L2 address\n // 0x000000000000000000000000000000000000006E.\n uint256 public immutable l2MaxSubmissionCost = 0.1e18;\n\n // L2 Gas price bid for immediate L2 execution attempt (queryable via standard eth*gasPrice RPC)\n uint256 public immutable l2GasPrice = 10e9; // 10 gWei\n\n // This address on L2 receives extra ETH that is left over after relaying a message via the inbox.\n address public immutable l2RefundL2Address;\n\n ArbitrumL1InboxLike public immutable l1Inbox;\n\n ArbitrumL1ERC20GatewayLike public immutable l1ERC20Gateway;\n\n /**\n * @notice Constructs new Adapter.\n * @param _l1ArbitrumInbox Inbox helper contract to send messages to Arbitrum.\n * @param _l1ERC20Gateway ERC20 gateway contract to send tokens to Arbitrum.\n */\n constructor(ArbitrumL1InboxLike _l1ArbitrumInbox, ArbitrumL1ERC20GatewayLike _l1ERC20Gateway) {\n l1Inbox = _l1ArbitrumInbox;\n l1ERC20Gateway = _l1ERC20Gateway;\n\n l2RefundL2Address = msg.sender;\n }\n\n /**\n * @notice Send cross-chain message to target on Arbitrum.\n * @notice This contract must hold at least getL1CallValue() amount of ETH to send a message via the Inbox\n * successfully, or the message will get stuck.\n * @param target Contract on Arbitrum that will receive message.\n * @param message Data to send to target.\n */\n function relayMessage(address target, bytes memory message) external payable override {\n uint256 requiredL1CallValue = getL1CallValue();\n require(address(this).balance >= requiredL1CallValue, \"Insufficient ETH balance\");\n\n l1Inbox.createRetryableTicket{ value: requiredL1CallValue }(\n target, // destAddr destination L2 contract address\n 0, // l2CallValue call value for retryable L2 message\n l2MaxSubmissionCost, // maxSubmissionCost Max gas deducted from user's L2 balance to cover base fee\n l2RefundL2Address, // excessFeeRefundAddress maxgas * gasprice - execution cost gets credited here on L2\n l2RefundL2Address, // callValueRefundAddress l2Callvalue gets credited here on L2 if retryable txn times out or gets cancelled\n l2GasLimit, // maxGas Max gas deducted from user's L2 balance to cover L2 execution\n l2GasPrice, // gasPriceBid price bid for L2 execution\n message // data ABI encoded data of L2 message\n );\n\n emit MessageRelayed(target, message);\n }\n\n /**\n * @notice Bridge tokens to Arbitrum.\n * @param l1Token L1 token to deposit.\n * @param l2Token L2 token to receive.\n * @param amount Amount of L1 tokens to deposit and L2 tokens to receive.\n * @param to Bridge recipient.\n */\n function relayTokens(\n address l1Token,\n address l2Token, // l2Token is unused for Arbitrum.\n uint256 amount,\n address to\n ) external payable override {\n l1ERC20Gateway.outboundTransfer(l1Token, to, amount, l2GasLimit, l2GasPrice, \"\");\n emit TokensRelayed(l1Token, l2Token, amount, to);\n }\n\n /**\n * @notice Returns required amount of ETH to send a message via the Inbox.\n * @return amount of ETH that this contract needs to hold in order for relayMessage to succeed.\n */\n function getL1CallValue() public pure returns (uint256) {\n return l2MaxSubmissionCost + l2GasPrice * l2GasLimit;\n }\n}\n" }, - "contracts/test/MerkleLibTest.sol": { - "content": "// SPDX-License-Identifier: GPL-3.0-only\npragma solidity ^0.8.0;\n\nimport \"../MerkleLib.sol\";\nimport \"../HubPoolInterface.sol\";\nimport \"../SpokePoolInterface.sol\";\n\n/**\n * @notice Contract to test the MerkleLib.\n */\ncontract MerkleLibTest {\n mapping(uint256 => uint256) public claimedBitMap;\n\n uint256 public claimedBitMap1D;\n\n function verifyPoolRebalance(\n bytes32 root,\n HubPoolInterface.PoolRebalanceLeaf memory rebalance,\n bytes32[] memory proof\n ) public pure returns (bool) {\n return MerkleLib.verifyPoolRebalance(root, rebalance, proof);\n }\n\n function verifyRelayerRefund(\n bytes32 root,\n SpokePoolInterface.RelayerRefundLeaf memory refund,\n bytes32[] memory proof\n ) public pure returns (bool) {\n return MerkleLib.verifyRelayerRefund(root, refund, proof);\n }\n\n function verifySlowRelayFulfillment(\n bytes32 root,\n SpokePoolInterface.RelayData memory slowRelayFulfillment,\n bytes32[] memory proof\n ) public pure returns (bool) {\n return MerkleLib.verifySlowRelayFulfillment(root, slowRelayFulfillment, proof);\n }\n\n function isClaimed(uint256 index) public view returns (bool) {\n return MerkleLib.isClaimed(claimedBitMap, index);\n }\n\n function setClaimed(uint256 index) public {\n MerkleLib.setClaimed(claimedBitMap, index);\n }\n\n function isClaimed1D(uint256 index) public view returns (bool) {\n return MerkleLib.isClaimed1D(claimedBitMap1D, index);\n }\n\n function setClaimed1D(uint256 index) public {\n claimedBitMap1D = MerkleLib.setClaimed1D(claimedBitMap1D, index);\n }\n}\n" + "@openzeppelin/contracts/access/Ownable.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts v4.4.1 (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 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 called by any account other than the owner.\n */\n modifier onlyOwner() {\n require(owner() == _msgSender(), \"Ownable: caller is not the owner\");\n _;\n }\n\n /**\n * @dev Leaves the contract without owner. It will not be possible to call\n * `onlyOwner` functions anymore. Can only be called by the current owner.\n *\n * NOTE: Renouncing ownership will leave the contract without an owner,\n * thereby removing 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" }, - "@uma/core/contracts/oracle/interfaces/SkinnyOptimisticOracleInterface.sol": { - "content": "// SPDX-License-Identifier: AGPL-3.0-only\npragma solidity ^0.8.0;\n\nimport \"@openzeppelin/contracts/token/ERC20/IERC20.sol\";\nimport \"../interfaces/OptimisticOracleInterface.sol\";\n\n/**\n * @title Interface for the gas-cost-reduced version of the OptimisticOracle.\n * @notice Differences from normal OptimisticOracle:\n * - refundOnDispute: flag is removed, by default there are no refunds on disputes.\n * - customizing request parameters: In the OptimisticOracle, parameters like `bond` and `customLiveness` can be reset\n * after a request is already made via `requestPrice`. In the SkinnyOptimisticOracle, these parameters can only be\n * set in `requestPrice`, which has an expanded input set.\n * - settleAndGetPrice: Replaced by `settle`, which can only be called once per settleable request. The resolved price\n * can be fetched via the `Settle` event or the return value of `settle`.\n * - general changes to interface: Functions that interact with existing requests all require the parameters of the\n * request to modify to be passed as input. These parameters must match with the existing request parameters or the\n * function will revert. This change reflects the internal refactor to store hashed request parameters instead of the\n * full request struct.\n * @dev Interface used by financial contracts to interact with the Oracle. Voters will use a different interface.\n */\nabstract contract SkinnyOptimisticOracleInterface {\n // Struct representing a price request. Note that this differs from the OptimisticOracleInterface's Request struct\n // in that refundOnDispute is removed.\n struct Request {\n address proposer; // Address of the proposer.\n address disputer; // Address of the disputer.\n IERC20 currency; // ERC20 token used to pay rewards and fees.\n bool settled; // True if the request is settled.\n int256 proposedPrice; // Price that the proposer submitted.\n int256 resolvedPrice; // Price resolved once the request is settled.\n uint256 expirationTime; // Time at which the request auto-settles without a dispute.\n uint256 reward; // Amount of the currency to pay to the proposer on settlement.\n uint256 finalFee; // Final fee to pay to the Store upon request to the DVM.\n uint256 bond; // Bond that the proposer and disputer must pay on top of the final fee.\n uint256 customLiveness; // Custom liveness value set by the requester.\n }\n\n // This value must be <= the Voting contract's `ancillaryBytesLimit` value otherwise it is possible\n // that a price can be requested to this contract successfully, but cannot be disputed because the DVM refuses\n // to accept a price request made with ancillary data length over a certain size.\n uint256 public constant ancillaryBytesLimit = 8192;\n\n /**\n * @notice Requests a new price.\n * @param identifier price identifier being requested.\n * @param timestamp timestamp of the price being requested.\n * @param ancillaryData ancillary data representing additional args being passed with the price request.\n * @param currency ERC20 token used for payment of rewards and fees. Must be approved for use with the DVM.\n * @param reward reward offered to a successful proposer. Will be pulled from the caller. Note: this can be 0,\n * which could make sense if the contract requests and proposes the value in the same call or\n * provides its own reward system.\n * @param bond custom proposal bond to set for request. If set to 0, defaults to the final fee.\n * @param customLiveness custom proposal liveness to set for request.\n * @return totalBond default bond + final fee that the proposer and disputer will be required to pay.\n */\n function requestPrice(\n bytes32 identifier,\n uint32 timestamp,\n bytes memory ancillaryData,\n IERC20 currency,\n uint256 reward,\n uint256 bond,\n uint256 customLiveness\n ) external virtual returns (uint256 totalBond);\n\n /**\n * @notice Proposes a price value on another address' behalf. Note: this address will receive any rewards that come\n * from this proposal. However, any bonds are pulled from the caller.\n * @param requester sender of the initial price request.\n * @param identifier price identifier to identify the existing request.\n * @param timestamp timestamp to identify the existing request.\n * @param ancillaryData ancillary data of the price being requested.\n * @param request price request parameters whose hash must match the request that the caller wants to\n * propose a price for.\n * @param proposer address to set as the proposer.\n * @param proposedPrice price being proposed.\n * @return totalBond the amount that's pulled from the caller's wallet as a bond. The bond will be returned to\n * the proposer once settled if the proposal is correct.\n */\n function proposePriceFor(\n address requester,\n bytes32 identifier,\n uint32 timestamp,\n bytes memory ancillaryData,\n Request memory request,\n address proposer,\n int256 proposedPrice\n ) public virtual returns (uint256 totalBond);\n\n /**\n * @notice Proposes a price value where caller is the proposer.\n * @param requester sender of the initial price request.\n * @param identifier price identifier to identify the existing request.\n * @param timestamp timestamp to identify the existing request.\n * @param ancillaryData ancillary data of the price being requested.\n * @param request price request parameters whose hash must match the request that the caller wants to\n * propose a price for.\n * @param proposedPrice price being proposed.\n * @return totalBond the amount that's pulled from the caller's wallet as a bond. The bond will be returned to\n * the proposer once settled if the proposal is correct.\n */\n function proposePrice(\n address requester,\n bytes32 identifier,\n uint32 timestamp,\n bytes memory ancillaryData,\n Request memory request,\n int256 proposedPrice\n ) external virtual returns (uint256 totalBond);\n\n /**\n * @notice Combines logic of requestPrice and proposePrice while taking advantage of gas savings from not having to\n * overwrite Request params that a normal requestPrice() => proposePrice() flow would entail. Note: The proposer\n * will receive any rewards that come from this proposal. However, any bonds are pulled from the caller.\n * @dev The caller is the requester, but the proposer can be customized.\n * @param identifier price identifier to identify the existing request.\n * @param timestamp timestamp to identify the existing request.\n * @param ancillaryData ancillary data of the price being requested.\n * @param currency ERC20 token used for payment of rewards and fees. Must be approved for use with the DVM.\n * @param reward reward offered to a successful proposer. Will be pulled from the caller. Note: this can be 0,\n * which could make sense if the contract requests and proposes the value in the same call or\n * provides its own reward system.\n * @param bond custom proposal bond to set for request. If set to 0, defaults to the final fee.\n * @param customLiveness custom proposal liveness to set for request.\n * @param proposer address to set as the proposer.\n * @param proposedPrice price being proposed.\n * @return totalBond the amount that's pulled from the caller's wallet as a bond. The bond will be returned to\n * the proposer once settled if the proposal is correct.\n */\n function requestAndProposePriceFor(\n bytes32 identifier,\n uint32 timestamp,\n bytes memory ancillaryData,\n IERC20 currency,\n uint256 reward,\n uint256 bond,\n uint256 customLiveness,\n address proposer,\n int256 proposedPrice\n ) external virtual returns (uint256 totalBond);\n\n /**\n * @notice Disputes a price request with an active proposal on another address' behalf. Note: this address will\n * receive any rewards that come from this dispute. However, any bonds are pulled from the caller.\n * @param identifier price identifier to identify the existing request.\n * @param timestamp timestamp to identify the existing request.\n * @param ancillaryData ancillary data of the price being requested.\n * @param request price request parameters whose hash must match the request that the caller wants to\n * dispute.\n * @param disputer address to set as the disputer.\n * @param requester sender of the initial price request.\n * @return totalBond the amount that's pulled from the caller's wallet as a bond. The bond will be returned to\n * the disputer once settled if the dispute was valid (the proposal was incorrect).\n */\n function disputePriceFor(\n bytes32 identifier,\n uint32 timestamp,\n bytes memory ancillaryData,\n Request memory request,\n address disputer,\n address requester\n ) public virtual returns (uint256 totalBond);\n\n /**\n * @notice Disputes a price request with an active proposal where caller is the disputer.\n * @param requester sender of the initial price request.\n * @param identifier price identifier to identify the existing request.\n * @param timestamp timestamp to identify the existing request.\n * @param ancillaryData ancillary data of the price being requested.\n * @param request price request parameters whose hash must match the request that the caller wants to\n * dispute.\n * @return totalBond the amount that's pulled from the caller's wallet as a bond. The bond will be returned to\n * the disputer once settled if the dispute was valid (the proposal was incorrect).\n */\n function disputePrice(\n address requester,\n bytes32 identifier,\n uint32 timestamp,\n bytes memory ancillaryData,\n Request memory request\n ) external virtual returns (uint256 totalBond);\n\n /**\n * @notice Attempts to settle an outstanding price request. Will revert if it isn't settleable.\n * @param requester sender of the initial price request.\n * @param identifier price identifier to identify the existing request.\n * @param timestamp timestamp to identify the existing request.\n * @param ancillaryData ancillary data of the price being requested.\n * @param request price request parameters whose hash must match the request that the caller wants to\n * settle.\n * @return payout the amount that the \"winner\" (proposer or disputer) receives on settlement. This amount includes\n * the returned bonds as well as additional rewards.\n * @return resolvedPrice the price that the request settled to.\n */\n function settle(\n address requester,\n bytes32 identifier,\n uint32 timestamp,\n bytes memory ancillaryData,\n Request memory request\n ) external virtual returns (uint256 payout, int256 resolvedPrice);\n\n /**\n * @notice Computes the current state of a price request. See the State enum for more details.\n * @param requester sender of the initial price request.\n * @param identifier price identifier to identify the existing request.\n * @param timestamp timestamp to identify the existing request.\n * @param ancillaryData ancillary data of the price being requested.\n * @param request price request parameters.\n * @return the State.\n */\n function getState(\n address requester,\n bytes32 identifier,\n uint32 timestamp,\n bytes memory ancillaryData,\n Request memory request\n ) external virtual returns (OptimisticOracleInterface.State);\n\n /**\n * @notice Checks if a given request has resolved, expired or been settled (i.e the optimistic oracle has a price).\n * @param requester sender of the initial price request.\n * @param identifier price identifier to identify the existing request.\n * @param timestamp timestamp to identify the existing request.\n * @param ancillaryData ancillary data of the price being requested.\n * @param request price request parameters. The hash of these parameters must match with the request hash that is\n * associated with the price request unique ID {requester, identifier, timestamp, ancillaryData}, or this method\n * will revert.\n * @return boolean indicating true if price exists and false if not.\n */\n function hasPrice(\n address requester,\n bytes32 identifier,\n uint32 timestamp,\n bytes memory ancillaryData,\n Request memory request\n ) public virtual returns (bool);\n\n /**\n * @notice Generates stamped ancillary data in the format that it would be used in the case of a price dispute.\n * @param ancillaryData ancillary data of the price being requested.\n * @param requester sender of the initial price request.\n * @return the stamped ancillary bytes.\n */\n function stampAncillaryData(bytes memory ancillaryData, address requester)\n public\n pure\n virtual\n returns (bytes memory);\n}\n" + "contracts/Ethereum_SpokePool.sol": { + "content": "// SPDX-License-Identifier: GPL-3.0-only\npragma solidity ^0.8.0;\n\nimport \"./SpokePool.sol\";\nimport \"@openzeppelin/contracts/access/Ownable.sol\";\n\n/**\n * @notice Ethereum L1 specific SpokePool. Used on Ethereum L1 to facilitate L2->L1 transfers.\n */\ncontract Ethereum_SpokePool is SpokePool, Ownable {\n /**\n * @notice Construct the Ethereum SpokePool.\n * @param _hubPool Hub pool address to set. Can be changed by admin.\n * @param _wethAddress Weth address for this network to set.\n * @param timerAddress Timer address to set.\n */\n constructor(\n address _hubPool,\n address _wethAddress,\n address timerAddress\n ) SpokePool(msg.sender, _hubPool, _wethAddress, timerAddress) {}\n\n /**************************************\n * INTERNAL FUNCTIONS *\n **************************************/\n\n function _bridgeTokensToHubPool(RelayerRefundLeaf memory relayerRefundLeaf) internal override {\n IERC20(relayerRefundLeaf.l2TokenAddress).transfer(hubPool, relayerRefundLeaf.amountToReturn);\n }\n\n // Admin is simply owner which should be same account that owns the HubPool deployed on this network. A core\n // assumption of this contract system is that the HubPool is deployed on Ethereum.\n function _requireAdminSender() internal override onlyOwner {}\n}\n" }, "@uma/core/contracts/oracle/interfaces/OptimisticOracleInterface.sol": { "content": "// SPDX-License-Identifier: AGPL-3.0-only\npragma solidity ^0.8.0;\n\nimport \"@openzeppelin/contracts/token/ERC20/IERC20.sol\";\n\n/**\n * @title Financial contract facing Oracle interface.\n * @dev Interface used by financial contracts to interact with the Oracle. Voters will use a different interface.\n */\nabstract contract OptimisticOracleInterface {\n // Struct representing the state of a price request.\n enum State {\n Invalid, // Never requested.\n Requested, // Requested, no other actions taken.\n Proposed, // Proposed, but not expired or disputed yet.\n Expired, // Proposed, not disputed, past liveness.\n Disputed, // Disputed, but no DVM price returned yet.\n Resolved, // Disputed and DVM price is available.\n Settled // Final price has been set in the contract (can get here from Expired or Resolved).\n }\n\n // Struct representing a price request.\n struct Request {\n address proposer; // Address of the proposer.\n address disputer; // Address of the disputer.\n IERC20 currency; // ERC20 token used to pay rewards and fees.\n bool settled; // True if the request is settled.\n bool refundOnDispute; // True if the requester should be refunded their reward on dispute.\n int256 proposedPrice; // Price that the proposer submitted.\n int256 resolvedPrice; // Price resolved once the request is settled.\n uint256 expirationTime; // Time at which the request auto-settles without a dispute.\n uint256 reward; // Amount of the currency to pay to the proposer on settlement.\n uint256 finalFee; // Final fee to pay to the Store upon request to the DVM.\n uint256 bond; // Bond that the proposer and disputer must pay on top of the final fee.\n uint256 customLiveness; // Custom liveness value set by the requester.\n }\n\n // This value must be <= the Voting contract's `ancillaryBytesLimit` value otherwise it is possible\n // that a price can be requested to this contract successfully, but cannot be disputed because the DVM refuses\n // to accept a price request made with ancillary data length over a certain size.\n uint256 public constant ancillaryBytesLimit = 8192;\n\n /**\n * @notice Requests a new price.\n * @param identifier price identifier being requested.\n * @param timestamp timestamp of the price being requested.\n * @param ancillaryData ancillary data representing additional args being passed with the price request.\n * @param currency ERC20 token used for payment of rewards and fees. Must be approved for use with the DVM.\n * @param reward reward offered to a successful proposer. Will be pulled from the caller. Note: this can be 0,\n * which could make sense if the contract requests and proposes the value in the same call or\n * provides its own reward system.\n * @return totalBond default bond (final fee) + final fee that the proposer and disputer will be required to pay.\n * This can be changed with a subsequent call to setBond().\n */\n function requestPrice(\n bytes32 identifier,\n uint256 timestamp,\n bytes memory ancillaryData,\n IERC20 currency,\n uint256 reward\n ) external virtual returns (uint256 totalBond);\n\n /**\n * @notice Set the proposal bond associated with a price request.\n * @param identifier price identifier to identify the existing request.\n * @param timestamp timestamp to identify the existing request.\n * @param ancillaryData ancillary data of the price being requested.\n * @param bond custom bond amount to set.\n * @return totalBond new bond + final fee that the proposer and disputer will be required to pay. This can be\n * changed again with a subsequent call to setBond().\n */\n function setBond(\n bytes32 identifier,\n uint256 timestamp,\n bytes memory ancillaryData,\n uint256 bond\n ) external virtual returns (uint256 totalBond);\n\n /**\n * @notice Sets the request to refund the reward if the proposal is disputed. This can help to \"hedge\" the caller\n * in the event of a dispute-caused delay. Note: in the event of a dispute, the winner still receives the other's\n * bond, so there is still profit to be made even if the reward is refunded.\n * @param identifier price identifier to identify the existing request.\n * @param timestamp timestamp to identify the existing request.\n * @param ancillaryData ancillary data of the price being requested.\n */\n function setRefundOnDispute(\n bytes32 identifier,\n uint256 timestamp,\n bytes memory ancillaryData\n ) external virtual;\n\n /**\n * @notice Sets a custom liveness value for the request. Liveness is the amount of time a proposal must wait before\n * being auto-resolved.\n * @param identifier price identifier to identify the existing request.\n * @param timestamp timestamp to identify the existing request.\n * @param ancillaryData ancillary data of the price being requested.\n * @param customLiveness new custom liveness.\n */\n function setCustomLiveness(\n bytes32 identifier,\n uint256 timestamp,\n bytes memory ancillaryData,\n uint256 customLiveness\n ) external virtual;\n\n /**\n * @notice Proposes a price value on another address' behalf. Note: this address will receive any rewards that come\n * from this proposal. However, any bonds are pulled from the caller.\n * @param proposer address to set as the proposer.\n * @param requester sender of the initial price request.\n * @param identifier price identifier to identify the existing request.\n * @param timestamp timestamp to identify the existing request.\n * @param ancillaryData ancillary data of the price being requested.\n * @param proposedPrice price being proposed.\n * @return totalBond the amount that's pulled from the caller's wallet as a bond. The bond will be returned to\n * the proposer once settled if the proposal is correct.\n */\n function proposePriceFor(\n address proposer,\n address requester,\n bytes32 identifier,\n uint256 timestamp,\n bytes memory ancillaryData,\n int256 proposedPrice\n ) public virtual returns (uint256 totalBond);\n\n /**\n * @notice Proposes a price value for an existing price request.\n * @param requester sender of the initial price request.\n * @param identifier price identifier to identify the existing request.\n * @param timestamp timestamp to identify the existing request.\n * @param ancillaryData ancillary data of the price being requested.\n * @param proposedPrice price being proposed.\n * @return totalBond the amount that's pulled from the proposer's wallet as a bond. The bond will be returned to\n * the proposer once settled if the proposal is correct.\n */\n function proposePrice(\n address requester,\n bytes32 identifier,\n uint256 timestamp,\n bytes memory ancillaryData,\n int256 proposedPrice\n ) external virtual returns (uint256 totalBond);\n\n /**\n * @notice Disputes a price request with an active proposal on another address' behalf. Note: this address will\n * receive any rewards that come from this dispute. However, any bonds are pulled from the caller.\n * @param disputer address to set as the disputer.\n * @param requester sender of the initial price request.\n * @param identifier price identifier to identify the existing request.\n * @param timestamp timestamp to identify the existing request.\n * @param ancillaryData ancillary data of the price being requested.\n * @return totalBond the amount that's pulled from the caller's wallet as a bond. The bond will be returned to\n * the disputer once settled if the dispute was value (the proposal was incorrect).\n */\n function disputePriceFor(\n address disputer,\n address requester,\n bytes32 identifier,\n uint256 timestamp,\n bytes memory ancillaryData\n ) public virtual returns (uint256 totalBond);\n\n /**\n * @notice Disputes a price value for an existing price request with an active proposal.\n * @param requester sender of the initial price request.\n * @param identifier price identifier to identify the existing request.\n * @param timestamp timestamp to identify the existing request.\n * @param ancillaryData ancillary data of the price being requested.\n * @return totalBond the amount that's pulled from the disputer's wallet as a bond. The bond will be returned to\n * the disputer once settled if the dispute was valid (the proposal was incorrect).\n */\n function disputePrice(\n address requester,\n bytes32 identifier,\n uint256 timestamp,\n bytes memory ancillaryData\n ) external virtual returns (uint256 totalBond);\n\n /**\n * @notice Retrieves a price that was previously requested by a caller. Reverts if the request is not settled\n * or settleable. Note: this method is not view so that this call may actually settle the price request if it\n * hasn't been settled.\n * @param identifier price identifier to identify the existing request.\n * @param timestamp timestamp to identify the existing request.\n * @param ancillaryData ancillary data of the price being requested.\n * @return resolved price.\n */\n function settleAndGetPrice(\n bytes32 identifier,\n uint256 timestamp,\n bytes memory ancillaryData\n ) external virtual returns (int256);\n\n /**\n * @notice Attempts to settle an outstanding price request. Will revert if it isn't settleable.\n * @param requester sender of the initial price request.\n * @param identifier price identifier to identify the existing request.\n * @param timestamp timestamp to identify the existing request.\n * @param ancillaryData ancillary data of the price being requested.\n * @return payout the amount that the \"winner\" (proposer or disputer) receives on settlement. This amount includes\n * the returned bonds as well as additional rewards.\n */\n function settle(\n address requester,\n bytes32 identifier,\n uint256 timestamp,\n bytes memory ancillaryData\n ) external virtual returns (uint256 payout);\n\n /**\n * @notice Gets the current data structure containing all information about a price request.\n * @param requester sender of the initial price request.\n * @param identifier price identifier to identify the existing request.\n * @param timestamp timestamp to identify the existing request.\n * @param ancillaryData ancillary data of the price being requested.\n * @return the Request data structure.\n */\n function getRequest(\n address requester,\n bytes32 identifier,\n uint256 timestamp,\n bytes memory ancillaryData\n ) public view virtual returns (Request memory);\n\n /**\n * @notice Returns the state of a price request.\n * @param requester sender of the initial price request.\n * @param identifier price identifier to identify the existing request.\n * @param timestamp timestamp to identify the existing request.\n * @param ancillaryData ancillary data of the price being requested.\n * @return the State enum value.\n */\n function getState(\n address requester,\n bytes32 identifier,\n uint256 timestamp,\n bytes memory ancillaryData\n ) public view virtual returns (State);\n\n /**\n * @notice Checks if a given request has resolved or been settled (i.e the optimistic oracle has a price).\n * @param requester sender of the initial price request.\n * @param identifier price identifier to identify the existing request.\n * @param timestamp timestamp to identify the existing request.\n * @param ancillaryData ancillary data of the price being requested.\n * @return true if price has resolved or settled, false otherwise.\n */\n function hasPrice(\n address requester,\n bytes32 identifier,\n uint256 timestamp,\n bytes memory ancillaryData\n ) public view virtual returns (bool);\n\n function stampAncillaryData(bytes memory ancillaryData, address requester)\n public\n view\n virtual\n returns (bytes memory);\n}\n" }, + "@uma/core/contracts/oracle/interfaces/SkinnyOptimisticOracleInterface.sol": { + "content": "// SPDX-License-Identifier: AGPL-3.0-only\npragma solidity ^0.8.0;\n\nimport \"@openzeppelin/contracts/token/ERC20/IERC20.sol\";\nimport \"../interfaces/OptimisticOracleInterface.sol\";\n\n/**\n * @title Interface for the gas-cost-reduced version of the OptimisticOracle.\n * @notice Differences from normal OptimisticOracle:\n * - refundOnDispute: flag is removed, by default there are no refunds on disputes.\n * - customizing request parameters: In the OptimisticOracle, parameters like `bond` and `customLiveness` can be reset\n * after a request is already made via `requestPrice`. In the SkinnyOptimisticOracle, these parameters can only be\n * set in `requestPrice`, which has an expanded input set.\n * - settleAndGetPrice: Replaced by `settle`, which can only be called once per settleable request. The resolved price\n * can be fetched via the `Settle` event or the return value of `settle`.\n * - general changes to interface: Functions that interact with existing requests all require the parameters of the\n * request to modify to be passed as input. These parameters must match with the existing request parameters or the\n * function will revert. This change reflects the internal refactor to store hashed request parameters instead of the\n * full request struct.\n * @dev Interface used by financial contracts to interact with the Oracle. Voters will use a different interface.\n */\nabstract contract SkinnyOptimisticOracleInterface {\n // Struct representing a price request. Note that this differs from the OptimisticOracleInterface's Request struct\n // in that refundOnDispute is removed.\n struct Request {\n address proposer; // Address of the proposer.\n address disputer; // Address of the disputer.\n IERC20 currency; // ERC20 token used to pay rewards and fees.\n bool settled; // True if the request is settled.\n int256 proposedPrice; // Price that the proposer submitted.\n int256 resolvedPrice; // Price resolved once the request is settled.\n uint256 expirationTime; // Time at which the request auto-settles without a dispute.\n uint256 reward; // Amount of the currency to pay to the proposer on settlement.\n uint256 finalFee; // Final fee to pay to the Store upon request to the DVM.\n uint256 bond; // Bond that the proposer and disputer must pay on top of the final fee.\n uint256 customLiveness; // Custom liveness value set by the requester.\n }\n\n // This value must be <= the Voting contract's `ancillaryBytesLimit` value otherwise it is possible\n // that a price can be requested to this contract successfully, but cannot be disputed because the DVM refuses\n // to accept a price request made with ancillary data length over a certain size.\n uint256 public constant ancillaryBytesLimit = 8192;\n\n /**\n * @notice Requests a new price.\n * @param identifier price identifier being requested.\n * @param timestamp timestamp of the price being requested.\n * @param ancillaryData ancillary data representing additional args being passed with the price request.\n * @param currency ERC20 token used for payment of rewards and fees. Must be approved for use with the DVM.\n * @param reward reward offered to a successful proposer. Will be pulled from the caller. Note: this can be 0,\n * which could make sense if the contract requests and proposes the value in the same call or\n * provides its own reward system.\n * @param bond custom proposal bond to set for request. If set to 0, defaults to the final fee.\n * @param customLiveness custom proposal liveness to set for request.\n * @return totalBond default bond + final fee that the proposer and disputer will be required to pay.\n */\n function requestPrice(\n bytes32 identifier,\n uint32 timestamp,\n bytes memory ancillaryData,\n IERC20 currency,\n uint256 reward,\n uint256 bond,\n uint256 customLiveness\n ) external virtual returns (uint256 totalBond);\n\n /**\n * @notice Proposes a price value on another address' behalf. Note: this address will receive any rewards that come\n * from this proposal. However, any bonds are pulled from the caller.\n * @param requester sender of the initial price request.\n * @param identifier price identifier to identify the existing request.\n * @param timestamp timestamp to identify the existing request.\n * @param ancillaryData ancillary data of the price being requested.\n * @param request price request parameters whose hash must match the request that the caller wants to\n * propose a price for.\n * @param proposer address to set as the proposer.\n * @param proposedPrice price being proposed.\n * @return totalBond the amount that's pulled from the caller's wallet as a bond. The bond will be returned to\n * the proposer once settled if the proposal is correct.\n */\n function proposePriceFor(\n address requester,\n bytes32 identifier,\n uint32 timestamp,\n bytes memory ancillaryData,\n Request memory request,\n address proposer,\n int256 proposedPrice\n ) public virtual returns (uint256 totalBond);\n\n /**\n * @notice Proposes a price value where caller is the proposer.\n * @param requester sender of the initial price request.\n * @param identifier price identifier to identify the existing request.\n * @param timestamp timestamp to identify the existing request.\n * @param ancillaryData ancillary data of the price being requested.\n * @param request price request parameters whose hash must match the request that the caller wants to\n * propose a price for.\n * @param proposedPrice price being proposed.\n * @return totalBond the amount that's pulled from the caller's wallet as a bond. The bond will be returned to\n * the proposer once settled if the proposal is correct.\n */\n function proposePrice(\n address requester,\n bytes32 identifier,\n uint32 timestamp,\n bytes memory ancillaryData,\n Request memory request,\n int256 proposedPrice\n ) external virtual returns (uint256 totalBond);\n\n /**\n * @notice Combines logic of requestPrice and proposePrice while taking advantage of gas savings from not having to\n * overwrite Request params that a normal requestPrice() => proposePrice() flow would entail. Note: The proposer\n * will receive any rewards that come from this proposal. However, any bonds are pulled from the caller.\n * @dev The caller is the requester, but the proposer can be customized.\n * @param identifier price identifier to identify the existing request.\n * @param timestamp timestamp to identify the existing request.\n * @param ancillaryData ancillary data of the price being requested.\n * @param currency ERC20 token used for payment of rewards and fees. Must be approved for use with the DVM.\n * @param reward reward offered to a successful proposer. Will be pulled from the caller. Note: this can be 0,\n * which could make sense if the contract requests and proposes the value in the same call or\n * provides its own reward system.\n * @param bond custom proposal bond to set for request. If set to 0, defaults to the final fee.\n * @param customLiveness custom proposal liveness to set for request.\n * @param proposer address to set as the proposer.\n * @param proposedPrice price being proposed.\n * @return totalBond the amount that's pulled from the caller's wallet as a bond. The bond will be returned to\n * the proposer once settled if the proposal is correct.\n */\n function requestAndProposePriceFor(\n bytes32 identifier,\n uint32 timestamp,\n bytes memory ancillaryData,\n IERC20 currency,\n uint256 reward,\n uint256 bond,\n uint256 customLiveness,\n address proposer,\n int256 proposedPrice\n ) external virtual returns (uint256 totalBond);\n\n /**\n * @notice Disputes a price request with an active proposal on another address' behalf. Note: this address will\n * receive any rewards that come from this dispute. However, any bonds are pulled from the caller.\n * @param identifier price identifier to identify the existing request.\n * @param timestamp timestamp to identify the existing request.\n * @param ancillaryData ancillary data of the price being requested.\n * @param request price request parameters whose hash must match the request that the caller wants to\n * dispute.\n * @param disputer address to set as the disputer.\n * @param requester sender of the initial price request.\n * @return totalBond the amount that's pulled from the caller's wallet as a bond. The bond will be returned to\n * the disputer once settled if the dispute was valid (the proposal was incorrect).\n */\n function disputePriceFor(\n bytes32 identifier,\n uint32 timestamp,\n bytes memory ancillaryData,\n Request memory request,\n address disputer,\n address requester\n ) public virtual returns (uint256 totalBond);\n\n /**\n * @notice Disputes a price request with an active proposal where caller is the disputer.\n * @param requester sender of the initial price request.\n * @param identifier price identifier to identify the existing request.\n * @param timestamp timestamp to identify the existing request.\n * @param ancillaryData ancillary data of the price being requested.\n * @param request price request parameters whose hash must match the request that the caller wants to\n * dispute.\n * @return totalBond the amount that's pulled from the caller's wallet as a bond. The bond will be returned to\n * the disputer once settled if the dispute was valid (the proposal was incorrect).\n */\n function disputePrice(\n address requester,\n bytes32 identifier,\n uint32 timestamp,\n bytes memory ancillaryData,\n Request memory request\n ) external virtual returns (uint256 totalBond);\n\n /**\n * @notice Attempts to settle an outstanding price request. Will revert if it isn't settleable.\n * @param requester sender of the initial price request.\n * @param identifier price identifier to identify the existing request.\n * @param timestamp timestamp to identify the existing request.\n * @param ancillaryData ancillary data of the price being requested.\n * @param request price request parameters whose hash must match the request that the caller wants to\n * settle.\n * @return payout the amount that the \"winner\" (proposer or disputer) receives on settlement. This amount includes\n * the returned bonds as well as additional rewards.\n * @return resolvedPrice the price that the request settled to.\n */\n function settle(\n address requester,\n bytes32 identifier,\n uint32 timestamp,\n bytes memory ancillaryData,\n Request memory request\n ) external virtual returns (uint256 payout, int256 resolvedPrice);\n\n /**\n * @notice Computes the current state of a price request. See the State enum for more details.\n * @param requester sender of the initial price request.\n * @param identifier price identifier to identify the existing request.\n * @param timestamp timestamp to identify the existing request.\n * @param ancillaryData ancillary data of the price being requested.\n * @param request price request parameters.\n * @return the State.\n */\n function getState(\n address requester,\n bytes32 identifier,\n uint32 timestamp,\n bytes memory ancillaryData,\n Request memory request\n ) external virtual returns (OptimisticOracleInterface.State);\n\n /**\n * @notice Checks if a given request has resolved, expired or been settled (i.e the optimistic oracle has a price).\n * @param requester sender of the initial price request.\n * @param identifier price identifier to identify the existing request.\n * @param timestamp timestamp to identify the existing request.\n * @param ancillaryData ancillary data of the price being requested.\n * @param request price request parameters. The hash of these parameters must match with the request hash that is\n * associated with the price request unique ID {requester, identifier, timestamp, ancillaryData}, or this method\n * will revert.\n * @return boolean indicating true if price exists and false if not.\n */\n function hasPrice(\n address requester,\n bytes32 identifier,\n uint32 timestamp,\n bytes memory ancillaryData,\n Request memory request\n ) public virtual returns (bool);\n\n /**\n * @notice Generates stamped ancillary data in the format that it would be used in the case of a price dispute.\n * @param ancillaryData ancillary data of the price being requested.\n * @param requester sender of the initial price request.\n * @return the stamped ancillary bytes.\n */\n function stampAncillaryData(bytes memory ancillaryData, address requester)\n public\n pure\n virtual\n returns (bytes memory);\n}\n" + }, "@uma/core/contracts/oracle/interfaces/StoreInterface.sol": { "content": "// SPDX-License-Identifier: AGPL-3.0-only\npragma solidity ^0.8.0;\n\nimport \"@openzeppelin/contracts/token/ERC20/IERC20.sol\";\nimport \"../../common/implementation/FixedPoint.sol\";\n\n/**\n * @title Interface that allows financial contracts to pay oracle fees for their use of the system.\n */\ninterface StoreInterface {\n /**\n * @notice Pays Oracle fees in ETH to the store.\n * @dev To be used by contracts whose margin currency is ETH.\n */\n function payOracleFees() external payable;\n\n /**\n * @notice Pays oracle fees in the margin currency, erc20Address, to the store.\n * @dev To be used if the margin currency is an ERC20 token rather than ETH.\n * @param erc20Address address of the ERC20 token used to pay the fee.\n * @param amount number of tokens to transfer. An approval for at least this amount must exist.\n */\n function payOracleFeesErc20(address erc20Address, FixedPoint.Unsigned calldata amount) external;\n\n /**\n * @notice Computes the regular oracle fees that a contract should pay for a period.\n * @param startTime defines the beginning time from which the fee is paid.\n * @param endTime end time until which the fee is paid.\n * @param pfc \"profit from corruption\", or the maximum amount of margin currency that a\n * token sponsor could extract from the contract through corrupting the price feed in their favor.\n * @return regularFee amount owed for the duration from start to end time for the given pfc.\n * @return latePenalty for paying the fee after the deadline.\n */\n function computeRegularFee(\n uint256 startTime,\n uint256 endTime,\n FixedPoint.Unsigned calldata pfc\n ) external view returns (FixedPoint.Unsigned memory regularFee, FixedPoint.Unsigned memory latePenalty);\n\n /**\n * @notice Computes the final oracle fees that a contract should pay at settlement.\n * @param currency token used to pay the final fee.\n * @return finalFee amount due.\n */\n function computeFinalFee(address currency) external view returns (FixedPoint.Unsigned memory);\n}\n" }, @@ -154,6 +148,12 @@ "@openzeppelin/contracts/utils/math/SignedSafeMath.sol": { "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts v4.4.1 (utils/math/SignedSafeMath.sol)\n\npragma solidity ^0.8.0;\n\n/**\n * @dev Wrappers over Solidity's arithmetic operations.\n *\n * NOTE: `SignedSafeMath` is no longer needed starting with Solidity 0.8. The compiler\n * now has built in overflow checking.\n */\nlibrary SignedSafeMath {\n /**\n * @dev Returns the multiplication of two signed integers, reverting on\n * overflow.\n *\n * Counterpart to Solidity's `*` operator.\n *\n * Requirements:\n *\n * - Multiplication cannot overflow.\n */\n function mul(int256 a, int256 b) internal pure returns (int256) {\n return a * b;\n }\n\n /**\n * @dev Returns the integer division of two signed integers. Reverts on\n * division by zero. The result is rounded towards zero.\n *\n * Counterpart to Solidity's `/` operator.\n *\n * Requirements:\n *\n * - The divisor cannot be zero.\n */\n function div(int256 a, int256 b) internal pure returns (int256) {\n return a / b;\n }\n\n /**\n * @dev Returns the subtraction of two signed integers, reverting on\n * overflow.\n *\n * Counterpart to Solidity's `-` operator.\n *\n * Requirements:\n *\n * - Subtraction cannot overflow.\n */\n function sub(int256 a, int256 b) internal pure returns (int256) {\n return a - b;\n }\n\n /**\n * @dev Returns the addition of two signed integers, reverting on\n * overflow.\n *\n * Counterpart to Solidity's `+` operator.\n *\n * Requirements:\n *\n * - Addition cannot overflow.\n */\n function add(int256 a, int256 b) internal pure returns (int256) {\n return a + b;\n }\n}\n" }, + "contracts/LpTokenFactory.sol": { + "content": "// SPDX-License-Identifier: GPL-3.0-only\npragma solidity ^0.8.0;\n\nimport \"./interfaces/LpTokenFactoryInterface.sol\";\n\nimport \"@uma/core/contracts/common/implementation/ExpandedERC20.sol\";\n\n/**\n * @notice Factory to create new LP ERC20 tokens that represent a liquidity provider's position. HubPool is the\n * intended client of this contract.\n */\ncontract LpTokenFactory is LpTokenFactoryInterface {\n /**\n * @notice Deploys new LP token for L1 token. Sets caller as minter and burner of token.\n * @param l1Token L1 token to name in LP token name.\n * @return address of new LP token.\n */\n function createLpToken(address l1Token) public returns (address) {\n ExpandedERC20 lpToken = new ExpandedERC20(\n _append(\"Across V2 \", IERC20Metadata(l1Token).name(), \" LP Token\"), // LP Token Name\n _append(\"Av2-\", IERC20Metadata(l1Token).symbol(), \"-LP\"), // LP Token Symbol\n IERC20Metadata(l1Token).decimals() // LP Token Decimals\n );\n lpToken.addMinter(msg.sender); // Set the caller as the LP Token's minter.\n lpToken.addBurner(msg.sender); // Set the caller as the LP Token's burner.\n lpToken.resetOwner(msg.sender); // Set the caller as the LP Token's owner.\n\n return address(lpToken);\n }\n\n function _append(\n string memory a,\n string memory b,\n string memory c\n ) internal pure returns (string memory) {\n return string(abi.encodePacked(a, b, c));\n }\n}\n" + }, + "contracts/interfaces/LpTokenFactoryInterface.sol": { + "content": "// SPDX-License-Identifier: AGPL-3.0-only\npragma solidity ^0.8.0;\n\ninterface LpTokenFactoryInterface {\n function createLpToken(address l1Token) external returns (address);\n}\n" + }, "@uma/core/contracts/oracle/interfaces/FinderInterface.sol": { "content": "// SPDX-License-Identifier: AGPL-3.0-only\npragma solidity ^0.8.0;\n\n/**\n * @title Provides addresses of the live contracts implementing certain interfaces.\n * @dev Examples are the Oracle or Store interfaces.\n */\ninterface FinderInterface {\n /**\n * @notice Updates the address of the contract that implements `interfaceName`.\n * @param interfaceName bytes32 encoding of the interface name that is either changed or registered.\n * @param implementationAddress address of the deployed contract that implements the interface.\n */\n function changeImplementationAddress(bytes32 interfaceName, address implementationAddress) external;\n\n /**\n * @notice Gets the address of the contract that implements the given `interfaceName`.\n * @param interfaceName queried interface.\n * @return implementationAddress address of the deployed contract that implements the interface.\n */\n function getImplementationAddress(bytes32 interfaceName) external view returns (address);\n}\n" }, @@ -168,12 +168,6 @@ }, "@uma/core/contracts/oracle/implementation/Constants.sol": { "content": "// SPDX-License-Identifier: AGPL-3.0-only\npragma solidity ^0.8.0;\n\n/**\n * @title Stores common interface names used throughout the DVM by registration in the Finder.\n */\nlibrary OracleInterfaces {\n bytes32 public constant Oracle = \"Oracle\";\n bytes32 public constant IdentifierWhitelist = \"IdentifierWhitelist\";\n bytes32 public constant Store = \"Store\";\n bytes32 public constant FinancialContractsAdmin = \"FinancialContractsAdmin\";\n bytes32 public constant Registry = \"Registry\";\n bytes32 public constant CollateralWhitelist = \"CollateralWhitelist\";\n bytes32 public constant OptimisticOracle = \"OptimisticOracle\";\n bytes32 public constant Bridge = \"Bridge\";\n bytes32 public constant GenericHandler = \"GenericHandler\";\n bytes32 public constant SkinnyOptimisticOracle = \"SkinnyOptimisticOracle\";\n bytes32 public constant ChildMessenger = \"ChildMessenger\";\n bytes32 public constant OracleHub = \"OracleHub\";\n bytes32 public constant OracleSpoke = \"OracleSpoke\";\n}\n\n/**\n * @title Commonly re-used values for contracts associated with the OptimisticOracle.\n */\nlibrary OptimisticOracleConstraints {\n // Any price request submitted to the OptimisticOracle must contain ancillary data no larger than this value.\n // This value must be <= the Voting contract's `ancillaryBytesLimit` constant value otherwise it is possible\n // that a price can be requested to the OptimisticOracle successfully, but cannot be resolved by the DVM which\n // refuses to accept a price request made with ancillary data length over a certain size.\n uint256 public constant ancillaryBytesLimit = 8192;\n}\n" - }, - "contracts/interfaces/LpTokenFactoryInterface.sol": { - "content": "// SPDX-License-Identifier: AGPL-3.0-only\npragma solidity ^0.8.0;\n\nimport \"@openzeppelin/contracts/token/ERC20/IERC20.sol\";\n\ninterface LpTokenFactoryInterface {\n function createLpToken(address l1Token) external returns (address);\n}\n" - }, - "contracts/LpTokenFactory.sol": { - "content": "// SPDX-License-Identifier: GPL-3.0-only\npragma solidity ^0.8.0;\n\nimport \"./interfaces/LpTokenFactoryInterface.sol\";\n\nimport \"@uma/core/contracts/common/implementation/ExpandedERC20.sol\";\n\n/**\n * @notice Factory to create new LP ERC20 tokens that represent a liquidity provider's position. HubPool is the\n * intended client of this contract.\n */\ncontract LpTokenFactory is LpTokenFactoryInterface {\n /**\n * @notice Deploys new LP token for L1 token. Sets caller as minter and burner of token.\n * @param l1Token L1 token to name in LP token name.\n * @return address of new LP token.\n */\n function createLpToken(address l1Token) public returns (address) {\n ExpandedERC20 lpToken = new ExpandedERC20(\n _append(\"Across \", IERC20Metadata(l1Token).name(), \" LP Token\"), // LP Token Name\n _append(\"Av2-\", IERC20Metadata(l1Token).symbol(), \"-LP\"), // LP Token Symbol\n IERC20Metadata(l1Token).decimals() // LP Token Decimals\n );\n lpToken.addMember(1, msg.sender); // Set this contract as the LP Token's minter.\n lpToken.addMember(2, msg.sender); // Set this contract as the LP Token's burner.\n\n return address(lpToken);\n }\n\n function _append(\n string memory a,\n string memory b,\n string memory c\n ) internal pure returns (string memory) {\n return string(abi.encodePacked(a, b, c));\n }\n}\n" } }, "settings": { diff --git a/deployments/optimism-kovan/Optimism_SpokePool.json b/deployments/optimism-kovan/Optimism_SpokePool.json index c29971a42..1246ad663 100644 --- a/deployments/optimism-kovan/Optimism_SpokePool.json +++ b/deployments/optimism-kovan/Optimism_SpokePool.json @@ -1,5 +1,5 @@ { - "address": "0x99EC530a761E68a377593888D9504002Bd191717", + "address": "0x2b7b7bAE341089103dD22fa4e8D7E4FA63E11084", "abi": [ { "inputs": [ @@ -22,6 +22,19 @@ "stateMutability": "nonpayable", "type": "constructor" }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "uint256", + "name": "rootBundleId", + "type": "uint256" + } + ], + "name": "EmergencyDeleteRootBundle", + "type": "event" + }, { "anonymous": false, "inputs": [ @@ -141,6 +154,12 @@ "name": "originChainId", "type": "uint256" }, + { + "indexed": false, + "internalType": "uint256", + "name": "destinationChainId", + "type": "uint256" + }, { "indexed": false, "internalType": "uint64", @@ -202,6 +221,12 @@ "name": "amount", "type": "uint256" }, + { + "indexed": false, + "internalType": "uint256", + "name": "originChainId", + "type": "uint256" + }, { "indexed": false, "internalType": "uint256", @@ -469,19 +494,6 @@ "stateMutability": "view", "type": "function" }, - { - "inputs": [], - "name": "deploymentTime", - "outputs": [ - { - "internalType": "uint32", - "name": "", - "type": "uint32" - } - ], - "stateMutability": "view", - "type": "function" - }, { "inputs": [ { @@ -533,6 +545,19 @@ "stateMutability": "view", "type": "function" }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "rootBundleId", + "type": "uint256" + } + ], + "name": "emergencyDeleteRootBundle", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, { "inputs": [ { @@ -1138,59 +1163,59 @@ "type": "receive" } ], - "transactionHash": "0x32aad5ff38addd761608bd13fcca726ebb5f8fc9af52e0600441f74046201e9a", + "transactionHash": "0xdc5329ba9c26608ec632cffcdd4bb2ab3d5d88b5a6a83c0b8fa9433ad300500a", "receipt": { "to": null, "from": "0x9A8f92a830A5cB89a3816e3D267CB7791c16b04D", - "contractAddress": "0x99EC530a761E68a377593888D9504002Bd191717", + "contractAddress": "0x2b7b7bAE341089103dD22fa4e8D7E4FA63E11084", "transactionIndex": 0, - "gasUsed": "3909892", - "logsBloom": "0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000800000800000000200000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000808000000000000000000000000000000000000000080000000000000000040000400000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000002000000080000000000000000000000000000080000000000000000000000000000000000400000000000000000000000000", - "blockHash": "0x93a642d25b602ab18d37f74b8dd410a7f587773b4539fcac7c8ce147ce1ed60c", - "transactionHash": "0x32aad5ff38addd761608bd13fcca726ebb5f8fc9af52e0600441f74046201e9a", + "gasUsed": "4212991", + "logsBloom": "0x00000000000000000000000000000000000000000000400000000000000000000000000000000000000000080800000000200000000000000000000000000200000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000800000000000000000000000000000000000000000000000000000000000040000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000080000000020000000000000000000000000000000000010000000000200000000400000000000000000000000000", + "blockHash": "0x73fc2bd5a044b4610393c78d0edc2ac810924ec4e3fbda7145646d3f957b2b38", + "transactionHash": "0xdc5329ba9c26608ec632cffcdd4bb2ab3d5d88b5a6a83c0b8fa9433ad300500a", "logs": [ { "transactionIndex": 0, - "blockNumber": 1396431, - "transactionHash": "0x32aad5ff38addd761608bd13fcca726ebb5f8fc9af52e0600441f74046201e9a", - "address": "0x99EC530a761E68a377593888D9504002Bd191717", + "blockNumber": 1618630, + "transactionHash": "0xdc5329ba9c26608ec632cffcdd4bb2ab3d5d88b5a6a83c0b8fa9433ad300500a", + "address": "0x2b7b7bAE341089103dD22fa4e8D7E4FA63E11084", "topics": [ "0xa9e8c42c9e7fca7f62755189a16b2f5314d43d8fb24e91ba54e6d65f9314e849", - "0x00000000000000000000000026efa52a66b7b776df2196bf34a9f70327f4b26d" + "0x000000000000000000000000d449af45a032df413b497a709eed3e8c112ebce3" ], "data": "0x", "logIndex": 0, - "blockHash": "0x93a642d25b602ab18d37f74b8dd410a7f587773b4539fcac7c8ce147ce1ed60c" + "blockHash": "0x73fc2bd5a044b4610393c78d0edc2ac810924ec4e3fbda7145646d3f957b2b38" }, { "transactionIndex": 0, - "blockNumber": 1396431, - "transactionHash": "0x32aad5ff38addd761608bd13fcca726ebb5f8fc9af52e0600441f74046201e9a", - "address": "0x99EC530a761E68a377593888D9504002Bd191717", + "blockNumber": 1618630, + "transactionHash": "0xdc5329ba9c26608ec632cffcdd4bb2ab3d5d88b5a6a83c0b8fa9433ad300500a", + "address": "0x2b7b7bAE341089103dD22fa4e8D7E4FA63E11084", "topics": [ "0x1f17a88f67b0f49060a34bec1a4723a563620e6aa265eb640b5046dcee0759a0", - "0x00000000000000000000000026efa52a66b7b776df2196bf34a9f70327f4b26d" + "0x000000000000000000000000d449af45a032df413b497a709eed3e8c112ebce3" ], "data": "0x", "logIndex": 1, - "blockHash": "0x93a642d25b602ab18d37f74b8dd410a7f587773b4539fcac7c8ce147ce1ed60c" + "blockHash": "0x73fc2bd5a044b4610393c78d0edc2ac810924ec4e3fbda7145646d3f957b2b38" } ], - "blockNumber": 1396431, - "cumulativeGasUsed": "3909892", + "blockNumber": 1618630, + "cumulativeGasUsed": "4212991", "status": 1, "byzantium": true }, "args": [ - "0x26EfA52A66b7B776Df2196Bf34A9F70327f4b26d", - "0x26EfA52A66b7B776Df2196Bf34A9F70327f4b26d", + "0xD449Af45a032Df413b497A709EeD3E8C112EbcE3", + "0xD449Af45a032Df413b497A709EeD3E8C112EbcE3", "0x0000000000000000000000000000000000000000" ], "numDeployments": 1, - "solcInputHash": "d3cc7d49c45bf725b6aea61557b961e9", - "metadata": "{\"compiler\":{\"version\":\"0.8.11+commit.d7f03943\"},\"language\":\"Solidity\",\"output\":{\"abi\":[{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_crossDomainAdmin\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"_hubPool\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"timerAddress\",\"type\":\"address\"}],\"stateMutability\":\"nonpayable\",\"type\":\"constructor\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"originToken\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"uint256\",\"name\":\"destinationChainId\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"bool\",\"name\":\"enabled\",\"type\":\"bool\"}],\"name\":\"EnabledDepositRoute\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"amountToReturn\",\"type\":\"uint256\"},{\"indexed\":true,\"internalType\":\"uint256\",\"name\":\"chainId\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"uint256[]\",\"name\":\"refundAmounts\",\"type\":\"uint256[]\"},{\"indexed\":true,\"internalType\":\"uint32\",\"name\":\"rootBundleId\",\"type\":\"uint32\"},{\"indexed\":true,\"internalType\":\"uint32\",\"name\":\"leafId\",\"type\":\"uint32\"},{\"indexed\":false,\"internalType\":\"address\",\"name\":\"l2TokenAddress\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"address[]\",\"name\":\"refundAddresses\",\"type\":\"address[]\"},{\"indexed\":false,\"internalType\":\"address\",\"name\":\"caller\",\"type\":\"address\"}],\"name\":\"ExecutedRelayerRefundRoot\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"bytes32\",\"name\":\"relayHash\",\"type\":\"bytes32\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"totalFilledAmount\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"fillAmount\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"repaymentChainId\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"originChainId\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"uint64\",\"name\":\"relayerFeePct\",\"type\":\"uint64\"},{\"indexed\":false,\"internalType\":\"uint64\",\"name\":\"realizedLpFeePct\",\"type\":\"uint64\"},{\"indexed\":false,\"internalType\":\"uint32\",\"name\":\"depositId\",\"type\":\"uint32\"},{\"indexed\":false,\"internalType\":\"address\",\"name\":\"destinationToken\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"relayer\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"depositor\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"address\",\"name\":\"recipient\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"bool\",\"name\":\"isSlowRelay\",\"type\":\"bool\"}],\"name\":\"FilledRelay\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"destinationChainId\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"uint64\",\"name\":\"relayerFeePct\",\"type\":\"uint64\"},{\"indexed\":true,\"internalType\":\"uint32\",\"name\":\"depositId\",\"type\":\"uint32\"},{\"indexed\":false,\"internalType\":\"uint32\",\"name\":\"quoteTimestamp\",\"type\":\"uint32\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"originToken\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"address\",\"name\":\"recipient\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"depositor\",\"type\":\"address\"}],\"name\":\"FundsDeposited\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"l2Token\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"address\",\"name\":\"target\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"numberOfTokensBridged\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"l1Gas\",\"type\":\"uint256\"}],\"name\":\"OptimismTokensBridged\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"uint32\",\"name\":\"rootBundleId\",\"type\":\"uint32\"},{\"indexed\":false,\"internalType\":\"bytes32\",\"name\":\"relayerRefundRoot\",\"type\":\"bytes32\"},{\"indexed\":false,\"internalType\":\"bytes32\",\"name\":\"slowRelayRoot\",\"type\":\"bytes32\"}],\"name\":\"RelayedRootBundle\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"uint64\",\"name\":\"newRelayerFeePct\",\"type\":\"uint64\"},{\"indexed\":true,\"internalType\":\"uint32\",\"name\":\"depositId\",\"type\":\"uint32\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"depositor\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"bytes\",\"name\":\"depositorSignature\",\"type\":\"bytes\"}],\"name\":\"RequestedSpeedUpDeposit\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"uint32\",\"name\":\"newBuffer\",\"type\":\"uint32\"}],\"name\":\"SetDepositQuoteTimeBuffer\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"newHubPool\",\"type\":\"address\"}],\"name\":\"SetHubPool\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"uint32\",\"name\":\"newL1Gas\",\"type\":\"uint32\"}],\"name\":\"SetL1Gas\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"l2Token\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"tokenBridge\",\"type\":\"address\"}],\"name\":\"SetL2TokenBridge\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"newAdmin\",\"type\":\"address\"}],\"name\":\"SetXDomainAdmin\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"amountToReturn\",\"type\":\"uint256\"},{\"indexed\":true,\"internalType\":\"uint256\",\"name\":\"chainId\",\"type\":\"uint256\"},{\"indexed\":true,\"internalType\":\"uint32\",\"name\":\"leafId\",\"type\":\"uint32\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"l2TokenAddress\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"address\",\"name\":\"caller\",\"type\":\"address\"}],\"name\":\"TokensBridged\",\"type\":\"event\"},{\"inputs\":[],\"name\":\"chainId\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"crossDomainAdmin\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"deploymentTime\",\"outputs\":[{\"internalType\":\"uint32\",\"name\":\"\",\"type\":\"uint32\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"recipient\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"originToken\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"destinationChainId\",\"type\":\"uint256\"},{\"internalType\":\"uint64\",\"name\":\"relayerFeePct\",\"type\":\"uint64\"},{\"internalType\":\"uint32\",\"name\":\"quoteTimestamp\",\"type\":\"uint32\"}],\"name\":\"deposit\",\"outputs\":[],\"stateMutability\":\"payable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"depositQuoteTimeBuffer\",\"outputs\":[{\"internalType\":\"uint32\",\"name\":\"\",\"type\":\"uint32\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"name\":\"enabledDepositRoutes\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint32\",\"name\":\"rootBundleId\",\"type\":\"uint32\"},{\"components\":[{\"internalType\":\"uint256\",\"name\":\"amountToReturn\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"chainId\",\"type\":\"uint256\"},{\"internalType\":\"uint256[]\",\"name\":\"refundAmounts\",\"type\":\"uint256[]\"},{\"internalType\":\"uint32\",\"name\":\"leafId\",\"type\":\"uint32\"},{\"internalType\":\"address\",\"name\":\"l2TokenAddress\",\"type\":\"address\"},{\"internalType\":\"address[]\",\"name\":\"refundAddresses\",\"type\":\"address[]\"}],\"internalType\":\"struct SpokePoolInterface.RelayerRefundLeaf\",\"name\":\"relayerRefundLeaf\",\"type\":\"tuple\"},{\"internalType\":\"bytes32[]\",\"name\":\"proof\",\"type\":\"bytes32[]\"}],\"name\":\"executeRelayerRefundRoot\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"depositor\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"recipient\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"destinationToken\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"totalRelayAmount\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"originChainId\",\"type\":\"uint256\"},{\"internalType\":\"uint64\",\"name\":\"realizedLpFeePct\",\"type\":\"uint64\"},{\"internalType\":\"uint64\",\"name\":\"relayerFeePct\",\"type\":\"uint64\"},{\"internalType\":\"uint32\",\"name\":\"depositId\",\"type\":\"uint32\"},{\"internalType\":\"uint32\",\"name\":\"rootBundleId\",\"type\":\"uint32\"},{\"internalType\":\"bytes32[]\",\"name\":\"proof\",\"type\":\"bytes32[]\"}],\"name\":\"executeSlowRelayRoot\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"depositor\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"recipient\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"destinationToken\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"maxTokensToSend\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"repaymentChainId\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"originChainId\",\"type\":\"uint256\"},{\"internalType\":\"uint64\",\"name\":\"realizedLpFeePct\",\"type\":\"uint64\"},{\"internalType\":\"uint64\",\"name\":\"relayerFeePct\",\"type\":\"uint64\"},{\"internalType\":\"uint32\",\"name\":\"depositId\",\"type\":\"uint32\"}],\"name\":\"fillRelay\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"depositor\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"recipient\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"destinationToken\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"maxTokensToSend\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"repaymentChainId\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"originChainId\",\"type\":\"uint256\"},{\"internalType\":\"uint64\",\"name\":\"realizedLpFeePct\",\"type\":\"uint64\"},{\"internalType\":\"uint64\",\"name\":\"relayerFeePct\",\"type\":\"uint64\"},{\"internalType\":\"uint64\",\"name\":\"newRelayerFeePct\",\"type\":\"uint64\"},{\"internalType\":\"uint32\",\"name\":\"depositId\",\"type\":\"uint32\"},{\"internalType\":\"bytes\",\"name\":\"depositorSignature\",\"type\":\"bytes\"}],\"name\":\"fillRelayWithUpdatedFee\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"getCurrentTime\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"hubPool\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"l1Gas\",\"outputs\":[{\"internalType\":\"uint32\",\"name\":\"\",\"type\":\"uint32\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"l2Eth\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"messenger\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes[]\",\"name\":\"data\",\"type\":\"bytes[]\"}],\"name\":\"multicall\",\"outputs\":[{\"internalType\":\"bytes[]\",\"name\":\"results\",\"type\":\"bytes[]\"}],\"stateMutability\":\"payable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"numberOfDeposits\",\"outputs\":[{\"internalType\":\"uint32\",\"name\":\"\",\"type\":\"uint32\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"\",\"type\":\"bytes32\"}],\"name\":\"relayFills\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"relayerRefundRoot\",\"type\":\"bytes32\"},{\"internalType\":\"bytes32\",\"name\":\"slowRelayRoot\",\"type\":\"bytes32\"}],\"name\":\"relayRootBundle\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"name\":\"rootBundles\",\"outputs\":[{\"internalType\":\"bytes32\",\"name\":\"slowRelayRoot\",\"type\":\"bytes32\"},{\"internalType\":\"bytes32\",\"name\":\"relayerRefundRoot\",\"type\":\"bytes32\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"newCrossDomainAdmin\",\"type\":\"address\"}],\"name\":\"setCrossDomainAdmin\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"time\",\"type\":\"uint256\"}],\"name\":\"setCurrentTime\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint32\",\"name\":\"newDepositQuoteTimeBuffer\",\"type\":\"uint32\"}],\"name\":\"setDepositQuoteTimeBuffer\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"originToken\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"destinationChainId\",\"type\":\"uint256\"},{\"internalType\":\"bool\",\"name\":\"enabled\",\"type\":\"bool\"}],\"name\":\"setEnableRoute\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"newHubPool\",\"type\":\"address\"}],\"name\":\"setHubPool\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint32\",\"name\":\"newl1Gas\",\"type\":\"uint32\"}],\"name\":\"setL1GasLimit\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"l2Token\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"tokenBridge\",\"type\":\"address\"}],\"name\":\"setTokenBridge\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"depositor\",\"type\":\"address\"},{\"internalType\":\"uint64\",\"name\":\"newRelayerFeePct\",\"type\":\"uint64\"},{\"internalType\":\"uint32\",\"name\":\"depositId\",\"type\":\"uint32\"},{\"internalType\":\"bytes\",\"name\":\"depositorSignature\",\"type\":\"bytes\"}],\"name\":\"speedUpDeposit\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"timerAddress\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"name\":\"tokenBridges\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"weth\",\"outputs\":[{\"internalType\":\"contract WETH9\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"stateMutability\":\"payable\",\"type\":\"receive\"}],\"devdoc\":{\"kind\":\"dev\",\"methods\":{\"chainId()\":{\"details\":\"Some L2s like ZKSync don't support the CHAIN_ID opcode so we allow the implementer to override this.\"},\"constructor\":{\"params\":{\"_crossDomainAdmin\":\"Cross domain admin to set. Can be changed by admin.\",\"_hubPool\":\"Hub pool address to set. Can be changed by admin.\",\"timerAddress\":\"Timer address to set.\"}},\"deposit(address,address,uint256,uint256,uint64,uint32)\":{\"params\":{\"amount\":\"Amount of tokens to deposit. Will be amount of tokens to receive less fees.\",\"destinationChainId\":\"Denotes network where user will receive funds from SpokePool by a relayer.\",\"originToken\":\"Token to lock into this contract to initiate deposit.\",\"quoteTimestamp\":\"Timestamp used by relayers to compute this deposit's realizedLPFeePct which is paid to LP pool on HubPool.\",\"recipient\":\"Address to receive funds at on destination chain.\",\"relayerFeePct\":\"% of deposit amount taken out to incentivize a fast relayer.\"}},\"executeRelayerRefundRoot(uint32,(uint256,uint256,uint256[],uint32,address,address[]),bytes32[])\":{\"params\":{\"proof\":\"Inclusion proof for this leaf in relayer refund root in root bundle.\",\"relayerRefundLeaf\":\"Contains all data neccessary to reconstruct leaf contained in root bundle and to refund relayer. This data structure is explained in detail in the SpokePoolInterface.\",\"rootBundleId\":\"Unique ID of root bundle containing relayer refund root that this leaf is contained in.\"}},\"executeSlowRelayRoot(address,address,address,uint256,uint256,uint64,uint64,uint32,uint32,bytes32[])\":{\"params\":{\"amount\":\"Full size of the deposit.\",\"depositId\":\"Unique deposit ID on origin spoke pool.\",\"depositor\":\"Depositor on origin chain who set this chain as the destination chain.\",\"destinationToken\":\"Token to send to recipient. Should be mapped to the origin token, origin chain ID and this chain ID via a mapping on the HubPool.\",\"originChainId\":\"Chain of SpokePool where deposit originated.\",\"proof\":\"Inclusion proof for this leaf in slow relay root in root bundle.\",\"realizedLpFeePct\":\"Fee % based on L1 HubPool utilization at deposit quote time. Deterministic based on quote time.\",\"recipient\":\"Specified recipient on this chain.\",\"relayerFeePct\":\"Original fee % to keep as relayer set by depositor.\",\"rootBundleId\":\"Unique ID of root bundle containing slow relay root that this leaf is contained in.\"}},\"fillRelay(address,address,address,uint256,uint256,uint256,uint256,uint64,uint64,uint32)\":{\"params\":{\"amount\":\"Full size of the deposit.\",\"depositId\":\"Unique deposit ID on origin spoke pool.\",\"depositor\":\"Depositor on origin chain who set this chain as the destination chain.\",\"destinationToken\":\"Token to send to recipient. Should be mapped to the origin token, origin chain ID and this chain ID via a mapping on the HubPool.\",\"maxTokensToSend\":\"Max amount of tokens to send recipient. If higher than amount, then caller will send recipient the full relay amount.\",\"originChainId\":\"Chain of SpokePool where deposit originated.\",\"realizedLpFeePct\":\"Fee % based on L1 HubPool utilization at deposit quote time. Deterministic based on quote time.\",\"recipient\":\"Specified recipient on this chain.\",\"relayerFeePct\":\"Fee % to keep as relayer, specified by depositor.\",\"repaymentChainId\":\"Chain of SpokePool where relayer wants to be refunded after the challenge window has passed.\"}},\"fillRelayWithUpdatedFee(address,address,address,uint256,uint256,uint256,uint256,uint64,uint64,uint64,uint32,bytes)\":{\"params\":{\"amount\":\"Full size of the deposit.\",\"depositId\":\"Unique deposit ID on origin spoke pool.\",\"depositor\":\"Depositor on origin chain who set this chain as the destination chain.\",\"depositorSignature\":\"Depositor-signed message containing updated fee %.\",\"destinationToken\":\"Token to send to recipient. Should be mapped to the origin token, origin chain ID and this chain ID via a mapping on the HubPool.\",\"maxTokensToSend\":\"Max amount of tokens to send recipient. If higher than amount, then caller will send recipient the full relay amount.\",\"newRelayerFeePct\":\"New fee % to keep as relayer also specified by depositor.\",\"originChainId\":\"Chain of SpokePool where deposit originated.\",\"realizedLpFeePct\":\"Fee % based on L1 HubPool utilization at deposit quote time. Deterministic based on quote time.\",\"recipient\":\"Specified recipient on this chain.\",\"relayerFeePct\":\"Original fee % to keep as relayer set by depositor.\",\"repaymentChainId\":\"Chain of SpokePool where relayer wants to be refunded after the challenge window has passed.\"}},\"getCurrentTime()\":{\"returns\":{\"_0\":\"uint for the current Testable timestamp.\"}},\"relayRootBundle(bytes32,bytes32)\":{\"params\":{\"relayerRefundRoot\":\"Merkle root containing relayer refund leaves that can be individually executed via executeRelayerRefundRoot().\",\"slowRelayRoot\":\"Merkle root containing slow relay fulfillment leaves that can be individually executed via executeSlowRelayRoot().\"}},\"setCrossDomainAdmin(address)\":{\"params\":{\"newCrossDomainAdmin\":\"New cross domain admin.\"}},\"setCurrentTime(uint256)\":{\"details\":\"Will revert if not running in test mode.\",\"params\":{\"time\":\"timestamp to set current Testable time to.\"}},\"setDepositQuoteTimeBuffer(uint32)\":{\"params\":{\"newDepositQuoteTimeBuffer\":\"New quote time buffer.\"}},\"setEnableRoute(address,uint256,bool)\":{\"params\":{\"destinationChainId\":\"Chain ID for where depositor wants to receive funds.\",\"enabled\":\"True to enable deposits, False otherwise.\",\"originToken\":\"Token that depositor can deposit to this contract.\"}},\"setHubPool(address)\":{\"params\":{\"newHubPool\":\"New hub pool.\"}},\"setL1GasLimit(uint32)\":{\"params\":{\"newl1Gas\":\"New L1 gas limit to set.\"}},\"setTokenBridge(address,address)\":{\"details\":\"If this mapping isn't set for an L2 token, then the standard bridge will be used to bridge this token.\",\"params\":{\"tokenBridge\":\"Address of token bridge\"}},\"speedUpDeposit(address,uint64,uint32,bytes)\":{\"params\":{\"depositId\":\"Deposit to update fee for that originated in this contract.\",\"depositor\":\"Signer of the update fee message who originally submitted the deposit. If the deposit doesn't exist, then the relayer will not be able to fill any relay, so the caller should validate that the depositor did in fact submit a relay.\",\"depositorSignature\":\"Signed message containing the depositor address, this contract chain ID, the updated relayer fee %, and the deposit ID. This signature is produced by signing a hash of data according to the EIP-191 standard. See more in the _verifyUpdateRelayerFeeMessage() comments.\",\"newRelayerFeePct\":\"New relayer fee that relayers can use.\"}}},\"version\":1},\"userdoc\":{\"kind\":\"user\",\"methods\":{\"chainId()\":{\"notice\":\"Returns chain ID for this network.\"},\"constructor\":{\"notice\":\"Construct the OVM SpokePool.\"},\"deposit(address,address,uint256,uint256,uint64,uint32)\":{\"notice\":\"Called by user to bridge funds from origin to destination chain. Depositor will effectively lock tokens in this contract and receive a destination token on the destination chain. The origin => destination token mapping is stored on the L1 HubPool.The caller must first approve this contract to spend amount of originToken.The originToken => destinationChainId must be enabled.This method is payable because the caller is able to deposit ETH if the originToken is WETH and this function will handle wrapping ETH.\"},\"executeRelayerRefundRoot(uint32,(uint256,uint256,uint256[],uint32,address,address[]),bytes32[])\":{\"notice\":\"Wraps any ETH into WETH before executing base function. This is necessary because SpokePool receives ETH over the canonical token bridge instead of WETH.\"},\"executeSlowRelayRoot(address,address,address,uint256,uint256,uint64,uint64,uint32,uint32,bytes32[])\":{\"notice\":\"Wraps any ETH into WETH before executing base function. This is necessary because SpokePool receives ETH over the canonical token bridge instead of WETH.\"},\"fillRelay(address,address,address,uint256,uint256,uint256,uint256,uint64,uint64,uint32)\":{\"notice\":\"Called by relayer to fulfill part of a deposit by sending destination tokens to the receipient. Relayer is expected to pass in unique identifying information for deposit that they want to fulfill, and this relay submission will be validated by off-chain data workers who can dispute this relay if any part is invalid. If the relay is valid, then the relayer will be refunded on their desired repayment chain. If relay is invalid, then relayer will not receive any refund.All of the deposit data can be found via on-chain events from the origin SpokePool, except for the realizedLpFeePct which is a function of the HubPool's utilization at the deposit quote time. This fee % is deterministic based on the quote time, so the relayer should just compute it using the canonical algorithm as described in a UMIP linked to the HubPool's identifier.\"},\"fillRelayWithUpdatedFee(address,address,address,uint256,uint256,uint256,uint256,uint64,uint64,uint64,uint32,bytes)\":{\"notice\":\"Called by relayer to execute same logic as calling fillRelay except that relayer is using an updated relayer fee %. The fee % must have been emitted in a message cryptographically signed by the depositor.By design, the depositor probably emitted the message with the updated fee by calling speedUpRelay().\"},\"getCurrentTime()\":{\"notice\":\"Gets the current time. Will return the last time set in `setCurrentTime` if running in test mode. Otherwise, it will return the block timestamp.\"},\"relayRootBundle(bytes32,bytes32)\":{\"notice\":\"This method stores a new root bundle in this contract that can be executed to refund relayers, fulfill slow relays, and send funds back to the HubPool on L1. This method can only be called by the admin and is designed to be called as part of a cross-chain message from the HubPool's executeRootBundle method.\"},\"setCrossDomainAdmin(address)\":{\"notice\":\"Change cross domain admin address. Callable by admin only.\"},\"setCurrentTime(uint256)\":{\"notice\":\"Sets the current time.\"},\"setDepositQuoteTimeBuffer(uint32)\":{\"notice\":\"Change allowance for deposit quote time to differ from current block time. Callable by admin only.\"},\"setEnableRoute(address,uint256,bool)\":{\"notice\":\"Enable/Disable an origin token => destination chain ID route for deposits. Callable by admin only.\"},\"setHubPool(address)\":{\"notice\":\"Change L1 hub pool address. Callable by admin only.\"},\"setL1GasLimit(uint32)\":{\"notice\":\"Change L1 gas limit. Callable only by admin.\"},\"setTokenBridge(address,address)\":{\"notice\":\"Set bridge contract for L2 token used to withdraw back to L1.\"},\"speedUpDeposit(address,uint64,uint32,bytes)\":{\"notice\":\"Convenience method that depositor can use to signal to relayer to use updated fee.Relayer should only use events emitted by this function to submit fills with updated fees, otherwise they risk their fills getting disputed for being invalid, for example if the depositor never actually signed the update fee message.This function will revert if the depositor did not sign a message containing the updated fee for the deposit ID stored in this contract. If the deposit ID is for another contract, or the depositor address is incorrect, or the updated fee is incorrect, then the signature will not match and this function will revert.\"}},\"notice\":\"OVM specific SpokePool. Uses OVM cross-domain-enabled logic to implement admin only access to functions.\",\"version\":1}},\"settings\":{\"compilationTarget\":{\"contracts/Optimism_SpokePool.sol\":\"Optimism_SpokePool\"},\"evmVersion\":\"london\",\"libraries\":{},\"metadata\":{\"bytecodeHash\":\"ipfs\",\"useLiteralContent\":true},\"optimizer\":{\"enabled\":true,\"runs\":1000000},\"remappings\":[]},\"sources\":{\"@eth-optimism/contracts/L2/messaging/IL2ERC20Bridge.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity ^0.8.9;\\n\\n/**\\n * @title IL2ERC20Bridge\\n */\\ninterface IL2ERC20Bridge {\\n /**********\\n * Events *\\n **********/\\n\\n event WithdrawalInitiated(\\n address indexed _l1Token,\\n address indexed _l2Token,\\n address indexed _from,\\n address _to,\\n uint256 _amount,\\n bytes _data\\n );\\n\\n event DepositFinalized(\\n address indexed _l1Token,\\n address indexed _l2Token,\\n address indexed _from,\\n address _to,\\n uint256 _amount,\\n bytes _data\\n );\\n\\n event DepositFailed(\\n address indexed _l1Token,\\n address indexed _l2Token,\\n address indexed _from,\\n address _to,\\n uint256 _amount,\\n bytes _data\\n );\\n\\n /********************\\n * Public Functions *\\n ********************/\\n\\n /**\\n * @dev get the address of the corresponding L1 bridge contract.\\n * @return Address of the corresponding L1 bridge contract.\\n */\\n function l1TokenBridge() external returns (address);\\n\\n /**\\n * @dev initiate a withdraw of some tokens to the caller's account on L1\\n * @param _l2Token Address of L2 token where withdrawal was initiated.\\n * @param _amount Amount of the token to withdraw.\\n * param _l1Gas Unused, but included for potential forward compatibility considerations.\\n * @param _data Optional data to forward to L1. This data is provided\\n * solely as a convenience for external contracts. Aside from enforcing a maximum\\n * length, these contracts provide no guarantees about its content.\\n */\\n function withdraw(\\n address _l2Token,\\n uint256 _amount,\\n uint32 _l1Gas,\\n bytes calldata _data\\n ) external;\\n\\n /**\\n * @dev initiate a withdraw of some token to a recipient's account on L1.\\n * @param _l2Token Address of L2 token where withdrawal is initiated.\\n * @param _to L1 adress to credit the withdrawal to.\\n * @param _amount Amount of the token to withdraw.\\n * param _l1Gas Unused, but included for potential forward compatibility considerations.\\n * @param _data Optional data to forward to L1. This data is provided\\n * solely as a convenience for external contracts. Aside from enforcing a maximum\\n * length, these contracts provide no guarantees about its content.\\n */\\n function withdrawTo(\\n address _l2Token,\\n address _to,\\n uint256 _amount,\\n uint32 _l1Gas,\\n bytes calldata _data\\n ) external;\\n\\n /*************************\\n * Cross-chain Functions *\\n *************************/\\n\\n /**\\n * @dev Complete a deposit from L1 to L2, and credits funds to the recipient's balance of this\\n * L2 token. This call will fail if it did not originate from a corresponding deposit in\\n * L1StandardTokenBridge.\\n * @param _l1Token Address for the l1 token this is called with\\n * @param _l2Token Address for the l2 token this is called with\\n * @param _from Account to pull the deposit from on L2.\\n * @param _to Address to receive the withdrawal at\\n * @param _amount Amount of the token to withdraw\\n * @param _data Data provider by the sender on L1. This data is provided\\n * solely as a convenience for external contracts. Aside from enforcing a maximum\\n * length, these contracts provide no guarantees about its content.\\n */\\n function finalizeDeposit(\\n address _l1Token,\\n address _l2Token,\\n address _from,\\n address _to,\\n uint256 _amount,\\n bytes calldata _data\\n ) external;\\n}\\n\",\"keccak256\":\"0x4674c3c8733ca0db16c2b81d58227560df36a07ded3b637a0793564d90ac0475\",\"license\":\"MIT\"},\"@eth-optimism/contracts/libraries/bridge/CrossDomainEnabled.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >0.5.0 <0.9.0;\\n\\n/* Interface Imports */\\nimport { ICrossDomainMessenger } from \\\"./ICrossDomainMessenger.sol\\\";\\n\\n/**\\n * @title CrossDomainEnabled\\n * @dev Helper contract for contracts performing cross-domain communications\\n *\\n * Compiler used: defined by inheriting contract\\n */\\ncontract CrossDomainEnabled {\\n /*************\\n * Variables *\\n *************/\\n\\n // Messenger contract used to send and recieve messages from the other domain.\\n address public messenger;\\n\\n /***************\\n * Constructor *\\n ***************/\\n\\n /**\\n * @param _messenger Address of the CrossDomainMessenger on the current layer.\\n */\\n constructor(address _messenger) {\\n messenger = _messenger;\\n }\\n\\n /**********************\\n * Function Modifiers *\\n **********************/\\n\\n /**\\n * Enforces that the modified function is only callable by a specific cross-domain account.\\n * @param _sourceDomainAccount The only account on the originating domain which is\\n * authenticated to call this function.\\n */\\n modifier onlyFromCrossDomainAccount(address _sourceDomainAccount) {\\n require(\\n msg.sender == address(getCrossDomainMessenger()),\\n \\\"OVM_XCHAIN: messenger contract unauthenticated\\\"\\n );\\n\\n require(\\n getCrossDomainMessenger().xDomainMessageSender() == _sourceDomainAccount,\\n \\\"OVM_XCHAIN: wrong sender of cross-domain message\\\"\\n );\\n\\n _;\\n }\\n\\n /**********************\\n * Internal Functions *\\n **********************/\\n\\n /**\\n * Gets the messenger, usually from storage. This function is exposed in case a child contract\\n * needs to override.\\n * @return The address of the cross-domain messenger contract which should be used.\\n */\\n function getCrossDomainMessenger() internal virtual returns (ICrossDomainMessenger) {\\n return ICrossDomainMessenger(messenger);\\n }\\n\\n /**q\\n * Sends a message to an account on another domain\\n * @param _crossDomainTarget The intended recipient on the destination domain\\n * @param _message The data to send to the target (usually calldata to a function with\\n * `onlyFromCrossDomainAccount()`)\\n * @param _gasLimit The gasLimit for the receipt of the message on the target domain.\\n */\\n function sendCrossDomainMessage(\\n address _crossDomainTarget,\\n uint32 _gasLimit,\\n bytes memory _message\\n ) internal {\\n // slither-disable-next-line reentrancy-events, reentrancy-benign\\n getCrossDomainMessenger().sendMessage(_crossDomainTarget, _message, _gasLimit);\\n }\\n}\\n\",\"keccak256\":\"0x9c3cc8b7047c68a403529b15769a21c2e2668ea71db7bef51f123288009811ea\",\"license\":\"MIT\"},\"@eth-optimism/contracts/libraries/bridge/ICrossDomainMessenger.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >0.5.0 <0.9.0;\\n\\n/**\\n * @title ICrossDomainMessenger\\n */\\ninterface ICrossDomainMessenger {\\n /**********\\n * Events *\\n **********/\\n\\n event SentMessage(\\n address indexed target,\\n address sender,\\n bytes message,\\n uint256 messageNonce,\\n uint256 gasLimit\\n );\\n event RelayedMessage(bytes32 indexed msgHash);\\n event FailedRelayedMessage(bytes32 indexed msgHash);\\n\\n /*************\\n * Variables *\\n *************/\\n\\n function xDomainMessageSender() external view returns (address);\\n\\n /********************\\n * Public Functions *\\n ********************/\\n\\n /**\\n * Sends a cross domain message to the target messenger.\\n * @param _target Target contract address.\\n * @param _message Message to send to the target.\\n * @param _gasLimit Gas limit for the provided message.\\n */\\n function sendMessage(\\n address _target,\\n bytes calldata _message,\\n uint32 _gasLimit\\n ) external;\\n}\\n\",\"keccak256\":\"0x8f29ae23021345a20ccac7b5edb3fc38268aef943b65adc8a32e74b80bf1833a\",\"license\":\"MIT\"},\"@eth-optimism/contracts/libraries/constants/Lib_PredeployAddresses.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity ^0.8.9;\\n\\n/**\\n * @title Lib_PredeployAddresses\\n */\\nlibrary Lib_PredeployAddresses {\\n address internal constant L2_TO_L1_MESSAGE_PASSER = 0x4200000000000000000000000000000000000000;\\n address internal constant L1_MESSAGE_SENDER = 0x4200000000000000000000000000000000000001;\\n address internal constant DEPLOYER_WHITELIST = 0x4200000000000000000000000000000000000002;\\n address payable internal constant OVM_ETH = payable(0xDeadDeAddeAddEAddeadDEaDDEAdDeaDDeAD0000);\\n address internal constant L2_CROSS_DOMAIN_MESSENGER =\\n 0x4200000000000000000000000000000000000007;\\n address internal constant LIB_ADDRESS_MANAGER = 0x4200000000000000000000000000000000000008;\\n address internal constant PROXY_EOA = 0x4200000000000000000000000000000000000009;\\n address internal constant L2_STANDARD_BRIDGE = 0x4200000000000000000000000000000000000010;\\n address internal constant SEQUENCER_FEE_WALLET = 0x4200000000000000000000000000000000000011;\\n address internal constant L2_STANDARD_TOKEN_FACTORY =\\n 0x4200000000000000000000000000000000000012;\\n address internal constant L1_BLOCK_NUMBER = 0x4200000000000000000000000000000000000013;\\n}\\n\",\"keccak256\":\"0x2bc28307af93e9716151a41a81694b56cbe513ef5eb335fb1d81f35e5db8edfa\",\"license\":\"MIT\"},\"@openzeppelin/contracts/interfaces/IERC1271.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts v4.4.1 (interfaces/IERC1271.sol)\\n\\npragma solidity ^0.8.0;\\n\\n/**\\n * @dev Interface of the ERC1271 standard signature validation method for\\n * contracts as defined in https://eips.ethereum.org/EIPS/eip-1271[ERC-1271].\\n *\\n * _Available since v4.1._\\n */\\ninterface IERC1271 {\\n /**\\n * @dev Should return whether the signature provided is valid for the provided data\\n * @param hash Hash of the data to be signed\\n * @param signature Signature byte array associated with _data\\n */\\n function isValidSignature(bytes32 hash, bytes memory signature) external view returns (bytes4 magicValue);\\n}\\n\",\"keccak256\":\"0x0705a4b1b86d7b0bd8432118f226ba139c44b9dcaba0a6eafba2dd7d0639c544\",\"license\":\"MIT\"},\"@openzeppelin/contracts/token/ERC20/IERC20.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.5.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 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(\\n address from,\\n address to,\\n uint256 amount\\n ) external returns (bool);\\n\\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\",\"keccak256\":\"0xbbc8ac883ac3c0078ce5ad3e288fbb3ffcc8a30c3a98c0fda0114d64fc44fca2\",\"license\":\"MIT\"},\"@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts v4.4.1 (token/ERC20/utils/SafeERC20.sol)\\n\\npragma solidity ^0.8.0;\\n\\nimport \\\"../IERC20.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 function safeTransfer(\\n IERC20 token,\\n address to,\\n uint256 value\\n ) internal {\\n _callOptionalReturn(token, abi.encodeWithSelector(token.transfer.selector, to, value));\\n }\\n\\n function safeTransferFrom(\\n IERC20 token,\\n address from,\\n address to,\\n uint256 value\\n ) 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(\\n IERC20 token,\\n address spender,\\n uint256 value\\n ) 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 function safeIncreaseAllowance(\\n IERC20 token,\\n address spender,\\n uint256 value\\n ) internal {\\n uint256 newAllowance = token.allowance(address(this), spender) + value;\\n _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, newAllowance));\\n }\\n\\n function safeDecreaseAllowance(\\n IERC20 token,\\n address spender,\\n uint256 value\\n ) internal {\\n unchecked {\\n uint256 oldAllowance = token.allowance(address(this), spender);\\n require(oldAllowance >= value, \\\"SafeERC20: decreased allowance below zero\\\");\\n uint256 newAllowance = oldAllowance - value;\\n _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, newAllowance));\\n }\\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 if (returndata.length > 0) {\\n // Return data is optional\\n require(abi.decode(returndata, (bool)), \\\"SafeERC20: ERC20 operation did not succeed\\\");\\n }\\n }\\n}\\n\",\"keccak256\":\"0xc3d946432c0ddbb1f846a0d3985be71299df331b91d06732152117f62f0be2b5\",\"license\":\"MIT\"},\"@openzeppelin/contracts/utils/Address.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.5.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 *\\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://diligence.consensys.net/posts/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.5.11/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 functionCall(target, data, \\\"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(\\n address target,\\n bytes memory data,\\n uint256 value\\n ) 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 require(isContract(target), \\\"Address: call to non-contract\\\");\\n\\n (bool success, bytes memory returndata) = target.call{value: value}(data);\\n return verifyCallResult(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 require(isContract(target), \\\"Address: static call to non-contract\\\");\\n\\n (bool success, bytes memory returndata) = target.staticcall(data);\\n return verifyCallResult(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 require(isContract(target), \\\"Address: delegate call to non-contract\\\");\\n\\n (bool success, bytes memory returndata) = target.delegatecall(data);\\n return verifyCallResult(success, returndata, errorMessage);\\n }\\n\\n /**\\n * @dev Tool to verifies that a low level call was successful, and revert if it wasn't, either by bubbling the\\n * revert reason 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 // 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\\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}\\n\",\"keccak256\":\"0x2ccf9d2313a313d41a791505f2b5abfdc62191b5d4334f7f7a82691c088a1c87\",\"license\":\"MIT\"},\"@openzeppelin/contracts/utils/Strings.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts v4.4.1 (utils/Strings.sol)\\n\\npragma solidity ^0.8.0;\\n\\n/**\\n * @dev String operations.\\n */\\nlibrary Strings {\\n bytes16 private constant _HEX_SYMBOLS = \\\"0123456789abcdef\\\";\\n\\n /**\\n * @dev Converts a `uint256` to its ASCII `string` decimal representation.\\n */\\n function toString(uint256 value) internal pure returns (string memory) {\\n // Inspired by OraclizeAPI's implementation - MIT licence\\n // https://github.com/oraclize/ethereum-api/blob/b42146b063c7d6ee1358846c198246239e9360e8/oraclizeAPI_0.4.25.sol\\n\\n if (value == 0) {\\n return \\\"0\\\";\\n }\\n uint256 temp = value;\\n uint256 digits;\\n while (temp != 0) {\\n digits++;\\n temp /= 10;\\n }\\n bytes memory buffer = new bytes(digits);\\n while (value != 0) {\\n digits -= 1;\\n buffer[digits] = bytes1(uint8(48 + uint256(value % 10)));\\n value /= 10;\\n }\\n return string(buffer);\\n }\\n\\n /**\\n * @dev Converts a `uint256` to its ASCII `string` hexadecimal representation.\\n */\\n function toHexString(uint256 value) internal pure returns (string memory) {\\n if (value == 0) {\\n return \\\"0x00\\\";\\n }\\n uint256 temp = value;\\n uint256 length = 0;\\n while (temp != 0) {\\n length++;\\n temp >>= 8;\\n }\\n return toHexString(value, length);\\n }\\n\\n /**\\n * @dev Converts a `uint256` to its ASCII `string` hexadecimal representation with fixed length.\\n */\\n function toHexString(uint256 value, uint256 length) internal pure returns (string memory) {\\n bytes memory buffer = new bytes(2 * length + 2);\\n buffer[0] = \\\"0\\\";\\n buffer[1] = \\\"x\\\";\\n for (uint256 i = 2 * length + 1; i > 1; --i) {\\n buffer[i] = _HEX_SYMBOLS[value & 0xf];\\n value >>= 4;\\n }\\n require(value == 0, \\\"Strings: hex length insufficient\\\");\\n return string(buffer);\\n }\\n}\\n\",\"keccak256\":\"0x32c202bd28995dd20c4347b7c6467a6d3241c74c8ad3edcbb610cd9205916c45\",\"license\":\"MIT\"},\"@openzeppelin/contracts/utils/cryptography/ECDSA.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.5.0) (utils/cryptography/ECDSA.sol)\\n\\npragma solidity ^0.8.0;\\n\\nimport \\\"../Strings.sol\\\";\\n\\n/**\\n * @dev Elliptic Curve Digital Signature Algorithm (ECDSA) operations.\\n *\\n * These functions can be used to verify that a message was signed by the holder\\n * of the private keys of a given address.\\n */\\nlibrary ECDSA {\\n enum RecoverError {\\n NoError,\\n InvalidSignature,\\n InvalidSignatureLength,\\n InvalidSignatureS,\\n InvalidSignatureV\\n }\\n\\n function _throwError(RecoverError error) private pure {\\n if (error == RecoverError.NoError) {\\n return; // no error: do nothing\\n } else if (error == RecoverError.InvalidSignature) {\\n revert(\\\"ECDSA: invalid signature\\\");\\n } else if (error == RecoverError.InvalidSignatureLength) {\\n revert(\\\"ECDSA: invalid signature length\\\");\\n } else if (error == RecoverError.InvalidSignatureS) {\\n revert(\\\"ECDSA: invalid signature 's' value\\\");\\n } else if (error == RecoverError.InvalidSignatureV) {\\n revert(\\\"ECDSA: invalid signature 'v' value\\\");\\n }\\n }\\n\\n /**\\n * @dev Returns the address that signed a hashed message (`hash`) with\\n * `signature` or error string. This address can then be used for verification purposes.\\n *\\n * The `ecrecover` EVM opcode allows for malleable (non-unique) signatures:\\n * this function rejects them by requiring the `s` value to be in the lower\\n * half order, and the `v` value to be either 27 or 28.\\n *\\n * IMPORTANT: `hash` _must_ be the result of a hash operation for the\\n * verification to be secure: it is possible to craft signatures that\\n * recover to arbitrary addresses for non-hashed data. A safe way to ensure\\n * this is by receiving a hash of the original message (which may otherwise\\n * be too long), and then calling {toEthSignedMessageHash} on it.\\n *\\n * Documentation for signature generation:\\n * - with https://web3js.readthedocs.io/en/v1.3.4/web3-eth-accounts.html#sign[Web3.js]\\n * - with https://docs.ethers.io/v5/api/signer/#Signer-signMessage[ethers]\\n *\\n * _Available since v4.3._\\n */\\n function tryRecover(bytes32 hash, bytes memory signature) internal pure returns (address, RecoverError) {\\n // Check the signature length\\n // - case 65: r,s,v signature (standard)\\n // - case 64: r,vs signature (cf https://eips.ethereum.org/EIPS/eip-2098) _Available since v4.1._\\n if (signature.length == 65) {\\n bytes32 r;\\n bytes32 s;\\n uint8 v;\\n // ecrecover takes the signature parameters, and the only way to get them\\n // currently is to use assembly.\\n assembly {\\n r := mload(add(signature, 0x20))\\n s := mload(add(signature, 0x40))\\n v := byte(0, mload(add(signature, 0x60)))\\n }\\n return tryRecover(hash, v, r, s);\\n } else if (signature.length == 64) {\\n bytes32 r;\\n bytes32 vs;\\n // ecrecover takes the signature parameters, and the only way to get them\\n // currently is to use assembly.\\n assembly {\\n r := mload(add(signature, 0x20))\\n vs := mload(add(signature, 0x40))\\n }\\n return tryRecover(hash, r, vs);\\n } else {\\n return (address(0), RecoverError.InvalidSignatureLength);\\n }\\n }\\n\\n /**\\n * @dev Returns the address that signed a hashed message (`hash`) with\\n * `signature`. This address can then be used for verification purposes.\\n *\\n * The `ecrecover` EVM opcode allows for malleable (non-unique) signatures:\\n * this function rejects them by requiring the `s` value to be in the lower\\n * half order, and the `v` value to be either 27 or 28.\\n *\\n * IMPORTANT: `hash` _must_ be the result of a hash operation for the\\n * verification to be secure: it is possible to craft signatures that\\n * recover to arbitrary addresses for non-hashed data. A safe way to ensure\\n * this is by receiving a hash of the original message (which may otherwise\\n * be too long), and then calling {toEthSignedMessageHash} on it.\\n */\\n function recover(bytes32 hash, bytes memory signature) internal pure returns (address) {\\n (address recovered, RecoverError error) = tryRecover(hash, signature);\\n _throwError(error);\\n return recovered;\\n }\\n\\n /**\\n * @dev Overload of {ECDSA-tryRecover} that receives the `r` and `vs` short-signature fields separately.\\n *\\n * See https://eips.ethereum.org/EIPS/eip-2098[EIP-2098 short signatures]\\n *\\n * _Available since v4.3._\\n */\\n function tryRecover(\\n bytes32 hash,\\n bytes32 r,\\n bytes32 vs\\n ) internal pure returns (address, RecoverError) {\\n bytes32 s = vs & bytes32(0x7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff);\\n uint8 v = uint8((uint256(vs) >> 255) + 27);\\n return tryRecover(hash, v, r, s);\\n }\\n\\n /**\\n * @dev Overload of {ECDSA-recover} that receives the `r and `vs` short-signature fields separately.\\n *\\n * _Available since v4.2._\\n */\\n function recover(\\n bytes32 hash,\\n bytes32 r,\\n bytes32 vs\\n ) internal pure returns (address) {\\n (address recovered, RecoverError error) = tryRecover(hash, r, vs);\\n _throwError(error);\\n return recovered;\\n }\\n\\n /**\\n * @dev Overload of {ECDSA-tryRecover} that receives the `v`,\\n * `r` and `s` signature fields separately.\\n *\\n * _Available since v4.3._\\n */\\n function tryRecover(\\n bytes32 hash,\\n uint8 v,\\n bytes32 r,\\n bytes32 s\\n ) internal pure returns (address, RecoverError) {\\n // EIP-2 still allows signature malleability for ecrecover(). Remove this possibility and make the signature\\n // unique. Appendix F in the Ethereum Yellow paper (https://ethereum.github.io/yellowpaper/paper.pdf), defines\\n // the valid range for s in (301): 0 < s < secp256k1n \\u00f7 2 + 1, and for v in (302): v \\u2208 {27, 28}. Most\\n // signatures from current libraries generate a unique signature with an s-value in the lower half order.\\n //\\n // If your library generates malleable signatures, such as s-values in the upper range, calculate a new s-value\\n // with 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFEBAAEDCE6AF48A03BBFD25E8CD0364141 - s1 and flip v from 27 to 28 or\\n // vice versa. If your library also generates signatures with 0/1 for v instead 27/28, add 27 to v to accept\\n // these malleable signatures as well.\\n if (uint256(s) > 0x7FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF5D576E7357A4501DDFE92F46681B20A0) {\\n return (address(0), RecoverError.InvalidSignatureS);\\n }\\n if (v != 27 && v != 28) {\\n return (address(0), RecoverError.InvalidSignatureV);\\n }\\n\\n // If the signature is valid (and not malleable), return the signer address\\n address signer = ecrecover(hash, v, r, s);\\n if (signer == address(0)) {\\n return (address(0), RecoverError.InvalidSignature);\\n }\\n\\n return (signer, RecoverError.NoError);\\n }\\n\\n /**\\n * @dev Overload of {ECDSA-recover} that receives the `v`,\\n * `r` and `s` signature fields separately.\\n */\\n function recover(\\n bytes32 hash,\\n uint8 v,\\n bytes32 r,\\n bytes32 s\\n ) internal pure returns (address) {\\n (address recovered, RecoverError error) = tryRecover(hash, v, r, s);\\n _throwError(error);\\n return recovered;\\n }\\n\\n /**\\n * @dev Returns an Ethereum Signed Message, created from a `hash`. This\\n * produces hash corresponding to the one signed with the\\n * https://eth.wiki/json-rpc/API#eth_sign[`eth_sign`]\\n * JSON-RPC method as part of EIP-191.\\n *\\n * See {recover}.\\n */\\n function toEthSignedMessageHash(bytes32 hash) internal pure returns (bytes32) {\\n // 32 is the length in bytes of hash,\\n // enforced by the type signature above\\n return keccak256(abi.encodePacked(\\\"\\\\x19Ethereum Signed Message:\\\\n32\\\", hash));\\n }\\n\\n /**\\n * @dev Returns an Ethereum Signed Message, created from `s`. This\\n * produces hash corresponding to the one signed with the\\n * https://eth.wiki/json-rpc/API#eth_sign[`eth_sign`]\\n * JSON-RPC method as part of EIP-191.\\n *\\n * See {recover}.\\n */\\n function toEthSignedMessageHash(bytes memory s) internal pure returns (bytes32) {\\n return keccak256(abi.encodePacked(\\\"\\\\x19Ethereum Signed Message:\\\\n\\\", Strings.toString(s.length), s));\\n }\\n\\n /**\\n * @dev Returns an Ethereum Signed Typed Data, created from a\\n * `domainSeparator` and a `structHash`. This produces hash corresponding\\n * to the one signed with the\\n * https://eips.ethereum.org/EIPS/eip-712[`eth_signTypedData`]\\n * JSON-RPC method as part of EIP-712.\\n *\\n * See {recover}.\\n */\\n function toTypedDataHash(bytes32 domainSeparator, bytes32 structHash) internal pure returns (bytes32) {\\n return keccak256(abi.encodePacked(\\\"\\\\x19\\\\x01\\\", domainSeparator, structHash));\\n }\\n}\\n\",\"keccak256\":\"0x3c07f43e60e099b3b157243b3152722e73b80eeb7985c2cd73712828d7f7da29\",\"license\":\"MIT\"},\"@openzeppelin/contracts/utils/cryptography/MerkleProof.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.5.0) (utils/cryptography/MerkleProof.sol)\\n\\npragma solidity ^0.8.0;\\n\\n/**\\n * @dev These functions deal with verification of Merkle Trees proofs.\\n *\\n * The proofs can be generated using the JavaScript library\\n * https://github.com/miguelmota/merkletreejs[merkletreejs].\\n * Note: the hashing algorithm should be keccak256 and pair sorting should be enabled.\\n *\\n * See `test/utils/cryptography/MerkleProof.test.js` for some examples.\\n */\\nlibrary MerkleProof {\\n /**\\n * @dev Returns true if a `leaf` can be proved to be a part of a Merkle tree\\n * defined by `root`. For this, a `proof` must be provided, containing\\n * sibling hashes on the branch from the leaf to the root of the tree. Each\\n * pair of leaves and each pair of pre-images are assumed to be sorted.\\n */\\n function verify(\\n bytes32[] memory proof,\\n bytes32 root,\\n bytes32 leaf\\n ) internal pure returns (bool) {\\n return processProof(proof, leaf) == root;\\n }\\n\\n /**\\n * @dev Returns the rebuilt hash obtained by traversing a Merklee tree up\\n * from `leaf` using `proof`. A `proof` is valid if and only if the rebuilt\\n * hash matches the root of the tree. When processing the proof, the pairs\\n * of leafs & pre-images are assumed to be sorted.\\n *\\n * _Available since v4.4._\\n */\\n function processProof(bytes32[] memory proof, bytes32 leaf) internal pure returns (bytes32) {\\n bytes32 computedHash = leaf;\\n for (uint256 i = 0; i < proof.length; i++) {\\n bytes32 proofElement = proof[i];\\n if (computedHash <= proofElement) {\\n // Hash(current computed hash + current element of the proof)\\n computedHash = _efficientHash(computedHash, proofElement);\\n } else {\\n // Hash(current element of the proof + current computed hash)\\n computedHash = _efficientHash(proofElement, computedHash);\\n }\\n }\\n return computedHash;\\n }\\n\\n function _efficientHash(bytes32 a, bytes32 b) private pure returns (bytes32 value) {\\n assembly {\\n mstore(0x00, a)\\n mstore(0x20, b)\\n value := keccak256(0x00, 0x40)\\n }\\n }\\n}\\n\",\"keccak256\":\"0xea64fbaccbf9d8c235cf6838240ddcebb97f9fc383660289e9dff32e4fb85f7a\",\"license\":\"MIT\"},\"@openzeppelin/contracts/utils/cryptography/SignatureChecker.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.5.0) (utils/cryptography/SignatureChecker.sol)\\n\\npragma solidity ^0.8.0;\\n\\nimport \\\"./ECDSA.sol\\\";\\nimport \\\"../Address.sol\\\";\\nimport \\\"../../interfaces/IERC1271.sol\\\";\\n\\n/**\\n * @dev Signature verification helper that can be used instead of `ECDSA.recover` to seamlessly support both ECDSA\\n * signatures from externally owned accounts (EOAs) as well as ERC1271 signatures from smart contract wallets like\\n * Argent and Gnosis Safe.\\n *\\n * _Available since v4.1._\\n */\\nlibrary SignatureChecker {\\n /**\\n * @dev Checks if a signature is valid for a given signer and data hash. If the signer is a smart contract, the\\n * signature is validated against that smart contract using ERC1271, otherwise it's validated using `ECDSA.recover`.\\n *\\n * NOTE: Unlike ECDSA signatures, contract signatures are revocable, and the outcome of this function can thus\\n * change through time. It could return true at block N and false at block N+1 (or the opposite).\\n */\\n function isValidSignatureNow(\\n address signer,\\n bytes32 hash,\\n bytes memory signature\\n ) internal view returns (bool) {\\n (address recovered, ECDSA.RecoverError error) = ECDSA.tryRecover(hash, signature);\\n if (error == ECDSA.RecoverError.NoError && recovered == signer) {\\n return true;\\n }\\n\\n (bool success, bytes memory result) = signer.staticcall(\\n abi.encodeWithSelector(IERC1271.isValidSignature.selector, hash, signature)\\n );\\n return (success && result.length == 32 && abi.decode(result, (bytes4)) == IERC1271.isValidSignature.selector);\\n }\\n}\\n\",\"keccak256\":\"0xc8add71d80d05a1390e1c656686a0ea10ffaebfcc433cc397a63fd725f376b7e\",\"license\":\"MIT\"},\"@uma/core/contracts/common/implementation/MultiCaller.sol\":{\"content\":\"// This contract is taken from Uniswaps'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.\\npragma solidity ^0.8.0;\\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 payable returns (bytes[] memory results) {\\n require(msg.value == 0, \\\"Only multicall with 0 value\\\");\\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\",\"keccak256\":\"0x31f18055b14fd9eeb459c6d6a88d1a60921bf3755031f6db4b709c3e01d078f7\"},\"@uma/core/contracts/common/implementation/Testable.sol\":{\"content\":\"// SPDX-License-Identifier: AGPL-3.0-only\\npragma solidity ^0.8.0;\\n\\nimport \\\"./Timer.sol\\\";\\n\\n/**\\n * @title Base class that provides time overrides, but only if being run in test mode.\\n */\\nabstract contract Testable {\\n // If the contract is being run in production, then `timerAddress` will be the 0x0 address.\\n // Note: this variable should be set on construction and never modified.\\n address public timerAddress;\\n\\n /**\\n * @notice Constructs the Testable contract. Called by child contracts.\\n * @param _timerAddress Contract that stores the current time in a testing environment.\\n * Must be set to 0x0 for production environments that use live time.\\n */\\n constructor(address _timerAddress) {\\n timerAddress = _timerAddress;\\n }\\n\\n /**\\n * @notice Reverts if not running in test mode.\\n */\\n modifier onlyIfTest {\\n require(timerAddress != address(0x0));\\n _;\\n }\\n\\n /**\\n * @notice Sets the current time.\\n * @dev Will revert if not running in test mode.\\n * @param time timestamp to set current Testable time to.\\n */\\n function setCurrentTime(uint256 time) external onlyIfTest {\\n Timer(timerAddress).setCurrentTime(time);\\n }\\n\\n /**\\n * @notice Gets the current time. Will return the last time set in `setCurrentTime` if running in test mode.\\n * Otherwise, it will return the block timestamp.\\n * @return uint for the current Testable timestamp.\\n */\\n function getCurrentTime() public view virtual returns (uint256) {\\n if (timerAddress != address(0x0)) {\\n return Timer(timerAddress).getCurrentTime();\\n } else {\\n return block.timestamp; // solhint-disable-line not-rely-on-time\\n }\\n }\\n}\\n\",\"keccak256\":\"0x0254b45747293bb800373a58d123969adec0428f7be79dc941cab10fcad09918\",\"license\":\"AGPL-3.0-only\"},\"@uma/core/contracts/common/implementation/Timer.sol\":{\"content\":\"// SPDX-License-Identifier: AGPL-3.0-only\\npragma solidity ^0.8.0;\\n\\n/**\\n * @title Universal store of current contract time for testing environments.\\n */\\ncontract Timer {\\n uint256 private currentTime;\\n\\n constructor() {\\n currentTime = block.timestamp; // solhint-disable-line not-rely-on-time\\n }\\n\\n /**\\n * @notice Sets the current time.\\n * @dev Will revert if not running in test mode.\\n * @param time timestamp to set `currentTime` to.\\n */\\n function setCurrentTime(uint256 time) external {\\n currentTime = time;\\n }\\n\\n /**\\n * @notice Gets the currentTime variable set in the Timer.\\n * @return uint256 for the current Testable timestamp.\\n */\\n function getCurrentTime() public view returns (uint256) {\\n return currentTime;\\n }\\n}\\n\",\"keccak256\":\"0x9e0dd7389718bd5d1da910273a6f4cee98ee22bfc0c92bde0f0955c0e23adb5e\",\"license\":\"AGPL-3.0-only\"},\"contracts/HubPoolInterface.sol\":{\"content\":\"// SPDX-License-Identifier: GPL-3.0-only\\npragma solidity ^0.8.0;\\n\\nimport \\\"@openzeppelin/contracts/token/ERC20/IERC20.sol\\\";\\nimport \\\"./interfaces/AdapterInterface.sol\\\";\\n\\n/**\\n * @notice Concise list of functions in HubPool implementation.\\n */\\ninterface HubPoolInterface {\\n // This leaf is meant to be decoded in the HubPool to rebalance tokens between HubPool and SpokePool.\\n struct PoolRebalanceLeaf {\\n // This is used to know which chain to send cross-chain transactions to (and which SpokePool to sent to).\\n uint256 chainId;\\n // Total LP fee amount per token in this bundle, encompassing all associated bundled relays.\\n uint256[] bundleLpFees;\\n // This array is grouped with the two above, and it represents the amount to send or request back from the\\n // SpokePool. If positive, the pool will pay the SpokePool. If negative the SpokePool will pay the HubPool.\\n // There can be arbitrarily complex rebalancing rules defined offchain. This number is only nonzero\\n // when the rules indicate that a rebalancing action should occur. When a rebalance does not occur,\\n // runningBalances for this token should change by the total relays - deposits in this bundle. When a rebalance\\n // does occur, runningBalances should be set to zero for this token and the netSendAmounts should be set to the\\n // previous runningBalances + relays - deposits in this bundle.\\n int256[] netSendAmounts;\\n // This is only here to be emitted in an event to track a running unpaid balance between the L2 pool and the L1 pool.\\n // A positive number indicates that the HubPool owes the SpokePool funds. A negative number indicates that the\\n // SpokePool owes the HubPool funds. See the comment above for the dynamics of this and netSendAmounts\\n int256[] runningBalances;\\n // Used as the index in the bitmap to track whether this leaf has been executed or not.\\n uint8 leafId;\\n // The following arrays are required to be the same length. They are parallel arrays for the given chainId and\\n // should be ordered by the l1Tokens field. All whitelisted tokens with nonzero relays on this chain in this\\n // bundle in the order of whitelisting.\\n address[] l1Tokens;\\n }\\n\\n function relaySpokePoolAdminFunction(uint256 chainId, bytes memory functionData) external;\\n\\n function setProtocolFeeCapture(address newProtocolFeeCaptureAddress, uint256 newProtocolFeeCapturePct) external;\\n\\n function setBond(IERC20 newBondToken, uint256 newBondAmount) external;\\n\\n function setLiveness(uint32 newLiveness) external;\\n\\n function setIdentifier(bytes32 newIdentifier) external;\\n\\n function setCrossChainContracts(\\n uint256 l2ChainId,\\n address adapter,\\n address spokePool\\n ) external;\\n\\n function whitelistRoute(\\n uint256 originChainId,\\n uint256 destinationChainId,\\n address originToken,\\n address destinationToken,\\n bool enableRoute\\n ) external;\\n\\n function enableL1TokenForLiquidityProvision(address l1Token) external;\\n\\n function disableL1TokenForLiquidityProvision(address l1Token) external;\\n\\n function addLiquidity(address l1Token, uint256 l1TokenAmount) external payable;\\n\\n function removeLiquidity(\\n address l1Token,\\n uint256 lpTokenAmount,\\n bool sendEth\\n ) external;\\n\\n function exchangeRateCurrent(address l1Token) external returns (uint256);\\n\\n function liquidityUtilizationCurrent(address l1Token) external returns (uint256);\\n\\n function liquidityUtilizationPostRelay(address token, uint256 relayedAmount) external returns (uint256);\\n\\n function sync(address l1Token) external;\\n\\n function proposeRootBundle(\\n uint256[] memory bundleEvaluationBlockNumbers,\\n uint8 poolRebalanceLeafCount,\\n bytes32 poolRebalanceRoot,\\n bytes32 relayerRefundRoot,\\n bytes32 slowRelayRoot\\n ) external;\\n\\n function executeRootBundle(PoolRebalanceLeaf memory poolRebalanceLeaf, bytes32[] memory proof) external;\\n\\n function disputeRootBundle() external;\\n\\n function claimProtocolFeesCaptured(address l1Token) external;\\n\\n function getRootBundleProposalAncillaryData() external view returns (bytes memory ancillaryData);\\n\\n function whitelistedRoute(\\n uint256 originChainId,\\n address originToken,\\n uint256 destinationChainId\\n ) external view returns (address);\\n\\n function loadEthForL2Calls() external payable;\\n}\\n\",\"keccak256\":\"0x990c28fe43a929f5d0524ebabed269965d759d1294df4e75880b9d30b34397ed\",\"license\":\"GPL-3.0-only\"},\"contracts/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 * @dev The reason why we use this local contract instead of importing from uma/contracts is because of the addition\\n * of the internal method `functionCallStackOriginatesFromOutsideThisContract` which doesn't exist in the one exported\\n * by uma/contracts.\\n */\\ncontract Lockable {\\n bool internal _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 /**\\n * @dev Returns true if the contract is currently in a non-entered state, meaning that the origination of the call\\n * came from outside the contract. This is relevant with fallback/receive methods to see if the call came from ETH\\n * being dropped onto the contract externally or due to ETH dropped on the the contract from within a method in this\\n * contract, such as unwrapping WETH to ETH within the contract.\\n */\\n function functionCallStackOriginatesFromOutsideThisContract() internal view returns (bool) {\\n return _notEntered;\\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\",\"keccak256\":\"0xef490be5cb859c97c6f600f3b0db0d50c6e18f334d3c74c6d9e693a260eaec3e\",\"license\":\"AGPL-3.0-only\"},\"contracts/MerkleLib.sol\":{\"content\":\"// SPDX-License-Identifier: GPL-3.0-only\\npragma solidity ^0.8.0;\\n\\nimport \\\"@openzeppelin/contracts/utils/cryptography/MerkleProof.sol\\\";\\nimport \\\"./SpokePoolInterface.sol\\\";\\nimport \\\"./HubPoolInterface.sol\\\";\\n\\n/**\\n * @notice Library to help with merkle roots, proofs, and claims.\\n */\\nlibrary MerkleLib {\\n /**\\n * @notice Verifies that a repayment is contained within a merkle root.\\n * @param root the merkle root.\\n * @param rebalance the rebalance struct.\\n * @param proof the merkle proof.\\n */\\n function verifyPoolRebalance(\\n bytes32 root,\\n HubPoolInterface.PoolRebalanceLeaf memory rebalance,\\n bytes32[] memory proof\\n ) internal pure returns (bool) {\\n return MerkleProof.verify(proof, root, keccak256(abi.encode(rebalance)));\\n }\\n\\n /**\\n * @notice Verifies that a relayer refund is contained within a merkle root.\\n * @param root the merkle root.\\n * @param refund the refund struct.\\n * @param proof the merkle proof.\\n */\\n function verifyRelayerRefund(\\n bytes32 root,\\n SpokePoolInterface.RelayerRefundLeaf memory refund,\\n bytes32[] memory proof\\n ) internal pure returns (bool) {\\n return MerkleProof.verify(proof, root, keccak256(abi.encode(refund)));\\n }\\n\\n /**\\n * @notice Verifies that a distribution is contained within a merkle root.\\n * @param root the merkle root.\\n * @param slowRelayFulfillment the relayData fulfullment struct.\\n * @param proof the merkle proof.\\n */\\n function verifySlowRelayFulfillment(\\n bytes32 root,\\n SpokePoolInterface.RelayData memory slowRelayFulfillment,\\n bytes32[] memory proof\\n ) internal pure returns (bool) {\\n return MerkleProof.verify(proof, root, keccak256(abi.encode(slowRelayFulfillment)));\\n }\\n\\n // The following functions are primarily copied from\\n // https://github.com/Uniswap/merkle-distributor/blob/master/contracts/MerkleDistributor.sol with minor changes.\\n\\n /**\\n * @notice Tests whether a claim is contained within a claimedBitMap mapping.\\n * @param claimedBitMap a simple uint256 mapping in storage used as a bitmap.\\n * @param index the index to check in the bitmap.\\n * @return bool indicating if the index within the claimedBitMap has been marked as claimed.\\n */\\n function isClaimed(mapping(uint256 => uint256) storage claimedBitMap, uint256 index) internal view returns (bool) {\\n uint256 claimedWordIndex = index / 256;\\n uint256 claimedBitIndex = index % 256;\\n uint256 claimedWord = claimedBitMap[claimedWordIndex];\\n uint256 mask = (1 << claimedBitIndex);\\n return claimedWord & mask == mask;\\n }\\n\\n /**\\n * @notice Marks an index in a claimedBitMap as claimed.\\n * @param claimedBitMap a simple uint256 mapping in storage used as a bitmap.\\n * @param index the index to mark in the bitmap.\\n */\\n function setClaimed(mapping(uint256 => uint256) storage claimedBitMap, uint256 index) internal {\\n uint256 claimedWordIndex = index / 256;\\n uint256 claimedBitIndex = index % 256;\\n claimedBitMap[claimedWordIndex] = claimedBitMap[claimedWordIndex] | (1 << claimedBitIndex);\\n }\\n\\n /**\\n * @notice Tests whether a claim is contained within a 1D claimedBitMap mapping.\\n * @param claimedBitMap a simple uint256 value, encoding a 1D bitmap.\\n * @param index the index to check in the bitmap.\\n \\\\* @return bool indicating if the index within the claimedBitMap has been marked as claimed.\\n */\\n function isClaimed1D(uint256 claimedBitMap, uint256 index) internal pure returns (bool) {\\n uint256 mask = (1 << index);\\n return claimedBitMap & mask == mask;\\n }\\n\\n /**\\n * @notice Marks an index in a claimedBitMap as claimed.\\n * @param claimedBitMap a simple uint256 mapping in storage used as a bitmap.\\n * @param index the index to mark in the bitmap.\\n */\\n function setClaimed1D(uint256 claimedBitMap, uint256 index) internal pure returns (uint256) {\\n require(index <= 255, \\\"Index out of bounds\\\");\\n return claimedBitMap | (1 << index % 256);\\n }\\n}\\n\",\"keccak256\":\"0xfec238b342924f5226ab994aa108a9917bc840a89cd34c2ee6c6806161ef3e0c\",\"license\":\"GPL-3.0-only\"},\"contracts/Optimism_SpokePool.sol\":{\"content\":\"// SPDX-License-Identifier: GPL-3.0-only\\npragma solidity ^0.8.0;\\n\\nimport \\\"./interfaces/WETH9.sol\\\";\\n\\nimport \\\"@eth-optimism/contracts/libraries/bridge/CrossDomainEnabled.sol\\\";\\nimport \\\"@eth-optimism/contracts/libraries/constants/Lib_PredeployAddresses.sol\\\";\\nimport \\\"@eth-optimism/contracts/L2/messaging/IL2ERC20Bridge.sol\\\";\\nimport \\\"./SpokePool.sol\\\";\\nimport \\\"./SpokePoolInterface.sol\\\";\\n\\n/**\\n * @notice OVM specific SpokePool. Uses OVM cross-domain-enabled logic to implement admin only access to functions.\\n */\\ncontract Optimism_SpokePool is CrossDomainEnabled, SpokePool {\\n // \\\"l1Gas\\\" parameter used in call to bridge tokens from this contract back to L1 via IL2ERC20Bridge. Currently\\n // unused by bridge but included for future compatibility.\\n uint32 public l1Gas = 5_000_000;\\n\\n // ETH is an ERC20 on OVM.\\n address public l2Eth = address(Lib_PredeployAddresses.OVM_ETH);\\n\\n // Stores alternative token bridges to use for L2 tokens that don't go over the standard bridge. This is needed\\n // to support non-standard ERC20 tokens on Optimism, such as DIA and SNX which both use custom bridges.\\n mapping(address => address) public tokenBridges;\\n\\n event OptimismTokensBridged(address indexed l2Token, address target, uint256 numberOfTokensBridged, uint256 l1Gas);\\n event SetL1Gas(uint32 indexed newL1Gas);\\n event SetL2TokenBridge(address indexed l2Token, address indexed tokenBridge);\\n\\n /**\\n * @notice Construct the OVM SpokePool.\\n * @param _crossDomainAdmin Cross domain admin to set. Can be changed by admin.\\n * @param _hubPool Hub pool address to set. Can be changed by admin.\\n * @param timerAddress Timer address to set.\\n */\\n constructor(\\n address _crossDomainAdmin,\\n address _hubPool,\\n address timerAddress\\n )\\n CrossDomainEnabled(Lib_PredeployAddresses.L2_CROSS_DOMAIN_MESSENGER)\\n SpokePool(_crossDomainAdmin, _hubPool, 0x4200000000000000000000000000000000000006, timerAddress)\\n {}\\n\\n /*******************************************\\n * OPTIMISM-SPECIFIC ADMIN FUNCTIONS *\\n *******************************************/\\n\\n /**\\n * @notice Change L1 gas limit. Callable only by admin.\\n * @param newl1Gas New L1 gas limit to set.\\n */\\n function setL1GasLimit(uint32 newl1Gas) public onlyAdmin {\\n l1Gas = newl1Gas;\\n emit SetL1Gas(newl1Gas);\\n }\\n\\n /**\\n * @notice Set bridge contract for L2 token used to withdraw back to L1.\\n * @dev If this mapping isn't set for an L2 token, then the standard bridge will be used to bridge this token.\\n * @param tokenBridge Address of token bridge\\n */\\n function setTokenBridge(address l2Token, address tokenBridge) public onlyAdmin {\\n tokenBridges[l2Token] = tokenBridge;\\n emit SetL2TokenBridge(l2Token, tokenBridge);\\n }\\n\\n /**************************************\\n * DATA WORKER FUNCTIONS *\\n **************************************/\\n\\n /**\\n * @notice Wraps any ETH into WETH before executing base function. This is necessary because SpokePool receives\\n * ETH over the canonical token bridge instead of WETH.\\n * @inheritdoc SpokePool\\n */\\n function executeSlowRelayRoot(\\n address depositor,\\n address recipient,\\n address destinationToken,\\n uint256 totalRelayAmount,\\n uint256 originChainId,\\n uint64 realizedLpFeePct,\\n uint64 relayerFeePct,\\n uint32 depositId,\\n uint32 rootBundleId,\\n bytes32[] memory proof\\n ) public override(SpokePool) nonReentrant {\\n if (destinationToken == address(weth)) _depositEthToWeth();\\n\\n _executeSlowRelayRoot(\\n depositor,\\n recipient,\\n destinationToken,\\n totalRelayAmount,\\n originChainId,\\n realizedLpFeePct,\\n relayerFeePct,\\n depositId,\\n rootBundleId,\\n proof\\n );\\n }\\n\\n /**\\n * @notice Wraps any ETH into WETH before executing base function. This is necessary because SpokePool receives\\n * ETH over the canonical token bridge instead of WETH.\\n * @inheritdoc SpokePool\\n */\\n function executeRelayerRefundRoot(\\n uint32 rootBundleId,\\n SpokePoolInterface.RelayerRefundLeaf memory relayerRefundLeaf,\\n bytes32[] memory proof\\n ) public override(SpokePool) nonReentrant {\\n if (relayerRefundLeaf.l2TokenAddress == address(weth)) _depositEthToWeth();\\n\\n _executeRelayerRefundRoot(rootBundleId, relayerRefundLeaf, proof);\\n }\\n\\n /**************************************\\n * INTERNAL FUNCTIONS *\\n **************************************/\\n\\n // Wrap any ETH owned by this contract so we can send expected L2 token to recipient. This is necessary because\\n // this SpokePool will receive ETH from the canonical token bridge instead of WETH. Its not sufficient to execute\\n // this logic inside a fallback method that executes when this contract receives ETH because ETH is an ERC20\\n // on the OVM.\\n function _depositEthToWeth() internal {\\n if (address(this).balance > 0) weth.deposit{ value: address(this).balance }();\\n }\\n\\n function _bridgeTokensToHubPool(RelayerRefundLeaf memory relayerRefundLeaf) internal override {\\n // If the token being bridged is WETH then we need to first unwrap it to ETH and then send ETH over the\\n // canonical bridge. On Optimism, this is address 0xDeadDeAddeAddEAddeadDEaDDEAdDeaDDeAD0000.\\n if (relayerRefundLeaf.l2TokenAddress == address(weth)) {\\n WETH9(relayerRefundLeaf.l2TokenAddress).withdraw(relayerRefundLeaf.amountToReturn); // Unwrap into ETH.\\n relayerRefundLeaf.l2TokenAddress = l2Eth; // Set the l2TokenAddress to ETH.\\n }\\n IL2ERC20Bridge(\\n tokenBridges[relayerRefundLeaf.l2TokenAddress] == address(0)\\n ? Lib_PredeployAddresses.L2_STANDARD_BRIDGE\\n : tokenBridges[relayerRefundLeaf.l2TokenAddress]\\n ).withdrawTo(\\n relayerRefundLeaf.l2TokenAddress, // _l2Token. Address of the L2 token to bridge over.\\n hubPool, // _to. Withdraw, over the bridge, to the l1 pool contract.\\n relayerRefundLeaf.amountToReturn, // _amount.\\n l1Gas, // _l1Gas. Unused, but included for potential forward compatibility considerations\\n \\\"\\\" // _data. We don't need to send any data for the bridging action.\\n );\\n\\n emit OptimismTokensBridged(relayerRefundLeaf.l2TokenAddress, hubPool, relayerRefundLeaf.amountToReturn, l1Gas);\\n }\\n\\n // Apply OVM-specific transformation to cross domain admin address on L1.\\n function _requireAdminSender() internal override onlyFromCrossDomainAccount(crossDomainAdmin) {}\\n}\\n\",\"keccak256\":\"0xa27b44472c5dd0c7628257430a1d9e930c84caabc79e115a80558e668246a41d\",\"license\":\"GPL-3.0-only\"},\"contracts/SpokePool.sol\":{\"content\":\"// SPDX-License-Identifier: GPL-3.0-only\\npragma solidity ^0.8.0;\\n\\nimport \\\"./MerkleLib.sol\\\";\\nimport \\\"./interfaces/WETH9.sol\\\";\\n\\nimport \\\"@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol\\\";\\nimport \\\"@openzeppelin/contracts/token/ERC20/IERC20.sol\\\";\\nimport \\\"@openzeppelin/contracts/utils/Address.sol\\\";\\n\\nimport \\\"@openzeppelin/contracts/utils/cryptography/SignatureChecker.sol\\\";\\nimport \\\"@openzeppelin/contracts/utils/cryptography/ECDSA.sol\\\";\\n\\nimport \\\"@uma/core/contracts/common/implementation/Testable.sol\\\";\\nimport \\\"@uma/core/contracts/common/implementation/MultiCaller.sol\\\";\\nimport \\\"./Lockable.sol\\\";\\nimport \\\"./MerkleLib.sol\\\";\\nimport \\\"./SpokePoolInterface.sol\\\";\\n\\n/**\\n * @title SpokePool\\n * @notice Base contract deployed on source and destination chains enabling depositors to transfer assets from source to\\n * destination. Deposit orders are fulfilled by off-chain relayers who also interact with this contract. Deposited\\n * tokens are locked on the source chain and relayers send the recipient the desired token currency and amount\\n * on the destination chain. Locked source chain tokens are later sent over the canonical token bridge to L1 HubPool.\\n * Relayers are refunded with destination tokens out of this contract after another off-chain actor, a \\\"data worker\\\",\\n * submits a proof that the relayer correctly submitted a relay on this SpokePool.\\n */\\nabstract contract SpokePool is SpokePoolInterface, Testable, Lockable, MultiCaller {\\n using SafeERC20 for IERC20;\\n using Address for address;\\n\\n // Address of the L1 contract that acts as the owner of this SpokePool. If this contract is deployed on Ethereum,\\n // then this address should be set to the same owner as the HubPool and the whole system.\\n address public crossDomainAdmin;\\n\\n // Address of the L1 contract that will send tokens to and receive tokens from this contract to fund relayer\\n // refunds and slow relays.\\n address public hubPool;\\n\\n // Address of WETH contract for this network. If an origin token matches this, then the caller can optionally\\n // instruct this contract to wrap ETH when depositing.\\n WETH9 public weth;\\n\\n // Timestamp when contract was constructed. Relays cannot have a quote time before this.\\n uint32 public deploymentTime;\\n\\n // Any deposit quote times greater than or less than this value to the current contract time is blocked. Forces\\n // caller to use an approximately \\\"current\\\" realized fee. Defaults to 10 minutes.\\n uint32 public depositQuoteTimeBuffer = 600;\\n\\n // Count of deposits is used to construct a unique deposit identifier for this spoke pool.\\n uint32 public numberOfDeposits;\\n\\n // Origin token to destination token routings can be turned on or off, which can enable or disable deposits.\\n // A reverse mapping is stored on the L1 HubPool to enable or disable rebalance transfers from the HubPool to this\\n // contract.\\n mapping(address => mapping(uint256 => bool)) public enabledDepositRoutes;\\n\\n // Stores collection of merkle roots that can be published to this contract from the HubPool, which are referenced\\n // by \\\"data workers\\\" via inclusion proofs to execute leaves in the roots.\\n struct RootBundle {\\n // Merkle root of slow relays that were not fully filled and whose recipient is still owed funds from the LP pool.\\n bytes32 slowRelayRoot;\\n // Merkle root of relayer refunds for successful relays.\\n bytes32 relayerRefundRoot;\\n // This is a 2D bitmap tracking which leafs in the relayer refund root have been claimed, with max size of\\n // 256x256 leaves per root.\\n mapping(uint256 => uint256) claimedBitmap;\\n }\\n\\n // This contract can store as many root bundles as the HubPool chooses to publish here.\\n RootBundle[] public rootBundles;\\n\\n // Each relay is associated with the hash of parameters that uniquely identify the original deposit and a relay\\n // attempt for that deposit. The relay itself is just represented as the amount filled so far. The total amount to\\n // relay, the fees, and the agents are all parameters included in the hash key.\\n mapping(bytes32 => uint256) public relayFills;\\n\\n /****************************************\\n * EVENTS *\\n ****************************************/\\n event SetXDomainAdmin(address indexed newAdmin);\\n event SetHubPool(address indexed newHubPool);\\n event EnabledDepositRoute(address indexed originToken, uint256 indexed destinationChainId, bool enabled);\\n event SetDepositQuoteTimeBuffer(uint32 newBuffer);\\n event FundsDeposited(\\n uint256 amount,\\n uint256 destinationChainId,\\n uint64 relayerFeePct,\\n uint32 indexed depositId,\\n uint32 quoteTimestamp,\\n address indexed originToken,\\n address recipient,\\n address indexed depositor\\n );\\n event RequestedSpeedUpDeposit(\\n uint64 newRelayerFeePct,\\n uint32 indexed depositId,\\n address indexed depositor,\\n bytes depositorSignature\\n );\\n event FilledRelay(\\n bytes32 indexed relayHash,\\n uint256 amount,\\n uint256 totalFilledAmount,\\n uint256 fillAmount,\\n uint256 repaymentChainId,\\n uint256 originChainId,\\n uint64 relayerFeePct,\\n uint64 realizedLpFeePct,\\n uint32 depositId,\\n address destinationToken,\\n address indexed relayer,\\n address indexed depositor,\\n address recipient,\\n bool isSlowRelay\\n );\\n event RelayedRootBundle(uint32 indexed rootBundleId, bytes32 relayerRefundRoot, bytes32 slowRelayRoot);\\n event ExecutedRelayerRefundRoot(\\n uint256 amountToReturn,\\n uint256 indexed chainId,\\n uint256[] refundAmounts,\\n uint32 indexed rootBundleId,\\n uint32 indexed leafId,\\n address l2TokenAddress,\\n address[] refundAddresses,\\n address caller\\n );\\n event TokensBridged(\\n uint256 amountToReturn,\\n uint256 indexed chainId,\\n uint32 indexed leafId,\\n address indexed l2TokenAddress,\\n address caller\\n );\\n\\n /**\\n * @notice Construct the base SpokePool.\\n * @param _crossDomainAdmin Cross domain admin to set. Can be changed by admin.\\n * @param _hubPool Hub pool address to set. Can be changed by admin.\\n * @param _wethAddress Weth address for this network to set.\\n * @param timerAddress Timer address to set.\\n */\\n constructor(\\n address _crossDomainAdmin,\\n address _hubPool,\\n address _wethAddress,\\n address timerAddress\\n ) Testable(timerAddress) {\\n _setCrossDomainAdmin(_crossDomainAdmin);\\n _setHubPool(_hubPool);\\n deploymentTime = uint32(getCurrentTime());\\n weth = WETH9(_wethAddress);\\n }\\n\\n /****************************************\\n * MODIFIERS *\\n ****************************************/\\n\\n modifier onlyEnabledRoute(address originToken, uint256 destinationId) {\\n require(enabledDepositRoutes[originToken][destinationId], \\\"Disabled route\\\");\\n _;\\n }\\n\\n // Implementing contract needs to override _requireAdminSender() to ensure that admin functions are protected\\n // appropriately.\\n modifier onlyAdmin() {\\n _requireAdminSender();\\n _;\\n }\\n\\n /**************************************\\n * ADMIN FUNCTIONS *\\n **************************************/\\n\\n /**\\n * @notice Change cross domain admin address. Callable by admin only.\\n * @param newCrossDomainAdmin New cross domain admin.\\n */\\n function setCrossDomainAdmin(address newCrossDomainAdmin) public override onlyAdmin {\\n _setCrossDomainAdmin(newCrossDomainAdmin);\\n }\\n\\n /**\\n * @notice Change L1 hub pool address. Callable by admin only.\\n * @param newHubPool New hub pool.\\n */\\n function setHubPool(address newHubPool) public override onlyAdmin {\\n _setHubPool(newHubPool);\\n }\\n\\n /**\\n * @notice Enable/Disable an origin token => destination chain ID route for deposits. Callable by admin only.\\n * @param originToken Token that depositor can deposit to this contract.\\n * @param destinationChainId Chain ID for where depositor wants to receive funds.\\n * @param enabled True to enable deposits, False otherwise.\\n */\\n function setEnableRoute(\\n address originToken,\\n uint256 destinationChainId,\\n bool enabled\\n ) public override onlyAdmin {\\n enabledDepositRoutes[originToken][destinationChainId] = enabled;\\n emit EnabledDepositRoute(originToken, destinationChainId, enabled);\\n }\\n\\n /**\\n * @notice Change allowance for deposit quote time to differ from current block time. Callable by admin only.\\n * @param newDepositQuoteTimeBuffer New quote time buffer.\\n */\\n function setDepositQuoteTimeBuffer(uint32 newDepositQuoteTimeBuffer) public override onlyAdmin {\\n depositQuoteTimeBuffer = newDepositQuoteTimeBuffer;\\n emit SetDepositQuoteTimeBuffer(newDepositQuoteTimeBuffer);\\n }\\n\\n /**\\n * @notice This method stores a new root bundle in this contract that can be executed to refund relayers, fulfill\\n * slow relays, and send funds back to the HubPool on L1. This method can only be called by the admin and is\\n * designed to be called as part of a cross-chain message from the HubPool's executeRootBundle method.\\n * @param relayerRefundRoot Merkle root containing relayer refund leaves that can be individually executed via\\n * executeRelayerRefundRoot().\\n * @param slowRelayRoot Merkle root containing slow relay fulfillment leaves that can be individually executed via\\n * executeSlowRelayRoot().\\n */\\n function relayRootBundle(bytes32 relayerRefundRoot, bytes32 slowRelayRoot) public override onlyAdmin {\\n uint32 rootBundleId = uint32(rootBundles.length);\\n RootBundle storage rootBundle = rootBundles.push();\\n rootBundle.relayerRefundRoot = relayerRefundRoot;\\n rootBundle.slowRelayRoot = slowRelayRoot;\\n emit RelayedRootBundle(rootBundleId, relayerRefundRoot, slowRelayRoot);\\n }\\n\\n /**************************************\\n * DEPOSITOR FUNCTIONS *\\n **************************************/\\n\\n /**\\n * @notice Called by user to bridge funds from origin to destination chain. Depositor will effectively lock\\n * tokens in this contract and receive a destination token on the destination chain. The origin => destination\\n * token mapping is stored on the L1 HubPool.\\n * @notice The caller must first approve this contract to spend amount of originToken.\\n * @notice The originToken => destinationChainId must be enabled.\\n * @notice This method is payable because the caller is able to deposit ETH if the originToken is WETH and this\\n * function will handle wrapping ETH.\\n * @param recipient Address to receive funds at on destination chain.\\n * @param originToken Token to lock into this contract to initiate deposit.\\n * @param amount Amount of tokens to deposit. Will be amount of tokens to receive less fees.\\n * @param destinationChainId Denotes network where user will receive funds from SpokePool by a relayer.\\n * @param relayerFeePct % of deposit amount taken out to incentivize a fast relayer.\\n * @param quoteTimestamp Timestamp used by relayers to compute this deposit's realizedLPFeePct which is paid\\n * to LP pool on HubPool.\\n */\\n function deposit(\\n address recipient,\\n address originToken,\\n uint256 amount,\\n uint256 destinationChainId,\\n uint64 relayerFeePct,\\n uint32 quoteTimestamp\\n ) public payable override onlyEnabledRoute(originToken, destinationChainId) nonReentrant {\\n // We limit the relay fees to prevent the user spending all their funds on fees.\\n require(relayerFeePct < 0.5e18, \\\"invalid relayer fee\\\");\\n // This function assumes that L2 timing cannot be compared accurately and consistently to L1 timing. Therefore,\\n // block.timestamp is different from the L1 EVM's. Therefore, the quoteTimestamp must be within a configurable\\n // buffer of this contract's block time to allow for this variance.\\n // Note also that quoteTimestamp cannot be less than the buffer otherwise the following arithmetic can result\\n // in underflow. This isn't a problem as the deposit will revert, but the error might be unexpected for clients.\\n require(\\n getCurrentTime() >= quoteTimestamp - depositQuoteTimeBuffer &&\\n getCurrentTime() <= quoteTimestamp + depositQuoteTimeBuffer,\\n \\\"invalid quote time\\\"\\n );\\n // If the address of the origin token is a WETH contract and there is a msg.value with the transaction\\n // then the user is sending ETH. In this case, the ETH should be deposited to WETH.\\n if (originToken == address(weth) && msg.value > 0) {\\n require(msg.value == amount, \\\"msg.value must match amount\\\");\\n weth.deposit{ value: msg.value }();\\n // Else, it is a normal ERC20. In this case pull the token from the users wallet as per normal.\\n // Note: this includes the case where the L2 user has WETH (already wrapped ETH) and wants to bridge them.\\n // In this case the msg.value will be set to 0, indicating a \\\"normal\\\" ERC20 bridging action.\\n } else IERC20(originToken).safeTransferFrom(msg.sender, address(this), amount);\\n\\n emit FundsDeposited(\\n amount,\\n destinationChainId,\\n relayerFeePct,\\n numberOfDeposits,\\n quoteTimestamp,\\n originToken,\\n recipient,\\n msg.sender\\n );\\n\\n // Increment count of deposits so that deposit ID for this spoke pool is unique.\\n numberOfDeposits += 1;\\n }\\n\\n /**\\n * @notice Convenience method that depositor can use to signal to relayer to use updated fee.\\n * @notice Relayer should only use events emitted by this function to submit fills with updated fees, otherwise they\\n * risk their fills getting disputed for being invalid, for example if the depositor never actually signed the\\n * update fee message.\\n * @notice This function will revert if the depositor did not sign a message containing the updated fee for the\\n * deposit ID stored in this contract. If the deposit ID is for another contract, or the depositor address is\\n * incorrect, or the updated fee is incorrect, then the signature will not match and this function will revert.\\n * @param depositor Signer of the update fee message who originally submitted the deposit. If the deposit doesn't\\n * exist, then the relayer will not be able to fill any relay, so the caller should validate that the depositor\\n * did in fact submit a relay.\\n * @param newRelayerFeePct New relayer fee that relayers can use.\\n * @param depositId Deposit to update fee for that originated in this contract.\\n * @param depositorSignature Signed message containing the depositor address, this contract chain ID, the updated\\n * relayer fee %, and the deposit ID. This signature is produced by signing a hash of data according to the\\n * EIP-191 standard. See more in the _verifyUpdateRelayerFeeMessage() comments.\\n */\\n function speedUpDeposit(\\n address depositor,\\n uint64 newRelayerFeePct,\\n uint32 depositId,\\n bytes memory depositorSignature\\n ) public override nonReentrant {\\n _verifyUpdateRelayerFeeMessage(depositor, chainId(), newRelayerFeePct, depositId, depositorSignature);\\n\\n // Assuming the above checks passed, a relayer can take the signature and the updated relayer fee information\\n // from the following event to submit a fill with an updated fee %.\\n emit RequestedSpeedUpDeposit(newRelayerFeePct, depositId, depositor, depositorSignature);\\n }\\n\\n /**************************************\\n * RELAYER FUNCTIONS *\\n **************************************/\\n\\n /**\\n * @notice Called by relayer to fulfill part of a deposit by sending destination tokens to the receipient.\\n * Relayer is expected to pass in unique identifying information for deposit that they want to fulfill, and this\\n * relay submission will be validated by off-chain data workers who can dispute this relay if any part is invalid.\\n * If the relay is valid, then the relayer will be refunded on their desired repayment chain. If relay is invalid,\\n * then relayer will not receive any refund.\\n * @notice All of the deposit data can be found via on-chain events from the origin SpokePool, except for the\\n * realizedLpFeePct which is a function of the HubPool's utilization at the deposit quote time. This fee %\\n * is deterministic based on the quote time, so the relayer should just compute it using the canonical algorithm\\n * as described in a UMIP linked to the HubPool's identifier.\\n * @param depositor Depositor on origin chain who set this chain as the destination chain.\\n * @param recipient Specified recipient on this chain.\\n * @param destinationToken Token to send to recipient. Should be mapped to the origin token, origin chain ID\\n * and this chain ID via a mapping on the HubPool.\\n * @param amount Full size of the deposit.\\n * @param maxTokensToSend Max amount of tokens to send recipient. If higher than amount, then caller will\\n * send recipient the full relay amount.\\n * @param repaymentChainId Chain of SpokePool where relayer wants to be refunded after the challenge window has\\n * passed.\\n * @param originChainId Chain of SpokePool where deposit originated.\\n * @param realizedLpFeePct Fee % based on L1 HubPool utilization at deposit quote time. Deterministic based on\\n * quote time.\\n * @param relayerFeePct Fee % to keep as relayer, specified by depositor.\\n * @param depositId Unique deposit ID on origin spoke pool.\\n */\\n function fillRelay(\\n address depositor,\\n address recipient,\\n address destinationToken,\\n uint256 amount,\\n uint256 maxTokensToSend,\\n uint256 repaymentChainId,\\n uint256 originChainId,\\n uint64 realizedLpFeePct,\\n uint64 relayerFeePct,\\n uint32 depositId\\n ) public nonReentrant {\\n // Each relay attempt is mapped to the hash of data uniquely identifying it, which includes the deposit data\\n // such as the origin chain ID and the deposit ID, and the data in a relay attempt such as who the recipient\\n // is, which chain and currency the recipient wants to receive funds on, and the relay fees.\\n SpokePoolInterface.RelayData memory relayData = SpokePoolInterface.RelayData({\\n depositor: depositor,\\n recipient: recipient,\\n destinationToken: destinationToken,\\n amount: amount,\\n realizedLpFeePct: realizedLpFeePct,\\n relayerFeePct: relayerFeePct,\\n depositId: depositId,\\n originChainId: originChainId\\n });\\n bytes32 relayHash = _getRelayHash(relayData);\\n\\n uint256 fillAmountPreFees = _fillRelay(relayHash, relayData, maxTokensToSend, relayerFeePct, false);\\n\\n _emitFillRelay(relayHash, fillAmountPreFees, repaymentChainId, relayerFeePct, relayData, false);\\n }\\n\\n /**\\n * @notice Called by relayer to execute same logic as calling fillRelay except that relayer is using an updated\\n * relayer fee %. The fee % must have been emitted in a message cryptographically signed by the depositor.\\n * @notice By design, the depositor probably emitted the message with the updated fee by calling speedUpRelay().\\n * @param depositor Depositor on origin chain who set this chain as the destination chain.\\n * @param recipient Specified recipient on this chain.\\n * @param destinationToken Token to send to recipient. Should be mapped to the origin token, origin chain ID\\n * and this chain ID via a mapping on the HubPool.\\n * @param amount Full size of the deposit.\\n * @param maxTokensToSend Max amount of tokens to send recipient. If higher than amount, then caller will\\n * send recipient the full relay amount.\\n * @param repaymentChainId Chain of SpokePool where relayer wants to be refunded after the challenge window has\\n * passed.\\n * @param originChainId Chain of SpokePool where deposit originated.\\n * @param realizedLpFeePct Fee % based on L1 HubPool utilization at deposit quote time. Deterministic based on\\n * quote time.\\n * @param relayerFeePct Original fee % to keep as relayer set by depositor.\\n * @param newRelayerFeePct New fee % to keep as relayer also specified by depositor.\\n * @param depositId Unique deposit ID on origin spoke pool.\\n * @param depositorSignature Depositor-signed message containing updated fee %.\\n */\\n function fillRelayWithUpdatedFee(\\n address depositor,\\n address recipient,\\n address destinationToken,\\n uint256 amount,\\n uint256 maxTokensToSend,\\n uint256 repaymentChainId,\\n uint256 originChainId,\\n uint64 realizedLpFeePct,\\n uint64 relayerFeePct,\\n uint64 newRelayerFeePct,\\n uint32 depositId,\\n bytes memory depositorSignature\\n ) public override nonReentrant {\\n _verifyUpdateRelayerFeeMessage(depositor, originChainId, newRelayerFeePct, depositId, depositorSignature);\\n\\n // Now follow the default fillRelay flow with the updated fee and the original relay hash.\\n RelayData memory relayData = RelayData({\\n depositor: depositor,\\n recipient: recipient,\\n destinationToken: destinationToken,\\n amount: amount,\\n realizedLpFeePct: realizedLpFeePct,\\n relayerFeePct: relayerFeePct,\\n depositId: depositId,\\n originChainId: originChainId\\n });\\n bytes32 relayHash = _getRelayHash(relayData);\\n uint256 fillAmountPreFees = _fillRelay(relayHash, relayData, maxTokensToSend, newRelayerFeePct, false);\\n\\n _emitFillRelay(relayHash, fillAmountPreFees, repaymentChainId, newRelayerFeePct, relayData, false);\\n }\\n\\n /**************************************\\n * DATA WORKER FUNCTIONS *\\n **************************************/\\n\\n /**\\n * @notice Executes a slow relay leaf stored as part of a root bundle. Will send the full amount remaining in the\\n * relay to the recipient, less fees.\\n * @param depositor Depositor on origin chain who set this chain as the destination chain.\\n * @param recipient Specified recipient on this chain.\\n * @param destinationToken Token to send to recipient. Should be mapped to the origin token, origin chain ID\\n * and this chain ID via a mapping on the HubPool.\\n * @param amount Full size of the deposit.\\n * @param originChainId Chain of SpokePool where deposit originated.\\n * @param realizedLpFeePct Fee % based on L1 HubPool utilization at deposit quote time. Deterministic based on\\n * quote time.\\n * @param relayerFeePct Original fee % to keep as relayer set by depositor.\\n * @param depositId Unique deposit ID on origin spoke pool.\\n * @param rootBundleId Unique ID of root bundle containing slow relay root that this leaf is contained in.\\n * @param proof Inclusion proof for this leaf in slow relay root in root bundle.\\n */\\n function executeSlowRelayRoot(\\n address depositor,\\n address recipient,\\n address destinationToken,\\n uint256 amount,\\n uint256 originChainId,\\n uint64 realizedLpFeePct,\\n uint64 relayerFeePct,\\n uint32 depositId,\\n uint32 rootBundleId,\\n bytes32[] memory proof\\n ) public virtual override nonReentrant {\\n _executeSlowRelayRoot(\\n depositor,\\n recipient,\\n destinationToken,\\n amount,\\n originChainId,\\n realizedLpFeePct,\\n relayerFeePct,\\n depositId,\\n rootBundleId,\\n proof\\n );\\n }\\n\\n /**\\n * @notice Executes a relayer refund leaf stored as part of a root bundle. Will send the relayer the amount they\\n * sent to the recipient plus a relayer fee.\\n * @param rootBundleId Unique ID of root bundle containing relayer refund root that this leaf is contained in.\\n * @param relayerRefundLeaf Contains all data neccessary to reconstruct leaf contained in root bundle and to\\n * refund relayer. This data structure is explained in detail in the SpokePoolInterface.\\n * @param proof Inclusion proof for this leaf in relayer refund root in root bundle.\\n */\\n function executeRelayerRefundRoot(\\n uint32 rootBundleId,\\n SpokePoolInterface.RelayerRefundLeaf memory relayerRefundLeaf,\\n bytes32[] memory proof\\n ) public virtual override nonReentrant {\\n _executeRelayerRefundRoot(rootBundleId, relayerRefundLeaf, proof);\\n }\\n\\n /**************************************\\n * VIEW FUNCTIONS *\\n **************************************/\\n\\n /**\\n * @notice Returns chain ID for this network.\\n * @dev Some L2s like ZKSync don't support the CHAIN_ID opcode so we allow the implementer to override this.\\n */\\n function chainId() public view override returns (uint256) {\\n return block.chainid;\\n }\\n\\n /**************************************\\n * INTERNAL FUNCTIONS *\\n **************************************/\\n\\n // Verifies inclusion proof of leaf in root, sends relayer their refund, and sends to HubPool any rebalance\\n // transfers.\\n function _executeRelayerRefundRoot(\\n uint32 rootBundleId,\\n SpokePoolInterface.RelayerRefundLeaf memory relayerRefundLeaf,\\n bytes32[] memory proof\\n ) internal {\\n // Check integrity of leaf structure:\\n require(relayerRefundLeaf.chainId == chainId(), \\\"Invalid chainId\\\");\\n require(relayerRefundLeaf.refundAddresses.length == relayerRefundLeaf.refundAmounts.length, \\\"invalid leaf\\\");\\n\\n RootBundle storage rootBundle = rootBundles[rootBundleId];\\n\\n // Check that inclusionProof proves that relayerRefundLeaf is contained within the relayer refund root.\\n // Note: This should revert if the relayerRefundRoot is uninitialized.\\n require(MerkleLib.verifyRelayerRefund(rootBundle.relayerRefundRoot, relayerRefundLeaf, proof), \\\"Bad Proof\\\");\\n\\n // Verify the leafId in the leaf has not yet been claimed.\\n require(!MerkleLib.isClaimed(rootBundle.claimedBitmap, relayerRefundLeaf.leafId), \\\"Already claimed\\\");\\n\\n // Set leaf as claimed in bitmap. This is passed by reference to the storage rootBundle.\\n MerkleLib.setClaimed(rootBundle.claimedBitmap, relayerRefundLeaf.leafId);\\n\\n // Send each relayer refund address the associated refundAmount for the L2 token address.\\n // Note: Even if the L2 token is not enabled on this spoke pool, we should still refund relayers.\\n for (uint32 i = 0; i < relayerRefundLeaf.refundAmounts.length; i++) {\\n uint256 amount = relayerRefundLeaf.refundAmounts[i];\\n if (amount > 0)\\n IERC20(relayerRefundLeaf.l2TokenAddress).safeTransfer(relayerRefundLeaf.refundAddresses[i], amount);\\n }\\n\\n // If leaf's amountToReturn is positive, then send L2 --> L1 message to bridge tokens back via\\n // chain-specific bridging method.\\n if (relayerRefundLeaf.amountToReturn > 0) {\\n _bridgeTokensToHubPool(relayerRefundLeaf);\\n\\n emit TokensBridged(\\n relayerRefundLeaf.amountToReturn,\\n relayerRefundLeaf.chainId,\\n relayerRefundLeaf.leafId,\\n relayerRefundLeaf.l2TokenAddress,\\n msg.sender\\n );\\n }\\n\\n emit ExecutedRelayerRefundRoot(\\n relayerRefundLeaf.amountToReturn,\\n relayerRefundLeaf.chainId,\\n relayerRefundLeaf.refundAmounts,\\n rootBundleId,\\n relayerRefundLeaf.leafId,\\n relayerRefundLeaf.l2TokenAddress,\\n relayerRefundLeaf.refundAddresses,\\n msg.sender\\n );\\n }\\n\\n // Verifies inclusion proof of leaf in root and sends recipient remainder of relay. Marks relay as filled.\\n function _executeSlowRelayRoot(\\n address depositor,\\n address recipient,\\n address destinationToken,\\n uint256 amount,\\n uint256 originChainId,\\n uint64 realizedLpFeePct,\\n uint64 relayerFeePct,\\n uint32 depositId,\\n uint32 rootBundleId,\\n bytes32[] memory proof\\n ) internal {\\n RelayData memory relayData = RelayData({\\n depositor: depositor,\\n recipient: recipient,\\n destinationToken: destinationToken,\\n amount: amount,\\n originChainId: originChainId,\\n realizedLpFeePct: realizedLpFeePct,\\n relayerFeePct: relayerFeePct,\\n depositId: depositId\\n });\\n\\n require(\\n MerkleLib.verifySlowRelayFulfillment(rootBundles[rootBundleId].slowRelayRoot, relayData, proof),\\n \\\"Invalid proof\\\"\\n );\\n\\n bytes32 relayHash = _getRelayHash(relayData);\\n\\n // Note: use relayAmount as the max amount to send, so the relay is always completely filled by the contract's\\n // funds in all cases. As this is a slow relay we set the relayerFeePct to 0. This effectively refunds the\\n // relayer component of the relayerFee thereby only charging the depositor the LpFee.\\n uint256 fillAmountPreFees = _fillRelay(relayHash, relayData, relayData.amount, 0, true);\\n\\n // Note: Set repayment chain ID to 0 to indicate that there is no repayment to be made. The off-chain data\\n // worker can use repaymentChainId=0 as a signal to ignore such relays for refunds. Also, set the relayerFeePct\\n // to 0 as slow relays do not pay the caller of this method (depositor is refunded this fee).\\n _emitFillRelay(relayHash, fillAmountPreFees, 0, 0, relayData, true);\\n }\\n\\n function _setCrossDomainAdmin(address newCrossDomainAdmin) internal {\\n require(newCrossDomainAdmin != address(0), \\\"Bad bridge router address\\\");\\n crossDomainAdmin = newCrossDomainAdmin;\\n emit SetXDomainAdmin(crossDomainAdmin);\\n }\\n\\n function _setHubPool(address newHubPool) internal {\\n require(newHubPool != address(0), \\\"Bad hub pool address\\\");\\n hubPool = newHubPool;\\n emit SetHubPool(hubPool);\\n }\\n\\n // Should be overriden by implementing contract depending on how L2 handles sending tokens to L1.\\n function _bridgeTokensToHubPool(SpokePoolInterface.RelayerRefundLeaf memory relayerRefundLeaf) internal virtual;\\n\\n function _verifyUpdateRelayerFeeMessage(\\n address depositor,\\n uint256 originChainId,\\n uint64 newRelayerFeePct,\\n uint32 depositId,\\n bytes memory depositorSignature\\n ) internal view {\\n // A depositor can request to speed up an un-relayed deposit by signing a hash containing the relayer\\n // fee % to update to and information uniquely identifying the deposit to relay. This information ensures\\n // that this signature cannot be re-used for other deposits. The version string is included as a precaution\\n // in case this contract is upgraded.\\n // Note: we use encode instead of encodePacked because it is more secure, more in the \\\"warning\\\" section\\n // here: https://docs.soliditylang.org/en/v0.8.11/abi-spec.html#non-standard-packed-mode\\n bytes32 expectedDepositorMessageHash = keccak256(\\n abi.encode(\\\"ACROSS-V2-FEE-1.0\\\", newRelayerFeePct, depositId, originChainId)\\n );\\n\\n // Check the hash corresponding to the https://eth.wiki/json-rpc/API#eth_sign[eth_sign]\\n // JSON-RPC method as part of EIP-191. We use OZ's signature checker library which adds support for\\n // EIP-1271 which can verify messages signed by smart contract wallets like Argent and Gnosis safes.\\n // If the depositor signed a message with a different updated fee (or any other param included in the\\n // above keccak156 hash), then this will revert.\\n bytes32 ethSignedMessageHash = ECDSA.toEthSignedMessageHash(expectedDepositorMessageHash);\\n\\n _verifyDepositorUpdateFeeMessage(depositor, ethSignedMessageHash, depositorSignature);\\n }\\n\\n // This function is isolated and made virtual to allow different L2's to implement chain specific recovery of\\n // signers from signatures because some L2s might not support ecrecover, such as those with account abstraction\\n // like ZKSync.\\n function _verifyDepositorUpdateFeeMessage(\\n address depositor,\\n bytes32 ethSignedMessageHash,\\n bytes memory depositorSignature\\n ) internal view virtual {\\n // Note: no need to worry about reentrancy from contract deployed at depositor address since\\n // SignatureChecker.isValidSignatureNow is a non state-modifying STATICCALL:\\n // - https://github.com/OpenZeppelin/openzeppelin-contracts/blob/63b466901fb015538913f811c5112a2775042177/contracts/utils/cryptography/SignatureChecker.sol#L35\\n // - https://github.com/ethereum/EIPs/pull/214\\n require(\\n SignatureChecker.isValidSignatureNow(depositor, ethSignedMessageHash, depositorSignature),\\n \\\"invalid signature\\\"\\n );\\n }\\n\\n function _computeAmountPreFees(uint256 amount, uint64 feesPct) private pure returns (uint256) {\\n return (1e18 * amount) / (1e18 - feesPct);\\n }\\n\\n function _computeAmountPostFees(uint256 amount, uint64 feesPct) private pure returns (uint256) {\\n return (amount * (1e18 - feesPct)) / 1e18;\\n }\\n\\n function _getRelayHash(SpokePoolInterface.RelayData memory relayData) private pure returns (bytes32) {\\n return keccak256(abi.encode(relayData));\\n }\\n\\n // Unwraps ETH and does a transfer to a recipient address. If the recipient is a smart contract then sends WETH.\\n function _unwrapWETHTo(address payable to, uint256 amount) internal {\\n if (address(to).isContract()) {\\n IERC20(address(weth)).safeTransfer(to, amount);\\n } else {\\n weth.withdraw(amount);\\n to.transfer(amount);\\n }\\n }\\n\\n // @notice Caller specifies the max amount of tokens to send to user. Based on this amount and the amount of the\\n // relay remaining (as stored in the relayFills mapping), pull the amount of tokens from the caller ancillaryData\\n // and send to the caller.\\n // @dev relayFills keeps track of pre-fee fill amounts as a convenience to relayers who want to specify round\\n // numbers for the maxTokensToSend parameter or convenient numbers like 100 (i.e. relayers who will fully\\n // fill any relay up to 100 tokens, and partial fill with 100 tokens for larger relays).\\n function _fillRelay(\\n bytes32 relayHash,\\n RelayData memory relayData,\\n uint256 maxTokensToSend,\\n uint64 updatableRelayerFeePct,\\n bool useContractFunds\\n ) internal returns (uint256 fillAmountPreFees) {\\n // We limit the relay fees to prevent the user spending all their funds on fees. Note that 0.5e18 (i.e. 50%)\\n // fees are just magic numbers. The important point is to prevent the total fee from being 100%, otherwise\\n // computing the amount pre fees runs into divide-by-0 issues.\\n require(updatableRelayerFeePct < 0.5e18 && relayData.realizedLpFeePct < 0.5e18, \\\"invalid fees\\\");\\n\\n // Check that the relay has not already been completely filled. Note that the relays mapping will point to\\n // the amount filled so far for a particular relayHash, so this will start at 0 and increment with each fill.\\n require(relayFills[relayHash] < relayData.amount, \\\"relay filled\\\");\\n\\n // Stores the equivalent amount to be sent by the relayer before fees have been taken out.\\n if (maxTokensToSend == 0) return 0;\\n\\n // Derive the amount of the relay filled if the caller wants to send exactly maxTokensToSend tokens to\\n // the recipient. For example, if the user wants to send 10 tokens to the recipient, the full relay amount\\n // is 100, and the fee %'s total 5%, then this computation would return ~10.5, meaning that to fill 10.5/100\\n // of the full relay size, the caller would need to send 10 tokens to the user.\\n fillAmountPreFees = _computeAmountPreFees(\\n maxTokensToSend,\\n (relayData.realizedLpFeePct + updatableRelayerFeePct)\\n );\\n // If user's specified max amount to send is greater than the amount of the relay remaining pre-fees,\\n // we'll pull exactly enough tokens to complete the relay.\\n uint256 amountToSend = maxTokensToSend;\\n uint256 amountRemainingInRelay = relayData.amount - relayFills[relayHash];\\n if (amountRemainingInRelay < fillAmountPreFees) {\\n fillAmountPreFees = amountRemainingInRelay;\\n\\n // The user will fulfill the remainder of the relay, so we need to compute exactly how many tokens post-fees\\n // that they need to send to the recipient. Note that if the relayer is filled using contract funds then\\n // this is a slow relay.\\n amountToSend = _computeAmountPostFees(\\n fillAmountPreFees,\\n relayData.realizedLpFeePct + updatableRelayerFeePct\\n );\\n }\\n\\n // relayFills keeps track of pre-fee fill amounts as a convenience to relayers who want to specify round\\n // numbers for the maxTokensToSend parameter or convenient numbers like 100 (i.e. relayers who will fully\\n // fill any relay up to 100 tokens, and partial fill with 100 tokens for larger relays).\\n relayFills[relayHash] += fillAmountPreFees;\\n\\n // If relay token is weth then unwrap and send eth.\\n if (relayData.destinationToken == address(weth)) {\\n // Note: useContractFunds is True if we want to send funds to the recipient directly out of this contract,\\n // otherwise we expect the caller to send funds to the recipient. If useContractFunds is True and the\\n // recipient wants WETH, then we can assume that WETH is already in the contract, otherwise we'll need the\\n // the user to send WETH to this contract. Regardless, we'll need to unwrap it before sending to the user.\\n if (!useContractFunds)\\n IERC20(relayData.destinationToken).safeTransferFrom(msg.sender, address(this), amountToSend);\\n _unwrapWETHTo(payable(relayData.recipient), amountToSend);\\n // Else, this is a normal ERC20 token. Send to recipient.\\n } else {\\n // Note: Similar to note above, send token directly from the contract to the user in the slow relay case.\\n if (!useContractFunds)\\n IERC20(relayData.destinationToken).safeTransferFrom(msg.sender, relayData.recipient, amountToSend);\\n else IERC20(relayData.destinationToken).safeTransfer(relayData.recipient, amountToSend);\\n }\\n }\\n\\n // The following internal methods emit events with many params to overcome solidity stack too deep issues.\\n function _emitFillRelay(\\n bytes32 relayHash,\\n uint256 fillAmount,\\n uint256 repaymentChainId,\\n uint64 relayerFeePct,\\n RelayData memory relayData,\\n bool isSlowRelay\\n ) internal {\\n emit FilledRelay(\\n relayHash,\\n relayData.amount,\\n relayFills[relayHash],\\n fillAmount,\\n repaymentChainId,\\n relayData.originChainId,\\n relayerFeePct,\\n relayData.realizedLpFeePct,\\n relayData.depositId,\\n relayData.destinationToken,\\n msg.sender,\\n relayData.depositor,\\n relayData.recipient,\\n isSlowRelay\\n );\\n }\\n\\n // Implementing contract needs to override this to ensure that only the appropriate cross chain admin can execute\\n // certain admin functions. For L2 contracts, the cross chain admin refers to some L1 address or contract, and for\\n // L1, this would just be the same admin of the HubPool.\\n function _requireAdminSender() internal virtual;\\n\\n // Added to enable the this contract to receive ETH. Used when unwrapping Weth.\\n receive() external payable {}\\n}\\n\",\"keccak256\":\"0x53900aac0bdf745c489daae95f1fe7b5165ac2dbc000ceb307ff9ce4ed331787\",\"license\":\"GPL-3.0-only\"},\"contracts/SpokePoolInterface.sol\":{\"content\":\"// SPDX-License-Identifier: GPL-3.0-only\\npragma solidity ^0.8.0;\\n\\n/**\\n * @notice Contains common data structures and functions used by all SpokePool implementations.\\n */\\ninterface SpokePoolInterface {\\n // This leaf is meant to be decoded in the SpokePool to pay out successful relayers.\\n struct RelayerRefundLeaf {\\n // This is the amount to return to the HubPool. This occurs when there is a PoolRebalanceLeaf netSendAmount that is\\n // negative. This is just that value inverted.\\n uint256 amountToReturn;\\n // Used to verify that this is being executed on the correct destination chainId.\\n uint256 chainId;\\n // This array designates how much each of those addresses should be refunded.\\n uint256[] refundAmounts;\\n // Used as the index in the bitmap to track whether this leaf has been executed or not.\\n uint32 leafId;\\n // The associated L2TokenAddress that these claims apply to.\\n address l2TokenAddress;\\n // Must be same length as refundAmounts and designates each address that must be refunded.\\n address[] refundAddresses;\\n }\\n\\n // This struct represents the data to fully specify a relay. If any portion of this data differs, the relay is\\n // considered to be completely distinct. Only one relay for a particular depositId, chainId pair should be\\n // considered valid and repaid. This data is hashed and inserted into a the slow relay merkle root so that an off\\n // chain validator can choose when to refund slow relayers.\\n struct RelayData {\\n // The address that made the deposit on the origin chain.\\n address depositor;\\n // The recipient address on the destination chain.\\n address recipient;\\n // The corresponding token address on the destination chain.\\n address destinationToken;\\n // The total relay amount before fees are taken out.\\n uint256 amount;\\n // Origin chain id.\\n uint256 originChainId;\\n // The LP Fee percentage computed by the relayer based on the deposit's quote timestamp\\n // and the HubPool's utilization.\\n uint64 realizedLpFeePct;\\n // The relayer fee percentage specified in the deposit.\\n uint64 relayerFeePct;\\n // The id uniquely identifying this deposit on the origin chain.\\n uint32 depositId;\\n }\\n\\n function setCrossDomainAdmin(address newCrossDomainAdmin) external;\\n\\n function setHubPool(address newHubPool) external;\\n\\n function setEnableRoute(\\n address originToken,\\n uint256 destinationChainId,\\n bool enable\\n ) external;\\n\\n function setDepositQuoteTimeBuffer(uint32 buffer) external;\\n\\n function relayRootBundle(bytes32 relayerRefundRoot, bytes32 slowRelayRoot) external;\\n\\n function deposit(\\n address recipient,\\n address originToken,\\n uint256 amount,\\n uint256 destinationChainId,\\n uint64 relayerFeePct,\\n uint32 quoteTimestamp\\n ) external payable;\\n\\n function speedUpDeposit(\\n address depositor,\\n uint64 newRelayerFeePct,\\n uint32 depositId,\\n bytes memory depositorSignature\\n ) external;\\n\\n function fillRelay(\\n address depositor,\\n address recipient,\\n address destinationToken,\\n uint256 amount,\\n uint256 maxTokensToSend,\\n uint256 repaymentChainId,\\n uint256 originChainId,\\n uint64 realizedLpFeePct,\\n uint64 relayerFeePct,\\n uint32 depositId\\n ) external;\\n\\n function fillRelayWithUpdatedFee(\\n address depositor,\\n address recipient,\\n address destinationToken,\\n uint256 amount,\\n uint256 maxTokensToSend,\\n uint256 repaymentChainId,\\n uint256 originChainId,\\n uint64 realizedLpFeePct,\\n uint64 relayerFeePct,\\n uint64 newRelayerFeePct,\\n uint32 depositId,\\n bytes memory depositorSignature\\n ) external;\\n\\n function executeSlowRelayRoot(\\n address depositor,\\n address recipient,\\n address destinationToken,\\n uint256 amount,\\n uint256 originChainId,\\n uint64 realizedLpFeePct,\\n uint64 relayerFeePct,\\n uint32 depositId,\\n uint32 rootBundleId,\\n bytes32[] memory proof\\n ) external;\\n\\n function executeRelayerRefundRoot(\\n uint32 rootBundleId,\\n SpokePoolInterface.RelayerRefundLeaf memory relayerRefundLeaf,\\n bytes32[] memory proof\\n ) external;\\n\\n function chainId() external view returns (uint256);\\n}\\n\",\"keccak256\":\"0x33257e146b1f3aecadcefded630c6a8d1308518d1992d84b963a734745ab96a5\",\"license\":\"GPL-3.0-only\"},\"contracts/interfaces/AdapterInterface.sol\":{\"content\":\"// SPDX-License-Identifier: AGPL-3.0-only\\npragma solidity ^0.8.0;\\n\\n/**\\n * @notice Sends cross chain messages and tokens to contracts on a specific L2 network.\\n */\\n\\ninterface AdapterInterface {\\n event HubPoolChanged(address newHubPool);\\n\\n event MessageRelayed(address target, bytes message);\\n\\n event TokensRelayed(address l1Token, address l2Token, uint256 amount, address to);\\n\\n function relayMessage(address target, bytes memory message) external payable;\\n\\n function relayTokens(\\n address l1Token,\\n address l2Token,\\n uint256 amount,\\n address to\\n ) external payable;\\n}\\n\",\"keccak256\":\"0x60e1ed2205f90655fe4152a90709be15bc9550fb3faeaf9835fee22c095bab11\",\"license\":\"AGPL-3.0-only\"},\"contracts/interfaces/WETH9.sol\":{\"content\":\"// SPDX-License-Identifier: GPL-3.0-only\\npragma solidity ^0.8.0;\\n\\ninterface WETH9 {\\n function withdraw(uint256 wad) external;\\n\\n function deposit() external payable;\\n\\n function balanceOf(address guy) external view returns (uint256 wad);\\n\\n function transfer(address guy, uint256 wad) external;\\n}\\n\",\"keccak256\":\"0x7b444d0840b1f76eee9bf39d74830f70644395613b96cce2d80fc50785a82eaa\",\"license\":\"GPL-3.0-only\"}},\"version\":1}", - "bytecode": "0x60806040526004805463ffffffff60c01b1916604b60c31b179055600880546001600160c01b03191677deaddeaddeaddeaddeaddeaddeaddeaddead0000004c4b401790553480156200005157600080fd5b50604051620047213803806200472183398101604081905262000074916200033d565b600080546001600160a01b031916734200000000000000000000000000000000000007179055600180546001600160a81b0319166001600160a01b03831617600160a01b179055828273420000000000000000000000000000000000000683620000de846200013f565b620000e983620001e5565b620000f362000287565b600480546001600160a01b039094166001600160a01b031963ffffffff93909316600160a01b02929092166001600160c01b0319909416939093171790915550620003a1945050505050565b6001600160a01b0381166200019b5760405162461bcd60e51b815260206004820152601960248201527f4261642062726964676520726f7574657220616464726573730000000000000060448201526064015b60405180910390fd5b600280546001600160a01b0319166001600160a01b0383169081179091556040517fa9e8c42c9e7fca7f62755189a16b2f5314d43d8fb24e91ba54e6d65f9314e84990600090a250565b6001600160a01b0381166200023d5760405162461bcd60e51b815260206004820152601460248201527f4261642068756220706f6f6c2061646472657373000000000000000000000000604482015260640162000192565b600380546001600160a01b0319166001600160a01b0383169081179091556040517f1f17a88f67b0f49060a34bec1a4723a563620e6aa265eb640b5046dcee0759a090600090a250565b6001546000906001600160a01b0316156200031b57600160009054906101000a90046001600160a01b03166001600160a01b03166329cb924d6040518163ffffffff1660e01b8152600401602060405180830381865afa158015620002f0573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019062000316919062000387565b905090565b504290565b80516001600160a01b03811681146200033857600080fd5b919050565b6000806000606084860312156200035357600080fd5b6200035e8462000320565b92506200036e6020850162000320565b91506200037e6040850162000320565b90509250925092565b6000602082840312156200039a57600080fd5b5051919050565b61437080620003b16000396000f3fe6080604052600436106101dc5760003560e01c806389a153cc11610102578063e282d5b911610095578063f06850f611610064578063f06850f614610673578063f500697c146106a0578063fbbba9ac146106c0578063ffc351a3146106e057600080fd5b8063e282d5b9146105b4578063e3229211146105d4578063ecda10f514610609578063ee2a53f81461063e57600080fd5b8063b27a4300116100d1578063b27a430014610504578063c894c0ca14610547578063de7eba7814610567578063e19044021461058757600080fd5b806389a153cc146104745780639a8a059214610494578063a1244c67146104a7578063ac9650d8146104e457600080fd5b80633cb747bf1161017a5780635249fef1116101495780635249fef1146103915780635285e058146103dc57806357f6dcb814610409578063766e07031461045757600080fd5b80633cb747bf146103045780633fc8cef314610331578063492289781461035e578063493a4f841461037157600080fd5b806322f8e566116101b657806322f8e56614610281578063272751c7146102a15780632752042e146102c157806329cb924d146102e157600080fd5b80630eaac9f0146101e85780631c39c38d1461020a5780631dfb2d021461026157600080fd5b366101e357005b600080fd5b3480156101f457600080fd5b506102086102033660046133e4565b610700565b005b34801561021657600080fd5b506001546102379073ffffffffffffffffffffffffffffffffffffffff1681565b60405173ffffffffffffffffffffffffffffffffffffffff90911681526020015b60405180910390f35b34801561026d57600080fd5b5061020861027c36600461342c565b610767565b34801561028d57600080fd5b5061020861029c366004613449565b61077b565b3480156102ad57600080fd5b506102086102bc366004613470565b610824565b3480156102cd57600080fd5b506102086102dc3660046133e4565b6108c2565b3480156102ed57600080fd5b506102f6610951565b604051908152602001610258565b34801561031057600080fd5b506000546102379073ffffffffffffffffffffffffffffffffffffffff1681565b34801561033d57600080fd5b506004546102379073ffffffffffffffffffffffffffffffffffffffff1681565b61020861036c3660046134ca565b610a0d565b34801561037d57600080fd5b5061020861038c366004613534565b610ebe565b34801561039d57600080fd5b506103cc6103ac366004613556565b600560209081526000928352604080842090915290825290205460ff1681565b6040519015158152602001610258565b3480156103e857600080fd5b506002546102379073ffffffffffffffffffffffffffffffffffffffff1681565b34801561041557600080fd5b50600454610442907801000000000000000000000000000000000000000000000000900463ffffffff1681565b60405163ffffffff9091168152602001610258565b34801561046357600080fd5b506008546104429063ffffffff1681565b34801561048057600080fd5b5061020861048f366004613582565b610f6c565b3480156104a057600080fd5b50466102f6565b3480156104b357600080fd5b50600454610442907c0100000000000000000000000000000000000000000000000000000000900463ffffffff1681565b6104f76104f2366004613626565b6110bc565b6040516102589190613711565b34801561051057600080fd5b5061023761051f36600461342c565b60096020526000908152604090205473ffffffffffffffffffffffffffffffffffffffff1681565b34801561055357600080fd5b5061020861056236600461392b565b611296565b34801561057357600080fd5b5061020861058236600461342c565b61134f565b34801561059357600080fd5b506003546102379073ffffffffffffffffffffffffffffffffffffffff1681565b3480156105c057600080fd5b506102086105cf366004613abe565b611360565b3480156105e057600080fd5b5060085461023790640100000000900473ffffffffffffffffffffffffffffffffffffffff1681565b34801561061557600080fd5b506004546104429074010000000000000000000000000000000000000000900463ffffffff1681565b34801561064a57600080fd5b5061065e610659366004613449565b611443565b60408051928352602083019190915201610258565b34801561067f57600080fd5b506102f661068e366004613449565b60076020526000908152604090205481565b3480156106ac57600080fd5b506102086106bb366004613b2f565b611471565b3480156106cc57600080fd5b506102086106db366004613bfc565b611527565b3480156106ec57600080fd5b506102086106fb366004613c35565b6115ab565b61070861170a565b600880547fffffffffffffffffffffffffffffffffffffffffffffffffffffffff000000001663ffffffff83169081179091556040517fe486a5c4bd7b36eabbfe274c99b39130277417be8d2209b4dae04c4fba64ee3a90600090a250565b61076f61170a565b61077881611943565b50565b60015473ffffffffffffffffffffffffffffffffffffffff1661079d57600080fd5b6001546040517f22f8e5660000000000000000000000000000000000000000000000000000000081526004810183905273ffffffffffffffffffffffffffffffffffffffff909116906322f8e56690602401600060405180830381600087803b15801561080957600080fd5b505af115801561081d573d6000803e3d6000fd5b5050505050565b61082c61170a565b73ffffffffffffffffffffffffffffffffffffffff8316600081815260056020908152604080832086845282529182902080547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff001685151590811790915591519182528492917f0a21fdd43d0ad0c62689ee7230a47309a050755bcc52eba00310add65297692a910160405180910390a3505050565b6108ca61170a565b600480547fffffffff00000000ffffffffffffffffffffffffffffffffffffffffffffffff16780100000000000000000000000000000000000000000000000063ffffffff8416908102919091179091556040519081527f0e55dd180fa793d9036c804d0a116e6a7617a48e72cee1f83d92793a793fcc039060200160405180910390a150565b60015460009073ffffffffffffffffffffffffffffffffffffffff1615610a0857600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166329cb924d6040518163ffffffff1660e01b8152600401602060405180830381865afa1580156109df573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610a039190613d13565b905090565b504290565b73ffffffffffffffffffffffffffffffffffffffff851660009081526005602090815260408083208684529091529020548590849060ff16610ab0576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152600e60248201527f44697361626c656420726f75746500000000000000000000000000000000000060448201526064015b60405180910390fd5b610ab8611a2f565b610ae5600180547fffffffffffffffffffffff00ffffffffffffffffffffffffffffffffffffffff169055565b6706f05b59d3b200008467ffffffffffffffff1610610b60576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601360248201527f696e76616c69642072656c6179657220666565000000000000000000000000006044820152606401610aa7565b600454610b8f907801000000000000000000000000000000000000000000000000900463ffffffff1684613d5b565b63ffffffff16610b9d610951565b10158015610be65750600454610bd5907801000000000000000000000000000000000000000000000000900463ffffffff1684613d80565b63ffffffff16610be3610951565b11155b610c4c576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601260248201527f696e76616c69642071756f74652074696d6500000000000000000000000000006044820152606401610aa7565b60045473ffffffffffffffffffffffffffffffffffffffff8881169116148015610c765750600034115b15610d6d57853414610ce4576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601b60248201527f6d73672e76616c7565206d757374206d6174636820616d6f756e7400000000006044820152606401610aa7565b60048054604080517fd0e30db0000000000000000000000000000000000000000000000000000000008152905173ffffffffffffffffffffffffffffffffffffffff9092169263d0e30db0923492808301926000929182900301818588803b158015610d4f57600080fd5b505af1158015610d63573d6000803e3d6000fd5b5050505050610d8f565b610d8f73ffffffffffffffffffffffffffffffffffffffff8816333089611ab5565b600454604080518881526020810188905267ffffffffffffffff87168183015263ffffffff868116606083015273ffffffffffffffffffffffffffffffffffffffff8c8116608084015292513394938c16937c01000000000000000000000000000000000000000000000000000000009004909116917ffc53c5b967d467d4136291c639720626f3d6dda97b4364da813e6858ad48a721919081900360a00190a460016004601c8282829054906101000a900463ffffffff16610e529190613d80565b92506101000a81548163ffffffff021916908363ffffffff160217905550610eb4600180547fffffffffffffffffffffff00ffffffffffffffffffffffffffffffffffffffff1674010000000000000000000000000000000000000000179055565b5050505050505050565b610ec661170a565b60068054600181018255600091909152600381027ff652222313e28459528d920b65115c16c04f3efc82aaedc97be59f3f377c0d4081018490557ff652222313e28459528d920b65115c16c04f3efc82aaedc97be59f3f377c0d3f01828155604080518581526020810185905263ffffffff8416917fc86ba04c55bc5eb2f2876b91c438849a296dbec7b08751c3074d92e04f0a77af910160405180910390a250505050565b610f74611a2f565b610fa1600180547fffffffffffffffffffffff00ffffffffffffffffffffffffffffffffffffffff169055565b60006040518061010001604052808c73ffffffffffffffffffffffffffffffffffffffff1681526020018b73ffffffffffffffffffffffffffffffffffffffff1681526020018a73ffffffffffffffffffffffffffffffffffffffff1681526020018981526020018681526020018567ffffffffffffffff1681526020018467ffffffffffffffff1681526020018363ffffffff168152509050600061104682611b91565b9050600061105882848b886000611bc1565b905061106982828a88876000611e4f565b5050506110b0600180547fffffffffffffffffffffff00ffffffffffffffffffffffffffffffffffffffff1674010000000000000000000000000000000000000000179055565b50505050505050505050565b60603415611126576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601b60248201527f4f6e6c79206d756c746963616c6c207769746820302076616c756500000000006044820152606401610aa7565b8167ffffffffffffffff81111561113f5761113f613791565b60405190808252806020026020018201604052801561117257816020015b606081526020019060019003908161115d5790505b50905060005b8281101561128f576000803086868581811061119657611196613da8565b90506020028101906111a89190613dd7565b6040516111b6929190613e3c565b600060405180830381855af49150503d80600081146111f1576040519150601f19603f3d011682016040523d82523d6000602084013e6111f6565b606091505b50915091508161125c5760448151101561120f57600080fd5b600481019050808060200190518101906112299190613e4c565b6040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610aa79190613eba565b8084848151811061126f5761126f613da8565b60200260200101819052505050808061128790613ecd565b915050611178565b5092915050565b61129e611a2f565b6112cb600180547fffffffffffffffffffffff00ffffffffffffffffffffffffffffffffffffffff169055565b600454608083015173ffffffffffffffffffffffffffffffffffffffff908116911614156112fb576112fb611f74565b611306838383611fe5565b61134a600180547fffffffffffffffffffffff00ffffffffffffffffffffffffffffffffffffffff1674010000000000000000000000000000000000000000179055565b505050565b61135761170a565b610778816123ab565b611368611a2f565b611395600180547fffffffffffffffffffffff00ffffffffffffffffffffffffffffffffffffffff169055565b6113a28446858585612497565b8373ffffffffffffffffffffffffffffffffffffffff168263ffffffff167fb9de16bf376724405019a10ef4fedac57fecd292bf86c08d81d7c42d394d5d3785846040516113f1929190613f06565b60405180910390a361143d600180547fffffffffffffffffffffff00ffffffffffffffffffffffffffffffffffffffff1674010000000000000000000000000000000000000000179055565b50505050565b6006818154811061145357600080fd5b60009182526020909120600390910201805460019091015490915082565b611479611a2f565b6114a6600180547fffffffffffffffffffffff00ffffffffffffffffffffffffffffffffffffffff169055565b60045473ffffffffffffffffffffffffffffffffffffffff898116911614156114d1576114d1611f74565b6114e38a8a8a8a8a8a8a8a8a8a612534565b6110b0600180547fffffffffffffffffffffff00ffffffffffffffffffffffffffffffffffffffff1674010000000000000000000000000000000000000000179055565b61152f61170a565b73ffffffffffffffffffffffffffffffffffffffff82811660008181526009602052604080822080547fffffffffffffffffffffffff0000000000000000000000000000000000000000169486169485179055517ff3dc137d2246f9b8abd0bb821e185ba01122c9b3ea3745ffca6208037674d6709190a35050565b6115b3611a2f565b6115e0600180547fffffffffffffffffffffff00ffffffffffffffffffffffffffffffffffffffff169055565b6115ed8c87858585612497565b60006040518061010001604052808e73ffffffffffffffffffffffffffffffffffffffff1681526020018d73ffffffffffffffffffffffffffffffffffffffff1681526020018c73ffffffffffffffffffffffffffffffffffffffff1681526020018b81526020018881526020018767ffffffffffffffff1681526020018667ffffffffffffffff1681526020018463ffffffff168152509050600061169282611b91565b905060006116a482848d896000611bc1565b90506116b582828c89876000611e4f565b5050506116fc600180547fffffffffffffffffffffff00ffffffffffffffffffffffffffffffffffffffff1674010000000000000000000000000000000000000000179055565b505050505050505050505050565b60025473ffffffffffffffffffffffffffffffffffffffff1661174260005473ffffffffffffffffffffffffffffffffffffffff1690565b73ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16146117fc576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602e60248201527f4f564d5f58434841494e3a206d657373656e67657220636f6e7472616374207560448201527f6e61757468656e746963617465640000000000000000000000000000000000006064820152608401610aa7565b8073ffffffffffffffffffffffffffffffffffffffff1661183260005473ffffffffffffffffffffffffffffffffffffffff1690565b73ffffffffffffffffffffffffffffffffffffffff16636e296e456040518163ffffffff1660e01b8152600401602060405180830381865afa15801561187c573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906118a09190613f29565b73ffffffffffffffffffffffffffffffffffffffff1614610778576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152603060248201527f4f564d5f58434841494e3a2077726f6e672073656e646572206f662063726f7360448201527f732d646f6d61696e206d657373616765000000000000000000000000000000006064820152608401610aa7565b73ffffffffffffffffffffffffffffffffffffffff81166119c0576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601460248201527f4261642068756220706f6f6c20616464726573730000000000000000000000006044820152606401610aa7565b600380547fffffffffffffffffffffffff00000000000000000000000000000000000000001673ffffffffffffffffffffffffffffffffffffffff83169081179091556040517f1f17a88f67b0f49060a34bec1a4723a563620e6aa265eb640b5046dcee0759a090600090a250565b60015474010000000000000000000000000000000000000000900460ff16611ab3576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601f60248201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c006044820152606401610aa7565b565b60405173ffffffffffffffffffffffffffffffffffffffff8085166024830152831660448201526064810182905261143d9085907f23b872dd00000000000000000000000000000000000000000000000000000000906084015b604080517fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe08184030181529190526020810180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff167fffffffff00000000000000000000000000000000000000000000000000000000909316929092179091526126ac565b600081604051602001611ba49190613f46565b604051602081830303815290604052805190602001209050919050565b60006706f05b59d3b200008367ffffffffffffffff16108015611bf957506706f05b59d3b200008560a0015167ffffffffffffffff16105b611c5f576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152600c60248201527f696e76616c6964206665657300000000000000000000000000000000000000006044820152606401610aa7565b606085015160008781526007602052604090205410611cda576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152600c60248201527f72656c61792066696c6c656400000000000000000000000000000000000000006044820152606401610aa7565b83611ce757506000611e46565b611d0084848760a00151611cfb9190613fd2565b6127b8565b60008781526007602052604081205460608801519293508692611d239190613ff5565b905082811015611d4c57809250611d4983868960a00151611d449190613fd2565b6127f9565b91505b60008881526007602052604081208054859290611d6a90849061400c565b9091555050600454604088015173ffffffffffffffffffffffffffffffffffffffff90811691161415611dd65783611dc3576040870151611dc39073ffffffffffffffffffffffffffffffffffffffff16333085611ab5565b611dd1876020015183612822565b611e43565b83611e1057611dd1338860200151848a6040015173ffffffffffffffffffffffffffffffffffffffff16611ab5909392919063ffffffff16565b611e43876020015183896040015173ffffffffffffffffffffffffffffffffffffffff1661292c9092919063ffffffff16565b50505b95945050505050565b816000015173ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16877fedf6b64f49870333280b7dcf98ec56c6b9ff7cf50aa9be7caecb3874e961849f8560600151600760008c8152602001908152602001600020548a8a89608001518b8b60a001518c60e001518d604001518e602001518e604051611f649b9a999897969594939291909a8b5260208b019990995260408a01979097526060890195909552608088019390935267ffffffffffffffff91821660a08801521660c086015263ffffffff1660e085015273ffffffffffffffffffffffffffffffffffffffff9081166101008501521661012083015215156101408201526101600190565b60405180910390a4505050505050565b4715611ab35760048054604080517fd0e30db0000000000000000000000000000000000000000000000000000000008152905173ffffffffffffffffffffffffffffffffffffffff9092169263d0e30db0924792808301926000929182900301818588803b15801561080957600080fd5b46826020015114612052576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152600f60248201527f496e76616c696420636861696e496400000000000000000000000000000000006044820152606401610aa7565b8160400151518260a0015151146120c5576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152600c60248201527f696e76616c6964206c65616600000000000000000000000000000000000000006044820152606401610aa7565b600060068463ffffffff16815481106120e0576120e0613da8565b906000526020600020906003020190506120ff81600101548484612982565b612165576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152600960248201527f4261642050726f6f6600000000000000000000000000000000000000000000006044820152606401610aa7565b61217c81600201846060015163ffffffff166129bd565b156121e3576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152600f60248201527f416c726561647920636c61696d656400000000000000000000000000000000006044820152606401610aa7565b6121fa81600201846060015163ffffffff166129fe565b60005b8360400151518163ffffffff1610156122a657600084604001518263ffffffff168151811061222e5761222e613da8565b602002602001015190506000811115612293576122938560a001518363ffffffff168151811061226057612260613da8565b602002602001015182876080015173ffffffffffffffffffffffffffffffffffffffff1661292c9092919063ffffffff16565b508061229e81614024565b9150506121fd565b5082511561233f576122b783612a3c565b826080015173ffffffffffffffffffffffffffffffffffffffff16836060015163ffffffff1684602001517f828fc203220356df8f072a91681caee7d5c75095e2a95e80ed5a14b384697f7186600001513360405161233692919091825273ffffffffffffffffffffffffffffffffffffffff16602082015260400190565b60405180910390a45b826060015163ffffffff168463ffffffff1684602001517ff8bd640004bcec1b89657020f561d0b070cbdf662d0b158db9dccb0a8301bfab8660000151876040015188608001518960a001513360405161239d9594939291906140c9565b60405180910390a450505050565b73ffffffffffffffffffffffffffffffffffffffff8116612428576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601960248201527f4261642062726964676520726f757465722061646472657373000000000000006044820152606401610aa7565b600280547fffffffffffffffffffffffff00000000000000000000000000000000000000001673ffffffffffffffffffffffffffffffffffffffff83169081179091556040517fa9e8c42c9e7fca7f62755189a16b2f5314d43d8fb24e91ba54e6d65f9314e84990600090a250565b60408051608060208201819052601160a08301527f4143524f53532d56322d4645452d312e3000000000000000000000000000000060c083015267ffffffffffffffff86169282019290925263ffffffff8416606082015290810185905260009060e001604051602081830303815290604052805190602001209050600061251e82612cbc565b905061252b878285612cf7565b50505050505050565b60006040518061010001604052808c73ffffffffffffffffffffffffffffffffffffffff1681526020018b73ffffffffffffffffffffffffffffffffffffffff1681526020018a73ffffffffffffffffffffffffffffffffffffffff1681526020018981526020018881526020018767ffffffffffffffff1681526020018667ffffffffffffffff1681526020018563ffffffff16815250905061260360068463ffffffff16815481106125ea576125ea613da8565b9060005260206000209060030201600001548284612d68565b612669576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152600d60248201527f496e76616c69642070726f6f66000000000000000000000000000000000000006044820152606401610aa7565b600061267482611b91565b9050600061268b8284856060015160006001611bc1565b905061269d8282600080876001611e4f565b50505050505050505050505050565b600061270e826040518060400160405280602081526020017f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c65648152508573ffffffffffffffffffffffffffffffffffffffff16612d809092919063ffffffff16565b80519091501561134a578080602001905181019061272c9190614127565b61134a576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602a60248201527f5361666545524332303a204552433230206f7065726174696f6e20646964206e60448201527f6f742073756363656564000000000000000000000000000000000000000000006064820152608401610aa7565b60006127cc82670de0b6b3a7640000614144565b67ffffffffffffffff166127e884670de0b6b3a7640000614165565b6127f291906141d1565b9392505050565b6000670de0b6b3a764000061280e8382614144565b6127e89067ffffffffffffffff1685614165565b73ffffffffffffffffffffffffffffffffffffffff82163b15612867576004546128639073ffffffffffffffffffffffffffffffffffffffff16838361292c565b5050565b600480546040517f2e1a7d4d00000000000000000000000000000000000000000000000000000000815291820183905273ffffffffffffffffffffffffffffffffffffffff1690632e1a7d4d90602401600060405180830381600087803b1580156128d157600080fd5b505af11580156128e5573d6000803e3d6000fd5b505060405173ffffffffffffffffffffffffffffffffffffffff8516925083156108fc02915083906000818181858888f1935050505015801561134a573d6000803e3d6000fd5b60405173ffffffffffffffffffffffffffffffffffffffff831660248201526044810182905261134a9084907fa9059cbb0000000000000000000000000000000000000000000000000000000090606401611b0f565b60006129b582858560405160200161299a91906141e5565b60405160208183030381529060405280519060200120612d8f565b949350505050565b6000806129cc610100846141d1565b905060006129dc61010085614280565b6000928352602095909552506040902054600190931b92831690921492915050565b6000612a0c610100836141d1565b90506000612a1c61010084614280565b600092835260209490945250604090208054600190931b90921790915550565b600454608082015173ffffffffffffffffffffffffffffffffffffffff90811691161415612b1957608081015181516040517f2e1a7d4d00000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff90921691632e1a7d4d91612ac09160040190815260200190565b600060405180830381600087803b158015612ada57600080fd5b505af1158015612aee573d6000803e3d6000fd5b5050600854640100000000900473ffffffffffffffffffffffffffffffffffffffff16608084015250505b608081015173ffffffffffffffffffffffffffffffffffffffff9081166000908152600960205260409020541615612b7d57608081015173ffffffffffffffffffffffffffffffffffffffff90811660009081526009602052604090205416612b93565b7342000000000000000000000000000000000000105b608082015160035483516008546040517fa3a7954800000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff94851660048201529284166024840152604483019190915263ffffffff16606482015260a06084820152600060a482015291169063a3a795489060c401600060405180830381600087803b158015612c3257600080fd5b505af1158015612c46573d6000803e3d6000fd5b50505050608081015160035482516008546040805173ffffffffffffffffffffffffffffffffffffffff9485168152602081019390935263ffffffff909116908201529116907f46b77e3c29797b94890fd3438da74f697480742358a3e26b9d13a227f1ac0ac99060600160405180910390a250565b6040517f19457468657265756d205369676e6564204d6573736167653a0a3332000000006020820152603c8101829052600090605c01611ba4565b612d02838383612da5565b61134a576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601160248201527f696e76616c6964207369676e61747572650000000000000000000000000000006044820152606401610aa7565b60006129b582858560405160200161299a9190613f46565b60606129b58484600085612f94565b600082612d9c858461312a565b14949350505050565b6000806000612db4858561319e565b90925090506000816004811115612dcd57612dcd614294565b148015612e0557508573ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff16145b15612e15576001925050506127f2565b6000808773ffffffffffffffffffffffffffffffffffffffff16631626ba7e60e01b8888604051602401612e4a9291906142c3565b604080517fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe08184030181529181526020820180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff167fffffffff00000000000000000000000000000000000000000000000000000000909416939093179092529051612ed391906142dc565b600060405180830381855afa9150503d8060008114612f0e576040519150601f19603f3d011682016040523d82523d6000602084013e612f13565b606091505b5091509150818015612f26575080516020145b8015612f88575080517f1626ba7e0000000000000000000000000000000000000000000000000000000090612f6490830160209081019084016142f8565b7fffffffff0000000000000000000000000000000000000000000000000000000016145b98975050505050505050565b606082471015613026576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602660248201527f416464726573733a20696e73756666696369656e742062616c616e636520666f60448201527f722063616c6c00000000000000000000000000000000000000000000000000006064820152608401610aa7565b73ffffffffffffffffffffffffffffffffffffffff85163b6130a4576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e74726163740000006044820152606401610aa7565b6000808673ffffffffffffffffffffffffffffffffffffffff1685876040516130cd91906142dc565b60006040518083038185875af1925050503d806000811461310a576040519150601f19603f3d011682016040523d82523d6000602084013e61310f565b606091505b509150915061311f82828661320e565b979650505050505050565b600081815b845181101561319657600085828151811061314c5761314c613da8565b602002602001015190508083116131725760008381526020829052604090209250613183565b600081815260208490526040902092505b508061318e81613ecd565b91505061312f565b509392505050565b6000808251604114156131d55760208301516040840151606085015160001a6131c987828585613261565b94509450505050613207565b8251604014156131ff57602083015160408401516131f4868383613379565b935093505050613207565b506000905060025b9250929050565b6060831561321d5750816127f2565b82511561322d5782518084602001fd5b816040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610aa79190613eba565b6000807f7fffffffffffffffffffffffffffffff5d576e7357a4501ddfe92f46681b20a08311156132985750600090506003613370565b8460ff16601b141580156132b057508460ff16601c14155b156132c15750600090506004613370565b6040805160008082526020820180845289905260ff881692820192909252606081018690526080810185905260019060a0016020604051602081039080840390855afa158015613315573d6000803e3d6000fd5b50506040517fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0015191505073ffffffffffffffffffffffffffffffffffffffff811661336957600060019250925050613370565b9150600090505b94509492505050565b6000807f7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff8316816133af60ff86901c601b61400c565b90506133bd87828885613261565b935093505050935093915050565b803563ffffffff811681146133df57600080fd5b919050565b6000602082840312156133f657600080fd5b6127f2826133cb565b73ffffffffffffffffffffffffffffffffffffffff8116811461077857600080fd5b80356133df816133ff565b60006020828403121561343e57600080fd5b81356127f2816133ff565b60006020828403121561345b57600080fd5b5035919050565b801515811461077857600080fd5b60008060006060848603121561348557600080fd5b8335613490816133ff565b92506020840135915060408401356134a781613462565b809150509250925092565b803567ffffffffffffffff811681146133df57600080fd5b60008060008060008060c087890312156134e357600080fd5b86356134ee816133ff565b955060208701356134fe816133ff565b9450604087013593506060870135925061351a608088016134b2565b915061352860a088016133cb565b90509295509295509295565b6000806040838503121561354757600080fd5b50508035926020909101359150565b6000806040838503121561356957600080fd5b8235613574816133ff565b946020939093013593505050565b6000806000806000806000806000806101408b8d0312156135a257600080fd5b8a356135ad816133ff565b995060208b01356135bd816133ff565b985060408b01356135cd816133ff565b975060608b0135965060808b0135955060a08b0135945060c08b013593506135f760e08c016134b2565b92506136066101008c016134b2565b91506136156101208c016133cb565b90509295989b9194979a5092959850565b6000806020838503121561363957600080fd5b823567ffffffffffffffff8082111561365157600080fd5b818501915085601f83011261366557600080fd5b81358181111561367457600080fd5b8660208260051b850101111561368957600080fd5b60209290920196919550909350505050565b60005b838110156136b657818101518382015260200161369e565b8381111561143d5750506000910152565b600081518084526136df81602086016020860161369b565b601f017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0169290920160200192915050565b6000602080830181845280855180835260408601915060408160051b870101925083870160005b82811015613784577fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc08886030184526137728583516136c7565b94509285019290850190600101613738565b5092979650505050505050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b60405160c0810167ffffffffffffffff811182821017156137e3576137e3613791565b60405290565b604051601f82017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe016810167ffffffffffffffff8111828210171561383057613830613791565b604052919050565b600067ffffffffffffffff82111561385257613852613791565b5060051b60200190565b600082601f83011261386d57600080fd5b8135602061388261387d83613838565b6137e9565b82815260059290921b840181019181810190868411156138a157600080fd5b8286015b848110156138bc57803583529183019183016138a5565b509695505050505050565b600082601f8301126138d857600080fd5b813560206138e861387d83613838565b82815260059290921b8401810191818101908684111561390757600080fd5b8286015b848110156138bc57803561391e816133ff565b835291830191830161390b565b60008060006060848603121561394057600080fd5b613949846133cb565b9250602084013567ffffffffffffffff8082111561396657600080fd5b9085019060c0828803121561397a57600080fd5b6139826137c0565b82358152602083013560208201526040830135828111156139a257600080fd5b6139ae8982860161385c565b6040830152506139c0606084016133cb565b60608201526139d160808401613421565b608082015260a0830135828111156139e857600080fd5b6139f4898286016138c7565b60a08301525093506040860135915080821115613a1057600080fd5b50613a1d8682870161385c565b9150509250925092565b600067ffffffffffffffff821115613a4157613a41613791565b50601f017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe01660200190565b600082601f830112613a7e57600080fd5b8135613a8c61387d82613a27565b818152846020838601011115613aa157600080fd5b816020850160208301376000918101602001919091529392505050565b60008060008060808587031215613ad457600080fd5b8435613adf816133ff565b9350613aed602086016134b2565b9250613afb604086016133cb565b9150606085013567ffffffffffffffff811115613b1757600080fd5b613b2387828801613a6d565b91505092959194509250565b6000806000806000806000806000806101408b8d031215613b4f57600080fd5b8a35613b5a816133ff565b995060208b0135613b6a816133ff565b985060408b0135613b7a816133ff565b975060608b0135965060808b01359550613b9660a08c016134b2565b9450613ba460c08c016134b2565b9350613bb260e08c016133cb565b9250613bc16101008c016133cb565b91506101208b013567ffffffffffffffff811115613bde57600080fd5b613bea8d828e0161385c565b9150509295989b9194979a5092959850565b60008060408385031215613c0f57600080fd5b8235613c1a816133ff565b91506020830135613c2a816133ff565b809150509250929050565b6000806000806000806000806000806000806101808d8f031215613c5857600080fd5b613c618d613421565b9b50613c6f60208e01613421565b9a50613c7d60408e01613421565b995060608d0135985060808d0135975060a08d0135965060c08d01359550613ca760e08e016134b2565b9450613cb66101008e016134b2565b9350613cc56101208e016134b2565b9250613cd46101408e016133cb565b915067ffffffffffffffff6101608e01351115613cf057600080fd5b613d018e6101608f01358f01613a6d565b90509295989b509295989b509295989b565b600060208284031215613d2557600080fd5b5051919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b600063ffffffff83811690831681811015613d7857613d78613d2c565b039392505050565b600063ffffffff808316818516808303821115613d9f57613d9f613d2c565b01949350505050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b60008083357fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe1843603018112613e0c57600080fd5b83018035915067ffffffffffffffff821115613e2757600080fd5b60200191503681900382131561320757600080fd5b8183823760009101908152919050565b600060208284031215613e5e57600080fd5b815167ffffffffffffffff811115613e7557600080fd5b8201601f81018413613e8657600080fd5b8051613e9461387d82613a27565b818152856020838501011115613ea957600080fd5b611e4682602083016020860161369b565b6020815260006127f260208301846136c7565b60007fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff821415613eff57613eff613d2c565b5060010190565b67ffffffffffffffff831681526040602082015260006129b560408301846136c7565b600060208284031215613f3b57600080fd5b81516127f2816133ff565b60006101008201905073ffffffffffffffffffffffffffffffffffffffff80845116835280602085015116602084015280604085015116604084015250606083015160608301526080830151608083015260a083015167ffffffffffffffff80821660a08501528060c08601511660c0850152505060e083015161128f60e084018263ffffffff169052565b600067ffffffffffffffff808316818516808303821115613d9f57613d9f613d2c565b60008282101561400757614007613d2c565b500390565b6000821982111561401f5761401f613d2c565b500190565b600063ffffffff8083168181141561403e5761403e613d2c565b6001019392505050565b600081518084526020808501945080840160005b838110156140785781518752958201959082019060010161405c565b509495945050505050565b600081518084526020808501945080840160005b8381101561407857815173ffffffffffffffffffffffffffffffffffffffff1687529582019590820190600101614097565b85815260a0602082015260006140e260a0830187614048565b73ffffffffffffffffffffffffffffffffffffffff808716604085015283820360608501526141118287614083565b9250808516608085015250509695505050505050565b60006020828403121561413957600080fd5b81516127f281613462565b600067ffffffffffffffff83811690831681811015613d7857613d78613d2c565b6000817fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff048311821515161561419d5761419d613d2c565b500290565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601260045260246000fd5b6000826141e0576141e06141a2565b500490565b6020815281516020820152602082015160408201526000604083015160c0606084015261421560e0840182614048565b905063ffffffff606085015116608084015273ffffffffffffffffffffffffffffffffffffffff60808501511660a084015260a08401517fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe08483030160c0850152611e468282614083565b60008261428f5761428f6141a2565b500690565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052602160045260246000fd5b8281526040602082015260006129b560408301846136c7565b600082516142ee81846020870161369b565b9190910192915050565b60006020828403121561430a57600080fd5b81517fffffffff00000000000000000000000000000000000000000000000000000000811681146127f257600080fdfea26469706673582212207b10348b019e6f8ed9f54976197ffd219617893c84f666895c35f68350bdd25d64736f6c634300080b0033", - "deployedBytecode": "0x6080604052600436106101dc5760003560e01c806389a153cc11610102578063e282d5b911610095578063f06850f611610064578063f06850f614610673578063f500697c146106a0578063fbbba9ac146106c0578063ffc351a3146106e057600080fd5b8063e282d5b9146105b4578063e3229211146105d4578063ecda10f514610609578063ee2a53f81461063e57600080fd5b8063b27a4300116100d1578063b27a430014610504578063c894c0ca14610547578063de7eba7814610567578063e19044021461058757600080fd5b806389a153cc146104745780639a8a059214610494578063a1244c67146104a7578063ac9650d8146104e457600080fd5b80633cb747bf1161017a5780635249fef1116101495780635249fef1146103915780635285e058146103dc57806357f6dcb814610409578063766e07031461045757600080fd5b80633cb747bf146103045780633fc8cef314610331578063492289781461035e578063493a4f841461037157600080fd5b806322f8e566116101b657806322f8e56614610281578063272751c7146102a15780632752042e146102c157806329cb924d146102e157600080fd5b80630eaac9f0146101e85780631c39c38d1461020a5780631dfb2d021461026157600080fd5b366101e357005b600080fd5b3480156101f457600080fd5b506102086102033660046133e4565b610700565b005b34801561021657600080fd5b506001546102379073ffffffffffffffffffffffffffffffffffffffff1681565b60405173ffffffffffffffffffffffffffffffffffffffff90911681526020015b60405180910390f35b34801561026d57600080fd5b5061020861027c36600461342c565b610767565b34801561028d57600080fd5b5061020861029c366004613449565b61077b565b3480156102ad57600080fd5b506102086102bc366004613470565b610824565b3480156102cd57600080fd5b506102086102dc3660046133e4565b6108c2565b3480156102ed57600080fd5b506102f6610951565b604051908152602001610258565b34801561031057600080fd5b506000546102379073ffffffffffffffffffffffffffffffffffffffff1681565b34801561033d57600080fd5b506004546102379073ffffffffffffffffffffffffffffffffffffffff1681565b61020861036c3660046134ca565b610a0d565b34801561037d57600080fd5b5061020861038c366004613534565b610ebe565b34801561039d57600080fd5b506103cc6103ac366004613556565b600560209081526000928352604080842090915290825290205460ff1681565b6040519015158152602001610258565b3480156103e857600080fd5b506002546102379073ffffffffffffffffffffffffffffffffffffffff1681565b34801561041557600080fd5b50600454610442907801000000000000000000000000000000000000000000000000900463ffffffff1681565b60405163ffffffff9091168152602001610258565b34801561046357600080fd5b506008546104429063ffffffff1681565b34801561048057600080fd5b5061020861048f366004613582565b610f6c565b3480156104a057600080fd5b50466102f6565b3480156104b357600080fd5b50600454610442907c0100000000000000000000000000000000000000000000000000000000900463ffffffff1681565b6104f76104f2366004613626565b6110bc565b6040516102589190613711565b34801561051057600080fd5b5061023761051f36600461342c565b60096020526000908152604090205473ffffffffffffffffffffffffffffffffffffffff1681565b34801561055357600080fd5b5061020861056236600461392b565b611296565b34801561057357600080fd5b5061020861058236600461342c565b61134f565b34801561059357600080fd5b506003546102379073ffffffffffffffffffffffffffffffffffffffff1681565b3480156105c057600080fd5b506102086105cf366004613abe565b611360565b3480156105e057600080fd5b5060085461023790640100000000900473ffffffffffffffffffffffffffffffffffffffff1681565b34801561061557600080fd5b506004546104429074010000000000000000000000000000000000000000900463ffffffff1681565b34801561064a57600080fd5b5061065e610659366004613449565b611443565b60408051928352602083019190915201610258565b34801561067f57600080fd5b506102f661068e366004613449565b60076020526000908152604090205481565b3480156106ac57600080fd5b506102086106bb366004613b2f565b611471565b3480156106cc57600080fd5b506102086106db366004613bfc565b611527565b3480156106ec57600080fd5b506102086106fb366004613c35565b6115ab565b61070861170a565b600880547fffffffffffffffffffffffffffffffffffffffffffffffffffffffff000000001663ffffffff83169081179091556040517fe486a5c4bd7b36eabbfe274c99b39130277417be8d2209b4dae04c4fba64ee3a90600090a250565b61076f61170a565b61077881611943565b50565b60015473ffffffffffffffffffffffffffffffffffffffff1661079d57600080fd5b6001546040517f22f8e5660000000000000000000000000000000000000000000000000000000081526004810183905273ffffffffffffffffffffffffffffffffffffffff909116906322f8e56690602401600060405180830381600087803b15801561080957600080fd5b505af115801561081d573d6000803e3d6000fd5b5050505050565b61082c61170a565b73ffffffffffffffffffffffffffffffffffffffff8316600081815260056020908152604080832086845282529182902080547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff001685151590811790915591519182528492917f0a21fdd43d0ad0c62689ee7230a47309a050755bcc52eba00310add65297692a910160405180910390a3505050565b6108ca61170a565b600480547fffffffff00000000ffffffffffffffffffffffffffffffffffffffffffffffff16780100000000000000000000000000000000000000000000000063ffffffff8416908102919091179091556040519081527f0e55dd180fa793d9036c804d0a116e6a7617a48e72cee1f83d92793a793fcc039060200160405180910390a150565b60015460009073ffffffffffffffffffffffffffffffffffffffff1615610a0857600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166329cb924d6040518163ffffffff1660e01b8152600401602060405180830381865afa1580156109df573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610a039190613d13565b905090565b504290565b73ffffffffffffffffffffffffffffffffffffffff851660009081526005602090815260408083208684529091529020548590849060ff16610ab0576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152600e60248201527f44697361626c656420726f75746500000000000000000000000000000000000060448201526064015b60405180910390fd5b610ab8611a2f565b610ae5600180547fffffffffffffffffffffff00ffffffffffffffffffffffffffffffffffffffff169055565b6706f05b59d3b200008467ffffffffffffffff1610610b60576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601360248201527f696e76616c69642072656c6179657220666565000000000000000000000000006044820152606401610aa7565b600454610b8f907801000000000000000000000000000000000000000000000000900463ffffffff1684613d5b565b63ffffffff16610b9d610951565b10158015610be65750600454610bd5907801000000000000000000000000000000000000000000000000900463ffffffff1684613d80565b63ffffffff16610be3610951565b11155b610c4c576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601260248201527f696e76616c69642071756f74652074696d6500000000000000000000000000006044820152606401610aa7565b60045473ffffffffffffffffffffffffffffffffffffffff8881169116148015610c765750600034115b15610d6d57853414610ce4576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601b60248201527f6d73672e76616c7565206d757374206d6174636820616d6f756e7400000000006044820152606401610aa7565b60048054604080517fd0e30db0000000000000000000000000000000000000000000000000000000008152905173ffffffffffffffffffffffffffffffffffffffff9092169263d0e30db0923492808301926000929182900301818588803b158015610d4f57600080fd5b505af1158015610d63573d6000803e3d6000fd5b5050505050610d8f565b610d8f73ffffffffffffffffffffffffffffffffffffffff8816333089611ab5565b600454604080518881526020810188905267ffffffffffffffff87168183015263ffffffff868116606083015273ffffffffffffffffffffffffffffffffffffffff8c8116608084015292513394938c16937c01000000000000000000000000000000000000000000000000000000009004909116917ffc53c5b967d467d4136291c639720626f3d6dda97b4364da813e6858ad48a721919081900360a00190a460016004601c8282829054906101000a900463ffffffff16610e529190613d80565b92506101000a81548163ffffffff021916908363ffffffff160217905550610eb4600180547fffffffffffffffffffffff00ffffffffffffffffffffffffffffffffffffffff1674010000000000000000000000000000000000000000179055565b5050505050505050565b610ec661170a565b60068054600181018255600091909152600381027ff652222313e28459528d920b65115c16c04f3efc82aaedc97be59f3f377c0d4081018490557ff652222313e28459528d920b65115c16c04f3efc82aaedc97be59f3f377c0d3f01828155604080518581526020810185905263ffffffff8416917fc86ba04c55bc5eb2f2876b91c438849a296dbec7b08751c3074d92e04f0a77af910160405180910390a250505050565b610f74611a2f565b610fa1600180547fffffffffffffffffffffff00ffffffffffffffffffffffffffffffffffffffff169055565b60006040518061010001604052808c73ffffffffffffffffffffffffffffffffffffffff1681526020018b73ffffffffffffffffffffffffffffffffffffffff1681526020018a73ffffffffffffffffffffffffffffffffffffffff1681526020018981526020018681526020018567ffffffffffffffff1681526020018467ffffffffffffffff1681526020018363ffffffff168152509050600061104682611b91565b9050600061105882848b886000611bc1565b905061106982828a88876000611e4f565b5050506110b0600180547fffffffffffffffffffffff00ffffffffffffffffffffffffffffffffffffffff1674010000000000000000000000000000000000000000179055565b50505050505050505050565b60603415611126576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601b60248201527f4f6e6c79206d756c746963616c6c207769746820302076616c756500000000006044820152606401610aa7565b8167ffffffffffffffff81111561113f5761113f613791565b60405190808252806020026020018201604052801561117257816020015b606081526020019060019003908161115d5790505b50905060005b8281101561128f576000803086868581811061119657611196613da8565b90506020028101906111a89190613dd7565b6040516111b6929190613e3c565b600060405180830381855af49150503d80600081146111f1576040519150601f19603f3d011682016040523d82523d6000602084013e6111f6565b606091505b50915091508161125c5760448151101561120f57600080fd5b600481019050808060200190518101906112299190613e4c565b6040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610aa79190613eba565b8084848151811061126f5761126f613da8565b60200260200101819052505050808061128790613ecd565b915050611178565b5092915050565b61129e611a2f565b6112cb600180547fffffffffffffffffffffff00ffffffffffffffffffffffffffffffffffffffff169055565b600454608083015173ffffffffffffffffffffffffffffffffffffffff908116911614156112fb576112fb611f74565b611306838383611fe5565b61134a600180547fffffffffffffffffffffff00ffffffffffffffffffffffffffffffffffffffff1674010000000000000000000000000000000000000000179055565b505050565b61135761170a565b610778816123ab565b611368611a2f565b611395600180547fffffffffffffffffffffff00ffffffffffffffffffffffffffffffffffffffff169055565b6113a28446858585612497565b8373ffffffffffffffffffffffffffffffffffffffff168263ffffffff167fb9de16bf376724405019a10ef4fedac57fecd292bf86c08d81d7c42d394d5d3785846040516113f1929190613f06565b60405180910390a361143d600180547fffffffffffffffffffffff00ffffffffffffffffffffffffffffffffffffffff1674010000000000000000000000000000000000000000179055565b50505050565b6006818154811061145357600080fd5b60009182526020909120600390910201805460019091015490915082565b611479611a2f565b6114a6600180547fffffffffffffffffffffff00ffffffffffffffffffffffffffffffffffffffff169055565b60045473ffffffffffffffffffffffffffffffffffffffff898116911614156114d1576114d1611f74565b6114e38a8a8a8a8a8a8a8a8a8a612534565b6110b0600180547fffffffffffffffffffffff00ffffffffffffffffffffffffffffffffffffffff1674010000000000000000000000000000000000000000179055565b61152f61170a565b73ffffffffffffffffffffffffffffffffffffffff82811660008181526009602052604080822080547fffffffffffffffffffffffff0000000000000000000000000000000000000000169486169485179055517ff3dc137d2246f9b8abd0bb821e185ba01122c9b3ea3745ffca6208037674d6709190a35050565b6115b3611a2f565b6115e0600180547fffffffffffffffffffffff00ffffffffffffffffffffffffffffffffffffffff169055565b6115ed8c87858585612497565b60006040518061010001604052808e73ffffffffffffffffffffffffffffffffffffffff1681526020018d73ffffffffffffffffffffffffffffffffffffffff1681526020018c73ffffffffffffffffffffffffffffffffffffffff1681526020018b81526020018881526020018767ffffffffffffffff1681526020018667ffffffffffffffff1681526020018463ffffffff168152509050600061169282611b91565b905060006116a482848d896000611bc1565b90506116b582828c89876000611e4f565b5050506116fc600180547fffffffffffffffffffffff00ffffffffffffffffffffffffffffffffffffffff1674010000000000000000000000000000000000000000179055565b505050505050505050505050565b60025473ffffffffffffffffffffffffffffffffffffffff1661174260005473ffffffffffffffffffffffffffffffffffffffff1690565b73ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16146117fc576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602e60248201527f4f564d5f58434841494e3a206d657373656e67657220636f6e7472616374207560448201527f6e61757468656e746963617465640000000000000000000000000000000000006064820152608401610aa7565b8073ffffffffffffffffffffffffffffffffffffffff1661183260005473ffffffffffffffffffffffffffffffffffffffff1690565b73ffffffffffffffffffffffffffffffffffffffff16636e296e456040518163ffffffff1660e01b8152600401602060405180830381865afa15801561187c573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906118a09190613f29565b73ffffffffffffffffffffffffffffffffffffffff1614610778576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152603060248201527f4f564d5f58434841494e3a2077726f6e672073656e646572206f662063726f7360448201527f732d646f6d61696e206d657373616765000000000000000000000000000000006064820152608401610aa7565b73ffffffffffffffffffffffffffffffffffffffff81166119c0576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601460248201527f4261642068756220706f6f6c20616464726573730000000000000000000000006044820152606401610aa7565b600380547fffffffffffffffffffffffff00000000000000000000000000000000000000001673ffffffffffffffffffffffffffffffffffffffff83169081179091556040517f1f17a88f67b0f49060a34bec1a4723a563620e6aa265eb640b5046dcee0759a090600090a250565b60015474010000000000000000000000000000000000000000900460ff16611ab3576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601f60248201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c006044820152606401610aa7565b565b60405173ffffffffffffffffffffffffffffffffffffffff8085166024830152831660448201526064810182905261143d9085907f23b872dd00000000000000000000000000000000000000000000000000000000906084015b604080517fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe08184030181529190526020810180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff167fffffffff00000000000000000000000000000000000000000000000000000000909316929092179091526126ac565b600081604051602001611ba49190613f46565b604051602081830303815290604052805190602001209050919050565b60006706f05b59d3b200008367ffffffffffffffff16108015611bf957506706f05b59d3b200008560a0015167ffffffffffffffff16105b611c5f576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152600c60248201527f696e76616c6964206665657300000000000000000000000000000000000000006044820152606401610aa7565b606085015160008781526007602052604090205410611cda576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152600c60248201527f72656c61792066696c6c656400000000000000000000000000000000000000006044820152606401610aa7565b83611ce757506000611e46565b611d0084848760a00151611cfb9190613fd2565b6127b8565b60008781526007602052604081205460608801519293508692611d239190613ff5565b905082811015611d4c57809250611d4983868960a00151611d449190613fd2565b6127f9565b91505b60008881526007602052604081208054859290611d6a90849061400c565b9091555050600454604088015173ffffffffffffffffffffffffffffffffffffffff90811691161415611dd65783611dc3576040870151611dc39073ffffffffffffffffffffffffffffffffffffffff16333085611ab5565b611dd1876020015183612822565b611e43565b83611e1057611dd1338860200151848a6040015173ffffffffffffffffffffffffffffffffffffffff16611ab5909392919063ffffffff16565b611e43876020015183896040015173ffffffffffffffffffffffffffffffffffffffff1661292c9092919063ffffffff16565b50505b95945050505050565b816000015173ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16877fedf6b64f49870333280b7dcf98ec56c6b9ff7cf50aa9be7caecb3874e961849f8560600151600760008c8152602001908152602001600020548a8a89608001518b8b60a001518c60e001518d604001518e602001518e604051611f649b9a999897969594939291909a8b5260208b019990995260408a01979097526060890195909552608088019390935267ffffffffffffffff91821660a08801521660c086015263ffffffff1660e085015273ffffffffffffffffffffffffffffffffffffffff9081166101008501521661012083015215156101408201526101600190565b60405180910390a4505050505050565b4715611ab35760048054604080517fd0e30db0000000000000000000000000000000000000000000000000000000008152905173ffffffffffffffffffffffffffffffffffffffff9092169263d0e30db0924792808301926000929182900301818588803b15801561080957600080fd5b46826020015114612052576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152600f60248201527f496e76616c696420636861696e496400000000000000000000000000000000006044820152606401610aa7565b8160400151518260a0015151146120c5576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152600c60248201527f696e76616c6964206c65616600000000000000000000000000000000000000006044820152606401610aa7565b600060068463ffffffff16815481106120e0576120e0613da8565b906000526020600020906003020190506120ff81600101548484612982565b612165576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152600960248201527f4261642050726f6f6600000000000000000000000000000000000000000000006044820152606401610aa7565b61217c81600201846060015163ffffffff166129bd565b156121e3576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152600f60248201527f416c726561647920636c61696d656400000000000000000000000000000000006044820152606401610aa7565b6121fa81600201846060015163ffffffff166129fe565b60005b8360400151518163ffffffff1610156122a657600084604001518263ffffffff168151811061222e5761222e613da8565b602002602001015190506000811115612293576122938560a001518363ffffffff168151811061226057612260613da8565b602002602001015182876080015173ffffffffffffffffffffffffffffffffffffffff1661292c9092919063ffffffff16565b508061229e81614024565b9150506121fd565b5082511561233f576122b783612a3c565b826080015173ffffffffffffffffffffffffffffffffffffffff16836060015163ffffffff1684602001517f828fc203220356df8f072a91681caee7d5c75095e2a95e80ed5a14b384697f7186600001513360405161233692919091825273ffffffffffffffffffffffffffffffffffffffff16602082015260400190565b60405180910390a45b826060015163ffffffff168463ffffffff1684602001517ff8bd640004bcec1b89657020f561d0b070cbdf662d0b158db9dccb0a8301bfab8660000151876040015188608001518960a001513360405161239d9594939291906140c9565b60405180910390a450505050565b73ffffffffffffffffffffffffffffffffffffffff8116612428576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601960248201527f4261642062726964676520726f757465722061646472657373000000000000006044820152606401610aa7565b600280547fffffffffffffffffffffffff00000000000000000000000000000000000000001673ffffffffffffffffffffffffffffffffffffffff83169081179091556040517fa9e8c42c9e7fca7f62755189a16b2f5314d43d8fb24e91ba54e6d65f9314e84990600090a250565b60408051608060208201819052601160a08301527f4143524f53532d56322d4645452d312e3000000000000000000000000000000060c083015267ffffffffffffffff86169282019290925263ffffffff8416606082015290810185905260009060e001604051602081830303815290604052805190602001209050600061251e82612cbc565b905061252b878285612cf7565b50505050505050565b60006040518061010001604052808c73ffffffffffffffffffffffffffffffffffffffff1681526020018b73ffffffffffffffffffffffffffffffffffffffff1681526020018a73ffffffffffffffffffffffffffffffffffffffff1681526020018981526020018881526020018767ffffffffffffffff1681526020018667ffffffffffffffff1681526020018563ffffffff16815250905061260360068463ffffffff16815481106125ea576125ea613da8565b9060005260206000209060030201600001548284612d68565b612669576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152600d60248201527f496e76616c69642070726f6f66000000000000000000000000000000000000006044820152606401610aa7565b600061267482611b91565b9050600061268b8284856060015160006001611bc1565b905061269d8282600080876001611e4f565b50505050505050505050505050565b600061270e826040518060400160405280602081526020017f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c65648152508573ffffffffffffffffffffffffffffffffffffffff16612d809092919063ffffffff16565b80519091501561134a578080602001905181019061272c9190614127565b61134a576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602a60248201527f5361666545524332303a204552433230206f7065726174696f6e20646964206e60448201527f6f742073756363656564000000000000000000000000000000000000000000006064820152608401610aa7565b60006127cc82670de0b6b3a7640000614144565b67ffffffffffffffff166127e884670de0b6b3a7640000614165565b6127f291906141d1565b9392505050565b6000670de0b6b3a764000061280e8382614144565b6127e89067ffffffffffffffff1685614165565b73ffffffffffffffffffffffffffffffffffffffff82163b15612867576004546128639073ffffffffffffffffffffffffffffffffffffffff16838361292c565b5050565b600480546040517f2e1a7d4d00000000000000000000000000000000000000000000000000000000815291820183905273ffffffffffffffffffffffffffffffffffffffff1690632e1a7d4d90602401600060405180830381600087803b1580156128d157600080fd5b505af11580156128e5573d6000803e3d6000fd5b505060405173ffffffffffffffffffffffffffffffffffffffff8516925083156108fc02915083906000818181858888f1935050505015801561134a573d6000803e3d6000fd5b60405173ffffffffffffffffffffffffffffffffffffffff831660248201526044810182905261134a9084907fa9059cbb0000000000000000000000000000000000000000000000000000000090606401611b0f565b60006129b582858560405160200161299a91906141e5565b60405160208183030381529060405280519060200120612d8f565b949350505050565b6000806129cc610100846141d1565b905060006129dc61010085614280565b6000928352602095909552506040902054600190931b92831690921492915050565b6000612a0c610100836141d1565b90506000612a1c61010084614280565b600092835260209490945250604090208054600190931b90921790915550565b600454608082015173ffffffffffffffffffffffffffffffffffffffff90811691161415612b1957608081015181516040517f2e1a7d4d00000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff90921691632e1a7d4d91612ac09160040190815260200190565b600060405180830381600087803b158015612ada57600080fd5b505af1158015612aee573d6000803e3d6000fd5b5050600854640100000000900473ffffffffffffffffffffffffffffffffffffffff16608084015250505b608081015173ffffffffffffffffffffffffffffffffffffffff9081166000908152600960205260409020541615612b7d57608081015173ffffffffffffffffffffffffffffffffffffffff90811660009081526009602052604090205416612b93565b7342000000000000000000000000000000000000105b608082015160035483516008546040517fa3a7954800000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff94851660048201529284166024840152604483019190915263ffffffff16606482015260a06084820152600060a482015291169063a3a795489060c401600060405180830381600087803b158015612c3257600080fd5b505af1158015612c46573d6000803e3d6000fd5b50505050608081015160035482516008546040805173ffffffffffffffffffffffffffffffffffffffff9485168152602081019390935263ffffffff909116908201529116907f46b77e3c29797b94890fd3438da74f697480742358a3e26b9d13a227f1ac0ac99060600160405180910390a250565b6040517f19457468657265756d205369676e6564204d6573736167653a0a3332000000006020820152603c8101829052600090605c01611ba4565b612d02838383612da5565b61134a576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601160248201527f696e76616c6964207369676e61747572650000000000000000000000000000006044820152606401610aa7565b60006129b582858560405160200161299a9190613f46565b60606129b58484600085612f94565b600082612d9c858461312a565b14949350505050565b6000806000612db4858561319e565b90925090506000816004811115612dcd57612dcd614294565b148015612e0557508573ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff16145b15612e15576001925050506127f2565b6000808773ffffffffffffffffffffffffffffffffffffffff16631626ba7e60e01b8888604051602401612e4a9291906142c3565b604080517fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe08184030181529181526020820180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff167fffffffff00000000000000000000000000000000000000000000000000000000909416939093179092529051612ed391906142dc565b600060405180830381855afa9150503d8060008114612f0e576040519150601f19603f3d011682016040523d82523d6000602084013e612f13565b606091505b5091509150818015612f26575080516020145b8015612f88575080517f1626ba7e0000000000000000000000000000000000000000000000000000000090612f6490830160209081019084016142f8565b7fffffffff0000000000000000000000000000000000000000000000000000000016145b98975050505050505050565b606082471015613026576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602660248201527f416464726573733a20696e73756666696369656e742062616c616e636520666f60448201527f722063616c6c00000000000000000000000000000000000000000000000000006064820152608401610aa7565b73ffffffffffffffffffffffffffffffffffffffff85163b6130a4576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e74726163740000006044820152606401610aa7565b6000808673ffffffffffffffffffffffffffffffffffffffff1685876040516130cd91906142dc565b60006040518083038185875af1925050503d806000811461310a576040519150601f19603f3d011682016040523d82523d6000602084013e61310f565b606091505b509150915061311f82828661320e565b979650505050505050565b600081815b845181101561319657600085828151811061314c5761314c613da8565b602002602001015190508083116131725760008381526020829052604090209250613183565b600081815260208490526040902092505b508061318e81613ecd565b91505061312f565b509392505050565b6000808251604114156131d55760208301516040840151606085015160001a6131c987828585613261565b94509450505050613207565b8251604014156131ff57602083015160408401516131f4868383613379565b935093505050613207565b506000905060025b9250929050565b6060831561321d5750816127f2565b82511561322d5782518084602001fd5b816040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610aa79190613eba565b6000807f7fffffffffffffffffffffffffffffff5d576e7357a4501ddfe92f46681b20a08311156132985750600090506003613370565b8460ff16601b141580156132b057508460ff16601c14155b156132c15750600090506004613370565b6040805160008082526020820180845289905260ff881692820192909252606081018690526080810185905260019060a0016020604051602081039080840390855afa158015613315573d6000803e3d6000fd5b50506040517fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0015191505073ffffffffffffffffffffffffffffffffffffffff811661336957600060019250925050613370565b9150600090505b94509492505050565b6000807f7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff8316816133af60ff86901c601b61400c565b90506133bd87828885613261565b935093505050935093915050565b803563ffffffff811681146133df57600080fd5b919050565b6000602082840312156133f657600080fd5b6127f2826133cb565b73ffffffffffffffffffffffffffffffffffffffff8116811461077857600080fd5b80356133df816133ff565b60006020828403121561343e57600080fd5b81356127f2816133ff565b60006020828403121561345b57600080fd5b5035919050565b801515811461077857600080fd5b60008060006060848603121561348557600080fd5b8335613490816133ff565b92506020840135915060408401356134a781613462565b809150509250925092565b803567ffffffffffffffff811681146133df57600080fd5b60008060008060008060c087890312156134e357600080fd5b86356134ee816133ff565b955060208701356134fe816133ff565b9450604087013593506060870135925061351a608088016134b2565b915061352860a088016133cb565b90509295509295509295565b6000806040838503121561354757600080fd5b50508035926020909101359150565b6000806040838503121561356957600080fd5b8235613574816133ff565b946020939093013593505050565b6000806000806000806000806000806101408b8d0312156135a257600080fd5b8a356135ad816133ff565b995060208b01356135bd816133ff565b985060408b01356135cd816133ff565b975060608b0135965060808b0135955060a08b0135945060c08b013593506135f760e08c016134b2565b92506136066101008c016134b2565b91506136156101208c016133cb565b90509295989b9194979a5092959850565b6000806020838503121561363957600080fd5b823567ffffffffffffffff8082111561365157600080fd5b818501915085601f83011261366557600080fd5b81358181111561367457600080fd5b8660208260051b850101111561368957600080fd5b60209290920196919550909350505050565b60005b838110156136b657818101518382015260200161369e565b8381111561143d5750506000910152565b600081518084526136df81602086016020860161369b565b601f017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0169290920160200192915050565b6000602080830181845280855180835260408601915060408160051b870101925083870160005b82811015613784577fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc08886030184526137728583516136c7565b94509285019290850190600101613738565b5092979650505050505050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b60405160c0810167ffffffffffffffff811182821017156137e3576137e3613791565b60405290565b604051601f82017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe016810167ffffffffffffffff8111828210171561383057613830613791565b604052919050565b600067ffffffffffffffff82111561385257613852613791565b5060051b60200190565b600082601f83011261386d57600080fd5b8135602061388261387d83613838565b6137e9565b82815260059290921b840181019181810190868411156138a157600080fd5b8286015b848110156138bc57803583529183019183016138a5565b509695505050505050565b600082601f8301126138d857600080fd5b813560206138e861387d83613838565b82815260059290921b8401810191818101908684111561390757600080fd5b8286015b848110156138bc57803561391e816133ff565b835291830191830161390b565b60008060006060848603121561394057600080fd5b613949846133cb565b9250602084013567ffffffffffffffff8082111561396657600080fd5b9085019060c0828803121561397a57600080fd5b6139826137c0565b82358152602083013560208201526040830135828111156139a257600080fd5b6139ae8982860161385c565b6040830152506139c0606084016133cb565b60608201526139d160808401613421565b608082015260a0830135828111156139e857600080fd5b6139f4898286016138c7565b60a08301525093506040860135915080821115613a1057600080fd5b50613a1d8682870161385c565b9150509250925092565b600067ffffffffffffffff821115613a4157613a41613791565b50601f017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe01660200190565b600082601f830112613a7e57600080fd5b8135613a8c61387d82613a27565b818152846020838601011115613aa157600080fd5b816020850160208301376000918101602001919091529392505050565b60008060008060808587031215613ad457600080fd5b8435613adf816133ff565b9350613aed602086016134b2565b9250613afb604086016133cb565b9150606085013567ffffffffffffffff811115613b1757600080fd5b613b2387828801613a6d565b91505092959194509250565b6000806000806000806000806000806101408b8d031215613b4f57600080fd5b8a35613b5a816133ff565b995060208b0135613b6a816133ff565b985060408b0135613b7a816133ff565b975060608b0135965060808b01359550613b9660a08c016134b2565b9450613ba460c08c016134b2565b9350613bb260e08c016133cb565b9250613bc16101008c016133cb565b91506101208b013567ffffffffffffffff811115613bde57600080fd5b613bea8d828e0161385c565b9150509295989b9194979a5092959850565b60008060408385031215613c0f57600080fd5b8235613c1a816133ff565b91506020830135613c2a816133ff565b809150509250929050565b6000806000806000806000806000806000806101808d8f031215613c5857600080fd5b613c618d613421565b9b50613c6f60208e01613421565b9a50613c7d60408e01613421565b995060608d0135985060808d0135975060a08d0135965060c08d01359550613ca760e08e016134b2565b9450613cb66101008e016134b2565b9350613cc56101208e016134b2565b9250613cd46101408e016133cb565b915067ffffffffffffffff6101608e01351115613cf057600080fd5b613d018e6101608f01358f01613a6d565b90509295989b509295989b509295989b565b600060208284031215613d2557600080fd5b5051919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b600063ffffffff83811690831681811015613d7857613d78613d2c565b039392505050565b600063ffffffff808316818516808303821115613d9f57613d9f613d2c565b01949350505050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b60008083357fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe1843603018112613e0c57600080fd5b83018035915067ffffffffffffffff821115613e2757600080fd5b60200191503681900382131561320757600080fd5b8183823760009101908152919050565b600060208284031215613e5e57600080fd5b815167ffffffffffffffff811115613e7557600080fd5b8201601f81018413613e8657600080fd5b8051613e9461387d82613a27565b818152856020838501011115613ea957600080fd5b611e4682602083016020860161369b565b6020815260006127f260208301846136c7565b60007fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff821415613eff57613eff613d2c565b5060010190565b67ffffffffffffffff831681526040602082015260006129b560408301846136c7565b600060208284031215613f3b57600080fd5b81516127f2816133ff565b60006101008201905073ffffffffffffffffffffffffffffffffffffffff80845116835280602085015116602084015280604085015116604084015250606083015160608301526080830151608083015260a083015167ffffffffffffffff80821660a08501528060c08601511660c0850152505060e083015161128f60e084018263ffffffff169052565b600067ffffffffffffffff808316818516808303821115613d9f57613d9f613d2c565b60008282101561400757614007613d2c565b500390565b6000821982111561401f5761401f613d2c565b500190565b600063ffffffff8083168181141561403e5761403e613d2c565b6001019392505050565b600081518084526020808501945080840160005b838110156140785781518752958201959082019060010161405c565b509495945050505050565b600081518084526020808501945080840160005b8381101561407857815173ffffffffffffffffffffffffffffffffffffffff1687529582019590820190600101614097565b85815260a0602082015260006140e260a0830187614048565b73ffffffffffffffffffffffffffffffffffffffff808716604085015283820360608501526141118287614083565b9250808516608085015250509695505050505050565b60006020828403121561413957600080fd5b81516127f281613462565b600067ffffffffffffffff83811690831681811015613d7857613d78613d2c565b6000817fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff048311821515161561419d5761419d613d2c565b500290565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601260045260246000fd5b6000826141e0576141e06141a2565b500490565b6020815281516020820152602082015160408201526000604083015160c0606084015261421560e0840182614048565b905063ffffffff606085015116608084015273ffffffffffffffffffffffffffffffffffffffff60808501511660a084015260a08401517fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe08483030160c0850152611e468282614083565b60008261428f5761428f6141a2565b500690565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052602160045260246000fd5b8281526040602082015260006129b560408301846136c7565b600082516142ee81846020870161369b565b9190910192915050565b60006020828403121561430a57600080fd5b81517fffffffff00000000000000000000000000000000000000000000000000000000811681146127f257600080fdfea26469706673582212207b10348b019e6f8ed9f54976197ffd219617893c84f666895c35f68350bdd25d64736f6c634300080b0033", + "solcInputHash": "c8b9349311d8b5049b613ac98eb998d0", + "metadata": "{\"compiler\":{\"version\":\"0.8.13+commit.abaa5c0e\"},\"language\":\"Solidity\",\"output\":{\"abi\":[{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_crossDomainAdmin\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"_hubPool\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"timerAddress\",\"type\":\"address\"}],\"stateMutability\":\"nonpayable\",\"type\":\"constructor\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"uint256\",\"name\":\"rootBundleId\",\"type\":\"uint256\"}],\"name\":\"EmergencyDeleteRootBundle\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"originToken\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"uint256\",\"name\":\"destinationChainId\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"bool\",\"name\":\"enabled\",\"type\":\"bool\"}],\"name\":\"EnabledDepositRoute\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"amountToReturn\",\"type\":\"uint256\"},{\"indexed\":true,\"internalType\":\"uint256\",\"name\":\"chainId\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"uint256[]\",\"name\":\"refundAmounts\",\"type\":\"uint256[]\"},{\"indexed\":true,\"internalType\":\"uint32\",\"name\":\"rootBundleId\",\"type\":\"uint32\"},{\"indexed\":true,\"internalType\":\"uint32\",\"name\":\"leafId\",\"type\":\"uint32\"},{\"indexed\":false,\"internalType\":\"address\",\"name\":\"l2TokenAddress\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"address[]\",\"name\":\"refundAddresses\",\"type\":\"address[]\"},{\"indexed\":false,\"internalType\":\"address\",\"name\":\"caller\",\"type\":\"address\"}],\"name\":\"ExecutedRelayerRefundRoot\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"bytes32\",\"name\":\"relayHash\",\"type\":\"bytes32\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"totalFilledAmount\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"fillAmount\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"repaymentChainId\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"originChainId\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"destinationChainId\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"uint64\",\"name\":\"relayerFeePct\",\"type\":\"uint64\"},{\"indexed\":false,\"internalType\":\"uint64\",\"name\":\"realizedLpFeePct\",\"type\":\"uint64\"},{\"indexed\":false,\"internalType\":\"uint32\",\"name\":\"depositId\",\"type\":\"uint32\"},{\"indexed\":false,\"internalType\":\"address\",\"name\":\"destinationToken\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"relayer\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"depositor\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"address\",\"name\":\"recipient\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"bool\",\"name\":\"isSlowRelay\",\"type\":\"bool\"}],\"name\":\"FilledRelay\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"originChainId\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"destinationChainId\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"uint64\",\"name\":\"relayerFeePct\",\"type\":\"uint64\"},{\"indexed\":true,\"internalType\":\"uint32\",\"name\":\"depositId\",\"type\":\"uint32\"},{\"indexed\":false,\"internalType\":\"uint32\",\"name\":\"quoteTimestamp\",\"type\":\"uint32\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"originToken\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"address\",\"name\":\"recipient\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"depositor\",\"type\":\"address\"}],\"name\":\"FundsDeposited\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"l2Token\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"address\",\"name\":\"target\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"numberOfTokensBridged\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"l1Gas\",\"type\":\"uint256\"}],\"name\":\"OptimismTokensBridged\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"uint32\",\"name\":\"rootBundleId\",\"type\":\"uint32\"},{\"indexed\":false,\"internalType\":\"bytes32\",\"name\":\"relayerRefundRoot\",\"type\":\"bytes32\"},{\"indexed\":false,\"internalType\":\"bytes32\",\"name\":\"slowRelayRoot\",\"type\":\"bytes32\"}],\"name\":\"RelayedRootBundle\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"uint64\",\"name\":\"newRelayerFeePct\",\"type\":\"uint64\"},{\"indexed\":true,\"internalType\":\"uint32\",\"name\":\"depositId\",\"type\":\"uint32\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"depositor\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"bytes\",\"name\":\"depositorSignature\",\"type\":\"bytes\"}],\"name\":\"RequestedSpeedUpDeposit\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"uint32\",\"name\":\"newBuffer\",\"type\":\"uint32\"}],\"name\":\"SetDepositQuoteTimeBuffer\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"newHubPool\",\"type\":\"address\"}],\"name\":\"SetHubPool\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"uint32\",\"name\":\"newL1Gas\",\"type\":\"uint32\"}],\"name\":\"SetL1Gas\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"l2Token\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"tokenBridge\",\"type\":\"address\"}],\"name\":\"SetL2TokenBridge\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"newAdmin\",\"type\":\"address\"}],\"name\":\"SetXDomainAdmin\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"amountToReturn\",\"type\":\"uint256\"},{\"indexed\":true,\"internalType\":\"uint256\",\"name\":\"chainId\",\"type\":\"uint256\"},{\"indexed\":true,\"internalType\":\"uint32\",\"name\":\"leafId\",\"type\":\"uint32\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"l2TokenAddress\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"address\",\"name\":\"caller\",\"type\":\"address\"}],\"name\":\"TokensBridged\",\"type\":\"event\"},{\"inputs\":[],\"name\":\"chainId\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"crossDomainAdmin\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"recipient\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"originToken\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"destinationChainId\",\"type\":\"uint256\"},{\"internalType\":\"uint64\",\"name\":\"relayerFeePct\",\"type\":\"uint64\"},{\"internalType\":\"uint32\",\"name\":\"quoteTimestamp\",\"type\":\"uint32\"}],\"name\":\"deposit\",\"outputs\":[],\"stateMutability\":\"payable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"depositQuoteTimeBuffer\",\"outputs\":[{\"internalType\":\"uint32\",\"name\":\"\",\"type\":\"uint32\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"rootBundleId\",\"type\":\"uint256\"}],\"name\":\"emergencyDeleteRootBundle\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"name\":\"enabledDepositRoutes\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint32\",\"name\":\"rootBundleId\",\"type\":\"uint32\"},{\"components\":[{\"internalType\":\"uint256\",\"name\":\"amountToReturn\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"chainId\",\"type\":\"uint256\"},{\"internalType\":\"uint256[]\",\"name\":\"refundAmounts\",\"type\":\"uint256[]\"},{\"internalType\":\"uint32\",\"name\":\"leafId\",\"type\":\"uint32\"},{\"internalType\":\"address\",\"name\":\"l2TokenAddress\",\"type\":\"address\"},{\"internalType\":\"address[]\",\"name\":\"refundAddresses\",\"type\":\"address[]\"}],\"internalType\":\"struct SpokePoolInterface.RelayerRefundLeaf\",\"name\":\"relayerRefundLeaf\",\"type\":\"tuple\"},{\"internalType\":\"bytes32[]\",\"name\":\"proof\",\"type\":\"bytes32[]\"}],\"name\":\"executeRelayerRefundRoot\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"depositor\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"recipient\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"destinationToken\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"totalRelayAmount\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"originChainId\",\"type\":\"uint256\"},{\"internalType\":\"uint64\",\"name\":\"realizedLpFeePct\",\"type\":\"uint64\"},{\"internalType\":\"uint64\",\"name\":\"relayerFeePct\",\"type\":\"uint64\"},{\"internalType\":\"uint32\",\"name\":\"depositId\",\"type\":\"uint32\"},{\"internalType\":\"uint32\",\"name\":\"rootBundleId\",\"type\":\"uint32\"},{\"internalType\":\"bytes32[]\",\"name\":\"proof\",\"type\":\"bytes32[]\"}],\"name\":\"executeSlowRelayRoot\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"depositor\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"recipient\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"destinationToken\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"maxTokensToSend\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"repaymentChainId\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"originChainId\",\"type\":\"uint256\"},{\"internalType\":\"uint64\",\"name\":\"realizedLpFeePct\",\"type\":\"uint64\"},{\"internalType\":\"uint64\",\"name\":\"relayerFeePct\",\"type\":\"uint64\"},{\"internalType\":\"uint32\",\"name\":\"depositId\",\"type\":\"uint32\"}],\"name\":\"fillRelay\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"depositor\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"recipient\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"destinationToken\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"maxTokensToSend\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"repaymentChainId\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"originChainId\",\"type\":\"uint256\"},{\"internalType\":\"uint64\",\"name\":\"realizedLpFeePct\",\"type\":\"uint64\"},{\"internalType\":\"uint64\",\"name\":\"relayerFeePct\",\"type\":\"uint64\"},{\"internalType\":\"uint64\",\"name\":\"newRelayerFeePct\",\"type\":\"uint64\"},{\"internalType\":\"uint32\",\"name\":\"depositId\",\"type\":\"uint32\"},{\"internalType\":\"bytes\",\"name\":\"depositorSignature\",\"type\":\"bytes\"}],\"name\":\"fillRelayWithUpdatedFee\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"getCurrentTime\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"hubPool\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"l1Gas\",\"outputs\":[{\"internalType\":\"uint32\",\"name\":\"\",\"type\":\"uint32\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"l2Eth\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"messenger\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes[]\",\"name\":\"data\",\"type\":\"bytes[]\"}],\"name\":\"multicall\",\"outputs\":[{\"internalType\":\"bytes[]\",\"name\":\"results\",\"type\":\"bytes[]\"}],\"stateMutability\":\"payable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"numberOfDeposits\",\"outputs\":[{\"internalType\":\"uint32\",\"name\":\"\",\"type\":\"uint32\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"\",\"type\":\"bytes32\"}],\"name\":\"relayFills\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"relayerRefundRoot\",\"type\":\"bytes32\"},{\"internalType\":\"bytes32\",\"name\":\"slowRelayRoot\",\"type\":\"bytes32\"}],\"name\":\"relayRootBundle\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"name\":\"rootBundles\",\"outputs\":[{\"internalType\":\"bytes32\",\"name\":\"slowRelayRoot\",\"type\":\"bytes32\"},{\"internalType\":\"bytes32\",\"name\":\"relayerRefundRoot\",\"type\":\"bytes32\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"newCrossDomainAdmin\",\"type\":\"address\"}],\"name\":\"setCrossDomainAdmin\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"time\",\"type\":\"uint256\"}],\"name\":\"setCurrentTime\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint32\",\"name\":\"newDepositQuoteTimeBuffer\",\"type\":\"uint32\"}],\"name\":\"setDepositQuoteTimeBuffer\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"originToken\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"destinationChainId\",\"type\":\"uint256\"},{\"internalType\":\"bool\",\"name\":\"enabled\",\"type\":\"bool\"}],\"name\":\"setEnableRoute\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"newHubPool\",\"type\":\"address\"}],\"name\":\"setHubPool\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint32\",\"name\":\"newl1Gas\",\"type\":\"uint32\"}],\"name\":\"setL1GasLimit\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"l2Token\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"tokenBridge\",\"type\":\"address\"}],\"name\":\"setTokenBridge\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"depositor\",\"type\":\"address\"},{\"internalType\":\"uint64\",\"name\":\"newRelayerFeePct\",\"type\":\"uint64\"},{\"internalType\":\"uint32\",\"name\":\"depositId\",\"type\":\"uint32\"},{\"internalType\":\"bytes\",\"name\":\"depositorSignature\",\"type\":\"bytes\"}],\"name\":\"speedUpDeposit\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"timerAddress\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"name\":\"tokenBridges\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"weth\",\"outputs\":[{\"internalType\":\"contract WETH9\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"stateMutability\":\"payable\",\"type\":\"receive\"}],\"devdoc\":{\"kind\":\"dev\",\"methods\":{\"chainId()\":{\"details\":\"Some L2s like ZKSync don't support the CHAIN_ID opcode so we allow the implementer to override this.\"},\"constructor\":{\"params\":{\"_crossDomainAdmin\":\"Cross domain admin to set. Can be changed by admin.\",\"_hubPool\":\"Hub pool address to set. Can be changed by admin.\",\"timerAddress\":\"Timer address to set.\"}},\"deposit(address,address,uint256,uint256,uint64,uint32)\":{\"params\":{\"amount\":\"Amount of tokens to deposit. Will be amount of tokens to receive less fees.\",\"destinationChainId\":\"Denotes network where user will receive funds from SpokePool by a relayer.\",\"originToken\":\"Token to lock into this contract to initiate deposit.\",\"quoteTimestamp\":\"Timestamp used by relayers to compute this deposit's realizedLPFeePct which is paid to LP pool on HubPool.\",\"recipient\":\"Address to receive funds at on destination chain.\",\"relayerFeePct\":\"% of deposit amount taken out to incentivize a fast relayer.\"}},\"emergencyDeleteRootBundle(uint256)\":{\"params\":{\"rootBundleId\":\"Index of the root bundle that needs to be deleted. Note: this is intentionally a uint256 to ensure that a small input range doesn't limit which indices this method is able to reach.\"}},\"executeRelayerRefundRoot(uint32,(uint256,uint256,uint256[],uint32,address,address[]),bytes32[])\":{\"params\":{\"proof\":\"Inclusion proof for this leaf in relayer refund root in root bundle.\",\"relayerRefundLeaf\":\"Contains all data necessary to reconstruct leaf contained in root bundle and to refund relayer. This data structure is explained in detail in the SpokePoolInterface.\",\"rootBundleId\":\"Unique ID of root bundle containing relayer refund root that this leaf is contained in.\"}},\"executeSlowRelayRoot(address,address,address,uint256,uint256,uint64,uint64,uint32,uint32,bytes32[])\":{\"details\":\"This function assumes that the relay's destination chain ID is the current chain ID, which prevents the caller from executing a slow relay intended for another chain on this chain.\",\"params\":{\"amount\":\"Full size of the deposit.\",\"depositId\":\"Unique deposit ID on origin spoke pool.\",\"depositor\":\"Depositor on origin chain who set this chain as the destination chain.\",\"destinationToken\":\"Token to send to recipient. Should be mapped to the origin token, origin chain ID and this chain ID via a mapping on the HubPool.\",\"originChainId\":\"Chain of SpokePool where deposit originated.\",\"proof\":\"Inclusion proof for this leaf in slow relay root in root bundle.\",\"realizedLpFeePct\":\"Fee % based on L1 HubPool utilization at deposit quote time. Deterministic based on quote time.\",\"recipient\":\"Specified recipient on this chain.\",\"relayerFeePct\":\"Original fee % to keep as relayer set by depositor.\",\"rootBundleId\":\"Unique ID of root bundle containing slow relay root that this leaf is contained in.\"}},\"fillRelay(address,address,address,uint256,uint256,uint256,uint256,uint64,uint64,uint32)\":{\"params\":{\"amount\":\"Full size of the deposit.\",\"depositId\":\"Unique deposit ID on origin spoke pool.\",\"depositor\":\"Depositor on origin chain who set this chain as the destination chain.\",\"destinationToken\":\"Token to send to recipient. Should be mapped to the origin token, origin chain ID and this chain ID via a mapping on the HubPool.\",\"maxTokensToSend\":\"Max amount of tokens to send recipient. If higher than amount, then caller will send recipient the full relay amount.\",\"originChainId\":\"Chain of SpokePool where deposit originated.\",\"realizedLpFeePct\":\"Fee % based on L1 HubPool utilization at deposit quote time. Deterministic based on quote time.\",\"recipient\":\"Specified recipient on this chain.\",\"relayerFeePct\":\"Fee % to keep as relayer, specified by depositor.\",\"repaymentChainId\":\"Chain of SpokePool where relayer wants to be refunded after the challenge window has passed.\"}},\"fillRelayWithUpdatedFee(address,address,address,uint256,uint256,uint256,uint256,uint64,uint64,uint64,uint32,bytes)\":{\"params\":{\"amount\":\"Full size of the deposit.\",\"depositId\":\"Unique deposit ID on origin spoke pool.\",\"depositor\":\"Depositor on origin chain who set this chain as the destination chain.\",\"depositorSignature\":\"Depositor-signed message containing updated fee %.\",\"destinationToken\":\"Token to send to recipient. Should be mapped to the origin token, origin chain ID and this chain ID via a mapping on the HubPool.\",\"maxTokensToSend\":\"Max amount of tokens to send recipient. If higher than amount, then caller will send recipient the full relay amount.\",\"newRelayerFeePct\":\"New fee % to keep as relayer also specified by depositor.\",\"originChainId\":\"Chain of SpokePool where deposit originated.\",\"realizedLpFeePct\":\"Fee % based on L1 HubPool utilization at deposit quote time. Deterministic based on quote time.\",\"recipient\":\"Specified recipient on this chain.\",\"relayerFeePct\":\"Original fee % to keep as relayer set by depositor.\",\"repaymentChainId\":\"Chain of SpokePool where relayer wants to be refunded after the challenge window has passed.\"}},\"getCurrentTime()\":{\"returns\":{\"_0\":\"uint for the current Testable timestamp.\"}},\"relayRootBundle(bytes32,bytes32)\":{\"params\":{\"relayerRefundRoot\":\"Merkle root containing relayer refund leaves that can be individually executed via executeRelayerRefundRoot().\",\"slowRelayRoot\":\"Merkle root containing slow relay fulfillment leaves that can be individually executed via executeSlowRelayRoot().\"}},\"setCrossDomainAdmin(address)\":{\"params\":{\"newCrossDomainAdmin\":\"New cross domain admin.\"}},\"setCurrentTime(uint256)\":{\"details\":\"Will revert if not running in test mode.\",\"params\":{\"time\":\"timestamp to set current Testable time to.\"}},\"setDepositQuoteTimeBuffer(uint32)\":{\"params\":{\"newDepositQuoteTimeBuffer\":\"New quote time buffer.\"}},\"setEnableRoute(address,uint256,bool)\":{\"params\":{\"destinationChainId\":\"Chain ID for where depositor wants to receive funds.\",\"enabled\":\"True to enable deposits, False otherwise.\",\"originToken\":\"Token that depositor can deposit to this contract.\"}},\"setHubPool(address)\":{\"params\":{\"newHubPool\":\"New hub pool.\"}},\"setL1GasLimit(uint32)\":{\"params\":{\"newl1Gas\":\"New L1 gas limit to set.\"}},\"setTokenBridge(address,address)\":{\"details\":\"If this mapping isn't set for an L2 token, then the standard bridge will be used to bridge this token.\",\"params\":{\"tokenBridge\":\"Address of token bridge\"}},\"speedUpDeposit(address,uint64,uint32,bytes)\":{\"params\":{\"depositId\":\"Deposit to update fee for that originated in this contract.\",\"depositor\":\"Signer of the update fee message who originally submitted the deposit. If the deposit doesn't exist, then the relayer will not be able to fill any relay, so the caller should validate that the depositor did in fact submit a relay.\",\"depositorSignature\":\"Signed message containing the depositor address, this contract chain ID, the updated relayer fee %, and the deposit ID. This signature is produced by signing a hash of data according to the EIP-191 standard. See more in the _verifyUpdateRelayerFeeMessage() comments.\",\"newRelayerFeePct\":\"New relayer fee that relayers can use.\"}}},\"version\":1},\"userdoc\":{\"kind\":\"user\",\"methods\":{\"chainId()\":{\"notice\":\"Returns chain ID for this network.\"},\"constructor\":{\"notice\":\"Construct the OVM SpokePool.\"},\"deposit(address,address,uint256,uint256,uint64,uint32)\":{\"notice\":\"Called by user to bridge funds from origin to destination chain. Depositor will effectively lock tokens in this contract and receive a destination token on the destination chain. The origin => destination token mapping is stored on the L1 HubPool.The caller must first approve this contract to spend amount of originToken.The originToken => destinationChainId must be enabled.This method is payable because the caller is able to deposit ETH if the originToken is WETH and this function will handle wrapping ETH.\"},\"emergencyDeleteRootBundle(uint256)\":{\"notice\":\"This method is intended to only be used in emergencies where a bad root bundle has reached the SpokePool.\"},\"executeRelayerRefundRoot(uint32,(uint256,uint256,uint256[],uint32,address,address[]),bytes32[])\":{\"notice\":\"Wraps any ETH into WETH before executing base function. This is necessary because SpokePool receives ETH over the canonical token bridge instead of WETH.\"},\"executeSlowRelayRoot(address,address,address,uint256,uint256,uint64,uint64,uint32,uint32,bytes32[])\":{\"notice\":\"Wraps any ETH into WETH before executing base function. This is necessary because SpokePool receives ETH over the canonical token bridge instead of WETH.\"},\"fillRelay(address,address,address,uint256,uint256,uint256,uint256,uint64,uint64,uint32)\":{\"notice\":\"Called by relayer to fulfill part of a deposit by sending destination tokens to the recipient. Relayer is expected to pass in unique identifying information for deposit that they want to fulfill, and this relay submission will be validated by off-chain data workers who can dispute this relay if any part is invalid. If the relay is valid, then the relayer will be refunded on their desired repayment chain. If relay is invalid, then relayer will not receive any refund.All of the deposit data can be found via on-chain events from the origin SpokePool, except for the realizedLpFeePct which is a function of the HubPool's utilization at the deposit quote time. This fee % is deterministic based on the quote time, so the relayer should just compute it using the canonical algorithm as described in a UMIP linked to the HubPool's identifier.\"},\"fillRelayWithUpdatedFee(address,address,address,uint256,uint256,uint256,uint256,uint64,uint64,uint64,uint32,bytes)\":{\"notice\":\"Called by relayer to execute same logic as calling fillRelay except that relayer is using an updated relayer fee %. The fee % must have been emitted in a message cryptographically signed by the depositor.By design, the depositor probably emitted the message with the updated fee by calling speedUpRelay().\"},\"getCurrentTime()\":{\"notice\":\"Gets the current time. Will return the last time set in `setCurrentTime` if running in test mode. Otherwise, it will return the block timestamp.\"},\"relayRootBundle(bytes32,bytes32)\":{\"notice\":\"This method stores a new root bundle in this contract that can be executed to refund relayers, fulfill slow relays, and send funds back to the HubPool on L1. This method can only be called by the admin and is designed to be called as part of a cross-chain message from the HubPool's executeRootBundle method.\"},\"setCrossDomainAdmin(address)\":{\"notice\":\"Change cross domain admin address. Callable by admin only.\"},\"setCurrentTime(uint256)\":{\"notice\":\"Sets the current time.\"},\"setDepositQuoteTimeBuffer(uint32)\":{\"notice\":\"Change allowance for deposit quote time to differ from current block time. Callable by admin only.\"},\"setEnableRoute(address,uint256,bool)\":{\"notice\":\"Enable/Disable an origin token => destination chain ID route for deposits. Callable by admin only.\"},\"setHubPool(address)\":{\"notice\":\"Change L1 hub pool address. Callable by admin only.\"},\"setL1GasLimit(uint32)\":{\"notice\":\"Change L1 gas limit. Callable only by admin.\"},\"setTokenBridge(address,address)\":{\"notice\":\"Set bridge contract for L2 token used to withdraw back to L1.\"},\"speedUpDeposit(address,uint64,uint32,bytes)\":{\"notice\":\"Convenience method that depositor can use to signal to relayer to use updated fee.Relayer should only use events emitted by this function to submit fills with updated fees, otherwise they risk their fills getting disputed for being invalid, for example if the depositor never actually signed the update fee message.This function will revert if the depositor did not sign a message containing the updated fee for the deposit ID stored in this contract. If the deposit ID is for another contract, or the depositor address is incorrect, or the updated fee is incorrect, then the signature will not match and this function will revert.\"}},\"notice\":\"OVM specific SpokePool. Uses OVM cross-domain-enabled logic to implement admin only access to functions.\",\"version\":1}},\"settings\":{\"compilationTarget\":{\"contracts/Optimism_SpokePool.sol\":\"Optimism_SpokePool\"},\"evmVersion\":\"london\",\"libraries\":{},\"metadata\":{\"bytecodeHash\":\"ipfs\",\"useLiteralContent\":true},\"optimizer\":{\"enabled\":true,\"runs\":1000000},\"remappings\":[]},\"sources\":{\"@eth-optimism/contracts/L2/messaging/IL2ERC20Bridge.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity ^0.8.9;\\n\\n/**\\n * @title IL2ERC20Bridge\\n */\\ninterface IL2ERC20Bridge {\\n /**********\\n * Events *\\n **********/\\n\\n event WithdrawalInitiated(\\n address indexed _l1Token,\\n address indexed _l2Token,\\n address indexed _from,\\n address _to,\\n uint256 _amount,\\n bytes _data\\n );\\n\\n event DepositFinalized(\\n address indexed _l1Token,\\n address indexed _l2Token,\\n address indexed _from,\\n address _to,\\n uint256 _amount,\\n bytes _data\\n );\\n\\n event DepositFailed(\\n address indexed _l1Token,\\n address indexed _l2Token,\\n address indexed _from,\\n address _to,\\n uint256 _amount,\\n bytes _data\\n );\\n\\n /********************\\n * Public Functions *\\n ********************/\\n\\n /**\\n * @dev get the address of the corresponding L1 bridge contract.\\n * @return Address of the corresponding L1 bridge contract.\\n */\\n function l1TokenBridge() external returns (address);\\n\\n /**\\n * @dev initiate a withdraw of some tokens to the caller's account on L1\\n * @param _l2Token Address of L2 token where withdrawal was initiated.\\n * @param _amount Amount of the token to withdraw.\\n * param _l1Gas Unused, but included for potential forward compatibility considerations.\\n * @param _data Optional data to forward to L1. This data is provided\\n * solely as a convenience for external contracts. Aside from enforcing a maximum\\n * length, these contracts provide no guarantees about its content.\\n */\\n function withdraw(\\n address _l2Token,\\n uint256 _amount,\\n uint32 _l1Gas,\\n bytes calldata _data\\n ) external;\\n\\n /**\\n * @dev initiate a withdraw of some token to a recipient's account on L1.\\n * @param _l2Token Address of L2 token where withdrawal is initiated.\\n * @param _to L1 adress to credit the withdrawal to.\\n * @param _amount Amount of the token to withdraw.\\n * param _l1Gas Unused, but included for potential forward compatibility considerations.\\n * @param _data Optional data to forward to L1. This data is provided\\n * solely as a convenience for external contracts. Aside from enforcing a maximum\\n * length, these contracts provide no guarantees about its content.\\n */\\n function withdrawTo(\\n address _l2Token,\\n address _to,\\n uint256 _amount,\\n uint32 _l1Gas,\\n bytes calldata _data\\n ) external;\\n\\n /*************************\\n * Cross-chain Functions *\\n *************************/\\n\\n /**\\n * @dev Complete a deposit from L1 to L2, and credits funds to the recipient's balance of this\\n * L2 token. This call will fail if it did not originate from a corresponding deposit in\\n * L1StandardTokenBridge.\\n * @param _l1Token Address for the l1 token this is called with\\n * @param _l2Token Address for the l2 token this is called with\\n * @param _from Account to pull the deposit from on L2.\\n * @param _to Address to receive the withdrawal at\\n * @param _amount Amount of the token to withdraw\\n * @param _data Data provider by the sender on L1. This data is provided\\n * solely as a convenience for external contracts. Aside from enforcing a maximum\\n * length, these contracts provide no guarantees about its content.\\n */\\n function finalizeDeposit(\\n address _l1Token,\\n address _l2Token,\\n address _from,\\n address _to,\\n uint256 _amount,\\n bytes calldata _data\\n ) external;\\n}\\n\",\"keccak256\":\"0x4674c3c8733ca0db16c2b81d58227560df36a07ded3b637a0793564d90ac0475\",\"license\":\"MIT\"},\"@eth-optimism/contracts/libraries/bridge/CrossDomainEnabled.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >0.5.0 <0.9.0;\\n\\n/* Interface Imports */\\nimport { ICrossDomainMessenger } from \\\"./ICrossDomainMessenger.sol\\\";\\n\\n/**\\n * @title CrossDomainEnabled\\n * @dev Helper contract for contracts performing cross-domain communications\\n *\\n * Compiler used: defined by inheriting contract\\n */\\ncontract CrossDomainEnabled {\\n /*************\\n * Variables *\\n *************/\\n\\n // Messenger contract used to send and recieve messages from the other domain.\\n address public messenger;\\n\\n /***************\\n * Constructor *\\n ***************/\\n\\n /**\\n * @param _messenger Address of the CrossDomainMessenger on the current layer.\\n */\\n constructor(address _messenger) {\\n messenger = _messenger;\\n }\\n\\n /**********************\\n * Function Modifiers *\\n **********************/\\n\\n /**\\n * Enforces that the modified function is only callable by a specific cross-domain account.\\n * @param _sourceDomainAccount The only account on the originating domain which is\\n * authenticated to call this function.\\n */\\n modifier onlyFromCrossDomainAccount(address _sourceDomainAccount) {\\n require(\\n msg.sender == address(getCrossDomainMessenger()),\\n \\\"OVM_XCHAIN: messenger contract unauthenticated\\\"\\n );\\n\\n require(\\n getCrossDomainMessenger().xDomainMessageSender() == _sourceDomainAccount,\\n \\\"OVM_XCHAIN: wrong sender of cross-domain message\\\"\\n );\\n\\n _;\\n }\\n\\n /**********************\\n * Internal Functions *\\n **********************/\\n\\n /**\\n * Gets the messenger, usually from storage. This function is exposed in case a child contract\\n * needs to override.\\n * @return The address of the cross-domain messenger contract which should be used.\\n */\\n function getCrossDomainMessenger() internal virtual returns (ICrossDomainMessenger) {\\n return ICrossDomainMessenger(messenger);\\n }\\n\\n /**q\\n * Sends a message to an account on another domain\\n * @param _crossDomainTarget The intended recipient on the destination domain\\n * @param _message The data to send to the target (usually calldata to a function with\\n * `onlyFromCrossDomainAccount()`)\\n * @param _gasLimit The gasLimit for the receipt of the message on the target domain.\\n */\\n function sendCrossDomainMessage(\\n address _crossDomainTarget,\\n uint32 _gasLimit,\\n bytes memory _message\\n ) internal {\\n // slither-disable-next-line reentrancy-events, reentrancy-benign\\n getCrossDomainMessenger().sendMessage(_crossDomainTarget, _message, _gasLimit);\\n }\\n}\\n\",\"keccak256\":\"0x9c3cc8b7047c68a403529b15769a21c2e2668ea71db7bef51f123288009811ea\",\"license\":\"MIT\"},\"@eth-optimism/contracts/libraries/bridge/ICrossDomainMessenger.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >0.5.0 <0.9.0;\\n\\n/**\\n * @title ICrossDomainMessenger\\n */\\ninterface ICrossDomainMessenger {\\n /**********\\n * Events *\\n **********/\\n\\n event SentMessage(\\n address indexed target,\\n address sender,\\n bytes message,\\n uint256 messageNonce,\\n uint256 gasLimit\\n );\\n event RelayedMessage(bytes32 indexed msgHash);\\n event FailedRelayedMessage(bytes32 indexed msgHash);\\n\\n /*************\\n * Variables *\\n *************/\\n\\n function xDomainMessageSender() external view returns (address);\\n\\n /********************\\n * Public Functions *\\n ********************/\\n\\n /**\\n * Sends a cross domain message to the target messenger.\\n * @param _target Target contract address.\\n * @param _message Message to send to the target.\\n * @param _gasLimit Gas limit for the provided message.\\n */\\n function sendMessage(\\n address _target,\\n bytes calldata _message,\\n uint32 _gasLimit\\n ) external;\\n}\\n\",\"keccak256\":\"0x8f29ae23021345a20ccac7b5edb3fc38268aef943b65adc8a32e74b80bf1833a\",\"license\":\"MIT\"},\"@eth-optimism/contracts/libraries/constants/Lib_PredeployAddresses.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity ^0.8.9;\\n\\n/**\\n * @title Lib_PredeployAddresses\\n */\\nlibrary Lib_PredeployAddresses {\\n address internal constant L2_TO_L1_MESSAGE_PASSER = 0x4200000000000000000000000000000000000000;\\n address internal constant L1_MESSAGE_SENDER = 0x4200000000000000000000000000000000000001;\\n address internal constant DEPLOYER_WHITELIST = 0x4200000000000000000000000000000000000002;\\n address payable internal constant OVM_ETH = payable(0xDeadDeAddeAddEAddeadDEaDDEAdDeaDDeAD0000);\\n address internal constant L2_CROSS_DOMAIN_MESSENGER =\\n 0x4200000000000000000000000000000000000007;\\n address internal constant LIB_ADDRESS_MANAGER = 0x4200000000000000000000000000000000000008;\\n address internal constant PROXY_EOA = 0x4200000000000000000000000000000000000009;\\n address internal constant L2_STANDARD_BRIDGE = 0x4200000000000000000000000000000000000010;\\n address internal constant SEQUENCER_FEE_WALLET = 0x4200000000000000000000000000000000000011;\\n address internal constant L2_STANDARD_TOKEN_FACTORY =\\n 0x4200000000000000000000000000000000000012;\\n address internal constant L1_BLOCK_NUMBER = 0x4200000000000000000000000000000000000013;\\n}\\n\",\"keccak256\":\"0x2bc28307af93e9716151a41a81694b56cbe513ef5eb335fb1d81f35e5db8edfa\",\"license\":\"MIT\"},\"@openzeppelin/contracts/token/ERC20/IERC20.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.5.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 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(\\n address from,\\n address to,\\n uint256 amount\\n ) external returns (bool);\\n\\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\",\"keccak256\":\"0xbbc8ac883ac3c0078ce5ad3e288fbb3ffcc8a30c3a98c0fda0114d64fc44fca2\",\"license\":\"MIT\"},\"@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts v4.4.1 (token/ERC20/utils/SafeERC20.sol)\\n\\npragma solidity ^0.8.0;\\n\\nimport \\\"../IERC20.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 function safeTransfer(\\n IERC20 token,\\n address to,\\n uint256 value\\n ) internal {\\n _callOptionalReturn(token, abi.encodeWithSelector(token.transfer.selector, to, value));\\n }\\n\\n function safeTransferFrom(\\n IERC20 token,\\n address from,\\n address to,\\n uint256 value\\n ) 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(\\n IERC20 token,\\n address spender,\\n uint256 value\\n ) 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 function safeIncreaseAllowance(\\n IERC20 token,\\n address spender,\\n uint256 value\\n ) internal {\\n uint256 newAllowance = token.allowance(address(this), spender) + value;\\n _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, newAllowance));\\n }\\n\\n function safeDecreaseAllowance(\\n IERC20 token,\\n address spender,\\n uint256 value\\n ) internal {\\n unchecked {\\n uint256 oldAllowance = token.allowance(address(this), spender);\\n require(oldAllowance >= value, \\\"SafeERC20: decreased allowance below zero\\\");\\n uint256 newAllowance = oldAllowance - value;\\n _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, newAllowance));\\n }\\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 if (returndata.length > 0) {\\n // Return data is optional\\n require(abi.decode(returndata, (bool)), \\\"SafeERC20: ERC20 operation did not succeed\\\");\\n }\\n }\\n}\\n\",\"keccak256\":\"0xc3d946432c0ddbb1f846a0d3985be71299df331b91d06732152117f62f0be2b5\",\"license\":\"MIT\"},\"@openzeppelin/contracts/utils/Address.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.5.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 *\\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://diligence.consensys.net/posts/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.5.11/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 functionCall(target, data, \\\"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(\\n address target,\\n bytes memory data,\\n uint256 value\\n ) 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 require(isContract(target), \\\"Address: call to non-contract\\\");\\n\\n (bool success, bytes memory returndata) = target.call{value: value}(data);\\n return verifyCallResult(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 require(isContract(target), \\\"Address: static call to non-contract\\\");\\n\\n (bool success, bytes memory returndata) = target.staticcall(data);\\n return verifyCallResult(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 require(isContract(target), \\\"Address: delegate call to non-contract\\\");\\n\\n (bool success, bytes memory returndata) = target.delegatecall(data);\\n return verifyCallResult(success, returndata, errorMessage);\\n }\\n\\n /**\\n * @dev Tool to verifies that a low level call was successful, and revert if it wasn't, either by bubbling the\\n * revert reason 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 // 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\\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}\\n\",\"keccak256\":\"0x2ccf9d2313a313d41a791505f2b5abfdc62191b5d4334f7f7a82691c088a1c87\",\"license\":\"MIT\"},\"@openzeppelin/contracts/utils/Strings.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts v4.4.1 (utils/Strings.sol)\\n\\npragma solidity ^0.8.0;\\n\\n/**\\n * @dev String operations.\\n */\\nlibrary Strings {\\n bytes16 private constant _HEX_SYMBOLS = \\\"0123456789abcdef\\\";\\n\\n /**\\n * @dev Converts a `uint256` to its ASCII `string` decimal representation.\\n */\\n function toString(uint256 value) internal pure returns (string memory) {\\n // Inspired by OraclizeAPI's implementation - MIT licence\\n // https://github.com/oraclize/ethereum-api/blob/b42146b063c7d6ee1358846c198246239e9360e8/oraclizeAPI_0.4.25.sol\\n\\n if (value == 0) {\\n return \\\"0\\\";\\n }\\n uint256 temp = value;\\n uint256 digits;\\n while (temp != 0) {\\n digits++;\\n temp /= 10;\\n }\\n bytes memory buffer = new bytes(digits);\\n while (value != 0) {\\n digits -= 1;\\n buffer[digits] = bytes1(uint8(48 + uint256(value % 10)));\\n value /= 10;\\n }\\n return string(buffer);\\n }\\n\\n /**\\n * @dev Converts a `uint256` to its ASCII `string` hexadecimal representation.\\n */\\n function toHexString(uint256 value) internal pure returns (string memory) {\\n if (value == 0) {\\n return \\\"0x00\\\";\\n }\\n uint256 temp = value;\\n uint256 length = 0;\\n while (temp != 0) {\\n length++;\\n temp >>= 8;\\n }\\n return toHexString(value, length);\\n }\\n\\n /**\\n * @dev Converts a `uint256` to its ASCII `string` hexadecimal representation with fixed length.\\n */\\n function toHexString(uint256 value, uint256 length) internal pure returns (string memory) {\\n bytes memory buffer = new bytes(2 * length + 2);\\n buffer[0] = \\\"0\\\";\\n buffer[1] = \\\"x\\\";\\n for (uint256 i = 2 * length + 1; i > 1; --i) {\\n buffer[i] = _HEX_SYMBOLS[value & 0xf];\\n value >>= 4;\\n }\\n require(value == 0, \\\"Strings: hex length insufficient\\\");\\n return string(buffer);\\n }\\n}\\n\",\"keccak256\":\"0x32c202bd28995dd20c4347b7c6467a6d3241c74c8ad3edcbb610cd9205916c45\",\"license\":\"MIT\"},\"@openzeppelin/contracts/utils/cryptography/ECDSA.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.5.0) (utils/cryptography/ECDSA.sol)\\n\\npragma solidity ^0.8.0;\\n\\nimport \\\"../Strings.sol\\\";\\n\\n/**\\n * @dev Elliptic Curve Digital Signature Algorithm (ECDSA) operations.\\n *\\n * These functions can be used to verify that a message was signed by the holder\\n * of the private keys of a given address.\\n */\\nlibrary ECDSA {\\n enum RecoverError {\\n NoError,\\n InvalidSignature,\\n InvalidSignatureLength,\\n InvalidSignatureS,\\n InvalidSignatureV\\n }\\n\\n function _throwError(RecoverError error) private pure {\\n if (error == RecoverError.NoError) {\\n return; // no error: do nothing\\n } else if (error == RecoverError.InvalidSignature) {\\n revert(\\\"ECDSA: invalid signature\\\");\\n } else if (error == RecoverError.InvalidSignatureLength) {\\n revert(\\\"ECDSA: invalid signature length\\\");\\n } else if (error == RecoverError.InvalidSignatureS) {\\n revert(\\\"ECDSA: invalid signature 's' value\\\");\\n } else if (error == RecoverError.InvalidSignatureV) {\\n revert(\\\"ECDSA: invalid signature 'v' value\\\");\\n }\\n }\\n\\n /**\\n * @dev Returns the address that signed a hashed message (`hash`) with\\n * `signature` or error string. This address can then be used for verification purposes.\\n *\\n * The `ecrecover` EVM opcode allows for malleable (non-unique) signatures:\\n * this function rejects them by requiring the `s` value to be in the lower\\n * half order, and the `v` value to be either 27 or 28.\\n *\\n * IMPORTANT: `hash` _must_ be the result of a hash operation for the\\n * verification to be secure: it is possible to craft signatures that\\n * recover to arbitrary addresses for non-hashed data. A safe way to ensure\\n * this is by receiving a hash of the original message (which may otherwise\\n * be too long), and then calling {toEthSignedMessageHash} on it.\\n *\\n * Documentation for signature generation:\\n * - with https://web3js.readthedocs.io/en/v1.3.4/web3-eth-accounts.html#sign[Web3.js]\\n * - with https://docs.ethers.io/v5/api/signer/#Signer-signMessage[ethers]\\n *\\n * _Available since v4.3._\\n */\\n function tryRecover(bytes32 hash, bytes memory signature) internal pure returns (address, RecoverError) {\\n // Check the signature length\\n // - case 65: r,s,v signature (standard)\\n // - case 64: r,vs signature (cf https://eips.ethereum.org/EIPS/eip-2098) _Available since v4.1._\\n if (signature.length == 65) {\\n bytes32 r;\\n bytes32 s;\\n uint8 v;\\n // ecrecover takes the signature parameters, and the only way to get them\\n // currently is to use assembly.\\n assembly {\\n r := mload(add(signature, 0x20))\\n s := mload(add(signature, 0x40))\\n v := byte(0, mload(add(signature, 0x60)))\\n }\\n return tryRecover(hash, v, r, s);\\n } else if (signature.length == 64) {\\n bytes32 r;\\n bytes32 vs;\\n // ecrecover takes the signature parameters, and the only way to get them\\n // currently is to use assembly.\\n assembly {\\n r := mload(add(signature, 0x20))\\n vs := mload(add(signature, 0x40))\\n }\\n return tryRecover(hash, r, vs);\\n } else {\\n return (address(0), RecoverError.InvalidSignatureLength);\\n }\\n }\\n\\n /**\\n * @dev Returns the address that signed a hashed message (`hash`) with\\n * `signature`. This address can then be used for verification purposes.\\n *\\n * The `ecrecover` EVM opcode allows for malleable (non-unique) signatures:\\n * this function rejects them by requiring the `s` value to be in the lower\\n * half order, and the `v` value to be either 27 or 28.\\n *\\n * IMPORTANT: `hash` _must_ be the result of a hash operation for the\\n * verification to be secure: it is possible to craft signatures that\\n * recover to arbitrary addresses for non-hashed data. A safe way to ensure\\n * this is by receiving a hash of the original message (which may otherwise\\n * be too long), and then calling {toEthSignedMessageHash} on it.\\n */\\n function recover(bytes32 hash, bytes memory signature) internal pure returns (address) {\\n (address recovered, RecoverError error) = tryRecover(hash, signature);\\n _throwError(error);\\n return recovered;\\n }\\n\\n /**\\n * @dev Overload of {ECDSA-tryRecover} that receives the `r` and `vs` short-signature fields separately.\\n *\\n * See https://eips.ethereum.org/EIPS/eip-2098[EIP-2098 short signatures]\\n *\\n * _Available since v4.3._\\n */\\n function tryRecover(\\n bytes32 hash,\\n bytes32 r,\\n bytes32 vs\\n ) internal pure returns (address, RecoverError) {\\n bytes32 s = vs & bytes32(0x7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff);\\n uint8 v = uint8((uint256(vs) >> 255) + 27);\\n return tryRecover(hash, v, r, s);\\n }\\n\\n /**\\n * @dev Overload of {ECDSA-recover} that receives the `r and `vs` short-signature fields separately.\\n *\\n * _Available since v4.2._\\n */\\n function recover(\\n bytes32 hash,\\n bytes32 r,\\n bytes32 vs\\n ) internal pure returns (address) {\\n (address recovered, RecoverError error) = tryRecover(hash, r, vs);\\n _throwError(error);\\n return recovered;\\n }\\n\\n /**\\n * @dev Overload of {ECDSA-tryRecover} that receives the `v`,\\n * `r` and `s` signature fields separately.\\n *\\n * _Available since v4.3._\\n */\\n function tryRecover(\\n bytes32 hash,\\n uint8 v,\\n bytes32 r,\\n bytes32 s\\n ) internal pure returns (address, RecoverError) {\\n // EIP-2 still allows signature malleability for ecrecover(). Remove this possibility and make the signature\\n // unique. Appendix F in the Ethereum Yellow paper (https://ethereum.github.io/yellowpaper/paper.pdf), defines\\n // the valid range for s in (301): 0 < s < secp256k1n \\u00f7 2 + 1, and for v in (302): v \\u2208 {27, 28}. Most\\n // signatures from current libraries generate a unique signature with an s-value in the lower half order.\\n //\\n // If your library generates malleable signatures, such as s-values in the upper range, calculate a new s-value\\n // with 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFEBAAEDCE6AF48A03BBFD25E8CD0364141 - s1 and flip v from 27 to 28 or\\n // vice versa. If your library also generates signatures with 0/1 for v instead 27/28, add 27 to v to accept\\n // these malleable signatures as well.\\n if (uint256(s) > 0x7FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF5D576E7357A4501DDFE92F46681B20A0) {\\n return (address(0), RecoverError.InvalidSignatureS);\\n }\\n if (v != 27 && v != 28) {\\n return (address(0), RecoverError.InvalidSignatureV);\\n }\\n\\n // If the signature is valid (and not malleable), return the signer address\\n address signer = ecrecover(hash, v, r, s);\\n if (signer == address(0)) {\\n return (address(0), RecoverError.InvalidSignature);\\n }\\n\\n return (signer, RecoverError.NoError);\\n }\\n\\n /**\\n * @dev Overload of {ECDSA-recover} that receives the `v`,\\n * `r` and `s` signature fields separately.\\n */\\n function recover(\\n bytes32 hash,\\n uint8 v,\\n bytes32 r,\\n bytes32 s\\n ) internal pure returns (address) {\\n (address recovered, RecoverError error) = tryRecover(hash, v, r, s);\\n _throwError(error);\\n return recovered;\\n }\\n\\n /**\\n * @dev Returns an Ethereum Signed Message, created from a `hash`. This\\n * produces hash corresponding to the one signed with the\\n * https://eth.wiki/json-rpc/API#eth_sign[`eth_sign`]\\n * JSON-RPC method as part of EIP-191.\\n *\\n * See {recover}.\\n */\\n function toEthSignedMessageHash(bytes32 hash) internal pure returns (bytes32) {\\n // 32 is the length in bytes of hash,\\n // enforced by the type signature above\\n return keccak256(abi.encodePacked(\\\"\\\\x19Ethereum Signed Message:\\\\n32\\\", hash));\\n }\\n\\n /**\\n * @dev Returns an Ethereum Signed Message, created from `s`. This\\n * produces hash corresponding to the one signed with the\\n * https://eth.wiki/json-rpc/API#eth_sign[`eth_sign`]\\n * JSON-RPC method as part of EIP-191.\\n *\\n * See {recover}.\\n */\\n function toEthSignedMessageHash(bytes memory s) internal pure returns (bytes32) {\\n return keccak256(abi.encodePacked(\\\"\\\\x19Ethereum Signed Message:\\\\n\\\", Strings.toString(s.length), s));\\n }\\n\\n /**\\n * @dev Returns an Ethereum Signed Typed Data, created from a\\n * `domainSeparator` and a `structHash`. This produces hash corresponding\\n * to the one signed with the\\n * https://eips.ethereum.org/EIPS/eip-712[`eth_signTypedData`]\\n * JSON-RPC method as part of EIP-712.\\n *\\n * See {recover}.\\n */\\n function toTypedDataHash(bytes32 domainSeparator, bytes32 structHash) internal pure returns (bytes32) {\\n return keccak256(abi.encodePacked(\\\"\\\\x19\\\\x01\\\", domainSeparator, structHash));\\n }\\n}\\n\",\"keccak256\":\"0x3c07f43e60e099b3b157243b3152722e73b80eeb7985c2cd73712828d7f7da29\",\"license\":\"MIT\"},\"@openzeppelin/contracts/utils/cryptography/MerkleProof.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.5.0) (utils/cryptography/MerkleProof.sol)\\n\\npragma solidity ^0.8.0;\\n\\n/**\\n * @dev These functions deal with verification of Merkle Trees proofs.\\n *\\n * The proofs can be generated using the JavaScript library\\n * https://github.com/miguelmota/merkletreejs[merkletreejs].\\n * Note: the hashing algorithm should be keccak256 and pair sorting should be enabled.\\n *\\n * See `test/utils/cryptography/MerkleProof.test.js` for some examples.\\n */\\nlibrary MerkleProof {\\n /**\\n * @dev Returns true if a `leaf` can be proved to be a part of a Merkle tree\\n * defined by `root`. For this, a `proof` must be provided, containing\\n * sibling hashes on the branch from the leaf to the root of the tree. Each\\n * pair of leaves and each pair of pre-images are assumed to be sorted.\\n */\\n function verify(\\n bytes32[] memory proof,\\n bytes32 root,\\n bytes32 leaf\\n ) internal pure returns (bool) {\\n return processProof(proof, leaf) == root;\\n }\\n\\n /**\\n * @dev Returns the rebuilt hash obtained by traversing a Merklee tree up\\n * from `leaf` using `proof`. A `proof` is valid if and only if the rebuilt\\n * hash matches the root of the tree. When processing the proof, the pairs\\n * of leafs & pre-images are assumed to be sorted.\\n *\\n * _Available since v4.4._\\n */\\n function processProof(bytes32[] memory proof, bytes32 leaf) internal pure returns (bytes32) {\\n bytes32 computedHash = leaf;\\n for (uint256 i = 0; i < proof.length; i++) {\\n bytes32 proofElement = proof[i];\\n if (computedHash <= proofElement) {\\n // Hash(current computed hash + current element of the proof)\\n computedHash = _efficientHash(computedHash, proofElement);\\n } else {\\n // Hash(current element of the proof + current computed hash)\\n computedHash = _efficientHash(proofElement, computedHash);\\n }\\n }\\n return computedHash;\\n }\\n\\n function _efficientHash(bytes32 a, bytes32 b) private pure returns (bytes32 value) {\\n assembly {\\n mstore(0x00, a)\\n mstore(0x20, b)\\n value := keccak256(0x00, 0x40)\\n }\\n }\\n}\\n\",\"keccak256\":\"0xea64fbaccbf9d8c235cf6838240ddcebb97f9fc383660289e9dff32e4fb85f7a\",\"license\":\"MIT\"},\"@uma/core/contracts/common/implementation/MultiCaller.sol\":{\"content\":\"// This contract is taken from Uniswaps'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.\\npragma solidity ^0.8.0;\\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 payable returns (bytes[] memory results) {\\n require(msg.value == 0, \\\"Only multicall with 0 value\\\");\\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\",\"keccak256\":\"0x31f18055b14fd9eeb459c6d6a88d1a60921bf3755031f6db4b709c3e01d078f7\"},\"@uma/core/contracts/common/implementation/Testable.sol\":{\"content\":\"// SPDX-License-Identifier: AGPL-3.0-only\\npragma solidity ^0.8.0;\\n\\nimport \\\"./Timer.sol\\\";\\n\\n/**\\n * @title Base class that provides time overrides, but only if being run in test mode.\\n */\\nabstract contract Testable {\\n // If the contract is being run in production, then `timerAddress` will be the 0x0 address.\\n // Note: this variable should be set on construction and never modified.\\n address public timerAddress;\\n\\n /**\\n * @notice Constructs the Testable contract. Called by child contracts.\\n * @param _timerAddress Contract that stores the current time in a testing environment.\\n * Must be set to 0x0 for production environments that use live time.\\n */\\n constructor(address _timerAddress) {\\n timerAddress = _timerAddress;\\n }\\n\\n /**\\n * @notice Reverts if not running in test mode.\\n */\\n modifier onlyIfTest {\\n require(timerAddress != address(0x0));\\n _;\\n }\\n\\n /**\\n * @notice Sets the current time.\\n * @dev Will revert if not running in test mode.\\n * @param time timestamp to set current Testable time to.\\n */\\n function setCurrentTime(uint256 time) external onlyIfTest {\\n Timer(timerAddress).setCurrentTime(time);\\n }\\n\\n /**\\n * @notice Gets the current time. Will return the last time set in `setCurrentTime` if running in test mode.\\n * Otherwise, it will return the block timestamp.\\n * @return uint for the current Testable timestamp.\\n */\\n function getCurrentTime() public view virtual returns (uint256) {\\n if (timerAddress != address(0x0)) {\\n return Timer(timerAddress).getCurrentTime();\\n } else {\\n return block.timestamp; // solhint-disable-line not-rely-on-time\\n }\\n }\\n}\\n\",\"keccak256\":\"0x0254b45747293bb800373a58d123969adec0428f7be79dc941cab10fcad09918\",\"license\":\"AGPL-3.0-only\"},\"@uma/core/contracts/common/implementation/Timer.sol\":{\"content\":\"// SPDX-License-Identifier: AGPL-3.0-only\\npragma solidity ^0.8.0;\\n\\n/**\\n * @title Universal store of current contract time for testing environments.\\n */\\ncontract Timer {\\n uint256 private currentTime;\\n\\n constructor() {\\n currentTime = block.timestamp; // solhint-disable-line not-rely-on-time\\n }\\n\\n /**\\n * @notice Sets the current time.\\n * @dev Will revert if not running in test mode.\\n * @param time timestamp to set `currentTime` to.\\n */\\n function setCurrentTime(uint256 time) external {\\n currentTime = time;\\n }\\n\\n /**\\n * @notice Gets the currentTime variable set in the Timer.\\n * @return uint256 for the current Testable timestamp.\\n */\\n function getCurrentTime() public view returns (uint256) {\\n return currentTime;\\n }\\n}\\n\",\"keccak256\":\"0x9e0dd7389718bd5d1da910273a6f4cee98ee22bfc0c92bde0f0955c0e23adb5e\",\"license\":\"AGPL-3.0-only\"},\"contracts/HubPoolInterface.sol\":{\"content\":\"// SPDX-License-Identifier: GPL-3.0-only\\npragma solidity ^0.8.0;\\n\\nimport \\\"./interfaces/AdapterInterface.sol\\\";\\n\\nimport \\\"@openzeppelin/contracts/token/ERC20/IERC20.sol\\\";\\n\\n/**\\n * @notice Concise list of functions in HubPool implementation.\\n */\\ninterface HubPoolInterface {\\n // This leaf is meant to be decoded in the HubPool to rebalance tokens between HubPool and SpokePool.\\n struct PoolRebalanceLeaf {\\n // This is used to know which chain to send cross-chain transactions to (and which SpokePool to send to).\\n uint256 chainId;\\n // Total LP fee amount per token in this bundle, encompassing all associated bundled relays.\\n uint256[] bundleLpFees;\\n // This array is grouped with the two above, and it represents the amount to send or request back from the\\n // SpokePool. If positive, the pool will pay the SpokePool. If negative the SpokePool will pay the HubPool.\\n // There can be arbitrarily complex rebalancing rules defined offchain. This number is only nonzero when the\\n // rules indicate that a rebalancing action should occur. When a rebalance does occur, runningBalances should be\\n // set to zero for this token and the netSendAmounts should be set to the previous runningBalances + relays -\\n // deposits in this bundle. If non-zero then it must be set on the SpokePool's RelayerRefundLeaf amountToReturn\\n // as -1 * this value to indicate if funds are being sent from or to the SpokePool.\\n int256[] netSendAmounts;\\n // This is only here to be emitted in an event to track a running unpaid balance between the L2 pool and the L1\\n // pool. A positive number indicates that the HubPool owes the SpokePool funds. A negative number indicates that\\n // the SpokePool owes the HubPool funds. See the comment above for the dynamics of this and netSendAmounts.\\n int256[] runningBalances;\\n // Used by data worker to mark which leaves should relay roots to SpokePools, and to otherwise organize leaves.\\n // For example, each leaf should contain all the rebalance information for a single chain, but in the case where\\n // the list of l1Tokens is very large such that they all can't fit into a single leaf that can be executed under\\n // the block gas limit, then the data worker can use this groupIndex to organize them. Any leaves with\\n // a groupIndex equal to 0 will relay roots to the SpokePool, so the data worker should ensure that only one\\n // leaf for a specific chainId should have a groupIndex equal to 0.\\n uint256 groupIndex;\\n // Used as the index in the bitmap to track whether this leaf has been executed or not.\\n uint8 leafId;\\n // The following arrays are required to be the same length. They are parallel arrays for the given chainId and\\n // should be ordered by the l1Tokens field. All whitelisted tokens with nonzero relays on this chain in this\\n // bundle in the order of whitelisting.\\n address[] l1Tokens;\\n }\\n\\n // A data worker can optimistically store several merkle roots on this contract by staking a bond and calling\\n // proposeRootBundle. By staking a bond, the data worker is alleging that the merkle roots all contain valid leaves\\n // that can be executed later to:\\n // - Send funds from this contract to a SpokePool or vice versa\\n // - Send funds from a SpokePool to Relayer as a refund for a relayed deposit\\n // - Send funds from a SpokePool to a deposit recipient to fulfill a \\\"slow\\\" relay\\n // Anyone can dispute this struct if the merkle roots contain invalid leaves before the\\n // requestExpirationTimestamp. Once the expiration timestamp is passed, executeRootBundle to execute a leaf\\n // from the poolRebalanceRoot on this contract and it will simultaneously publish the relayerRefundRoot and\\n // slowRelayRoot to a SpokePool. The latter two roots, once published to the SpokePool, contain\\n // leaves that can be executed on the SpokePool to pay relayers or recipients.\\n struct RootBundle {\\n // Contains leaves instructing this contract to send funds to SpokePools.\\n bytes32 poolRebalanceRoot;\\n // Relayer refund merkle root to be published to a SpokePool.\\n bytes32 relayerRefundRoot;\\n // Slow relay merkle root to be published to a SpokePool.\\n bytes32 slowRelayRoot;\\n // This is a 1D bitmap, with max size of 256 elements, limiting us to 256 chainsIds.\\n uint256 claimedBitMap;\\n // Proposer of this root bundle.\\n address proposer;\\n // Number of pool rebalance leaves to execute in the poolRebalanceRoot. After this number\\n // of leaves are executed, a new root bundle can be proposed\\n uint8 unclaimedPoolRebalanceLeafCount;\\n // When root bundle challenge period passes and this root bundle becomes executable.\\n uint32 requestExpirationTimestamp;\\n }\\n\\n // Each whitelisted L1 token has an associated pooledToken struct that contains all information used to track the\\n // cumulative LP positions and if this token is enabled for deposits.\\n struct PooledToken {\\n // LP token given to LPs of a specific L1 token.\\n address lpToken;\\n // True if accepting new LP's.\\n bool isEnabled;\\n // Timestamp of last LP fee update.\\n uint32 lastLpFeeUpdate;\\n // Number of LP funds sent via pool rebalances to SpokePools and are expected to be sent\\n // back later.\\n int256 utilizedReserves;\\n // Number of LP funds held in contract less utilized reserves.\\n uint256 liquidReserves;\\n // Number of LP funds reserved to pay out to LPs as fees.\\n uint256 undistributedLpFees;\\n }\\n\\n // Helper contracts to facilitate cross chain actions between HubPool and SpokePool for a specific network.\\n struct CrossChainContract {\\n address adapter;\\n address spokePool;\\n }\\n\\n function setPaused(bool pause) external;\\n\\n function emergencyDeleteProposal() external;\\n\\n function relaySpokePoolAdminFunction(uint256 chainId, bytes memory functionData) external;\\n\\n function setProtocolFeeCapture(address newProtocolFeeCaptureAddress, uint256 newProtocolFeeCapturePct) external;\\n\\n function setBond(IERC20 newBondToken, uint256 newBondAmount) external;\\n\\n function setLiveness(uint32 newLiveness) external;\\n\\n function setIdentifier(bytes32 newIdentifier) external;\\n\\n function setCrossChainContracts(\\n uint256 l2ChainId,\\n address adapter,\\n address spokePool\\n ) external;\\n\\n function enableL1TokenForLiquidityProvision(address l1Token) external;\\n\\n function disableL1TokenForLiquidityProvision(address l1Token) external;\\n\\n function addLiquidity(address l1Token, uint256 l1TokenAmount) external payable;\\n\\n function removeLiquidity(\\n address l1Token,\\n uint256 lpTokenAmount,\\n bool sendEth\\n ) external;\\n\\n function exchangeRateCurrent(address l1Token) external returns (uint256);\\n\\n function liquidityUtilizationCurrent(address l1Token) external returns (uint256);\\n\\n function liquidityUtilizationPostRelay(address token, uint256 relayedAmount) external returns (uint256);\\n\\n function sync(address l1Token) external;\\n\\n function proposeRootBundle(\\n uint256[] memory bundleEvaluationBlockNumbers,\\n uint8 poolRebalanceLeafCount,\\n bytes32 poolRebalanceRoot,\\n bytes32 relayerRefundRoot,\\n bytes32 slowRelayRoot\\n ) external;\\n\\n function executeRootBundle(\\n uint256 chainId,\\n uint256 groupIndex,\\n uint256[] memory bundleLpFees,\\n int256[] memory netSendAmounts,\\n int256[] memory runningBalances,\\n uint8 leafId,\\n address[] memory l1Tokens,\\n bytes32[] memory proof\\n ) external;\\n\\n function disputeRootBundle() external;\\n\\n function claimProtocolFeesCaptured(address l1Token) external;\\n\\n function setPoolRebalanceRoute(\\n uint256 destinationChainId,\\n address l1Token,\\n address destinationToken\\n ) external;\\n\\n function setDepositRoute(\\n uint256 originChainId,\\n uint256 destinationChainId,\\n address originToken,\\n bool depositsEnabled\\n ) external;\\n\\n function poolRebalanceRoute(uint256 destinationChainId, address l1Token)\\n external\\n view\\n returns (address destinationToken);\\n\\n function loadEthForL2Calls() external payable;\\n}\\n\",\"keccak256\":\"0x71b427ffd4a1e8c0cc681bafe050c536d79464f12559e90172681e6745f2e7bc\",\"license\":\"GPL-3.0-only\"},\"contracts/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 * @dev The reason why we use this local contract instead of importing from uma/contracts is because of the addition\\n * of the internal method `functionCallStackOriginatesFromOutsideThisContract` which doesn't exist in the one exported\\n * by uma/contracts.\\n */\\ncontract Lockable {\\n bool internal _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 /**\\n * @dev Returns true if the contract is currently in a non-entered state, meaning that the origination of the call\\n * came from outside the contract. This is relevant with fallback/receive methods to see if the call came from ETH\\n * being dropped onto the contract externally or due to ETH dropped on the the contract from within a method in this\\n * contract, such as unwrapping WETH to ETH within the contract.\\n */\\n function functionCallStackOriginatesFromOutsideThisContract() internal view returns (bool) {\\n return _notEntered;\\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\",\"keccak256\":\"0xef490be5cb859c97c6f600f3b0db0d50c6e18f334d3c74c6d9e693a260eaec3e\",\"license\":\"AGPL-3.0-only\"},\"contracts/MerkleLib.sol\":{\"content\":\"// SPDX-License-Identifier: GPL-3.0-only\\npragma solidity ^0.8.0;\\n\\nimport \\\"./SpokePoolInterface.sol\\\";\\nimport \\\"./HubPoolInterface.sol\\\";\\n\\nimport \\\"@openzeppelin/contracts/utils/cryptography/MerkleProof.sol\\\";\\n\\n/**\\n * @notice Library to help with merkle roots, proofs, and claims.\\n */\\nlibrary MerkleLib {\\n /**\\n * @notice Verifies that a repayment is contained within a merkle root.\\n * @param root the merkle root.\\n * @param rebalance the rebalance struct.\\n * @param proof the merkle proof.\\n * @return bool to signal if the pool rebalance proof correctly shows inclusion of the rebalance within the tree.\\n */\\n function verifyPoolRebalance(\\n bytes32 root,\\n HubPoolInterface.PoolRebalanceLeaf memory rebalance,\\n bytes32[] memory proof\\n ) internal pure returns (bool) {\\n return MerkleProof.verify(proof, root, keccak256(abi.encode(rebalance)));\\n }\\n\\n /**\\n * @notice Verifies that a relayer refund is contained within a merkle root.\\n * @param root the merkle root.\\n * @param refund the refund struct.\\n * @param proof the merkle proof.\\n * @return bool to signal if the relayer refund proof correctly shows inclusion of the refund within the tree.\\n */\\n function verifyRelayerRefund(\\n bytes32 root,\\n SpokePoolInterface.RelayerRefundLeaf memory refund,\\n bytes32[] memory proof\\n ) internal pure returns (bool) {\\n return MerkleProof.verify(proof, root, keccak256(abi.encode(refund)));\\n }\\n\\n /**\\n * @notice Verifies that a distribution is contained within a merkle root.\\n * @param root the merkle root.\\n * @param slowRelayFulfillment the relayData fulfillment struct.\\n * @param proof the merkle proof.\\n * @return bool to signal if the slow relay's proof correctly shows inclusion of the slow relay within the tree.\\n */\\n function verifySlowRelayFulfillment(\\n bytes32 root,\\n SpokePoolInterface.RelayData memory slowRelayFulfillment,\\n bytes32[] memory proof\\n ) internal pure returns (bool) {\\n return MerkleProof.verify(proof, root, keccak256(abi.encode(slowRelayFulfillment)));\\n }\\n\\n // The following functions are primarily copied from\\n // https://github.com/Uniswap/merkle-distributor/blob/master/contracts/MerkleDistributor.sol with minor changes.\\n\\n /**\\n * @notice Tests whether a claim is contained within a claimedBitMap mapping.\\n * @param claimedBitMap a simple uint256 mapping in storage used as a bitmap.\\n * @param index the index to check in the bitmap.\\n * @return bool indicating if the index within the claimedBitMap has been marked as claimed.\\n */\\n function isClaimed(mapping(uint256 => uint256) storage claimedBitMap, uint256 index) internal view returns (bool) {\\n uint256 claimedWordIndex = index / 256;\\n uint256 claimedBitIndex = index % 256;\\n uint256 claimedWord = claimedBitMap[claimedWordIndex];\\n uint256 mask = (1 << claimedBitIndex);\\n return claimedWord & mask == mask;\\n }\\n\\n /**\\n * @notice Marks an index in a claimedBitMap as claimed.\\n * @param claimedBitMap a simple uint256 mapping in storage used as a bitmap.\\n * @param index the index to mark in the bitmap.\\n */\\n function setClaimed(mapping(uint256 => uint256) storage claimedBitMap, uint256 index) internal {\\n uint256 claimedWordIndex = index / 256;\\n uint256 claimedBitIndex = index % 256;\\n claimedBitMap[claimedWordIndex] = claimedBitMap[claimedWordIndex] | (1 << claimedBitIndex);\\n }\\n\\n /**\\n * @notice Tests whether a claim is contained within a 1D claimedBitMap mapping.\\n * @param claimedBitMap a simple uint256 value, encoding a 1D bitmap.\\n * @param index the index to check in the bitmap. Uint8 type enforces that index can't be > 255.\\n * @return bool indicating if the index within the claimedBitMap has been marked as claimed.\\n */\\n function isClaimed1D(uint256 claimedBitMap, uint8 index) internal pure returns (bool) {\\n uint256 mask = (1 << index);\\n return claimedBitMap & mask == mask;\\n }\\n\\n /**\\n * @notice Marks an index in a claimedBitMap as claimed.\\n * @param claimedBitMap a simple uint256 mapping in storage used as a bitmap. Uint8 type enforces that index\\n * can't be > 255.\\n * @param index the index to mark in the bitmap.\\n * @return uint256 representing the modified input claimedBitMap with the index set to true.\\n */\\n function setClaimed1D(uint256 claimedBitMap, uint8 index) internal pure returns (uint256) {\\n return claimedBitMap | (1 << index % 256);\\n }\\n}\\n\",\"keccak256\":\"0x5b49211d8b8e5a2792d08adb818fddc2ad8abaef45822f91ca678ceb7ea018ea\",\"license\":\"GPL-3.0-only\"},\"contracts/Optimism_SpokePool.sol\":{\"content\":\"// SPDX-License-Identifier: GPL-3.0-only\\npragma solidity ^0.8.0;\\n\\nimport \\\"./SpokePool.sol\\\";\\nimport \\\"./interfaces/WETH9.sol\\\";\\n\\nimport \\\"@eth-optimism/contracts/libraries/bridge/CrossDomainEnabled.sol\\\";\\nimport \\\"@eth-optimism/contracts/libraries/constants/Lib_PredeployAddresses.sol\\\";\\nimport \\\"@eth-optimism/contracts/L2/messaging/IL2ERC20Bridge.sol\\\";\\n\\n/**\\n * @notice OVM specific SpokePool. Uses OVM cross-domain-enabled logic to implement admin only access to functions.\\n */\\ncontract Optimism_SpokePool is CrossDomainEnabled, SpokePool {\\n // \\\"l1Gas\\\" parameter used in call to bridge tokens from this contract back to L1 via IL2ERC20Bridge. Currently\\n // unused by bridge but included for future compatibility.\\n uint32 public l1Gas = 5_000_000;\\n\\n // ETH is an ERC20 on OVM.\\n address public immutable l2Eth = address(Lib_PredeployAddresses.OVM_ETH);\\n\\n // Stores alternative token bridges to use for L2 tokens that don't go over the standard bridge. This is needed\\n // to support non-standard ERC20 tokens on Optimism, such as DIA and SNX which both use custom bridges.\\n mapping(address => address) public tokenBridges;\\n\\n event OptimismTokensBridged(address indexed l2Token, address target, uint256 numberOfTokensBridged, uint256 l1Gas);\\n event SetL1Gas(uint32 indexed newL1Gas);\\n event SetL2TokenBridge(address indexed l2Token, address indexed tokenBridge);\\n\\n /**\\n * @notice Construct the OVM SpokePool.\\n * @param _crossDomainAdmin Cross domain admin to set. Can be changed by admin.\\n * @param _hubPool Hub pool address to set. Can be changed by admin.\\n * @param timerAddress Timer address to set.\\n */\\n constructor(\\n address _crossDomainAdmin,\\n address _hubPool,\\n address timerAddress\\n )\\n CrossDomainEnabled(Lib_PredeployAddresses.L2_CROSS_DOMAIN_MESSENGER)\\n SpokePool(_crossDomainAdmin, _hubPool, 0x4200000000000000000000000000000000000006, timerAddress)\\n {}\\n\\n /*******************************************\\n * OPTIMISM-SPECIFIC ADMIN FUNCTIONS *\\n *******************************************/\\n\\n /**\\n * @notice Change L1 gas limit. Callable only by admin.\\n * @param newl1Gas New L1 gas limit to set.\\n */\\n function setL1GasLimit(uint32 newl1Gas) public onlyAdmin nonReentrant {\\n l1Gas = newl1Gas;\\n emit SetL1Gas(newl1Gas);\\n }\\n\\n /**\\n * @notice Set bridge contract for L2 token used to withdraw back to L1.\\n * @dev If this mapping isn't set for an L2 token, then the standard bridge will be used to bridge this token.\\n * @param tokenBridge Address of token bridge\\n */\\n function setTokenBridge(address l2Token, address tokenBridge) public onlyAdmin nonReentrant {\\n tokenBridges[l2Token] = tokenBridge;\\n emit SetL2TokenBridge(l2Token, tokenBridge);\\n }\\n\\n /**************************************\\n * DATA WORKER FUNCTIONS *\\n **************************************/\\n\\n /**\\n * @notice Wraps any ETH into WETH before executing base function. This is necessary because SpokePool receives\\n * ETH over the canonical token bridge instead of WETH.\\n * @inheritdoc SpokePool\\n */\\n function executeSlowRelayRoot(\\n address depositor,\\n address recipient,\\n address destinationToken,\\n uint256 totalRelayAmount,\\n uint256 originChainId,\\n uint64 realizedLpFeePct,\\n uint64 relayerFeePct,\\n uint32 depositId,\\n uint32 rootBundleId,\\n bytes32[] memory proof\\n ) public override(SpokePool) nonReentrant {\\n if (destinationToken == address(weth)) _depositEthToWeth();\\n\\n _executeSlowRelayRoot(\\n depositor,\\n recipient,\\n destinationToken,\\n totalRelayAmount,\\n originChainId,\\n chainId(),\\n realizedLpFeePct,\\n relayerFeePct,\\n depositId,\\n rootBundleId,\\n proof\\n );\\n }\\n\\n /**\\n * @notice Wraps any ETH into WETH before executing base function. This is necessary because SpokePool receives\\n * ETH over the canonical token bridge instead of WETH.\\n * @inheritdoc SpokePool\\n */\\n function executeRelayerRefundRoot(\\n uint32 rootBundleId,\\n SpokePoolInterface.RelayerRefundLeaf memory relayerRefundLeaf,\\n bytes32[] memory proof\\n ) public override(SpokePool) nonReentrant {\\n if (relayerRefundLeaf.l2TokenAddress == address(weth)) _depositEthToWeth();\\n\\n _executeRelayerRefundRoot(rootBundleId, relayerRefundLeaf, proof);\\n }\\n\\n /**************************************\\n * INTERNAL FUNCTIONS *\\n **************************************/\\n\\n // Wrap any ETH owned by this contract so we can send expected L2 token to recipient. This is necessary because\\n // this SpokePool will receive ETH from the canonical token bridge instead of WETH. Its not sufficient to execute\\n // this logic inside a fallback method that executes when this contract receives ETH because ETH is an ERC20\\n // on the OVM.\\n function _depositEthToWeth() internal {\\n if (address(this).balance > 0) weth.deposit{ value: address(this).balance }();\\n }\\n\\n function _bridgeTokensToHubPool(RelayerRefundLeaf memory relayerRefundLeaf) internal override {\\n // If the token being bridged is WETH then we need to first unwrap it to ETH and then send ETH over the\\n // canonical bridge. On Optimism, this is address 0xDeadDeAddeAddEAddeadDEaDDEAdDeaDDeAD0000.\\n if (relayerRefundLeaf.l2TokenAddress == address(weth)) {\\n WETH9(relayerRefundLeaf.l2TokenAddress).withdraw(relayerRefundLeaf.amountToReturn); // Unwrap into ETH.\\n relayerRefundLeaf.l2TokenAddress = l2Eth; // Set the l2TokenAddress to ETH.\\n }\\n IL2ERC20Bridge(\\n tokenBridges[relayerRefundLeaf.l2TokenAddress] == address(0)\\n ? Lib_PredeployAddresses.L2_STANDARD_BRIDGE\\n : tokenBridges[relayerRefundLeaf.l2TokenAddress]\\n ).withdrawTo(\\n relayerRefundLeaf.l2TokenAddress, // _l2Token. Address of the L2 token to bridge over.\\n hubPool, // _to. Withdraw, over the bridge, to the l1 pool contract.\\n relayerRefundLeaf.amountToReturn, // _amount.\\n l1Gas, // _l1Gas. Unused, but included for potential forward compatibility considerations\\n \\\"\\\" // _data. We don't need to send any data for the bridging action.\\n );\\n\\n emit OptimismTokensBridged(relayerRefundLeaf.l2TokenAddress, hubPool, relayerRefundLeaf.amountToReturn, l1Gas);\\n }\\n\\n // Apply OVM-specific transformation to cross domain admin address on L1.\\n function _requireAdminSender() internal override onlyFromCrossDomainAccount(crossDomainAdmin) {}\\n}\\n\",\"keccak256\":\"0xc3a5671b939647b8b12ad12d5e77e6a20d5713147146bb5d197a56d254ca1b3d\",\"license\":\"GPL-3.0-only\"},\"contracts/SpokePool.sol\":{\"content\":\"// SPDX-License-Identifier: GPL-3.0-only\\npragma solidity ^0.8.0;\\n\\nimport \\\"./MerkleLib.sol\\\";\\nimport \\\"./interfaces/WETH9.sol\\\";\\nimport \\\"./Lockable.sol\\\";\\nimport \\\"./SpokePoolInterface.sol\\\";\\n\\nimport \\\"@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol\\\";\\nimport \\\"@openzeppelin/contracts/token/ERC20/IERC20.sol\\\";\\nimport \\\"@openzeppelin/contracts/utils/Address.sol\\\";\\n\\nimport \\\"@openzeppelin/contracts/utils/cryptography/ECDSA.sol\\\";\\nimport \\\"@uma/core/contracts/common/implementation/Testable.sol\\\";\\nimport \\\"@uma/core/contracts/common/implementation/MultiCaller.sol\\\";\\n\\n/**\\n * @title SpokePool\\n * @notice Base contract deployed on source and destination chains enabling depositors to transfer assets from source to\\n * destination. Deposit orders are fulfilled by off-chain relayers who also interact with this contract. Deposited\\n * tokens are locked on the source chain and relayers send the recipient the desired token currency and amount\\n * on the destination chain. Locked source chain tokens are later sent over the canonical token bridge to L1 HubPool.\\n * Relayers are refunded with destination tokens out of this contract after another off-chain actor, a \\\"data worker\\\",\\n * submits a proof that the relayer correctly submitted a relay on this SpokePool.\\n */\\nabstract contract SpokePool is SpokePoolInterface, Testable, Lockable, MultiCaller {\\n using SafeERC20 for IERC20;\\n using Address for address;\\n\\n // Address of the L1 contract that acts as the owner of this SpokePool. If this contract is deployed on Ethereum,\\n // then this address should be set to the same owner as the HubPool and the whole system.\\n address public crossDomainAdmin;\\n\\n // Address of the L1 contract that will send tokens to and receive tokens from this contract to fund relayer\\n // refunds and slow relays.\\n address public hubPool;\\n\\n // Address of WETH contract for this network. If an origin token matches this, then the caller can optionally\\n // instruct this contract to wrap ETH when depositing.\\n WETH9 public immutable weth;\\n\\n // Any deposit quote times greater than or less than this value to the current contract time is blocked. Forces\\n // caller to use an approximately \\\"current\\\" realized fee. Defaults to 10 minutes.\\n uint32 public depositQuoteTimeBuffer = 600;\\n\\n // Count of deposits is used to construct a unique deposit identifier for this spoke pool.\\n uint32 public numberOfDeposits;\\n\\n // Origin token to destination token routings can be turned on or off, which can enable or disable deposits.\\n\\n mapping(address => mapping(uint256 => bool)) public enabledDepositRoutes;\\n\\n // This contract can store as many root bundles as the HubPool chooses to publish here.\\n RootBundle[] public rootBundles;\\n\\n // Each relay is associated with the hash of parameters that uniquely identify the original deposit and a relay\\n // attempt for that deposit. The relay itself is just represented as the amount filled so far. The total amount to\\n // relay, the fees, and the agents are all parameters included in the hash key.\\n mapping(bytes32 => uint256) public relayFills;\\n\\n /****************************************\\n * EVENTS *\\n ****************************************/\\n event SetXDomainAdmin(address indexed newAdmin);\\n event SetHubPool(address indexed newHubPool);\\n event EnabledDepositRoute(address indexed originToken, uint256 indexed destinationChainId, bool enabled);\\n event SetDepositQuoteTimeBuffer(uint32 newBuffer);\\n event FundsDeposited(\\n uint256 amount,\\n uint256 originChainId,\\n uint256 destinationChainId,\\n uint64 relayerFeePct,\\n uint32 indexed depositId,\\n uint32 quoteTimestamp,\\n address indexed originToken,\\n address recipient,\\n address indexed depositor\\n );\\n event RequestedSpeedUpDeposit(\\n uint64 newRelayerFeePct,\\n uint32 indexed depositId,\\n address indexed depositor,\\n bytes depositorSignature\\n );\\n event FilledRelay(\\n bytes32 indexed relayHash,\\n uint256 amount,\\n uint256 totalFilledAmount,\\n uint256 fillAmount,\\n uint256 repaymentChainId,\\n uint256 originChainId,\\n uint256 destinationChainId,\\n uint64 relayerFeePct,\\n uint64 realizedLpFeePct,\\n uint32 depositId,\\n address destinationToken,\\n address indexed relayer,\\n address indexed depositor,\\n address recipient,\\n bool isSlowRelay\\n );\\n event RelayedRootBundle(uint32 indexed rootBundleId, bytes32 relayerRefundRoot, bytes32 slowRelayRoot);\\n event ExecutedRelayerRefundRoot(\\n uint256 amountToReturn,\\n uint256 indexed chainId,\\n uint256[] refundAmounts,\\n uint32 indexed rootBundleId,\\n uint32 indexed leafId,\\n address l2TokenAddress,\\n address[] refundAddresses,\\n address caller\\n );\\n event TokensBridged(\\n uint256 amountToReturn,\\n uint256 indexed chainId,\\n uint32 indexed leafId,\\n address indexed l2TokenAddress,\\n address caller\\n );\\n event EmergencyDeleteRootBundle(uint256 indexed rootBundleId);\\n\\n /**\\n * @notice Construct the base SpokePool.\\n * @param _crossDomainAdmin Cross domain admin to set. Can be changed by admin.\\n * @param _hubPool Hub pool address to set. Can be changed by admin.\\n * @param _wethAddress Weth address for this network to set.\\n * @param timerAddress Timer address to set.\\n */\\n constructor(\\n address _crossDomainAdmin,\\n address _hubPool,\\n address _wethAddress,\\n address timerAddress\\n ) Testable(timerAddress) {\\n _setCrossDomainAdmin(_crossDomainAdmin);\\n _setHubPool(_hubPool);\\n weth = WETH9(_wethAddress);\\n }\\n\\n /****************************************\\n * MODIFIERS *\\n ****************************************/\\n\\n // Implementing contract needs to override _requireAdminSender() to ensure that admin functions are protected\\n // appropriately.\\n modifier onlyAdmin() {\\n _requireAdminSender();\\n _;\\n }\\n\\n /**************************************\\n * ADMIN FUNCTIONS *\\n **************************************/\\n\\n /**\\n * @notice Change cross domain admin address. Callable by admin only.\\n * @param newCrossDomainAdmin New cross domain admin.\\n */\\n function setCrossDomainAdmin(address newCrossDomainAdmin) public override onlyAdmin nonReentrant {\\n _setCrossDomainAdmin(newCrossDomainAdmin);\\n }\\n\\n /**\\n * @notice Change L1 hub pool address. Callable by admin only.\\n * @param newHubPool New hub pool.\\n */\\n function setHubPool(address newHubPool) public override onlyAdmin nonReentrant {\\n _setHubPool(newHubPool);\\n }\\n\\n /**\\n * @notice Enable/Disable an origin token => destination chain ID route for deposits. Callable by admin only.\\n * @param originToken Token that depositor can deposit to this contract.\\n * @param destinationChainId Chain ID for where depositor wants to receive funds.\\n * @param enabled True to enable deposits, False otherwise.\\n */\\n function setEnableRoute(\\n address originToken,\\n uint256 destinationChainId,\\n bool enabled\\n ) public override onlyAdmin nonReentrant {\\n enabledDepositRoutes[originToken][destinationChainId] = enabled;\\n emit EnabledDepositRoute(originToken, destinationChainId, enabled);\\n }\\n\\n /**\\n * @notice Change allowance for deposit quote time to differ from current block time. Callable by admin only.\\n * @param newDepositQuoteTimeBuffer New quote time buffer.\\n */\\n function setDepositQuoteTimeBuffer(uint32 newDepositQuoteTimeBuffer) public override onlyAdmin nonReentrant {\\n depositQuoteTimeBuffer = newDepositQuoteTimeBuffer;\\n emit SetDepositQuoteTimeBuffer(newDepositQuoteTimeBuffer);\\n }\\n\\n /**\\n * @notice This method stores a new root bundle in this contract that can be executed to refund relayers, fulfill\\n * slow relays, and send funds back to the HubPool on L1. This method can only be called by the admin and is\\n * designed to be called as part of a cross-chain message from the HubPool's executeRootBundle method.\\n * @param relayerRefundRoot Merkle root containing relayer refund leaves that can be individually executed via\\n * executeRelayerRefundRoot().\\n * @param slowRelayRoot Merkle root containing slow relay fulfillment leaves that can be individually executed via\\n * executeSlowRelayRoot().\\n */\\n function relayRootBundle(bytes32 relayerRefundRoot, bytes32 slowRelayRoot) public override onlyAdmin nonReentrant {\\n uint32 rootBundleId = uint32(rootBundles.length);\\n RootBundle storage rootBundle = rootBundles.push();\\n rootBundle.relayerRefundRoot = relayerRefundRoot;\\n rootBundle.slowRelayRoot = slowRelayRoot;\\n emit RelayedRootBundle(rootBundleId, relayerRefundRoot, slowRelayRoot);\\n }\\n\\n /**\\n * @notice This method is intended to only be used in emergencies where a bad root bundle has reached the\\n * SpokePool.\\n * @param rootBundleId Index of the root bundle that needs to be deleted. Note: this is intentionally a uint256\\n * to ensure that a small input range doesn't limit which indices this method is able to reach.\\n */\\n function emergencyDeleteRootBundle(uint256 rootBundleId) public override onlyAdmin nonReentrant {\\n delete rootBundles[rootBundleId];\\n emit EmergencyDeleteRootBundle(rootBundleId);\\n }\\n\\n /**************************************\\n * DEPOSITOR FUNCTIONS *\\n **************************************/\\n\\n /**\\n * @notice Called by user to bridge funds from origin to destination chain. Depositor will effectively lock\\n * tokens in this contract and receive a destination token on the destination chain. The origin => destination\\n * token mapping is stored on the L1 HubPool.\\n * @notice The caller must first approve this contract to spend amount of originToken.\\n * @notice The originToken => destinationChainId must be enabled.\\n * @notice This method is payable because the caller is able to deposit ETH if the originToken is WETH and this\\n * function will handle wrapping ETH.\\n * @param recipient Address to receive funds at on destination chain.\\n * @param originToken Token to lock into this contract to initiate deposit.\\n * @param amount Amount of tokens to deposit. Will be amount of tokens to receive less fees.\\n * @param destinationChainId Denotes network where user will receive funds from SpokePool by a relayer.\\n * @param relayerFeePct % of deposit amount taken out to incentivize a fast relayer.\\n * @param quoteTimestamp Timestamp used by relayers to compute this deposit's realizedLPFeePct which is paid\\n * to LP pool on HubPool.\\n */\\n function deposit(\\n address recipient,\\n address originToken,\\n uint256 amount,\\n uint256 destinationChainId,\\n uint64 relayerFeePct,\\n uint32 quoteTimestamp\\n ) public payable override nonReentrant {\\n // Check that deposit route is enabled.\\n require(enabledDepositRoutes[originToken][destinationChainId], \\\"Disabled route\\\");\\n\\n // We limit the relay fees to prevent the user spending all their funds on fees.\\n require(relayerFeePct < 0.5e18, \\\"invalid relayer fee\\\");\\n // This function assumes that L2 timing cannot be compared accurately and consistently to L1 timing. Therefore,\\n // block.timestamp is different from the L1 EVM's. Therefore, the quoteTimestamp must be within a configurable\\n // buffer of this contract's block time to allow for this variance.\\n // Note also that quoteTimestamp cannot be less than the buffer otherwise the following arithmetic can result\\n // in underflow. This isn't a problem as the deposit will revert, but the error might be unexpected for clients.\\n require(\\n getCurrentTime() >= quoteTimestamp - depositQuoteTimeBuffer &&\\n getCurrentTime() <= quoteTimestamp + depositQuoteTimeBuffer,\\n \\\"invalid quote time\\\"\\n );\\n // If the address of the origin token is a WETH contract and there is a msg.value with the transaction\\n // then the user is sending ETH. In this case, the ETH should be deposited to WETH.\\n if (originToken == address(weth) && msg.value > 0) {\\n require(msg.value == amount, \\\"msg.value must match amount\\\");\\n weth.deposit{ value: msg.value }();\\n // Else, it is a normal ERC20. In this case pull the token from the user's wallet as per normal.\\n // Note: this includes the case where the L2 user has WETH (already wrapped ETH) and wants to bridge them.\\n // In this case the msg.value will be set to 0, indicating a \\\"normal\\\" ERC20 bridging action.\\n } else IERC20(originToken).safeTransferFrom(msg.sender, address(this), amount);\\n\\n _emitDeposit(\\n amount,\\n chainId(),\\n destinationChainId,\\n relayerFeePct,\\n numberOfDeposits,\\n quoteTimestamp,\\n originToken,\\n recipient,\\n msg.sender\\n );\\n\\n // Increment count of deposits so that deposit ID for this spoke pool is unique.\\n numberOfDeposits += 1;\\n }\\n\\n /**\\n * @notice Convenience method that depositor can use to signal to relayer to use updated fee.\\n * @notice Relayer should only use events emitted by this function to submit fills with updated fees, otherwise they\\n * risk their fills getting disputed for being invalid, for example if the depositor never actually signed the\\n * update fee message.\\n * @notice This function will revert if the depositor did not sign a message containing the updated fee for the\\n * deposit ID stored in this contract. If the deposit ID is for another contract, or the depositor address is\\n * incorrect, or the updated fee is incorrect, then the signature will not match and this function will revert.\\n * @param depositor Signer of the update fee message who originally submitted the deposit. If the deposit doesn't\\n * exist, then the relayer will not be able to fill any relay, so the caller should validate that the depositor\\n * did in fact submit a relay.\\n * @param newRelayerFeePct New relayer fee that relayers can use.\\n * @param depositId Deposit to update fee for that originated in this contract.\\n * @param depositorSignature Signed message containing the depositor address, this contract chain ID, the updated\\n * relayer fee %, and the deposit ID. This signature is produced by signing a hash of data according to the\\n * EIP-191 standard. See more in the _verifyUpdateRelayerFeeMessage() comments.\\n */\\n function speedUpDeposit(\\n address depositor,\\n uint64 newRelayerFeePct,\\n uint32 depositId,\\n bytes memory depositorSignature\\n ) public override nonReentrant {\\n require(newRelayerFeePct < 0.5e18, \\\"invalid relayer fee\\\");\\n\\n _verifyUpdateRelayerFeeMessage(depositor, chainId(), newRelayerFeePct, depositId, depositorSignature);\\n\\n // Assuming the above checks passed, a relayer can take the signature and the updated relayer fee information\\n // from the following event to submit a fill with an updated fee %.\\n emit RequestedSpeedUpDeposit(newRelayerFeePct, depositId, depositor, depositorSignature);\\n }\\n\\n /**************************************\\n * RELAYER FUNCTIONS *\\n **************************************/\\n\\n /**\\n * @notice Called by relayer to fulfill part of a deposit by sending destination tokens to the recipient.\\n * Relayer is expected to pass in unique identifying information for deposit that they want to fulfill, and this\\n * relay submission will be validated by off-chain data workers who can dispute this relay if any part is invalid.\\n * If the relay is valid, then the relayer will be refunded on their desired repayment chain. If relay is invalid,\\n * then relayer will not receive any refund.\\n * @notice All of the deposit data can be found via on-chain events from the origin SpokePool, except for the\\n * realizedLpFeePct which is a function of the HubPool's utilization at the deposit quote time. This fee %\\n * is deterministic based on the quote time, so the relayer should just compute it using the canonical algorithm\\n * as described in a UMIP linked to the HubPool's identifier.\\n * @param depositor Depositor on origin chain who set this chain as the destination chain.\\n * @param recipient Specified recipient on this chain.\\n * @param destinationToken Token to send to recipient. Should be mapped to the origin token, origin chain ID\\n * and this chain ID via a mapping on the HubPool.\\n * @param amount Full size of the deposit.\\n * @param maxTokensToSend Max amount of tokens to send recipient. If higher than amount, then caller will\\n * send recipient the full relay amount.\\n * @param repaymentChainId Chain of SpokePool where relayer wants to be refunded after the challenge window has\\n * passed.\\n * @param originChainId Chain of SpokePool where deposit originated.\\n * @param realizedLpFeePct Fee % based on L1 HubPool utilization at deposit quote time. Deterministic based on\\n * quote time.\\n * @param relayerFeePct Fee % to keep as relayer, specified by depositor.\\n * @param depositId Unique deposit ID on origin spoke pool.\\n */\\n function fillRelay(\\n address depositor,\\n address recipient,\\n address destinationToken,\\n uint256 amount,\\n uint256 maxTokensToSend,\\n uint256 repaymentChainId,\\n uint256 originChainId,\\n uint64 realizedLpFeePct,\\n uint64 relayerFeePct,\\n uint32 depositId\\n ) public nonReentrant {\\n // Each relay attempt is mapped to the hash of data uniquely identifying it, which includes the deposit data\\n // such as the origin chain ID and the deposit ID, and the data in a relay attempt such as who the recipient\\n // is, which chain and currency the recipient wants to receive funds on, and the relay fees.\\n SpokePoolInterface.RelayData memory relayData = SpokePoolInterface.RelayData({\\n depositor: depositor,\\n recipient: recipient,\\n destinationToken: destinationToken,\\n amount: amount,\\n realizedLpFeePct: realizedLpFeePct,\\n relayerFeePct: relayerFeePct,\\n depositId: depositId,\\n originChainId: originChainId,\\n destinationChainId: chainId()\\n });\\n bytes32 relayHash = _getRelayHash(relayData);\\n\\n uint256 fillAmountPreFees = _fillRelay(relayHash, relayData, maxTokensToSend, relayerFeePct, false);\\n\\n _emitFillRelay(relayHash, fillAmountPreFees, repaymentChainId, relayerFeePct, relayData, false);\\n }\\n\\n /**\\n * @notice Called by relayer to execute same logic as calling fillRelay except that relayer is using an updated\\n * relayer fee %. The fee % must have been emitted in a message cryptographically signed by the depositor.\\n * @notice By design, the depositor probably emitted the message with the updated fee by calling speedUpRelay().\\n * @param depositor Depositor on origin chain who set this chain as the destination chain.\\n * @param recipient Specified recipient on this chain.\\n * @param destinationToken Token to send to recipient. Should be mapped to the origin token, origin chain ID\\n * and this chain ID via a mapping on the HubPool.\\n * @param amount Full size of the deposit.\\n * @param maxTokensToSend Max amount of tokens to send recipient. If higher than amount, then caller will\\n * send recipient the full relay amount.\\n * @param repaymentChainId Chain of SpokePool where relayer wants to be refunded after the challenge window has\\n * passed.\\n * @param originChainId Chain of SpokePool where deposit originated.\\n * @param realizedLpFeePct Fee % based on L1 HubPool utilization at deposit quote time. Deterministic based on\\n * quote time.\\n * @param relayerFeePct Original fee % to keep as relayer set by depositor.\\n * @param newRelayerFeePct New fee % to keep as relayer also specified by depositor.\\n * @param depositId Unique deposit ID on origin spoke pool.\\n * @param depositorSignature Depositor-signed message containing updated fee %.\\n */\\n function fillRelayWithUpdatedFee(\\n address depositor,\\n address recipient,\\n address destinationToken,\\n uint256 amount,\\n uint256 maxTokensToSend,\\n uint256 repaymentChainId,\\n uint256 originChainId,\\n uint64 realizedLpFeePct,\\n uint64 relayerFeePct,\\n uint64 newRelayerFeePct,\\n uint32 depositId,\\n bytes memory depositorSignature\\n ) public override nonReentrant {\\n _verifyUpdateRelayerFeeMessage(depositor, originChainId, newRelayerFeePct, depositId, depositorSignature);\\n\\n // Now follow the default fillRelay flow with the updated fee and the original relay hash.\\n RelayData memory relayData = RelayData({\\n depositor: depositor,\\n recipient: recipient,\\n destinationToken: destinationToken,\\n amount: amount,\\n realizedLpFeePct: realizedLpFeePct,\\n relayerFeePct: relayerFeePct,\\n depositId: depositId,\\n originChainId: originChainId,\\n destinationChainId: chainId()\\n });\\n bytes32 relayHash = _getRelayHash(relayData);\\n uint256 fillAmountPreFees = _fillRelay(relayHash, relayData, maxTokensToSend, newRelayerFeePct, false);\\n\\n _emitFillRelay(relayHash, fillAmountPreFees, repaymentChainId, newRelayerFeePct, relayData, false);\\n }\\n\\n /**************************************\\n * DATA WORKER FUNCTIONS *\\n **************************************/\\n\\n /**\\n * @notice Executes a slow relay leaf stored as part of a root bundle. Will send the full amount remaining in the\\n * relay to the recipient, less fees.\\n * @dev This function assumes that the relay's destination chain ID is the current chain ID, which prevents\\n * the caller from executing a slow relay intended for another chain on this chain.\\n * @param depositor Depositor on origin chain who set this chain as the destination chain.\\n * @param recipient Specified recipient on this chain.\\n * @param destinationToken Token to send to recipient. Should be mapped to the origin token, origin chain ID\\n * and this chain ID via a mapping on the HubPool.\\n * @param amount Full size of the deposit.\\n * @param originChainId Chain of SpokePool where deposit originated.\\n * @param realizedLpFeePct Fee % based on L1 HubPool utilization at deposit quote time. Deterministic based on\\n * quote time.\\n * @param relayerFeePct Original fee % to keep as relayer set by depositor.\\n * @param depositId Unique deposit ID on origin spoke pool.\\n * @param rootBundleId Unique ID of root bundle containing slow relay root that this leaf is contained in.\\n * @param proof Inclusion proof for this leaf in slow relay root in root bundle.\\n */\\n function executeSlowRelayRoot(\\n address depositor,\\n address recipient,\\n address destinationToken,\\n uint256 amount,\\n uint256 originChainId,\\n uint64 realizedLpFeePct,\\n uint64 relayerFeePct,\\n uint32 depositId,\\n uint32 rootBundleId,\\n bytes32[] memory proof\\n ) public virtual override nonReentrant {\\n _executeSlowRelayRoot(\\n depositor,\\n recipient,\\n destinationToken,\\n amount,\\n originChainId,\\n chainId(),\\n realizedLpFeePct,\\n relayerFeePct,\\n depositId,\\n rootBundleId,\\n proof\\n );\\n }\\n\\n /**\\n * @notice Executes a relayer refund leaf stored as part of a root bundle. Will send the relayer the amount they\\n * sent to the recipient plus a relayer fee.\\n * @param rootBundleId Unique ID of root bundle containing relayer refund root that this leaf is contained in.\\n * @param relayerRefundLeaf Contains all data necessary to reconstruct leaf contained in root bundle and to\\n * refund relayer. This data structure is explained in detail in the SpokePoolInterface.\\n * @param proof Inclusion proof for this leaf in relayer refund root in root bundle.\\n */\\n function executeRelayerRefundRoot(\\n uint32 rootBundleId,\\n SpokePoolInterface.RelayerRefundLeaf memory relayerRefundLeaf,\\n bytes32[] memory proof\\n ) public virtual override nonReentrant {\\n _executeRelayerRefundRoot(rootBundleId, relayerRefundLeaf, proof);\\n }\\n\\n /**************************************\\n * VIEW FUNCTIONS *\\n **************************************/\\n\\n /**\\n * @notice Returns chain ID for this network.\\n * @dev Some L2s like ZKSync don't support the CHAIN_ID opcode so we allow the implementer to override this.\\n */\\n function chainId() public view virtual override returns (uint256) {\\n return block.chainid;\\n }\\n\\n /**************************************\\n * INTERNAL FUNCTIONS *\\n **************************************/\\n\\n // Verifies inclusion proof of leaf in root, sends relayer their refund, and sends to HubPool any rebalance\\n // transfers.\\n function _executeRelayerRefundRoot(\\n uint32 rootBundleId,\\n SpokePoolInterface.RelayerRefundLeaf memory relayerRefundLeaf,\\n bytes32[] memory proof\\n ) internal {\\n // Check integrity of leaf structure:\\n require(relayerRefundLeaf.chainId == chainId(), \\\"Invalid chainId\\\");\\n require(relayerRefundLeaf.refundAddresses.length == relayerRefundLeaf.refundAmounts.length, \\\"invalid leaf\\\");\\n\\n RootBundle storage rootBundle = rootBundles[rootBundleId];\\n\\n // Check that inclusionProof proves that relayerRefundLeaf is contained within the relayer refund root.\\n // Note: This should revert if the relayerRefundRoot is uninitialized.\\n require(MerkleLib.verifyRelayerRefund(rootBundle.relayerRefundRoot, relayerRefundLeaf, proof), \\\"Bad Proof\\\");\\n\\n // Verify the leafId in the leaf has not yet been claimed.\\n require(!MerkleLib.isClaimed(rootBundle.claimedBitmap, relayerRefundLeaf.leafId), \\\"Already claimed\\\");\\n\\n // Set leaf as claimed in bitmap. This is passed by reference to the storage rootBundle.\\n MerkleLib.setClaimed(rootBundle.claimedBitmap, relayerRefundLeaf.leafId);\\n\\n // Send each relayer refund address the associated refundAmount for the L2 token address.\\n // Note: Even if the L2 token is not enabled on this spoke pool, we should still refund relayers.\\n for (uint32 i = 0; i < relayerRefundLeaf.refundAmounts.length; i++) {\\n uint256 amount = relayerRefundLeaf.refundAmounts[i];\\n if (amount > 0)\\n IERC20(relayerRefundLeaf.l2TokenAddress).safeTransfer(relayerRefundLeaf.refundAddresses[i], amount);\\n }\\n\\n // If leaf's amountToReturn is positive, then send L2 --> L1 message to bridge tokens back via\\n // chain-specific bridging method.\\n if (relayerRefundLeaf.amountToReturn > 0) {\\n _bridgeTokensToHubPool(relayerRefundLeaf);\\n\\n emit TokensBridged(\\n relayerRefundLeaf.amountToReturn,\\n relayerRefundLeaf.chainId,\\n relayerRefundLeaf.leafId,\\n relayerRefundLeaf.l2TokenAddress,\\n msg.sender\\n );\\n }\\n\\n emit ExecutedRelayerRefundRoot(\\n relayerRefundLeaf.amountToReturn,\\n relayerRefundLeaf.chainId,\\n relayerRefundLeaf.refundAmounts,\\n rootBundleId,\\n relayerRefundLeaf.leafId,\\n relayerRefundLeaf.l2TokenAddress,\\n relayerRefundLeaf.refundAddresses,\\n msg.sender\\n );\\n }\\n\\n // Verifies inclusion proof of leaf in root and sends recipient remainder of relay. Marks relay as filled.\\n function _executeSlowRelayRoot(\\n address depositor,\\n address recipient,\\n address destinationToken,\\n uint256 amount,\\n uint256 originChainId,\\n uint256 destinationChainId,\\n uint64 realizedLpFeePct,\\n uint64 relayerFeePct,\\n uint32 depositId,\\n uint32 rootBundleId,\\n bytes32[] memory proof\\n ) internal {\\n RelayData memory relayData = RelayData({\\n depositor: depositor,\\n recipient: recipient,\\n destinationToken: destinationToken,\\n amount: amount,\\n originChainId: originChainId,\\n destinationChainId: destinationChainId,\\n realizedLpFeePct: realizedLpFeePct,\\n relayerFeePct: relayerFeePct,\\n depositId: depositId\\n });\\n\\n require(\\n MerkleLib.verifySlowRelayFulfillment(rootBundles[rootBundleId].slowRelayRoot, relayData, proof),\\n \\\"Invalid proof\\\"\\n );\\n\\n bytes32 relayHash = _getRelayHash(relayData);\\n\\n // Note: use relayAmount as the max amount to send, so the relay is always completely filled by the contract's\\n // funds in all cases. As this is a slow relay we set the relayerFeePct to 0. This effectively refunds the\\n // relayer component of the relayerFee thereby only charging the depositor the LpFee.\\n uint256 fillAmountPreFees = _fillRelay(relayHash, relayData, relayData.amount, 0, true);\\n\\n // Note: Set repayment chain ID to 0 to indicate that there is no repayment to be made. The off-chain data\\n // worker can use repaymentChainId=0 as a signal to ignore such relays for refunds. Also, set the relayerFeePct\\n // to 0 as slow relays do not pay the caller of this method (depositor is refunded this fee).\\n _emitFillRelay(relayHash, fillAmountPreFees, 0, 0, relayData, true);\\n }\\n\\n function _setCrossDomainAdmin(address newCrossDomainAdmin) internal {\\n require(newCrossDomainAdmin != address(0), \\\"Bad bridge router address\\\");\\n crossDomainAdmin = newCrossDomainAdmin;\\n emit SetXDomainAdmin(crossDomainAdmin);\\n }\\n\\n function _setHubPool(address newHubPool) internal {\\n require(newHubPool != address(0), \\\"Bad hub pool address\\\");\\n hubPool = newHubPool;\\n emit SetHubPool(hubPool);\\n }\\n\\n // Should be overriden by implementing contract depending on how L2 handles sending tokens to L1.\\n function _bridgeTokensToHubPool(SpokePoolInterface.RelayerRefundLeaf memory relayerRefundLeaf) internal virtual;\\n\\n function _verifyUpdateRelayerFeeMessage(\\n address depositor,\\n uint256 originChainId,\\n uint64 newRelayerFeePct,\\n uint32 depositId,\\n bytes memory depositorSignature\\n ) internal view {\\n // A depositor can request to speed up an un-relayed deposit by signing a hash containing the relayer\\n // fee % to update to and information uniquely identifying the deposit to relay. This information ensures\\n // that this signature cannot be re-used for other deposits. The version string is included as a precaution\\n // in case this contract is upgraded.\\n // Note: we use encode instead of encodePacked because it is more secure, more in the \\\"warning\\\" section\\n // here: https://docs.soliditylang.org/en/v0.8.11/abi-spec.html#non-standard-packed-mode\\n bytes32 expectedDepositorMessageHash = keccak256(\\n abi.encode(\\\"ACROSS-V2-FEE-1.0\\\", newRelayerFeePct, depositId, originChainId)\\n );\\n\\n // Check the hash corresponding to the https://eth.wiki/json-rpc/API#eth_sign[eth_sign]\\n // If the depositor signed a message with a different updated fee (or any other param included in the\\n // above keccak156 hash), then this will revert.\\n bytes32 ethSignedMessageHash = ECDSA.toEthSignedMessageHash(expectedDepositorMessageHash);\\n\\n _verifyDepositorUpdateFeeMessage(depositor, ethSignedMessageHash, depositorSignature);\\n }\\n\\n // This function is isolated and made virtual to allow different L2's to implement chain specific recovery of\\n // signers from signatures because some L2s might not support ecrecover. To be safe, consider always reverting\\n // this function for L2s where ecrecover is different from how it works on Ethereum, otherwise there is the\\n // potential to forge a signature from the depositor using a different private key than the original depositor's.\\n function _verifyDepositorUpdateFeeMessage(\\n address depositor,\\n bytes32 ethSignedMessageHash,\\n bytes memory depositorSignature\\n ) internal view virtual {\\n // Note: We purposefully do not support EIP-191 signatures (meaning that multisigs and smart contract wallets\\n // like Argent are not supported) because of the possibility that a multisig that signed a message on the origin\\n // chain does not have a parallel on this destination chain.\\n require(depositor == ECDSA.recover(ethSignedMessageHash, depositorSignature), \\\"invalid signature\\\");\\n }\\n\\n function _computeAmountPreFees(uint256 amount, uint64 feesPct) private pure returns (uint256) {\\n return (1e18 * amount) / (1e18 - feesPct);\\n }\\n\\n function _computeAmountPostFees(uint256 amount, uint64 feesPct) private pure returns (uint256) {\\n return (amount * (1e18 - feesPct)) / 1e18;\\n }\\n\\n function _getRelayHash(SpokePoolInterface.RelayData memory relayData) private pure returns (bytes32) {\\n return keccak256(abi.encode(relayData));\\n }\\n\\n // Unwraps ETH and does a transfer to a recipient address. If the recipient is a smart contract then sends WETH.\\n function _unwrapWETHTo(address payable to, uint256 amount) internal {\\n if (address(to).isContract()) {\\n IERC20(address(weth)).safeTransfer(to, amount);\\n } else {\\n weth.withdraw(amount);\\n to.transfer(amount);\\n }\\n }\\n\\n /**\\n * @notice Caller specifies the max amount of tokens to send to user. Based on this amount and the amount of the\\n * relay remaining (as stored in the relayFills mapping), pull the amount of tokens from the caller\\n * and send to the recipient.\\n * @dev relayFills keeps track of pre-fee fill amounts as a convenience to relayers who want to specify round\\n * numbers for the maxTokensToSend parameter or convenient numbers like 100 (i.e. relayers who will fully\\n * fill any relay up to 100 tokens, and partial fill with 100 tokens for larger relays).\\n * @dev Caller must approve this contract to transfer up to maxTokensToSend of the relayData.destinationToken.\\n * The amount to be sent might end up less if there is insufficient relay amount remaining to be sent.\\n */\\n function _fillRelay(\\n bytes32 relayHash,\\n RelayData memory relayData,\\n uint256 maxTokensToSend,\\n uint64 updatableRelayerFeePct,\\n bool useContractFunds\\n ) internal returns (uint256 fillAmountPreFees) {\\n // We limit the relay fees to prevent the user spending all their funds on fees. Note that 0.5e18 (i.e. 50%)\\n // fees are just magic numbers. The important point is to prevent the total fee from being 100%, otherwise\\n // computing the amount pre fees runs into divide-by-0 issues.\\n require(updatableRelayerFeePct < 0.5e18 && relayData.realizedLpFeePct < 0.5e18, \\\"invalid fees\\\");\\n\\n // Check that the relay has not already been completely filled. Note that the relays mapping will point to\\n // the amount filled so far for a particular relayHash, so this will start at 0 and increment with each fill.\\n require(relayFills[relayHash] < relayData.amount, \\\"relay filled\\\");\\n\\n // Stores the equivalent amount to be sent by the relayer before fees have been taken out.\\n if (maxTokensToSend == 0) return 0;\\n\\n // Derive the amount of the relay filled if the caller wants to send exactly maxTokensToSend tokens to\\n // the recipient. For example, if the user wants to send 10 tokens to the recipient, the full relay amount\\n // is 100, and the fee %'s total 5%, then this computation would return ~10.5, meaning that to fill 10.5/100\\n // of the full relay size, the caller would need to send 10 tokens to the user.\\n fillAmountPreFees = _computeAmountPreFees(\\n maxTokensToSend,\\n (relayData.realizedLpFeePct + updatableRelayerFeePct)\\n );\\n // If user's specified max amount to send is greater than the amount of the relay remaining pre-fees,\\n // we'll pull exactly enough tokens to complete the relay.\\n uint256 amountToSend = maxTokensToSend;\\n uint256 amountRemainingInRelay = relayData.amount - relayFills[relayHash];\\n if (amountRemainingInRelay < fillAmountPreFees) {\\n fillAmountPreFees = amountRemainingInRelay;\\n\\n // The user will fulfill the remainder of the relay, so we need to compute exactly how many tokens post-fees\\n // that they need to send to the recipient. Note that if the relayer is filled using contract funds then\\n // this is a slow relay.\\n amountToSend = _computeAmountPostFees(\\n fillAmountPreFees,\\n relayData.realizedLpFeePct + updatableRelayerFeePct\\n );\\n }\\n\\n // relayFills keeps track of pre-fee fill amounts as a convenience to relayers who want to specify round\\n // numbers for the maxTokensToSend parameter or convenient numbers like 100 (i.e. relayers who will fully\\n // fill any relay up to 100 tokens, and partial fill with 100 tokens for larger relays).\\n relayFills[relayHash] += fillAmountPreFees;\\n\\n // If relay token is weth then unwrap and send eth.\\n if (relayData.destinationToken == address(weth)) {\\n // Note: useContractFunds is True if we want to send funds to the recipient directly out of this contract,\\n // otherwise we expect the caller to send funds to the recipient. If useContractFunds is True and the\\n // recipient wants WETH, then we can assume that WETH is already in the contract, otherwise we'll need the\\n // the user to send WETH to this contract. Regardless, we'll need to unwrap it before sending to the user.\\n if (!useContractFunds)\\n IERC20(relayData.destinationToken).safeTransferFrom(msg.sender, address(this), amountToSend);\\n _unwrapWETHTo(payable(relayData.recipient), amountToSend);\\n // Else, this is a normal ERC20 token. Send to recipient.\\n } else {\\n // Note: Similar to note above, send token directly from the contract to the user in the slow relay case.\\n if (!useContractFunds)\\n IERC20(relayData.destinationToken).safeTransferFrom(msg.sender, relayData.recipient, amountToSend);\\n else IERC20(relayData.destinationToken).safeTransfer(relayData.recipient, amountToSend);\\n }\\n }\\n\\n // The following internal methods emit events with many params to overcome solidity stack too deep issues.\\n function _emitFillRelay(\\n bytes32 relayHash,\\n uint256 fillAmount,\\n uint256 repaymentChainId,\\n uint64 relayerFeePct,\\n RelayData memory relayData,\\n bool isSlowRelay\\n ) internal {\\n emit FilledRelay(\\n relayHash,\\n relayData.amount,\\n relayFills[relayHash],\\n fillAmount,\\n repaymentChainId,\\n relayData.originChainId,\\n relayData.destinationChainId,\\n relayerFeePct,\\n relayData.realizedLpFeePct,\\n relayData.depositId,\\n relayData.destinationToken,\\n msg.sender,\\n relayData.depositor,\\n relayData.recipient,\\n isSlowRelay\\n );\\n }\\n\\n function _emitDeposit(\\n uint256 amount,\\n uint256 originChainId,\\n uint256 destinationChainId,\\n uint64 relayerFeePct,\\n uint32 depositId,\\n uint32 quoteTimestamp,\\n address originToken,\\n address recipient,\\n address depositor\\n ) internal {\\n emit FundsDeposited(\\n amount,\\n originChainId,\\n destinationChainId,\\n relayerFeePct,\\n depositId,\\n quoteTimestamp,\\n originToken,\\n recipient,\\n depositor\\n );\\n }\\n\\n // Implementing contract needs to override this to ensure that only the appropriate cross chain admin can execute\\n // certain admin functions. For L2 contracts, the cross chain admin refers to some L1 address or contract, and for\\n // L1, this would just be the same admin of the HubPool.\\n function _requireAdminSender() internal virtual;\\n\\n // Added to enable the this contract to receive ETH. Used when unwrapping Weth.\\n receive() external payable {}\\n}\\n\",\"keccak256\":\"0x460bea0562b87af55699b2ec0e53735b2224039573f9c5243815541263588bc1\",\"license\":\"GPL-3.0-only\"},\"contracts/SpokePoolInterface.sol\":{\"content\":\"// SPDX-License-Identifier: GPL-3.0-only\\npragma solidity ^0.8.0;\\n\\n/**\\n * @notice Contains common data structures and functions used by all SpokePool implementations.\\n */\\ninterface SpokePoolInterface {\\n // This leaf is meant to be decoded in the SpokePool to pay out successful relayers.\\n struct RelayerRefundLeaf {\\n // This is the amount to return to the HubPool. This occurs when there is a PoolRebalanceLeaf netSendAmount that\\n // is negative. This is just the negative of this value.\\n uint256 amountToReturn;\\n // Used to verify that this is being executed on the correct destination chainId.\\n uint256 chainId;\\n // This array designates how much each of those addresses should be refunded.\\n uint256[] refundAmounts;\\n // Used as the index in the bitmap to track whether this leaf has been executed or not.\\n uint32 leafId;\\n // The associated L2TokenAddress that these claims apply to.\\n address l2TokenAddress;\\n // Must be same length as refundAmounts and designates each address that must be refunded.\\n address[] refundAddresses;\\n }\\n\\n // This struct represents the data to fully specify a relay. If any portion of this data differs, the relay is\\n // considered to be completely distinct. Only one relay for a particular depositId, chainId pair should be\\n // considered valid and repaid. This data is hashed and inserted into the slow relay merkle root so that an off\\n // chain validator can choose when to refund slow relayers.\\n struct RelayData {\\n // The address that made the deposit on the origin chain.\\n address depositor;\\n // The recipient address on the destination chain.\\n address recipient;\\n // The corresponding token address on the destination chain.\\n address destinationToken;\\n // The total relay amount before fees are taken out.\\n uint256 amount;\\n // Origin chain id.\\n uint256 originChainId;\\n // Destination chain id.\\n uint256 destinationChainId;\\n // The LP Fee percentage computed by the relayer based on the deposit's quote timestamp\\n // and the HubPool's utilization.\\n uint64 realizedLpFeePct;\\n // The relayer fee percentage specified in the deposit.\\n uint64 relayerFeePct;\\n // The id uniquely identifying this deposit on the origin chain.\\n uint32 depositId;\\n }\\n\\n // Stores collection of merkle roots that can be published to this contract from the HubPool, which are referenced\\n // by \\\"data workers\\\" via inclusion proofs to execute leaves in the roots.\\n struct RootBundle {\\n // Merkle root of slow relays that were not fully filled and whose recipient is still owed funds from the LP pool.\\n bytes32 slowRelayRoot;\\n // Merkle root of relayer refunds for successful relays.\\n bytes32 relayerRefundRoot;\\n // This is a 2D bitmap tracking which leaves in the relayer refund root have been claimed, with max size of\\n // 256x256 leaves per root.\\n mapping(uint256 => uint256) claimedBitmap;\\n }\\n\\n function setCrossDomainAdmin(address newCrossDomainAdmin) external;\\n\\n function setHubPool(address newHubPool) external;\\n\\n function setEnableRoute(\\n address originToken,\\n uint256 destinationChainId,\\n bool enable\\n ) external;\\n\\n function setDepositQuoteTimeBuffer(uint32 buffer) external;\\n\\n function relayRootBundle(bytes32 relayerRefundRoot, bytes32 slowRelayRoot) external;\\n\\n function emergencyDeleteRootBundle(uint256 rootBundleId) external;\\n\\n function deposit(\\n address recipient,\\n address originToken,\\n uint256 amount,\\n uint256 destinationChainId,\\n uint64 relayerFeePct,\\n uint32 quoteTimestamp\\n ) external payable;\\n\\n function speedUpDeposit(\\n address depositor,\\n uint64 newRelayerFeePct,\\n uint32 depositId,\\n bytes memory depositorSignature\\n ) external;\\n\\n function fillRelay(\\n address depositor,\\n address recipient,\\n address destinationToken,\\n uint256 amount,\\n uint256 maxTokensToSend,\\n uint256 repaymentChainId,\\n uint256 originChainId,\\n uint64 realizedLpFeePct,\\n uint64 relayerFeePct,\\n uint32 depositId\\n ) external;\\n\\n function fillRelayWithUpdatedFee(\\n address depositor,\\n address recipient,\\n address destinationToken,\\n uint256 amount,\\n uint256 maxTokensToSend,\\n uint256 repaymentChainId,\\n uint256 originChainId,\\n uint64 realizedLpFeePct,\\n uint64 relayerFeePct,\\n uint64 newRelayerFeePct,\\n uint32 depositId,\\n bytes memory depositorSignature\\n ) external;\\n\\n function executeSlowRelayRoot(\\n address depositor,\\n address recipient,\\n address destinationToken,\\n uint256 amount,\\n uint256 originChainId,\\n uint64 realizedLpFeePct,\\n uint64 relayerFeePct,\\n uint32 depositId,\\n uint32 rootBundleId,\\n bytes32[] memory proof\\n ) external;\\n\\n function executeRelayerRefundRoot(\\n uint32 rootBundleId,\\n SpokePoolInterface.RelayerRefundLeaf memory relayerRefundLeaf,\\n bytes32[] memory proof\\n ) external;\\n\\n function chainId() external view returns (uint256);\\n}\\n\",\"keccak256\":\"0xe0ae593c1cd9c8204f0b7a3f226a5d4bd30d580692d2ecb2a33548b5b4e75f12\",\"license\":\"GPL-3.0-only\"},\"contracts/interfaces/AdapterInterface.sol\":{\"content\":\"// SPDX-License-Identifier: AGPL-3.0-only\\npragma solidity ^0.8.0;\\n\\n/**\\n * @notice Sends cross chain messages and tokens to contracts on a specific L2 network.\\n */\\n\\ninterface AdapterInterface {\\n event MessageRelayed(address target, bytes message);\\n\\n event TokensRelayed(address l1Token, address l2Token, uint256 amount, address to);\\n\\n function relayMessage(address target, bytes memory message) external payable;\\n\\n function relayTokens(\\n address l1Token,\\n address l2Token,\\n uint256 amount,\\n address to\\n ) external payable;\\n}\\n\",\"keccak256\":\"0xbd7091006acbdfe72b21ce985f964f0682a2316d9d3b38967beeb55f4ae5118c\",\"license\":\"AGPL-3.0-only\"},\"contracts/interfaces/WETH9.sol\":{\"content\":\"// SPDX-License-Identifier: GPL-3.0-only\\npragma solidity ^0.8.0;\\n\\ninterface WETH9 {\\n function withdraw(uint256 wad) external;\\n\\n function deposit() external payable;\\n\\n function balanceOf(address guy) external view returns (uint256 wad);\\n\\n function transfer(address guy, uint256 wad) external;\\n}\\n\",\"keccak256\":\"0x7b444d0840b1f76eee9bf39d74830f70644395613b96cce2d80fc50785a82eaa\",\"license\":\"GPL-3.0-only\"}},\"version\":1}", + "bytecode": "0x60c060405260038054604b60a31b63ffffffff60a01b199091161790556007805463ffffffff1916624c4b4017905573deaddeaddeaddeaddeaddeaddeaddeaddead000060a0523480156200005357600080fd5b5060405162004c9738038062004c97833981016040819052620000769162000269565b600080546001600160a01b031916734200000000000000000000000000000000000007179055600180546001600160a81b0319166001600160a01b03831617600160a01b179055828273420000000000000000000000000000000000000683620000e08462000104565b620000eb83620001aa565b506001600160a01b031660805250620002b39350505050565b6001600160a01b038116620001605760405162461bcd60e51b815260206004820152601960248201527f4261642062726964676520726f7574657220616464726573730000000000000060448201526064015b60405180910390fd5b600280546001600160a01b0319166001600160a01b0383169081179091556040517fa9e8c42c9e7fca7f62755189a16b2f5314d43d8fb24e91ba54e6d65f9314e84990600090a250565b6001600160a01b038116620002025760405162461bcd60e51b815260206004820152601460248201527f4261642068756220706f6f6c2061646472657373000000000000000000000000604482015260640162000157565b600380546001600160a01b0319166001600160a01b0383169081179091556040517f1f17a88f67b0f49060a34bec1a4723a563620e6aa265eb640b5046dcee0759a090600090a250565b80516001600160a01b03811681146200026457600080fd5b919050565b6000806000606084860312156200027f57600080fd5b6200028a846200024c565b92506200029a602085016200024c565b9150620002aa604085016200024c565b90509250925092565b60805160a0516149786200031f60003960008181610605015261309001526000818161034301528181610e0501528181610ece0152818161159f015281816118540152818161227d0152818161249a01528181612d7b01528181612dd10152612f9701526149786000f3fe6080604052600436106101dc5760003560e01c806389a153cc11610102578063e190440211610095578063f06850f611610064578063f06850f61461065c578063f500697c14610689578063fbbba9ac146106a9578063ffc351a3146106c957600080fd5b8063e1904402146105a6578063e282d5b9146105d3578063e3229211146105f3578063ee2a53f81461062757600080fd5b8063ac9650d8116100d1578063ac9650d814610503578063b27a430014610523578063c894c0ca14610566578063de7eba781461058657600080fd5b806389a153cc146104775780638a7860ce146104975780639a8a0592146104b7578063a1244c67146104ca57600080fd5b80633cb747bf1161017a5780635249fef1116101495780635249fef1146103985780635285e058146103e357806357f6dcb814610410578063766e07031461045a57600080fd5b80633cb747bf146103045780633fc8cef3146103315780634922897814610365578063493a4f841461037857600080fd5b806322f8e566116101b657806322f8e56614610281578063272751c7146102a15780632752042e146102c157806329cb924d146102e157600080fd5b80630eaac9f0146101e85780631c39c38d1461020a5780631dfb2d021461026157600080fd5b366101e357005b600080fd5b3480156101f457600080fd5b50610208610203366004613a2e565b6106e9565b005b34801561021657600080fd5b506001546102379073ffffffffffffffffffffffffffffffffffffffff1681565b60405173ffffffffffffffffffffffffffffffffffffffff90911681526020015b60405180910390f35b34801561026d57600080fd5b5061020861027c366004613a76565b6107c9565b34801561028d57600080fd5b5061020861029c366004613a93565b610853565b3480156102ad57600080fd5b506102086102bc366004613aba565b6108fc565b3480156102cd57600080fd5b506102086102dc366004613a2e565b610a13565b3480156102ed57600080fd5b506102f6610b14565b604051908152602001610258565b34801561031057600080fd5b506000546102379073ffffffffffffffffffffffffffffffffffffffff1681565b34801561033d57600080fd5b506102377f000000000000000000000000000000000000000000000000000000000000000081565b610208610373366004613b14565b610bd0565b34801561038457600080fd5b50610208610393366004613b7e565b611037565b3480156103a457600080fd5b506103d36103b3366004613ba0565b600460209081526000928352604080842090915290825290205460ff1681565b6040519015158152602001610258565b3480156103ef57600080fd5b506002546102379073ffffffffffffffffffffffffffffffffffffffff1681565b34801561041c57600080fd5b506003546104459074010000000000000000000000000000000000000000900463ffffffff1681565b60405163ffffffff9091168152602001610258565b34801561046657600080fd5b506007546104459063ffffffff1681565b34801561048357600080fd5b50610208610492366004613bcc565b61115e565b3480156104a357600080fd5b506102086104b2366004613a93565b6112ba565b3480156104c357600080fd5b50466102f6565b3480156104d657600080fd5b50600354610445907801000000000000000000000000000000000000000000000000900463ffffffff1681565b610516610511366004613c70565b61138e565b6040516102589190613d5b565b34801561052f57600080fd5b5061023761053e366004613a76565b60086020526000908152604090205473ffffffffffffffffffffffffffffffffffffffff1681565b34801561057257600080fd5b50610208610581366004613f75565b611568565b34801561059257600080fd5b506102086105a1366004613a76565b61164b565b3480156105b257600080fd5b506003546102379073ffffffffffffffffffffffffffffffffffffffff1681565b3480156105df57600080fd5b506102086105ee366004614108565b611691565b3480156105ff57600080fd5b506102377f000000000000000000000000000000000000000000000000000000000000000081565b34801561063357600080fd5b50610647610642366004613a93565b6117ef565b60408051928352602083019190915201610258565b34801561066857600080fd5b506102f6610677366004613a93565b60066020526000908152604090205481565b34801561069557600080fd5b506102086106a4366004614179565b61181d565b3480156106b557600080fd5b506102086106c4366004614246565b611904565b3480156106d557600080fd5b506102086106e436600461427f565b6119fd565b6106f1611b68565b6106f9611da1565b610726600180547fffffffffffffffffffffff00ffffffffffffffffffffffffffffffffffffffff169055565b600780547fffffffffffffffffffffffffffffffffffffffffffffffffffffffff000000001663ffffffff83169081179091556040517fe486a5c4bd7b36eabbfe274c99b39130277417be8d2209b4dae04c4fba64ee3a90600090a26107c6600180547fffffffffffffffffffffff00ffffffffffffffffffffffffffffffffffffffff1674010000000000000000000000000000000000000000179055565b50565b6107d1611b68565b6107d9611da1565b610806600180547fffffffffffffffffffffff00ffffffffffffffffffffffffffffffffffffffff169055565b61080f81611e27565b6107c6600180547fffffffffffffffffffffff00ffffffffffffffffffffffffffffffffffffffff1674010000000000000000000000000000000000000000179055565b60015473ffffffffffffffffffffffffffffffffffffffff1661087557600080fd5b6001546040517f22f8e5660000000000000000000000000000000000000000000000000000000081526004810183905273ffffffffffffffffffffffffffffffffffffffff909116906322f8e56690602401600060405180830381600087803b1580156108e157600080fd5b505af11580156108f5573d6000803e3d6000fd5b5050505050565b610904611b68565b61090c611da1565b610939600180547fffffffffffffffffffffff00ffffffffffffffffffffffffffffffffffffffff169055565b73ffffffffffffffffffffffffffffffffffffffff8316600081815260046020908152604080832086845282529182902080547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff001685151590811790915591519182528492917f0a21fdd43d0ad0c62689ee7230a47309a050755bcc52eba00310add65297692a910160405180910390a3610a0e600180547fffffffffffffffffffffff00ffffffffffffffffffffffffffffffffffffffff1674010000000000000000000000000000000000000000179055565b505050565b610a1b611b68565b610a23611da1565b610a50600180547fffffffffffffffffffffff00ffffffffffffffffffffffffffffffffffffffff169055565b600380547fffffffffffffffff00000000ffffffffffffffffffffffffffffffffffffffff167401000000000000000000000000000000000000000063ffffffff8416908102919091179091556040519081527f0e55dd180fa793d9036c804d0a116e6a7617a48e72cee1f83d92793a793fcc039060200160405180910390a16107c6600180547fffffffffffffffffffffff00ffffffffffffffffffffffffffffffffffffffff1674010000000000000000000000000000000000000000179055565b60015460009073ffffffffffffffffffffffffffffffffffffffff1615610bcb57600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166329cb924d6040518163ffffffff1660e01b8152600401602060405180830381865afa158015610ba2573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610bc6919061435d565b905090565b504290565b610bd8611da1565b610c05600180547fffffffffffffffffffffff00ffffffffffffffffffffffffffffffffffffffff169055565b73ffffffffffffffffffffffffffffffffffffffff8516600090815260046020908152604080832086845290915290205460ff16610ca4576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152600e60248201527f44697361626c656420726f75746500000000000000000000000000000000000060448201526064015b60405180910390fd5b6706f05b59d3b200008267ffffffffffffffff1610610d1f576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601360248201527f696e76616c69642072656c6179657220666565000000000000000000000000006044820152606401610c9b565b600354610d4a9074010000000000000000000000000000000000000000900463ffffffff16826143a5565b63ffffffff16610d58610b14565b10158015610d9d5750600354610d8c9074010000000000000000000000000000000000000000900463ffffffff16826143ca565b63ffffffff16610d9a610b14565b11155b610e03576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601260248201527f696e76616c69642071756f74652074696d6500000000000000000000000000006044820152606401610c9b565b7f000000000000000000000000000000000000000000000000000000000000000073ffffffffffffffffffffffffffffffffffffffff168573ffffffffffffffffffffffffffffffffffffffff16148015610e5e5750600034115b15610f5257833414610ecc576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601b60248201527f6d73672e76616c7565206d757374206d6174636820616d6f756e7400000000006044820152606401610c9b565b7f000000000000000000000000000000000000000000000000000000000000000073ffffffffffffffffffffffffffffffffffffffff1663d0e30db0346040518263ffffffff1660e01b81526004016000604051808303818588803b158015610f3457600080fd5b505af1158015610f48573d6000803e3d6000fd5b5050505050610f74565b610f7473ffffffffffffffffffffffffffffffffffffffff8616333087611f13565b610fab8446600354869086907801000000000000000000000000000000000000000000000000900463ffffffff16868b8d33611fef565b6001600360188282829054906101000a900463ffffffff16610fcd91906143ca565b92506101000a81548163ffffffff021916908363ffffffff16021790555061102f600180547fffffffffffffffffffffff00ffffffffffffffffffffffffffffffffffffffff1674010000000000000000000000000000000000000000179055565b505050505050565b61103f611b68565b611047611da1565b611074600180547fffffffffffffffffffffff00ffffffffffffffffffffffffffffffffffffffff169055565b60058054600181018255600091909152600381027f036b6384b5eca791c62761152d0c79bb0604c104a5fb6f4eb0703f3154bb3db181018490557f036b6384b5eca791c62761152d0c79bb0604c104a5fb6f4eb0703f3154bb3db001828155604080518581526020810185905263ffffffff8416917fc86ba04c55bc5eb2f2876b91c438849a296dbec7b08751c3074d92e04f0a77af910160405180910390a2505061115a600180547fffffffffffffffffffffff00ffffffffffffffffffffffffffffffffffffffff1674010000000000000000000000000000000000000000179055565b5050565b611166611da1565b611193600180547fffffffffffffffffffffff00ffffffffffffffffffffffffffffffffffffffff169055565b60006040518061012001604052808c73ffffffffffffffffffffffffffffffffffffffff1681526020018b73ffffffffffffffffffffffffffffffffffffffff1681526020018a73ffffffffffffffffffffffffffffffffffffffff1681526020018981526020018681526020016112084690565b81526020018567ffffffffffffffff1681526020018467ffffffffffffffff1681526020018363ffffffff168152509050600061124482612080565b9050600061125682848b8860006120b0565b905061126782828a8887600061235d565b5050506112ae600180547fffffffffffffffffffffff00ffffffffffffffffffffffffffffffffffffffff1674010000000000000000000000000000000000000000179055565b50505050505050505050565b6112c2611b68565b6112ca611da1565b6112f7600180547fffffffffffffffffffffff00ffffffffffffffffffffffffffffffffffffffff169055565b6005818154811061130a5761130a6143f2565b60009182526020822060039091020181815560010181905560405182917f3569b846531b754c99cb80df3f49cd72fa6fe106aaee5ab8e0caf35a9d7ce88d91a26107c6600180547fffffffffffffffffffffff00ffffffffffffffffffffffffffffffffffffffff1674010000000000000000000000000000000000000000179055565b606034156113f8576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601b60248201527f4f6e6c79206d756c746963616c6c207769746820302076616c756500000000006044820152606401610c9b565b8167ffffffffffffffff81111561141157611411613ddb565b60405190808252806020026020018201604052801561144457816020015b606081526020019060019003908161142f5790505b50905060005b828110156115615760008030868685818110611468576114686143f2565b905060200281019061147a9190614421565b604051611488929190614486565b600060405180830381855af49150503d80600081146114c3576040519150601f19603f3d011682016040523d82523d6000602084013e6114c8565b606091505b50915091508161152e576044815110156114e157600080fd5b600481019050808060200190518101906114fb9190614496565b6040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610c9b9190614504565b80848481518110611541576115416143f2565b60200260200101819052505050808061155990614517565b91505061144a565b5092915050565b611570611da1565b61159d600180547fffffffffffffffffffffff00ffffffffffffffffffffffffffffffffffffffff169055565b7f000000000000000000000000000000000000000000000000000000000000000073ffffffffffffffffffffffffffffffffffffffff16826080015173ffffffffffffffffffffffffffffffffffffffff16036115fc576115fc612492565b611607838383612500565b610a0e600180547fffffffffffffffffffffff00ffffffffffffffffffffffffffffffffffffffff1674010000000000000000000000000000000000000000179055565b611653611b68565b61165b611da1565b611688600180547fffffffffffffffffffffff00ffffffffffffffffffffffffffffffffffffffff169055565b61080f816128c6565b611699611da1565b6116c6600180547fffffffffffffffffffffff00ffffffffffffffffffffffffffffffffffffffff169055565b6706f05b59d3b200008367ffffffffffffffff1610611741576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601360248201527f696e76616c69642072656c6179657220666565000000000000000000000000006044820152606401610c9b565b61174e84468585856129b2565b8373ffffffffffffffffffffffffffffffffffffffff168263ffffffff167fb9de16bf376724405019a10ef4fedac57fecd292bf86c08d81d7c42d394d5d37858460405161179d92919061454f565b60405180910390a36117e9600180547fffffffffffffffffffffff00ffffffffffffffffffffffffffffffffffffffff1674010000000000000000000000000000000000000000179055565b50505050565b600581815481106117ff57600080fd5b60009182526020909120600390910201805460019091015490915082565b611825611da1565b611852600180547fffffffffffffffffffffff00ffffffffffffffffffffffffffffffffffffffff169055565b7f000000000000000000000000000000000000000000000000000000000000000073ffffffffffffffffffffffffffffffffffffffff168873ffffffffffffffffffffffffffffffffffffffff16036118ad576118ad612492565b6118c08a8a8a8a8a468b8b8b8b8b612a4f565b6112ae600180547fffffffffffffffffffffff00ffffffffffffffffffffffffffffffffffffffff1674010000000000000000000000000000000000000000179055565b61190c611b68565b611914611da1565b611941600180547fffffffffffffffffffffff00ffffffffffffffffffffffffffffffffffffffff169055565b73ffffffffffffffffffffffffffffffffffffffff82811660008181526008602052604080822080547fffffffffffffffffffffffff0000000000000000000000000000000000000000169486169485179055517ff3dc137d2246f9b8abd0bb821e185ba01122c9b3ea3745ffca6208037674d6709190a361115a600180547fffffffffffffffffffffff00ffffffffffffffffffffffffffffffffffffffff1674010000000000000000000000000000000000000000179055565b611a05611da1565b611a32600180547fffffffffffffffffffffff00ffffffffffffffffffffffffffffffffffffffff169055565b611a3f8c878585856129b2565b60006040518061012001604052808e73ffffffffffffffffffffffffffffffffffffffff1681526020018d73ffffffffffffffffffffffffffffffffffffffff1681526020018c73ffffffffffffffffffffffffffffffffffffffff1681526020018b8152602001888152602001611ab44690565b81526020018767ffffffffffffffff1681526020018667ffffffffffffffff1681526020018463ffffffff1681525090506000611af082612080565b90506000611b0282848d8960006120b0565b9050611b1382828c8987600061235d565b505050611b5a600180547fffffffffffffffffffffff00ffffffffffffffffffffffffffffffffffffffff1674010000000000000000000000000000000000000000179055565b505050505050505050505050565b60025473ffffffffffffffffffffffffffffffffffffffff16611ba060005473ffffffffffffffffffffffffffffffffffffffff1690565b73ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614611c5a576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602e60248201527f4f564d5f58434841494e3a206d657373656e67657220636f6e7472616374207560448201527f6e61757468656e746963617465640000000000000000000000000000000000006064820152608401610c9b565b8073ffffffffffffffffffffffffffffffffffffffff16611c9060005473ffffffffffffffffffffffffffffffffffffffff1690565b73ffffffffffffffffffffffffffffffffffffffff16636e296e456040518163ffffffff1660e01b8152600401602060405180830381865afa158015611cda573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611cfe9190614572565b73ffffffffffffffffffffffffffffffffffffffff16146107c6576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152603060248201527f4f564d5f58434841494e3a2077726f6e672073656e646572206f662063726f7360448201527f732d646f6d61696e206d657373616765000000000000000000000000000000006064820152608401610c9b565b60015474010000000000000000000000000000000000000000900460ff16611e25576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601f60248201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c006044820152606401610c9b565b565b73ffffffffffffffffffffffffffffffffffffffff8116611ea4576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601460248201527f4261642068756220706f6f6c20616464726573730000000000000000000000006044820152606401610c9b565b600380547fffffffffffffffffffffffff00000000000000000000000000000000000000001673ffffffffffffffffffffffffffffffffffffffff83169081179091556040517f1f17a88f67b0f49060a34bec1a4723a563620e6aa265eb640b5046dcee0759a090600090a250565b60405173ffffffffffffffffffffffffffffffffffffffff808516602483015283166044820152606481018290526117e99085907f23b872dd00000000000000000000000000000000000000000000000000000000906084015b604080517fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe08184030181529190526020810180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff167fffffffff0000000000000000000000000000000000000000000000000000000090931692909217909152612bce565b604080518a8152602081018a905290810188905267ffffffffffffffff8716606082015263ffffffff858116608083015273ffffffffffffffffffffffffffffffffffffffff84811660a084015280841692908616918816907f4a4fc49abd237bfd7f4ac82d6c7a284c69daaea5154430cff04ad7482c6c42549060c00160405180910390a4505050505050505050565b600081604051602001612093919061458f565b604051602081830303815290604052805190602001209050919050565b60006706f05b59d3b200008367ffffffffffffffff161080156120e857506706f05b59d3b200008560c0015167ffffffffffffffff16105b61214e576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152600c60248201527f696e76616c6964206665657300000000000000000000000000000000000000006044820152606401610c9b565b6060850151600087815260066020526040902054106121c9576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152600c60248201527f72656c61792066696c6c656400000000000000000000000000000000000000006044820152606401610c9b565b836000036121d957506000612354565b6121f284848760c001516121ed9190614636565b612cda565b600087815260066020526040812054606088015192935086926122159190614659565b90508281101561223e5780925061223b83868960c001516122369190614636565b612d1b565b91505b6000888152600660205260408120805485929061225c908490614670565b9091555050604087015173ffffffffffffffffffffffffffffffffffffffff7f000000000000000000000000000000000000000000000000000000000000000081169116036122e457836122d15760408701516122d19073ffffffffffffffffffffffffffffffffffffffff16333085611f13565b6122df876020015183612d44565b612351565b8361231e576122df338860200151848a6040015173ffffffffffffffffffffffffffffffffffffffff16611f13909392919063ffffffff16565b612351876020015183896040015173ffffffffffffffffffffffffffffffffffffffff16612e859092919063ffffffff16565b50505b95945050505050565b816000015173ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16877f1d59c1d19baf4b4de03cec9c844258e7ca2f2004975025eb14fe9a5e1d4e0d888560600151600660008c8152602001908152602001600020548a8a89608001518a60a001518c8c60c001518d61010001518e604001518f602001518f6040516124829c9b9a999897969594939291909b8c5260208c019a909a5260408b019890985260608a0196909652608089019490945260a088019290925267ffffffffffffffff90811660c08801521660e086015263ffffffff1661010085015273ffffffffffffffffffffffffffffffffffffffff9081166101208501521661014083015215156101608201526101800190565b60405180910390a4505050505050565b4715611e25577f000000000000000000000000000000000000000000000000000000000000000073ffffffffffffffffffffffffffffffffffffffff1663d0e30db0476040518263ffffffff1660e01b81526004016000604051808303818588803b1580156108e157600080fd5b4682602001511461256d576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152600f60248201527f496e76616c696420636861696e496400000000000000000000000000000000006044820152606401610c9b565b8160400151518260a0015151146125e0576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152600c60248201527f696e76616c6964206c65616600000000000000000000000000000000000000006044820152606401610c9b565b600060058463ffffffff16815481106125fb576125fb6143f2565b9060005260206000209060030201905061261a81600101548484612edb565b612680576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152600960248201527f4261642050726f6f6600000000000000000000000000000000000000000000006044820152606401610c9b565b61269781600201846060015163ffffffff16612f16565b156126fe576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152600f60248201527f416c726561647920636c61696d656400000000000000000000000000000000006044820152606401610c9b565b61271581600201846060015163ffffffff16612f57565b60005b8360400151518163ffffffff1610156127c157600084604001518263ffffffff1681518110612749576127496143f2565b6020026020010151905060008111156127ae576127ae8560a001518363ffffffff168151811061277b5761277b6143f2565b602002602001015182876080015173ffffffffffffffffffffffffffffffffffffffff16612e859092919063ffffffff16565b50806127b981614688565b915050612718565b5082511561285a576127d283612f95565b826080015173ffffffffffffffffffffffffffffffffffffffff16836060015163ffffffff1684602001517f828fc203220356df8f072a91681caee7d5c75095e2a95e80ed5a14b384697f7186600001513360405161285192919091825273ffffffffffffffffffffffffffffffffffffffff16602082015260400190565b60405180910390a45b826060015163ffffffff168463ffffffff1684602001517ff8bd640004bcec1b89657020f561d0b070cbdf662d0b158db9dccb0a8301bfab8660000151876040015188608001518960a00151336040516128b895949392919061472c565b60405180910390a450505050565b73ffffffffffffffffffffffffffffffffffffffff8116612943576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601960248201527f4261642062726964676520726f757465722061646472657373000000000000006044820152606401610c9b565b600280547fffffffffffffffffffffffff00000000000000000000000000000000000000001673ffffffffffffffffffffffffffffffffffffffff83169081179091556040517fa9e8c42c9e7fca7f62755189a16b2f5314d43d8fb24e91ba54e6d65f9314e84990600090a250565b60408051608060208201819052601160a08301527f4143524f53532d56322d4645452d312e3000000000000000000000000000000060c083015267ffffffffffffffff86169282019290925263ffffffff8416606082015290810185905260009060e0016040516020818303038152906040528051906020012090506000612a398261325a565b9050612a46878285613295565b50505050505050565b60006040518061012001604052808d73ffffffffffffffffffffffffffffffffffffffff1681526020018c73ffffffffffffffffffffffffffffffffffffffff1681526020018b73ffffffffffffffffffffffffffffffffffffffff1681526020018a81526020018981526020018881526020018767ffffffffffffffff1681526020018667ffffffffffffffff1681526020018563ffffffff168152509050612b2460058463ffffffff1681548110612b0b57612b0b6143f2565b9060005260206000209060030201600001548284613333565b612b8a576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152600d60248201527f496e76616c69642070726f6f66000000000000000000000000000000000000006044820152606401610c9b565b6000612b9582612080565b90506000612bac82848560600151600060016120b0565b9050612bbe828260008087600161235d565b5050505050505050505050505050565b6000612c30826040518060400160405280602081526020017f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c65648152508573ffffffffffffffffffffffffffffffffffffffff1661334b9092919063ffffffff16565b805190915015610a0e5780806020019051810190612c4e919061478a565b610a0e576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602a60248201527f5361666545524332303a204552433230206f7065726174696f6e20646964206e60448201527f6f742073756363656564000000000000000000000000000000000000000000006064820152608401610c9b565b6000612cee82670de0b6b3a76400006147a7565b67ffffffffffffffff16612d0a84670de0b6b3a76400006147c8565b612d149190614834565b9392505050565b6000670de0b6b3a7640000612d3083826147a7565b612d0a9067ffffffffffffffff16856147c8565b73ffffffffffffffffffffffffffffffffffffffff82163b15612da25761115a73ffffffffffffffffffffffffffffffffffffffff7f0000000000000000000000000000000000000000000000000000000000000000168383612e85565b6040517f2e1a7d4d000000000000000000000000000000000000000000000000000000008152600481018290527f000000000000000000000000000000000000000000000000000000000000000073ffffffffffffffffffffffffffffffffffffffff1690632e1a7d4d90602401600060405180830381600087803b158015612e2a57600080fd5b505af1158015612e3e573d6000803e3d6000fd5b505060405173ffffffffffffffffffffffffffffffffffffffff8516925083156108fc02915083906000818181858888f19350505050158015610a0e573d6000803e3d6000fd5b60405173ffffffffffffffffffffffffffffffffffffffff8316602482015260448101829052610a0e9084907fa9059cbb0000000000000000000000000000000000000000000000000000000090606401611f6d565b6000612f0e828585604051602001612ef39190614848565b6040516020818303038152906040528051906020012061335a565b949350505050565b600080612f2561010084614834565b90506000612f35610100856148e3565b6000928352602095909552506040902054600190931b92831690921492915050565b6000612f6561010083614834565b90506000612f75610100846148e3565b600092835260209490945250604090208054600190931b90921790915550565b7f000000000000000000000000000000000000000000000000000000000000000073ffffffffffffffffffffffffffffffffffffffff16816080015173ffffffffffffffffffffffffffffffffffffffff16036130b757608081015181516040517f2e1a7d4d00000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff90921691632e1a7d4d916130489160040190815260200190565b600060405180830381600087803b15801561306257600080fd5b505af1158015613076573d6000803e3d6000fd5b50505073ffffffffffffffffffffffffffffffffffffffff7f0000000000000000000000000000000000000000000000000000000000000000166080830152505b608081015173ffffffffffffffffffffffffffffffffffffffff908116600090815260086020526040902054161561311b57608081015173ffffffffffffffffffffffffffffffffffffffff90811660009081526008602052604090205416613131565b7342000000000000000000000000000000000000105b608082015160035483516007546040517fa3a7954800000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff94851660048201529284166024840152604483019190915263ffffffff16606482015260a06084820152600060a482015291169063a3a795489060c401600060405180830381600087803b1580156131d057600080fd5b505af11580156131e4573d6000803e3d6000fd5b50505050608081015160035482516007546040805173ffffffffffffffffffffffffffffffffffffffff9485168152602081019390935263ffffffff909116908201529116907f46b77e3c29797b94890fd3438da74f697480742358a3e26b9d13a227f1ac0ac99060600160405180910390a250565b6040517f19457468657265756d205369676e6564204d6573736167653a0a3332000000006020820152603c8101829052600090605c01612093565b61329f8282613370565b73ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614610a0e576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601160248201527f696e76616c6964207369676e61747572650000000000000000000000000000006044820152606401610c9b565b6000612f0e828585604051602001612ef3919061458f565b6060612f0e8484600085613394565b600082613367858461352a565b14949350505050565b600080600061337f8585613596565b9150915061338c81613604565b509392505050565b606082471015613426576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602660248201527f416464726573733a20696e73756666696369656e742062616c616e636520666f60448201527f722063616c6c00000000000000000000000000000000000000000000000000006064820152608401610c9b565b73ffffffffffffffffffffffffffffffffffffffff85163b6134a4576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e74726163740000006044820152606401610c9b565b6000808673ffffffffffffffffffffffffffffffffffffffff1685876040516134cd91906148f7565b60006040518083038185875af1925050503d806000811461350a576040519150601f19603f3d011682016040523d82523d6000602084013e61350f565b606091505b509150915061351f828286613858565b979650505050505050565b600081815b845181101561338c57600085828151811061354c5761354c6143f2565b602002602001015190508083116135725760008381526020829052604090209250613583565b600081815260208490526040902092505b508061358e81614517565b91505061352f565b60008082516041036135cc5760208301516040840151606085015160001a6135c0878285856138ab565b945094505050506135fd565b82516040036135f557602083015160408401516135ea8683836139c3565b9350935050506135fd565b506000905060025b9250929050565b600081600481111561361857613618614913565b036136205750565b600181600481111561363457613634614913565b0361369b576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601860248201527f45434453413a20696e76616c6964207369676e617475726500000000000000006044820152606401610c9b565b60028160048111156136af576136af614913565b03613716576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601f60248201527f45434453413a20696e76616c6964207369676e6174757265206c656e677468006044820152606401610c9b565b600381600481111561372a5761372a614913565b036137b7576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602260248201527f45434453413a20696e76616c6964207369676e6174757265202773272076616c60448201527f75650000000000000000000000000000000000000000000000000000000000006064820152608401610c9b565b60048160048111156137cb576137cb614913565b036107c6576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602260248201527f45434453413a20696e76616c6964207369676e6174757265202776272076616c60448201527f75650000000000000000000000000000000000000000000000000000000000006064820152608401610c9b565b60608315613867575081612d14565b8251156138775782518084602001fd5b816040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610c9b9190614504565b6000807f7fffffffffffffffffffffffffffffff5d576e7357a4501ddfe92f46681b20a08311156138e257506000905060036139ba565b8460ff16601b141580156138fa57508460ff16601c14155b1561390b57506000905060046139ba565b6040805160008082526020820180845289905260ff881692820192909252606081018690526080810185905260019060a0016020604051602081039080840390855afa15801561395f573d6000803e3d6000fd5b50506040517fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0015191505073ffffffffffffffffffffffffffffffffffffffff81166139b3576000600192509250506139ba565b9150600090505b94509492505050565b6000807f7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff8316816139f960ff86901c601b614670565b9050613a07878288856138ab565b935093505050935093915050565b803563ffffffff81168114613a2957600080fd5b919050565b600060208284031215613a4057600080fd5b612d1482613a15565b73ffffffffffffffffffffffffffffffffffffffff811681146107c657600080fd5b8035613a2981613a49565b600060208284031215613a8857600080fd5b8135612d1481613a49565b600060208284031215613aa557600080fd5b5035919050565b80151581146107c657600080fd5b600080600060608486031215613acf57600080fd5b8335613ada81613a49565b9250602084013591506040840135613af181613aac565b809150509250925092565b803567ffffffffffffffff81168114613a2957600080fd5b60008060008060008060c08789031215613b2d57600080fd5b8635613b3881613a49565b95506020870135613b4881613a49565b94506040870135935060608701359250613b6460808801613afc565b9150613b7260a08801613a15565b90509295509295509295565b60008060408385031215613b9157600080fd5b50508035926020909101359150565b60008060408385031215613bb357600080fd5b8235613bbe81613a49565b946020939093013593505050565b6000806000806000806000806000806101408b8d031215613bec57600080fd5b8a35613bf781613a49565b995060208b0135613c0781613a49565b985060408b0135613c1781613a49565b975060608b0135965060808b0135955060a08b0135945060c08b01359350613c4160e08c01613afc565b9250613c506101008c01613afc565b9150613c5f6101208c01613a15565b90509295989b9194979a5092959850565b60008060208385031215613c8357600080fd5b823567ffffffffffffffff80821115613c9b57600080fd5b818501915085601f830112613caf57600080fd5b813581811115613cbe57600080fd5b8660208260051b8501011115613cd357600080fd5b60209290920196919550909350505050565b60005b83811015613d00578181015183820152602001613ce8565b838111156117e95750506000910152565b60008151808452613d29816020860160208601613ce5565b601f017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0169290920160200192915050565b6000602080830181845280855180835260408601915060408160051b870101925083870160005b82811015613dce577fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc0888603018452613dbc858351613d11565b94509285019290850190600101613d82565b5092979650505050505050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b60405160c0810167ffffffffffffffff81118282101715613e2d57613e2d613ddb565b60405290565b604051601f82017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe016810167ffffffffffffffff81118282101715613e7a57613e7a613ddb565b604052919050565b600067ffffffffffffffff821115613e9c57613e9c613ddb565b5060051b60200190565b600082601f830112613eb757600080fd5b81356020613ecc613ec783613e82565b613e33565b82815260059290921b84018101918181019086841115613eeb57600080fd5b8286015b84811015613f065780358352918301918301613eef565b509695505050505050565b600082601f830112613f2257600080fd5b81356020613f32613ec783613e82565b82815260059290921b84018101918181019086841115613f5157600080fd5b8286015b84811015613f06578035613f6881613a49565b8352918301918301613f55565b600080600060608486031215613f8a57600080fd5b613f9384613a15565b9250602084013567ffffffffffffffff80821115613fb057600080fd5b9085019060c08288031215613fc457600080fd5b613fcc613e0a565b8235815260208301356020820152604083013582811115613fec57600080fd5b613ff889828601613ea6565b60408301525061400a60608401613a15565b606082015261401b60808401613a6b565b608082015260a08301358281111561403257600080fd5b61403e89828601613f11565b60a0830152509350604086013591508082111561405a57600080fd5b5061406786828701613ea6565b9150509250925092565b600067ffffffffffffffff82111561408b5761408b613ddb565b50601f017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe01660200190565b600082601f8301126140c857600080fd5b81356140d6613ec782614071565b8181528460208386010111156140eb57600080fd5b816020850160208301376000918101602001919091529392505050565b6000806000806080858703121561411e57600080fd5b843561412981613a49565b935061413760208601613afc565b925061414560408601613a15565b9150606085013567ffffffffffffffff81111561416157600080fd5b61416d878288016140b7565b91505092959194509250565b6000806000806000806000806000806101408b8d03121561419957600080fd5b8a356141a481613a49565b995060208b01356141b481613a49565b985060408b01356141c481613a49565b975060608b0135965060808b013595506141e060a08c01613afc565b94506141ee60c08c01613afc565b93506141fc60e08c01613a15565b925061420b6101008c01613a15565b91506101208b013567ffffffffffffffff81111561422857600080fd5b6142348d828e01613ea6565b9150509295989b9194979a5092959850565b6000806040838503121561425957600080fd5b823561426481613a49565b9150602083013561427481613a49565b809150509250929050565b6000806000806000806000806000806000806101808d8f0312156142a257600080fd5b6142ab8d613a6b565b9b506142b960208e01613a6b565b9a506142c760408e01613a6b565b995060608d0135985060808d0135975060a08d0135965060c08d013595506142f160e08e01613afc565b94506143006101008e01613afc565b935061430f6101208e01613afc565b925061431e6101408e01613a15565b915067ffffffffffffffff6101608e0135111561433a57600080fd5b61434b8e6101608f01358f016140b7565b90509295989b509295989b509295989b565b60006020828403121561436f57600080fd5b5051919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b600063ffffffff838116908316818110156143c2576143c2614376565b039392505050565b600063ffffffff8083168185168083038211156143e9576143e9614376565b01949350505050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b60008083357fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe184360301811261445657600080fd5b83018035915067ffffffffffffffff82111561447157600080fd5b6020019150368190038213156135fd57600080fd5b8183823760009101908152919050565b6000602082840312156144a857600080fd5b815167ffffffffffffffff8111156144bf57600080fd5b8201601f810184136144d057600080fd5b80516144de613ec782614071565b8181528560208385010111156144f357600080fd5b612354826020830160208601613ce5565b602081526000612d146020830184613d11565b60007fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff820361454857614548614376565b5060010190565b67ffffffffffffffff83168152604060208201526000612f0e6040830184613d11565b60006020828403121561458457600080fd5b8151612d1481613a49565b815173ffffffffffffffffffffffffffffffffffffffff90811682526020808401518216908301526040808401519182169083015261012082019050606083015160608301526080830151608083015260a083015160a083015260c083015161460460c084018267ffffffffffffffff169052565b5060e083015161462060e084018267ffffffffffffffff169052565b506101009283015163ffffffff16919092015290565b600067ffffffffffffffff8083168185168083038211156143e9576143e9614376565b60008282101561466b5761466b614376565b500390565b6000821982111561468357614683614376565b500190565b600063ffffffff8083168181036146a1576146a1614376565b6001019392505050565b600081518084526020808501945080840160005b838110156146db578151875295820195908201906001016146bf565b509495945050505050565b600081518084526020808501945080840160005b838110156146db57815173ffffffffffffffffffffffffffffffffffffffff16875295820195908201906001016146fa565b85815260a06020820152600061474560a08301876146ab565b73ffffffffffffffffffffffffffffffffffffffff8087166040850152838203606085015261477482876146e6565b9250808516608085015250509695505050505050565b60006020828403121561479c57600080fd5b8151612d1481613aac565b600067ffffffffffffffff838116908316818110156143c2576143c2614376565b6000817fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff048311821515161561480057614800614376565b500290565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601260045260246000fd5b60008261484357614843614805565b500490565b6020815281516020820152602082015160408201526000604083015160c0606084015261487860e08401826146ab565b905063ffffffff606085015116608084015273ffffffffffffffffffffffffffffffffffffffff60808501511660a084015260a08401517fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe08483030160c085015261235482826146e6565b6000826148f2576148f2614805565b500690565b60008251614909818460208701613ce5565b9190910192915050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052602160045260246000fdfea2646970667358221220fe93404bbfbcfdac61818feaefbc57a6d13f70410291a528f51f7c3e7197c79f64736f6c634300080d0033", + "deployedBytecode": "0x6080604052600436106101dc5760003560e01c806389a153cc11610102578063e190440211610095578063f06850f611610064578063f06850f61461065c578063f500697c14610689578063fbbba9ac146106a9578063ffc351a3146106c957600080fd5b8063e1904402146105a6578063e282d5b9146105d3578063e3229211146105f3578063ee2a53f81461062757600080fd5b8063ac9650d8116100d1578063ac9650d814610503578063b27a430014610523578063c894c0ca14610566578063de7eba781461058657600080fd5b806389a153cc146104775780638a7860ce146104975780639a8a0592146104b7578063a1244c67146104ca57600080fd5b80633cb747bf1161017a5780635249fef1116101495780635249fef1146103985780635285e058146103e357806357f6dcb814610410578063766e07031461045a57600080fd5b80633cb747bf146103045780633fc8cef3146103315780634922897814610365578063493a4f841461037857600080fd5b806322f8e566116101b657806322f8e56614610281578063272751c7146102a15780632752042e146102c157806329cb924d146102e157600080fd5b80630eaac9f0146101e85780631c39c38d1461020a5780631dfb2d021461026157600080fd5b366101e357005b600080fd5b3480156101f457600080fd5b50610208610203366004613a2e565b6106e9565b005b34801561021657600080fd5b506001546102379073ffffffffffffffffffffffffffffffffffffffff1681565b60405173ffffffffffffffffffffffffffffffffffffffff90911681526020015b60405180910390f35b34801561026d57600080fd5b5061020861027c366004613a76565b6107c9565b34801561028d57600080fd5b5061020861029c366004613a93565b610853565b3480156102ad57600080fd5b506102086102bc366004613aba565b6108fc565b3480156102cd57600080fd5b506102086102dc366004613a2e565b610a13565b3480156102ed57600080fd5b506102f6610b14565b604051908152602001610258565b34801561031057600080fd5b506000546102379073ffffffffffffffffffffffffffffffffffffffff1681565b34801561033d57600080fd5b506102377f000000000000000000000000000000000000000000000000000000000000000081565b610208610373366004613b14565b610bd0565b34801561038457600080fd5b50610208610393366004613b7e565b611037565b3480156103a457600080fd5b506103d36103b3366004613ba0565b600460209081526000928352604080842090915290825290205460ff1681565b6040519015158152602001610258565b3480156103ef57600080fd5b506002546102379073ffffffffffffffffffffffffffffffffffffffff1681565b34801561041c57600080fd5b506003546104459074010000000000000000000000000000000000000000900463ffffffff1681565b60405163ffffffff9091168152602001610258565b34801561046657600080fd5b506007546104459063ffffffff1681565b34801561048357600080fd5b50610208610492366004613bcc565b61115e565b3480156104a357600080fd5b506102086104b2366004613a93565b6112ba565b3480156104c357600080fd5b50466102f6565b3480156104d657600080fd5b50600354610445907801000000000000000000000000000000000000000000000000900463ffffffff1681565b610516610511366004613c70565b61138e565b6040516102589190613d5b565b34801561052f57600080fd5b5061023761053e366004613a76565b60086020526000908152604090205473ffffffffffffffffffffffffffffffffffffffff1681565b34801561057257600080fd5b50610208610581366004613f75565b611568565b34801561059257600080fd5b506102086105a1366004613a76565b61164b565b3480156105b257600080fd5b506003546102379073ffffffffffffffffffffffffffffffffffffffff1681565b3480156105df57600080fd5b506102086105ee366004614108565b611691565b3480156105ff57600080fd5b506102377f000000000000000000000000000000000000000000000000000000000000000081565b34801561063357600080fd5b50610647610642366004613a93565b6117ef565b60408051928352602083019190915201610258565b34801561066857600080fd5b506102f6610677366004613a93565b60066020526000908152604090205481565b34801561069557600080fd5b506102086106a4366004614179565b61181d565b3480156106b557600080fd5b506102086106c4366004614246565b611904565b3480156106d557600080fd5b506102086106e436600461427f565b6119fd565b6106f1611b68565b6106f9611da1565b610726600180547fffffffffffffffffffffff00ffffffffffffffffffffffffffffffffffffffff169055565b600780547fffffffffffffffffffffffffffffffffffffffffffffffffffffffff000000001663ffffffff83169081179091556040517fe486a5c4bd7b36eabbfe274c99b39130277417be8d2209b4dae04c4fba64ee3a90600090a26107c6600180547fffffffffffffffffffffff00ffffffffffffffffffffffffffffffffffffffff1674010000000000000000000000000000000000000000179055565b50565b6107d1611b68565b6107d9611da1565b610806600180547fffffffffffffffffffffff00ffffffffffffffffffffffffffffffffffffffff169055565b61080f81611e27565b6107c6600180547fffffffffffffffffffffff00ffffffffffffffffffffffffffffffffffffffff1674010000000000000000000000000000000000000000179055565b60015473ffffffffffffffffffffffffffffffffffffffff1661087557600080fd5b6001546040517f22f8e5660000000000000000000000000000000000000000000000000000000081526004810183905273ffffffffffffffffffffffffffffffffffffffff909116906322f8e56690602401600060405180830381600087803b1580156108e157600080fd5b505af11580156108f5573d6000803e3d6000fd5b5050505050565b610904611b68565b61090c611da1565b610939600180547fffffffffffffffffffffff00ffffffffffffffffffffffffffffffffffffffff169055565b73ffffffffffffffffffffffffffffffffffffffff8316600081815260046020908152604080832086845282529182902080547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff001685151590811790915591519182528492917f0a21fdd43d0ad0c62689ee7230a47309a050755bcc52eba00310add65297692a910160405180910390a3610a0e600180547fffffffffffffffffffffff00ffffffffffffffffffffffffffffffffffffffff1674010000000000000000000000000000000000000000179055565b505050565b610a1b611b68565b610a23611da1565b610a50600180547fffffffffffffffffffffff00ffffffffffffffffffffffffffffffffffffffff169055565b600380547fffffffffffffffff00000000ffffffffffffffffffffffffffffffffffffffff167401000000000000000000000000000000000000000063ffffffff8416908102919091179091556040519081527f0e55dd180fa793d9036c804d0a116e6a7617a48e72cee1f83d92793a793fcc039060200160405180910390a16107c6600180547fffffffffffffffffffffff00ffffffffffffffffffffffffffffffffffffffff1674010000000000000000000000000000000000000000179055565b60015460009073ffffffffffffffffffffffffffffffffffffffff1615610bcb57600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166329cb924d6040518163ffffffff1660e01b8152600401602060405180830381865afa158015610ba2573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610bc6919061435d565b905090565b504290565b610bd8611da1565b610c05600180547fffffffffffffffffffffff00ffffffffffffffffffffffffffffffffffffffff169055565b73ffffffffffffffffffffffffffffffffffffffff8516600090815260046020908152604080832086845290915290205460ff16610ca4576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152600e60248201527f44697361626c656420726f75746500000000000000000000000000000000000060448201526064015b60405180910390fd5b6706f05b59d3b200008267ffffffffffffffff1610610d1f576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601360248201527f696e76616c69642072656c6179657220666565000000000000000000000000006044820152606401610c9b565b600354610d4a9074010000000000000000000000000000000000000000900463ffffffff16826143a5565b63ffffffff16610d58610b14565b10158015610d9d5750600354610d8c9074010000000000000000000000000000000000000000900463ffffffff16826143ca565b63ffffffff16610d9a610b14565b11155b610e03576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601260248201527f696e76616c69642071756f74652074696d6500000000000000000000000000006044820152606401610c9b565b7f000000000000000000000000000000000000000000000000000000000000000073ffffffffffffffffffffffffffffffffffffffff168573ffffffffffffffffffffffffffffffffffffffff16148015610e5e5750600034115b15610f5257833414610ecc576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601b60248201527f6d73672e76616c7565206d757374206d6174636820616d6f756e7400000000006044820152606401610c9b565b7f000000000000000000000000000000000000000000000000000000000000000073ffffffffffffffffffffffffffffffffffffffff1663d0e30db0346040518263ffffffff1660e01b81526004016000604051808303818588803b158015610f3457600080fd5b505af1158015610f48573d6000803e3d6000fd5b5050505050610f74565b610f7473ffffffffffffffffffffffffffffffffffffffff8616333087611f13565b610fab8446600354869086907801000000000000000000000000000000000000000000000000900463ffffffff16868b8d33611fef565b6001600360188282829054906101000a900463ffffffff16610fcd91906143ca565b92506101000a81548163ffffffff021916908363ffffffff16021790555061102f600180547fffffffffffffffffffffff00ffffffffffffffffffffffffffffffffffffffff1674010000000000000000000000000000000000000000179055565b505050505050565b61103f611b68565b611047611da1565b611074600180547fffffffffffffffffffffff00ffffffffffffffffffffffffffffffffffffffff169055565b60058054600181018255600091909152600381027f036b6384b5eca791c62761152d0c79bb0604c104a5fb6f4eb0703f3154bb3db181018490557f036b6384b5eca791c62761152d0c79bb0604c104a5fb6f4eb0703f3154bb3db001828155604080518581526020810185905263ffffffff8416917fc86ba04c55bc5eb2f2876b91c438849a296dbec7b08751c3074d92e04f0a77af910160405180910390a2505061115a600180547fffffffffffffffffffffff00ffffffffffffffffffffffffffffffffffffffff1674010000000000000000000000000000000000000000179055565b5050565b611166611da1565b611193600180547fffffffffffffffffffffff00ffffffffffffffffffffffffffffffffffffffff169055565b60006040518061012001604052808c73ffffffffffffffffffffffffffffffffffffffff1681526020018b73ffffffffffffffffffffffffffffffffffffffff1681526020018a73ffffffffffffffffffffffffffffffffffffffff1681526020018981526020018681526020016112084690565b81526020018567ffffffffffffffff1681526020018467ffffffffffffffff1681526020018363ffffffff168152509050600061124482612080565b9050600061125682848b8860006120b0565b905061126782828a8887600061235d565b5050506112ae600180547fffffffffffffffffffffff00ffffffffffffffffffffffffffffffffffffffff1674010000000000000000000000000000000000000000179055565b50505050505050505050565b6112c2611b68565b6112ca611da1565b6112f7600180547fffffffffffffffffffffff00ffffffffffffffffffffffffffffffffffffffff169055565b6005818154811061130a5761130a6143f2565b60009182526020822060039091020181815560010181905560405182917f3569b846531b754c99cb80df3f49cd72fa6fe106aaee5ab8e0caf35a9d7ce88d91a26107c6600180547fffffffffffffffffffffff00ffffffffffffffffffffffffffffffffffffffff1674010000000000000000000000000000000000000000179055565b606034156113f8576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601b60248201527f4f6e6c79206d756c746963616c6c207769746820302076616c756500000000006044820152606401610c9b565b8167ffffffffffffffff81111561141157611411613ddb565b60405190808252806020026020018201604052801561144457816020015b606081526020019060019003908161142f5790505b50905060005b828110156115615760008030868685818110611468576114686143f2565b905060200281019061147a9190614421565b604051611488929190614486565b600060405180830381855af49150503d80600081146114c3576040519150601f19603f3d011682016040523d82523d6000602084013e6114c8565b606091505b50915091508161152e576044815110156114e157600080fd5b600481019050808060200190518101906114fb9190614496565b6040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610c9b9190614504565b80848481518110611541576115416143f2565b60200260200101819052505050808061155990614517565b91505061144a565b5092915050565b611570611da1565b61159d600180547fffffffffffffffffffffff00ffffffffffffffffffffffffffffffffffffffff169055565b7f000000000000000000000000000000000000000000000000000000000000000073ffffffffffffffffffffffffffffffffffffffff16826080015173ffffffffffffffffffffffffffffffffffffffff16036115fc576115fc612492565b611607838383612500565b610a0e600180547fffffffffffffffffffffff00ffffffffffffffffffffffffffffffffffffffff1674010000000000000000000000000000000000000000179055565b611653611b68565b61165b611da1565b611688600180547fffffffffffffffffffffff00ffffffffffffffffffffffffffffffffffffffff169055565b61080f816128c6565b611699611da1565b6116c6600180547fffffffffffffffffffffff00ffffffffffffffffffffffffffffffffffffffff169055565b6706f05b59d3b200008367ffffffffffffffff1610611741576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601360248201527f696e76616c69642072656c6179657220666565000000000000000000000000006044820152606401610c9b565b61174e84468585856129b2565b8373ffffffffffffffffffffffffffffffffffffffff168263ffffffff167fb9de16bf376724405019a10ef4fedac57fecd292bf86c08d81d7c42d394d5d37858460405161179d92919061454f565b60405180910390a36117e9600180547fffffffffffffffffffffff00ffffffffffffffffffffffffffffffffffffffff1674010000000000000000000000000000000000000000179055565b50505050565b600581815481106117ff57600080fd5b60009182526020909120600390910201805460019091015490915082565b611825611da1565b611852600180547fffffffffffffffffffffff00ffffffffffffffffffffffffffffffffffffffff169055565b7f000000000000000000000000000000000000000000000000000000000000000073ffffffffffffffffffffffffffffffffffffffff168873ffffffffffffffffffffffffffffffffffffffff16036118ad576118ad612492565b6118c08a8a8a8a8a468b8b8b8b8b612a4f565b6112ae600180547fffffffffffffffffffffff00ffffffffffffffffffffffffffffffffffffffff1674010000000000000000000000000000000000000000179055565b61190c611b68565b611914611da1565b611941600180547fffffffffffffffffffffff00ffffffffffffffffffffffffffffffffffffffff169055565b73ffffffffffffffffffffffffffffffffffffffff82811660008181526008602052604080822080547fffffffffffffffffffffffff0000000000000000000000000000000000000000169486169485179055517ff3dc137d2246f9b8abd0bb821e185ba01122c9b3ea3745ffca6208037674d6709190a361115a600180547fffffffffffffffffffffff00ffffffffffffffffffffffffffffffffffffffff1674010000000000000000000000000000000000000000179055565b611a05611da1565b611a32600180547fffffffffffffffffffffff00ffffffffffffffffffffffffffffffffffffffff169055565b611a3f8c878585856129b2565b60006040518061012001604052808e73ffffffffffffffffffffffffffffffffffffffff1681526020018d73ffffffffffffffffffffffffffffffffffffffff1681526020018c73ffffffffffffffffffffffffffffffffffffffff1681526020018b8152602001888152602001611ab44690565b81526020018767ffffffffffffffff1681526020018667ffffffffffffffff1681526020018463ffffffff1681525090506000611af082612080565b90506000611b0282848d8960006120b0565b9050611b1382828c8987600061235d565b505050611b5a600180547fffffffffffffffffffffff00ffffffffffffffffffffffffffffffffffffffff1674010000000000000000000000000000000000000000179055565b505050505050505050505050565b60025473ffffffffffffffffffffffffffffffffffffffff16611ba060005473ffffffffffffffffffffffffffffffffffffffff1690565b73ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614611c5a576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602e60248201527f4f564d5f58434841494e3a206d657373656e67657220636f6e7472616374207560448201527f6e61757468656e746963617465640000000000000000000000000000000000006064820152608401610c9b565b8073ffffffffffffffffffffffffffffffffffffffff16611c9060005473ffffffffffffffffffffffffffffffffffffffff1690565b73ffffffffffffffffffffffffffffffffffffffff16636e296e456040518163ffffffff1660e01b8152600401602060405180830381865afa158015611cda573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611cfe9190614572565b73ffffffffffffffffffffffffffffffffffffffff16146107c6576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152603060248201527f4f564d5f58434841494e3a2077726f6e672073656e646572206f662063726f7360448201527f732d646f6d61696e206d657373616765000000000000000000000000000000006064820152608401610c9b565b60015474010000000000000000000000000000000000000000900460ff16611e25576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601f60248201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c006044820152606401610c9b565b565b73ffffffffffffffffffffffffffffffffffffffff8116611ea4576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601460248201527f4261642068756220706f6f6c20616464726573730000000000000000000000006044820152606401610c9b565b600380547fffffffffffffffffffffffff00000000000000000000000000000000000000001673ffffffffffffffffffffffffffffffffffffffff83169081179091556040517f1f17a88f67b0f49060a34bec1a4723a563620e6aa265eb640b5046dcee0759a090600090a250565b60405173ffffffffffffffffffffffffffffffffffffffff808516602483015283166044820152606481018290526117e99085907f23b872dd00000000000000000000000000000000000000000000000000000000906084015b604080517fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe08184030181529190526020810180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff167fffffffff0000000000000000000000000000000000000000000000000000000090931692909217909152612bce565b604080518a8152602081018a905290810188905267ffffffffffffffff8716606082015263ffffffff858116608083015273ffffffffffffffffffffffffffffffffffffffff84811660a084015280841692908616918816907f4a4fc49abd237bfd7f4ac82d6c7a284c69daaea5154430cff04ad7482c6c42549060c00160405180910390a4505050505050505050565b600081604051602001612093919061458f565b604051602081830303815290604052805190602001209050919050565b60006706f05b59d3b200008367ffffffffffffffff161080156120e857506706f05b59d3b200008560c0015167ffffffffffffffff16105b61214e576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152600c60248201527f696e76616c6964206665657300000000000000000000000000000000000000006044820152606401610c9b565b6060850151600087815260066020526040902054106121c9576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152600c60248201527f72656c61792066696c6c656400000000000000000000000000000000000000006044820152606401610c9b565b836000036121d957506000612354565b6121f284848760c001516121ed9190614636565b612cda565b600087815260066020526040812054606088015192935086926122159190614659565b90508281101561223e5780925061223b83868960c001516122369190614636565b612d1b565b91505b6000888152600660205260408120805485929061225c908490614670565b9091555050604087015173ffffffffffffffffffffffffffffffffffffffff7f000000000000000000000000000000000000000000000000000000000000000081169116036122e457836122d15760408701516122d19073ffffffffffffffffffffffffffffffffffffffff16333085611f13565b6122df876020015183612d44565b612351565b8361231e576122df338860200151848a6040015173ffffffffffffffffffffffffffffffffffffffff16611f13909392919063ffffffff16565b612351876020015183896040015173ffffffffffffffffffffffffffffffffffffffff16612e859092919063ffffffff16565b50505b95945050505050565b816000015173ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16877f1d59c1d19baf4b4de03cec9c844258e7ca2f2004975025eb14fe9a5e1d4e0d888560600151600660008c8152602001908152602001600020548a8a89608001518a60a001518c8c60c001518d61010001518e604001518f602001518f6040516124829c9b9a999897969594939291909b8c5260208c019a909a5260408b019890985260608a0196909652608089019490945260a088019290925267ffffffffffffffff90811660c08801521660e086015263ffffffff1661010085015273ffffffffffffffffffffffffffffffffffffffff9081166101208501521661014083015215156101608201526101800190565b60405180910390a4505050505050565b4715611e25577f000000000000000000000000000000000000000000000000000000000000000073ffffffffffffffffffffffffffffffffffffffff1663d0e30db0476040518263ffffffff1660e01b81526004016000604051808303818588803b1580156108e157600080fd5b4682602001511461256d576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152600f60248201527f496e76616c696420636861696e496400000000000000000000000000000000006044820152606401610c9b565b8160400151518260a0015151146125e0576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152600c60248201527f696e76616c6964206c65616600000000000000000000000000000000000000006044820152606401610c9b565b600060058463ffffffff16815481106125fb576125fb6143f2565b9060005260206000209060030201905061261a81600101548484612edb565b612680576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152600960248201527f4261642050726f6f6600000000000000000000000000000000000000000000006044820152606401610c9b565b61269781600201846060015163ffffffff16612f16565b156126fe576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152600f60248201527f416c726561647920636c61696d656400000000000000000000000000000000006044820152606401610c9b565b61271581600201846060015163ffffffff16612f57565b60005b8360400151518163ffffffff1610156127c157600084604001518263ffffffff1681518110612749576127496143f2565b6020026020010151905060008111156127ae576127ae8560a001518363ffffffff168151811061277b5761277b6143f2565b602002602001015182876080015173ffffffffffffffffffffffffffffffffffffffff16612e859092919063ffffffff16565b50806127b981614688565b915050612718565b5082511561285a576127d283612f95565b826080015173ffffffffffffffffffffffffffffffffffffffff16836060015163ffffffff1684602001517f828fc203220356df8f072a91681caee7d5c75095e2a95e80ed5a14b384697f7186600001513360405161285192919091825273ffffffffffffffffffffffffffffffffffffffff16602082015260400190565b60405180910390a45b826060015163ffffffff168463ffffffff1684602001517ff8bd640004bcec1b89657020f561d0b070cbdf662d0b158db9dccb0a8301bfab8660000151876040015188608001518960a00151336040516128b895949392919061472c565b60405180910390a450505050565b73ffffffffffffffffffffffffffffffffffffffff8116612943576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601960248201527f4261642062726964676520726f757465722061646472657373000000000000006044820152606401610c9b565b600280547fffffffffffffffffffffffff00000000000000000000000000000000000000001673ffffffffffffffffffffffffffffffffffffffff83169081179091556040517fa9e8c42c9e7fca7f62755189a16b2f5314d43d8fb24e91ba54e6d65f9314e84990600090a250565b60408051608060208201819052601160a08301527f4143524f53532d56322d4645452d312e3000000000000000000000000000000060c083015267ffffffffffffffff86169282019290925263ffffffff8416606082015290810185905260009060e0016040516020818303038152906040528051906020012090506000612a398261325a565b9050612a46878285613295565b50505050505050565b60006040518061012001604052808d73ffffffffffffffffffffffffffffffffffffffff1681526020018c73ffffffffffffffffffffffffffffffffffffffff1681526020018b73ffffffffffffffffffffffffffffffffffffffff1681526020018a81526020018981526020018881526020018767ffffffffffffffff1681526020018667ffffffffffffffff1681526020018563ffffffff168152509050612b2460058463ffffffff1681548110612b0b57612b0b6143f2565b9060005260206000209060030201600001548284613333565b612b8a576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152600d60248201527f496e76616c69642070726f6f66000000000000000000000000000000000000006044820152606401610c9b565b6000612b9582612080565b90506000612bac82848560600151600060016120b0565b9050612bbe828260008087600161235d565b5050505050505050505050505050565b6000612c30826040518060400160405280602081526020017f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c65648152508573ffffffffffffffffffffffffffffffffffffffff1661334b9092919063ffffffff16565b805190915015610a0e5780806020019051810190612c4e919061478a565b610a0e576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602a60248201527f5361666545524332303a204552433230206f7065726174696f6e20646964206e60448201527f6f742073756363656564000000000000000000000000000000000000000000006064820152608401610c9b565b6000612cee82670de0b6b3a76400006147a7565b67ffffffffffffffff16612d0a84670de0b6b3a76400006147c8565b612d149190614834565b9392505050565b6000670de0b6b3a7640000612d3083826147a7565b612d0a9067ffffffffffffffff16856147c8565b73ffffffffffffffffffffffffffffffffffffffff82163b15612da25761115a73ffffffffffffffffffffffffffffffffffffffff7f0000000000000000000000000000000000000000000000000000000000000000168383612e85565b6040517f2e1a7d4d000000000000000000000000000000000000000000000000000000008152600481018290527f000000000000000000000000000000000000000000000000000000000000000073ffffffffffffffffffffffffffffffffffffffff1690632e1a7d4d90602401600060405180830381600087803b158015612e2a57600080fd5b505af1158015612e3e573d6000803e3d6000fd5b505060405173ffffffffffffffffffffffffffffffffffffffff8516925083156108fc02915083906000818181858888f19350505050158015610a0e573d6000803e3d6000fd5b60405173ffffffffffffffffffffffffffffffffffffffff8316602482015260448101829052610a0e9084907fa9059cbb0000000000000000000000000000000000000000000000000000000090606401611f6d565b6000612f0e828585604051602001612ef39190614848565b6040516020818303038152906040528051906020012061335a565b949350505050565b600080612f2561010084614834565b90506000612f35610100856148e3565b6000928352602095909552506040902054600190931b92831690921492915050565b6000612f6561010083614834565b90506000612f75610100846148e3565b600092835260209490945250604090208054600190931b90921790915550565b7f000000000000000000000000000000000000000000000000000000000000000073ffffffffffffffffffffffffffffffffffffffff16816080015173ffffffffffffffffffffffffffffffffffffffff16036130b757608081015181516040517f2e1a7d4d00000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff90921691632e1a7d4d916130489160040190815260200190565b600060405180830381600087803b15801561306257600080fd5b505af1158015613076573d6000803e3d6000fd5b50505073ffffffffffffffffffffffffffffffffffffffff7f0000000000000000000000000000000000000000000000000000000000000000166080830152505b608081015173ffffffffffffffffffffffffffffffffffffffff908116600090815260086020526040902054161561311b57608081015173ffffffffffffffffffffffffffffffffffffffff90811660009081526008602052604090205416613131565b7342000000000000000000000000000000000000105b608082015160035483516007546040517fa3a7954800000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff94851660048201529284166024840152604483019190915263ffffffff16606482015260a06084820152600060a482015291169063a3a795489060c401600060405180830381600087803b1580156131d057600080fd5b505af11580156131e4573d6000803e3d6000fd5b50505050608081015160035482516007546040805173ffffffffffffffffffffffffffffffffffffffff9485168152602081019390935263ffffffff909116908201529116907f46b77e3c29797b94890fd3438da74f697480742358a3e26b9d13a227f1ac0ac99060600160405180910390a250565b6040517f19457468657265756d205369676e6564204d6573736167653a0a3332000000006020820152603c8101829052600090605c01612093565b61329f8282613370565b73ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614610a0e576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601160248201527f696e76616c6964207369676e61747572650000000000000000000000000000006044820152606401610c9b565b6000612f0e828585604051602001612ef3919061458f565b6060612f0e8484600085613394565b600082613367858461352a565b14949350505050565b600080600061337f8585613596565b9150915061338c81613604565b509392505050565b606082471015613426576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602660248201527f416464726573733a20696e73756666696369656e742062616c616e636520666f60448201527f722063616c6c00000000000000000000000000000000000000000000000000006064820152608401610c9b565b73ffffffffffffffffffffffffffffffffffffffff85163b6134a4576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e74726163740000006044820152606401610c9b565b6000808673ffffffffffffffffffffffffffffffffffffffff1685876040516134cd91906148f7565b60006040518083038185875af1925050503d806000811461350a576040519150601f19603f3d011682016040523d82523d6000602084013e61350f565b606091505b509150915061351f828286613858565b979650505050505050565b600081815b845181101561338c57600085828151811061354c5761354c6143f2565b602002602001015190508083116135725760008381526020829052604090209250613583565b600081815260208490526040902092505b508061358e81614517565b91505061352f565b60008082516041036135cc5760208301516040840151606085015160001a6135c0878285856138ab565b945094505050506135fd565b82516040036135f557602083015160408401516135ea8683836139c3565b9350935050506135fd565b506000905060025b9250929050565b600081600481111561361857613618614913565b036136205750565b600181600481111561363457613634614913565b0361369b576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601860248201527f45434453413a20696e76616c6964207369676e617475726500000000000000006044820152606401610c9b565b60028160048111156136af576136af614913565b03613716576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601f60248201527f45434453413a20696e76616c6964207369676e6174757265206c656e677468006044820152606401610c9b565b600381600481111561372a5761372a614913565b036137b7576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602260248201527f45434453413a20696e76616c6964207369676e6174757265202773272076616c60448201527f75650000000000000000000000000000000000000000000000000000000000006064820152608401610c9b565b60048160048111156137cb576137cb614913565b036107c6576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602260248201527f45434453413a20696e76616c6964207369676e6174757265202776272076616c60448201527f75650000000000000000000000000000000000000000000000000000000000006064820152608401610c9b565b60608315613867575081612d14565b8251156138775782518084602001fd5b816040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610c9b9190614504565b6000807f7fffffffffffffffffffffffffffffff5d576e7357a4501ddfe92f46681b20a08311156138e257506000905060036139ba565b8460ff16601b141580156138fa57508460ff16601c14155b1561390b57506000905060046139ba565b6040805160008082526020820180845289905260ff881692820192909252606081018690526080810185905260019060a0016020604051602081039080840390855afa15801561395f573d6000803e3d6000fd5b50506040517fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0015191505073ffffffffffffffffffffffffffffffffffffffff81166139b3576000600192509250506139ba565b9150600090505b94509492505050565b6000807f7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff8316816139f960ff86901c601b614670565b9050613a07878288856138ab565b935093505050935093915050565b803563ffffffff81168114613a2957600080fd5b919050565b600060208284031215613a4057600080fd5b612d1482613a15565b73ffffffffffffffffffffffffffffffffffffffff811681146107c657600080fd5b8035613a2981613a49565b600060208284031215613a8857600080fd5b8135612d1481613a49565b600060208284031215613aa557600080fd5b5035919050565b80151581146107c657600080fd5b600080600060608486031215613acf57600080fd5b8335613ada81613a49565b9250602084013591506040840135613af181613aac565b809150509250925092565b803567ffffffffffffffff81168114613a2957600080fd5b60008060008060008060c08789031215613b2d57600080fd5b8635613b3881613a49565b95506020870135613b4881613a49565b94506040870135935060608701359250613b6460808801613afc565b9150613b7260a08801613a15565b90509295509295509295565b60008060408385031215613b9157600080fd5b50508035926020909101359150565b60008060408385031215613bb357600080fd5b8235613bbe81613a49565b946020939093013593505050565b6000806000806000806000806000806101408b8d031215613bec57600080fd5b8a35613bf781613a49565b995060208b0135613c0781613a49565b985060408b0135613c1781613a49565b975060608b0135965060808b0135955060a08b0135945060c08b01359350613c4160e08c01613afc565b9250613c506101008c01613afc565b9150613c5f6101208c01613a15565b90509295989b9194979a5092959850565b60008060208385031215613c8357600080fd5b823567ffffffffffffffff80821115613c9b57600080fd5b818501915085601f830112613caf57600080fd5b813581811115613cbe57600080fd5b8660208260051b8501011115613cd357600080fd5b60209290920196919550909350505050565b60005b83811015613d00578181015183820152602001613ce8565b838111156117e95750506000910152565b60008151808452613d29816020860160208601613ce5565b601f017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0169290920160200192915050565b6000602080830181845280855180835260408601915060408160051b870101925083870160005b82811015613dce577fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc0888603018452613dbc858351613d11565b94509285019290850190600101613d82565b5092979650505050505050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b60405160c0810167ffffffffffffffff81118282101715613e2d57613e2d613ddb565b60405290565b604051601f82017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe016810167ffffffffffffffff81118282101715613e7a57613e7a613ddb565b604052919050565b600067ffffffffffffffff821115613e9c57613e9c613ddb565b5060051b60200190565b600082601f830112613eb757600080fd5b81356020613ecc613ec783613e82565b613e33565b82815260059290921b84018101918181019086841115613eeb57600080fd5b8286015b84811015613f065780358352918301918301613eef565b509695505050505050565b600082601f830112613f2257600080fd5b81356020613f32613ec783613e82565b82815260059290921b84018101918181019086841115613f5157600080fd5b8286015b84811015613f06578035613f6881613a49565b8352918301918301613f55565b600080600060608486031215613f8a57600080fd5b613f9384613a15565b9250602084013567ffffffffffffffff80821115613fb057600080fd5b9085019060c08288031215613fc457600080fd5b613fcc613e0a565b8235815260208301356020820152604083013582811115613fec57600080fd5b613ff889828601613ea6565b60408301525061400a60608401613a15565b606082015261401b60808401613a6b565b608082015260a08301358281111561403257600080fd5b61403e89828601613f11565b60a0830152509350604086013591508082111561405a57600080fd5b5061406786828701613ea6565b9150509250925092565b600067ffffffffffffffff82111561408b5761408b613ddb565b50601f017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe01660200190565b600082601f8301126140c857600080fd5b81356140d6613ec782614071565b8181528460208386010111156140eb57600080fd5b816020850160208301376000918101602001919091529392505050565b6000806000806080858703121561411e57600080fd5b843561412981613a49565b935061413760208601613afc565b925061414560408601613a15565b9150606085013567ffffffffffffffff81111561416157600080fd5b61416d878288016140b7565b91505092959194509250565b6000806000806000806000806000806101408b8d03121561419957600080fd5b8a356141a481613a49565b995060208b01356141b481613a49565b985060408b01356141c481613a49565b975060608b0135965060808b013595506141e060a08c01613afc565b94506141ee60c08c01613afc565b93506141fc60e08c01613a15565b925061420b6101008c01613a15565b91506101208b013567ffffffffffffffff81111561422857600080fd5b6142348d828e01613ea6565b9150509295989b9194979a5092959850565b6000806040838503121561425957600080fd5b823561426481613a49565b9150602083013561427481613a49565b809150509250929050565b6000806000806000806000806000806000806101808d8f0312156142a257600080fd5b6142ab8d613a6b565b9b506142b960208e01613a6b565b9a506142c760408e01613a6b565b995060608d0135985060808d0135975060a08d0135965060c08d013595506142f160e08e01613afc565b94506143006101008e01613afc565b935061430f6101208e01613afc565b925061431e6101408e01613a15565b915067ffffffffffffffff6101608e0135111561433a57600080fd5b61434b8e6101608f01358f016140b7565b90509295989b509295989b509295989b565b60006020828403121561436f57600080fd5b5051919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b600063ffffffff838116908316818110156143c2576143c2614376565b039392505050565b600063ffffffff8083168185168083038211156143e9576143e9614376565b01949350505050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b60008083357fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe184360301811261445657600080fd5b83018035915067ffffffffffffffff82111561447157600080fd5b6020019150368190038213156135fd57600080fd5b8183823760009101908152919050565b6000602082840312156144a857600080fd5b815167ffffffffffffffff8111156144bf57600080fd5b8201601f810184136144d057600080fd5b80516144de613ec782614071565b8181528560208385010111156144f357600080fd5b612354826020830160208601613ce5565b602081526000612d146020830184613d11565b60007fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff820361454857614548614376565b5060010190565b67ffffffffffffffff83168152604060208201526000612f0e6040830184613d11565b60006020828403121561458457600080fd5b8151612d1481613a49565b815173ffffffffffffffffffffffffffffffffffffffff90811682526020808401518216908301526040808401519182169083015261012082019050606083015160608301526080830151608083015260a083015160a083015260c083015161460460c084018267ffffffffffffffff169052565b5060e083015161462060e084018267ffffffffffffffff169052565b506101009283015163ffffffff16919092015290565b600067ffffffffffffffff8083168185168083038211156143e9576143e9614376565b60008282101561466b5761466b614376565b500390565b6000821982111561468357614683614376565b500190565b600063ffffffff8083168181036146a1576146a1614376565b6001019392505050565b600081518084526020808501945080840160005b838110156146db578151875295820195908201906001016146bf565b509495945050505050565b600081518084526020808501945080840160005b838110156146db57815173ffffffffffffffffffffffffffffffffffffffff16875295820195908201906001016146fa565b85815260a06020820152600061474560a08301876146ab565b73ffffffffffffffffffffffffffffffffffffffff8087166040850152838203606085015261477482876146e6565b9250808516608085015250509695505050505050565b60006020828403121561479c57600080fd5b8151612d1481613aac565b600067ffffffffffffffff838116908316818110156143c2576143c2614376565b6000817fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff048311821515161561480057614800614376565b500290565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601260045260246000fd5b60008261484357614843614805565b500490565b6020815281516020820152602082015160408201526000604083015160c0606084015261487860e08401826146ab565b905063ffffffff606085015116608084015273ffffffffffffffffffffffffffffffffffffffff60808501511660a084015260a08401517fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe08483030160c085015261235482826146e6565b6000826148f2576148f2614805565b500690565b60008251614909818460208701613ce5565b9190910192915050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052602160045260246000fdfea2646970667358221220fe93404bbfbcfdac61818feaefbc57a6d13f70410291a528f51f7c3e7197c79f64736f6c634300080d0033", "devdoc": { "kind": "dev", "methods": { @@ -1214,14 +1239,20 @@ "relayerFeePct": "% of deposit amount taken out to incentivize a fast relayer." } }, + "emergencyDeleteRootBundle(uint256)": { + "params": { + "rootBundleId": "Index of the root bundle that needs to be deleted. Note: this is intentionally a uint256 to ensure that a small input range doesn't limit which indices this method is able to reach." + } + }, "executeRelayerRefundRoot(uint32,(uint256,uint256,uint256[],uint32,address,address[]),bytes32[])": { "params": { "proof": "Inclusion proof for this leaf in relayer refund root in root bundle.", - "relayerRefundLeaf": "Contains all data neccessary to reconstruct leaf contained in root bundle and to refund relayer. This data structure is explained in detail in the SpokePoolInterface.", + "relayerRefundLeaf": "Contains all data necessary to reconstruct leaf contained in root bundle and to refund relayer. This data structure is explained in detail in the SpokePoolInterface.", "rootBundleId": "Unique ID of root bundle containing relayer refund root that this leaf is contained in." } }, "executeSlowRelayRoot(address,address,address,uint256,uint256,uint64,uint64,uint32,uint32,bytes32[])": { + "details": "This function assumes that the relay's destination chain ID is the current chain ID, which prevents the caller from executing a slow relay intended for another chain on this chain.", "params": { "amount": "Full size of the deposit.", "depositId": "Unique deposit ID on origin spoke pool.", @@ -1338,6 +1369,9 @@ "deposit(address,address,uint256,uint256,uint64,uint32)": { "notice": "Called by user to bridge funds from origin to destination chain. Depositor will effectively lock tokens in this contract and receive a destination token on the destination chain. The origin => destination token mapping is stored on the L1 HubPool.The caller must first approve this contract to spend amount of originToken.The originToken => destinationChainId must be enabled.This method is payable because the caller is able to deposit ETH if the originToken is WETH and this function will handle wrapping ETH." }, + "emergencyDeleteRootBundle(uint256)": { + "notice": "This method is intended to only be used in emergencies where a bad root bundle has reached the SpokePool." + }, "executeRelayerRefundRoot(uint32,(uint256,uint256,uint256[],uint32,address,address[]),bytes32[])": { "notice": "Wraps any ETH into WETH before executing base function. This is necessary because SpokePool receives ETH over the canonical token bridge instead of WETH." }, @@ -1345,7 +1379,7 @@ "notice": "Wraps any ETH into WETH before executing base function. This is necessary because SpokePool receives ETH over the canonical token bridge instead of WETH." }, "fillRelay(address,address,address,uint256,uint256,uint256,uint256,uint64,uint64,uint32)": { - "notice": "Called by relayer to fulfill part of a deposit by sending destination tokens to the receipient. Relayer is expected to pass in unique identifying information for deposit that they want to fulfill, and this relay submission will be validated by off-chain data workers who can dispute this relay if any part is invalid. If the relay is valid, then the relayer will be refunded on their desired repayment chain. If relay is invalid, then relayer will not receive any refund.All of the deposit data can be found via on-chain events from the origin SpokePool, except for the realizedLpFeePct which is a function of the HubPool's utilization at the deposit quote time. This fee % is deterministic based on the quote time, so the relayer should just compute it using the canonical algorithm as described in a UMIP linked to the HubPool's identifier." + "notice": "Called by relayer to fulfill part of a deposit by sending destination tokens to the recipient. Relayer is expected to pass in unique identifying information for deposit that they want to fulfill, and this relay submission will be validated by off-chain data workers who can dispute this relay if any part is invalid. If the relay is valid, then the relayer will be refunded on their desired repayment chain. If relay is invalid, then relayer will not receive any refund.All of the deposit data can be found via on-chain events from the origin SpokePool, except for the realizedLpFeePct which is a function of the HubPool's utilization at the deposit quote time. This fee % is deterministic based on the quote time, so the relayer should just compute it using the canonical algorithm as described in a UMIP linked to the HubPool's identifier." }, "fillRelayWithUpdatedFee(address,address,address,uint256,uint256,uint256,uint256,uint64,uint64,uint64,uint32,bytes)": { "notice": "Called by relayer to execute same logic as calling fillRelay except that relayer is using an updated relayer fee %. The fee % must have been emitted in a message cryptographically signed by the depositor.By design, the depositor probably emitted the message with the updated fee by calling speedUpRelay()." @@ -1395,7 +1429,7 @@ "type": "t_address" }, { - "astId": 5884, + "astId": 5790, "contract": "contracts/Optimism_SpokePool.sol:Optimism_SpokePool", "label": "timerAddress", "offset": 0, @@ -1403,7 +1437,7 @@ "type": "t_address" }, { - "astId": 7106, + "astId": 7084, "contract": "contracts/Optimism_SpokePool.sol:Optimism_SpokePool", "label": "_notEntered", "offset": 20, @@ -1411,7 +1445,7 @@ "type": "t_bool" }, { - "astId": 8192, + "astId": 8179, "contract": "contracts/Optimism_SpokePool.sol:Optimism_SpokePool", "label": "crossDomainAdmin", "offset": 0, @@ -1419,7 +1453,7 @@ "type": "t_address" }, { - "astId": 8194, + "astId": 8181, "contract": "contracts/Optimism_SpokePool.sol:Optimism_SpokePool", "label": "hubPool", "offset": 0, @@ -1427,83 +1461,59 @@ "type": "t_address" }, { - "astId": 8197, - "contract": "contracts/Optimism_SpokePool.sol:Optimism_SpokePool", - "label": "weth", - "offset": 0, - "slot": "4", - "type": "t_contract(WETH9)10662" - }, - { - "astId": 8199, - "contract": "contracts/Optimism_SpokePool.sol:Optimism_SpokePool", - "label": "deploymentTime", - "offset": 20, - "slot": "4", - "type": "t_uint32" - }, - { - "astId": 8202, + "astId": 8187, "contract": "contracts/Optimism_SpokePool.sol:Optimism_SpokePool", "label": "depositQuoteTimeBuffer", - "offset": 24, - "slot": "4", + "offset": 20, + "slot": "3", "type": "t_uint32" }, { - "astId": 8204, + "astId": 8189, "contract": "contracts/Optimism_SpokePool.sol:Optimism_SpokePool", "label": "numberOfDeposits", - "offset": 28, - "slot": "4", + "offset": 24, + "slot": "3", "type": "t_uint32" }, { - "astId": 8210, + "astId": 8195, "contract": "contracts/Optimism_SpokePool.sol:Optimism_SpokePool", "label": "enabledDepositRoutes", "offset": 0, - "slot": "5", + "slot": "4", "type": "t_mapping(t_address,t_mapping(t_uint256,t_bool))" }, { - "astId": 8223, + "astId": 8199, "contract": "contracts/Optimism_SpokePool.sol:Optimism_SpokePool", "label": "rootBundles", "offset": 0, - "slot": "6", - "type": "t_array(t_struct(RootBundle)8219_storage)dyn_storage" + "slot": "5", + "type": "t_array(t_struct(RootBundle)9627_storage)dyn_storage" }, { - "astId": 8227, + "astId": 8203, "contract": "contracts/Optimism_SpokePool.sol:Optimism_SpokePool", "label": "relayFills", "offset": 0, - "slot": "7", + "slot": "6", "type": "t_mapping(t_bytes32,t_uint256)" }, { - "astId": 7497, + "astId": 7472, "contract": "contracts/Optimism_SpokePool.sol:Optimism_SpokePool", "label": "l1Gas", "offset": 0, - "slot": "8", + "slot": "7", "type": "t_uint32" }, { - "astId": 7504, - "contract": "contracts/Optimism_SpokePool.sol:Optimism_SpokePool", - "label": "l2Eth", - "offset": 4, - "slot": "8", - "type": "t_address" - }, - { - "astId": 7508, + "astId": 7483, "contract": "contracts/Optimism_SpokePool.sol:Optimism_SpokePool", "label": "tokenBridges", "offset": 0, - "slot": "9", + "slot": "8", "type": "t_mapping(t_address,t_address)" } ], @@ -1513,10 +1523,10 @@ "label": "address", "numberOfBytes": "20" }, - "t_array(t_struct(RootBundle)8219_storage)dyn_storage": { - "base": "t_struct(RootBundle)8219_storage", + "t_array(t_struct(RootBundle)9627_storage)dyn_storage": { + "base": "t_struct(RootBundle)9627_storage", "encoding": "dynamic_array", - "label": "struct SpokePool.RootBundle[]", + "label": "struct SpokePoolInterface.RootBundle[]", "numberOfBytes": "32" }, "t_bool": { @@ -1529,11 +1539,6 @@ "label": "bytes32", "numberOfBytes": "32" }, - "t_contract(WETH9)10662": { - "encoding": "inplace", - "label": "contract WETH9", - "numberOfBytes": "20" - }, "t_mapping(t_address,t_address)": { "encoding": "mapping", "key": "t_address", @@ -1569,12 +1574,12 @@ "numberOfBytes": "32", "value": "t_uint256" }, - "t_struct(RootBundle)8219_storage": { + "t_struct(RootBundle)9627_storage": { "encoding": "inplace", - "label": "struct SpokePool.RootBundle", + "label": "struct SpokePoolInterface.RootBundle", "members": [ { - "astId": 8212, + "astId": 9620, "contract": "contracts/Optimism_SpokePool.sol:Optimism_SpokePool", "label": "slowRelayRoot", "offset": 0, @@ -1582,7 +1587,7 @@ "type": "t_bytes32" }, { - "astId": 8214, + "astId": 9622, "contract": "contracts/Optimism_SpokePool.sol:Optimism_SpokePool", "label": "relayerRefundRoot", "offset": 0, @@ -1590,7 +1595,7 @@ "type": "t_bytes32" }, { - "astId": 8218, + "astId": 9626, "contract": "contracts/Optimism_SpokePool.sol:Optimism_SpokePool", "label": "claimedBitmap", "offset": 0, diff --git a/deployments/optimism-kovan/solcInputs/d3cc7d49c45bf725b6aea61557b961e9.json b/deployments/optimism-kovan/solcInputs/c8b9349311d8b5049b613ac98eb998d0.json similarity index 64% rename from deployments/optimism-kovan/solcInputs/d3cc7d49c45bf725b6aea61557b961e9.json rename to deployments/optimism-kovan/solcInputs/c8b9349311d8b5049b613ac98eb998d0.json index 572746276..dfb09219e 100644 --- a/deployments/optimism-kovan/solcInputs/d3cc7d49c45bf725b6aea61557b961e9.json +++ b/deployments/optimism-kovan/solcInputs/c8b9349311d8b5049b613ac98eb998d0.json @@ -2,20 +2,23 @@ "language": "Solidity", "sources": { "contracts/Arbitrum_SpokePool.sol": { - "content": "// SPDX-License-Identifier: GPL-3.0-only\npragma solidity ^0.8.0;\n\nimport \"./SpokePool.sol\";\nimport \"./SpokePoolInterface.sol\";\n\ninterface StandardBridgeLike {\n function outboundTransfer(\n address _l1Token,\n address _to,\n uint256 _amount,\n bytes calldata _data\n ) external payable returns (bytes memory);\n}\n\n/**\n * @notice AVM specific SpokePool. Uses AVM cross-domain-enabled logic to implement admin only access to functions.\n */\ncontract Arbitrum_SpokePool is SpokePool {\n // Address of the Arbitrum L2 token gateway to send funds to L1.\n address public l2GatewayRouter;\n\n // Admin controlled mapping of arbitrum tokens to L1 counterpart. L1 counterpart addresses\n // are neccessary params used when bridging tokens to L1.\n mapping(address => address) public whitelistedTokens;\n\n event ArbitrumTokensBridged(address indexed l1Token, address target, uint256 numberOfTokensBridged);\n event SetL2GatewayRouter(address indexed newL2GatewayRouter);\n event WhitelistedTokens(address indexed l2Token, address indexed l1Token);\n\n /**\n * @notice Construct the AVM SpokePool.\n * @param _l2GatewayRouter Address of L2 token gateway. Can be reset by admin.\n * @param _crossDomainAdmin Cross domain admin to set. Can be changed by admin.\n * @param _hubPool Hub pool address to set. Can be changed by admin.\n * @param _wethAddress Weth address for this network to set.\n * @param timerAddress Timer address to set.\n */\n constructor(\n address _l2GatewayRouter,\n address _crossDomainAdmin,\n address _hubPool,\n address _wethAddress,\n address timerAddress\n ) SpokePool(_crossDomainAdmin, _hubPool, _wethAddress, timerAddress) {\n _setL2GatewayRouter(_l2GatewayRouter);\n }\n\n modifier onlyFromCrossDomainAdmin() {\n require(msg.sender == _applyL1ToL2Alias(crossDomainAdmin), \"ONLY_COUNTERPART_GATEWAY\");\n _;\n }\n\n /********************************************************\n * ARBITRUM-SPECIFIC CROSS-CHAIN ADMIN FUNCTIONS *\n ********************************************************/\n\n /**\n * @notice Change L2 gateway router. Callable only by admin.\n * @param newL2GatewayRouter New L2 gateway router.\n */\n function setL2GatewayRouter(address newL2GatewayRouter) public onlyAdmin {\n _setL2GatewayRouter(newL2GatewayRouter);\n }\n\n /**\n * @notice Add L2 -> L1 token mapping. Callable only by admin.\n * @param l2Token Arbitrum token.\n * @param l1Token Ethereum version of l2Token.\n */\n function whitelistToken(address l2Token, address l1Token) public onlyAdmin {\n _whitelistToken(l2Token, l1Token);\n }\n\n /**************************************\n * INTERNAL FUNCTIONS *\n **************************************/\n\n function _bridgeTokensToHubPool(RelayerRefundLeaf memory relayerRefundLeaf) internal override {\n StandardBridgeLike(l2GatewayRouter).outboundTransfer(\n whitelistedTokens[relayerRefundLeaf.l2TokenAddress], // _l1Token. Address of the L1 token to bridge over.\n hubPool, // _to. Withdraw, over the bridge, to the l1 hub pool contract.\n relayerRefundLeaf.amountToReturn, // _amount.\n \"\" // _data. We don't need to send any data for the bridging action.\n );\n emit ArbitrumTokensBridged(address(0), hubPool, relayerRefundLeaf.amountToReturn);\n }\n\n function _setL2GatewayRouter(address _l2GatewayRouter) internal {\n l2GatewayRouter = _l2GatewayRouter;\n emit SetL2GatewayRouter(l2GatewayRouter);\n }\n\n function _whitelistToken(address _l2Token, address _l1Token) internal {\n whitelistedTokens[_l2Token] = _l1Token;\n emit WhitelistedTokens(_l2Token, _l1Token);\n }\n\n // L1 addresses are transformed during l1->l2 calls.\n // See https://developer.offchainlabs.com/docs/l1_l2_messages#address-aliasing for more information.\n // This cannot be pulled directly from Arbitrum contracts because their contracts are not 0.8.X compatible and\n // this operation takes advantage of overflows, whose behavior changed in 0.8.0.\n function _applyL1ToL2Alias(address l1Address) internal pure returns (address l2Address) {\n // Allows overflows as explained above.\n unchecked {\n l2Address = address(uint160(l1Address) + uint160(0x1111000000000000000000000000000000001111));\n }\n }\n\n // Apply AVM-specific transformation to cross domain admin address on L1.\n function _requireAdminSender() internal override onlyFromCrossDomainAdmin {}\n}\n" + "content": "// SPDX-License-Identifier: GPL-3.0-only\npragma solidity ^0.8.0;\n\nimport \"./SpokePool.sol\";\n\ninterface StandardBridgeLike {\n function outboundTransfer(\n address _l1Token,\n address _to,\n uint256 _amount,\n bytes calldata _data\n ) external payable returns (bytes memory);\n}\n\n/**\n * @notice AVM specific SpokePool. Uses AVM cross-domain-enabled logic to implement admin only access to functions.\n */\ncontract Arbitrum_SpokePool is SpokePool {\n // Address of the Arbitrum L2 token gateway to send funds to L1.\n address public l2GatewayRouter;\n\n // Admin controlled mapping of arbitrum tokens to L1 counterpart. L1 counterpart addresses\n // are necessary params used when bridging tokens to L1.\n mapping(address => address) public whitelistedTokens;\n\n event ArbitrumTokensBridged(address indexed l1Token, address target, uint256 numberOfTokensBridged);\n event SetL2GatewayRouter(address indexed newL2GatewayRouter);\n event WhitelistedTokens(address indexed l2Token, address indexed l1Token);\n\n /**\n * @notice Construct the AVM SpokePool.\n * @param _l2GatewayRouter Address of L2 token gateway. Can be reset by admin.\n * @param _crossDomainAdmin Cross domain admin to set. Can be changed by admin.\n * @param _hubPool Hub pool address to set. Can be changed by admin.\n * @param _wethAddress Weth address for this network to set.\n * @param timerAddress Timer address to set.\n */\n constructor(\n address _l2GatewayRouter,\n address _crossDomainAdmin,\n address _hubPool,\n address _wethAddress,\n address timerAddress\n ) SpokePool(_crossDomainAdmin, _hubPool, _wethAddress, timerAddress) {\n _setL2GatewayRouter(_l2GatewayRouter);\n }\n\n modifier onlyFromCrossDomainAdmin() {\n require(msg.sender == _applyL1ToL2Alias(crossDomainAdmin), \"ONLY_COUNTERPART_GATEWAY\");\n _;\n }\n\n /********************************************************\n * ARBITRUM-SPECIFIC CROSS-CHAIN ADMIN FUNCTIONS *\n ********************************************************/\n\n /**\n * @notice Change L2 gateway router. Callable only by admin.\n * @param newL2GatewayRouter New L2 gateway router.\n */\n function setL2GatewayRouter(address newL2GatewayRouter) public onlyAdmin nonReentrant {\n _setL2GatewayRouter(newL2GatewayRouter);\n }\n\n /**\n * @notice Add L2 -> L1 token mapping. Callable only by admin.\n * @param l2Token Arbitrum token.\n * @param l1Token Ethereum version of l2Token.\n */\n function whitelistToken(address l2Token, address l1Token) public onlyAdmin nonReentrant {\n _whitelistToken(l2Token, l1Token);\n }\n\n /**************************************\n * INTERNAL FUNCTIONS *\n **************************************/\n\n function _bridgeTokensToHubPool(RelayerRefundLeaf memory relayerRefundLeaf) internal override {\n // Check that the Ethereum counterpart of the L2 token is stored on this contract.\n address ethereumTokenToBridge = whitelistedTokens[relayerRefundLeaf.l2TokenAddress];\n require(ethereumTokenToBridge != address(0), \"Uninitialized mainnet token\");\n StandardBridgeLike(l2GatewayRouter).outboundTransfer(\n ethereumTokenToBridge, // _l1Token. Address of the L1 token to bridge over.\n hubPool, // _to. Withdraw, over the bridge, to the l1 hub pool contract.\n relayerRefundLeaf.amountToReturn, // _amount.\n \"\" // _data. We don't need to send any data for the bridging action.\n );\n emit ArbitrumTokensBridged(address(0), hubPool, relayerRefundLeaf.amountToReturn);\n }\n\n function _setL2GatewayRouter(address _l2GatewayRouter) internal {\n l2GatewayRouter = _l2GatewayRouter;\n emit SetL2GatewayRouter(l2GatewayRouter);\n }\n\n function _whitelistToken(address _l2Token, address _l1Token) internal {\n whitelistedTokens[_l2Token] = _l1Token;\n emit WhitelistedTokens(_l2Token, _l1Token);\n }\n\n // L1 addresses are transformed during l1->l2 calls.\n // See https://developer.offchainlabs.com/docs/l1_l2_messages#address-aliasing for more information.\n // This cannot be pulled directly from Arbitrum contracts because their contracts are not 0.8.X compatible and\n // this operation takes advantage of overflows, whose behavior changed in 0.8.0.\n function _applyL1ToL2Alias(address l1Address) internal pure returns (address l2Address) {\n // Allows overflows as explained above.\n unchecked {\n l2Address = address(uint160(l1Address) + uint160(0x1111000000000000000000000000000000001111));\n }\n }\n\n // Apply AVM-specific transformation to cross domain admin address on L1.\n function _requireAdminSender() internal override onlyFromCrossDomainAdmin {}\n}\n" }, "contracts/SpokePool.sol": { - "content": "// SPDX-License-Identifier: GPL-3.0-only\npragma solidity ^0.8.0;\n\nimport \"./MerkleLib.sol\";\nimport \"./interfaces/WETH9.sol\";\n\nimport \"@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol\";\nimport \"@openzeppelin/contracts/token/ERC20/IERC20.sol\";\nimport \"@openzeppelin/contracts/utils/Address.sol\";\n\nimport \"@openzeppelin/contracts/utils/cryptography/SignatureChecker.sol\";\nimport \"@openzeppelin/contracts/utils/cryptography/ECDSA.sol\";\n\nimport \"@uma/core/contracts/common/implementation/Testable.sol\";\nimport \"@uma/core/contracts/common/implementation/MultiCaller.sol\";\nimport \"./Lockable.sol\";\nimport \"./MerkleLib.sol\";\nimport \"./SpokePoolInterface.sol\";\n\n/**\n * @title SpokePool\n * @notice Base contract deployed on source and destination chains enabling depositors to transfer assets from source to\n * destination. Deposit orders are fulfilled by off-chain relayers who also interact with this contract. Deposited\n * tokens are locked on the source chain and relayers send the recipient the desired token currency and amount\n * on the destination chain. Locked source chain tokens are later sent over the canonical token bridge to L1 HubPool.\n * Relayers are refunded with destination tokens out of this contract after another off-chain actor, a \"data worker\",\n * submits a proof that the relayer correctly submitted a relay on this SpokePool.\n */\nabstract contract SpokePool is SpokePoolInterface, Testable, Lockable, MultiCaller {\n using SafeERC20 for IERC20;\n using Address for address;\n\n // Address of the L1 contract that acts as the owner of this SpokePool. If this contract is deployed on Ethereum,\n // then this address should be set to the same owner as the HubPool and the whole system.\n address public crossDomainAdmin;\n\n // Address of the L1 contract that will send tokens to and receive tokens from this contract to fund relayer\n // refunds and slow relays.\n address public hubPool;\n\n // Address of WETH contract for this network. If an origin token matches this, then the caller can optionally\n // instruct this contract to wrap ETH when depositing.\n WETH9 public weth;\n\n // Timestamp when contract was constructed. Relays cannot have a quote time before this.\n uint32 public deploymentTime;\n\n // Any deposit quote times greater than or less than this value to the current contract time is blocked. Forces\n // caller to use an approximately \"current\" realized fee. Defaults to 10 minutes.\n uint32 public depositQuoteTimeBuffer = 600;\n\n // Count of deposits is used to construct a unique deposit identifier for this spoke pool.\n uint32 public numberOfDeposits;\n\n // Origin token to destination token routings can be turned on or off, which can enable or disable deposits.\n // A reverse mapping is stored on the L1 HubPool to enable or disable rebalance transfers from the HubPool to this\n // contract.\n mapping(address => mapping(uint256 => bool)) public enabledDepositRoutes;\n\n // Stores collection of merkle roots that can be published to this contract from the HubPool, which are referenced\n // by \"data workers\" via inclusion proofs to execute leaves in the roots.\n struct RootBundle {\n // Merkle root of slow relays that were not fully filled and whose recipient is still owed funds from the LP pool.\n bytes32 slowRelayRoot;\n // Merkle root of relayer refunds for successful relays.\n bytes32 relayerRefundRoot;\n // This is a 2D bitmap tracking which leafs in the relayer refund root have been claimed, with max size of\n // 256x256 leaves per root.\n mapping(uint256 => uint256) claimedBitmap;\n }\n\n // This contract can store as many root bundles as the HubPool chooses to publish here.\n RootBundle[] public rootBundles;\n\n // Each relay is associated with the hash of parameters that uniquely identify the original deposit and a relay\n // attempt for that deposit. The relay itself is just represented as the amount filled so far. The total amount to\n // relay, the fees, and the agents are all parameters included in the hash key.\n mapping(bytes32 => uint256) public relayFills;\n\n /****************************************\n * EVENTS *\n ****************************************/\n event SetXDomainAdmin(address indexed newAdmin);\n event SetHubPool(address indexed newHubPool);\n event EnabledDepositRoute(address indexed originToken, uint256 indexed destinationChainId, bool enabled);\n event SetDepositQuoteTimeBuffer(uint32 newBuffer);\n event FundsDeposited(\n uint256 amount,\n uint256 destinationChainId,\n uint64 relayerFeePct,\n uint32 indexed depositId,\n uint32 quoteTimestamp,\n address indexed originToken,\n address recipient,\n address indexed depositor\n );\n event RequestedSpeedUpDeposit(\n uint64 newRelayerFeePct,\n uint32 indexed depositId,\n address indexed depositor,\n bytes depositorSignature\n );\n event FilledRelay(\n bytes32 indexed relayHash,\n uint256 amount,\n uint256 totalFilledAmount,\n uint256 fillAmount,\n uint256 repaymentChainId,\n uint256 originChainId,\n uint64 relayerFeePct,\n uint64 realizedLpFeePct,\n uint32 depositId,\n address destinationToken,\n address indexed relayer,\n address indexed depositor,\n address recipient,\n bool isSlowRelay\n );\n event RelayedRootBundle(uint32 indexed rootBundleId, bytes32 relayerRefundRoot, bytes32 slowRelayRoot);\n event ExecutedRelayerRefundRoot(\n uint256 amountToReturn,\n uint256 indexed chainId,\n uint256[] refundAmounts,\n uint32 indexed rootBundleId,\n uint32 indexed leafId,\n address l2TokenAddress,\n address[] refundAddresses,\n address caller\n );\n event TokensBridged(\n uint256 amountToReturn,\n uint256 indexed chainId,\n uint32 indexed leafId,\n address indexed l2TokenAddress,\n address caller\n );\n\n /**\n * @notice Construct the base SpokePool.\n * @param _crossDomainAdmin Cross domain admin to set. Can be changed by admin.\n * @param _hubPool Hub pool address to set. Can be changed by admin.\n * @param _wethAddress Weth address for this network to set.\n * @param timerAddress Timer address to set.\n */\n constructor(\n address _crossDomainAdmin,\n address _hubPool,\n address _wethAddress,\n address timerAddress\n ) Testable(timerAddress) {\n _setCrossDomainAdmin(_crossDomainAdmin);\n _setHubPool(_hubPool);\n deploymentTime = uint32(getCurrentTime());\n weth = WETH9(_wethAddress);\n }\n\n /****************************************\n * MODIFIERS *\n ****************************************/\n\n modifier onlyEnabledRoute(address originToken, uint256 destinationId) {\n require(enabledDepositRoutes[originToken][destinationId], \"Disabled route\");\n _;\n }\n\n // Implementing contract needs to override _requireAdminSender() to ensure that admin functions are protected\n // appropriately.\n modifier onlyAdmin() {\n _requireAdminSender();\n _;\n }\n\n /**************************************\n * ADMIN FUNCTIONS *\n **************************************/\n\n /**\n * @notice Change cross domain admin address. Callable by admin only.\n * @param newCrossDomainAdmin New cross domain admin.\n */\n function setCrossDomainAdmin(address newCrossDomainAdmin) public override onlyAdmin {\n _setCrossDomainAdmin(newCrossDomainAdmin);\n }\n\n /**\n * @notice Change L1 hub pool address. Callable by admin only.\n * @param newHubPool New hub pool.\n */\n function setHubPool(address newHubPool) public override onlyAdmin {\n _setHubPool(newHubPool);\n }\n\n /**\n * @notice Enable/Disable an origin token => destination chain ID route for deposits. Callable by admin only.\n * @param originToken Token that depositor can deposit to this contract.\n * @param destinationChainId Chain ID for where depositor wants to receive funds.\n * @param enabled True to enable deposits, False otherwise.\n */\n function setEnableRoute(\n address originToken,\n uint256 destinationChainId,\n bool enabled\n ) public override onlyAdmin {\n enabledDepositRoutes[originToken][destinationChainId] = enabled;\n emit EnabledDepositRoute(originToken, destinationChainId, enabled);\n }\n\n /**\n * @notice Change allowance for deposit quote time to differ from current block time. Callable by admin only.\n * @param newDepositQuoteTimeBuffer New quote time buffer.\n */\n function setDepositQuoteTimeBuffer(uint32 newDepositQuoteTimeBuffer) public override onlyAdmin {\n depositQuoteTimeBuffer = newDepositQuoteTimeBuffer;\n emit SetDepositQuoteTimeBuffer(newDepositQuoteTimeBuffer);\n }\n\n /**\n * @notice This method stores a new root bundle in this contract that can be executed to refund relayers, fulfill\n * slow relays, and send funds back to the HubPool on L1. This method can only be called by the admin and is\n * designed to be called as part of a cross-chain message from the HubPool's executeRootBundle method.\n * @param relayerRefundRoot Merkle root containing relayer refund leaves that can be individually executed via\n * executeRelayerRefundRoot().\n * @param slowRelayRoot Merkle root containing slow relay fulfillment leaves that can be individually executed via\n * executeSlowRelayRoot().\n */\n function relayRootBundle(bytes32 relayerRefundRoot, bytes32 slowRelayRoot) public override onlyAdmin {\n uint32 rootBundleId = uint32(rootBundles.length);\n RootBundle storage rootBundle = rootBundles.push();\n rootBundle.relayerRefundRoot = relayerRefundRoot;\n rootBundle.slowRelayRoot = slowRelayRoot;\n emit RelayedRootBundle(rootBundleId, relayerRefundRoot, slowRelayRoot);\n }\n\n /**************************************\n * DEPOSITOR FUNCTIONS *\n **************************************/\n\n /**\n * @notice Called by user to bridge funds from origin to destination chain. Depositor will effectively lock\n * tokens in this contract and receive a destination token on the destination chain. The origin => destination\n * token mapping is stored on the L1 HubPool.\n * @notice The caller must first approve this contract to spend amount of originToken.\n * @notice The originToken => destinationChainId must be enabled.\n * @notice This method is payable because the caller is able to deposit ETH if the originToken is WETH and this\n * function will handle wrapping ETH.\n * @param recipient Address to receive funds at on destination chain.\n * @param originToken Token to lock into this contract to initiate deposit.\n * @param amount Amount of tokens to deposit. Will be amount of tokens to receive less fees.\n * @param destinationChainId Denotes network where user will receive funds from SpokePool by a relayer.\n * @param relayerFeePct % of deposit amount taken out to incentivize a fast relayer.\n * @param quoteTimestamp Timestamp used by relayers to compute this deposit's realizedLPFeePct which is paid\n * to LP pool on HubPool.\n */\n function deposit(\n address recipient,\n address originToken,\n uint256 amount,\n uint256 destinationChainId,\n uint64 relayerFeePct,\n uint32 quoteTimestamp\n ) public payable override onlyEnabledRoute(originToken, destinationChainId) nonReentrant {\n // We limit the relay fees to prevent the user spending all their funds on fees.\n require(relayerFeePct < 0.5e18, \"invalid relayer fee\");\n // This function assumes that L2 timing cannot be compared accurately and consistently to L1 timing. Therefore,\n // block.timestamp is different from the L1 EVM's. Therefore, the quoteTimestamp must be within a configurable\n // buffer of this contract's block time to allow for this variance.\n // Note also that quoteTimestamp cannot be less than the buffer otherwise the following arithmetic can result\n // in underflow. This isn't a problem as the deposit will revert, but the error might be unexpected for clients.\n require(\n getCurrentTime() >= quoteTimestamp - depositQuoteTimeBuffer &&\n getCurrentTime() <= quoteTimestamp + depositQuoteTimeBuffer,\n \"invalid quote time\"\n );\n // If the address of the origin token is a WETH contract and there is a msg.value with the transaction\n // then the user is sending ETH. In this case, the ETH should be deposited to WETH.\n if (originToken == address(weth) && msg.value > 0) {\n require(msg.value == amount, \"msg.value must match amount\");\n weth.deposit{ value: msg.value }();\n // Else, it is a normal ERC20. In this case pull the token from the users wallet as per normal.\n // Note: this includes the case where the L2 user has WETH (already wrapped ETH) and wants to bridge them.\n // In this case the msg.value will be set to 0, indicating a \"normal\" ERC20 bridging action.\n } else IERC20(originToken).safeTransferFrom(msg.sender, address(this), amount);\n\n emit FundsDeposited(\n amount,\n destinationChainId,\n relayerFeePct,\n numberOfDeposits,\n quoteTimestamp,\n originToken,\n recipient,\n msg.sender\n );\n\n // Increment count of deposits so that deposit ID for this spoke pool is unique.\n numberOfDeposits += 1;\n }\n\n /**\n * @notice Convenience method that depositor can use to signal to relayer to use updated fee.\n * @notice Relayer should only use events emitted by this function to submit fills with updated fees, otherwise they\n * risk their fills getting disputed for being invalid, for example if the depositor never actually signed the\n * update fee message.\n * @notice This function will revert if the depositor did not sign a message containing the updated fee for the\n * deposit ID stored in this contract. If the deposit ID is for another contract, or the depositor address is\n * incorrect, or the updated fee is incorrect, then the signature will not match and this function will revert.\n * @param depositor Signer of the update fee message who originally submitted the deposit. If the deposit doesn't\n * exist, then the relayer will not be able to fill any relay, so the caller should validate that the depositor\n * did in fact submit a relay.\n * @param newRelayerFeePct New relayer fee that relayers can use.\n * @param depositId Deposit to update fee for that originated in this contract.\n * @param depositorSignature Signed message containing the depositor address, this contract chain ID, the updated\n * relayer fee %, and the deposit ID. This signature is produced by signing a hash of data according to the\n * EIP-191 standard. See more in the _verifyUpdateRelayerFeeMessage() comments.\n */\n function speedUpDeposit(\n address depositor,\n uint64 newRelayerFeePct,\n uint32 depositId,\n bytes memory depositorSignature\n ) public override nonReentrant {\n _verifyUpdateRelayerFeeMessage(depositor, chainId(), newRelayerFeePct, depositId, depositorSignature);\n\n // Assuming the above checks passed, a relayer can take the signature and the updated relayer fee information\n // from the following event to submit a fill with an updated fee %.\n emit RequestedSpeedUpDeposit(newRelayerFeePct, depositId, depositor, depositorSignature);\n }\n\n /**************************************\n * RELAYER FUNCTIONS *\n **************************************/\n\n /**\n * @notice Called by relayer to fulfill part of a deposit by sending destination tokens to the receipient.\n * Relayer is expected to pass in unique identifying information for deposit that they want to fulfill, and this\n * relay submission will be validated by off-chain data workers who can dispute this relay if any part is invalid.\n * If the relay is valid, then the relayer will be refunded on their desired repayment chain. If relay is invalid,\n * then relayer will not receive any refund.\n * @notice All of the deposit data can be found via on-chain events from the origin SpokePool, except for the\n * realizedLpFeePct which is a function of the HubPool's utilization at the deposit quote time. This fee %\n * is deterministic based on the quote time, so the relayer should just compute it using the canonical algorithm\n * as described in a UMIP linked to the HubPool's identifier.\n * @param depositor Depositor on origin chain who set this chain as the destination chain.\n * @param recipient Specified recipient on this chain.\n * @param destinationToken Token to send to recipient. Should be mapped to the origin token, origin chain ID\n * and this chain ID via a mapping on the HubPool.\n * @param amount Full size of the deposit.\n * @param maxTokensToSend Max amount of tokens to send recipient. If higher than amount, then caller will\n * send recipient the full relay amount.\n * @param repaymentChainId Chain of SpokePool where relayer wants to be refunded after the challenge window has\n * passed.\n * @param originChainId Chain of SpokePool where deposit originated.\n * @param realizedLpFeePct Fee % based on L1 HubPool utilization at deposit quote time. Deterministic based on\n * quote time.\n * @param relayerFeePct Fee % to keep as relayer, specified by depositor.\n * @param depositId Unique deposit ID on origin spoke pool.\n */\n function fillRelay(\n address depositor,\n address recipient,\n address destinationToken,\n uint256 amount,\n uint256 maxTokensToSend,\n uint256 repaymentChainId,\n uint256 originChainId,\n uint64 realizedLpFeePct,\n uint64 relayerFeePct,\n uint32 depositId\n ) public nonReentrant {\n // Each relay attempt is mapped to the hash of data uniquely identifying it, which includes the deposit data\n // such as the origin chain ID and the deposit ID, and the data in a relay attempt such as who the recipient\n // is, which chain and currency the recipient wants to receive funds on, and the relay fees.\n SpokePoolInterface.RelayData memory relayData = SpokePoolInterface.RelayData({\n depositor: depositor,\n recipient: recipient,\n destinationToken: destinationToken,\n amount: amount,\n realizedLpFeePct: realizedLpFeePct,\n relayerFeePct: relayerFeePct,\n depositId: depositId,\n originChainId: originChainId\n });\n bytes32 relayHash = _getRelayHash(relayData);\n\n uint256 fillAmountPreFees = _fillRelay(relayHash, relayData, maxTokensToSend, relayerFeePct, false);\n\n _emitFillRelay(relayHash, fillAmountPreFees, repaymentChainId, relayerFeePct, relayData, false);\n }\n\n /**\n * @notice Called by relayer to execute same logic as calling fillRelay except that relayer is using an updated\n * relayer fee %. The fee % must have been emitted in a message cryptographically signed by the depositor.\n * @notice By design, the depositor probably emitted the message with the updated fee by calling speedUpRelay().\n * @param depositor Depositor on origin chain who set this chain as the destination chain.\n * @param recipient Specified recipient on this chain.\n * @param destinationToken Token to send to recipient. Should be mapped to the origin token, origin chain ID\n * and this chain ID via a mapping on the HubPool.\n * @param amount Full size of the deposit.\n * @param maxTokensToSend Max amount of tokens to send recipient. If higher than amount, then caller will\n * send recipient the full relay amount.\n * @param repaymentChainId Chain of SpokePool where relayer wants to be refunded after the challenge window has\n * passed.\n * @param originChainId Chain of SpokePool where deposit originated.\n * @param realizedLpFeePct Fee % based on L1 HubPool utilization at deposit quote time. Deterministic based on\n * quote time.\n * @param relayerFeePct Original fee % to keep as relayer set by depositor.\n * @param newRelayerFeePct New fee % to keep as relayer also specified by depositor.\n * @param depositId Unique deposit ID on origin spoke pool.\n * @param depositorSignature Depositor-signed message containing updated fee %.\n */\n function fillRelayWithUpdatedFee(\n address depositor,\n address recipient,\n address destinationToken,\n uint256 amount,\n uint256 maxTokensToSend,\n uint256 repaymentChainId,\n uint256 originChainId,\n uint64 realizedLpFeePct,\n uint64 relayerFeePct,\n uint64 newRelayerFeePct,\n uint32 depositId,\n bytes memory depositorSignature\n ) public override nonReentrant {\n _verifyUpdateRelayerFeeMessage(depositor, originChainId, newRelayerFeePct, depositId, depositorSignature);\n\n // Now follow the default fillRelay flow with the updated fee and the original relay hash.\n RelayData memory relayData = RelayData({\n depositor: depositor,\n recipient: recipient,\n destinationToken: destinationToken,\n amount: amount,\n realizedLpFeePct: realizedLpFeePct,\n relayerFeePct: relayerFeePct,\n depositId: depositId,\n originChainId: originChainId\n });\n bytes32 relayHash = _getRelayHash(relayData);\n uint256 fillAmountPreFees = _fillRelay(relayHash, relayData, maxTokensToSend, newRelayerFeePct, false);\n\n _emitFillRelay(relayHash, fillAmountPreFees, repaymentChainId, newRelayerFeePct, relayData, false);\n }\n\n /**************************************\n * DATA WORKER FUNCTIONS *\n **************************************/\n\n /**\n * @notice Executes a slow relay leaf stored as part of a root bundle. Will send the full amount remaining in the\n * relay to the recipient, less fees.\n * @param depositor Depositor on origin chain who set this chain as the destination chain.\n * @param recipient Specified recipient on this chain.\n * @param destinationToken Token to send to recipient. Should be mapped to the origin token, origin chain ID\n * and this chain ID via a mapping on the HubPool.\n * @param amount Full size of the deposit.\n * @param originChainId Chain of SpokePool where deposit originated.\n * @param realizedLpFeePct Fee % based on L1 HubPool utilization at deposit quote time. Deterministic based on\n * quote time.\n * @param relayerFeePct Original fee % to keep as relayer set by depositor.\n * @param depositId Unique deposit ID on origin spoke pool.\n * @param rootBundleId Unique ID of root bundle containing slow relay root that this leaf is contained in.\n * @param proof Inclusion proof for this leaf in slow relay root in root bundle.\n */\n function executeSlowRelayRoot(\n address depositor,\n address recipient,\n address destinationToken,\n uint256 amount,\n uint256 originChainId,\n uint64 realizedLpFeePct,\n uint64 relayerFeePct,\n uint32 depositId,\n uint32 rootBundleId,\n bytes32[] memory proof\n ) public virtual override nonReentrant {\n _executeSlowRelayRoot(\n depositor,\n recipient,\n destinationToken,\n amount,\n originChainId,\n realizedLpFeePct,\n relayerFeePct,\n depositId,\n rootBundleId,\n proof\n );\n }\n\n /**\n * @notice Executes a relayer refund leaf stored as part of a root bundle. Will send the relayer the amount they\n * sent to the recipient plus a relayer fee.\n * @param rootBundleId Unique ID of root bundle containing relayer refund root that this leaf is contained in.\n * @param relayerRefundLeaf Contains all data neccessary to reconstruct leaf contained in root bundle and to\n * refund relayer. This data structure is explained in detail in the SpokePoolInterface.\n * @param proof Inclusion proof for this leaf in relayer refund root in root bundle.\n */\n function executeRelayerRefundRoot(\n uint32 rootBundleId,\n SpokePoolInterface.RelayerRefundLeaf memory relayerRefundLeaf,\n bytes32[] memory proof\n ) public virtual override nonReentrant {\n _executeRelayerRefundRoot(rootBundleId, relayerRefundLeaf, proof);\n }\n\n /**************************************\n * VIEW FUNCTIONS *\n **************************************/\n\n /**\n * @notice Returns chain ID for this network.\n * @dev Some L2s like ZKSync don't support the CHAIN_ID opcode so we allow the implementer to override this.\n */\n function chainId() public view override returns (uint256) {\n return block.chainid;\n }\n\n /**************************************\n * INTERNAL FUNCTIONS *\n **************************************/\n\n // Verifies inclusion proof of leaf in root, sends relayer their refund, and sends to HubPool any rebalance\n // transfers.\n function _executeRelayerRefundRoot(\n uint32 rootBundleId,\n SpokePoolInterface.RelayerRefundLeaf memory relayerRefundLeaf,\n bytes32[] memory proof\n ) internal {\n // Check integrity of leaf structure:\n require(relayerRefundLeaf.chainId == chainId(), \"Invalid chainId\");\n require(relayerRefundLeaf.refundAddresses.length == relayerRefundLeaf.refundAmounts.length, \"invalid leaf\");\n\n RootBundle storage rootBundle = rootBundles[rootBundleId];\n\n // Check that inclusionProof proves that relayerRefundLeaf is contained within the relayer refund root.\n // Note: This should revert if the relayerRefundRoot is uninitialized.\n require(MerkleLib.verifyRelayerRefund(rootBundle.relayerRefundRoot, relayerRefundLeaf, proof), \"Bad Proof\");\n\n // Verify the leafId in the leaf has not yet been claimed.\n require(!MerkleLib.isClaimed(rootBundle.claimedBitmap, relayerRefundLeaf.leafId), \"Already claimed\");\n\n // Set leaf as claimed in bitmap. This is passed by reference to the storage rootBundle.\n MerkleLib.setClaimed(rootBundle.claimedBitmap, relayerRefundLeaf.leafId);\n\n // Send each relayer refund address the associated refundAmount for the L2 token address.\n // Note: Even if the L2 token is not enabled on this spoke pool, we should still refund relayers.\n for (uint32 i = 0; i < relayerRefundLeaf.refundAmounts.length; i++) {\n uint256 amount = relayerRefundLeaf.refundAmounts[i];\n if (amount > 0)\n IERC20(relayerRefundLeaf.l2TokenAddress).safeTransfer(relayerRefundLeaf.refundAddresses[i], amount);\n }\n\n // If leaf's amountToReturn is positive, then send L2 --> L1 message to bridge tokens back via\n // chain-specific bridging method.\n if (relayerRefundLeaf.amountToReturn > 0) {\n _bridgeTokensToHubPool(relayerRefundLeaf);\n\n emit TokensBridged(\n relayerRefundLeaf.amountToReturn,\n relayerRefundLeaf.chainId,\n relayerRefundLeaf.leafId,\n relayerRefundLeaf.l2TokenAddress,\n msg.sender\n );\n }\n\n emit ExecutedRelayerRefundRoot(\n relayerRefundLeaf.amountToReturn,\n relayerRefundLeaf.chainId,\n relayerRefundLeaf.refundAmounts,\n rootBundleId,\n relayerRefundLeaf.leafId,\n relayerRefundLeaf.l2TokenAddress,\n relayerRefundLeaf.refundAddresses,\n msg.sender\n );\n }\n\n // Verifies inclusion proof of leaf in root and sends recipient remainder of relay. Marks relay as filled.\n function _executeSlowRelayRoot(\n address depositor,\n address recipient,\n address destinationToken,\n uint256 amount,\n uint256 originChainId,\n uint64 realizedLpFeePct,\n uint64 relayerFeePct,\n uint32 depositId,\n uint32 rootBundleId,\n bytes32[] memory proof\n ) internal {\n RelayData memory relayData = RelayData({\n depositor: depositor,\n recipient: recipient,\n destinationToken: destinationToken,\n amount: amount,\n originChainId: originChainId,\n realizedLpFeePct: realizedLpFeePct,\n relayerFeePct: relayerFeePct,\n depositId: depositId\n });\n\n require(\n MerkleLib.verifySlowRelayFulfillment(rootBundles[rootBundleId].slowRelayRoot, relayData, proof),\n \"Invalid proof\"\n );\n\n bytes32 relayHash = _getRelayHash(relayData);\n\n // Note: use relayAmount as the max amount to send, so the relay is always completely filled by the contract's\n // funds in all cases. As this is a slow relay we set the relayerFeePct to 0. This effectively refunds the\n // relayer component of the relayerFee thereby only charging the depositor the LpFee.\n uint256 fillAmountPreFees = _fillRelay(relayHash, relayData, relayData.amount, 0, true);\n\n // Note: Set repayment chain ID to 0 to indicate that there is no repayment to be made. The off-chain data\n // worker can use repaymentChainId=0 as a signal to ignore such relays for refunds. Also, set the relayerFeePct\n // to 0 as slow relays do not pay the caller of this method (depositor is refunded this fee).\n _emitFillRelay(relayHash, fillAmountPreFees, 0, 0, relayData, true);\n }\n\n function _setCrossDomainAdmin(address newCrossDomainAdmin) internal {\n require(newCrossDomainAdmin != address(0), \"Bad bridge router address\");\n crossDomainAdmin = newCrossDomainAdmin;\n emit SetXDomainAdmin(crossDomainAdmin);\n }\n\n function _setHubPool(address newHubPool) internal {\n require(newHubPool != address(0), \"Bad hub pool address\");\n hubPool = newHubPool;\n emit SetHubPool(hubPool);\n }\n\n // Should be overriden by implementing contract depending on how L2 handles sending tokens to L1.\n function _bridgeTokensToHubPool(SpokePoolInterface.RelayerRefundLeaf memory relayerRefundLeaf) internal virtual;\n\n function _verifyUpdateRelayerFeeMessage(\n address depositor,\n uint256 originChainId,\n uint64 newRelayerFeePct,\n uint32 depositId,\n bytes memory depositorSignature\n ) internal view {\n // A depositor can request to speed up an un-relayed deposit by signing a hash containing the relayer\n // fee % to update to and information uniquely identifying the deposit to relay. This information ensures\n // that this signature cannot be re-used for other deposits. The version string is included as a precaution\n // in case this contract is upgraded.\n // Note: we use encode instead of encodePacked because it is more secure, more in the \"warning\" section\n // here: https://docs.soliditylang.org/en/v0.8.11/abi-spec.html#non-standard-packed-mode\n bytes32 expectedDepositorMessageHash = keccak256(\n abi.encode(\"ACROSS-V2-FEE-1.0\", newRelayerFeePct, depositId, originChainId)\n );\n\n // Check the hash corresponding to the https://eth.wiki/json-rpc/API#eth_sign[eth_sign]\n // JSON-RPC method as part of EIP-191. We use OZ's signature checker library which adds support for\n // EIP-1271 which can verify messages signed by smart contract wallets like Argent and Gnosis safes.\n // If the depositor signed a message with a different updated fee (or any other param included in the\n // above keccak156 hash), then this will revert.\n bytes32 ethSignedMessageHash = ECDSA.toEthSignedMessageHash(expectedDepositorMessageHash);\n\n _verifyDepositorUpdateFeeMessage(depositor, ethSignedMessageHash, depositorSignature);\n }\n\n // This function is isolated and made virtual to allow different L2's to implement chain specific recovery of\n // signers from signatures because some L2s might not support ecrecover, such as those with account abstraction\n // like ZKSync.\n function _verifyDepositorUpdateFeeMessage(\n address depositor,\n bytes32 ethSignedMessageHash,\n bytes memory depositorSignature\n ) internal view virtual {\n // Note: no need to worry about reentrancy from contract deployed at depositor address since\n // SignatureChecker.isValidSignatureNow is a non state-modifying STATICCALL:\n // - https://github.com/OpenZeppelin/openzeppelin-contracts/blob/63b466901fb015538913f811c5112a2775042177/contracts/utils/cryptography/SignatureChecker.sol#L35\n // - https://github.com/ethereum/EIPs/pull/214\n require(\n SignatureChecker.isValidSignatureNow(depositor, ethSignedMessageHash, depositorSignature),\n \"invalid signature\"\n );\n }\n\n function _computeAmountPreFees(uint256 amount, uint64 feesPct) private pure returns (uint256) {\n return (1e18 * amount) / (1e18 - feesPct);\n }\n\n function _computeAmountPostFees(uint256 amount, uint64 feesPct) private pure returns (uint256) {\n return (amount * (1e18 - feesPct)) / 1e18;\n }\n\n function _getRelayHash(SpokePoolInterface.RelayData memory relayData) private pure returns (bytes32) {\n return keccak256(abi.encode(relayData));\n }\n\n // Unwraps ETH and does a transfer to a recipient address. If the recipient is a smart contract then sends WETH.\n function _unwrapWETHTo(address payable to, uint256 amount) internal {\n if (address(to).isContract()) {\n IERC20(address(weth)).safeTransfer(to, amount);\n } else {\n weth.withdraw(amount);\n to.transfer(amount);\n }\n }\n\n // @notice Caller specifies the max amount of tokens to send to user. Based on this amount and the amount of the\n // relay remaining (as stored in the relayFills mapping), pull the amount of tokens from the caller ancillaryData\n // and send to the caller.\n // @dev relayFills keeps track of pre-fee fill amounts as a convenience to relayers who want to specify round\n // numbers for the maxTokensToSend parameter or convenient numbers like 100 (i.e. relayers who will fully\n // fill any relay up to 100 tokens, and partial fill with 100 tokens for larger relays).\n function _fillRelay(\n bytes32 relayHash,\n RelayData memory relayData,\n uint256 maxTokensToSend,\n uint64 updatableRelayerFeePct,\n bool useContractFunds\n ) internal returns (uint256 fillAmountPreFees) {\n // We limit the relay fees to prevent the user spending all their funds on fees. Note that 0.5e18 (i.e. 50%)\n // fees are just magic numbers. The important point is to prevent the total fee from being 100%, otherwise\n // computing the amount pre fees runs into divide-by-0 issues.\n require(updatableRelayerFeePct < 0.5e18 && relayData.realizedLpFeePct < 0.5e18, \"invalid fees\");\n\n // Check that the relay has not already been completely filled. Note that the relays mapping will point to\n // the amount filled so far for a particular relayHash, so this will start at 0 and increment with each fill.\n require(relayFills[relayHash] < relayData.amount, \"relay filled\");\n\n // Stores the equivalent amount to be sent by the relayer before fees have been taken out.\n if (maxTokensToSend == 0) return 0;\n\n // Derive the amount of the relay filled if the caller wants to send exactly maxTokensToSend tokens to\n // the recipient. For example, if the user wants to send 10 tokens to the recipient, the full relay amount\n // is 100, and the fee %'s total 5%, then this computation would return ~10.5, meaning that to fill 10.5/100\n // of the full relay size, the caller would need to send 10 tokens to the user.\n fillAmountPreFees = _computeAmountPreFees(\n maxTokensToSend,\n (relayData.realizedLpFeePct + updatableRelayerFeePct)\n );\n // If user's specified max amount to send is greater than the amount of the relay remaining pre-fees,\n // we'll pull exactly enough tokens to complete the relay.\n uint256 amountToSend = maxTokensToSend;\n uint256 amountRemainingInRelay = relayData.amount - relayFills[relayHash];\n if (amountRemainingInRelay < fillAmountPreFees) {\n fillAmountPreFees = amountRemainingInRelay;\n\n // The user will fulfill the remainder of the relay, so we need to compute exactly how many tokens post-fees\n // that they need to send to the recipient. Note that if the relayer is filled using contract funds then\n // this is a slow relay.\n amountToSend = _computeAmountPostFees(\n fillAmountPreFees,\n relayData.realizedLpFeePct + updatableRelayerFeePct\n );\n }\n\n // relayFills keeps track of pre-fee fill amounts as a convenience to relayers who want to specify round\n // numbers for the maxTokensToSend parameter or convenient numbers like 100 (i.e. relayers who will fully\n // fill any relay up to 100 tokens, and partial fill with 100 tokens for larger relays).\n relayFills[relayHash] += fillAmountPreFees;\n\n // If relay token is weth then unwrap and send eth.\n if (relayData.destinationToken == address(weth)) {\n // Note: useContractFunds is True if we want to send funds to the recipient directly out of this contract,\n // otherwise we expect the caller to send funds to the recipient. If useContractFunds is True and the\n // recipient wants WETH, then we can assume that WETH is already in the contract, otherwise we'll need the\n // the user to send WETH to this contract. Regardless, we'll need to unwrap it before sending to the user.\n if (!useContractFunds)\n IERC20(relayData.destinationToken).safeTransferFrom(msg.sender, address(this), amountToSend);\n _unwrapWETHTo(payable(relayData.recipient), amountToSend);\n // Else, this is a normal ERC20 token. Send to recipient.\n } else {\n // Note: Similar to note above, send token directly from the contract to the user in the slow relay case.\n if (!useContractFunds)\n IERC20(relayData.destinationToken).safeTransferFrom(msg.sender, relayData.recipient, amountToSend);\n else IERC20(relayData.destinationToken).safeTransfer(relayData.recipient, amountToSend);\n }\n }\n\n // The following internal methods emit events with many params to overcome solidity stack too deep issues.\n function _emitFillRelay(\n bytes32 relayHash,\n uint256 fillAmount,\n uint256 repaymentChainId,\n uint64 relayerFeePct,\n RelayData memory relayData,\n bool isSlowRelay\n ) internal {\n emit FilledRelay(\n relayHash,\n relayData.amount,\n relayFills[relayHash],\n fillAmount,\n repaymentChainId,\n relayData.originChainId,\n relayerFeePct,\n relayData.realizedLpFeePct,\n relayData.depositId,\n relayData.destinationToken,\n msg.sender,\n relayData.depositor,\n relayData.recipient,\n isSlowRelay\n );\n }\n\n // Implementing contract needs to override this to ensure that only the appropriate cross chain admin can execute\n // certain admin functions. For L2 contracts, the cross chain admin refers to some L1 address or contract, and for\n // L1, this would just be the same admin of the HubPool.\n function _requireAdminSender() internal virtual;\n\n // Added to enable the this contract to receive ETH. Used when unwrapping Weth.\n receive() external payable {}\n}\n" - }, - "contracts/SpokePoolInterface.sol": { - "content": "// SPDX-License-Identifier: GPL-3.0-only\npragma solidity ^0.8.0;\n\n/**\n * @notice Contains common data structures and functions used by all SpokePool implementations.\n */\ninterface SpokePoolInterface {\n // This leaf is meant to be decoded in the SpokePool to pay out successful relayers.\n struct RelayerRefundLeaf {\n // This is the amount to return to the HubPool. This occurs when there is a PoolRebalanceLeaf netSendAmount that is\n // negative. This is just that value inverted.\n uint256 amountToReturn;\n // Used to verify that this is being executed on the correct destination chainId.\n uint256 chainId;\n // This array designates how much each of those addresses should be refunded.\n uint256[] refundAmounts;\n // Used as the index in the bitmap to track whether this leaf has been executed or not.\n uint32 leafId;\n // The associated L2TokenAddress that these claims apply to.\n address l2TokenAddress;\n // Must be same length as refundAmounts and designates each address that must be refunded.\n address[] refundAddresses;\n }\n\n // This struct represents the data to fully specify a relay. If any portion of this data differs, the relay is\n // considered to be completely distinct. Only one relay for a particular depositId, chainId pair should be\n // considered valid and repaid. This data is hashed and inserted into a the slow relay merkle root so that an off\n // chain validator can choose when to refund slow relayers.\n struct RelayData {\n // The address that made the deposit on the origin chain.\n address depositor;\n // The recipient address on the destination chain.\n address recipient;\n // The corresponding token address on the destination chain.\n address destinationToken;\n // The total relay amount before fees are taken out.\n uint256 amount;\n // Origin chain id.\n uint256 originChainId;\n // The LP Fee percentage computed by the relayer based on the deposit's quote timestamp\n // and the HubPool's utilization.\n uint64 realizedLpFeePct;\n // The relayer fee percentage specified in the deposit.\n uint64 relayerFeePct;\n // The id uniquely identifying this deposit on the origin chain.\n uint32 depositId;\n }\n\n function setCrossDomainAdmin(address newCrossDomainAdmin) external;\n\n function setHubPool(address newHubPool) external;\n\n function setEnableRoute(\n address originToken,\n uint256 destinationChainId,\n bool enable\n ) external;\n\n function setDepositQuoteTimeBuffer(uint32 buffer) external;\n\n function relayRootBundle(bytes32 relayerRefundRoot, bytes32 slowRelayRoot) external;\n\n function deposit(\n address recipient,\n address originToken,\n uint256 amount,\n uint256 destinationChainId,\n uint64 relayerFeePct,\n uint32 quoteTimestamp\n ) external payable;\n\n function speedUpDeposit(\n address depositor,\n uint64 newRelayerFeePct,\n uint32 depositId,\n bytes memory depositorSignature\n ) external;\n\n function fillRelay(\n address depositor,\n address recipient,\n address destinationToken,\n uint256 amount,\n uint256 maxTokensToSend,\n uint256 repaymentChainId,\n uint256 originChainId,\n uint64 realizedLpFeePct,\n uint64 relayerFeePct,\n uint32 depositId\n ) external;\n\n function fillRelayWithUpdatedFee(\n address depositor,\n address recipient,\n address destinationToken,\n uint256 amount,\n uint256 maxTokensToSend,\n uint256 repaymentChainId,\n uint256 originChainId,\n uint64 realizedLpFeePct,\n uint64 relayerFeePct,\n uint64 newRelayerFeePct,\n uint32 depositId,\n bytes memory depositorSignature\n ) external;\n\n function executeSlowRelayRoot(\n address depositor,\n address recipient,\n address destinationToken,\n uint256 amount,\n uint256 originChainId,\n uint64 realizedLpFeePct,\n uint64 relayerFeePct,\n uint32 depositId,\n uint32 rootBundleId,\n bytes32[] memory proof\n ) external;\n\n function executeRelayerRefundRoot(\n uint32 rootBundleId,\n SpokePoolInterface.RelayerRefundLeaf memory relayerRefundLeaf,\n bytes32[] memory proof\n ) external;\n\n function chainId() external view returns (uint256);\n}\n" + "content": "// SPDX-License-Identifier: GPL-3.0-only\npragma solidity ^0.8.0;\n\nimport \"./MerkleLib.sol\";\nimport \"./interfaces/WETH9.sol\";\nimport \"./Lockable.sol\";\nimport \"./SpokePoolInterface.sol\";\n\nimport \"@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol\";\nimport \"@openzeppelin/contracts/token/ERC20/IERC20.sol\";\nimport \"@openzeppelin/contracts/utils/Address.sol\";\n\nimport \"@openzeppelin/contracts/utils/cryptography/ECDSA.sol\";\nimport \"@uma/core/contracts/common/implementation/Testable.sol\";\nimport \"@uma/core/contracts/common/implementation/MultiCaller.sol\";\n\n/**\n * @title SpokePool\n * @notice Base contract deployed on source and destination chains enabling depositors to transfer assets from source to\n * destination. Deposit orders are fulfilled by off-chain relayers who also interact with this contract. Deposited\n * tokens are locked on the source chain and relayers send the recipient the desired token currency and amount\n * on the destination chain. Locked source chain tokens are later sent over the canonical token bridge to L1 HubPool.\n * Relayers are refunded with destination tokens out of this contract after another off-chain actor, a \"data worker\",\n * submits a proof that the relayer correctly submitted a relay on this SpokePool.\n */\nabstract contract SpokePool is SpokePoolInterface, Testable, Lockable, MultiCaller {\n using SafeERC20 for IERC20;\n using Address for address;\n\n // Address of the L1 contract that acts as the owner of this SpokePool. If this contract is deployed on Ethereum,\n // then this address should be set to the same owner as the HubPool and the whole system.\n address public crossDomainAdmin;\n\n // Address of the L1 contract that will send tokens to and receive tokens from this contract to fund relayer\n // refunds and slow relays.\n address public hubPool;\n\n // Address of WETH contract for this network. If an origin token matches this, then the caller can optionally\n // instruct this contract to wrap ETH when depositing.\n WETH9 public immutable weth;\n\n // Any deposit quote times greater than or less than this value to the current contract time is blocked. Forces\n // caller to use an approximately \"current\" realized fee. Defaults to 10 minutes.\n uint32 public depositQuoteTimeBuffer = 600;\n\n // Count of deposits is used to construct a unique deposit identifier for this spoke pool.\n uint32 public numberOfDeposits;\n\n // Origin token to destination token routings can be turned on or off, which can enable or disable deposits.\n\n mapping(address => mapping(uint256 => bool)) public enabledDepositRoutes;\n\n // This contract can store as many root bundles as the HubPool chooses to publish here.\n RootBundle[] public rootBundles;\n\n // Each relay is associated with the hash of parameters that uniquely identify the original deposit and a relay\n // attempt for that deposit. The relay itself is just represented as the amount filled so far. The total amount to\n // relay, the fees, and the agents are all parameters included in the hash key.\n mapping(bytes32 => uint256) public relayFills;\n\n /****************************************\n * EVENTS *\n ****************************************/\n event SetXDomainAdmin(address indexed newAdmin);\n event SetHubPool(address indexed newHubPool);\n event EnabledDepositRoute(address indexed originToken, uint256 indexed destinationChainId, bool enabled);\n event SetDepositQuoteTimeBuffer(uint32 newBuffer);\n event FundsDeposited(\n uint256 amount,\n uint256 originChainId,\n uint256 destinationChainId,\n uint64 relayerFeePct,\n uint32 indexed depositId,\n uint32 quoteTimestamp,\n address indexed originToken,\n address recipient,\n address indexed depositor\n );\n event RequestedSpeedUpDeposit(\n uint64 newRelayerFeePct,\n uint32 indexed depositId,\n address indexed depositor,\n bytes depositorSignature\n );\n event FilledRelay(\n bytes32 indexed relayHash,\n uint256 amount,\n uint256 totalFilledAmount,\n uint256 fillAmount,\n uint256 repaymentChainId,\n uint256 originChainId,\n uint256 destinationChainId,\n uint64 relayerFeePct,\n uint64 realizedLpFeePct,\n uint32 depositId,\n address destinationToken,\n address indexed relayer,\n address indexed depositor,\n address recipient,\n bool isSlowRelay\n );\n event RelayedRootBundle(uint32 indexed rootBundleId, bytes32 relayerRefundRoot, bytes32 slowRelayRoot);\n event ExecutedRelayerRefundRoot(\n uint256 amountToReturn,\n uint256 indexed chainId,\n uint256[] refundAmounts,\n uint32 indexed rootBundleId,\n uint32 indexed leafId,\n address l2TokenAddress,\n address[] refundAddresses,\n address caller\n );\n event TokensBridged(\n uint256 amountToReturn,\n uint256 indexed chainId,\n uint32 indexed leafId,\n address indexed l2TokenAddress,\n address caller\n );\n event EmergencyDeleteRootBundle(uint256 indexed rootBundleId);\n\n /**\n * @notice Construct the base SpokePool.\n * @param _crossDomainAdmin Cross domain admin to set. Can be changed by admin.\n * @param _hubPool Hub pool address to set. Can be changed by admin.\n * @param _wethAddress Weth address for this network to set.\n * @param timerAddress Timer address to set.\n */\n constructor(\n address _crossDomainAdmin,\n address _hubPool,\n address _wethAddress,\n address timerAddress\n ) Testable(timerAddress) {\n _setCrossDomainAdmin(_crossDomainAdmin);\n _setHubPool(_hubPool);\n weth = WETH9(_wethAddress);\n }\n\n /****************************************\n * MODIFIERS *\n ****************************************/\n\n // Implementing contract needs to override _requireAdminSender() to ensure that admin functions are protected\n // appropriately.\n modifier onlyAdmin() {\n _requireAdminSender();\n _;\n }\n\n /**************************************\n * ADMIN FUNCTIONS *\n **************************************/\n\n /**\n * @notice Change cross domain admin address. Callable by admin only.\n * @param newCrossDomainAdmin New cross domain admin.\n */\n function setCrossDomainAdmin(address newCrossDomainAdmin) public override onlyAdmin nonReentrant {\n _setCrossDomainAdmin(newCrossDomainAdmin);\n }\n\n /**\n * @notice Change L1 hub pool address. Callable by admin only.\n * @param newHubPool New hub pool.\n */\n function setHubPool(address newHubPool) public override onlyAdmin nonReentrant {\n _setHubPool(newHubPool);\n }\n\n /**\n * @notice Enable/Disable an origin token => destination chain ID route for deposits. Callable by admin only.\n * @param originToken Token that depositor can deposit to this contract.\n * @param destinationChainId Chain ID for where depositor wants to receive funds.\n * @param enabled True to enable deposits, False otherwise.\n */\n function setEnableRoute(\n address originToken,\n uint256 destinationChainId,\n bool enabled\n ) public override onlyAdmin nonReentrant {\n enabledDepositRoutes[originToken][destinationChainId] = enabled;\n emit EnabledDepositRoute(originToken, destinationChainId, enabled);\n }\n\n /**\n * @notice Change allowance for deposit quote time to differ from current block time. Callable by admin only.\n * @param newDepositQuoteTimeBuffer New quote time buffer.\n */\n function setDepositQuoteTimeBuffer(uint32 newDepositQuoteTimeBuffer) public override onlyAdmin nonReentrant {\n depositQuoteTimeBuffer = newDepositQuoteTimeBuffer;\n emit SetDepositQuoteTimeBuffer(newDepositQuoteTimeBuffer);\n }\n\n /**\n * @notice This method stores a new root bundle in this contract that can be executed to refund relayers, fulfill\n * slow relays, and send funds back to the HubPool on L1. This method can only be called by the admin and is\n * designed to be called as part of a cross-chain message from the HubPool's executeRootBundle method.\n * @param relayerRefundRoot Merkle root containing relayer refund leaves that can be individually executed via\n * executeRelayerRefundRoot().\n * @param slowRelayRoot Merkle root containing slow relay fulfillment leaves that can be individually executed via\n * executeSlowRelayRoot().\n */\n function relayRootBundle(bytes32 relayerRefundRoot, bytes32 slowRelayRoot) public override onlyAdmin nonReentrant {\n uint32 rootBundleId = uint32(rootBundles.length);\n RootBundle storage rootBundle = rootBundles.push();\n rootBundle.relayerRefundRoot = relayerRefundRoot;\n rootBundle.slowRelayRoot = slowRelayRoot;\n emit RelayedRootBundle(rootBundleId, relayerRefundRoot, slowRelayRoot);\n }\n\n /**\n * @notice This method is intended to only be used in emergencies where a bad root bundle has reached the\n * SpokePool.\n * @param rootBundleId Index of the root bundle that needs to be deleted. Note: this is intentionally a uint256\n * to ensure that a small input range doesn't limit which indices this method is able to reach.\n */\n function emergencyDeleteRootBundle(uint256 rootBundleId) public override onlyAdmin nonReentrant {\n delete rootBundles[rootBundleId];\n emit EmergencyDeleteRootBundle(rootBundleId);\n }\n\n /**************************************\n * DEPOSITOR FUNCTIONS *\n **************************************/\n\n /**\n * @notice Called by user to bridge funds from origin to destination chain. Depositor will effectively lock\n * tokens in this contract and receive a destination token on the destination chain. The origin => destination\n * token mapping is stored on the L1 HubPool.\n * @notice The caller must first approve this contract to spend amount of originToken.\n * @notice The originToken => destinationChainId must be enabled.\n * @notice This method is payable because the caller is able to deposit ETH if the originToken is WETH and this\n * function will handle wrapping ETH.\n * @param recipient Address to receive funds at on destination chain.\n * @param originToken Token to lock into this contract to initiate deposit.\n * @param amount Amount of tokens to deposit. Will be amount of tokens to receive less fees.\n * @param destinationChainId Denotes network where user will receive funds from SpokePool by a relayer.\n * @param relayerFeePct % of deposit amount taken out to incentivize a fast relayer.\n * @param quoteTimestamp Timestamp used by relayers to compute this deposit's realizedLPFeePct which is paid\n * to LP pool on HubPool.\n */\n function deposit(\n address recipient,\n address originToken,\n uint256 amount,\n uint256 destinationChainId,\n uint64 relayerFeePct,\n uint32 quoteTimestamp\n ) public payable override nonReentrant {\n // Check that deposit route is enabled.\n require(enabledDepositRoutes[originToken][destinationChainId], \"Disabled route\");\n\n // We limit the relay fees to prevent the user spending all their funds on fees.\n require(relayerFeePct < 0.5e18, \"invalid relayer fee\");\n // This function assumes that L2 timing cannot be compared accurately and consistently to L1 timing. Therefore,\n // block.timestamp is different from the L1 EVM's. Therefore, the quoteTimestamp must be within a configurable\n // buffer of this contract's block time to allow for this variance.\n // Note also that quoteTimestamp cannot be less than the buffer otherwise the following arithmetic can result\n // in underflow. This isn't a problem as the deposit will revert, but the error might be unexpected for clients.\n require(\n getCurrentTime() >= quoteTimestamp - depositQuoteTimeBuffer &&\n getCurrentTime() <= quoteTimestamp + depositQuoteTimeBuffer,\n \"invalid quote time\"\n );\n // If the address of the origin token is a WETH contract and there is a msg.value with the transaction\n // then the user is sending ETH. In this case, the ETH should be deposited to WETH.\n if (originToken == address(weth) && msg.value > 0) {\n require(msg.value == amount, \"msg.value must match amount\");\n weth.deposit{ value: msg.value }();\n // Else, it is a normal ERC20. In this case pull the token from the user's wallet as per normal.\n // Note: this includes the case where the L2 user has WETH (already wrapped ETH) and wants to bridge them.\n // In this case the msg.value will be set to 0, indicating a \"normal\" ERC20 bridging action.\n } else IERC20(originToken).safeTransferFrom(msg.sender, address(this), amount);\n\n _emitDeposit(\n amount,\n chainId(),\n destinationChainId,\n relayerFeePct,\n numberOfDeposits,\n quoteTimestamp,\n originToken,\n recipient,\n msg.sender\n );\n\n // Increment count of deposits so that deposit ID for this spoke pool is unique.\n numberOfDeposits += 1;\n }\n\n /**\n * @notice Convenience method that depositor can use to signal to relayer to use updated fee.\n * @notice Relayer should only use events emitted by this function to submit fills with updated fees, otherwise they\n * risk their fills getting disputed for being invalid, for example if the depositor never actually signed the\n * update fee message.\n * @notice This function will revert if the depositor did not sign a message containing the updated fee for the\n * deposit ID stored in this contract. If the deposit ID is for another contract, or the depositor address is\n * incorrect, or the updated fee is incorrect, then the signature will not match and this function will revert.\n * @param depositor Signer of the update fee message who originally submitted the deposit. If the deposit doesn't\n * exist, then the relayer will not be able to fill any relay, so the caller should validate that the depositor\n * did in fact submit a relay.\n * @param newRelayerFeePct New relayer fee that relayers can use.\n * @param depositId Deposit to update fee for that originated in this contract.\n * @param depositorSignature Signed message containing the depositor address, this contract chain ID, the updated\n * relayer fee %, and the deposit ID. This signature is produced by signing a hash of data according to the\n * EIP-191 standard. See more in the _verifyUpdateRelayerFeeMessage() comments.\n */\n function speedUpDeposit(\n address depositor,\n uint64 newRelayerFeePct,\n uint32 depositId,\n bytes memory depositorSignature\n ) public override nonReentrant {\n require(newRelayerFeePct < 0.5e18, \"invalid relayer fee\");\n\n _verifyUpdateRelayerFeeMessage(depositor, chainId(), newRelayerFeePct, depositId, depositorSignature);\n\n // Assuming the above checks passed, a relayer can take the signature and the updated relayer fee information\n // from the following event to submit a fill with an updated fee %.\n emit RequestedSpeedUpDeposit(newRelayerFeePct, depositId, depositor, depositorSignature);\n }\n\n /**************************************\n * RELAYER FUNCTIONS *\n **************************************/\n\n /**\n * @notice Called by relayer to fulfill part of a deposit by sending destination tokens to the recipient.\n * Relayer is expected to pass in unique identifying information for deposit that they want to fulfill, and this\n * relay submission will be validated by off-chain data workers who can dispute this relay if any part is invalid.\n * If the relay is valid, then the relayer will be refunded on their desired repayment chain. If relay is invalid,\n * then relayer will not receive any refund.\n * @notice All of the deposit data can be found via on-chain events from the origin SpokePool, except for the\n * realizedLpFeePct which is a function of the HubPool's utilization at the deposit quote time. This fee %\n * is deterministic based on the quote time, so the relayer should just compute it using the canonical algorithm\n * as described in a UMIP linked to the HubPool's identifier.\n * @param depositor Depositor on origin chain who set this chain as the destination chain.\n * @param recipient Specified recipient on this chain.\n * @param destinationToken Token to send to recipient. Should be mapped to the origin token, origin chain ID\n * and this chain ID via a mapping on the HubPool.\n * @param amount Full size of the deposit.\n * @param maxTokensToSend Max amount of tokens to send recipient. If higher than amount, then caller will\n * send recipient the full relay amount.\n * @param repaymentChainId Chain of SpokePool where relayer wants to be refunded after the challenge window has\n * passed.\n * @param originChainId Chain of SpokePool where deposit originated.\n * @param realizedLpFeePct Fee % based on L1 HubPool utilization at deposit quote time. Deterministic based on\n * quote time.\n * @param relayerFeePct Fee % to keep as relayer, specified by depositor.\n * @param depositId Unique deposit ID on origin spoke pool.\n */\n function fillRelay(\n address depositor,\n address recipient,\n address destinationToken,\n uint256 amount,\n uint256 maxTokensToSend,\n uint256 repaymentChainId,\n uint256 originChainId,\n uint64 realizedLpFeePct,\n uint64 relayerFeePct,\n uint32 depositId\n ) public nonReentrant {\n // Each relay attempt is mapped to the hash of data uniquely identifying it, which includes the deposit data\n // such as the origin chain ID and the deposit ID, and the data in a relay attempt such as who the recipient\n // is, which chain and currency the recipient wants to receive funds on, and the relay fees.\n SpokePoolInterface.RelayData memory relayData = SpokePoolInterface.RelayData({\n depositor: depositor,\n recipient: recipient,\n destinationToken: destinationToken,\n amount: amount,\n realizedLpFeePct: realizedLpFeePct,\n relayerFeePct: relayerFeePct,\n depositId: depositId,\n originChainId: originChainId,\n destinationChainId: chainId()\n });\n bytes32 relayHash = _getRelayHash(relayData);\n\n uint256 fillAmountPreFees = _fillRelay(relayHash, relayData, maxTokensToSend, relayerFeePct, false);\n\n _emitFillRelay(relayHash, fillAmountPreFees, repaymentChainId, relayerFeePct, relayData, false);\n }\n\n /**\n * @notice Called by relayer to execute same logic as calling fillRelay except that relayer is using an updated\n * relayer fee %. The fee % must have been emitted in a message cryptographically signed by the depositor.\n * @notice By design, the depositor probably emitted the message with the updated fee by calling speedUpRelay().\n * @param depositor Depositor on origin chain who set this chain as the destination chain.\n * @param recipient Specified recipient on this chain.\n * @param destinationToken Token to send to recipient. Should be mapped to the origin token, origin chain ID\n * and this chain ID via a mapping on the HubPool.\n * @param amount Full size of the deposit.\n * @param maxTokensToSend Max amount of tokens to send recipient. If higher than amount, then caller will\n * send recipient the full relay amount.\n * @param repaymentChainId Chain of SpokePool where relayer wants to be refunded after the challenge window has\n * passed.\n * @param originChainId Chain of SpokePool where deposit originated.\n * @param realizedLpFeePct Fee % based on L1 HubPool utilization at deposit quote time. Deterministic based on\n * quote time.\n * @param relayerFeePct Original fee % to keep as relayer set by depositor.\n * @param newRelayerFeePct New fee % to keep as relayer also specified by depositor.\n * @param depositId Unique deposit ID on origin spoke pool.\n * @param depositorSignature Depositor-signed message containing updated fee %.\n */\n function fillRelayWithUpdatedFee(\n address depositor,\n address recipient,\n address destinationToken,\n uint256 amount,\n uint256 maxTokensToSend,\n uint256 repaymentChainId,\n uint256 originChainId,\n uint64 realizedLpFeePct,\n uint64 relayerFeePct,\n uint64 newRelayerFeePct,\n uint32 depositId,\n bytes memory depositorSignature\n ) public override nonReentrant {\n _verifyUpdateRelayerFeeMessage(depositor, originChainId, newRelayerFeePct, depositId, depositorSignature);\n\n // Now follow the default fillRelay flow with the updated fee and the original relay hash.\n RelayData memory relayData = RelayData({\n depositor: depositor,\n recipient: recipient,\n destinationToken: destinationToken,\n amount: amount,\n realizedLpFeePct: realizedLpFeePct,\n relayerFeePct: relayerFeePct,\n depositId: depositId,\n originChainId: originChainId,\n destinationChainId: chainId()\n });\n bytes32 relayHash = _getRelayHash(relayData);\n uint256 fillAmountPreFees = _fillRelay(relayHash, relayData, maxTokensToSend, newRelayerFeePct, false);\n\n _emitFillRelay(relayHash, fillAmountPreFees, repaymentChainId, newRelayerFeePct, relayData, false);\n }\n\n /**************************************\n * DATA WORKER FUNCTIONS *\n **************************************/\n\n /**\n * @notice Executes a slow relay leaf stored as part of a root bundle. Will send the full amount remaining in the\n * relay to the recipient, less fees.\n * @dev This function assumes that the relay's destination chain ID is the current chain ID, which prevents\n * the caller from executing a slow relay intended for another chain on this chain.\n * @param depositor Depositor on origin chain who set this chain as the destination chain.\n * @param recipient Specified recipient on this chain.\n * @param destinationToken Token to send to recipient. Should be mapped to the origin token, origin chain ID\n * and this chain ID via a mapping on the HubPool.\n * @param amount Full size of the deposit.\n * @param originChainId Chain of SpokePool where deposit originated.\n * @param realizedLpFeePct Fee % based on L1 HubPool utilization at deposit quote time. Deterministic based on\n * quote time.\n * @param relayerFeePct Original fee % to keep as relayer set by depositor.\n * @param depositId Unique deposit ID on origin spoke pool.\n * @param rootBundleId Unique ID of root bundle containing slow relay root that this leaf is contained in.\n * @param proof Inclusion proof for this leaf in slow relay root in root bundle.\n */\n function executeSlowRelayRoot(\n address depositor,\n address recipient,\n address destinationToken,\n uint256 amount,\n uint256 originChainId,\n uint64 realizedLpFeePct,\n uint64 relayerFeePct,\n uint32 depositId,\n uint32 rootBundleId,\n bytes32[] memory proof\n ) public virtual override nonReentrant {\n _executeSlowRelayRoot(\n depositor,\n recipient,\n destinationToken,\n amount,\n originChainId,\n chainId(),\n realizedLpFeePct,\n relayerFeePct,\n depositId,\n rootBundleId,\n proof\n );\n }\n\n /**\n * @notice Executes a relayer refund leaf stored as part of a root bundle. Will send the relayer the amount they\n * sent to the recipient plus a relayer fee.\n * @param rootBundleId Unique ID of root bundle containing relayer refund root that this leaf is contained in.\n * @param relayerRefundLeaf Contains all data necessary to reconstruct leaf contained in root bundle and to\n * refund relayer. This data structure is explained in detail in the SpokePoolInterface.\n * @param proof Inclusion proof for this leaf in relayer refund root in root bundle.\n */\n function executeRelayerRefundRoot(\n uint32 rootBundleId,\n SpokePoolInterface.RelayerRefundLeaf memory relayerRefundLeaf,\n bytes32[] memory proof\n ) public virtual override nonReentrant {\n _executeRelayerRefundRoot(rootBundleId, relayerRefundLeaf, proof);\n }\n\n /**************************************\n * VIEW FUNCTIONS *\n **************************************/\n\n /**\n * @notice Returns chain ID for this network.\n * @dev Some L2s like ZKSync don't support the CHAIN_ID opcode so we allow the implementer to override this.\n */\n function chainId() public view virtual override returns (uint256) {\n return block.chainid;\n }\n\n /**************************************\n * INTERNAL FUNCTIONS *\n **************************************/\n\n // Verifies inclusion proof of leaf in root, sends relayer their refund, and sends to HubPool any rebalance\n // transfers.\n function _executeRelayerRefundRoot(\n uint32 rootBundleId,\n SpokePoolInterface.RelayerRefundLeaf memory relayerRefundLeaf,\n bytes32[] memory proof\n ) internal {\n // Check integrity of leaf structure:\n require(relayerRefundLeaf.chainId == chainId(), \"Invalid chainId\");\n require(relayerRefundLeaf.refundAddresses.length == relayerRefundLeaf.refundAmounts.length, \"invalid leaf\");\n\n RootBundle storage rootBundle = rootBundles[rootBundleId];\n\n // Check that inclusionProof proves that relayerRefundLeaf is contained within the relayer refund root.\n // Note: This should revert if the relayerRefundRoot is uninitialized.\n require(MerkleLib.verifyRelayerRefund(rootBundle.relayerRefundRoot, relayerRefundLeaf, proof), \"Bad Proof\");\n\n // Verify the leafId in the leaf has not yet been claimed.\n require(!MerkleLib.isClaimed(rootBundle.claimedBitmap, relayerRefundLeaf.leafId), \"Already claimed\");\n\n // Set leaf as claimed in bitmap. This is passed by reference to the storage rootBundle.\n MerkleLib.setClaimed(rootBundle.claimedBitmap, relayerRefundLeaf.leafId);\n\n // Send each relayer refund address the associated refundAmount for the L2 token address.\n // Note: Even if the L2 token is not enabled on this spoke pool, we should still refund relayers.\n for (uint32 i = 0; i < relayerRefundLeaf.refundAmounts.length; i++) {\n uint256 amount = relayerRefundLeaf.refundAmounts[i];\n if (amount > 0)\n IERC20(relayerRefundLeaf.l2TokenAddress).safeTransfer(relayerRefundLeaf.refundAddresses[i], amount);\n }\n\n // If leaf's amountToReturn is positive, then send L2 --> L1 message to bridge tokens back via\n // chain-specific bridging method.\n if (relayerRefundLeaf.amountToReturn > 0) {\n _bridgeTokensToHubPool(relayerRefundLeaf);\n\n emit TokensBridged(\n relayerRefundLeaf.amountToReturn,\n relayerRefundLeaf.chainId,\n relayerRefundLeaf.leafId,\n relayerRefundLeaf.l2TokenAddress,\n msg.sender\n );\n }\n\n emit ExecutedRelayerRefundRoot(\n relayerRefundLeaf.amountToReturn,\n relayerRefundLeaf.chainId,\n relayerRefundLeaf.refundAmounts,\n rootBundleId,\n relayerRefundLeaf.leafId,\n relayerRefundLeaf.l2TokenAddress,\n relayerRefundLeaf.refundAddresses,\n msg.sender\n );\n }\n\n // Verifies inclusion proof of leaf in root and sends recipient remainder of relay. Marks relay as filled.\n function _executeSlowRelayRoot(\n address depositor,\n address recipient,\n address destinationToken,\n uint256 amount,\n uint256 originChainId,\n uint256 destinationChainId,\n uint64 realizedLpFeePct,\n uint64 relayerFeePct,\n uint32 depositId,\n uint32 rootBundleId,\n bytes32[] memory proof\n ) internal {\n RelayData memory relayData = RelayData({\n depositor: depositor,\n recipient: recipient,\n destinationToken: destinationToken,\n amount: amount,\n originChainId: originChainId,\n destinationChainId: destinationChainId,\n realizedLpFeePct: realizedLpFeePct,\n relayerFeePct: relayerFeePct,\n depositId: depositId\n });\n\n require(\n MerkleLib.verifySlowRelayFulfillment(rootBundles[rootBundleId].slowRelayRoot, relayData, proof),\n \"Invalid proof\"\n );\n\n bytes32 relayHash = _getRelayHash(relayData);\n\n // Note: use relayAmount as the max amount to send, so the relay is always completely filled by the contract's\n // funds in all cases. As this is a slow relay we set the relayerFeePct to 0. This effectively refunds the\n // relayer component of the relayerFee thereby only charging the depositor the LpFee.\n uint256 fillAmountPreFees = _fillRelay(relayHash, relayData, relayData.amount, 0, true);\n\n // Note: Set repayment chain ID to 0 to indicate that there is no repayment to be made. The off-chain data\n // worker can use repaymentChainId=0 as a signal to ignore such relays for refunds. Also, set the relayerFeePct\n // to 0 as slow relays do not pay the caller of this method (depositor is refunded this fee).\n _emitFillRelay(relayHash, fillAmountPreFees, 0, 0, relayData, true);\n }\n\n function _setCrossDomainAdmin(address newCrossDomainAdmin) internal {\n require(newCrossDomainAdmin != address(0), \"Bad bridge router address\");\n crossDomainAdmin = newCrossDomainAdmin;\n emit SetXDomainAdmin(crossDomainAdmin);\n }\n\n function _setHubPool(address newHubPool) internal {\n require(newHubPool != address(0), \"Bad hub pool address\");\n hubPool = newHubPool;\n emit SetHubPool(hubPool);\n }\n\n // Should be overriden by implementing contract depending on how L2 handles sending tokens to L1.\n function _bridgeTokensToHubPool(SpokePoolInterface.RelayerRefundLeaf memory relayerRefundLeaf) internal virtual;\n\n function _verifyUpdateRelayerFeeMessage(\n address depositor,\n uint256 originChainId,\n uint64 newRelayerFeePct,\n uint32 depositId,\n bytes memory depositorSignature\n ) internal view {\n // A depositor can request to speed up an un-relayed deposit by signing a hash containing the relayer\n // fee % to update to and information uniquely identifying the deposit to relay. This information ensures\n // that this signature cannot be re-used for other deposits. The version string is included as a precaution\n // in case this contract is upgraded.\n // Note: we use encode instead of encodePacked because it is more secure, more in the \"warning\" section\n // here: https://docs.soliditylang.org/en/v0.8.11/abi-spec.html#non-standard-packed-mode\n bytes32 expectedDepositorMessageHash = keccak256(\n abi.encode(\"ACROSS-V2-FEE-1.0\", newRelayerFeePct, depositId, originChainId)\n );\n\n // Check the hash corresponding to the https://eth.wiki/json-rpc/API#eth_sign[eth_sign]\n // If the depositor signed a message with a different updated fee (or any other param included in the\n // above keccak156 hash), then this will revert.\n bytes32 ethSignedMessageHash = ECDSA.toEthSignedMessageHash(expectedDepositorMessageHash);\n\n _verifyDepositorUpdateFeeMessage(depositor, ethSignedMessageHash, depositorSignature);\n }\n\n // This function is isolated and made virtual to allow different L2's to implement chain specific recovery of\n // signers from signatures because some L2s might not support ecrecover. To be safe, consider always reverting\n // this function for L2s where ecrecover is different from how it works on Ethereum, otherwise there is the\n // potential to forge a signature from the depositor using a different private key than the original depositor's.\n function _verifyDepositorUpdateFeeMessage(\n address depositor,\n bytes32 ethSignedMessageHash,\n bytes memory depositorSignature\n ) internal view virtual {\n // Note: We purposefully do not support EIP-191 signatures (meaning that multisigs and smart contract wallets\n // like Argent are not supported) because of the possibility that a multisig that signed a message on the origin\n // chain does not have a parallel on this destination chain.\n require(depositor == ECDSA.recover(ethSignedMessageHash, depositorSignature), \"invalid signature\");\n }\n\n function _computeAmountPreFees(uint256 amount, uint64 feesPct) private pure returns (uint256) {\n return (1e18 * amount) / (1e18 - feesPct);\n }\n\n function _computeAmountPostFees(uint256 amount, uint64 feesPct) private pure returns (uint256) {\n return (amount * (1e18 - feesPct)) / 1e18;\n }\n\n function _getRelayHash(SpokePoolInterface.RelayData memory relayData) private pure returns (bytes32) {\n return keccak256(abi.encode(relayData));\n }\n\n // Unwraps ETH and does a transfer to a recipient address. If the recipient is a smart contract then sends WETH.\n function _unwrapWETHTo(address payable to, uint256 amount) internal {\n if (address(to).isContract()) {\n IERC20(address(weth)).safeTransfer(to, amount);\n } else {\n weth.withdraw(amount);\n to.transfer(amount);\n }\n }\n\n /**\n * @notice Caller specifies the max amount of tokens to send to user. Based on this amount and the amount of the\n * relay remaining (as stored in the relayFills mapping), pull the amount of tokens from the caller\n * and send to the recipient.\n * @dev relayFills keeps track of pre-fee fill amounts as a convenience to relayers who want to specify round\n * numbers for the maxTokensToSend parameter or convenient numbers like 100 (i.e. relayers who will fully\n * fill any relay up to 100 tokens, and partial fill with 100 tokens for larger relays).\n * @dev Caller must approve this contract to transfer up to maxTokensToSend of the relayData.destinationToken.\n * The amount to be sent might end up less if there is insufficient relay amount remaining to be sent.\n */\n function _fillRelay(\n bytes32 relayHash,\n RelayData memory relayData,\n uint256 maxTokensToSend,\n uint64 updatableRelayerFeePct,\n bool useContractFunds\n ) internal returns (uint256 fillAmountPreFees) {\n // We limit the relay fees to prevent the user spending all their funds on fees. Note that 0.5e18 (i.e. 50%)\n // fees are just magic numbers. The important point is to prevent the total fee from being 100%, otherwise\n // computing the amount pre fees runs into divide-by-0 issues.\n require(updatableRelayerFeePct < 0.5e18 && relayData.realizedLpFeePct < 0.5e18, \"invalid fees\");\n\n // Check that the relay has not already been completely filled. Note that the relays mapping will point to\n // the amount filled so far for a particular relayHash, so this will start at 0 and increment with each fill.\n require(relayFills[relayHash] < relayData.amount, \"relay filled\");\n\n // Stores the equivalent amount to be sent by the relayer before fees have been taken out.\n if (maxTokensToSend == 0) return 0;\n\n // Derive the amount of the relay filled if the caller wants to send exactly maxTokensToSend tokens to\n // the recipient. For example, if the user wants to send 10 tokens to the recipient, the full relay amount\n // is 100, and the fee %'s total 5%, then this computation would return ~10.5, meaning that to fill 10.5/100\n // of the full relay size, the caller would need to send 10 tokens to the user.\n fillAmountPreFees = _computeAmountPreFees(\n maxTokensToSend,\n (relayData.realizedLpFeePct + updatableRelayerFeePct)\n );\n // If user's specified max amount to send is greater than the amount of the relay remaining pre-fees,\n // we'll pull exactly enough tokens to complete the relay.\n uint256 amountToSend = maxTokensToSend;\n uint256 amountRemainingInRelay = relayData.amount - relayFills[relayHash];\n if (amountRemainingInRelay < fillAmountPreFees) {\n fillAmountPreFees = amountRemainingInRelay;\n\n // The user will fulfill the remainder of the relay, so we need to compute exactly how many tokens post-fees\n // that they need to send to the recipient. Note that if the relayer is filled using contract funds then\n // this is a slow relay.\n amountToSend = _computeAmountPostFees(\n fillAmountPreFees,\n relayData.realizedLpFeePct + updatableRelayerFeePct\n );\n }\n\n // relayFills keeps track of pre-fee fill amounts as a convenience to relayers who want to specify round\n // numbers for the maxTokensToSend parameter or convenient numbers like 100 (i.e. relayers who will fully\n // fill any relay up to 100 tokens, and partial fill with 100 tokens for larger relays).\n relayFills[relayHash] += fillAmountPreFees;\n\n // If relay token is weth then unwrap and send eth.\n if (relayData.destinationToken == address(weth)) {\n // Note: useContractFunds is True if we want to send funds to the recipient directly out of this contract,\n // otherwise we expect the caller to send funds to the recipient. If useContractFunds is True and the\n // recipient wants WETH, then we can assume that WETH is already in the contract, otherwise we'll need the\n // the user to send WETH to this contract. Regardless, we'll need to unwrap it before sending to the user.\n if (!useContractFunds)\n IERC20(relayData.destinationToken).safeTransferFrom(msg.sender, address(this), amountToSend);\n _unwrapWETHTo(payable(relayData.recipient), amountToSend);\n // Else, this is a normal ERC20 token. Send to recipient.\n } else {\n // Note: Similar to note above, send token directly from the contract to the user in the slow relay case.\n if (!useContractFunds)\n IERC20(relayData.destinationToken).safeTransferFrom(msg.sender, relayData.recipient, amountToSend);\n else IERC20(relayData.destinationToken).safeTransfer(relayData.recipient, amountToSend);\n }\n }\n\n // The following internal methods emit events with many params to overcome solidity stack too deep issues.\n function _emitFillRelay(\n bytes32 relayHash,\n uint256 fillAmount,\n uint256 repaymentChainId,\n uint64 relayerFeePct,\n RelayData memory relayData,\n bool isSlowRelay\n ) internal {\n emit FilledRelay(\n relayHash,\n relayData.amount,\n relayFills[relayHash],\n fillAmount,\n repaymentChainId,\n relayData.originChainId,\n relayData.destinationChainId,\n relayerFeePct,\n relayData.realizedLpFeePct,\n relayData.depositId,\n relayData.destinationToken,\n msg.sender,\n relayData.depositor,\n relayData.recipient,\n isSlowRelay\n );\n }\n\n function _emitDeposit(\n uint256 amount,\n uint256 originChainId,\n uint256 destinationChainId,\n uint64 relayerFeePct,\n uint32 depositId,\n uint32 quoteTimestamp,\n address originToken,\n address recipient,\n address depositor\n ) internal {\n emit FundsDeposited(\n amount,\n originChainId,\n destinationChainId,\n relayerFeePct,\n depositId,\n quoteTimestamp,\n originToken,\n recipient,\n depositor\n );\n }\n\n // Implementing contract needs to override this to ensure that only the appropriate cross chain admin can execute\n // certain admin functions. For L2 contracts, the cross chain admin refers to some L1 address or contract, and for\n // L1, this would just be the same admin of the HubPool.\n function _requireAdminSender() internal virtual;\n\n // Added to enable the this contract to receive ETH. Used when unwrapping Weth.\n receive() external payable {}\n}\n" }, "contracts/MerkleLib.sol": { - "content": "// SPDX-License-Identifier: GPL-3.0-only\npragma solidity ^0.8.0;\n\nimport \"@openzeppelin/contracts/utils/cryptography/MerkleProof.sol\";\nimport \"./SpokePoolInterface.sol\";\nimport \"./HubPoolInterface.sol\";\n\n/**\n * @notice Library to help with merkle roots, proofs, and claims.\n */\nlibrary MerkleLib {\n /**\n * @notice Verifies that a repayment is contained within a merkle root.\n * @param root the merkle root.\n * @param rebalance the rebalance struct.\n * @param proof the merkle proof.\n */\n function verifyPoolRebalance(\n bytes32 root,\n HubPoolInterface.PoolRebalanceLeaf memory rebalance,\n bytes32[] memory proof\n ) internal pure returns (bool) {\n return MerkleProof.verify(proof, root, keccak256(abi.encode(rebalance)));\n }\n\n /**\n * @notice Verifies that a relayer refund is contained within a merkle root.\n * @param root the merkle root.\n * @param refund the refund struct.\n * @param proof the merkle proof.\n */\n function verifyRelayerRefund(\n bytes32 root,\n SpokePoolInterface.RelayerRefundLeaf memory refund,\n bytes32[] memory proof\n ) internal pure returns (bool) {\n return MerkleProof.verify(proof, root, keccak256(abi.encode(refund)));\n }\n\n /**\n * @notice Verifies that a distribution is contained within a merkle root.\n * @param root the merkle root.\n * @param slowRelayFulfillment the relayData fulfullment struct.\n * @param proof the merkle proof.\n */\n function verifySlowRelayFulfillment(\n bytes32 root,\n SpokePoolInterface.RelayData memory slowRelayFulfillment,\n bytes32[] memory proof\n ) internal pure returns (bool) {\n return MerkleProof.verify(proof, root, keccak256(abi.encode(slowRelayFulfillment)));\n }\n\n // The following functions are primarily copied from\n // https://github.com/Uniswap/merkle-distributor/blob/master/contracts/MerkleDistributor.sol with minor changes.\n\n /**\n * @notice Tests whether a claim is contained within a claimedBitMap mapping.\n * @param claimedBitMap a simple uint256 mapping in storage used as a bitmap.\n * @param index the index to check in the bitmap.\n * @return bool indicating if the index within the claimedBitMap has been marked as claimed.\n */\n function isClaimed(mapping(uint256 => uint256) storage claimedBitMap, uint256 index) internal view returns (bool) {\n uint256 claimedWordIndex = index / 256;\n uint256 claimedBitIndex = index % 256;\n uint256 claimedWord = claimedBitMap[claimedWordIndex];\n uint256 mask = (1 << claimedBitIndex);\n return claimedWord & mask == mask;\n }\n\n /**\n * @notice Marks an index in a claimedBitMap as claimed.\n * @param claimedBitMap a simple uint256 mapping in storage used as a bitmap.\n * @param index the index to mark in the bitmap.\n */\n function setClaimed(mapping(uint256 => uint256) storage claimedBitMap, uint256 index) internal {\n uint256 claimedWordIndex = index / 256;\n uint256 claimedBitIndex = index % 256;\n claimedBitMap[claimedWordIndex] = claimedBitMap[claimedWordIndex] | (1 << claimedBitIndex);\n }\n\n /**\n * @notice Tests whether a claim is contained within a 1D claimedBitMap mapping.\n * @param claimedBitMap a simple uint256 value, encoding a 1D bitmap.\n * @param index the index to check in the bitmap.\n \\* @return bool indicating if the index within the claimedBitMap has been marked as claimed.\n */\n function isClaimed1D(uint256 claimedBitMap, uint256 index) internal pure returns (bool) {\n uint256 mask = (1 << index);\n return claimedBitMap & mask == mask;\n }\n\n /**\n * @notice Marks an index in a claimedBitMap as claimed.\n * @param claimedBitMap a simple uint256 mapping in storage used as a bitmap.\n * @param index the index to mark in the bitmap.\n */\n function setClaimed1D(uint256 claimedBitMap, uint256 index) internal pure returns (uint256) {\n require(index <= 255, \"Index out of bounds\");\n return claimedBitMap | (1 << index % 256);\n }\n}\n" + "content": "// SPDX-License-Identifier: GPL-3.0-only\npragma solidity ^0.8.0;\n\nimport \"./SpokePoolInterface.sol\";\nimport \"./HubPoolInterface.sol\";\n\nimport \"@openzeppelin/contracts/utils/cryptography/MerkleProof.sol\";\n\n/**\n * @notice Library to help with merkle roots, proofs, and claims.\n */\nlibrary MerkleLib {\n /**\n * @notice Verifies that a repayment is contained within a merkle root.\n * @param root the merkle root.\n * @param rebalance the rebalance struct.\n * @param proof the merkle proof.\n * @return bool to signal if the pool rebalance proof correctly shows inclusion of the rebalance within the tree.\n */\n function verifyPoolRebalance(\n bytes32 root,\n HubPoolInterface.PoolRebalanceLeaf memory rebalance,\n bytes32[] memory proof\n ) internal pure returns (bool) {\n return MerkleProof.verify(proof, root, keccak256(abi.encode(rebalance)));\n }\n\n /**\n * @notice Verifies that a relayer refund is contained within a merkle root.\n * @param root the merkle root.\n * @param refund the refund struct.\n * @param proof the merkle proof.\n * @return bool to signal if the relayer refund proof correctly shows inclusion of the refund within the tree.\n */\n function verifyRelayerRefund(\n bytes32 root,\n SpokePoolInterface.RelayerRefundLeaf memory refund,\n bytes32[] memory proof\n ) internal pure returns (bool) {\n return MerkleProof.verify(proof, root, keccak256(abi.encode(refund)));\n }\n\n /**\n * @notice Verifies that a distribution is contained within a merkle root.\n * @param root the merkle root.\n * @param slowRelayFulfillment the relayData fulfillment struct.\n * @param proof the merkle proof.\n * @return bool to signal if the slow relay's proof correctly shows inclusion of the slow relay within the tree.\n */\n function verifySlowRelayFulfillment(\n bytes32 root,\n SpokePoolInterface.RelayData memory slowRelayFulfillment,\n bytes32[] memory proof\n ) internal pure returns (bool) {\n return MerkleProof.verify(proof, root, keccak256(abi.encode(slowRelayFulfillment)));\n }\n\n // The following functions are primarily copied from\n // https://github.com/Uniswap/merkle-distributor/blob/master/contracts/MerkleDistributor.sol with minor changes.\n\n /**\n * @notice Tests whether a claim is contained within a claimedBitMap mapping.\n * @param claimedBitMap a simple uint256 mapping in storage used as a bitmap.\n * @param index the index to check in the bitmap.\n * @return bool indicating if the index within the claimedBitMap has been marked as claimed.\n */\n function isClaimed(mapping(uint256 => uint256) storage claimedBitMap, uint256 index) internal view returns (bool) {\n uint256 claimedWordIndex = index / 256;\n uint256 claimedBitIndex = index % 256;\n uint256 claimedWord = claimedBitMap[claimedWordIndex];\n uint256 mask = (1 << claimedBitIndex);\n return claimedWord & mask == mask;\n }\n\n /**\n * @notice Marks an index in a claimedBitMap as claimed.\n * @param claimedBitMap a simple uint256 mapping in storage used as a bitmap.\n * @param index the index to mark in the bitmap.\n */\n function setClaimed(mapping(uint256 => uint256) storage claimedBitMap, uint256 index) internal {\n uint256 claimedWordIndex = index / 256;\n uint256 claimedBitIndex = index % 256;\n claimedBitMap[claimedWordIndex] = claimedBitMap[claimedWordIndex] | (1 << claimedBitIndex);\n }\n\n /**\n * @notice Tests whether a claim is contained within a 1D claimedBitMap mapping.\n * @param claimedBitMap a simple uint256 value, encoding a 1D bitmap.\n * @param index the index to check in the bitmap. Uint8 type enforces that index can't be > 255.\n * @return bool indicating if the index within the claimedBitMap has been marked as claimed.\n */\n function isClaimed1D(uint256 claimedBitMap, uint8 index) internal pure returns (bool) {\n uint256 mask = (1 << index);\n return claimedBitMap & mask == mask;\n }\n\n /**\n * @notice Marks an index in a claimedBitMap as claimed.\n * @param claimedBitMap a simple uint256 mapping in storage used as a bitmap. Uint8 type enforces that index\n * can't be > 255.\n * @param index the index to mark in the bitmap.\n * @return uint256 representing the modified input claimedBitMap with the index set to true.\n */\n function setClaimed1D(uint256 claimedBitMap, uint8 index) internal pure returns (uint256) {\n return claimedBitMap | (1 << index % 256);\n }\n}\n" }, "contracts/interfaces/WETH9.sol": { "content": "// SPDX-License-Identifier: GPL-3.0-only\npragma solidity ^0.8.0;\n\ninterface WETH9 {\n function withdraw(uint256 wad) external;\n\n function deposit() external payable;\n\n function balanceOf(address guy) external view returns (uint256 wad);\n\n function transfer(address guy, uint256 wad) external;\n}\n" }, + "contracts/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 * @dev The reason why we use this local contract instead of importing from uma/contracts is because of the addition\n * of the internal method `functionCallStackOriginatesFromOutsideThisContract` which doesn't exist in the one exported\n * by uma/contracts.\n */\ncontract Lockable {\n bool internal _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 /**\n * @dev Returns true if the contract is currently in a non-entered state, meaning that the origination of the call\n * came from outside the contract. This is relevant with fallback/receive methods to see if the call came from ETH\n * being dropped onto the contract externally or due to ETH dropped on the the contract from within a method in this\n * contract, such as unwrapping WETH to ETH within the contract.\n */\n function functionCallStackOriginatesFromOutsideThisContract() internal view returns (bool) {\n return _notEntered;\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" + }, + "contracts/SpokePoolInterface.sol": { + "content": "// SPDX-License-Identifier: GPL-3.0-only\npragma solidity ^0.8.0;\n\n/**\n * @notice Contains common data structures and functions used by all SpokePool implementations.\n */\ninterface SpokePoolInterface {\n // This leaf is meant to be decoded in the SpokePool to pay out successful relayers.\n struct RelayerRefundLeaf {\n // This is the amount to return to the HubPool. This occurs when there is a PoolRebalanceLeaf netSendAmount that\n // is negative. This is just the negative of this value.\n uint256 amountToReturn;\n // Used to verify that this is being executed on the correct destination chainId.\n uint256 chainId;\n // This array designates how much each of those addresses should be refunded.\n uint256[] refundAmounts;\n // Used as the index in the bitmap to track whether this leaf has been executed or not.\n uint32 leafId;\n // The associated L2TokenAddress that these claims apply to.\n address l2TokenAddress;\n // Must be same length as refundAmounts and designates each address that must be refunded.\n address[] refundAddresses;\n }\n\n // This struct represents the data to fully specify a relay. If any portion of this data differs, the relay is\n // considered to be completely distinct. Only one relay for a particular depositId, chainId pair should be\n // considered valid and repaid. This data is hashed and inserted into the slow relay merkle root so that an off\n // chain validator can choose when to refund slow relayers.\n struct RelayData {\n // The address that made the deposit on the origin chain.\n address depositor;\n // The recipient address on the destination chain.\n address recipient;\n // The corresponding token address on the destination chain.\n address destinationToken;\n // The total relay amount before fees are taken out.\n uint256 amount;\n // Origin chain id.\n uint256 originChainId;\n // Destination chain id.\n uint256 destinationChainId;\n // The LP Fee percentage computed by the relayer based on the deposit's quote timestamp\n // and the HubPool's utilization.\n uint64 realizedLpFeePct;\n // The relayer fee percentage specified in the deposit.\n uint64 relayerFeePct;\n // The id uniquely identifying this deposit on the origin chain.\n uint32 depositId;\n }\n\n // Stores collection of merkle roots that can be published to this contract from the HubPool, which are referenced\n // by \"data workers\" via inclusion proofs to execute leaves in the roots.\n struct RootBundle {\n // Merkle root of slow relays that were not fully filled and whose recipient is still owed funds from the LP pool.\n bytes32 slowRelayRoot;\n // Merkle root of relayer refunds for successful relays.\n bytes32 relayerRefundRoot;\n // This is a 2D bitmap tracking which leaves in the relayer refund root have been claimed, with max size of\n // 256x256 leaves per root.\n mapping(uint256 => uint256) claimedBitmap;\n }\n\n function setCrossDomainAdmin(address newCrossDomainAdmin) external;\n\n function setHubPool(address newHubPool) external;\n\n function setEnableRoute(\n address originToken,\n uint256 destinationChainId,\n bool enable\n ) external;\n\n function setDepositQuoteTimeBuffer(uint32 buffer) external;\n\n function relayRootBundle(bytes32 relayerRefundRoot, bytes32 slowRelayRoot) external;\n\n function emergencyDeleteRootBundle(uint256 rootBundleId) external;\n\n function deposit(\n address recipient,\n address originToken,\n uint256 amount,\n uint256 destinationChainId,\n uint64 relayerFeePct,\n uint32 quoteTimestamp\n ) external payable;\n\n function speedUpDeposit(\n address depositor,\n uint64 newRelayerFeePct,\n uint32 depositId,\n bytes memory depositorSignature\n ) external;\n\n function fillRelay(\n address depositor,\n address recipient,\n address destinationToken,\n uint256 amount,\n uint256 maxTokensToSend,\n uint256 repaymentChainId,\n uint256 originChainId,\n uint64 realizedLpFeePct,\n uint64 relayerFeePct,\n uint32 depositId\n ) external;\n\n function fillRelayWithUpdatedFee(\n address depositor,\n address recipient,\n address destinationToken,\n uint256 amount,\n uint256 maxTokensToSend,\n uint256 repaymentChainId,\n uint256 originChainId,\n uint64 realizedLpFeePct,\n uint64 relayerFeePct,\n uint64 newRelayerFeePct,\n uint32 depositId,\n bytes memory depositorSignature\n ) external;\n\n function executeSlowRelayRoot(\n address depositor,\n address recipient,\n address destinationToken,\n uint256 amount,\n uint256 originChainId,\n uint64 realizedLpFeePct,\n uint64 relayerFeePct,\n uint32 depositId,\n uint32 rootBundleId,\n bytes32[] memory proof\n ) external;\n\n function executeRelayerRefundRoot(\n uint32 rootBundleId,\n SpokePoolInterface.RelayerRefundLeaf memory relayerRefundLeaf,\n bytes32[] memory proof\n ) external;\n\n function chainId() external view returns (uint256);\n}\n" + }, "@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol": { "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts v4.4.1 (token/ERC20/utils/SafeERC20.sol)\n\npragma solidity ^0.8.0;\n\nimport \"../IERC20.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 function safeTransfer(\n IERC20 token,\n address to,\n uint256 value\n ) internal {\n _callOptionalReturn(token, abi.encodeWithSelector(token.transfer.selector, to, value));\n }\n\n function safeTransferFrom(\n IERC20 token,\n address from,\n address to,\n uint256 value\n ) 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(\n IERC20 token,\n address spender,\n uint256 value\n ) 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 function safeIncreaseAllowance(\n IERC20 token,\n address spender,\n uint256 value\n ) internal {\n uint256 newAllowance = token.allowance(address(this), spender) + value;\n _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, newAllowance));\n }\n\n function safeDecreaseAllowance(\n IERC20 token,\n address spender,\n uint256 value\n ) internal {\n unchecked {\n uint256 oldAllowance = token.allowance(address(this), spender);\n require(oldAllowance >= value, \"SafeERC20: decreased allowance below zero\");\n uint256 newAllowance = oldAllowance - value;\n _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, newAllowance));\n }\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 if (returndata.length > 0) {\n // Return data is optional\n require(abi.decode(returndata, (bool)), \"SafeERC20: ERC20 operation did not succeed\");\n }\n }\n}\n" }, @@ -25,9 +28,6 @@ "@openzeppelin/contracts/utils/Address.sol": { "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.5.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 *\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://diligence.consensys.net/posts/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.5.11/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 functionCall(target, data, \"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(\n address target,\n bytes memory data,\n uint256 value\n ) 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 require(isContract(target), \"Address: call to non-contract\");\n\n (bool success, bytes memory returndata) = target.call{value: value}(data);\n return verifyCallResult(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 require(isContract(target), \"Address: static call to non-contract\");\n\n (bool success, bytes memory returndata) = target.staticcall(data);\n return verifyCallResult(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 require(isContract(target), \"Address: delegate call to non-contract\");\n\n (bool success, bytes memory returndata) = target.delegatecall(data);\n return verifyCallResult(success, returndata, errorMessage);\n }\n\n /**\n * @dev Tool to verifies that a low level call was successful, and revert if it wasn't, either by bubbling the\n * revert reason 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 // 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\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}\n" }, - "@openzeppelin/contracts/utils/cryptography/SignatureChecker.sol": { - "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.5.0) (utils/cryptography/SignatureChecker.sol)\n\npragma solidity ^0.8.0;\n\nimport \"./ECDSA.sol\";\nimport \"../Address.sol\";\nimport \"../../interfaces/IERC1271.sol\";\n\n/**\n * @dev Signature verification helper that can be used instead of `ECDSA.recover` to seamlessly support both ECDSA\n * signatures from externally owned accounts (EOAs) as well as ERC1271 signatures from smart contract wallets like\n * Argent and Gnosis Safe.\n *\n * _Available since v4.1._\n */\nlibrary SignatureChecker {\n /**\n * @dev Checks if a signature is valid for a given signer and data hash. If the signer is a smart contract, the\n * signature is validated against that smart contract using ERC1271, otherwise it's validated using `ECDSA.recover`.\n *\n * NOTE: Unlike ECDSA signatures, contract signatures are revocable, and the outcome of this function can thus\n * change through time. It could return true at block N and false at block N+1 (or the opposite).\n */\n function isValidSignatureNow(\n address signer,\n bytes32 hash,\n bytes memory signature\n ) internal view returns (bool) {\n (address recovered, ECDSA.RecoverError error) = ECDSA.tryRecover(hash, signature);\n if (error == ECDSA.RecoverError.NoError && recovered == signer) {\n return true;\n }\n\n (bool success, bytes memory result) = signer.staticcall(\n abi.encodeWithSelector(IERC1271.isValidSignature.selector, hash, signature)\n );\n return (success && result.length == 32 && abi.decode(result, (bytes4)) == IERC1271.isValidSignature.selector);\n }\n}\n" - }, "@openzeppelin/contracts/utils/cryptography/ECDSA.sol": { "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.5.0) (utils/cryptography/ECDSA.sol)\n\npragma solidity ^0.8.0;\n\nimport \"../Strings.sol\";\n\n/**\n * @dev Elliptic Curve Digital Signature Algorithm (ECDSA) operations.\n *\n * These functions can be used to verify that a message was signed by the holder\n * of the private keys of a given address.\n */\nlibrary ECDSA {\n enum RecoverError {\n NoError,\n InvalidSignature,\n InvalidSignatureLength,\n InvalidSignatureS,\n InvalidSignatureV\n }\n\n function _throwError(RecoverError error) private pure {\n if (error == RecoverError.NoError) {\n return; // no error: do nothing\n } else if (error == RecoverError.InvalidSignature) {\n revert(\"ECDSA: invalid signature\");\n } else if (error == RecoverError.InvalidSignatureLength) {\n revert(\"ECDSA: invalid signature length\");\n } else if (error == RecoverError.InvalidSignatureS) {\n revert(\"ECDSA: invalid signature 's' value\");\n } else if (error == RecoverError.InvalidSignatureV) {\n revert(\"ECDSA: invalid signature 'v' value\");\n }\n }\n\n /**\n * @dev Returns the address that signed a hashed message (`hash`) with\n * `signature` or error string. This address can then be used for verification purposes.\n *\n * The `ecrecover` EVM opcode allows for malleable (non-unique) signatures:\n * this function rejects them by requiring the `s` value to be in the lower\n * half order, and the `v` value to be either 27 or 28.\n *\n * IMPORTANT: `hash` _must_ be the result of a hash operation for the\n * verification to be secure: it is possible to craft signatures that\n * recover to arbitrary addresses for non-hashed data. A safe way to ensure\n * this is by receiving a hash of the original message (which may otherwise\n * be too long), and then calling {toEthSignedMessageHash} on it.\n *\n * Documentation for signature generation:\n * - with https://web3js.readthedocs.io/en/v1.3.4/web3-eth-accounts.html#sign[Web3.js]\n * - with https://docs.ethers.io/v5/api/signer/#Signer-signMessage[ethers]\n *\n * _Available since v4.3._\n */\n function tryRecover(bytes32 hash, bytes memory signature) internal pure returns (address, RecoverError) {\n // Check the signature length\n // - case 65: r,s,v signature (standard)\n // - case 64: r,vs signature (cf https://eips.ethereum.org/EIPS/eip-2098) _Available since v4.1._\n if (signature.length == 65) {\n bytes32 r;\n bytes32 s;\n uint8 v;\n // ecrecover takes the signature parameters, and the only way to get them\n // currently is to use assembly.\n assembly {\n r := mload(add(signature, 0x20))\n s := mload(add(signature, 0x40))\n v := byte(0, mload(add(signature, 0x60)))\n }\n return tryRecover(hash, v, r, s);\n } else if (signature.length == 64) {\n bytes32 r;\n bytes32 vs;\n // ecrecover takes the signature parameters, and the only way to get them\n // currently is to use assembly.\n assembly {\n r := mload(add(signature, 0x20))\n vs := mload(add(signature, 0x40))\n }\n return tryRecover(hash, r, vs);\n } else {\n return (address(0), RecoverError.InvalidSignatureLength);\n }\n }\n\n /**\n * @dev Returns the address that signed a hashed message (`hash`) with\n * `signature`. This address can then be used for verification purposes.\n *\n * The `ecrecover` EVM opcode allows for malleable (non-unique) signatures:\n * this function rejects them by requiring the `s` value to be in the lower\n * half order, and the `v` value to be either 27 or 28.\n *\n * IMPORTANT: `hash` _must_ be the result of a hash operation for the\n * verification to be secure: it is possible to craft signatures that\n * recover to arbitrary addresses for non-hashed data. A safe way to ensure\n * this is by receiving a hash of the original message (which may otherwise\n * be too long), and then calling {toEthSignedMessageHash} on it.\n */\n function recover(bytes32 hash, bytes memory signature) internal pure returns (address) {\n (address recovered, RecoverError error) = tryRecover(hash, signature);\n _throwError(error);\n return recovered;\n }\n\n /**\n * @dev Overload of {ECDSA-tryRecover} that receives the `r` and `vs` short-signature fields separately.\n *\n * See https://eips.ethereum.org/EIPS/eip-2098[EIP-2098 short signatures]\n *\n * _Available since v4.3._\n */\n function tryRecover(\n bytes32 hash,\n bytes32 r,\n bytes32 vs\n ) internal pure returns (address, RecoverError) {\n bytes32 s = vs & bytes32(0x7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff);\n uint8 v = uint8((uint256(vs) >> 255) + 27);\n return tryRecover(hash, v, r, s);\n }\n\n /**\n * @dev Overload of {ECDSA-recover} that receives the `r and `vs` short-signature fields separately.\n *\n * _Available since v4.2._\n */\n function recover(\n bytes32 hash,\n bytes32 r,\n bytes32 vs\n ) internal pure returns (address) {\n (address recovered, RecoverError error) = tryRecover(hash, r, vs);\n _throwError(error);\n return recovered;\n }\n\n /**\n * @dev Overload of {ECDSA-tryRecover} that receives the `v`,\n * `r` and `s` signature fields separately.\n *\n * _Available since v4.3._\n */\n function tryRecover(\n bytes32 hash,\n uint8 v,\n bytes32 r,\n bytes32 s\n ) internal pure returns (address, RecoverError) {\n // EIP-2 still allows signature malleability for ecrecover(). Remove this possibility and make the signature\n // unique. Appendix F in the Ethereum Yellow paper (https://ethereum.github.io/yellowpaper/paper.pdf), defines\n // the valid range for s in (301): 0 < s < secp256k1n ÷ 2 + 1, and for v in (302): v ∈ {27, 28}. Most\n // signatures from current libraries generate a unique signature with an s-value in the lower half order.\n //\n // If your library generates malleable signatures, such as s-values in the upper range, calculate a new s-value\n // with 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFEBAAEDCE6AF48A03BBFD25E8CD0364141 - s1 and flip v from 27 to 28 or\n // vice versa. If your library also generates signatures with 0/1 for v instead 27/28, add 27 to v to accept\n // these malleable signatures as well.\n if (uint256(s) > 0x7FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF5D576E7357A4501DDFE92F46681B20A0) {\n return (address(0), RecoverError.InvalidSignatureS);\n }\n if (v != 27 && v != 28) {\n return (address(0), RecoverError.InvalidSignatureV);\n }\n\n // If the signature is valid (and not malleable), return the signer address\n address signer = ecrecover(hash, v, r, s);\n if (signer == address(0)) {\n return (address(0), RecoverError.InvalidSignature);\n }\n\n return (signer, RecoverError.NoError);\n }\n\n /**\n * @dev Overload of {ECDSA-recover} that receives the `v`,\n * `r` and `s` signature fields separately.\n */\n function recover(\n bytes32 hash,\n uint8 v,\n bytes32 r,\n bytes32 s\n ) internal pure returns (address) {\n (address recovered, RecoverError error) = tryRecover(hash, v, r, s);\n _throwError(error);\n return recovered;\n }\n\n /**\n * @dev Returns an Ethereum Signed Message, created from a `hash`. This\n * produces hash corresponding to the one signed with the\n * https://eth.wiki/json-rpc/API#eth_sign[`eth_sign`]\n * JSON-RPC method as part of EIP-191.\n *\n * See {recover}.\n */\n function toEthSignedMessageHash(bytes32 hash) internal pure returns (bytes32) {\n // 32 is the length in bytes of hash,\n // enforced by the type signature above\n return keccak256(abi.encodePacked(\"\\x19Ethereum Signed Message:\\n32\", hash));\n }\n\n /**\n * @dev Returns an Ethereum Signed Message, created from `s`. This\n * produces hash corresponding to the one signed with the\n * https://eth.wiki/json-rpc/API#eth_sign[`eth_sign`]\n * JSON-RPC method as part of EIP-191.\n *\n * See {recover}.\n */\n function toEthSignedMessageHash(bytes memory s) internal pure returns (bytes32) {\n return keccak256(abi.encodePacked(\"\\x19Ethereum Signed Message:\\n\", Strings.toString(s.length), s));\n }\n\n /**\n * @dev Returns an Ethereum Signed Typed Data, created from a\n * `domainSeparator` and a `structHash`. This produces hash corresponding\n * to the one signed with the\n * https://eips.ethereum.org/EIPS/eip-712[`eth_signTypedData`]\n * JSON-RPC method as part of EIP-712.\n *\n * See {recover}.\n */\n function toTypedDataHash(bytes32 domainSeparator, bytes32 structHash) internal pure returns (bytes32) {\n return keccak256(abi.encodePacked(\"\\x19\\x01\", domainSeparator, structHash));\n }\n}\n" }, @@ -37,20 +37,14 @@ "@uma/core/contracts/common/implementation/MultiCaller.sol": { "content": "// This contract is taken from Uniswaps'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.\npragma solidity ^0.8.0;\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 payable returns (bytes[] memory results) {\n require(msg.value == 0, \"Only multicall with 0 value\");\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/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 * @dev The reason why we use this local contract instead of importing from uma/contracts is because of the addition\n * of the internal method `functionCallStackOriginatesFromOutsideThisContract` which doesn't exist in the one exported\n * by uma/contracts.\n */\ncontract Lockable {\n bool internal _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 /**\n * @dev Returns true if the contract is currently in a non-entered state, meaning that the origination of the call\n * came from outside the contract. This is relevant with fallback/receive methods to see if the call came from ETH\n * being dropped onto the contract externally or due to ETH dropped on the the contract from within a method in this\n * contract, such as unwrapping WETH to ETH within the contract.\n */\n function functionCallStackOriginatesFromOutsideThisContract() internal view returns (bool) {\n return _notEntered;\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" + "contracts/HubPoolInterface.sol": { + "content": "// SPDX-License-Identifier: GPL-3.0-only\npragma solidity ^0.8.0;\n\nimport \"./interfaces/AdapterInterface.sol\";\n\nimport \"@openzeppelin/contracts/token/ERC20/IERC20.sol\";\n\n/**\n * @notice Concise list of functions in HubPool implementation.\n */\ninterface HubPoolInterface {\n // This leaf is meant to be decoded in the HubPool to rebalance tokens between HubPool and SpokePool.\n struct PoolRebalanceLeaf {\n // This is used to know which chain to send cross-chain transactions to (and which SpokePool to send to).\n uint256 chainId;\n // Total LP fee amount per token in this bundle, encompassing all associated bundled relays.\n uint256[] bundleLpFees;\n // This array is grouped with the two above, and it represents the amount to send or request back from the\n // SpokePool. If positive, the pool will pay the SpokePool. If negative the SpokePool will pay the HubPool.\n // There can be arbitrarily complex rebalancing rules defined offchain. This number is only nonzero when the\n // rules indicate that a rebalancing action should occur. When a rebalance does occur, runningBalances should be\n // set to zero for this token and the netSendAmounts should be set to the previous runningBalances + relays -\n // deposits in this bundle. If non-zero then it must be set on the SpokePool's RelayerRefundLeaf amountToReturn\n // as -1 * this value to indicate if funds are being sent from or to the SpokePool.\n int256[] netSendAmounts;\n // This is only here to be emitted in an event to track a running unpaid balance between the L2 pool and the L1\n // pool. A positive number indicates that the HubPool owes the SpokePool funds. A negative number indicates that\n // the SpokePool owes the HubPool funds. See the comment above for the dynamics of this and netSendAmounts.\n int256[] runningBalances;\n // Used by data worker to mark which leaves should relay roots to SpokePools, and to otherwise organize leaves.\n // For example, each leaf should contain all the rebalance information for a single chain, but in the case where\n // the list of l1Tokens is very large such that they all can't fit into a single leaf that can be executed under\n // the block gas limit, then the data worker can use this groupIndex to organize them. Any leaves with\n // a groupIndex equal to 0 will relay roots to the SpokePool, so the data worker should ensure that only one\n // leaf for a specific chainId should have a groupIndex equal to 0.\n uint256 groupIndex;\n // Used as the index in the bitmap to track whether this leaf has been executed or not.\n uint8 leafId;\n // The following arrays are required to be the same length. They are parallel arrays for the given chainId and\n // should be ordered by the l1Tokens field. All whitelisted tokens with nonzero relays on this chain in this\n // bundle in the order of whitelisting.\n address[] l1Tokens;\n }\n\n // A data worker can optimistically store several merkle roots on this contract by staking a bond and calling\n // proposeRootBundle. By staking a bond, the data worker is alleging that the merkle roots all contain valid leaves\n // that can be executed later to:\n // - Send funds from this contract to a SpokePool or vice versa\n // - Send funds from a SpokePool to Relayer as a refund for a relayed deposit\n // - Send funds from a SpokePool to a deposit recipient to fulfill a \"slow\" relay\n // Anyone can dispute this struct if the merkle roots contain invalid leaves before the\n // requestExpirationTimestamp. Once the expiration timestamp is passed, executeRootBundle to execute a leaf\n // from the poolRebalanceRoot on this contract and it will simultaneously publish the relayerRefundRoot and\n // slowRelayRoot to a SpokePool. The latter two roots, once published to the SpokePool, contain\n // leaves that can be executed on the SpokePool to pay relayers or recipients.\n struct RootBundle {\n // Contains leaves instructing this contract to send funds to SpokePools.\n bytes32 poolRebalanceRoot;\n // Relayer refund merkle root to be published to a SpokePool.\n bytes32 relayerRefundRoot;\n // Slow relay merkle root to be published to a SpokePool.\n bytes32 slowRelayRoot;\n // This is a 1D bitmap, with max size of 256 elements, limiting us to 256 chainsIds.\n uint256 claimedBitMap;\n // Proposer of this root bundle.\n address proposer;\n // Number of pool rebalance leaves to execute in the poolRebalanceRoot. After this number\n // of leaves are executed, a new root bundle can be proposed\n uint8 unclaimedPoolRebalanceLeafCount;\n // When root bundle challenge period passes and this root bundle becomes executable.\n uint32 requestExpirationTimestamp;\n }\n\n // Each whitelisted L1 token has an associated pooledToken struct that contains all information used to track the\n // cumulative LP positions and if this token is enabled for deposits.\n struct PooledToken {\n // LP token given to LPs of a specific L1 token.\n address lpToken;\n // True if accepting new LP's.\n bool isEnabled;\n // Timestamp of last LP fee update.\n uint32 lastLpFeeUpdate;\n // Number of LP funds sent via pool rebalances to SpokePools and are expected to be sent\n // back later.\n int256 utilizedReserves;\n // Number of LP funds held in contract less utilized reserves.\n uint256 liquidReserves;\n // Number of LP funds reserved to pay out to LPs as fees.\n uint256 undistributedLpFees;\n }\n\n // Helper contracts to facilitate cross chain actions between HubPool and SpokePool for a specific network.\n struct CrossChainContract {\n address adapter;\n address spokePool;\n }\n\n function setPaused(bool pause) external;\n\n function emergencyDeleteProposal() external;\n\n function relaySpokePoolAdminFunction(uint256 chainId, bytes memory functionData) external;\n\n function setProtocolFeeCapture(address newProtocolFeeCaptureAddress, uint256 newProtocolFeeCapturePct) external;\n\n function setBond(IERC20 newBondToken, uint256 newBondAmount) external;\n\n function setLiveness(uint32 newLiveness) external;\n\n function setIdentifier(bytes32 newIdentifier) external;\n\n function setCrossChainContracts(\n uint256 l2ChainId,\n address adapter,\n address spokePool\n ) external;\n\n function enableL1TokenForLiquidityProvision(address l1Token) external;\n\n function disableL1TokenForLiquidityProvision(address l1Token) external;\n\n function addLiquidity(address l1Token, uint256 l1TokenAmount) external payable;\n\n function removeLiquidity(\n address l1Token,\n uint256 lpTokenAmount,\n bool sendEth\n ) external;\n\n function exchangeRateCurrent(address l1Token) external returns (uint256);\n\n function liquidityUtilizationCurrent(address l1Token) external returns (uint256);\n\n function liquidityUtilizationPostRelay(address token, uint256 relayedAmount) external returns (uint256);\n\n function sync(address l1Token) external;\n\n function proposeRootBundle(\n uint256[] memory bundleEvaluationBlockNumbers,\n uint8 poolRebalanceLeafCount,\n bytes32 poolRebalanceRoot,\n bytes32 relayerRefundRoot,\n bytes32 slowRelayRoot\n ) external;\n\n function executeRootBundle(\n uint256 chainId,\n uint256 groupIndex,\n uint256[] memory bundleLpFees,\n int256[] memory netSendAmounts,\n int256[] memory runningBalances,\n uint8 leafId,\n address[] memory l1Tokens,\n bytes32[] memory proof\n ) external;\n\n function disputeRootBundle() external;\n\n function claimProtocolFeesCaptured(address l1Token) external;\n\n function setPoolRebalanceRoute(\n uint256 destinationChainId,\n address l1Token,\n address destinationToken\n ) external;\n\n function setDepositRoute(\n uint256 originChainId,\n uint256 destinationChainId,\n address originToken,\n bool depositsEnabled\n ) external;\n\n function poolRebalanceRoute(uint256 destinationChainId, address l1Token)\n external\n view\n returns (address destinationToken);\n\n function loadEthForL2Calls() external payable;\n}\n" }, "@openzeppelin/contracts/utils/cryptography/MerkleProof.sol": { "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.5.0) (utils/cryptography/MerkleProof.sol)\n\npragma solidity ^0.8.0;\n\n/**\n * @dev These functions deal with verification of Merkle Trees proofs.\n *\n * The proofs can be generated using the JavaScript library\n * https://github.com/miguelmota/merkletreejs[merkletreejs].\n * Note: the hashing algorithm should be keccak256 and pair sorting should be enabled.\n *\n * See `test/utils/cryptography/MerkleProof.test.js` for some examples.\n */\nlibrary MerkleProof {\n /**\n * @dev Returns true if a `leaf` can be proved to be a part of a Merkle tree\n * defined by `root`. For this, a `proof` must be provided, containing\n * sibling hashes on the branch from the leaf to the root of the tree. Each\n * pair of leaves and each pair of pre-images are assumed to be sorted.\n */\n function verify(\n bytes32[] memory proof,\n bytes32 root,\n bytes32 leaf\n ) internal pure returns (bool) {\n return processProof(proof, leaf) == root;\n }\n\n /**\n * @dev Returns the rebuilt hash obtained by traversing a Merklee tree up\n * from `leaf` using `proof`. A `proof` is valid if and only if the rebuilt\n * hash matches the root of the tree. When processing the proof, the pairs\n * of leafs & pre-images are assumed to be sorted.\n *\n * _Available since v4.4._\n */\n function processProof(bytes32[] memory proof, bytes32 leaf) internal pure returns (bytes32) {\n bytes32 computedHash = leaf;\n for (uint256 i = 0; i < proof.length; i++) {\n bytes32 proofElement = proof[i];\n if (computedHash <= proofElement) {\n // Hash(current computed hash + current element of the proof)\n computedHash = _efficientHash(computedHash, proofElement);\n } else {\n // Hash(current element of the proof + current computed hash)\n computedHash = _efficientHash(proofElement, computedHash);\n }\n }\n return computedHash;\n }\n\n function _efficientHash(bytes32 a, bytes32 b) private pure returns (bytes32 value) {\n assembly {\n mstore(0x00, a)\n mstore(0x20, b)\n value := keccak256(0x00, 0x40)\n }\n }\n}\n" }, - "contracts/HubPoolInterface.sol": { - "content": "// SPDX-License-Identifier: GPL-3.0-only\npragma solidity ^0.8.0;\n\nimport \"@openzeppelin/contracts/token/ERC20/IERC20.sol\";\nimport \"./interfaces/AdapterInterface.sol\";\n\n/**\n * @notice Concise list of functions in HubPool implementation.\n */\ninterface HubPoolInterface {\n // This leaf is meant to be decoded in the HubPool to rebalance tokens between HubPool and SpokePool.\n struct PoolRebalanceLeaf {\n // This is used to know which chain to send cross-chain transactions to (and which SpokePool to sent to).\n uint256 chainId;\n // Total LP fee amount per token in this bundle, encompassing all associated bundled relays.\n uint256[] bundleLpFees;\n // This array is grouped with the two above, and it represents the amount to send or request back from the\n // SpokePool. If positive, the pool will pay the SpokePool. If negative the SpokePool will pay the HubPool.\n // There can be arbitrarily complex rebalancing rules defined offchain. This number is only nonzero\n // when the rules indicate that a rebalancing action should occur. When a rebalance does not occur,\n // runningBalances for this token should change by the total relays - deposits in this bundle. When a rebalance\n // does occur, runningBalances should be set to zero for this token and the netSendAmounts should be set to the\n // previous runningBalances + relays - deposits in this bundle.\n int256[] netSendAmounts;\n // This is only here to be emitted in an event to track a running unpaid balance between the L2 pool and the L1 pool.\n // A positive number indicates that the HubPool owes the SpokePool funds. A negative number indicates that the\n // SpokePool owes the HubPool funds. See the comment above for the dynamics of this and netSendAmounts\n int256[] runningBalances;\n // Used as the index in the bitmap to track whether this leaf has been executed or not.\n uint8 leafId;\n // The following arrays are required to be the same length. They are parallel arrays for the given chainId and\n // should be ordered by the l1Tokens field. All whitelisted tokens with nonzero relays on this chain in this\n // bundle in the order of whitelisting.\n address[] l1Tokens;\n }\n\n function relaySpokePoolAdminFunction(uint256 chainId, bytes memory functionData) external;\n\n function setProtocolFeeCapture(address newProtocolFeeCaptureAddress, uint256 newProtocolFeeCapturePct) external;\n\n function setBond(IERC20 newBondToken, uint256 newBondAmount) external;\n\n function setLiveness(uint32 newLiveness) external;\n\n function setIdentifier(bytes32 newIdentifier) external;\n\n function setCrossChainContracts(\n uint256 l2ChainId,\n address adapter,\n address spokePool\n ) external;\n\n function whitelistRoute(\n uint256 originChainId,\n uint256 destinationChainId,\n address originToken,\n address destinationToken,\n bool enableRoute\n ) external;\n\n function enableL1TokenForLiquidityProvision(address l1Token) external;\n\n function disableL1TokenForLiquidityProvision(address l1Token) external;\n\n function addLiquidity(address l1Token, uint256 l1TokenAmount) external payable;\n\n function removeLiquidity(\n address l1Token,\n uint256 lpTokenAmount,\n bool sendEth\n ) external;\n\n function exchangeRateCurrent(address l1Token) external returns (uint256);\n\n function liquidityUtilizationCurrent(address l1Token) external returns (uint256);\n\n function liquidityUtilizationPostRelay(address token, uint256 relayedAmount) external returns (uint256);\n\n function sync(address l1Token) external;\n\n function proposeRootBundle(\n uint256[] memory bundleEvaluationBlockNumbers,\n uint8 poolRebalanceLeafCount,\n bytes32 poolRebalanceRoot,\n bytes32 relayerRefundRoot,\n bytes32 slowRelayRoot\n ) external;\n\n function executeRootBundle(PoolRebalanceLeaf memory poolRebalanceLeaf, bytes32[] memory proof) external;\n\n function disputeRootBundle() external;\n\n function claimProtocolFeesCaptured(address l1Token) external;\n\n function getRootBundleProposalAncillaryData() external view returns (bytes memory ancillaryData);\n\n function whitelistedRoute(\n uint256 originChainId,\n address originToken,\n uint256 destinationChainId\n ) external view returns (address);\n\n function loadEthForL2Calls() external payable;\n}\n" - }, "contracts/interfaces/AdapterInterface.sol": { - "content": "// SPDX-License-Identifier: AGPL-3.0-only\npragma solidity ^0.8.0;\n\n/**\n * @notice Sends cross chain messages and tokens to contracts on a specific L2 network.\n */\n\ninterface AdapterInterface {\n event HubPoolChanged(address newHubPool);\n\n event MessageRelayed(address target, bytes message);\n\n event TokensRelayed(address l1Token, address l2Token, uint256 amount, address to);\n\n function relayMessage(address target, bytes memory message) external payable;\n\n function relayTokens(\n address l1Token,\n address l2Token,\n uint256 amount,\n address to\n ) external payable;\n}\n" - }, - "@openzeppelin/contracts/interfaces/IERC1271.sol": { - "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts v4.4.1 (interfaces/IERC1271.sol)\n\npragma solidity ^0.8.0;\n\n/**\n * @dev Interface of the ERC1271 standard signature validation method for\n * contracts as defined in https://eips.ethereum.org/EIPS/eip-1271[ERC-1271].\n *\n * _Available since v4.1._\n */\ninterface IERC1271 {\n /**\n * @dev Should return whether the signature provided is valid for the provided data\n * @param hash Hash of the data to be signed\n * @param signature Signature byte array associated with _data\n */\n function isValidSignature(bytes32 hash, bytes memory signature) external view returns (bytes4 magicValue);\n}\n" + "content": "// SPDX-License-Identifier: AGPL-3.0-only\npragma solidity ^0.8.0;\n\n/**\n * @notice Sends cross chain messages and tokens to contracts on a specific L2 network.\n */\n\ninterface AdapterInterface {\n event MessageRelayed(address target, bytes message);\n\n event TokensRelayed(address l1Token, address l2Token, uint256 amount, address to);\n\n function relayMessage(address target, bytes memory message) external payable;\n\n function relayTokens(\n address l1Token,\n address l2Token,\n uint256 amount,\n address to\n ) external payable;\n}\n" }, "@openzeppelin/contracts/utils/Strings.sol": { "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts v4.4.1 (utils/Strings.sol)\n\npragma solidity ^0.8.0;\n\n/**\n * @dev String operations.\n */\nlibrary Strings {\n bytes16 private constant _HEX_SYMBOLS = \"0123456789abcdef\";\n\n /**\n * @dev Converts a `uint256` to its ASCII `string` decimal representation.\n */\n function toString(uint256 value) internal pure returns (string memory) {\n // Inspired by OraclizeAPI's implementation - MIT licence\n // https://github.com/oraclize/ethereum-api/blob/b42146b063c7d6ee1358846c198246239e9360e8/oraclizeAPI_0.4.25.sol\n\n if (value == 0) {\n return \"0\";\n }\n uint256 temp = value;\n uint256 digits;\n while (temp != 0) {\n digits++;\n temp /= 10;\n }\n bytes memory buffer = new bytes(digits);\n while (value != 0) {\n digits -= 1;\n buffer[digits] = bytes1(uint8(48 + uint256(value % 10)));\n value /= 10;\n }\n return string(buffer);\n }\n\n /**\n * @dev Converts a `uint256` to its ASCII `string` hexadecimal representation.\n */\n function toHexString(uint256 value) internal pure returns (string memory) {\n if (value == 0) {\n return \"0x00\";\n }\n uint256 temp = value;\n uint256 length = 0;\n while (temp != 0) {\n length++;\n temp >>= 8;\n }\n return toHexString(value, length);\n }\n\n /**\n * @dev Converts a `uint256` to its ASCII `string` hexadecimal representation with fixed length.\n */\n function toHexString(uint256 value, uint256 length) internal pure returns (string memory) {\n bytes memory buffer = new bytes(2 * length + 2);\n buffer[0] = \"0\";\n buffer[1] = \"x\";\n for (uint256 i = 2 * length + 1; i > 1; --i) {\n buffer[i] = _HEX_SYMBOLS[value & 0xf];\n value >>= 4;\n }\n require(value == 0, \"Strings: hex length insufficient\");\n return string(buffer);\n }\n}\n" @@ -59,13 +53,13 @@ "content": "// SPDX-License-Identifier: AGPL-3.0-only\npragma solidity ^0.8.0;\n\n/**\n * @title Universal store of current contract time for testing environments.\n */\ncontract Timer {\n uint256 private currentTime;\n\n constructor() {\n currentTime = block.timestamp; // solhint-disable-line not-rely-on-time\n }\n\n /**\n * @notice Sets the current time.\n * @dev Will revert if not running in test mode.\n * @param time timestamp to set `currentTime` to.\n */\n function setCurrentTime(uint256 time) external {\n currentTime = time;\n }\n\n /**\n * @notice Gets the currentTime variable set in the Timer.\n * @return uint256 for the current Testable timestamp.\n */\n function getCurrentTime() public view returns (uint256) {\n return currentTime;\n }\n}\n" }, "contracts/test/MockSpokePool.sol": { - "content": "//SPDX-License-Identifier: Unlicense\npragma solidity ^0.8.0;\n\nimport \"../SpokePool.sol\";\nimport \"../SpokePoolInterface.sol\";\n\n/**\n * @title MockSpokePool\n * @notice Implements abstract contract for testing.\n */\ncontract MockSpokePool is SpokePoolInterface, SpokePool {\n constructor(\n address _crossDomainAdmin,\n address _hubPool,\n address _wethAddress,\n address timerAddress\n ) SpokePool(_crossDomainAdmin, _hubPool, _wethAddress, timerAddress) {}\n\n function _bridgeTokensToHubPool(RelayerRefundLeaf memory relayerRefundLeaf) internal override {}\n\n function _requireAdminSender() internal override {}\n}\n" + "content": "//SPDX-License-Identifier: Unlicense\npragma solidity ^0.8.0;\n\nimport \"../SpokePool.sol\";\nimport \"../SpokePoolInterface.sol\";\n\n/**\n * @title MockSpokePool\n * @notice Implements abstract contract for testing.\n */\ncontract MockSpokePool is SpokePool {\n uint256 chainId_;\n\n constructor(\n address _crossDomainAdmin,\n address _hubPool,\n address _wethAddress,\n address timerAddress\n ) SpokePool(_crossDomainAdmin, _hubPool, _wethAddress, timerAddress) {}\n\n function _bridgeTokensToHubPool(RelayerRefundLeaf memory relayerRefundLeaf) internal override {}\n\n function _requireAdminSender() internal override {}\n\n function chainId() public view override(SpokePool) returns (uint256) {\n // If chainId_ is set then return it, else do nothing and return the parent chainId().\n return chainId_ == 0 ? super.chainId() : chainId_;\n }\n\n function setChainId(uint256 _chainId) public {\n chainId_ = _chainId;\n }\n}\n" }, - "contracts/Polygon_SpokePool.sol": { - "content": "// SPDX-License-Identifier: GPL-3.0-only\npragma solidity ^0.8.0;\n\nimport \"./interfaces/WETH9.sol\";\nimport \"@openzeppelin/contracts/token/ERC20/IERC20.sol\";\nimport \"@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol\";\nimport \"./SpokePool.sol\";\nimport \"./SpokePoolInterface.sol\";\nimport \"./PolygonTokenBridger.sol\";\n\n// IFxMessageProcessor represents interface to process messages.\ninterface IFxMessageProcessor {\n function processMessageFromRoot(\n uint256 stateId,\n address rootMessageSender,\n bytes calldata data\n ) external;\n}\n\n/**\n * @notice Polygon specific SpokePool.\n */\ncontract Polygon_SpokePool is IFxMessageProcessor, SpokePool {\n using SafeERC20 for PolygonIERC20;\n\n // Address of FxChild which sends and receives messages to and from L1.\n address public fxChild;\n\n // Contract deployed on L1 and L2 processes all cross-chain transfers between this contract and the the HubPool.\n // Required because bridging tokens from Polygon to Ethereum has special constraints.\n PolygonTokenBridger public polygonTokenBridger;\n\n // Internal variable that only flips temporarily to true upon receiving messages from L1. Used to authenticate that\n // the caller is the fxChild AND that the fxChild called processMessageFromRoot\n bool private callValidated = false;\n\n event PolygonTokensBridged(address indexed token, address indexed receiver, uint256 amount);\n event SetFxChild(address indexed newFxChild);\n event SetPolygonTokenBridger(address indexed polygonTokenBridger);\n\n // Note: validating calls this way ensures that strange calls coming from the fxChild won't be misinterpreted.\n // Put differently, just checking that msg.sender == fxChild is not sufficient.\n // All calls that have admin priviledges must be fired from within the processMessageFromRoot method that's gone\n // through validation where the sender is checked and the root (mainnet) sender is also validated.\n // This modifier sets the callValidated variable so this condition can be checked in _requireAdminSender().\n modifier validateInternalCalls() {\n // This sets a variable indicating that we're now inside a validated call.\n // Note: this is used by other methods to ensure that this call has been validated by this method and is not\n // spoofed. See\n callValidated = true;\n\n _;\n\n // Reset callValidated to false to disallow admin calls after this method exits.\n callValidated = false;\n }\n\n /**\n * @notice Construct the Polygon SpokePool.\n * @param _polygonTokenBridger Token routing contract that sends tokens from here to HubPool. Changeable by Admin.\n * @param _crossDomainAdmin Cross domain admin to set. Can be changed by admin.\n * @param _hubPool Hub pool address to set. Can be changed by admin.\n * @param _wmaticAddress Replaces _wethAddress for this network since MATIC is the gas token and sent via msg.value\n * on Polygon.\n * @param _fxChild FxChild contract, changeable by Admin.\n * @param timerAddress Timer address to set.\n */\n constructor(\n PolygonTokenBridger _polygonTokenBridger,\n address _crossDomainAdmin,\n address _hubPool,\n address _wmaticAddress, // Note: wmatic is used here since it is the token sent via msg.value on polygon.\n address _fxChild,\n address timerAddress\n ) SpokePool(_crossDomainAdmin, _hubPool, _wmaticAddress, timerAddress) {\n polygonTokenBridger = _polygonTokenBridger;\n fxChild = _fxChild;\n }\n\n /********************************************************\n * ARBITRUM-SPECIFIC CROSS-CHAIN ADMIN FUNCTIONS *\n ********************************************************/\n\n /**\n * @notice Change FxChild address. Callable only by admin via processMessageFromRoot.\n * @param newFxChild New FxChild.\n */\n function setFxChild(address newFxChild) public onlyAdmin {\n fxChild = newFxChild;\n emit SetFxChild(fxChild);\n }\n\n /**\n * @notice Change polygonTokenBridger address. Callable only by admin via processMessageFromRoot.\n * @param newPolygonTokenBridger New Polygon Token Bridger contract.\n */\n function setPolygonTokenBridger(address payable newPolygonTokenBridger) public onlyAdmin {\n polygonTokenBridger = PolygonTokenBridger(newPolygonTokenBridger);\n emit SetPolygonTokenBridger(address(polygonTokenBridger));\n }\n\n /**\n * @notice Called by FxChild upon receiving L1 message that targets this contract. Performs an additional check\n * that the L1 caller was the expected cross domain admin, and then delegate calls.\n * @notice Polygon bridge only executes this external function on the target Polygon contract when relaying\n * messages from L1, so all functions on this SpokePool are expected to originate via this call.\n * @dev stateId value isn't used because it isn't relevant for this method. It doesn't care what state sync\n * triggered this call.\n * @param rootMessageSender Original L1 sender of data.\n * @param data ABI encoded function call to execute on this contract.\n */\n function processMessageFromRoot(\n uint256, /*stateId*/\n address rootMessageSender,\n bytes calldata data\n ) public validateInternalCalls nonReentrant {\n // Validation logic.\n require(msg.sender == fxChild, \"Not from fxChild\");\n require(rootMessageSender == crossDomainAdmin, \"Not from mainnet admin\");\n\n // This uses delegatecall to take the information in the message and process it as a function call on this contract.\n (bool success, ) = address(this).delegatecall(data);\n require(success, \"delegatecall failed\");\n }\n\n /**************************************\n * INTERNAL FUNCTIONS *\n **************************************/\n\n function _bridgeTokensToHubPool(RelayerRefundLeaf memory relayerRefundLeaf) internal override {\n PolygonIERC20(relayerRefundLeaf.l2TokenAddress).safeIncreaseAllowance(\n address(polygonTokenBridger),\n relayerRefundLeaf.amountToReturn\n );\n\n // Note: WETH is WMATIC on matic, so this tells the tokenbridger that this is an unwrappable native token.\n polygonTokenBridger.send(\n PolygonIERC20(relayerRefundLeaf.l2TokenAddress),\n relayerRefundLeaf.amountToReturn,\n address(weth) == relayerRefundLeaf.l2TokenAddress\n );\n\n emit PolygonTokensBridged(relayerRefundLeaf.l2TokenAddress, address(this), relayerRefundLeaf.amountToReturn);\n }\n\n function _requireAdminSender() internal view override {\n require(callValidated, \"Must call processMessageFromRoot\");\n }\n}\n" + "contracts/test/MerkleLibTest.sol": { + "content": "// SPDX-License-Identifier: GPL-3.0-only\npragma solidity ^0.8.0;\n\nimport \"../MerkleLib.sol\";\nimport \"../HubPoolInterface.sol\";\nimport \"../SpokePoolInterface.sol\";\n\n/**\n * @notice Contract to test the MerkleLib.\n */\ncontract MerkleLibTest {\n mapping(uint256 => uint256) public claimedBitMap;\n\n uint256 public claimedBitMap1D;\n\n function verifyPoolRebalance(\n bytes32 root,\n HubPoolInterface.PoolRebalanceLeaf memory rebalance,\n bytes32[] memory proof\n ) public pure returns (bool) {\n return MerkleLib.verifyPoolRebalance(root, rebalance, proof);\n }\n\n function verifyRelayerRefund(\n bytes32 root,\n SpokePoolInterface.RelayerRefundLeaf memory refund,\n bytes32[] memory proof\n ) public pure returns (bool) {\n return MerkleLib.verifyRelayerRefund(root, refund, proof);\n }\n\n function verifySlowRelayFulfillment(\n bytes32 root,\n SpokePoolInterface.RelayData memory slowRelayFulfillment,\n bytes32[] memory proof\n ) public pure returns (bool) {\n return MerkleLib.verifySlowRelayFulfillment(root, slowRelayFulfillment, proof);\n }\n\n function isClaimed(uint256 index) public view returns (bool) {\n return MerkleLib.isClaimed(claimedBitMap, index);\n }\n\n function setClaimed(uint256 index) public {\n MerkleLib.setClaimed(claimedBitMap, index);\n }\n\n function isClaimed1D(uint8 index) public view returns (bool) {\n return MerkleLib.isClaimed1D(claimedBitMap1D, index);\n }\n\n function setClaimed1D(uint8 index) public {\n claimedBitMap1D = MerkleLib.setClaimed1D(claimedBitMap1D, index);\n }\n}\n" }, "contracts/PolygonTokenBridger.sol": { - "content": "// SPDX-License-Identifier: AGPL-3.0-only\npragma solidity ^0.8.0;\n\nimport \"@openzeppelin/contracts/token/ERC20/IERC20.sol\";\nimport \"@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol\";\nimport \"./Lockable.sol\";\nimport \"./interfaces/WETH9.sol\";\n\n// ERC20s (on polygon) compatible with polygon's bridge have a withdraw method.\ninterface PolygonIERC20 is IERC20 {\n function withdraw(uint256 amount) external;\n}\n\ninterface MaticToken {\n function withdraw(uint256 amount) external payable;\n}\n\n/**\n * @notice Contract deployed on Ethereum and Polygon to facilitate token transfers from Polygon to the HubPool and back.\n * @dev Because Polygon only allows withdrawals from a particular address to go to that same address on mainnet, we need to\n * have some sort of contract that can guarantee identical addresses on Polygon and Ethereum. This contract is intended\n * to be completely immutable, so it's guaranteed that the contract on each side is configured identically as long as\n * it is created via create2. create2 is an alternative creation method that uses a different address determination\n * mechanism from normal create.\n * Normal create: address = hash(deployer_address, deployer_nonce)\n * create2: address = hash(0xFF, sender, salt, bytecode)\n * This ultimately allows create2 to generate deterministic addresses that don't depend on the transaction count of the\n * sender.\n */\ncontract PolygonTokenBridger is Lockable {\n using SafeERC20 for PolygonIERC20;\n using SafeERC20 for IERC20;\n\n // Gas token for Polygon.\n MaticToken public constant maticToken = MaticToken(0x0000000000000000000000000000000000001010);\n\n // Should be set to HubPool on Ethereum, or unused on Polygon.\n address public immutable destination;\n\n // WETH contract on Ethereum.\n WETH9 public immutable l1Weth;\n\n /**\n * @notice Constructs Token Bridger contract.\n * @param _destination Where to send tokens to for this network.\n * @param _l1Weth Ethereum WETH address.\n */\n constructor(address _destination, WETH9 _l1Weth) {\n destination = _destination;\n l1Weth = _l1Weth;\n }\n\n /**\n * @notice Called by Polygon SpokePool to send tokens over bridge to contract with the same address as this.\n * @param token Token to bridge.\n * @param amount Amount to bridge.\n * @param isMatic True if token is MATIC.\n */\n function send(\n PolygonIERC20 token,\n uint256 amount,\n bool isMatic\n ) public nonReentrant {\n token.safeTransferFrom(msg.sender, address(this), amount);\n\n // In the wMatic case, this unwraps. For other ERC20s, this is the burn/send action.\n token.withdraw(amount);\n\n // This takes the token that was withdrawn and calls withdraw on the \"native\" ERC20.\n if (isMatic) maticToken.withdraw{ value: amount }(amount);\n }\n\n /**\n * @notice Called by someone to send tokens to the destination, which should be set to the HubPool.\n * @param token Token to send to destination.\n */\n function retrieve(IERC20 token) public nonReentrant {\n token.safeTransfer(destination, token.balanceOf(address(this)));\n }\n\n receive() external payable {\n // Note: this should only happen on the mainnet side where ETH is sent to the contract directly by the bridge.\n if (functionCallStackOriginatesFromOutsideThisContract()) l1Weth.deposit{ value: address(this).balance }();\n }\n}\n" + "content": "// SPDX-License-Identifier: AGPL-3.0-only\npragma solidity ^0.8.0;\n\nimport \"./Lockable.sol\";\nimport \"./interfaces/WETH9.sol\";\n\nimport \"@openzeppelin/contracts/token/ERC20/IERC20.sol\";\nimport \"@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol\";\n\n// ERC20s (on polygon) compatible with polygon's bridge have a withdraw method.\ninterface PolygonIERC20 is IERC20 {\n function withdraw(uint256 amount) external;\n}\n\ninterface MaticToken {\n function withdraw(uint256 amount) external payable;\n}\n\n/**\n * @notice Contract deployed on Ethereum and Polygon to facilitate token transfers from Polygon to the HubPool and back.\n * @dev Because Polygon only allows withdrawals from a particular address to go to that same address on mainnet, we need to\n * have some sort of contract that can guarantee identical addresses on Polygon and Ethereum. This contract is intended\n * to be completely immutable, so it's guaranteed that the contract on each side is configured identically as long as\n * it is created via create2. create2 is an alternative creation method that uses a different address determination\n * mechanism from normal create.\n * Normal create: address = hash(deployer_address, deployer_nonce)\n * create2: address = hash(0xFF, sender, salt, bytecode)\n * This ultimately allows create2 to generate deterministic addresses that don't depend on the transaction count of the\n * sender.\n */\ncontract PolygonTokenBridger is Lockable {\n using SafeERC20 for PolygonIERC20;\n using SafeERC20 for IERC20;\n\n // Gas token for Polygon.\n MaticToken public constant maticToken = MaticToken(0x0000000000000000000000000000000000001010);\n\n // Should be set to HubPool on Ethereum, or unused on Polygon.\n address public immutable destination;\n\n // WETH contract on Ethereum.\n WETH9 public immutable l1Weth;\n\n /**\n * @notice Constructs Token Bridger contract.\n * @param _destination Where to send tokens to for this network.\n * @param _l1Weth Ethereum WETH address.\n */\n constructor(address _destination, WETH9 _l1Weth) {\n destination = _destination;\n l1Weth = _l1Weth;\n }\n\n /**\n * @notice Called by Polygon SpokePool to send tokens over bridge to contract with the same address as this.\n * @notice The caller of this function must approve this contract to spend amount of token.\n * @param token Token to bridge.\n * @param amount Amount to bridge.\n * @param isWrappedMatic True if token is WMATIC.\n */\n function send(\n PolygonIERC20 token,\n uint256 amount,\n bool isWrappedMatic\n ) public nonReentrant {\n token.safeTransferFrom(msg.sender, address(this), amount);\n\n // In the wMatic case, this unwraps. For other ERC20s, this is the burn/send action.\n token.withdraw(amount);\n\n // This takes the token that was withdrawn and calls withdraw on the \"native\" ERC20.\n if (isWrappedMatic) maticToken.withdraw{ value: amount }(amount);\n }\n\n /**\n * @notice Called by someone to send tokens to the destination, which should be set to the HubPool.\n * @param token Token to send to destination.\n */\n function retrieve(IERC20 token) public nonReentrant {\n token.safeTransfer(destination, token.balanceOf(address(this)));\n }\n\n receive() external payable {\n // Note: this should only happen on the mainnet side where ETH is sent to the contract directly by the bridge.\n if (functionCallStackOriginatesFromOutsideThisContract()) l1Weth.deposit{ value: address(this).balance }();\n }\n}\n" }, "contracts/test/PolygonERC20Test.sol": { "content": "// SPDX-License-Identifier: AGPL-3.0-only\npragma solidity ^0.8.0;\n\nimport \"@uma/core/contracts/common/implementation/ExpandedERC20.sol\";\nimport \"../PolygonTokenBridger.sol\";\n\n/**\n * @notice Simulated Polygon ERC20 for use in testing PolygonTokenBridger.\n */\ncontract PolygonERC20Test is ExpandedERC20, PolygonIERC20 {\n constructor() ExpandedERC20(\"Polygon Test\", \"POLY_TEST\", 18) {}\n\n function withdraw(uint256 amount) public {\n _burn(msg.sender, amount);\n }\n}\n" @@ -88,60 +82,60 @@ "@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" }, - "@openzeppelin/contracts/access/Ownable.sol": { - "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts v4.4.1 (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 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 called by any account other than the owner.\n */\n modifier onlyOwner() {\n require(owner() == _msgSender(), \"Ownable: caller is not the owner\");\n _;\n }\n\n /**\n * @dev Leaves the contract without owner. It will not be possible to call\n * `onlyOwner` functions anymore. Can only be called by the current owner.\n *\n * NOTE: Renouncing ownership will leave the contract without an owner,\n * thereby removing 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" + "contracts/Polygon_SpokePool.sol": { + "content": "// SPDX-License-Identifier: GPL-3.0-only\npragma solidity ^0.8.0;\n\nimport \"./SpokePool.sol\";\nimport \"./PolygonTokenBridger.sol\";\nimport \"./interfaces/WETH9.sol\";\nimport \"./SpokePoolInterface.sol\";\n\nimport \"@openzeppelin/contracts/token/ERC20/IERC20.sol\";\nimport \"@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol\";\n\n// IFxMessageProcessor represents interface to process messages.\ninterface IFxMessageProcessor {\n function processMessageFromRoot(\n uint256 stateId,\n address rootMessageSender,\n bytes calldata data\n ) external;\n}\n\n/**\n * @notice Polygon specific SpokePool.\n */\ncontract Polygon_SpokePool is IFxMessageProcessor, SpokePool {\n using SafeERC20 for PolygonIERC20;\n\n // Address of FxChild which sends and receives messages to and from L1.\n address public fxChild;\n\n // Contract deployed on L1 and L2 processes all cross-chain transfers between this contract and the the HubPool.\n // Required because bridging tokens from Polygon to Ethereum has special constraints.\n PolygonTokenBridger public polygonTokenBridger;\n\n // Internal variable that only flips temporarily to true upon receiving messages from L1. Used to authenticate that\n // the caller is the fxChild AND that the fxChild called processMessageFromRoot\n bool private callValidated = false;\n\n event PolygonTokensBridged(address indexed token, address indexed receiver, uint256 amount);\n event SetFxChild(address indexed newFxChild);\n event SetPolygonTokenBridger(address indexed polygonTokenBridger);\n\n // Note: validating calls this way ensures that strange calls coming from the fxChild won't be misinterpreted.\n // Put differently, just checking that msg.sender == fxChild is not sufficient.\n // All calls that have admin privileges must be fired from within the processMessageFromRoot method that's gone\n // through validation where the sender is checked and the root (mainnet) sender is also validated.\n // This modifier sets the callValidated variable so this condition can be checked in _requireAdminSender().\n modifier validateInternalCalls() {\n // Make sure callValidated is set to True only once at beginning of processMessageFromRoot, which prevents\n // processMessageFromRoot from being re-entered.\n require(!callValidated, \"callValidated already set\");\n\n // This sets a variable indicating that we're now inside a validated call.\n // Note: this is used by other methods to ensure that this call has been validated by this method and is not\n // spoofed. See\n callValidated = true;\n\n _;\n\n // Reset callValidated to false to disallow admin calls after this method exits.\n callValidated = false;\n }\n\n /**\n * @notice Construct the Polygon SpokePool.\n * @param _polygonTokenBridger Token routing contract that sends tokens from here to HubPool. Changeable by Admin.\n * @param _crossDomainAdmin Cross domain admin to set. Can be changed by admin.\n * @param _hubPool Hub pool address to set. Can be changed by admin.\n * @param _wmaticAddress Replaces _wethAddress for this network since MATIC is the gas token and sent via msg.value\n * on Polygon.\n * @param _fxChild FxChild contract, changeable by Admin.\n * @param timerAddress Timer address to set.\n */\n constructor(\n PolygonTokenBridger _polygonTokenBridger,\n address _crossDomainAdmin,\n address _hubPool,\n address _wmaticAddress, // Note: wmatic is used here since it is the token sent via msg.value on polygon.\n address _fxChild,\n address timerAddress\n ) SpokePool(_crossDomainAdmin, _hubPool, _wmaticAddress, timerAddress) {\n polygonTokenBridger = _polygonTokenBridger;\n fxChild = _fxChild;\n }\n\n /********************************************************\n * ARBITRUM-SPECIFIC CROSS-CHAIN ADMIN FUNCTIONS *\n ********************************************************/\n\n /**\n * @notice Change FxChild address. Callable only by admin via processMessageFromRoot.\n * @param newFxChild New FxChild.\n */\n function setFxChild(address newFxChild) public onlyAdmin nonReentrant {\n fxChild = newFxChild;\n emit SetFxChild(fxChild);\n }\n\n /**\n * @notice Change polygonTokenBridger address. Callable only by admin via processMessageFromRoot.\n * @param newPolygonTokenBridger New Polygon Token Bridger contract.\n */\n function setPolygonTokenBridger(address payable newPolygonTokenBridger) public onlyAdmin nonReentrant {\n polygonTokenBridger = PolygonTokenBridger(newPolygonTokenBridger);\n emit SetPolygonTokenBridger(address(polygonTokenBridger));\n }\n\n /**\n * @notice Called by FxChild upon receiving L1 message that targets this contract. Performs an additional check\n * that the L1 caller was the expected cross domain admin, and then delegate calls.\n * @notice Polygon bridge only executes this external function on the target Polygon contract when relaying\n * messages from L1, so all functions on this SpokePool are expected to originate via this call.\n * @dev stateId value isn't used because it isn't relevant for this method. It doesn't care what state sync\n * triggered this call.\n * @param rootMessageSender Original L1 sender of data.\n * @param data ABI encoded function call to execute on this contract.\n */\n function processMessageFromRoot(\n uint256, /*stateId*/\n address rootMessageSender,\n bytes calldata data\n ) public validateInternalCalls {\n // Validation logic.\n require(msg.sender == fxChild, \"Not from fxChild\");\n require(rootMessageSender == crossDomainAdmin, \"Not from mainnet admin\");\n\n // This uses delegatecall to take the information in the message and process it as a function call on this contract.\n (bool success, ) = address(this).delegatecall(data);\n require(success, \"delegatecall failed\");\n }\n\n /**************************************\n * INTERNAL FUNCTIONS *\n **************************************/\n\n function _bridgeTokensToHubPool(RelayerRefundLeaf memory relayerRefundLeaf) internal override {\n PolygonIERC20(relayerRefundLeaf.l2TokenAddress).safeIncreaseAllowance(\n address(polygonTokenBridger),\n relayerRefundLeaf.amountToReturn\n );\n\n // Note: WETH is WMATIC on matic, so this tells the tokenbridger that this is an unwrappable native token.\n polygonTokenBridger.send(\n PolygonIERC20(relayerRefundLeaf.l2TokenAddress),\n relayerRefundLeaf.amountToReturn,\n address(weth) == relayerRefundLeaf.l2TokenAddress\n );\n\n emit PolygonTokensBridged(relayerRefundLeaf.l2TokenAddress, address(this), relayerRefundLeaf.amountToReturn);\n }\n\n // @dev: This contract will trigger admin functions internally via the `processMessageFromRoot`, which is why\n // the `callValidated` check is made below and why we use the `validateInternalCalls` modifier on\n // `processMessageFromRoot`. This prevents calling the admin functions from any other method besides\n // `processMessageFromRoot`.\n function _requireAdminSender() internal view override {\n require(callValidated, \"Must call processMessageFromRoot\");\n }\n}\n" }, - "contracts/chain-adapters/Polygon_Adapter.sol": { - "content": "// SPDX-License-Identifier: AGPL-3.0-only\npragma solidity ^0.8.0;\n\nimport \"../interfaces/AdapterInterface.sol\";\nimport \"../interfaces/WETH9.sol\";\nimport \"../Lockable.sol\";\n\nimport \"@eth-optimism/contracts/libraries/bridge/CrossDomainEnabled.sol\";\nimport \"@eth-optimism/contracts/L1/messaging/IL1StandardBridge.sol\";\nimport \"@openzeppelin/contracts/token/ERC20/IERC20.sol\";\nimport \"@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol\";\n\ninterface IRootChainManager {\n function depositEtherFor(address user) external payable;\n\n function depositFor(\n address user,\n address rootToken,\n bytes calldata depositData\n ) external;\n}\n\ninterface IFxStateSender {\n function sendMessageToChild(address _receiver, bytes calldata _data) external;\n}\n\n/**\n * @notice Sends cross chain messages Polygon L2 network.\n * @dev Public functions calling external contracts do not guard against reentrancy because they are expected to be\n * called via delegatecall, which will execute this contract's logic within the context of the originating contract.\n * For example, the HubPool will delegatecall these functions, therefore its only neccessary that the HubPool's methods\n * that call this contract's logic guard against reentrancy.\n */\ncontract Polygon_Adapter is AdapterInterface {\n using SafeERC20 for IERC20;\n IRootChainManager public immutable rootChainManager;\n IFxStateSender public immutable fxStateSender;\n WETH9 public immutable l1Weth;\n\n /**\n * @notice Constructs new Adapter.\n * @param _rootChainManager RootChainManager Polygon system helper contract.\n * @param _fxStateSender FxStateSender Polygon system helper contract.\n * @param _l1Weth WETH address on L1.\n */\n constructor(\n IRootChainManager _rootChainManager,\n IFxStateSender _fxStateSender,\n WETH9 _l1Weth\n ) {\n rootChainManager = _rootChainManager;\n fxStateSender = _fxStateSender;\n l1Weth = _l1Weth;\n }\n\n /**\n * @notice Send cross-chain message to target on Polygon.\n * @param target Contract on Polygon that will receive message.\n * @param message Data to send to target.\n */\n\n function relayMessage(address target, bytes memory message) external payable override {\n fxStateSender.sendMessageToChild(target, message);\n emit MessageRelayed(target, message);\n }\n\n /**\n * @notice Bridge tokens to Polygon.\n * @param l1Token L1 token to deposit.\n * @param l2Token L2 token to receive.\n * @param amount Amount of L1 tokens to deposit and L2 tokens to receive.\n * @param to Bridge recipient.\n */\n function relayTokens(\n address l1Token,\n address l2Token,\n uint256 amount,\n address to\n ) external payable override {\n // If the l1Token is weth then unwrap it to ETH then send the ETH to the standard bridge.\n if (l1Token == address(l1Weth)) {\n l1Weth.withdraw(amount);\n rootChainManager.depositEtherFor{ value: amount }(to);\n } else {\n IERC20(l1Token).safeIncreaseAllowance(address(rootChainManager), amount);\n rootChainManager.depositFor(to, l1Token, abi.encode(amount));\n }\n emit TokensRelayed(l1Token, l2Token, amount, to);\n }\n}\n" + "contracts/Optimism_SpokePool.sol": { + "content": "// SPDX-License-Identifier: GPL-3.0-only\npragma solidity ^0.8.0;\n\nimport \"./SpokePool.sol\";\nimport \"./interfaces/WETH9.sol\";\n\nimport \"@eth-optimism/contracts/libraries/bridge/CrossDomainEnabled.sol\";\nimport \"@eth-optimism/contracts/libraries/constants/Lib_PredeployAddresses.sol\";\nimport \"@eth-optimism/contracts/L2/messaging/IL2ERC20Bridge.sol\";\n\n/**\n * @notice OVM specific SpokePool. Uses OVM cross-domain-enabled logic to implement admin only access to functions.\n */\ncontract Optimism_SpokePool is CrossDomainEnabled, SpokePool {\n // \"l1Gas\" parameter used in call to bridge tokens from this contract back to L1 via IL2ERC20Bridge. Currently\n // unused by bridge but included for future compatibility.\n uint32 public l1Gas = 5_000_000;\n\n // ETH is an ERC20 on OVM.\n address public immutable l2Eth = address(Lib_PredeployAddresses.OVM_ETH);\n\n // Stores alternative token bridges to use for L2 tokens that don't go over the standard bridge. This is needed\n // to support non-standard ERC20 tokens on Optimism, such as DIA and SNX which both use custom bridges.\n mapping(address => address) public tokenBridges;\n\n event OptimismTokensBridged(address indexed l2Token, address target, uint256 numberOfTokensBridged, uint256 l1Gas);\n event SetL1Gas(uint32 indexed newL1Gas);\n event SetL2TokenBridge(address indexed l2Token, address indexed tokenBridge);\n\n /**\n * @notice Construct the OVM SpokePool.\n * @param _crossDomainAdmin Cross domain admin to set. Can be changed by admin.\n * @param _hubPool Hub pool address to set. Can be changed by admin.\n * @param timerAddress Timer address to set.\n */\n constructor(\n address _crossDomainAdmin,\n address _hubPool,\n address timerAddress\n )\n CrossDomainEnabled(Lib_PredeployAddresses.L2_CROSS_DOMAIN_MESSENGER)\n SpokePool(_crossDomainAdmin, _hubPool, 0x4200000000000000000000000000000000000006, timerAddress)\n {}\n\n /*******************************************\n * OPTIMISM-SPECIFIC ADMIN FUNCTIONS *\n *******************************************/\n\n /**\n * @notice Change L1 gas limit. Callable only by admin.\n * @param newl1Gas New L1 gas limit to set.\n */\n function setL1GasLimit(uint32 newl1Gas) public onlyAdmin nonReentrant {\n l1Gas = newl1Gas;\n emit SetL1Gas(newl1Gas);\n }\n\n /**\n * @notice Set bridge contract for L2 token used to withdraw back to L1.\n * @dev If this mapping isn't set for an L2 token, then the standard bridge will be used to bridge this token.\n * @param tokenBridge Address of token bridge\n */\n function setTokenBridge(address l2Token, address tokenBridge) public onlyAdmin nonReentrant {\n tokenBridges[l2Token] = tokenBridge;\n emit SetL2TokenBridge(l2Token, tokenBridge);\n }\n\n /**************************************\n * DATA WORKER FUNCTIONS *\n **************************************/\n\n /**\n * @notice Wraps any ETH into WETH before executing base function. This is necessary because SpokePool receives\n * ETH over the canonical token bridge instead of WETH.\n * @inheritdoc SpokePool\n */\n function executeSlowRelayRoot(\n address depositor,\n address recipient,\n address destinationToken,\n uint256 totalRelayAmount,\n uint256 originChainId,\n uint64 realizedLpFeePct,\n uint64 relayerFeePct,\n uint32 depositId,\n uint32 rootBundleId,\n bytes32[] memory proof\n ) public override(SpokePool) nonReentrant {\n if (destinationToken == address(weth)) _depositEthToWeth();\n\n _executeSlowRelayRoot(\n depositor,\n recipient,\n destinationToken,\n totalRelayAmount,\n originChainId,\n chainId(),\n realizedLpFeePct,\n relayerFeePct,\n depositId,\n rootBundleId,\n proof\n );\n }\n\n /**\n * @notice Wraps any ETH into WETH before executing base function. This is necessary because SpokePool receives\n * ETH over the canonical token bridge instead of WETH.\n * @inheritdoc SpokePool\n */\n function executeRelayerRefundRoot(\n uint32 rootBundleId,\n SpokePoolInterface.RelayerRefundLeaf memory relayerRefundLeaf,\n bytes32[] memory proof\n ) public override(SpokePool) nonReentrant {\n if (relayerRefundLeaf.l2TokenAddress == address(weth)) _depositEthToWeth();\n\n _executeRelayerRefundRoot(rootBundleId, relayerRefundLeaf, proof);\n }\n\n /**************************************\n * INTERNAL FUNCTIONS *\n **************************************/\n\n // Wrap any ETH owned by this contract so we can send expected L2 token to recipient. This is necessary because\n // this SpokePool will receive ETH from the canonical token bridge instead of WETH. Its not sufficient to execute\n // this logic inside a fallback method that executes when this contract receives ETH because ETH is an ERC20\n // on the OVM.\n function _depositEthToWeth() internal {\n if (address(this).balance > 0) weth.deposit{ value: address(this).balance }();\n }\n\n function _bridgeTokensToHubPool(RelayerRefundLeaf memory relayerRefundLeaf) internal override {\n // If the token being bridged is WETH then we need to first unwrap it to ETH and then send ETH over the\n // canonical bridge. On Optimism, this is address 0xDeadDeAddeAddEAddeadDEaDDEAdDeaDDeAD0000.\n if (relayerRefundLeaf.l2TokenAddress == address(weth)) {\n WETH9(relayerRefundLeaf.l2TokenAddress).withdraw(relayerRefundLeaf.amountToReturn); // Unwrap into ETH.\n relayerRefundLeaf.l2TokenAddress = l2Eth; // Set the l2TokenAddress to ETH.\n }\n IL2ERC20Bridge(\n tokenBridges[relayerRefundLeaf.l2TokenAddress] == address(0)\n ? Lib_PredeployAddresses.L2_STANDARD_BRIDGE\n : tokenBridges[relayerRefundLeaf.l2TokenAddress]\n ).withdrawTo(\n relayerRefundLeaf.l2TokenAddress, // _l2Token. Address of the L2 token to bridge over.\n hubPool, // _to. Withdraw, over the bridge, to the l1 pool contract.\n relayerRefundLeaf.amountToReturn, // _amount.\n l1Gas, // _l1Gas. Unused, but included for potential forward compatibility considerations\n \"\" // _data. We don't need to send any data for the bridging action.\n );\n\n emit OptimismTokensBridged(relayerRefundLeaf.l2TokenAddress, hubPool, relayerRefundLeaf.amountToReturn, l1Gas);\n }\n\n // Apply OVM-specific transformation to cross domain admin address on L1.\n function _requireAdminSender() internal override onlyFromCrossDomainAccount(crossDomainAdmin) {}\n}\n" }, "@eth-optimism/contracts/libraries/bridge/CrossDomainEnabled.sol": { "content": "// SPDX-License-Identifier: MIT\npragma solidity >0.5.0 <0.9.0;\n\n/* Interface Imports */\nimport { ICrossDomainMessenger } from \"./ICrossDomainMessenger.sol\";\n\n/**\n * @title CrossDomainEnabled\n * @dev Helper contract for contracts performing cross-domain communications\n *\n * Compiler used: defined by inheriting contract\n */\ncontract CrossDomainEnabled {\n /*************\n * Variables *\n *************/\n\n // Messenger contract used to send and recieve messages from the other domain.\n address public messenger;\n\n /***************\n * Constructor *\n ***************/\n\n /**\n * @param _messenger Address of the CrossDomainMessenger on the current layer.\n */\n constructor(address _messenger) {\n messenger = _messenger;\n }\n\n /**********************\n * Function Modifiers *\n **********************/\n\n /**\n * Enforces that the modified function is only callable by a specific cross-domain account.\n * @param _sourceDomainAccount The only account on the originating domain which is\n * authenticated to call this function.\n */\n modifier onlyFromCrossDomainAccount(address _sourceDomainAccount) {\n require(\n msg.sender == address(getCrossDomainMessenger()),\n \"OVM_XCHAIN: messenger contract unauthenticated\"\n );\n\n require(\n getCrossDomainMessenger().xDomainMessageSender() == _sourceDomainAccount,\n \"OVM_XCHAIN: wrong sender of cross-domain message\"\n );\n\n _;\n }\n\n /**********************\n * Internal Functions *\n **********************/\n\n /**\n * Gets the messenger, usually from storage. This function is exposed in case a child contract\n * needs to override.\n * @return The address of the cross-domain messenger contract which should be used.\n */\n function getCrossDomainMessenger() internal virtual returns (ICrossDomainMessenger) {\n return ICrossDomainMessenger(messenger);\n }\n\n /**q\n * Sends a message to an account on another domain\n * @param _crossDomainTarget The intended recipient on the destination domain\n * @param _message The data to send to the target (usually calldata to a function with\n * `onlyFromCrossDomainAccount()`)\n * @param _gasLimit The gasLimit for the receipt of the message on the target domain.\n */\n function sendCrossDomainMessage(\n address _crossDomainTarget,\n uint32 _gasLimit,\n bytes memory _message\n ) internal {\n // slither-disable-next-line reentrancy-events, reentrancy-benign\n getCrossDomainMessenger().sendMessage(_crossDomainTarget, _message, _gasLimit);\n }\n}\n" }, - "@eth-optimism/contracts/L1/messaging/IL1StandardBridge.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma solidity >0.5.0 <0.9.0;\n\nimport \"./IL1ERC20Bridge.sol\";\n\n/**\n * @title IL1StandardBridge\n */\ninterface IL1StandardBridge is IL1ERC20Bridge {\n /**********\n * Events *\n **********/\n event ETHDepositInitiated(\n address indexed _from,\n address indexed _to,\n uint256 _amount,\n bytes _data\n );\n\n event ETHWithdrawalFinalized(\n address indexed _from,\n address indexed _to,\n uint256 _amount,\n bytes _data\n );\n\n /********************\n * Public Functions *\n ********************/\n\n /**\n * @dev Deposit an amount of the ETH to the caller's balance on L2.\n * @param _l2Gas Gas limit required to complete the deposit on L2.\n * @param _data Optional data to forward to L2. This data is provided\n * solely as a convenience for external contracts. Aside from enforcing a maximum\n * length, these contracts provide no guarantees about its content.\n */\n function depositETH(uint32 _l2Gas, bytes calldata _data) external payable;\n\n /**\n * @dev Deposit an amount of ETH to a recipient's balance on L2.\n * @param _to L2 address to credit the withdrawal to.\n * @param _l2Gas Gas limit required to complete the deposit on L2.\n * @param _data Optional data to forward to L2. This data is provided\n * solely as a convenience for external contracts. Aside from enforcing a maximum\n * length, these contracts provide no guarantees about its content.\n */\n function depositETHTo(\n address _to,\n uint32 _l2Gas,\n bytes calldata _data\n ) external payable;\n\n /*************************\n * Cross-chain Functions *\n *************************/\n\n /**\n * @dev Complete a withdrawal from L2 to L1, and credit funds to the recipient's balance of the\n * L1 ETH token. Since only the xDomainMessenger can call this function, it will never be called\n * before the withdrawal is finalized.\n * @param _from L2 address initiating the transfer.\n * @param _to L1 address to credit the withdrawal to.\n * @param _amount Amount of the ERC20 to deposit.\n * @param _data Optional data to forward to L2. This data is provided\n * solely as a convenience for external contracts. Aside from enforcing a maximum\n * length, these contracts provide no guarantees about its content.\n */\n function finalizeETHWithdrawal(\n address _from,\n address _to,\n uint256 _amount,\n bytes calldata _data\n ) external;\n}\n" + "@eth-optimism/contracts/libraries/constants/Lib_PredeployAddresses.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.9;\n\n/**\n * @title Lib_PredeployAddresses\n */\nlibrary Lib_PredeployAddresses {\n address internal constant L2_TO_L1_MESSAGE_PASSER = 0x4200000000000000000000000000000000000000;\n address internal constant L1_MESSAGE_SENDER = 0x4200000000000000000000000000000000000001;\n address internal constant DEPLOYER_WHITELIST = 0x4200000000000000000000000000000000000002;\n address payable internal constant OVM_ETH = payable(0xDeadDeAddeAddEAddeadDEaDDEAdDeaDDeAD0000);\n address internal constant L2_CROSS_DOMAIN_MESSENGER =\n 0x4200000000000000000000000000000000000007;\n address internal constant LIB_ADDRESS_MANAGER = 0x4200000000000000000000000000000000000008;\n address internal constant PROXY_EOA = 0x4200000000000000000000000000000000000009;\n address internal constant L2_STANDARD_BRIDGE = 0x4200000000000000000000000000000000000010;\n address internal constant SEQUENCER_FEE_WALLET = 0x4200000000000000000000000000000000000011;\n address internal constant L2_STANDARD_TOKEN_FACTORY =\n 0x4200000000000000000000000000000000000012;\n address internal constant L1_BLOCK_NUMBER = 0x4200000000000000000000000000000000000013;\n}\n" + }, + "@eth-optimism/contracts/L2/messaging/IL2ERC20Bridge.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.9;\n\n/**\n * @title IL2ERC20Bridge\n */\ninterface IL2ERC20Bridge {\n /**********\n * Events *\n **********/\n\n event WithdrawalInitiated(\n address indexed _l1Token,\n address indexed _l2Token,\n address indexed _from,\n address _to,\n uint256 _amount,\n bytes _data\n );\n\n event DepositFinalized(\n address indexed _l1Token,\n address indexed _l2Token,\n address indexed _from,\n address _to,\n uint256 _amount,\n bytes _data\n );\n\n event DepositFailed(\n address indexed _l1Token,\n address indexed _l2Token,\n address indexed _from,\n address _to,\n uint256 _amount,\n bytes _data\n );\n\n /********************\n * Public Functions *\n ********************/\n\n /**\n * @dev get the address of the corresponding L1 bridge contract.\n * @return Address of the corresponding L1 bridge contract.\n */\n function l1TokenBridge() external returns (address);\n\n /**\n * @dev initiate a withdraw of some tokens to the caller's account on L1\n * @param _l2Token Address of L2 token where withdrawal was initiated.\n * @param _amount Amount of the token to withdraw.\n * param _l1Gas Unused, but included for potential forward compatibility considerations.\n * @param _data Optional data to forward to L1. This data is provided\n * solely as a convenience for external contracts. Aside from enforcing a maximum\n * length, these contracts provide no guarantees about its content.\n */\n function withdraw(\n address _l2Token,\n uint256 _amount,\n uint32 _l1Gas,\n bytes calldata _data\n ) external;\n\n /**\n * @dev initiate a withdraw of some token to a recipient's account on L1.\n * @param _l2Token Address of L2 token where withdrawal is initiated.\n * @param _to L1 adress to credit the withdrawal to.\n * @param _amount Amount of the token to withdraw.\n * param _l1Gas Unused, but included for potential forward compatibility considerations.\n * @param _data Optional data to forward to L1. This data is provided\n * solely as a convenience for external contracts. Aside from enforcing a maximum\n * length, these contracts provide no guarantees about its content.\n */\n function withdrawTo(\n address _l2Token,\n address _to,\n uint256 _amount,\n uint32 _l1Gas,\n bytes calldata _data\n ) external;\n\n /*************************\n * Cross-chain Functions *\n *************************/\n\n /**\n * @dev Complete a deposit from L1 to L2, and credits funds to the recipient's balance of this\n * L2 token. This call will fail if it did not originate from a corresponding deposit in\n * L1StandardTokenBridge.\n * @param _l1Token Address for the l1 token this is called with\n * @param _l2Token Address for the l2 token this is called with\n * @param _from Account to pull the deposit from on L2.\n * @param _to Address to receive the withdrawal at\n * @param _amount Amount of the token to withdraw\n * @param _data Data provider by the sender on L1. This data is provided\n * solely as a convenience for external contracts. Aside from enforcing a maximum\n * length, these contracts provide no guarantees about its content.\n */\n function finalizeDeposit(\n address _l1Token,\n address _l2Token,\n address _from,\n address _to,\n uint256 _amount,\n bytes calldata _data\n ) external;\n}\n" }, "@eth-optimism/contracts/libraries/bridge/ICrossDomainMessenger.sol": { "content": "// SPDX-License-Identifier: MIT\npragma solidity >0.5.0 <0.9.0;\n\n/**\n * @title ICrossDomainMessenger\n */\ninterface ICrossDomainMessenger {\n /**********\n * Events *\n **********/\n\n event SentMessage(\n address indexed target,\n address sender,\n bytes message,\n uint256 messageNonce,\n uint256 gasLimit\n );\n event RelayedMessage(bytes32 indexed msgHash);\n event FailedRelayedMessage(bytes32 indexed msgHash);\n\n /*************\n * Variables *\n *************/\n\n function xDomainMessageSender() external view returns (address);\n\n /********************\n * Public Functions *\n ********************/\n\n /**\n * Sends a cross domain message to the target messenger.\n * @param _target Target contract address.\n * @param _message Message to send to the target.\n * @param _gasLimit Gas limit for the provided message.\n */\n function sendMessage(\n address _target,\n bytes calldata _message,\n uint32 _gasLimit\n ) external;\n}\n" }, - "@eth-optimism/contracts/L1/messaging/IL1ERC20Bridge.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma solidity >0.5.0 <0.9.0;\n\n/**\n * @title IL1ERC20Bridge\n */\ninterface IL1ERC20Bridge {\n /**********\n * Events *\n **********/\n\n event ERC20DepositInitiated(\n address indexed _l1Token,\n address indexed _l2Token,\n address indexed _from,\n address _to,\n uint256 _amount,\n bytes _data\n );\n\n event ERC20WithdrawalFinalized(\n address indexed _l1Token,\n address indexed _l2Token,\n address indexed _from,\n address _to,\n uint256 _amount,\n bytes _data\n );\n\n /********************\n * Public Functions *\n ********************/\n\n /**\n * @dev get the address of the corresponding L2 bridge contract.\n * @return Address of the corresponding L2 bridge contract.\n */\n function l2TokenBridge() external returns (address);\n\n /**\n * @dev deposit an amount of the ERC20 to the caller's balance on L2.\n * @param _l1Token Address of the L1 ERC20 we are depositing\n * @param _l2Token Address of the L1 respective L2 ERC20\n * @param _amount Amount of the ERC20 to deposit\n * @param _l2Gas Gas limit required to complete the deposit on L2.\n * @param _data Optional data to forward to L2. This data is provided\n * solely as a convenience for external contracts. Aside from enforcing a maximum\n * length, these contracts provide no guarantees about its content.\n */\n function depositERC20(\n address _l1Token,\n address _l2Token,\n uint256 _amount,\n uint32 _l2Gas,\n bytes calldata _data\n ) external;\n\n /**\n * @dev deposit an amount of ERC20 to a recipient's balance on L2.\n * @param _l1Token Address of the L1 ERC20 we are depositing\n * @param _l2Token Address of the L1 respective L2 ERC20\n * @param _to L2 address to credit the withdrawal to.\n * @param _amount Amount of the ERC20 to deposit.\n * @param _l2Gas Gas limit required to complete the deposit on L2.\n * @param _data Optional data to forward to L2. This data is provided\n * solely as a convenience for external contracts. Aside from enforcing a maximum\n * length, these contracts provide no guarantees about its content.\n */\n function depositERC20To(\n address _l1Token,\n address _l2Token,\n address _to,\n uint256 _amount,\n uint32 _l2Gas,\n bytes calldata _data\n ) external;\n\n /*************************\n * Cross-chain Functions *\n *************************/\n\n /**\n * @dev Complete a withdrawal from L2 to L1, and credit funds to the recipient's balance of the\n * L1 ERC20 token.\n * This call will fail if the initialized withdrawal from L2 has not been finalized.\n *\n * @param _l1Token Address of L1 token to finalizeWithdrawal for.\n * @param _l2Token Address of L2 token where withdrawal was initiated.\n * @param _from L2 address initiating the transfer.\n * @param _to L1 address to credit the withdrawal to.\n * @param _amount Amount of the ERC20 to deposit.\n * @param _data Data provided by the sender on L2. This data is provided\n * solely as a convenience for external contracts. Aside from enforcing a maximum\n * length, these contracts provide no guarantees about its content.\n */\n function finalizeERC20Withdrawal(\n address _l1Token,\n address _l2Token,\n address _from,\n address _to,\n uint256 _amount,\n bytes calldata _data\n ) external;\n}\n" - }, - "contracts/chain-adapters/Optimism_Adapter.sol": { - "content": "// SPDX-License-Identifier: AGPL-3.0-only\npragma solidity ^0.8.0;\n\nimport \"../interfaces/AdapterInterface.sol\";\nimport \"../interfaces/WETH9.sol\";\n\n// @dev Use local modified CrossDomainEnabled contract instead of one exported by eth-optimism because we need\n// this contract's state variables to be `immutable` because of the delegateCall call.\nimport \"./CrossDomainEnabled.sol\";\nimport \"@eth-optimism/contracts/L1/messaging/IL1StandardBridge.sol\";\n\nimport \"@openzeppelin/contracts/token/ERC20/IERC20.sol\";\nimport \"@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol\";\n\n/**\n * @notice Contract containing logic to send messages from L1 to Optimism.\n * @dev Public functions calling external contracts do not guard against reentrancy because they are expected to be\n * called via delegatecall, which will execute this contract's logic within the context of the originating contract.\n * For example, the HubPool will delegatecall these functions, therefore its only neccessary that the HubPool's methods\n * that call this contract's logic guard against reentrancy.\n */\ncontract Optimism_Adapter is CrossDomainEnabled, AdapterInterface {\n using SafeERC20 for IERC20;\n uint32 public immutable l2GasLimit = 5_000_000;\n\n WETH9 public immutable l1Weth;\n\n IL1StandardBridge public immutable l1StandardBridge;\n\n // Optimism has the ability to support \"custom\" bridges. These bridges are not supported by the canonical bridge\n // and so we need to store the address of the custom token and the associated bridge. In the event we want to\n // support a new token that is not supported by Optimism, we can add a new custom bridge for it and re-deploy the\n // adapter. A full list of custom optimism tokens and their associated bridges can be found here:\n // https://github.com/ethereum-optimism/ethereum-optimism.github.io/blob/master/optimism.tokenlist.json\n address public immutable dai = 0x6B175474E89094C44Da98b954EedeAC495271d0F;\n address public immutable daiOptimismBridge = 0x10E6593CDda8c58a1d0f14C5164B376352a55f2F;\n address public immutable snx = 0xC011a73ee8576Fb46F5E1c5751cA3B9Fe0af2a6F;\n address public immutable snxOptimismBridge = 0xCd9D4988C0AE61887B075bA77f08cbFAd2b65068;\n\n event L2GasLimitSet(uint32 newGasLimit);\n\n /**\n * @notice Constructs new Adapter.\n * @param _l1Weth WETH address on L1.\n * @param _crossDomainMessenger XDomainMessenger Optimism system contract.\n * @param _l1StandardBridge Standard bridge contract.\n */\n constructor(\n WETH9 _l1Weth,\n address _crossDomainMessenger,\n IL1StandardBridge _l1StandardBridge\n ) CrossDomainEnabled(_crossDomainMessenger) {\n l1Weth = _l1Weth;\n l1StandardBridge = _l1StandardBridge;\n }\n\n /**\n * @notice Send cross-chain message to target on Optimism.\n * @param target Contract on Optimism that will receive message.\n * @param message Data to send to target.\n */\n function relayMessage(address target, bytes memory message) external payable override {\n sendCrossDomainMessage(target, uint32(l2GasLimit), message);\n emit MessageRelayed(target, message);\n }\n\n /**\n * @notice Bridge tokens to Optimism.\n * @param l1Token L1 token to deposit.\n * @param l2Token L2 token to receive.\n * @param amount Amount of L1 tokens to deposit and L2 tokens to receive.\n * @param to Bridge recipient.\n */\n function relayTokens(\n address l1Token,\n address l2Token,\n uint256 amount,\n address to\n ) external payable override {\n // If the l1Token is weth then unwrap it to ETH then send the ETH to the standard bridge.\n if (l1Token == address(l1Weth)) {\n l1Weth.withdraw(amount);\n l1StandardBridge.depositETHTo{ value: amount }(to, l2GasLimit, \"\");\n } else {\n IL1StandardBridge _l1StandardBridge = l1StandardBridge;\n\n // Check if the L1 token requires a custom bridge. If so, use that bridge over the standard bridge.\n if (l1Token == dai) _l1StandardBridge = IL1StandardBridge(daiOptimismBridge); // 1. DAI\n if (l1Token == snx) _l1StandardBridge = IL1StandardBridge(snxOptimismBridge); // 2. SNX\n\n IERC20(l1Token).safeIncreaseAllowance(address(_l1StandardBridge), amount);\n _l1StandardBridge.depositERC20To(l1Token, l2Token, to, amount, l2GasLimit, \"\");\n }\n emit TokensRelayed(l1Token, l2Token, amount, to);\n }\n}\n" - }, "contracts/chain-adapters/CrossDomainEnabled.sol": { "content": "// SPDX-License-Identifier: MIT\npragma solidity >0.5.0 <0.9.0;\n\n/* Interface Imports */\nimport { ICrossDomainMessenger } from \"@eth-optimism/contracts/libraries/bridge/ICrossDomainMessenger.sol\";\n\n/**\n * @title CrossDomainEnabled\n * @dev Helper contract for contracts performing cross-domain communications between L1 and Optimism.\n * @dev This modifies the eth-optimism/CrossDomainEnabled contract only by changing state variables to be\n * immutable for use in contracts like the Optimism_Adapter which use delegateCall().\n */\ncontract CrossDomainEnabled {\n // Messenger contract used to send and recieve messages from the other domain.\n address public immutable messenger;\n\n /**\n * @param _messenger Address of the CrossDomainMessenger on the current layer.\n */\n constructor(address _messenger) {\n messenger = _messenger;\n }\n\n /**\n * Enforces that the modified function is only callable by a specific cross-domain account.\n * @param _sourceDomainAccount The only account on the originating domain which is\n * authenticated to call this function.\n */\n modifier onlyFromCrossDomainAccount(address _sourceDomainAccount) {\n require(msg.sender == address(getCrossDomainMessenger()), \"OVM_XCHAIN: messenger contract unauthenticated\");\n\n require(\n getCrossDomainMessenger().xDomainMessageSender() == _sourceDomainAccount,\n \"OVM_XCHAIN: wrong sender of cross-domain message\"\n );\n\n _;\n }\n\n /**\n * Gets the messenger, usually from storage. This function is exposed in case a child contract\n * needs to override.\n * @return The address of the cross-domain messenger contract which should be used.\n */\n function getCrossDomainMessenger() internal virtual returns (ICrossDomainMessenger) {\n return ICrossDomainMessenger(messenger);\n }\n\n /**\n * Sends a message to an account on another domain\n * @param _crossDomainTarget The intended recipient on the destination domain\n * @param _message The data to send to the target (usually calldata to a function with\n * onlyFromCrossDomainAccount())\n * @param _gasLimit The gasLimit for the receipt of the message on the target domain.\n */\n function sendCrossDomainMessage(\n address _crossDomainTarget,\n uint32 _gasLimit,\n bytes memory _message\n ) internal {\n // slither-disable-next-line reentrancy-events, reentrancy-benign\n getCrossDomainMessenger().sendMessage(_crossDomainTarget, _message, _gasLimit);\n }\n}\n" }, - "contracts/Optimism_SpokePool.sol": { - "content": "// SPDX-License-Identifier: GPL-3.0-only\npragma solidity ^0.8.0;\n\nimport \"./interfaces/WETH9.sol\";\n\nimport \"@eth-optimism/contracts/libraries/bridge/CrossDomainEnabled.sol\";\nimport \"@eth-optimism/contracts/libraries/constants/Lib_PredeployAddresses.sol\";\nimport \"@eth-optimism/contracts/L2/messaging/IL2ERC20Bridge.sol\";\nimport \"./SpokePool.sol\";\nimport \"./SpokePoolInterface.sol\";\n\n/**\n * @notice OVM specific SpokePool. Uses OVM cross-domain-enabled logic to implement admin only access to functions.\n */\ncontract Optimism_SpokePool is CrossDomainEnabled, SpokePool {\n // \"l1Gas\" parameter used in call to bridge tokens from this contract back to L1 via IL2ERC20Bridge. Currently\n // unused by bridge but included for future compatibility.\n uint32 public l1Gas = 5_000_000;\n\n // ETH is an ERC20 on OVM.\n address public l2Eth = address(Lib_PredeployAddresses.OVM_ETH);\n\n // Stores alternative token bridges to use for L2 tokens that don't go over the standard bridge. This is needed\n // to support non-standard ERC20 tokens on Optimism, such as DIA and SNX which both use custom bridges.\n mapping(address => address) public tokenBridges;\n\n event OptimismTokensBridged(address indexed l2Token, address target, uint256 numberOfTokensBridged, uint256 l1Gas);\n event SetL1Gas(uint32 indexed newL1Gas);\n event SetL2TokenBridge(address indexed l2Token, address indexed tokenBridge);\n\n /**\n * @notice Construct the OVM SpokePool.\n * @param _crossDomainAdmin Cross domain admin to set. Can be changed by admin.\n * @param _hubPool Hub pool address to set. Can be changed by admin.\n * @param timerAddress Timer address to set.\n */\n constructor(\n address _crossDomainAdmin,\n address _hubPool,\n address timerAddress\n )\n CrossDomainEnabled(Lib_PredeployAddresses.L2_CROSS_DOMAIN_MESSENGER)\n SpokePool(_crossDomainAdmin, _hubPool, 0x4200000000000000000000000000000000000006, timerAddress)\n {}\n\n /*******************************************\n * OPTIMISM-SPECIFIC ADMIN FUNCTIONS *\n *******************************************/\n\n /**\n * @notice Change L1 gas limit. Callable only by admin.\n * @param newl1Gas New L1 gas limit to set.\n */\n function setL1GasLimit(uint32 newl1Gas) public onlyAdmin {\n l1Gas = newl1Gas;\n emit SetL1Gas(newl1Gas);\n }\n\n /**\n * @notice Set bridge contract for L2 token used to withdraw back to L1.\n * @dev If this mapping isn't set for an L2 token, then the standard bridge will be used to bridge this token.\n * @param tokenBridge Address of token bridge\n */\n function setTokenBridge(address l2Token, address tokenBridge) public onlyAdmin {\n tokenBridges[l2Token] = tokenBridge;\n emit SetL2TokenBridge(l2Token, tokenBridge);\n }\n\n /**************************************\n * DATA WORKER FUNCTIONS *\n **************************************/\n\n /**\n * @notice Wraps any ETH into WETH before executing base function. This is necessary because SpokePool receives\n * ETH over the canonical token bridge instead of WETH.\n * @inheritdoc SpokePool\n */\n function executeSlowRelayRoot(\n address depositor,\n address recipient,\n address destinationToken,\n uint256 totalRelayAmount,\n uint256 originChainId,\n uint64 realizedLpFeePct,\n uint64 relayerFeePct,\n uint32 depositId,\n uint32 rootBundleId,\n bytes32[] memory proof\n ) public override(SpokePool) nonReentrant {\n if (destinationToken == address(weth)) _depositEthToWeth();\n\n _executeSlowRelayRoot(\n depositor,\n recipient,\n destinationToken,\n totalRelayAmount,\n originChainId,\n realizedLpFeePct,\n relayerFeePct,\n depositId,\n rootBundleId,\n proof\n );\n }\n\n /**\n * @notice Wraps any ETH into WETH before executing base function. This is necessary because SpokePool receives\n * ETH over the canonical token bridge instead of WETH.\n * @inheritdoc SpokePool\n */\n function executeRelayerRefundRoot(\n uint32 rootBundleId,\n SpokePoolInterface.RelayerRefundLeaf memory relayerRefundLeaf,\n bytes32[] memory proof\n ) public override(SpokePool) nonReentrant {\n if (relayerRefundLeaf.l2TokenAddress == address(weth)) _depositEthToWeth();\n\n _executeRelayerRefundRoot(rootBundleId, relayerRefundLeaf, proof);\n }\n\n /**************************************\n * INTERNAL FUNCTIONS *\n **************************************/\n\n // Wrap any ETH owned by this contract so we can send expected L2 token to recipient. This is necessary because\n // this SpokePool will receive ETH from the canonical token bridge instead of WETH. Its not sufficient to execute\n // this logic inside a fallback method that executes when this contract receives ETH because ETH is an ERC20\n // on the OVM.\n function _depositEthToWeth() internal {\n if (address(this).balance > 0) weth.deposit{ value: address(this).balance }();\n }\n\n function _bridgeTokensToHubPool(RelayerRefundLeaf memory relayerRefundLeaf) internal override {\n // If the token being bridged is WETH then we need to first unwrap it to ETH and then send ETH over the\n // canonical bridge. On Optimism, this is address 0xDeadDeAddeAddEAddeadDEaDDEAdDeaDDeAD0000.\n if (relayerRefundLeaf.l2TokenAddress == address(weth)) {\n WETH9(relayerRefundLeaf.l2TokenAddress).withdraw(relayerRefundLeaf.amountToReturn); // Unwrap into ETH.\n relayerRefundLeaf.l2TokenAddress = l2Eth; // Set the l2TokenAddress to ETH.\n }\n IL2ERC20Bridge(\n tokenBridges[relayerRefundLeaf.l2TokenAddress] == address(0)\n ? Lib_PredeployAddresses.L2_STANDARD_BRIDGE\n : tokenBridges[relayerRefundLeaf.l2TokenAddress]\n ).withdrawTo(\n relayerRefundLeaf.l2TokenAddress, // _l2Token. Address of the L2 token to bridge over.\n hubPool, // _to. Withdraw, over the bridge, to the l1 pool contract.\n relayerRefundLeaf.amountToReturn, // _amount.\n l1Gas, // _l1Gas. Unused, but included for potential forward compatibility considerations\n \"\" // _data. We don't need to send any data for the bridging action.\n );\n\n emit OptimismTokensBridged(relayerRefundLeaf.l2TokenAddress, hubPool, relayerRefundLeaf.amountToReturn, l1Gas);\n }\n\n // Apply OVM-specific transformation to cross domain admin address on L1.\n function _requireAdminSender() internal override onlyFromCrossDomainAccount(crossDomainAdmin) {}\n}\n" - }, - "@eth-optimism/contracts/libraries/constants/Lib_PredeployAddresses.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.9;\n\n/**\n * @title Lib_PredeployAddresses\n */\nlibrary Lib_PredeployAddresses {\n address internal constant L2_TO_L1_MESSAGE_PASSER = 0x4200000000000000000000000000000000000000;\n address internal constant L1_MESSAGE_SENDER = 0x4200000000000000000000000000000000000001;\n address internal constant DEPLOYER_WHITELIST = 0x4200000000000000000000000000000000000002;\n address payable internal constant OVM_ETH = payable(0xDeadDeAddeAddEAddeadDEaDDEAdDeaDDeAD0000);\n address internal constant L2_CROSS_DOMAIN_MESSENGER =\n 0x4200000000000000000000000000000000000007;\n address internal constant LIB_ADDRESS_MANAGER = 0x4200000000000000000000000000000000000008;\n address internal constant PROXY_EOA = 0x4200000000000000000000000000000000000009;\n address internal constant L2_STANDARD_BRIDGE = 0x4200000000000000000000000000000000000010;\n address internal constant SEQUENCER_FEE_WALLET = 0x4200000000000000000000000000000000000011;\n address internal constant L2_STANDARD_TOKEN_FACTORY =\n 0x4200000000000000000000000000000000000012;\n address internal constant L1_BLOCK_NUMBER = 0x4200000000000000000000000000000000000013;\n}\n" + "contracts/chain-adapters/Optimism_Adapter.sol": { + "content": "// SPDX-License-Identifier: AGPL-3.0-only\npragma solidity ^0.8.0;\n\nimport \"../interfaces/AdapterInterface.sol\";\nimport \"../interfaces/WETH9.sol\";\n\n// @dev Use local modified CrossDomainEnabled contract instead of one exported by eth-optimism because we need\n// this contract's state variables to be `immutable` because of the delegateCall call.\nimport \"./CrossDomainEnabled.sol\";\nimport \"@eth-optimism/contracts/L1/messaging/IL1StandardBridge.sol\";\n\nimport \"@openzeppelin/contracts/token/ERC20/IERC20.sol\";\nimport \"@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol\";\n\n/**\n * @notice Contract containing logic to send messages from L1 to Optimism.\n * @dev Public functions calling external contracts do not guard against reentrancy because they are expected to be\n * called via delegatecall, which will execute this contract's logic within the context of the originating contract.\n * For example, the HubPool will delegatecall these functions, therefore its only necessary that the HubPool's methods\n * that call this contract's logic guard against reentrancy.\n */\ncontract Optimism_Adapter is CrossDomainEnabled, AdapterInterface {\n using SafeERC20 for IERC20;\n uint32 public immutable l2GasLimit = 5_000_000;\n\n WETH9 public immutable l1Weth;\n\n IL1StandardBridge public immutable l1StandardBridge;\n\n // Optimism has the ability to support \"custom\" bridges. These bridges are not supported by the canonical bridge\n // and so we need to store the address of the custom token and the associated bridge. In the event we want to\n // support a new token that is not supported by Optimism, we can add a new custom bridge for it and re-deploy the\n // adapter. A full list of custom optimism tokens and their associated bridges can be found here:\n // https://github.com/ethereum-optimism/ethereum-optimism.github.io/blob/master/optimism.tokenlist.json\n address public immutable dai = 0x6B175474E89094C44Da98b954EedeAC495271d0F;\n address public immutable daiOptimismBridge = 0x10E6593CDda8c58a1d0f14C5164B376352a55f2F;\n address public immutable snx = 0xC011a73ee8576Fb46F5E1c5751cA3B9Fe0af2a6F;\n address public immutable snxOptimismBridge = 0xCd9D4988C0AE61887B075bA77f08cbFAd2b65068;\n\n /**\n * @notice Constructs new Adapter.\n * @param _l1Weth WETH address on L1.\n * @param _crossDomainMessenger XDomainMessenger Optimism system contract.\n * @param _l1StandardBridge Standard bridge contract.\n */\n constructor(\n WETH9 _l1Weth,\n address _crossDomainMessenger,\n IL1StandardBridge _l1StandardBridge\n ) CrossDomainEnabled(_crossDomainMessenger) {\n l1Weth = _l1Weth;\n l1StandardBridge = _l1StandardBridge;\n }\n\n /**\n * @notice Send cross-chain message to target on Optimism.\n * @param target Contract on Optimism that will receive message.\n * @param message Data to send to target.\n */\n function relayMessage(address target, bytes memory message) external payable override {\n sendCrossDomainMessage(target, uint32(l2GasLimit), message);\n emit MessageRelayed(target, message);\n }\n\n /**\n * @notice Bridge tokens to Optimism.\n * @param l1Token L1 token to deposit.\n * @param l2Token L2 token to receive.\n * @param amount Amount of L1 tokens to deposit and L2 tokens to receive.\n * @param to Bridge recipient.\n */\n function relayTokens(\n address l1Token,\n address l2Token,\n uint256 amount,\n address to\n ) external payable override {\n // If the l1Token is weth then unwrap it to ETH then send the ETH to the standard bridge.\n if (l1Token == address(l1Weth)) {\n l1Weth.withdraw(amount);\n l1StandardBridge.depositETHTo{ value: amount }(to, l2GasLimit, \"\");\n } else {\n IL1StandardBridge _l1StandardBridge = l1StandardBridge;\n\n // Check if the L1 token requires a custom bridge. If so, use that bridge over the standard bridge.\n if (l1Token == dai) _l1StandardBridge = IL1StandardBridge(daiOptimismBridge); // 1. DAI\n if (l1Token == snx) _l1StandardBridge = IL1StandardBridge(snxOptimismBridge); // 2. SNX\n\n IERC20(l1Token).safeIncreaseAllowance(address(_l1StandardBridge), amount);\n _l1StandardBridge.depositERC20To(l1Token, l2Token, to, amount, l2GasLimit, \"\");\n }\n emit TokensRelayed(l1Token, l2Token, amount, to);\n }\n}\n" }, - "@eth-optimism/contracts/L2/messaging/IL2ERC20Bridge.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.9;\n\n/**\n * @title IL2ERC20Bridge\n */\ninterface IL2ERC20Bridge {\n /**********\n * Events *\n **********/\n\n event WithdrawalInitiated(\n address indexed _l1Token,\n address indexed _l2Token,\n address indexed _from,\n address _to,\n uint256 _amount,\n bytes _data\n );\n\n event DepositFinalized(\n address indexed _l1Token,\n address indexed _l2Token,\n address indexed _from,\n address _to,\n uint256 _amount,\n bytes _data\n );\n\n event DepositFailed(\n address indexed _l1Token,\n address indexed _l2Token,\n address indexed _from,\n address _to,\n uint256 _amount,\n bytes _data\n );\n\n /********************\n * Public Functions *\n ********************/\n\n /**\n * @dev get the address of the corresponding L1 bridge contract.\n * @return Address of the corresponding L1 bridge contract.\n */\n function l1TokenBridge() external returns (address);\n\n /**\n * @dev initiate a withdraw of some tokens to the caller's account on L1\n * @param _l2Token Address of L2 token where withdrawal was initiated.\n * @param _amount Amount of the token to withdraw.\n * param _l1Gas Unused, but included for potential forward compatibility considerations.\n * @param _data Optional data to forward to L1. This data is provided\n * solely as a convenience for external contracts. Aside from enforcing a maximum\n * length, these contracts provide no guarantees about its content.\n */\n function withdraw(\n address _l2Token,\n uint256 _amount,\n uint32 _l1Gas,\n bytes calldata _data\n ) external;\n\n /**\n * @dev initiate a withdraw of some token to a recipient's account on L1.\n * @param _l2Token Address of L2 token where withdrawal is initiated.\n * @param _to L1 adress to credit the withdrawal to.\n * @param _amount Amount of the token to withdraw.\n * param _l1Gas Unused, but included for potential forward compatibility considerations.\n * @param _data Optional data to forward to L1. This data is provided\n * solely as a convenience for external contracts. Aside from enforcing a maximum\n * length, these contracts provide no guarantees about its content.\n */\n function withdrawTo(\n address _l2Token,\n address _to,\n uint256 _amount,\n uint32 _l1Gas,\n bytes calldata _data\n ) external;\n\n /*************************\n * Cross-chain Functions *\n *************************/\n\n /**\n * @dev Complete a deposit from L1 to L2, and credits funds to the recipient's balance of this\n * L2 token. This call will fail if it did not originate from a corresponding deposit in\n * L1StandardTokenBridge.\n * @param _l1Token Address for the l1 token this is called with\n * @param _l2Token Address for the l2 token this is called with\n * @param _from Account to pull the deposit from on L2.\n * @param _to Address to receive the withdrawal at\n * @param _amount Amount of the token to withdraw\n * @param _data Data provider by the sender on L1. This data is provided\n * solely as a convenience for external contracts. Aside from enforcing a maximum\n * length, these contracts provide no guarantees about its content.\n */\n function finalizeDeposit(\n address _l1Token,\n address _l2Token,\n address _from,\n address _to,\n uint256 _amount,\n bytes calldata _data\n ) external;\n}\n" + "@eth-optimism/contracts/L1/messaging/IL1StandardBridge.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity >0.5.0 <0.9.0;\n\nimport \"./IL1ERC20Bridge.sol\";\n\n/**\n * @title IL1StandardBridge\n */\ninterface IL1StandardBridge is IL1ERC20Bridge {\n /**********\n * Events *\n **********/\n event ETHDepositInitiated(\n address indexed _from,\n address indexed _to,\n uint256 _amount,\n bytes _data\n );\n\n event ETHWithdrawalFinalized(\n address indexed _from,\n address indexed _to,\n uint256 _amount,\n bytes _data\n );\n\n /********************\n * Public Functions *\n ********************/\n\n /**\n * @dev Deposit an amount of the ETH to the caller's balance on L2.\n * @param _l2Gas Gas limit required to complete the deposit on L2.\n * @param _data Optional data to forward to L2. This data is provided\n * solely as a convenience for external contracts. Aside from enforcing a maximum\n * length, these contracts provide no guarantees about its content.\n */\n function depositETH(uint32 _l2Gas, bytes calldata _data) external payable;\n\n /**\n * @dev Deposit an amount of ETH to a recipient's balance on L2.\n * @param _to L2 address to credit the withdrawal to.\n * @param _l2Gas Gas limit required to complete the deposit on L2.\n * @param _data Optional data to forward to L2. This data is provided\n * solely as a convenience for external contracts. Aside from enforcing a maximum\n * length, these contracts provide no guarantees about its content.\n */\n function depositETHTo(\n address _to,\n uint32 _l2Gas,\n bytes calldata _data\n ) external payable;\n\n /*************************\n * Cross-chain Functions *\n *************************/\n\n /**\n * @dev Complete a withdrawal from L2 to L1, and credit funds to the recipient's balance of the\n * L1 ETH token. Since only the xDomainMessenger can call this function, it will never be called\n * before the withdrawal is finalized.\n * @param _from L2 address initiating the transfer.\n * @param _to L1 address to credit the withdrawal to.\n * @param _amount Amount of the ERC20 to deposit.\n * @param _data Optional data to forward to L2. This data is provided\n * solely as a convenience for external contracts. Aside from enforcing a maximum\n * length, these contracts provide no guarantees about its content.\n */\n function finalizeETHWithdrawal(\n address _from,\n address _to,\n uint256 _amount,\n bytes calldata _data\n ) external;\n}\n" }, - "contracts/Ethereum_SpokePool.sol": { - "content": "// SPDX-License-Identifier: GPL-3.0-only\npragma solidity ^0.8.0;\n\nimport \"./interfaces/WETH9.sol\";\n\nimport \"@openzeppelin/contracts/access/Ownable.sol\";\nimport \"@openzeppelin/contracts/token/ERC20/IERC20.sol\";\n\nimport \"./SpokePool.sol\";\nimport \"./SpokePoolInterface.sol\";\n\n/**\n * @notice Ethereum L1 specific SpokePool. Used on Ethereum L1 to facilitate L2->L1 transfers.\n */\ncontract Ethereum_SpokePool is SpokePool, Ownable {\n /**\n * @notice Construct the Ethereum SpokePool.\n * @param _hubPool Hub pool address to set. Can be changed by admin.\n * @param _wethAddress Weth address for this network to set.\n * @param timerAddress Timer address to set.\n */\n constructor(\n address _hubPool,\n address _wethAddress,\n address timerAddress\n ) SpokePool(msg.sender, _hubPool, _wethAddress, timerAddress) {}\n\n /**************************************\n * INTERNAL FUNCTIONS *\n **************************************/\n\n function _bridgeTokensToHubPool(RelayerRefundLeaf memory relayerRefundLeaf) internal override {\n IERC20(relayerRefundLeaf.l2TokenAddress).transfer(hubPool, relayerRefundLeaf.amountToReturn);\n }\n\n // Admin is simply owner which should be same account that owns the HubPool deployed on this network. A core\n // assumption of this contract system is that the HubPool is deployed on Ethereum.\n function _requireAdminSender() internal override onlyOwner {}\n}\n" + "@eth-optimism/contracts/L1/messaging/IL1ERC20Bridge.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity >0.5.0 <0.9.0;\n\n/**\n * @title IL1ERC20Bridge\n */\ninterface IL1ERC20Bridge {\n /**********\n * Events *\n **********/\n\n event ERC20DepositInitiated(\n address indexed _l1Token,\n address indexed _l2Token,\n address indexed _from,\n address _to,\n uint256 _amount,\n bytes _data\n );\n\n event ERC20WithdrawalFinalized(\n address indexed _l1Token,\n address indexed _l2Token,\n address indexed _from,\n address _to,\n uint256 _amount,\n bytes _data\n );\n\n /********************\n * Public Functions *\n ********************/\n\n /**\n * @dev get the address of the corresponding L2 bridge contract.\n * @return Address of the corresponding L2 bridge contract.\n */\n function l2TokenBridge() external returns (address);\n\n /**\n * @dev deposit an amount of the ERC20 to the caller's balance on L2.\n * @param _l1Token Address of the L1 ERC20 we are depositing\n * @param _l2Token Address of the L1 respective L2 ERC20\n * @param _amount Amount of the ERC20 to deposit\n * @param _l2Gas Gas limit required to complete the deposit on L2.\n * @param _data Optional data to forward to L2. This data is provided\n * solely as a convenience for external contracts. Aside from enforcing a maximum\n * length, these contracts provide no guarantees about its content.\n */\n function depositERC20(\n address _l1Token,\n address _l2Token,\n uint256 _amount,\n uint32 _l2Gas,\n bytes calldata _data\n ) external;\n\n /**\n * @dev deposit an amount of ERC20 to a recipient's balance on L2.\n * @param _l1Token Address of the L1 ERC20 we are depositing\n * @param _l2Token Address of the L1 respective L2 ERC20\n * @param _to L2 address to credit the withdrawal to.\n * @param _amount Amount of the ERC20 to deposit.\n * @param _l2Gas Gas limit required to complete the deposit on L2.\n * @param _data Optional data to forward to L2. This data is provided\n * solely as a convenience for external contracts. Aside from enforcing a maximum\n * length, these contracts provide no guarantees about its content.\n */\n function depositERC20To(\n address _l1Token,\n address _l2Token,\n address _to,\n uint256 _amount,\n uint32 _l2Gas,\n bytes calldata _data\n ) external;\n\n /*************************\n * Cross-chain Functions *\n *************************/\n\n /**\n * @dev Complete a withdrawal from L2 to L1, and credit funds to the recipient's balance of the\n * L1 ERC20 token.\n * This call will fail if the initialized withdrawal from L2 has not been finalized.\n *\n * @param _l1Token Address of L1 token to finalizeWithdrawal for.\n * @param _l2Token Address of L2 token where withdrawal was initiated.\n * @param _from L2 address initiating the transfer.\n * @param _to L1 address to credit the withdrawal to.\n * @param _amount Amount of the ERC20 to deposit.\n * @param _data Data provided by the sender on L2. This data is provided\n * solely as a convenience for external contracts. Aside from enforcing a maximum\n * length, these contracts provide no guarantees about its content.\n */\n function finalizeERC20Withdrawal(\n address _l1Token,\n address _l2Token,\n address _from,\n address _to,\n uint256 _amount,\n bytes calldata _data\n ) external;\n}\n" }, - "contracts/chain-adapters/Ethereum_Adapter.sol": { - "content": "// SPDX-License-Identifier: AGPL-3.0-only\npragma solidity ^0.8.0;\n\nimport \"../interfaces/AdapterInterface.sol\";\nimport \"../interfaces/WETH9.sol\";\n\nimport \"@openzeppelin/contracts/token/ERC20/IERC20.sol\";\nimport \"@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol\";\n\n/**\n * @notice Contract containing logic to send messages from L1 to Ethereum SpokePool.\n * @notice This contract should always be deployed on the same chain as the HubPool, as it acts as a pass-through\n * contract between HubPool and SpokePool on the same chain. Its named \"Ethereum_Adapter\" because a core assumption\n * is that the HubPool will be deployed on Ethereum, so this adapter will be used to communicate between HubPool\n * and the Ethereum_SpokePool.\n * @dev Public functions calling external contracts do not guard against reentrancy because they are expected to be\n * called via delegatecall, which will execute this contract's logic within the context of the originating contract.\n * For example, the HubPool will delegatecall these functions, therefore its only neccessary that the HubPool's methods\n * that call this contract's logic guard against reentrancy.\n */\ncontract Ethereum_Adapter is AdapterInterface {\n using SafeERC20 for IERC20;\n\n /**\n * @notice Send message to target on Ethereum.\n * @notice This function, and contract overall, is not useful in practice except that the HubPool\n * expects to interact with the SpokePool via an Adapter, so when communicating to the Ethereum_SpokePool, it must\n * send messages via this pass-through contract.\n * @param target Contract that will receive message.\n * @param message Data to send to target.\n */\n function relayMessage(address target, bytes memory message) external payable override {\n _executeCall(target, message);\n emit MessageRelayed(target, message);\n }\n\n /**\n * @notice Send tokens to target.\n * @param l1Token L1 token to send.\n * @param l2Token Unused parameter in this contract.\n * @param amount Amount of L1 tokens to send.\n * @param to recipient.\n */\n function relayTokens(\n address l1Token,\n address l2Token, // l2Token is unused for ethereum since we are assuming that the HubPool is only deployed\n // on this network.\n uint256 amount,\n address to\n ) external payable override {\n IERC20(l1Token).safeTransfer(to, amount);\n emit TokensRelayed(l1Token, l2Token, amount, to);\n }\n\n // Note: this snippet of code is copied from Governor.sol.\n function _executeCall(address to, bytes memory data) private {\n // Note: this snippet of code is copied from Governor.sol and modified to not include any \"value\" field.\n // solhint-disable-next-line no-inline-assembly\n\n bool success;\n assembly {\n let inputData := add(data, 0x20)\n let inputDataSize := mload(data)\n // Hardcode value to be 0 for relayed governance calls in order to avoid addressing complexity of bridging\n // value cross-chain.\n success := call(gas(), to, 0, inputData, inputDataSize, 0, 0)\n }\n require(success, \"execute call failed\");\n }\n}\n" + "contracts/chain-adapters/Polygon_Adapter.sol": { + "content": "// SPDX-License-Identifier: AGPL-3.0-only\npragma solidity ^0.8.0;\n\nimport \"../interfaces/AdapterInterface.sol\";\nimport \"../interfaces/WETH9.sol\";\n\nimport \"@openzeppelin/contracts/token/ERC20/IERC20.sol\";\nimport \"@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol\";\n\ninterface IRootChainManager {\n function depositEtherFor(address user) external payable;\n\n function depositFor(\n address user,\n address rootToken,\n bytes calldata depositData\n ) external;\n}\n\ninterface IFxStateSender {\n function sendMessageToChild(address _receiver, bytes calldata _data) external;\n}\n\n/**\n * @notice Sends cross chain messages Polygon L2 network.\n * @dev Public functions calling external contracts do not guard against reentrancy because they are expected to be\n * called via delegatecall, which will execute this contract's logic within the context of the originating contract.\n * For example, the HubPool will delegatecall these functions, therefore its only necessary that the HubPool's methods\n * that call this contract's logic guard against reentrancy.\n */\ncontract Polygon_Adapter is AdapterInterface {\n using SafeERC20 for IERC20;\n IRootChainManager public immutable rootChainManager;\n IFxStateSender public immutable fxStateSender;\n WETH9 public immutable l1Weth;\n\n /**\n * @notice Constructs new Adapter.\n * @param _rootChainManager RootChainManager Polygon system helper contract.\n * @param _fxStateSender FxStateSender Polygon system helper contract.\n * @param _l1Weth WETH address on L1.\n */\n constructor(\n IRootChainManager _rootChainManager,\n IFxStateSender _fxStateSender,\n WETH9 _l1Weth\n ) {\n rootChainManager = _rootChainManager;\n fxStateSender = _fxStateSender;\n l1Weth = _l1Weth;\n }\n\n /**\n * @notice Send cross-chain message to target on Polygon.\n * @param target Contract on Polygon that will receive message.\n * @param message Data to send to target.\n */\n\n function relayMessage(address target, bytes memory message) external payable override {\n fxStateSender.sendMessageToChild(target, message);\n emit MessageRelayed(target, message);\n }\n\n /**\n * @notice Bridge tokens to Polygon.\n * @param l1Token L1 token to deposit.\n * @param l2Token L2 token to receive.\n * @param amount Amount of L1 tokens to deposit and L2 tokens to receive.\n * @param to Bridge recipient.\n */\n function relayTokens(\n address l1Token,\n address l2Token,\n uint256 amount,\n address to\n ) external payable override {\n // If the l1Token is weth then unwrap it to ETH then send the ETH to the standard bridge.\n if (l1Token == address(l1Weth)) {\n l1Weth.withdraw(amount);\n rootChainManager.depositEtherFor{ value: amount }(to);\n } else {\n IERC20(l1Token).safeIncreaseAllowance(address(rootChainManager), amount);\n rootChainManager.depositFor(to, l1Token, abi.encode(amount));\n }\n emit TokensRelayed(l1Token, l2Token, amount, to);\n }\n}\n" }, "contracts/chain-adapters/Mock_Adapter.sol": { "content": "// SPDX-License-Identifier: AGPL-3.0-only\npragma solidity ^0.8.0;\n\nimport \"../interfaces/AdapterInterface.sol\";\nimport \"@openzeppelin/contracts/token/ERC20/IERC20.sol\";\n\n/**\n * @notice Contract used for testing communication between HubPool and Adapter.\n */\ncontract Mock_Adapter is AdapterInterface {\n event RelayMessageCalled(address target, bytes message, address caller);\n\n event RelayTokensCalled(address l1Token, address l2Token, uint256 amount, address to, address caller);\n\n Mock_Bridge public immutable bridge;\n\n constructor() {\n bridge = new Mock_Bridge();\n }\n\n function relayMessage(address target, bytes memory message) external payable override {\n bridge.bridgeMessage(target, message);\n emit RelayMessageCalled(target, message, msg.sender);\n }\n\n function relayTokens(\n address l1Token,\n address l2Token,\n uint256 amount,\n address to\n ) external payable override {\n IERC20(l1Token).approve(address(bridge), amount);\n bridge.bridgeTokens(l1Token, amount);\n emit RelayTokensCalled(l1Token, l2Token, amount, to, msg.sender);\n }\n}\n\n// This contract is intended to \"act like\" a simple version of an L2 bridge.\n// It's primarily meant to better reflect how a true L2 bridge interaction might work to give better gas estimates.\ncontract Mock_Bridge {\n event BridgedTokens(address token, uint256 amount);\n event BridgedMessage(address target, bytes message);\n\n mapping(address => uint256) deposits;\n\n function bridgeTokens(address token, uint256 amount) public {\n IERC20(token).transferFrom(msg.sender, address(this), amount);\n deposits[token] += amount;\n emit BridgedTokens(token, amount);\n }\n\n function bridgeMessage(address target, bytes memory message) public {\n emit BridgedMessage(target, message);\n }\n}\n" }, + "contracts/chain-adapters/Ethereum_Adapter.sol": { + "content": "// SPDX-License-Identifier: AGPL-3.0-only\npragma solidity ^0.8.0;\n\nimport \"../interfaces/AdapterInterface.sol\";\n\nimport \"@openzeppelin/contracts/token/ERC20/IERC20.sol\";\nimport \"@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol\";\n\n/**\n * @notice Contract containing logic to send messages from L1 to Ethereum SpokePool.\n * @notice This contract should always be deployed on the same chain as the HubPool, as it acts as a pass-through\n * contract between HubPool and SpokePool on the same chain. Its named \"Ethereum_Adapter\" because a core assumption\n * is that the HubPool will be deployed on Ethereum, so this adapter will be used to communicate between HubPool\n * and the Ethereum_SpokePool.\n * @dev Public functions calling external contracts do not guard against reentrancy because they are expected to be\n * called via delegatecall, which will execute this contract's logic within the context of the originating contract.\n * For example, the HubPool will delegatecall these functions, therefore its only necessary that the HubPool's methods\n * that call this contract's logic guard against reentrancy.\n */\ncontract Ethereum_Adapter is AdapterInterface {\n using SafeERC20 for IERC20;\n\n /**\n * @notice Send message to target on Ethereum.\n * @notice This function, and contract overall, is not useful in practice except that the HubPool\n * expects to interact with the SpokePool via an Adapter, so when communicating to the Ethereum_SpokePool, it must\n * send messages via this pass-through contract.\n * @param target Contract that will receive message.\n * @param message Data to send to target.\n */\n function relayMessage(address target, bytes memory message) external payable override {\n _executeCall(target, message);\n emit MessageRelayed(target, message);\n }\n\n /**\n * @notice Send tokens to target.\n * @param l1Token L1 token to send.\n * @param l2Token Unused parameter in this contract.\n * @param amount Amount of L1 tokens to send.\n * @param to recipient.\n */\n function relayTokens(\n address l1Token,\n address l2Token, // l2Token is unused for ethereum since we are assuming that the HubPool is only deployed\n // on this network.\n uint256 amount,\n address to\n ) external payable override {\n IERC20(l1Token).safeTransfer(to, amount);\n emit TokensRelayed(l1Token, l2Token, amount, to);\n }\n\n // Note: this snippet of code is copied from Governor.sol. Source: https://github.com/UMAprotocol/protocol/blob/5b37ea818a28479c01e458389a83c3e736306b17/packages/core/contracts/oracle/implementation/Governor.sol#L190-L207\n function _executeCall(address to, bytes memory data) private {\n // Note: this snippet of code is copied from Governor.sol and modified to not include any \"value\" field.\n // solhint-disable-next-line no-inline-assembly\n\n bool success;\n assembly {\n let inputData := add(data, 0x20)\n let inputDataSize := mload(data)\n // Hardcode value to be 0 for relayed governance calls in order to avoid addressing complexity of bridging\n // value cross-chain.\n success := call(gas(), to, 0, inputData, inputDataSize, 0, 0)\n }\n require(success, \"execute call failed\");\n }\n}\n" + }, "contracts/chain-adapters/Arbitrum_Adapter.sol": { - "content": "// SPDX-License-Identifier: AGPL-3.0-only\npragma solidity ^0.8.0;\n\nimport \"../interfaces/AdapterInterface.sol\";\nimport \"../interfaces/AdapterInterface.sol\";\nimport \"../interfaces/WETH9.sol\";\n\nimport \"@openzeppelin/contracts/token/ERC20/IERC20.sol\";\n\ninterface ArbitrumL1InboxLike {\n function createRetryableTicket(\n address destAddr,\n uint256 arbTxCallValue,\n uint256 maxSubmissionCost,\n address submissionRefundAddress,\n address valueRefundAddress,\n uint256 maxGas,\n uint256 gasPriceBid,\n bytes calldata data\n ) external payable returns (uint256);\n}\n\ninterface ArbitrumL1ERC20GatewayLike {\n function outboundTransfer(\n address _token,\n address _to,\n uint256 _amount,\n uint256 _maxGas,\n uint256 _gasPriceBid,\n bytes calldata _data\n ) external payable returns (bytes memory);\n}\n\n/**\n * @notice Contract containing logic to send messages from L1 to Arbitrum.\n * @dev Public functions calling external contracts do not guard against reentrancy because they are expected to be\n * called via delegatecall, which will execute this contract's logic within the context of the originating contract.\n * For example, the HubPool will delegatecall these functions, therefore its only neccessary that the HubPool's methods\n * that call this contract's logic guard against reentrancy.\n */\ncontract Arbitrum_Adapter is AdapterInterface {\n // Gas limit for immediate L2 execution attempt (can be estimated via NodeInterface.estimateRetryableTicket).\n // NodeInterface precompile interface exists at L2 address 0x00000000000000000000000000000000000000C8\n uint32 public immutable l2GasLimit = 5_000_000;\n\n // Amount of ETH allocated to pay for the base submission fee. The base submission fee is a parameter unique to\n // retryable transactions; the user is charged the base submission fee to cover the storage costs of keeping their\n // ticket’s calldata in the retry buffer. (current base submission fee is queryable via\n // ArbRetryableTx.getSubmissionPrice). ArbRetryableTicket precompile interface exists at L2 address\n // 0x000000000000000000000000000000000000006E.\n uint256 public immutable l2MaxSubmissionCost = 0.1e18;\n\n // L2 Gas price bid for immediate L2 execution attempt (queryable via standard eth*gasPrice RPC)\n uint256 public immutable l2GasPrice = 10e9; // 10 gWei\n\n // This address on L2 receives extra ETH that is left over after relaying a message via the inbox.\n address public immutable l2RefundL2Address;\n\n ArbitrumL1InboxLike public immutable l1Inbox;\n\n ArbitrumL1ERC20GatewayLike public immutable l1ERC20Gateway;\n\n event L2GasLimitSet(uint32 newL2GasLimit);\n\n event L2MaxSubmissionCostSet(uint256 newL2MaxSubmissionCost);\n\n event L2GasPriceSet(uint256 newL2GasPrice);\n\n event L2RefundL2AddressSet(address newL2RefundL2Address);\n\n /**\n * @notice Constructs new Adapter.\n * @param _l1ArbitrumInbox Inbox helper contract to send messages to Arbitrum.\n * @param _l1ERC20Gateway ERC20 gateway contract to send tokens to Arbitrum.\n */\n constructor(ArbitrumL1InboxLike _l1ArbitrumInbox, ArbitrumL1ERC20GatewayLike _l1ERC20Gateway) {\n l1Inbox = _l1ArbitrumInbox;\n l1ERC20Gateway = _l1ERC20Gateway;\n\n l2RefundL2Address = msg.sender;\n }\n\n /**\n * @notice Send cross-chain message to target on Arbitrum.\n * @notice This contract must hold at least getL1CallValue() amount of ETH to send a message via the Inbox\n * successfully, or the message will get stuck.\n * @param target Contract on Arbitrum that will receive message.\n * @param message Data to send to target.\n */\n function relayMessage(address target, bytes memory message) external payable override {\n uint256 requiredL1CallValue = getL1CallValue();\n require(address(this).balance >= requiredL1CallValue, \"Insufficient ETH balance\");\n\n l1Inbox.createRetryableTicket{ value: requiredL1CallValue }(\n target, // destAddr destination L2 contract address\n 0, // l2CallValue call value for retryable L2 message\n l2MaxSubmissionCost, // maxSubmissionCost Max gas deducted from user's L2 balance to cover base fee\n l2RefundL2Address, // excessFeeRefundAddress maxgas * gasprice - execution cost gets credited here on L2\n l2RefundL2Address, // callValueRefundAddress l2Callvalue gets credited here on L2 if retryable txn times out or gets cancelled\n l2GasLimit, // maxGas Max gas deducted from user's L2 balance to cover L2 execution\n l2GasPrice, // gasPriceBid price bid for L2 execution\n message // data ABI encoded data of L2 message\n );\n\n emit MessageRelayed(target, message);\n }\n\n /**\n * @notice Bridge tokens to Arbitrum.\n * @param l1Token L1 token to deposit.\n * @param l2Token L2 token to receive.\n * @param amount Amount of L1 tokens to deposit and L2 tokens to receive.\n * @param to Bridge recipient.\n */\n function relayTokens(\n address l1Token,\n address l2Token, // l2Token is unused for Arbitrum.\n uint256 amount,\n address to\n ) external payable override {\n l1ERC20Gateway.outboundTransfer(l1Token, to, amount, l2GasLimit, l2GasPrice, \"\");\n emit TokensRelayed(l1Token, l2Token, amount, to);\n }\n\n /**\n * @notice Returns required amount of ETH to send a message via the Inbox.\n * @return amount of ETH that this contract needs to hold in order for relayMessage to succeed.\n */\n function getL1CallValue() public pure returns (uint256) {\n return l2MaxSubmissionCost + l2GasPrice * l2GasLimit;\n }\n}\n" + "content": "// SPDX-License-Identifier: AGPL-3.0-only\npragma solidity ^0.8.0;\n\nimport \"../interfaces/AdapterInterface.sol\";\n\ninterface ArbitrumL1InboxLike {\n function createRetryableTicket(\n address destAddr,\n uint256 arbTxCallValue,\n uint256 maxSubmissionCost,\n address submissionRefundAddress,\n address valueRefundAddress,\n uint256 maxGas,\n uint256 gasPriceBid,\n bytes calldata data\n ) external payable returns (uint256);\n}\n\ninterface ArbitrumL1ERC20GatewayLike {\n function outboundTransfer(\n address _token,\n address _to,\n uint256 _amount,\n uint256 _maxGas,\n uint256 _gasPriceBid,\n bytes calldata _data\n ) external payable returns (bytes memory);\n}\n\n/**\n * @notice Contract containing logic to send messages from L1 to Arbitrum.\n * @dev Public functions calling external contracts do not guard against reentrancy because they are expected to be\n * called via delegatecall, which will execute this contract's logic within the context of the originating contract.\n * For example, the HubPool will delegatecall these functions, therefore its only necessary that the HubPool's methods\n * that call this contract's logic guard against reentrancy.\n */\ncontract Arbitrum_Adapter is AdapterInterface {\n // Gas limit for immediate L2 execution attempt (can be estimated via NodeInterface.estimateRetryableTicket).\n // NodeInterface precompile interface exists at L2 address 0x00000000000000000000000000000000000000C8\n uint32 public immutable l2GasLimit = 5_000_000;\n\n // Amount of ETH allocated to pay for the base submission fee. The base submission fee is a parameter unique to\n // retryable transactions; the user is charged the base submission fee to cover the storage costs of keeping their\n // ticket’s calldata in the retry buffer. (current base submission fee is queryable via\n // ArbRetryableTx.getSubmissionPrice). ArbRetryableTicket precompile interface exists at L2 address\n // 0x000000000000000000000000000000000000006E.\n uint256 public immutable l2MaxSubmissionCost = 0.1e18;\n\n // L2 Gas price bid for immediate L2 execution attempt (queryable via standard eth*gasPrice RPC)\n uint256 public immutable l2GasPrice = 10e9; // 10 gWei\n\n // This address on L2 receives extra ETH that is left over after relaying a message via the inbox.\n address public immutable l2RefundL2Address;\n\n ArbitrumL1InboxLike public immutable l1Inbox;\n\n ArbitrumL1ERC20GatewayLike public immutable l1ERC20Gateway;\n\n /**\n * @notice Constructs new Adapter.\n * @param _l1ArbitrumInbox Inbox helper contract to send messages to Arbitrum.\n * @param _l1ERC20Gateway ERC20 gateway contract to send tokens to Arbitrum.\n */\n constructor(ArbitrumL1InboxLike _l1ArbitrumInbox, ArbitrumL1ERC20GatewayLike _l1ERC20Gateway) {\n l1Inbox = _l1ArbitrumInbox;\n l1ERC20Gateway = _l1ERC20Gateway;\n\n l2RefundL2Address = msg.sender;\n }\n\n /**\n * @notice Send cross-chain message to target on Arbitrum.\n * @notice This contract must hold at least getL1CallValue() amount of ETH to send a message via the Inbox\n * successfully, or the message will get stuck.\n * @param target Contract on Arbitrum that will receive message.\n * @param message Data to send to target.\n */\n function relayMessage(address target, bytes memory message) external payable override {\n uint256 requiredL1CallValue = getL1CallValue();\n require(address(this).balance >= requiredL1CallValue, \"Insufficient ETH balance\");\n\n l1Inbox.createRetryableTicket{ value: requiredL1CallValue }(\n target, // destAddr destination L2 contract address\n 0, // l2CallValue call value for retryable L2 message\n l2MaxSubmissionCost, // maxSubmissionCost Max gas deducted from user's L2 balance to cover base fee\n l2RefundL2Address, // excessFeeRefundAddress maxgas * gasprice - execution cost gets credited here on L2\n l2RefundL2Address, // callValueRefundAddress l2Callvalue gets credited here on L2 if retryable txn times out or gets cancelled\n l2GasLimit, // maxGas Max gas deducted from user's L2 balance to cover L2 execution\n l2GasPrice, // gasPriceBid price bid for L2 execution\n message // data ABI encoded data of L2 message\n );\n\n emit MessageRelayed(target, message);\n }\n\n /**\n * @notice Bridge tokens to Arbitrum.\n * @param l1Token L1 token to deposit.\n * @param l2Token L2 token to receive.\n * @param amount Amount of L1 tokens to deposit and L2 tokens to receive.\n * @param to Bridge recipient.\n */\n function relayTokens(\n address l1Token,\n address l2Token, // l2Token is unused for Arbitrum.\n uint256 amount,\n address to\n ) external payable override {\n l1ERC20Gateway.outboundTransfer(l1Token, to, amount, l2GasLimit, l2GasPrice, \"\");\n emit TokensRelayed(l1Token, l2Token, amount, to);\n }\n\n /**\n * @notice Returns required amount of ETH to send a message via the Inbox.\n * @return amount of ETH that this contract needs to hold in order for relayMessage to succeed.\n */\n function getL1CallValue() public pure returns (uint256) {\n return l2MaxSubmissionCost + l2GasPrice * l2GasLimit;\n }\n}\n" }, - "contracts/test/MerkleLibTest.sol": { - "content": "// SPDX-License-Identifier: GPL-3.0-only\npragma solidity ^0.8.0;\n\nimport \"../MerkleLib.sol\";\nimport \"../HubPoolInterface.sol\";\nimport \"../SpokePoolInterface.sol\";\n\n/**\n * @notice Contract to test the MerkleLib.\n */\ncontract MerkleLibTest {\n mapping(uint256 => uint256) public claimedBitMap;\n\n uint256 public claimedBitMap1D;\n\n function verifyPoolRebalance(\n bytes32 root,\n HubPoolInterface.PoolRebalanceLeaf memory rebalance,\n bytes32[] memory proof\n ) public pure returns (bool) {\n return MerkleLib.verifyPoolRebalance(root, rebalance, proof);\n }\n\n function verifyRelayerRefund(\n bytes32 root,\n SpokePoolInterface.RelayerRefundLeaf memory refund,\n bytes32[] memory proof\n ) public pure returns (bool) {\n return MerkleLib.verifyRelayerRefund(root, refund, proof);\n }\n\n function verifySlowRelayFulfillment(\n bytes32 root,\n SpokePoolInterface.RelayData memory slowRelayFulfillment,\n bytes32[] memory proof\n ) public pure returns (bool) {\n return MerkleLib.verifySlowRelayFulfillment(root, slowRelayFulfillment, proof);\n }\n\n function isClaimed(uint256 index) public view returns (bool) {\n return MerkleLib.isClaimed(claimedBitMap, index);\n }\n\n function setClaimed(uint256 index) public {\n MerkleLib.setClaimed(claimedBitMap, index);\n }\n\n function isClaimed1D(uint256 index) public view returns (bool) {\n return MerkleLib.isClaimed1D(claimedBitMap1D, index);\n }\n\n function setClaimed1D(uint256 index) public {\n claimedBitMap1D = MerkleLib.setClaimed1D(claimedBitMap1D, index);\n }\n}\n" + "@openzeppelin/contracts/access/Ownable.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts v4.4.1 (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 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 called by any account other than the owner.\n */\n modifier onlyOwner() {\n require(owner() == _msgSender(), \"Ownable: caller is not the owner\");\n _;\n }\n\n /**\n * @dev Leaves the contract without owner. It will not be possible to call\n * `onlyOwner` functions anymore. Can only be called by the current owner.\n *\n * NOTE: Renouncing ownership will leave the contract without an owner,\n * thereby removing 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" }, - "@uma/core/contracts/oracle/interfaces/SkinnyOptimisticOracleInterface.sol": { - "content": "// SPDX-License-Identifier: AGPL-3.0-only\npragma solidity ^0.8.0;\n\nimport \"@openzeppelin/contracts/token/ERC20/IERC20.sol\";\nimport \"../interfaces/OptimisticOracleInterface.sol\";\n\n/**\n * @title Interface for the gas-cost-reduced version of the OptimisticOracle.\n * @notice Differences from normal OptimisticOracle:\n * - refundOnDispute: flag is removed, by default there are no refunds on disputes.\n * - customizing request parameters: In the OptimisticOracle, parameters like `bond` and `customLiveness` can be reset\n * after a request is already made via `requestPrice`. In the SkinnyOptimisticOracle, these parameters can only be\n * set in `requestPrice`, which has an expanded input set.\n * - settleAndGetPrice: Replaced by `settle`, which can only be called once per settleable request. The resolved price\n * can be fetched via the `Settle` event or the return value of `settle`.\n * - general changes to interface: Functions that interact with existing requests all require the parameters of the\n * request to modify to be passed as input. These parameters must match with the existing request parameters or the\n * function will revert. This change reflects the internal refactor to store hashed request parameters instead of the\n * full request struct.\n * @dev Interface used by financial contracts to interact with the Oracle. Voters will use a different interface.\n */\nabstract contract SkinnyOptimisticOracleInterface {\n // Struct representing a price request. Note that this differs from the OptimisticOracleInterface's Request struct\n // in that refundOnDispute is removed.\n struct Request {\n address proposer; // Address of the proposer.\n address disputer; // Address of the disputer.\n IERC20 currency; // ERC20 token used to pay rewards and fees.\n bool settled; // True if the request is settled.\n int256 proposedPrice; // Price that the proposer submitted.\n int256 resolvedPrice; // Price resolved once the request is settled.\n uint256 expirationTime; // Time at which the request auto-settles without a dispute.\n uint256 reward; // Amount of the currency to pay to the proposer on settlement.\n uint256 finalFee; // Final fee to pay to the Store upon request to the DVM.\n uint256 bond; // Bond that the proposer and disputer must pay on top of the final fee.\n uint256 customLiveness; // Custom liveness value set by the requester.\n }\n\n // This value must be <= the Voting contract's `ancillaryBytesLimit` value otherwise it is possible\n // that a price can be requested to this contract successfully, but cannot be disputed because the DVM refuses\n // to accept a price request made with ancillary data length over a certain size.\n uint256 public constant ancillaryBytesLimit = 8192;\n\n /**\n * @notice Requests a new price.\n * @param identifier price identifier being requested.\n * @param timestamp timestamp of the price being requested.\n * @param ancillaryData ancillary data representing additional args being passed with the price request.\n * @param currency ERC20 token used for payment of rewards and fees. Must be approved for use with the DVM.\n * @param reward reward offered to a successful proposer. Will be pulled from the caller. Note: this can be 0,\n * which could make sense if the contract requests and proposes the value in the same call or\n * provides its own reward system.\n * @param bond custom proposal bond to set for request. If set to 0, defaults to the final fee.\n * @param customLiveness custom proposal liveness to set for request.\n * @return totalBond default bond + final fee that the proposer and disputer will be required to pay.\n */\n function requestPrice(\n bytes32 identifier,\n uint32 timestamp,\n bytes memory ancillaryData,\n IERC20 currency,\n uint256 reward,\n uint256 bond,\n uint256 customLiveness\n ) external virtual returns (uint256 totalBond);\n\n /**\n * @notice Proposes a price value on another address' behalf. Note: this address will receive any rewards that come\n * from this proposal. However, any bonds are pulled from the caller.\n * @param requester sender of the initial price request.\n * @param identifier price identifier to identify the existing request.\n * @param timestamp timestamp to identify the existing request.\n * @param ancillaryData ancillary data of the price being requested.\n * @param request price request parameters whose hash must match the request that the caller wants to\n * propose a price for.\n * @param proposer address to set as the proposer.\n * @param proposedPrice price being proposed.\n * @return totalBond the amount that's pulled from the caller's wallet as a bond. The bond will be returned to\n * the proposer once settled if the proposal is correct.\n */\n function proposePriceFor(\n address requester,\n bytes32 identifier,\n uint32 timestamp,\n bytes memory ancillaryData,\n Request memory request,\n address proposer,\n int256 proposedPrice\n ) public virtual returns (uint256 totalBond);\n\n /**\n * @notice Proposes a price value where caller is the proposer.\n * @param requester sender of the initial price request.\n * @param identifier price identifier to identify the existing request.\n * @param timestamp timestamp to identify the existing request.\n * @param ancillaryData ancillary data of the price being requested.\n * @param request price request parameters whose hash must match the request that the caller wants to\n * propose a price for.\n * @param proposedPrice price being proposed.\n * @return totalBond the amount that's pulled from the caller's wallet as a bond. The bond will be returned to\n * the proposer once settled if the proposal is correct.\n */\n function proposePrice(\n address requester,\n bytes32 identifier,\n uint32 timestamp,\n bytes memory ancillaryData,\n Request memory request,\n int256 proposedPrice\n ) external virtual returns (uint256 totalBond);\n\n /**\n * @notice Combines logic of requestPrice and proposePrice while taking advantage of gas savings from not having to\n * overwrite Request params that a normal requestPrice() => proposePrice() flow would entail. Note: The proposer\n * will receive any rewards that come from this proposal. However, any bonds are pulled from the caller.\n * @dev The caller is the requester, but the proposer can be customized.\n * @param identifier price identifier to identify the existing request.\n * @param timestamp timestamp to identify the existing request.\n * @param ancillaryData ancillary data of the price being requested.\n * @param currency ERC20 token used for payment of rewards and fees. Must be approved for use with the DVM.\n * @param reward reward offered to a successful proposer. Will be pulled from the caller. Note: this can be 0,\n * which could make sense if the contract requests and proposes the value in the same call or\n * provides its own reward system.\n * @param bond custom proposal bond to set for request. If set to 0, defaults to the final fee.\n * @param customLiveness custom proposal liveness to set for request.\n * @param proposer address to set as the proposer.\n * @param proposedPrice price being proposed.\n * @return totalBond the amount that's pulled from the caller's wallet as a bond. The bond will be returned to\n * the proposer once settled if the proposal is correct.\n */\n function requestAndProposePriceFor(\n bytes32 identifier,\n uint32 timestamp,\n bytes memory ancillaryData,\n IERC20 currency,\n uint256 reward,\n uint256 bond,\n uint256 customLiveness,\n address proposer,\n int256 proposedPrice\n ) external virtual returns (uint256 totalBond);\n\n /**\n * @notice Disputes a price request with an active proposal on another address' behalf. Note: this address will\n * receive any rewards that come from this dispute. However, any bonds are pulled from the caller.\n * @param identifier price identifier to identify the existing request.\n * @param timestamp timestamp to identify the existing request.\n * @param ancillaryData ancillary data of the price being requested.\n * @param request price request parameters whose hash must match the request that the caller wants to\n * dispute.\n * @param disputer address to set as the disputer.\n * @param requester sender of the initial price request.\n * @return totalBond the amount that's pulled from the caller's wallet as a bond. The bond will be returned to\n * the disputer once settled if the dispute was valid (the proposal was incorrect).\n */\n function disputePriceFor(\n bytes32 identifier,\n uint32 timestamp,\n bytes memory ancillaryData,\n Request memory request,\n address disputer,\n address requester\n ) public virtual returns (uint256 totalBond);\n\n /**\n * @notice Disputes a price request with an active proposal where caller is the disputer.\n * @param requester sender of the initial price request.\n * @param identifier price identifier to identify the existing request.\n * @param timestamp timestamp to identify the existing request.\n * @param ancillaryData ancillary data of the price being requested.\n * @param request price request parameters whose hash must match the request that the caller wants to\n * dispute.\n * @return totalBond the amount that's pulled from the caller's wallet as a bond. The bond will be returned to\n * the disputer once settled if the dispute was valid (the proposal was incorrect).\n */\n function disputePrice(\n address requester,\n bytes32 identifier,\n uint32 timestamp,\n bytes memory ancillaryData,\n Request memory request\n ) external virtual returns (uint256 totalBond);\n\n /**\n * @notice Attempts to settle an outstanding price request. Will revert if it isn't settleable.\n * @param requester sender of the initial price request.\n * @param identifier price identifier to identify the existing request.\n * @param timestamp timestamp to identify the existing request.\n * @param ancillaryData ancillary data of the price being requested.\n * @param request price request parameters whose hash must match the request that the caller wants to\n * settle.\n * @return payout the amount that the \"winner\" (proposer or disputer) receives on settlement. This amount includes\n * the returned bonds as well as additional rewards.\n * @return resolvedPrice the price that the request settled to.\n */\n function settle(\n address requester,\n bytes32 identifier,\n uint32 timestamp,\n bytes memory ancillaryData,\n Request memory request\n ) external virtual returns (uint256 payout, int256 resolvedPrice);\n\n /**\n * @notice Computes the current state of a price request. See the State enum for more details.\n * @param requester sender of the initial price request.\n * @param identifier price identifier to identify the existing request.\n * @param timestamp timestamp to identify the existing request.\n * @param ancillaryData ancillary data of the price being requested.\n * @param request price request parameters.\n * @return the State.\n */\n function getState(\n address requester,\n bytes32 identifier,\n uint32 timestamp,\n bytes memory ancillaryData,\n Request memory request\n ) external virtual returns (OptimisticOracleInterface.State);\n\n /**\n * @notice Checks if a given request has resolved, expired or been settled (i.e the optimistic oracle has a price).\n * @param requester sender of the initial price request.\n * @param identifier price identifier to identify the existing request.\n * @param timestamp timestamp to identify the existing request.\n * @param ancillaryData ancillary data of the price being requested.\n * @param request price request parameters. The hash of these parameters must match with the request hash that is\n * associated with the price request unique ID {requester, identifier, timestamp, ancillaryData}, or this method\n * will revert.\n * @return boolean indicating true if price exists and false if not.\n */\n function hasPrice(\n address requester,\n bytes32 identifier,\n uint32 timestamp,\n bytes memory ancillaryData,\n Request memory request\n ) public virtual returns (bool);\n\n /**\n * @notice Generates stamped ancillary data in the format that it would be used in the case of a price dispute.\n * @param ancillaryData ancillary data of the price being requested.\n * @param requester sender of the initial price request.\n * @return the stamped ancillary bytes.\n */\n function stampAncillaryData(bytes memory ancillaryData, address requester)\n public\n pure\n virtual\n returns (bytes memory);\n}\n" + "contracts/Ethereum_SpokePool.sol": { + "content": "// SPDX-License-Identifier: GPL-3.0-only\npragma solidity ^0.8.0;\n\nimport \"./SpokePool.sol\";\nimport \"@openzeppelin/contracts/access/Ownable.sol\";\n\n/**\n * @notice Ethereum L1 specific SpokePool. Used on Ethereum L1 to facilitate L2->L1 transfers.\n */\ncontract Ethereum_SpokePool is SpokePool, Ownable {\n /**\n * @notice Construct the Ethereum SpokePool.\n * @param _hubPool Hub pool address to set. Can be changed by admin.\n * @param _wethAddress Weth address for this network to set.\n * @param timerAddress Timer address to set.\n */\n constructor(\n address _hubPool,\n address _wethAddress,\n address timerAddress\n ) SpokePool(msg.sender, _hubPool, _wethAddress, timerAddress) {}\n\n /**************************************\n * INTERNAL FUNCTIONS *\n **************************************/\n\n function _bridgeTokensToHubPool(RelayerRefundLeaf memory relayerRefundLeaf) internal override {\n IERC20(relayerRefundLeaf.l2TokenAddress).transfer(hubPool, relayerRefundLeaf.amountToReturn);\n }\n\n // Admin is simply owner which should be same account that owns the HubPool deployed on this network. A core\n // assumption of this contract system is that the HubPool is deployed on Ethereum.\n function _requireAdminSender() internal override onlyOwner {}\n}\n" }, "@uma/core/contracts/oracle/interfaces/OptimisticOracleInterface.sol": { "content": "// SPDX-License-Identifier: AGPL-3.0-only\npragma solidity ^0.8.0;\n\nimport \"@openzeppelin/contracts/token/ERC20/IERC20.sol\";\n\n/**\n * @title Financial contract facing Oracle interface.\n * @dev Interface used by financial contracts to interact with the Oracle. Voters will use a different interface.\n */\nabstract contract OptimisticOracleInterface {\n // Struct representing the state of a price request.\n enum State {\n Invalid, // Never requested.\n Requested, // Requested, no other actions taken.\n Proposed, // Proposed, but not expired or disputed yet.\n Expired, // Proposed, not disputed, past liveness.\n Disputed, // Disputed, but no DVM price returned yet.\n Resolved, // Disputed and DVM price is available.\n Settled // Final price has been set in the contract (can get here from Expired or Resolved).\n }\n\n // Struct representing a price request.\n struct Request {\n address proposer; // Address of the proposer.\n address disputer; // Address of the disputer.\n IERC20 currency; // ERC20 token used to pay rewards and fees.\n bool settled; // True if the request is settled.\n bool refundOnDispute; // True if the requester should be refunded their reward on dispute.\n int256 proposedPrice; // Price that the proposer submitted.\n int256 resolvedPrice; // Price resolved once the request is settled.\n uint256 expirationTime; // Time at which the request auto-settles without a dispute.\n uint256 reward; // Amount of the currency to pay to the proposer on settlement.\n uint256 finalFee; // Final fee to pay to the Store upon request to the DVM.\n uint256 bond; // Bond that the proposer and disputer must pay on top of the final fee.\n uint256 customLiveness; // Custom liveness value set by the requester.\n }\n\n // This value must be <= the Voting contract's `ancillaryBytesLimit` value otherwise it is possible\n // that a price can be requested to this contract successfully, but cannot be disputed because the DVM refuses\n // to accept a price request made with ancillary data length over a certain size.\n uint256 public constant ancillaryBytesLimit = 8192;\n\n /**\n * @notice Requests a new price.\n * @param identifier price identifier being requested.\n * @param timestamp timestamp of the price being requested.\n * @param ancillaryData ancillary data representing additional args being passed with the price request.\n * @param currency ERC20 token used for payment of rewards and fees. Must be approved for use with the DVM.\n * @param reward reward offered to a successful proposer. Will be pulled from the caller. Note: this can be 0,\n * which could make sense if the contract requests and proposes the value in the same call or\n * provides its own reward system.\n * @return totalBond default bond (final fee) + final fee that the proposer and disputer will be required to pay.\n * This can be changed with a subsequent call to setBond().\n */\n function requestPrice(\n bytes32 identifier,\n uint256 timestamp,\n bytes memory ancillaryData,\n IERC20 currency,\n uint256 reward\n ) external virtual returns (uint256 totalBond);\n\n /**\n * @notice Set the proposal bond associated with a price request.\n * @param identifier price identifier to identify the existing request.\n * @param timestamp timestamp to identify the existing request.\n * @param ancillaryData ancillary data of the price being requested.\n * @param bond custom bond amount to set.\n * @return totalBond new bond + final fee that the proposer and disputer will be required to pay. This can be\n * changed again with a subsequent call to setBond().\n */\n function setBond(\n bytes32 identifier,\n uint256 timestamp,\n bytes memory ancillaryData,\n uint256 bond\n ) external virtual returns (uint256 totalBond);\n\n /**\n * @notice Sets the request to refund the reward if the proposal is disputed. This can help to \"hedge\" the caller\n * in the event of a dispute-caused delay. Note: in the event of a dispute, the winner still receives the other's\n * bond, so there is still profit to be made even if the reward is refunded.\n * @param identifier price identifier to identify the existing request.\n * @param timestamp timestamp to identify the existing request.\n * @param ancillaryData ancillary data of the price being requested.\n */\n function setRefundOnDispute(\n bytes32 identifier,\n uint256 timestamp,\n bytes memory ancillaryData\n ) external virtual;\n\n /**\n * @notice Sets a custom liveness value for the request. Liveness is the amount of time a proposal must wait before\n * being auto-resolved.\n * @param identifier price identifier to identify the existing request.\n * @param timestamp timestamp to identify the existing request.\n * @param ancillaryData ancillary data of the price being requested.\n * @param customLiveness new custom liveness.\n */\n function setCustomLiveness(\n bytes32 identifier,\n uint256 timestamp,\n bytes memory ancillaryData,\n uint256 customLiveness\n ) external virtual;\n\n /**\n * @notice Proposes a price value on another address' behalf. Note: this address will receive any rewards that come\n * from this proposal. However, any bonds are pulled from the caller.\n * @param proposer address to set as the proposer.\n * @param requester sender of the initial price request.\n * @param identifier price identifier to identify the existing request.\n * @param timestamp timestamp to identify the existing request.\n * @param ancillaryData ancillary data of the price being requested.\n * @param proposedPrice price being proposed.\n * @return totalBond the amount that's pulled from the caller's wallet as a bond. The bond will be returned to\n * the proposer once settled if the proposal is correct.\n */\n function proposePriceFor(\n address proposer,\n address requester,\n bytes32 identifier,\n uint256 timestamp,\n bytes memory ancillaryData,\n int256 proposedPrice\n ) public virtual returns (uint256 totalBond);\n\n /**\n * @notice Proposes a price value for an existing price request.\n * @param requester sender of the initial price request.\n * @param identifier price identifier to identify the existing request.\n * @param timestamp timestamp to identify the existing request.\n * @param ancillaryData ancillary data of the price being requested.\n * @param proposedPrice price being proposed.\n * @return totalBond the amount that's pulled from the proposer's wallet as a bond. The bond will be returned to\n * the proposer once settled if the proposal is correct.\n */\n function proposePrice(\n address requester,\n bytes32 identifier,\n uint256 timestamp,\n bytes memory ancillaryData,\n int256 proposedPrice\n ) external virtual returns (uint256 totalBond);\n\n /**\n * @notice Disputes a price request with an active proposal on another address' behalf. Note: this address will\n * receive any rewards that come from this dispute. However, any bonds are pulled from the caller.\n * @param disputer address to set as the disputer.\n * @param requester sender of the initial price request.\n * @param identifier price identifier to identify the existing request.\n * @param timestamp timestamp to identify the existing request.\n * @param ancillaryData ancillary data of the price being requested.\n * @return totalBond the amount that's pulled from the caller's wallet as a bond. The bond will be returned to\n * the disputer once settled if the dispute was value (the proposal was incorrect).\n */\n function disputePriceFor(\n address disputer,\n address requester,\n bytes32 identifier,\n uint256 timestamp,\n bytes memory ancillaryData\n ) public virtual returns (uint256 totalBond);\n\n /**\n * @notice Disputes a price value for an existing price request with an active proposal.\n * @param requester sender of the initial price request.\n * @param identifier price identifier to identify the existing request.\n * @param timestamp timestamp to identify the existing request.\n * @param ancillaryData ancillary data of the price being requested.\n * @return totalBond the amount that's pulled from the disputer's wallet as a bond. The bond will be returned to\n * the disputer once settled if the dispute was valid (the proposal was incorrect).\n */\n function disputePrice(\n address requester,\n bytes32 identifier,\n uint256 timestamp,\n bytes memory ancillaryData\n ) external virtual returns (uint256 totalBond);\n\n /**\n * @notice Retrieves a price that was previously requested by a caller. Reverts if the request is not settled\n * or settleable. Note: this method is not view so that this call may actually settle the price request if it\n * hasn't been settled.\n * @param identifier price identifier to identify the existing request.\n * @param timestamp timestamp to identify the existing request.\n * @param ancillaryData ancillary data of the price being requested.\n * @return resolved price.\n */\n function settleAndGetPrice(\n bytes32 identifier,\n uint256 timestamp,\n bytes memory ancillaryData\n ) external virtual returns (int256);\n\n /**\n * @notice Attempts to settle an outstanding price request. Will revert if it isn't settleable.\n * @param requester sender of the initial price request.\n * @param identifier price identifier to identify the existing request.\n * @param timestamp timestamp to identify the existing request.\n * @param ancillaryData ancillary data of the price being requested.\n * @return payout the amount that the \"winner\" (proposer or disputer) receives on settlement. This amount includes\n * the returned bonds as well as additional rewards.\n */\n function settle(\n address requester,\n bytes32 identifier,\n uint256 timestamp,\n bytes memory ancillaryData\n ) external virtual returns (uint256 payout);\n\n /**\n * @notice Gets the current data structure containing all information about a price request.\n * @param requester sender of the initial price request.\n * @param identifier price identifier to identify the existing request.\n * @param timestamp timestamp to identify the existing request.\n * @param ancillaryData ancillary data of the price being requested.\n * @return the Request data structure.\n */\n function getRequest(\n address requester,\n bytes32 identifier,\n uint256 timestamp,\n bytes memory ancillaryData\n ) public view virtual returns (Request memory);\n\n /**\n * @notice Returns the state of a price request.\n * @param requester sender of the initial price request.\n * @param identifier price identifier to identify the existing request.\n * @param timestamp timestamp to identify the existing request.\n * @param ancillaryData ancillary data of the price being requested.\n * @return the State enum value.\n */\n function getState(\n address requester,\n bytes32 identifier,\n uint256 timestamp,\n bytes memory ancillaryData\n ) public view virtual returns (State);\n\n /**\n * @notice Checks if a given request has resolved or been settled (i.e the optimistic oracle has a price).\n * @param requester sender of the initial price request.\n * @param identifier price identifier to identify the existing request.\n * @param timestamp timestamp to identify the existing request.\n * @param ancillaryData ancillary data of the price being requested.\n * @return true if price has resolved or settled, false otherwise.\n */\n function hasPrice(\n address requester,\n bytes32 identifier,\n uint256 timestamp,\n bytes memory ancillaryData\n ) public view virtual returns (bool);\n\n function stampAncillaryData(bytes memory ancillaryData, address requester)\n public\n view\n virtual\n returns (bytes memory);\n}\n" }, + "@uma/core/contracts/oracle/interfaces/SkinnyOptimisticOracleInterface.sol": { + "content": "// SPDX-License-Identifier: AGPL-3.0-only\npragma solidity ^0.8.0;\n\nimport \"@openzeppelin/contracts/token/ERC20/IERC20.sol\";\nimport \"../interfaces/OptimisticOracleInterface.sol\";\n\n/**\n * @title Interface for the gas-cost-reduced version of the OptimisticOracle.\n * @notice Differences from normal OptimisticOracle:\n * - refundOnDispute: flag is removed, by default there are no refunds on disputes.\n * - customizing request parameters: In the OptimisticOracle, parameters like `bond` and `customLiveness` can be reset\n * after a request is already made via `requestPrice`. In the SkinnyOptimisticOracle, these parameters can only be\n * set in `requestPrice`, which has an expanded input set.\n * - settleAndGetPrice: Replaced by `settle`, which can only be called once per settleable request. The resolved price\n * can be fetched via the `Settle` event or the return value of `settle`.\n * - general changes to interface: Functions that interact with existing requests all require the parameters of the\n * request to modify to be passed as input. These parameters must match with the existing request parameters or the\n * function will revert. This change reflects the internal refactor to store hashed request parameters instead of the\n * full request struct.\n * @dev Interface used by financial contracts to interact with the Oracle. Voters will use a different interface.\n */\nabstract contract SkinnyOptimisticOracleInterface {\n // Struct representing a price request. Note that this differs from the OptimisticOracleInterface's Request struct\n // in that refundOnDispute is removed.\n struct Request {\n address proposer; // Address of the proposer.\n address disputer; // Address of the disputer.\n IERC20 currency; // ERC20 token used to pay rewards and fees.\n bool settled; // True if the request is settled.\n int256 proposedPrice; // Price that the proposer submitted.\n int256 resolvedPrice; // Price resolved once the request is settled.\n uint256 expirationTime; // Time at which the request auto-settles without a dispute.\n uint256 reward; // Amount of the currency to pay to the proposer on settlement.\n uint256 finalFee; // Final fee to pay to the Store upon request to the DVM.\n uint256 bond; // Bond that the proposer and disputer must pay on top of the final fee.\n uint256 customLiveness; // Custom liveness value set by the requester.\n }\n\n // This value must be <= the Voting contract's `ancillaryBytesLimit` value otherwise it is possible\n // that a price can be requested to this contract successfully, but cannot be disputed because the DVM refuses\n // to accept a price request made with ancillary data length over a certain size.\n uint256 public constant ancillaryBytesLimit = 8192;\n\n /**\n * @notice Requests a new price.\n * @param identifier price identifier being requested.\n * @param timestamp timestamp of the price being requested.\n * @param ancillaryData ancillary data representing additional args being passed with the price request.\n * @param currency ERC20 token used for payment of rewards and fees. Must be approved for use with the DVM.\n * @param reward reward offered to a successful proposer. Will be pulled from the caller. Note: this can be 0,\n * which could make sense if the contract requests and proposes the value in the same call or\n * provides its own reward system.\n * @param bond custom proposal bond to set for request. If set to 0, defaults to the final fee.\n * @param customLiveness custom proposal liveness to set for request.\n * @return totalBond default bond + final fee that the proposer and disputer will be required to pay.\n */\n function requestPrice(\n bytes32 identifier,\n uint32 timestamp,\n bytes memory ancillaryData,\n IERC20 currency,\n uint256 reward,\n uint256 bond,\n uint256 customLiveness\n ) external virtual returns (uint256 totalBond);\n\n /**\n * @notice Proposes a price value on another address' behalf. Note: this address will receive any rewards that come\n * from this proposal. However, any bonds are pulled from the caller.\n * @param requester sender of the initial price request.\n * @param identifier price identifier to identify the existing request.\n * @param timestamp timestamp to identify the existing request.\n * @param ancillaryData ancillary data of the price being requested.\n * @param request price request parameters whose hash must match the request that the caller wants to\n * propose a price for.\n * @param proposer address to set as the proposer.\n * @param proposedPrice price being proposed.\n * @return totalBond the amount that's pulled from the caller's wallet as a bond. The bond will be returned to\n * the proposer once settled if the proposal is correct.\n */\n function proposePriceFor(\n address requester,\n bytes32 identifier,\n uint32 timestamp,\n bytes memory ancillaryData,\n Request memory request,\n address proposer,\n int256 proposedPrice\n ) public virtual returns (uint256 totalBond);\n\n /**\n * @notice Proposes a price value where caller is the proposer.\n * @param requester sender of the initial price request.\n * @param identifier price identifier to identify the existing request.\n * @param timestamp timestamp to identify the existing request.\n * @param ancillaryData ancillary data of the price being requested.\n * @param request price request parameters whose hash must match the request that the caller wants to\n * propose a price for.\n * @param proposedPrice price being proposed.\n * @return totalBond the amount that's pulled from the caller's wallet as a bond. The bond will be returned to\n * the proposer once settled if the proposal is correct.\n */\n function proposePrice(\n address requester,\n bytes32 identifier,\n uint32 timestamp,\n bytes memory ancillaryData,\n Request memory request,\n int256 proposedPrice\n ) external virtual returns (uint256 totalBond);\n\n /**\n * @notice Combines logic of requestPrice and proposePrice while taking advantage of gas savings from not having to\n * overwrite Request params that a normal requestPrice() => proposePrice() flow would entail. Note: The proposer\n * will receive any rewards that come from this proposal. However, any bonds are pulled from the caller.\n * @dev The caller is the requester, but the proposer can be customized.\n * @param identifier price identifier to identify the existing request.\n * @param timestamp timestamp to identify the existing request.\n * @param ancillaryData ancillary data of the price being requested.\n * @param currency ERC20 token used for payment of rewards and fees. Must be approved for use with the DVM.\n * @param reward reward offered to a successful proposer. Will be pulled from the caller. Note: this can be 0,\n * which could make sense if the contract requests and proposes the value in the same call or\n * provides its own reward system.\n * @param bond custom proposal bond to set for request. If set to 0, defaults to the final fee.\n * @param customLiveness custom proposal liveness to set for request.\n * @param proposer address to set as the proposer.\n * @param proposedPrice price being proposed.\n * @return totalBond the amount that's pulled from the caller's wallet as a bond. The bond will be returned to\n * the proposer once settled if the proposal is correct.\n */\n function requestAndProposePriceFor(\n bytes32 identifier,\n uint32 timestamp,\n bytes memory ancillaryData,\n IERC20 currency,\n uint256 reward,\n uint256 bond,\n uint256 customLiveness,\n address proposer,\n int256 proposedPrice\n ) external virtual returns (uint256 totalBond);\n\n /**\n * @notice Disputes a price request with an active proposal on another address' behalf. Note: this address will\n * receive any rewards that come from this dispute. However, any bonds are pulled from the caller.\n * @param identifier price identifier to identify the existing request.\n * @param timestamp timestamp to identify the existing request.\n * @param ancillaryData ancillary data of the price being requested.\n * @param request price request parameters whose hash must match the request that the caller wants to\n * dispute.\n * @param disputer address to set as the disputer.\n * @param requester sender of the initial price request.\n * @return totalBond the amount that's pulled from the caller's wallet as a bond. The bond will be returned to\n * the disputer once settled if the dispute was valid (the proposal was incorrect).\n */\n function disputePriceFor(\n bytes32 identifier,\n uint32 timestamp,\n bytes memory ancillaryData,\n Request memory request,\n address disputer,\n address requester\n ) public virtual returns (uint256 totalBond);\n\n /**\n * @notice Disputes a price request with an active proposal where caller is the disputer.\n * @param requester sender of the initial price request.\n * @param identifier price identifier to identify the existing request.\n * @param timestamp timestamp to identify the existing request.\n * @param ancillaryData ancillary data of the price being requested.\n * @param request price request parameters whose hash must match the request that the caller wants to\n * dispute.\n * @return totalBond the amount that's pulled from the caller's wallet as a bond. The bond will be returned to\n * the disputer once settled if the dispute was valid (the proposal was incorrect).\n */\n function disputePrice(\n address requester,\n bytes32 identifier,\n uint32 timestamp,\n bytes memory ancillaryData,\n Request memory request\n ) external virtual returns (uint256 totalBond);\n\n /**\n * @notice Attempts to settle an outstanding price request. Will revert if it isn't settleable.\n * @param requester sender of the initial price request.\n * @param identifier price identifier to identify the existing request.\n * @param timestamp timestamp to identify the existing request.\n * @param ancillaryData ancillary data of the price being requested.\n * @param request price request parameters whose hash must match the request that the caller wants to\n * settle.\n * @return payout the amount that the \"winner\" (proposer or disputer) receives on settlement. This amount includes\n * the returned bonds as well as additional rewards.\n * @return resolvedPrice the price that the request settled to.\n */\n function settle(\n address requester,\n bytes32 identifier,\n uint32 timestamp,\n bytes memory ancillaryData,\n Request memory request\n ) external virtual returns (uint256 payout, int256 resolvedPrice);\n\n /**\n * @notice Computes the current state of a price request. See the State enum for more details.\n * @param requester sender of the initial price request.\n * @param identifier price identifier to identify the existing request.\n * @param timestamp timestamp to identify the existing request.\n * @param ancillaryData ancillary data of the price being requested.\n * @param request price request parameters.\n * @return the State.\n */\n function getState(\n address requester,\n bytes32 identifier,\n uint32 timestamp,\n bytes memory ancillaryData,\n Request memory request\n ) external virtual returns (OptimisticOracleInterface.State);\n\n /**\n * @notice Checks if a given request has resolved, expired or been settled (i.e the optimistic oracle has a price).\n * @param requester sender of the initial price request.\n * @param identifier price identifier to identify the existing request.\n * @param timestamp timestamp to identify the existing request.\n * @param ancillaryData ancillary data of the price being requested.\n * @param request price request parameters. The hash of these parameters must match with the request hash that is\n * associated with the price request unique ID {requester, identifier, timestamp, ancillaryData}, or this method\n * will revert.\n * @return boolean indicating true if price exists and false if not.\n */\n function hasPrice(\n address requester,\n bytes32 identifier,\n uint32 timestamp,\n bytes memory ancillaryData,\n Request memory request\n ) public virtual returns (bool);\n\n /**\n * @notice Generates stamped ancillary data in the format that it would be used in the case of a price dispute.\n * @param ancillaryData ancillary data of the price being requested.\n * @param requester sender of the initial price request.\n * @return the stamped ancillary bytes.\n */\n function stampAncillaryData(bytes memory ancillaryData, address requester)\n public\n pure\n virtual\n returns (bytes memory);\n}\n" + }, "@uma/core/contracts/oracle/interfaces/StoreInterface.sol": { "content": "// SPDX-License-Identifier: AGPL-3.0-only\npragma solidity ^0.8.0;\n\nimport \"@openzeppelin/contracts/token/ERC20/IERC20.sol\";\nimport \"../../common/implementation/FixedPoint.sol\";\n\n/**\n * @title Interface that allows financial contracts to pay oracle fees for their use of the system.\n */\ninterface StoreInterface {\n /**\n * @notice Pays Oracle fees in ETH to the store.\n * @dev To be used by contracts whose margin currency is ETH.\n */\n function payOracleFees() external payable;\n\n /**\n * @notice Pays oracle fees in the margin currency, erc20Address, to the store.\n * @dev To be used if the margin currency is an ERC20 token rather than ETH.\n * @param erc20Address address of the ERC20 token used to pay the fee.\n * @param amount number of tokens to transfer. An approval for at least this amount must exist.\n */\n function payOracleFeesErc20(address erc20Address, FixedPoint.Unsigned calldata amount) external;\n\n /**\n * @notice Computes the regular oracle fees that a contract should pay for a period.\n * @param startTime defines the beginning time from which the fee is paid.\n * @param endTime end time until which the fee is paid.\n * @param pfc \"profit from corruption\", or the maximum amount of margin currency that a\n * token sponsor could extract from the contract through corrupting the price feed in their favor.\n * @return regularFee amount owed for the duration from start to end time for the given pfc.\n * @return latePenalty for paying the fee after the deadline.\n */\n function computeRegularFee(\n uint256 startTime,\n uint256 endTime,\n FixedPoint.Unsigned calldata pfc\n ) external view returns (FixedPoint.Unsigned memory regularFee, FixedPoint.Unsigned memory latePenalty);\n\n /**\n * @notice Computes the final oracle fees that a contract should pay at settlement.\n * @param currency token used to pay the final fee.\n * @return finalFee amount due.\n */\n function computeFinalFee(address currency) external view returns (FixedPoint.Unsigned memory);\n}\n" }, @@ -154,6 +148,12 @@ "@openzeppelin/contracts/utils/math/SignedSafeMath.sol": { "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts v4.4.1 (utils/math/SignedSafeMath.sol)\n\npragma solidity ^0.8.0;\n\n/**\n * @dev Wrappers over Solidity's arithmetic operations.\n *\n * NOTE: `SignedSafeMath` is no longer needed starting with Solidity 0.8. The compiler\n * now has built in overflow checking.\n */\nlibrary SignedSafeMath {\n /**\n * @dev Returns the multiplication of two signed integers, reverting on\n * overflow.\n *\n * Counterpart to Solidity's `*` operator.\n *\n * Requirements:\n *\n * - Multiplication cannot overflow.\n */\n function mul(int256 a, int256 b) internal pure returns (int256) {\n return a * b;\n }\n\n /**\n * @dev Returns the integer division of two signed integers. Reverts on\n * division by zero. The result is rounded towards zero.\n *\n * Counterpart to Solidity's `/` operator.\n *\n * Requirements:\n *\n * - The divisor cannot be zero.\n */\n function div(int256 a, int256 b) internal pure returns (int256) {\n return a / b;\n }\n\n /**\n * @dev Returns the subtraction of two signed integers, reverting on\n * overflow.\n *\n * Counterpart to Solidity's `-` operator.\n *\n * Requirements:\n *\n * - Subtraction cannot overflow.\n */\n function sub(int256 a, int256 b) internal pure returns (int256) {\n return a - b;\n }\n\n /**\n * @dev Returns the addition of two signed integers, reverting on\n * overflow.\n *\n * Counterpart to Solidity's `+` operator.\n *\n * Requirements:\n *\n * - Addition cannot overflow.\n */\n function add(int256 a, int256 b) internal pure returns (int256) {\n return a + b;\n }\n}\n" }, + "contracts/LpTokenFactory.sol": { + "content": "// SPDX-License-Identifier: GPL-3.0-only\npragma solidity ^0.8.0;\n\nimport \"./interfaces/LpTokenFactoryInterface.sol\";\n\nimport \"@uma/core/contracts/common/implementation/ExpandedERC20.sol\";\n\n/**\n * @notice Factory to create new LP ERC20 tokens that represent a liquidity provider's position. HubPool is the\n * intended client of this contract.\n */\ncontract LpTokenFactory is LpTokenFactoryInterface {\n /**\n * @notice Deploys new LP token for L1 token. Sets caller as minter and burner of token.\n * @param l1Token L1 token to name in LP token name.\n * @return address of new LP token.\n */\n function createLpToken(address l1Token) public returns (address) {\n ExpandedERC20 lpToken = new ExpandedERC20(\n _append(\"Across V2 \", IERC20Metadata(l1Token).name(), \" LP Token\"), // LP Token Name\n _append(\"Av2-\", IERC20Metadata(l1Token).symbol(), \"-LP\"), // LP Token Symbol\n IERC20Metadata(l1Token).decimals() // LP Token Decimals\n );\n lpToken.addMinter(msg.sender); // Set the caller as the LP Token's minter.\n lpToken.addBurner(msg.sender); // Set the caller as the LP Token's burner.\n lpToken.resetOwner(msg.sender); // Set the caller as the LP Token's owner.\n\n return address(lpToken);\n }\n\n function _append(\n string memory a,\n string memory b,\n string memory c\n ) internal pure returns (string memory) {\n return string(abi.encodePacked(a, b, c));\n }\n}\n" + }, + "contracts/interfaces/LpTokenFactoryInterface.sol": { + "content": "// SPDX-License-Identifier: AGPL-3.0-only\npragma solidity ^0.8.0;\n\ninterface LpTokenFactoryInterface {\n function createLpToken(address l1Token) external returns (address);\n}\n" + }, "@uma/core/contracts/oracle/interfaces/FinderInterface.sol": { "content": "// SPDX-License-Identifier: AGPL-3.0-only\npragma solidity ^0.8.0;\n\n/**\n * @title Provides addresses of the live contracts implementing certain interfaces.\n * @dev Examples are the Oracle or Store interfaces.\n */\ninterface FinderInterface {\n /**\n * @notice Updates the address of the contract that implements `interfaceName`.\n * @param interfaceName bytes32 encoding of the interface name that is either changed or registered.\n * @param implementationAddress address of the deployed contract that implements the interface.\n */\n function changeImplementationAddress(bytes32 interfaceName, address implementationAddress) external;\n\n /**\n * @notice Gets the address of the contract that implements the given `interfaceName`.\n * @param interfaceName queried interface.\n * @return implementationAddress address of the deployed contract that implements the interface.\n */\n function getImplementationAddress(bytes32 interfaceName) external view returns (address);\n}\n" }, @@ -168,12 +168,6 @@ }, "@uma/core/contracts/oracle/implementation/Constants.sol": { "content": "// SPDX-License-Identifier: AGPL-3.0-only\npragma solidity ^0.8.0;\n\n/**\n * @title Stores common interface names used throughout the DVM by registration in the Finder.\n */\nlibrary OracleInterfaces {\n bytes32 public constant Oracle = \"Oracle\";\n bytes32 public constant IdentifierWhitelist = \"IdentifierWhitelist\";\n bytes32 public constant Store = \"Store\";\n bytes32 public constant FinancialContractsAdmin = \"FinancialContractsAdmin\";\n bytes32 public constant Registry = \"Registry\";\n bytes32 public constant CollateralWhitelist = \"CollateralWhitelist\";\n bytes32 public constant OptimisticOracle = \"OptimisticOracle\";\n bytes32 public constant Bridge = \"Bridge\";\n bytes32 public constant GenericHandler = \"GenericHandler\";\n bytes32 public constant SkinnyOptimisticOracle = \"SkinnyOptimisticOracle\";\n bytes32 public constant ChildMessenger = \"ChildMessenger\";\n bytes32 public constant OracleHub = \"OracleHub\";\n bytes32 public constant OracleSpoke = \"OracleSpoke\";\n}\n\n/**\n * @title Commonly re-used values for contracts associated with the OptimisticOracle.\n */\nlibrary OptimisticOracleConstraints {\n // Any price request submitted to the OptimisticOracle must contain ancillary data no larger than this value.\n // This value must be <= the Voting contract's `ancillaryBytesLimit` constant value otherwise it is possible\n // that a price can be requested to the OptimisticOracle successfully, but cannot be resolved by the DVM which\n // refuses to accept a price request made with ancillary data length over a certain size.\n uint256 public constant ancillaryBytesLimit = 8192;\n}\n" - }, - "contracts/interfaces/LpTokenFactoryInterface.sol": { - "content": "// SPDX-License-Identifier: AGPL-3.0-only\npragma solidity ^0.8.0;\n\nimport \"@openzeppelin/contracts/token/ERC20/IERC20.sol\";\n\ninterface LpTokenFactoryInterface {\n function createLpToken(address l1Token) external returns (address);\n}\n" - }, - "contracts/LpTokenFactory.sol": { - "content": "// SPDX-License-Identifier: GPL-3.0-only\npragma solidity ^0.8.0;\n\nimport \"./interfaces/LpTokenFactoryInterface.sol\";\n\nimport \"@uma/core/contracts/common/implementation/ExpandedERC20.sol\";\n\n/**\n * @notice Factory to create new LP ERC20 tokens that represent a liquidity provider's position. HubPool is the\n * intended client of this contract.\n */\ncontract LpTokenFactory is LpTokenFactoryInterface {\n /**\n * @notice Deploys new LP token for L1 token. Sets caller as minter and burner of token.\n * @param l1Token L1 token to name in LP token name.\n * @return address of new LP token.\n */\n function createLpToken(address l1Token) public returns (address) {\n ExpandedERC20 lpToken = new ExpandedERC20(\n _append(\"Across \", IERC20Metadata(l1Token).name(), \" LP Token\"), // LP Token Name\n _append(\"Av2-\", IERC20Metadata(l1Token).symbol(), \"-LP\"), // LP Token Symbol\n IERC20Metadata(l1Token).decimals() // LP Token Decimals\n );\n lpToken.addMember(1, msg.sender); // Set this contract as the LP Token's minter.\n lpToken.addMember(2, msg.sender); // Set this contract as the LP Token's burner.\n\n return address(lpToken);\n }\n\n function _append(\n string memory a,\n string memory b,\n string memory c\n ) internal pure returns (string memory) {\n return string(abi.encodePacked(a, b, c));\n }\n}\n" } }, "settings": { diff --git a/scripts/setupOptimismSpokePool.ts b/scripts/setupOptimismSpokePool.ts index 1ec324bb1..75ee6e787 100644 --- a/scripts/setupOptimismSpokePool.ts +++ b/scripts/setupOptimismSpokePool.ts @@ -1,6 +1,7 @@ // @notice Logs ABI-encoded function data that can be relayed from HubPool to OptimismSpokePool to set it up. -import { getContractFactory, ethers } from "../test/utils"; +import { getContractFactory, ethers, hre } from "../test/utils"; +import * as consts from "../test/constants"; async function main() { const [signer] = await ethers.getSigners(); @@ -12,6 +13,13 @@ async function main() { "0x467194771dAe2967Aef3ECbEDD3Bf9a310C76C65", // L2 DAI Custom Bridge ]); console.log(`(DAI) setTokenBridge: `, setTokenBridgeDai); + + // WETH is also not verified on the optimism explorer so we should approve it to be spent by the spoke pool. + const ERC20 = await getContractFactory("ExpandedERC20", { signer }); + const weth = await ERC20.attach("0x4200000000000000000000000000000000000006"); + const deployedSpokePool = await hre.deployments.get("Optimism_SpokePool"); + const approval = await weth.approve(deployedSpokePool.address, consts.maxUint256); + console.log(`Approved WETH to be spent by SpokePool @ ${deployedSpokePool.address}: `, approval.hash); } main().then( From 48057cfcaab58275633d8f7cd45549eb56593427 Mon Sep 17 00:00:00 2001 From: nicholaspai Date: Fri, 18 Mar 2022 12:16:13 -0400 Subject: [PATCH 03/11] Update Optimism_Adapter.json --- deployments/kovan/Optimism_Adapter.json | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/deployments/kovan/Optimism_Adapter.json b/deployments/kovan/Optimism_Adapter.json index 492ffa1c5..0cbe47af2 100644 --- a/deployments/kovan/Optimism_Adapter.json +++ b/deployments/kovan/Optimism_Adapter.json @@ -1,5 +1,5 @@ { - "address": "0xf0fF8f4811C055D40cd9222670cdD377f243D33E", + "address": "0x7851603f5d6679FC8fFe76bBCb08a88Db34DB4E2", "abi": [ { "inputs": [ @@ -223,19 +223,19 @@ "type": "function" } ], - "transactionHash": "0x3688ab69ffcfd7a8a13c64e8e834bacf9ac9aba9c4e729997799ee3f7fc35848", + "transactionHash": "0xb1c92bc5ce3a92b945234058f87551abacf041da4ebaadebea34f80666ea2d7a", "receipt": { "to": null, "from": "0x9A8f92a830A5cB89a3816e3D267CB7791c16b04D", - "contractAddress": "0xf0fF8f4811C055D40cd9222670cdD377f243D33E", - "transactionIndex": 3, + "contractAddress": "0x7851603f5d6679FC8fFe76bBCb08a88Db34DB4E2", + "transactionIndex": 6, "gasUsed": "912742", "logsBloom": "0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", - "blockHash": "0x2b589c0b99bc413e75eea1cc751cfb8ca5056e83a311ca33fcba82035ec01c3f", - "transactionHash": "0x3688ab69ffcfd7a8a13c64e8e834bacf9ac9aba9c4e729997799ee3f7fc35848", + "blockHash": "0xe43e8b8bada994512b427972d681dcbb48ae27f71fa72ed0a856c2d611296fb8", + "transactionHash": "0xb1c92bc5ce3a92b945234058f87551abacf041da4ebaadebea34f80666ea2d7a", "logs": [], - "blockNumber": 30475930, - "cumulativeGasUsed": "1150006", + "blockNumber": 30477031, + "cumulativeGasUsed": "2571572", "status": 1, "byzantium": true }, From 6a94b2f710879eccfa0170c8c81078802aba8765 Mon Sep 17 00:00:00 2001 From: nicholaspai Date: Mon, 21 Mar 2022 11:43:14 -0400 Subject: [PATCH 04/11] Init commit: arbitrum rinkeby --- deploy/consts.ts | 8 +- .../arbitrum-rinkeby/Arbitrum_SpokePool.json | 533 ++++--- .../arbitrum-rinkeby/Ethereum_SpokePool.json | 1371 ----------------- .../arbitrum-rinkeby/LpTokenFactory.json | 60 - .../a1881af3726e467ac35772874a89bba0.json | 195 --- .../c8b9349311d8b5049b613ac98eb998d0.json | 198 +++ .../cee77d8f3a5225b985a9cf3439956316.json | 195 --- deployments/rinkeby/Arbitrum_Adapter.json | 408 +---- deployments/rinkeby/Ethereum_Adapter.json | 223 +-- deployments/rinkeby/Ethereum_SpokePool.json | 516 ++++--- deployments/rinkeby/HubPool.json | 466 ++++-- deployments/rinkeby/LpTokenFactory.json | 44 +- deployments/rinkeby/Optimism_Adapter.json | 300 ++++ deployments/rinkeby/PolygonTokenBridger.json | 182 +++ deployments/rinkeby/Polygon_Adapter.json | 235 +++ ... => 2fe6c4b637a440a1380be3adbf7d9e12.json} | 28 +- .../a1881af3726e467ac35772874a89bba0.json | 195 --- .../a5765a49a3d11723dab4e70ab648f8a6.json | 195 --- .../c8b9349311d8b5049b613ac98eb998d0.json | 198 +++ .../cee77d8f3a5225b985a9cf3439956316.json | 195 --- 20 files changed, 2223 insertions(+), 3522 deletions(-) delete mode 100644 deployments/arbitrum-rinkeby/Ethereum_SpokePool.json delete mode 100644 deployments/arbitrum-rinkeby/LpTokenFactory.json delete mode 100644 deployments/arbitrum-rinkeby/solcInputs/a1881af3726e467ac35772874a89bba0.json create mode 100644 deployments/arbitrum-rinkeby/solcInputs/c8b9349311d8b5049b613ac98eb998d0.json delete mode 100644 deployments/arbitrum-rinkeby/solcInputs/cee77d8f3a5225b985a9cf3439956316.json create mode 100644 deployments/rinkeby/Optimism_Adapter.json create mode 100644 deployments/rinkeby/PolygonTokenBridger.json create mode 100644 deployments/rinkeby/Polygon_Adapter.json rename deployments/rinkeby/solcInputs/{b448085fba4896ef879334e29280c4da.json => 2fe6c4b637a440a1380be3adbf7d9e12.json} (51%) delete mode 100644 deployments/rinkeby/solcInputs/a1881af3726e467ac35772874a89bba0.json delete mode 100644 deployments/rinkeby/solcInputs/a5765a49a3d11723dab4e70ab648f8a6.json create mode 100644 deployments/rinkeby/solcInputs/c8b9349311d8b5049b613ac98eb998d0.json delete mode 100644 deployments/rinkeby/solcInputs/cee77d8f3a5225b985a9cf3439956316.json diff --git a/deploy/consts.ts b/deploy/consts.ts index db44e012d..2e7639780 100644 --- a/deploy/consts.ts +++ b/deploy/consts.ts @@ -13,8 +13,8 @@ export const L1_ADDRESS_MAP: { [key: number]: { [contractName: string]: string } 4: { weth: "0xc778417E063141139Fce010982780140Aa0cD5Ab", finder: "0xbb6206fb01fAad31e8aaFc3AD303cEA89D8c8157", - l1ArbitrumInbox: "0x578BAde599406A8fE3d24Fd7f7211c0911F5B29e", - l1ERC20Gateway: "0x91169Dbb45e6804743F94609De50D511C437572E", + l1ArbitrumInbox: "0x578BAde599406A8fE3d24Fd7f7211c0911F5B29e", // Should be listed as "DelayedInbox" here: https://developer.offchainlabs.com/docs/useful_addresses + l1ERC20Gateway: "0x70C143928eCfFaf9F5b406f7f4fC28Dc43d68380", // Should be listed as "L1 ERC20 Gateway Router" here: https://developer.offchainlabs.com/docs/useful_addresses optimismCrossDomainMessenger: "0x25ace71c97B33Cc4729CF772ae268934F7ab5fA1", // dummy: Optimism's testnet is kovan optimismStandardBridge: "0x99C9fc46f92E8a1c0deC1b1747d010903E884bE1", // dummy: Optimism's testnet is kovan polygonRootChainManager: "0xBbD7cBFA79faee899Eaf900F13C9065bF03B1A74", // dummy: Polygon's testnet is goerli @@ -24,7 +24,7 @@ export const L1_ADDRESS_MAP: { [key: number]: { [contractName: string]: string } optimismCrossDomainMessenger: "0x25ace71c97B33Cc4729CF772ae268934F7ab5fA1", // dummy: Optimism's testnet is kovan optimismStandardBridge: "0x99C9fc46f92E8a1c0deC1b1747d010903E884bE1", // dummy: Optimism's testnet is kovan l1ArbitrumInbox: "0x578BAde599406A8fE3d24Fd7f7211c0911F5B29e", // dummy: Arbitrum's testnet is rinkeby - l1ERC20Gateway: "0x91169Dbb45e6804743F94609De50D511C437572E", // dummy: Arbitrum's testnet is rinkeby + l1ERC20Gateway: "0x70C143928eCfFaf9F5b406f7f4fC28Dc43d68380", // dummy: Arbitrum's testnet is rinkeby finder: "0xDC6b80D38004F495861E081e249213836a2F3217", polygonRootChainManager: "0xBbD7cBFA79faee899Eaf900F13C9065bF03B1A74", polygonFxRoot: "0x3d1d3E34f7fB6D26245E6640E1c50710eFFf15bA", @@ -32,7 +32,7 @@ export const L1_ADDRESS_MAP: { [key: number]: { [contractName: string]: string } }, 42: { l1ArbitrumInbox: "0x578BAde599406A8fE3d24Fd7f7211c0911F5B29e", // dummy: Arbitrum's testnet is rinkeby - l1ERC20Gateway: "0x91169Dbb45e6804743F94609De50D511C437572E", // dummy: Arbitrum's testnet is rinkeby + l1ERC20Gateway: "0x70C143928eCfFaf9F5b406f7f4fC28Dc43d68380", // dummy: Arbitrum's testnet is rinkeby optimismCrossDomainMessenger: "0x4361d0F75A0186C05f971c566dC6bEa5957483fD", weth: "0xd0A1E359811322d97991E03f863a0C30C2cF029C", optimismStandardBridge: "0x22F24361D548e5FaAfb36d1437839f080363982B", diff --git a/deployments/arbitrum-rinkeby/Arbitrum_SpokePool.json b/deployments/arbitrum-rinkeby/Arbitrum_SpokePool.json index 741ebf058..695cae394 100644 --- a/deployments/arbitrum-rinkeby/Arbitrum_SpokePool.json +++ b/deployments/arbitrum-rinkeby/Arbitrum_SpokePool.json @@ -1,5 +1,5 @@ { - "address": "0x68306388c266dce735245A0A6DAe6Dd3b727A640", + "address": "0x3BED21dAe767e4Df894B31b14aD32369cE4bad8b", "abi": [ { "inputs": [ @@ -57,6 +57,19 @@ "name": "ArbitrumTokensBridged", "type": "event" }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "uint256", + "name": "rootBundleId", + "type": "uint256" + } + ], + "name": "EmergencyDeleteRootBundle", + "type": "event" + }, { "anonymous": false, "inputs": [ @@ -92,7 +105,7 @@ "type": "uint256" }, { - "indexed": false, + "indexed": true, "internalType": "uint256", "name": "chainId", "type": "uint256" @@ -128,7 +141,7 @@ "type": "address[]" }, { - "indexed": true, + "indexed": false, "internalType": "address", "name": "caller", "type": "address" @@ -149,7 +162,7 @@ { "indexed": false, "internalType": "uint256", - "name": "totalRelayAmount", + "name": "amount", "type": "uint256" }, { @@ -167,92 +180,19 @@ { "indexed": false, "internalType": "uint256", - "name": "originChainId", - "type": "uint256" - }, - { - "indexed": false, - "internalType": "uint64", - "name": "relayerFeePct", - "type": "uint64" - }, - { - "indexed": false, - "internalType": "uint64", - "name": "realizedLpFeePct", - "type": "uint64" - }, - { - "indexed": false, - "internalType": "uint32", - "name": "depositId", - "type": "uint32" - }, - { - "indexed": false, - "internalType": "address", - "name": "destinationToken", - "type": "address" - }, - { - "indexed": true, - "internalType": "address", - "name": "caller", - "type": "address" - }, - { - "indexed": false, - "internalType": "address", - "name": "depositor", - "type": "address" - }, - { - "indexed": false, - "internalType": "address", - "name": "recipient", - "type": "address" - } - ], - "name": "ExecutedSlowRelayFulfillmentRoot", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": true, - "internalType": "bytes32", - "name": "relayHash", - "type": "bytes32" - }, - { - "indexed": false, - "internalType": "uint256", - "name": "totalRelayAmount", - "type": "uint256" - }, - { - "indexed": false, - "internalType": "uint256", - "name": "totalFilledAmount", + "name": "repaymentChainId", "type": "uint256" }, { "indexed": false, "internalType": "uint256", - "name": "fillAmount", - "type": "uint256" - }, - { - "indexed": true, - "internalType": "uint256", - "name": "repaymentChain", + "name": "originChainId", "type": "uint256" }, { "indexed": false, "internalType": "uint256", - "name": "originChainId", + "name": "destinationChainId", "type": "uint256" }, { @@ -286,7 +226,7 @@ "type": "address" }, { - "indexed": false, + "indexed": true, "internalType": "address", "name": "depositor", "type": "address" @@ -296,6 +236,12 @@ "internalType": "address", "name": "recipient", "type": "address" + }, + { + "indexed": false, + "internalType": "bool", + "name": "isSlowRelay", + "type": "bool" } ], "name": "FilledRelay", @@ -310,6 +256,12 @@ "name": "amount", "type": "uint256" }, + { + "indexed": false, + "internalType": "uint256", + "name": "originChainId", + "type": "uint256" + }, { "indexed": false, "internalType": "uint256", @@ -374,13 +326,44 @@ { "indexed": false, "internalType": "bytes32", - "name": "slowRelayFulfillmentRoot", + "name": "slowRelayRoot", "type": "bytes32" } ], "name": "RelayedRootBundle", "type": "event" }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "uint64", + "name": "newRelayerFeePct", + "type": "uint64" + }, + { + "indexed": true, + "internalType": "uint32", + "name": "depositId", + "type": "uint32" + }, + { + "indexed": true, + "internalType": "address", + "name": "depositor", + "type": "address" + }, + { + "indexed": false, + "internalType": "bytes", + "name": "depositorSignature", + "type": "bytes" + } + ], + "name": "RequestedSpeedUpDeposit", + "type": "event" + }, { "anonymous": false, "inputs": [ @@ -515,19 +498,6 @@ "stateMutability": "view", "type": "function" }, - { - "inputs": [], - "name": "deploymentTime", - "outputs": [ - { - "internalType": "uint32", - "name": "", - "type": "uint32" - } - ], - "stateMutability": "view", - "type": "function" - }, { "inputs": [ { @@ -579,6 +549,19 @@ "stateMutability": "view", "type": "function" }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "rootBundleId", + "type": "uint256" + } + ], + "name": "emergencyDeleteRootBundle", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, { "inputs": [ { @@ -677,7 +660,7 @@ }, { "internalType": "uint256", - "name": "totalRelayAmount", + "name": "amount", "type": "uint256" }, { @@ -711,7 +694,7 @@ "type": "bytes32[]" } ], - "name": "executeSlowRelayFulfillmentRoot", + "name": "executeSlowRelayRoot", "outputs": [], "stateMutability": "nonpayable", "type": "function" @@ -735,7 +718,7 @@ }, { "internalType": "uint256", - "name": "totalRelayAmount", + "name": "amount", "type": "uint256" }, { @@ -745,7 +728,7 @@ }, { "internalType": "uint256", - "name": "repaymentChain", + "name": "repaymentChainId", "type": "uint256" }, { @@ -793,7 +776,7 @@ }, { "internalType": "uint256", - "name": "totalRelayAmount", + "name": "amount", "type": "uint256" }, { @@ -803,7 +786,7 @@ }, { "internalType": "uint256", - "name": "repaymentChain", + "name": "repaymentChainId", "type": "uint256" }, { @@ -941,7 +924,7 @@ }, { "internalType": "bytes32", - "name": "slowRelayFulfillmentRoot", + "name": "slowRelayRoot", "type": "bytes32" } ], @@ -962,7 +945,7 @@ "outputs": [ { "internalType": "bytes32", - "name": "slowRelayFulfillmentRoot", + "name": "slowRelayRoot", "type": "bytes32" }, { @@ -1004,7 +987,7 @@ "inputs": [ { "internalType": "uint32", - "name": "buffer", + "name": "newDepositQuoteTimeBuffer", "type": "uint32" } ], @@ -1027,7 +1010,7 @@ }, { "internalType": "bool", - "name": "enable", + "name": "enabled", "type": "bool" } ], @@ -1062,6 +1045,34 @@ "stateMutability": "nonpayable", "type": "function" }, + { + "inputs": [ + { + "internalType": "address", + "name": "depositor", + "type": "address" + }, + { + "internalType": "uint64", + "name": "newRelayerFeePct", + "type": "uint64" + }, + { + "internalType": "uint32", + "name": "depositId", + "type": "uint32" + }, + { + "internalType": "bytes", + "name": "depositorSignature", + "type": "bytes" + } + ], + "name": "speedUpDeposit", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, { "inputs": [], "name": "timerAddress", @@ -1130,91 +1141,213 @@ "type": "receive" } ], - "transactionHash": "0x24385f8e0c2473bb2d842f05956fa2f1e9b51f25b7fd392e11374a8aff2f3ed9", + "transactionHash": "0x38c1877557166c023755d543599eb1aef624931f6bb2599597d1259e63676d27", "receipt": { "to": null, "from": "0x9A8f92a830A5cB89a3816e3D267CB7791c16b04D", - "contractAddress": "0x68306388c266dce735245A0A6DAe6Dd3b727A640", + "contractAddress": "0x3BED21dAe767e4Df894B31b14aD32369cE4bad8b", "transactionIndex": 0, - "gasUsed": "32421400", - "logsBloom": "0x00000000000000000000000000000000000400000000010000000000000000000000000000000000000000000800000000200000000000000000000000000000000000000000000000000000000204000000000000000000000000000000000000020000000000000000000000000000000800000000000000000000000040000000000000000000000000200000000040000400000000000000000020000000000000000000000000000000000000000000040000000000000000000000000000000100000000000000200000000080000080000000000000000000000000000010008000000000000000000000000000000400000000000000000000000000", - "blockHash": "0x00fd52ddc032b69f6c6389efba7bd7bfa377192bba6caf033fdd6d2fb570ed0c", - "transactionHash": "0x24385f8e0c2473bb2d842f05956fa2f1e9b51f25b7fd392e11374a8aff2f3ed9", + "gasUsed": "59221041", + "logsBloom": "0x00000000000000000000000000000000010000000000000000000000000000000000000000000000000000000800000000200000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000020000000000000020000000000000000800000000000000000000000040000000000000000000000000000000000040000400000000000000200000000000000000000000000000000000000000000000040000000000000000000000000000000000000000000000000000008000000080000000000000000000000000000010008000080000000000000000000000000400000000000000000000000000", + "blockHash": "0x97e69e57091b6fbed542ffabcd6f6c9694688d30538ae05422991a34b64031cc", + "transactionHash": "0x38c1877557166c023755d543599eb1aef624931f6bb2599597d1259e63676d27", "logs": [ { "transactionIndex": 0, - "blockNumber": 9828565, - "transactionHash": "0x24385f8e0c2473bb2d842f05956fa2f1e9b51f25b7fd392e11374a8aff2f3ed9", - "address": "0x68306388c266dce735245A0A6DAe6Dd3b727A640", + "blockNumber": 10523275, + "transactionHash": "0x38c1877557166c023755d543599eb1aef624931f6bb2599597d1259e63676d27", + "address": "0x3BED21dAe767e4Df894B31b14aD32369cE4bad8b", "topics": [ "0xa9e8c42c9e7fca7f62755189a16b2f5314d43d8fb24e91ba54e6d65f9314e849", - "0x000000000000000000000000f116afc252687b487acedcf3038790252d43fb83" + "0x000000000000000000000000a1b6da4aae90fa16f3a3338c8d1dc70b4926fca7" ], "data": "0x", "logIndex": 0, - "blockHash": "0x00fd52ddc032b69f6c6389efba7bd7bfa377192bba6caf033fdd6d2fb570ed0c" + "blockHash": "0x97e69e57091b6fbed542ffabcd6f6c9694688d30538ae05422991a34b64031cc" }, { "transactionIndex": 0, - "blockNumber": 9828565, - "transactionHash": "0x24385f8e0c2473bb2d842f05956fa2f1e9b51f25b7fd392e11374a8aff2f3ed9", - "address": "0x68306388c266dce735245A0A6DAe6Dd3b727A640", + "blockNumber": 10523275, + "transactionHash": "0x38c1877557166c023755d543599eb1aef624931f6bb2599597d1259e63676d27", + "address": "0x3BED21dAe767e4Df894B31b14aD32369cE4bad8b", "topics": [ "0x1f17a88f67b0f49060a34bec1a4723a563620e6aa265eb640b5046dcee0759a0", - "0x000000000000000000000000fa6326fdf1f149b63d116576fcfbc7e15cc0355a" + "0x000000000000000000000000a1b6da4aae90fa16f3a3338c8d1dc70b4926fca7" ], "data": "0x", "logIndex": 1, - "blockHash": "0x00fd52ddc032b69f6c6389efba7bd7bfa377192bba6caf033fdd6d2fb570ed0c" + "blockHash": "0x97e69e57091b6fbed542ffabcd6f6c9694688d30538ae05422991a34b64031cc" }, { "transactionIndex": 0, - "blockNumber": 9828565, - "transactionHash": "0x24385f8e0c2473bb2d842f05956fa2f1e9b51f25b7fd392e11374a8aff2f3ed9", - "address": "0x68306388c266dce735245A0A6DAe6Dd3b727A640", + "blockNumber": 10523275, + "transactionHash": "0x38c1877557166c023755d543599eb1aef624931f6bb2599597d1259e63676d27", + "address": "0x3BED21dAe767e4Df894B31b14aD32369cE4bad8b", "topics": [ "0xdc4a5f4c066ad14c1306e624550b42395e08f992a76b416cc7b1ad11503d376c", "0x0000000000000000000000009413ad42910c1ea60c737db5f58d1c504498a3cd" ], "data": "0x", "logIndex": 2, - "blockHash": "0x00fd52ddc032b69f6c6389efba7bd7bfa377192bba6caf033fdd6d2fb570ed0c" + "blockHash": "0x97e69e57091b6fbed542ffabcd6f6c9694688d30538ae05422991a34b64031cc" } ], - "blockNumber": 9828565, - "cumulativeGasUsed": "458759", + "blockNumber": 10523275, + "cumulativeGasUsed": "28291100", "status": 1, "byzantium": true }, "args": [ "0x9413AD42910c1eA60c737dB5f58d1C504498a3cD", - "0xf116afc252687B487AceDcf3038790252D43fB83", - "0xFA6326FdF1f149B63d116576fCfbc7e15cc0355A", + "0xa1b6DA4AaE90fA16F3A3338c8d1Dc70B4926FCa7", + "0xa1b6DA4AaE90fA16F3A3338c8d1Dc70B4926FCa7", "0xB47e6A5f8b33b3F17603C83a0535A9dcD7E32681", "0x0000000000000000000000000000000000000000" ], "numDeployments": 1, - "solcInputHash": "cee77d8f3a5225b985a9cf3439956316", - "metadata": "{\"compiler\":{\"version\":\"0.8.11+commit.d7f03943\"},\"language\":\"Solidity\",\"output\":{\"abi\":[{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_l2GatewayRouter\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"_crossDomainAdmin\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"_hubPool\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"_wethAddress\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"timerAddress\",\"type\":\"address\"}],\"stateMutability\":\"nonpayable\",\"type\":\"constructor\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"l1Token\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"address\",\"name\":\"target\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"numberOfTokensBridged\",\"type\":\"uint256\"}],\"name\":\"ArbitrumTokensBridged\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"originToken\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"uint256\",\"name\":\"destinationChainId\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"bool\",\"name\":\"enabled\",\"type\":\"bool\"}],\"name\":\"EnabledDepositRoute\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"amountToReturn\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"chainId\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"uint256[]\",\"name\":\"refundAmounts\",\"type\":\"uint256[]\"},{\"indexed\":true,\"internalType\":\"uint32\",\"name\":\"rootBundleId\",\"type\":\"uint32\"},{\"indexed\":true,\"internalType\":\"uint32\",\"name\":\"leafId\",\"type\":\"uint32\"},{\"indexed\":false,\"internalType\":\"address\",\"name\":\"l2TokenAddress\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"address[]\",\"name\":\"refundAddresses\",\"type\":\"address[]\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"caller\",\"type\":\"address\"}],\"name\":\"ExecutedRelayerRefundRoot\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"bytes32\",\"name\":\"relayHash\",\"type\":\"bytes32\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"totalRelayAmount\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"totalFilledAmount\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"fillAmount\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"originChainId\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"uint64\",\"name\":\"relayerFeePct\",\"type\":\"uint64\"},{\"indexed\":false,\"internalType\":\"uint64\",\"name\":\"realizedLpFeePct\",\"type\":\"uint64\"},{\"indexed\":false,\"internalType\":\"uint32\",\"name\":\"depositId\",\"type\":\"uint32\"},{\"indexed\":false,\"internalType\":\"address\",\"name\":\"destinationToken\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"caller\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"address\",\"name\":\"depositor\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"address\",\"name\":\"recipient\",\"type\":\"address\"}],\"name\":\"ExecutedSlowRelayFulfillmentRoot\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"bytes32\",\"name\":\"relayHash\",\"type\":\"bytes32\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"totalRelayAmount\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"totalFilledAmount\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"fillAmount\",\"type\":\"uint256\"},{\"indexed\":true,\"internalType\":\"uint256\",\"name\":\"repaymentChain\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"originChainId\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"uint64\",\"name\":\"relayerFeePct\",\"type\":\"uint64\"},{\"indexed\":false,\"internalType\":\"uint64\",\"name\":\"realizedLpFeePct\",\"type\":\"uint64\"},{\"indexed\":false,\"internalType\":\"uint32\",\"name\":\"depositId\",\"type\":\"uint32\"},{\"indexed\":false,\"internalType\":\"address\",\"name\":\"destinationToken\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"relayer\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"address\",\"name\":\"depositor\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"address\",\"name\":\"recipient\",\"type\":\"address\"}],\"name\":\"FilledRelay\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"destinationChainId\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"uint64\",\"name\":\"relayerFeePct\",\"type\":\"uint64\"},{\"indexed\":true,\"internalType\":\"uint32\",\"name\":\"depositId\",\"type\":\"uint32\"},{\"indexed\":false,\"internalType\":\"uint32\",\"name\":\"quoteTimestamp\",\"type\":\"uint32\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"originToken\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"address\",\"name\":\"recipient\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"depositor\",\"type\":\"address\"}],\"name\":\"FundsDeposited\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"uint32\",\"name\":\"rootBundleId\",\"type\":\"uint32\"},{\"indexed\":false,\"internalType\":\"bytes32\",\"name\":\"relayerRefundRoot\",\"type\":\"bytes32\"},{\"indexed\":false,\"internalType\":\"bytes32\",\"name\":\"slowRelayFulfillmentRoot\",\"type\":\"bytes32\"}],\"name\":\"RelayedRootBundle\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"uint32\",\"name\":\"newBuffer\",\"type\":\"uint32\"}],\"name\":\"SetDepositQuoteTimeBuffer\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"newHubPool\",\"type\":\"address\"}],\"name\":\"SetHubPool\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"newL2GatewayRouter\",\"type\":\"address\"}],\"name\":\"SetL2GatewayRouter\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"newAdmin\",\"type\":\"address\"}],\"name\":\"SetXDomainAdmin\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"amountToReturn\",\"type\":\"uint256\"},{\"indexed\":true,\"internalType\":\"uint256\",\"name\":\"chainId\",\"type\":\"uint256\"},{\"indexed\":true,\"internalType\":\"uint32\",\"name\":\"leafId\",\"type\":\"uint32\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"l2TokenAddress\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"address\",\"name\":\"caller\",\"type\":\"address\"}],\"name\":\"TokensBridged\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"l2Token\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"l1Token\",\"type\":\"address\"}],\"name\":\"WhitelistedTokens\",\"type\":\"event\"},{\"inputs\":[],\"name\":\"chainId\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"crossDomainAdmin\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"deploymentTime\",\"outputs\":[{\"internalType\":\"uint32\",\"name\":\"\",\"type\":\"uint32\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"recipient\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"originToken\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"destinationChainId\",\"type\":\"uint256\"},{\"internalType\":\"uint64\",\"name\":\"relayerFeePct\",\"type\":\"uint64\"},{\"internalType\":\"uint32\",\"name\":\"quoteTimestamp\",\"type\":\"uint32\"}],\"name\":\"deposit\",\"outputs\":[],\"stateMutability\":\"payable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"depositQuoteTimeBuffer\",\"outputs\":[{\"internalType\":\"uint32\",\"name\":\"\",\"type\":\"uint32\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"name\":\"enabledDepositRoutes\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint32\",\"name\":\"rootBundleId\",\"type\":\"uint32\"},{\"components\":[{\"internalType\":\"uint256\",\"name\":\"amountToReturn\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"chainId\",\"type\":\"uint256\"},{\"internalType\":\"uint256[]\",\"name\":\"refundAmounts\",\"type\":\"uint256[]\"},{\"internalType\":\"uint32\",\"name\":\"leafId\",\"type\":\"uint32\"},{\"internalType\":\"address\",\"name\":\"l2TokenAddress\",\"type\":\"address\"},{\"internalType\":\"address[]\",\"name\":\"refundAddresses\",\"type\":\"address[]\"}],\"internalType\":\"struct SpokePoolInterface.RelayerRefundLeaf\",\"name\":\"relayerRefundLeaf\",\"type\":\"tuple\"},{\"internalType\":\"bytes32[]\",\"name\":\"proof\",\"type\":\"bytes32[]\"}],\"name\":\"executeRelayerRefundRoot\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"depositor\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"recipient\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"destinationToken\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"totalRelayAmount\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"originChainId\",\"type\":\"uint256\"},{\"internalType\":\"uint64\",\"name\":\"realizedLpFeePct\",\"type\":\"uint64\"},{\"internalType\":\"uint64\",\"name\":\"relayerFeePct\",\"type\":\"uint64\"},{\"internalType\":\"uint32\",\"name\":\"depositId\",\"type\":\"uint32\"},{\"internalType\":\"uint32\",\"name\":\"rootBundleId\",\"type\":\"uint32\"},{\"internalType\":\"bytes32[]\",\"name\":\"proof\",\"type\":\"bytes32[]\"}],\"name\":\"executeSlowRelayFulfillmentRoot\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"depositor\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"recipient\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"destinationToken\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"totalRelayAmount\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"maxTokensToSend\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"repaymentChain\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"originChainId\",\"type\":\"uint256\"},{\"internalType\":\"uint64\",\"name\":\"realizedLpFeePct\",\"type\":\"uint64\"},{\"internalType\":\"uint64\",\"name\":\"relayerFeePct\",\"type\":\"uint64\"},{\"internalType\":\"uint32\",\"name\":\"depositId\",\"type\":\"uint32\"}],\"name\":\"fillRelay\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"depositor\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"recipient\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"destinationToken\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"totalRelayAmount\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"maxTokensToSend\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"repaymentChain\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"originChainId\",\"type\":\"uint256\"},{\"internalType\":\"uint64\",\"name\":\"realizedLpFeePct\",\"type\":\"uint64\"},{\"internalType\":\"uint64\",\"name\":\"relayerFeePct\",\"type\":\"uint64\"},{\"internalType\":\"uint64\",\"name\":\"newRelayerFeePct\",\"type\":\"uint64\"},{\"internalType\":\"uint32\",\"name\":\"depositId\",\"type\":\"uint32\"},{\"internalType\":\"bytes\",\"name\":\"depositorSignature\",\"type\":\"bytes\"}],\"name\":\"fillRelayWithUpdatedFee\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"getCurrentTime\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"hubPool\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"l2GatewayRouter\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes[]\",\"name\":\"data\",\"type\":\"bytes[]\"}],\"name\":\"multicall\",\"outputs\":[{\"internalType\":\"bytes[]\",\"name\":\"results\",\"type\":\"bytes[]\"}],\"stateMutability\":\"payable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"numberOfDeposits\",\"outputs\":[{\"internalType\":\"uint32\",\"name\":\"\",\"type\":\"uint32\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"\",\"type\":\"bytes32\"}],\"name\":\"relayFills\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"relayerRefundRoot\",\"type\":\"bytes32\"},{\"internalType\":\"bytes32\",\"name\":\"slowRelayFulfillmentRoot\",\"type\":\"bytes32\"}],\"name\":\"relayRootBundle\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"name\":\"rootBundles\",\"outputs\":[{\"internalType\":\"bytes32\",\"name\":\"slowRelayFulfillmentRoot\",\"type\":\"bytes32\"},{\"internalType\":\"bytes32\",\"name\":\"relayerRefundRoot\",\"type\":\"bytes32\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"newCrossDomainAdmin\",\"type\":\"address\"}],\"name\":\"setCrossDomainAdmin\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"time\",\"type\":\"uint256\"}],\"name\":\"setCurrentTime\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint32\",\"name\":\"buffer\",\"type\":\"uint32\"}],\"name\":\"setDepositQuoteTimeBuffer\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"originToken\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"destinationChainId\",\"type\":\"uint256\"},{\"internalType\":\"bool\",\"name\":\"enable\",\"type\":\"bool\"}],\"name\":\"setEnableRoute\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"newHubPool\",\"type\":\"address\"}],\"name\":\"setHubPool\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"newL2GatewayRouter\",\"type\":\"address\"}],\"name\":\"setL2GatewayRouter\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"timerAddress\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"weth\",\"outputs\":[{\"internalType\":\"contract WETH9\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"l2Token\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"l1Token\",\"type\":\"address\"}],\"name\":\"whitelistToken\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"name\":\"whitelistedTokens\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"stateMutability\":\"payable\",\"type\":\"receive\"}],\"devdoc\":{\"details\":\"Uses AVM cross-domain-enabled logic for access control.\",\"kind\":\"dev\",\"methods\":{\"deposit(address,address,uint256,uint256,uint64,uint32)\":{\"details\":\"The caller must first approve this contract to spend `amount` of `originToken`.\"},\"getCurrentTime()\":{\"returns\":{\"_0\":\"uint for the current Testable timestamp.\"}},\"setCurrentTime(uint256)\":{\"details\":\"Will revert if not running in test mode.\",\"params\":{\"time\":\"timestamp to set current Testable time to.\"}}},\"version\":1},\"userdoc\":{\"kind\":\"user\",\"methods\":{\"deposit(address,address,uint256,uint256,uint64,uint32)\":{\"notice\":\"Called by user to bridge funds from origin to destination chain.\"},\"getCurrentTime()\":{\"notice\":\"Gets the current time. Will return the last time set in `setCurrentTime` if running in test mode. Otherwise, it will return the block timestamp.\"},\"setCurrentTime(uint256)\":{\"notice\":\"Sets the current time.\"}},\"notice\":\"AVM specific SpokePool.\",\"version\":1}},\"settings\":{\"compilationTarget\":{\"contracts/Arbitrum_SpokePool.sol\":\"Arbitrum_SpokePool\"},\"evmVersion\":\"london\",\"libraries\":{},\"metadata\":{\"bytecodeHash\":\"ipfs\",\"useLiteralContent\":true},\"optimizer\":{\"enabled\":true,\"runs\":1000000},\"remappings\":[]},\"sources\":{\"@openzeppelin/contracts/interfaces/IERC1271.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts v4.4.1 (interfaces/IERC1271.sol)\\n\\npragma solidity ^0.8.0;\\n\\n/**\\n * @dev Interface of the ERC1271 standard signature validation method for\\n * contracts as defined in https://eips.ethereum.org/EIPS/eip-1271[ERC-1271].\\n *\\n * _Available since v4.1._\\n */\\ninterface IERC1271 {\\n /**\\n * @dev Should return whether the signature provided is valid for the provided data\\n * @param hash Hash of the data to be signed\\n * @param signature Signature byte array associated with _data\\n */\\n function isValidSignature(bytes32 hash, bytes memory signature) external view returns (bytes4 magicValue);\\n}\\n\",\"keccak256\":\"0x0705a4b1b86d7b0bd8432118f226ba139c44b9dcaba0a6eafba2dd7d0639c544\",\"license\":\"MIT\"},\"@openzeppelin/contracts/token/ERC20/IERC20.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts v4.4.1 (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 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 `recipient`.\\n *\\n * Returns a boolean value indicating whether the operation succeeded.\\n *\\n * Emits a {Transfer} event.\\n */\\n function transfer(address recipient, 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 `sender` to `recipient` 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(\\n address sender,\\n address recipient,\\n uint256 amount\\n ) external returns (bool);\\n\\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\",\"keccak256\":\"0x61437cb513a887a1bbad006e7b1c8b414478427d33de47c5600af3c748f108da\",\"license\":\"MIT\"},\"@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts v4.4.1 (token/ERC20/utils/SafeERC20.sol)\\n\\npragma solidity ^0.8.0;\\n\\nimport \\\"../IERC20.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 function safeTransfer(\\n IERC20 token,\\n address to,\\n uint256 value\\n ) internal {\\n _callOptionalReturn(token, abi.encodeWithSelector(token.transfer.selector, to, value));\\n }\\n\\n function safeTransferFrom(\\n IERC20 token,\\n address from,\\n address to,\\n uint256 value\\n ) 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(\\n IERC20 token,\\n address spender,\\n uint256 value\\n ) 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 function safeIncreaseAllowance(\\n IERC20 token,\\n address spender,\\n uint256 value\\n ) internal {\\n uint256 newAllowance = token.allowance(address(this), spender) + value;\\n _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, newAllowance));\\n }\\n\\n function safeDecreaseAllowance(\\n IERC20 token,\\n address spender,\\n uint256 value\\n ) internal {\\n unchecked {\\n uint256 oldAllowance = token.allowance(address(this), spender);\\n require(oldAllowance >= value, \\\"SafeERC20: decreased allowance below zero\\\");\\n uint256 newAllowance = oldAllowance - value;\\n _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, newAllowance));\\n }\\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 if (returndata.length > 0) {\\n // Return data is optional\\n require(abi.decode(returndata, (bool)), \\\"SafeERC20: ERC20 operation did not succeed\\\");\\n }\\n }\\n}\\n\",\"keccak256\":\"0xc3d946432c0ddbb1f846a0d3985be71299df331b91d06732152117f62f0be2b5\",\"license\":\"MIT\"},\"@openzeppelin/contracts/utils/Address.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts v4.4.1 (utils/Address.sol)\\n\\npragma solidity ^0.8.0;\\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 */\\n function isContract(address account) internal view returns (bool) {\\n // This method relies on extcodesize, which returns 0 for contracts in\\n // construction, since the code is only stored at the end of the\\n // constructor execution.\\n\\n uint256 size;\\n assembly {\\n size := extcodesize(account)\\n }\\n return size > 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://diligence.consensys.net/posts/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.5.11/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 functionCall(target, data, \\\"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(\\n address target,\\n bytes memory data,\\n uint256 value\\n ) 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 require(isContract(target), \\\"Address: call to non-contract\\\");\\n\\n (bool success, bytes memory returndata) = target.call{value: value}(data);\\n return verifyCallResult(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 require(isContract(target), \\\"Address: static call to non-contract\\\");\\n\\n (bool success, bytes memory returndata) = target.staticcall(data);\\n return verifyCallResult(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 require(isContract(target), \\\"Address: delegate call to non-contract\\\");\\n\\n (bool success, bytes memory returndata) = target.delegatecall(data);\\n return verifyCallResult(success, returndata, errorMessage);\\n }\\n\\n /**\\n * @dev Tool to verifies that a low level call was successful, and revert if it wasn't, either by bubbling the\\n * revert reason 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 // 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\\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}\\n\",\"keccak256\":\"0x51b758a8815ecc9596c66c37d56b1d33883a444631a3f916b9fe65cb863ef7c4\",\"license\":\"MIT\"},\"@openzeppelin/contracts/utils/Strings.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts v4.4.1 (utils/Strings.sol)\\n\\npragma solidity ^0.8.0;\\n\\n/**\\n * @dev String operations.\\n */\\nlibrary Strings {\\n bytes16 private constant _HEX_SYMBOLS = \\\"0123456789abcdef\\\";\\n\\n /**\\n * @dev Converts a `uint256` to its ASCII `string` decimal representation.\\n */\\n function toString(uint256 value) internal pure returns (string memory) {\\n // Inspired by OraclizeAPI's implementation - MIT licence\\n // https://github.com/oraclize/ethereum-api/blob/b42146b063c7d6ee1358846c198246239e9360e8/oraclizeAPI_0.4.25.sol\\n\\n if (value == 0) {\\n return \\\"0\\\";\\n }\\n uint256 temp = value;\\n uint256 digits;\\n while (temp != 0) {\\n digits++;\\n temp /= 10;\\n }\\n bytes memory buffer = new bytes(digits);\\n while (value != 0) {\\n digits -= 1;\\n buffer[digits] = bytes1(uint8(48 + uint256(value % 10)));\\n value /= 10;\\n }\\n return string(buffer);\\n }\\n\\n /**\\n * @dev Converts a `uint256` to its ASCII `string` hexadecimal representation.\\n */\\n function toHexString(uint256 value) internal pure returns (string memory) {\\n if (value == 0) {\\n return \\\"0x00\\\";\\n }\\n uint256 temp = value;\\n uint256 length = 0;\\n while (temp != 0) {\\n length++;\\n temp >>= 8;\\n }\\n return toHexString(value, length);\\n }\\n\\n /**\\n * @dev Converts a `uint256` to its ASCII `string` hexadecimal representation with fixed length.\\n */\\n function toHexString(uint256 value, uint256 length) internal pure returns (string memory) {\\n bytes memory buffer = new bytes(2 * length + 2);\\n buffer[0] = \\\"0\\\";\\n buffer[1] = \\\"x\\\";\\n for (uint256 i = 2 * length + 1; i > 1; --i) {\\n buffer[i] = _HEX_SYMBOLS[value & 0xf];\\n value >>= 4;\\n }\\n require(value == 0, \\\"Strings: hex length insufficient\\\");\\n return string(buffer);\\n }\\n}\\n\",\"keccak256\":\"0x32c202bd28995dd20c4347b7c6467a6d3241c74c8ad3edcbb610cd9205916c45\",\"license\":\"MIT\"},\"@openzeppelin/contracts/utils/cryptography/ECDSA.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts v4.4.1 (utils/cryptography/ECDSA.sol)\\n\\npragma solidity ^0.8.0;\\n\\nimport \\\"../Strings.sol\\\";\\n\\n/**\\n * @dev Elliptic Curve Digital Signature Algorithm (ECDSA) operations.\\n *\\n * These functions can be used to verify that a message was signed by the holder\\n * of the private keys of a given address.\\n */\\nlibrary ECDSA {\\n enum RecoverError {\\n NoError,\\n InvalidSignature,\\n InvalidSignatureLength,\\n InvalidSignatureS,\\n InvalidSignatureV\\n }\\n\\n function _throwError(RecoverError error) private pure {\\n if (error == RecoverError.NoError) {\\n return; // no error: do nothing\\n } else if (error == RecoverError.InvalidSignature) {\\n revert(\\\"ECDSA: invalid signature\\\");\\n } else if (error == RecoverError.InvalidSignatureLength) {\\n revert(\\\"ECDSA: invalid signature length\\\");\\n } else if (error == RecoverError.InvalidSignatureS) {\\n revert(\\\"ECDSA: invalid signature 's' value\\\");\\n } else if (error == RecoverError.InvalidSignatureV) {\\n revert(\\\"ECDSA: invalid signature 'v' value\\\");\\n }\\n }\\n\\n /**\\n * @dev Returns the address that signed a hashed message (`hash`) with\\n * `signature` or error string. This address can then be used for verification purposes.\\n *\\n * The `ecrecover` EVM opcode allows for malleable (non-unique) signatures:\\n * this function rejects them by requiring the `s` value to be in the lower\\n * half order, and the `v` value to be either 27 or 28.\\n *\\n * IMPORTANT: `hash` _must_ be the result of a hash operation for the\\n * verification to be secure: it is possible to craft signatures that\\n * recover to arbitrary addresses for non-hashed data. A safe way to ensure\\n * this is by receiving a hash of the original message (which may otherwise\\n * be too long), and then calling {toEthSignedMessageHash} on it.\\n *\\n * Documentation for signature generation:\\n * - with https://web3js.readthedocs.io/en/v1.3.4/web3-eth-accounts.html#sign[Web3.js]\\n * - with https://docs.ethers.io/v5/api/signer/#Signer-signMessage[ethers]\\n *\\n * _Available since v4.3._\\n */\\n function tryRecover(bytes32 hash, bytes memory signature) internal pure returns (address, RecoverError) {\\n // Check the signature length\\n // - case 65: r,s,v signature (standard)\\n // - case 64: r,vs signature (cf https://eips.ethereum.org/EIPS/eip-2098) _Available since v4.1._\\n if (signature.length == 65) {\\n bytes32 r;\\n bytes32 s;\\n uint8 v;\\n // ecrecover takes the signature parameters, and the only way to get them\\n // currently is to use assembly.\\n assembly {\\n r := mload(add(signature, 0x20))\\n s := mload(add(signature, 0x40))\\n v := byte(0, mload(add(signature, 0x60)))\\n }\\n return tryRecover(hash, v, r, s);\\n } else if (signature.length == 64) {\\n bytes32 r;\\n bytes32 vs;\\n // ecrecover takes the signature parameters, and the only way to get them\\n // currently is to use assembly.\\n assembly {\\n r := mload(add(signature, 0x20))\\n vs := mload(add(signature, 0x40))\\n }\\n return tryRecover(hash, r, vs);\\n } else {\\n return (address(0), RecoverError.InvalidSignatureLength);\\n }\\n }\\n\\n /**\\n * @dev Returns the address that signed a hashed message (`hash`) with\\n * `signature`. This address can then be used for verification purposes.\\n *\\n * The `ecrecover` EVM opcode allows for malleable (non-unique) signatures:\\n * this function rejects them by requiring the `s` value to be in the lower\\n * half order, and the `v` value to be either 27 or 28.\\n *\\n * IMPORTANT: `hash` _must_ be the result of a hash operation for the\\n * verification to be secure: it is possible to craft signatures that\\n * recover to arbitrary addresses for non-hashed data. A safe way to ensure\\n * this is by receiving a hash of the original message (which may otherwise\\n * be too long), and then calling {toEthSignedMessageHash} on it.\\n */\\n function recover(bytes32 hash, bytes memory signature) internal pure returns (address) {\\n (address recovered, RecoverError error) = tryRecover(hash, signature);\\n _throwError(error);\\n return recovered;\\n }\\n\\n /**\\n * @dev Overload of {ECDSA-tryRecover} that receives the `r` and `vs` short-signature fields separately.\\n *\\n * See https://eips.ethereum.org/EIPS/eip-2098[EIP-2098 short signatures]\\n *\\n * _Available since v4.3._\\n */\\n function tryRecover(\\n bytes32 hash,\\n bytes32 r,\\n bytes32 vs\\n ) internal pure returns (address, RecoverError) {\\n bytes32 s;\\n uint8 v;\\n assembly {\\n s := and(vs, 0x7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff)\\n v := add(shr(255, vs), 27)\\n }\\n return tryRecover(hash, v, r, s);\\n }\\n\\n /**\\n * @dev Overload of {ECDSA-recover} that receives the `r and `vs` short-signature fields separately.\\n *\\n * _Available since v4.2._\\n */\\n function recover(\\n bytes32 hash,\\n bytes32 r,\\n bytes32 vs\\n ) internal pure returns (address) {\\n (address recovered, RecoverError error) = tryRecover(hash, r, vs);\\n _throwError(error);\\n return recovered;\\n }\\n\\n /**\\n * @dev Overload of {ECDSA-tryRecover} that receives the `v`,\\n * `r` and `s` signature fields separately.\\n *\\n * _Available since v4.3._\\n */\\n function tryRecover(\\n bytes32 hash,\\n uint8 v,\\n bytes32 r,\\n bytes32 s\\n ) internal pure returns (address, RecoverError) {\\n // EIP-2 still allows signature malleability for ecrecover(). Remove this possibility and make the signature\\n // unique. Appendix F in the Ethereum Yellow paper (https://ethereum.github.io/yellowpaper/paper.pdf), defines\\n // the valid range for s in (301): 0 < s < secp256k1n \\u00f7 2 + 1, and for v in (302): v \\u2208 {27, 28}. Most\\n // signatures from current libraries generate a unique signature with an s-value in the lower half order.\\n //\\n // If your library generates malleable signatures, such as s-values in the upper range, calculate a new s-value\\n // with 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFEBAAEDCE6AF48A03BBFD25E8CD0364141 - s1 and flip v from 27 to 28 or\\n // vice versa. If your library also generates signatures with 0/1 for v instead 27/28, add 27 to v to accept\\n // these malleable signatures as well.\\n if (uint256(s) > 0x7FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF5D576E7357A4501DDFE92F46681B20A0) {\\n return (address(0), RecoverError.InvalidSignatureS);\\n }\\n if (v != 27 && v != 28) {\\n return (address(0), RecoverError.InvalidSignatureV);\\n }\\n\\n // If the signature is valid (and not malleable), return the signer address\\n address signer = ecrecover(hash, v, r, s);\\n if (signer == address(0)) {\\n return (address(0), RecoverError.InvalidSignature);\\n }\\n\\n return (signer, RecoverError.NoError);\\n }\\n\\n /**\\n * @dev Overload of {ECDSA-recover} that receives the `v`,\\n * `r` and `s` signature fields separately.\\n */\\n function recover(\\n bytes32 hash,\\n uint8 v,\\n bytes32 r,\\n bytes32 s\\n ) internal pure returns (address) {\\n (address recovered, RecoverError error) = tryRecover(hash, v, r, s);\\n _throwError(error);\\n return recovered;\\n }\\n\\n /**\\n * @dev Returns an Ethereum Signed Message, created from a `hash`. This\\n * produces hash corresponding to the one signed with the\\n * https://eth.wiki/json-rpc/API#eth_sign[`eth_sign`]\\n * JSON-RPC method as part of EIP-191.\\n *\\n * See {recover}.\\n */\\n function toEthSignedMessageHash(bytes32 hash) internal pure returns (bytes32) {\\n // 32 is the length in bytes of hash,\\n // enforced by the type signature above\\n return keccak256(abi.encodePacked(\\\"\\\\x19Ethereum Signed Message:\\\\n32\\\", hash));\\n }\\n\\n /**\\n * @dev Returns an Ethereum Signed Message, created from `s`. This\\n * produces hash corresponding to the one signed with the\\n * https://eth.wiki/json-rpc/API#eth_sign[`eth_sign`]\\n * JSON-RPC method as part of EIP-191.\\n *\\n * See {recover}.\\n */\\n function toEthSignedMessageHash(bytes memory s) internal pure returns (bytes32) {\\n return keccak256(abi.encodePacked(\\\"\\\\x19Ethereum Signed Message:\\\\n\\\", Strings.toString(s.length), s));\\n }\\n\\n /**\\n * @dev Returns an Ethereum Signed Typed Data, created from a\\n * `domainSeparator` and a `structHash`. This produces hash corresponding\\n * to the one signed with the\\n * https://eips.ethereum.org/EIPS/eip-712[`eth_signTypedData`]\\n * JSON-RPC method as part of EIP-712.\\n *\\n * See {recover}.\\n */\\n function toTypedDataHash(bytes32 domainSeparator, bytes32 structHash) internal pure returns (bytes32) {\\n return keccak256(abi.encodePacked(\\\"\\\\x19\\\\x01\\\", domainSeparator, structHash));\\n }\\n}\\n\",\"keccak256\":\"0xe9e291de7ffe06e66503c6700b1bb84ff6e0989cbb974653628d8994e7c97f03\",\"license\":\"MIT\"},\"@openzeppelin/contracts/utils/cryptography/MerkleProof.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts v4.4.1 (utils/cryptography/MerkleProof.sol)\\n\\npragma solidity ^0.8.0;\\n\\n/**\\n * @dev These functions deal with verification of Merkle Trees proofs.\\n *\\n * The proofs can be generated using the JavaScript library\\n * https://github.com/miguelmota/merkletreejs[merkletreejs].\\n * Note: the hashing algorithm should be keccak256 and pair sorting should be enabled.\\n *\\n * See `test/utils/cryptography/MerkleProof.test.js` for some examples.\\n */\\nlibrary MerkleProof {\\n /**\\n * @dev Returns true if a `leaf` can be proved to be a part of a Merkle tree\\n * defined by `root`. For this, a `proof` must be provided, containing\\n * sibling hashes on the branch from the leaf to the root of the tree. Each\\n * pair of leaves and each pair of pre-images are assumed to be sorted.\\n */\\n function verify(\\n bytes32[] memory proof,\\n bytes32 root,\\n bytes32 leaf\\n ) internal pure returns (bool) {\\n return processProof(proof, leaf) == root;\\n }\\n\\n /**\\n * @dev Returns the rebuilt hash obtained by traversing a Merklee tree up\\n * from `leaf` using `proof`. A `proof` is valid if and only if the rebuilt\\n * hash matches the root of the tree. When processing the proof, the pairs\\n * of leafs & pre-images are assumed to be sorted.\\n *\\n * _Available since v4.4._\\n */\\n function processProof(bytes32[] memory proof, bytes32 leaf) internal pure returns (bytes32) {\\n bytes32 computedHash = leaf;\\n for (uint256 i = 0; i < proof.length; i++) {\\n bytes32 proofElement = proof[i];\\n if (computedHash <= proofElement) {\\n // Hash(current computed hash + current element of the proof)\\n computedHash = keccak256(abi.encodePacked(computedHash, proofElement));\\n } else {\\n // Hash(current element of the proof + current computed hash)\\n computedHash = keccak256(abi.encodePacked(proofElement, computedHash));\\n }\\n }\\n return computedHash;\\n }\\n}\\n\",\"keccak256\":\"0x9c35727c74a6ffd8d02237b414e7bfb532c0323b1088709def98ea5c628157de\",\"license\":\"MIT\"},\"@openzeppelin/contracts/utils/cryptography/SignatureChecker.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts v4.4.1 (utils/cryptography/SignatureChecker.sol)\\n\\npragma solidity ^0.8.0;\\n\\nimport \\\"./ECDSA.sol\\\";\\nimport \\\"../Address.sol\\\";\\nimport \\\"../../interfaces/IERC1271.sol\\\";\\n\\n/**\\n * @dev Signature verification helper: Provide a single mechanism to verify both private-key (EOA) ECDSA signature and\\n * ERC1271 contract signatures. Using this instead of ECDSA.recover in your contract will make them compatible with\\n * smart contract wallets such as Argent and Gnosis.\\n *\\n * Note: unlike ECDSA signatures, contract signature's are revocable, and the outcome of this function can thus change\\n * through time. It could return true at block N and false at block N+1 (or the opposite).\\n *\\n * _Available since v4.1._\\n */\\nlibrary SignatureChecker {\\n function isValidSignatureNow(\\n address signer,\\n bytes32 hash,\\n bytes memory signature\\n ) internal view returns (bool) {\\n (address recovered, ECDSA.RecoverError error) = ECDSA.tryRecover(hash, signature);\\n if (error == ECDSA.RecoverError.NoError && recovered == signer) {\\n return true;\\n }\\n\\n (bool success, bytes memory result) = signer.staticcall(\\n abi.encodeWithSelector(IERC1271.isValidSignature.selector, hash, signature)\\n );\\n return (success && result.length == 32 && abi.decode(result, (bytes4)) == IERC1271.isValidSignature.selector);\\n }\\n}\\n\",\"keccak256\":\"0x448837ee3c81795bb58732fd56e8ec9b5194ab6a05a415e960da852fbaa23d01\",\"license\":\"MIT\"},\"@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\",\"keccak256\":\"0xcd34b3f83b61a096b53020749f327096d5cacd89c2393d947595afb934496ad4\",\"license\":\"AGPL-3.0-only\"},\"@uma/core/contracts/common/implementation/MultiCaller.sol\":{\"content\":\"// This contract is taken from Uniswaps'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.\\npragma solidity ^0.8.0;\\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 payable returns (bytes[] memory results) {\\n require(msg.value == 0, \\\"Only multicall with 0 value\\\");\\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\",\"keccak256\":\"0x31f18055b14fd9eeb459c6d6a88d1a60921bf3755031f6db4b709c3e01d078f7\"},\"@uma/core/contracts/common/implementation/Testable.sol\":{\"content\":\"// SPDX-License-Identifier: AGPL-3.0-only\\npragma solidity ^0.8.0;\\n\\nimport \\\"./Timer.sol\\\";\\n\\n/**\\n * @title Base class that provides time overrides, but only if being run in test mode.\\n */\\nabstract contract Testable {\\n // If the contract is being run in production, then `timerAddress` will be the 0x0 address.\\n // Note: this variable should be set on construction and never modified.\\n address public timerAddress;\\n\\n /**\\n * @notice Constructs the Testable contract. Called by child contracts.\\n * @param _timerAddress Contract that stores the current time in a testing environment.\\n * Must be set to 0x0 for production environments that use live time.\\n */\\n constructor(address _timerAddress) {\\n timerAddress = _timerAddress;\\n }\\n\\n /**\\n * @notice Reverts if not running in test mode.\\n */\\n modifier onlyIfTest {\\n require(timerAddress != address(0x0));\\n _;\\n }\\n\\n /**\\n * @notice Sets the current time.\\n * @dev Will revert if not running in test mode.\\n * @param time timestamp to set current Testable time to.\\n */\\n function setCurrentTime(uint256 time) external onlyIfTest {\\n Timer(timerAddress).setCurrentTime(time);\\n }\\n\\n /**\\n * @notice Gets the current time. Will return the last time set in `setCurrentTime` if running in test mode.\\n * Otherwise, it will return the block timestamp.\\n * @return uint for the current Testable timestamp.\\n */\\n function getCurrentTime() public view virtual returns (uint256) {\\n if (timerAddress != address(0x0)) {\\n return Timer(timerAddress).getCurrentTime();\\n } else {\\n return block.timestamp; // solhint-disable-line not-rely-on-time\\n }\\n }\\n}\\n\",\"keccak256\":\"0x0254b45747293bb800373a58d123969adec0428f7be79dc941cab10fcad09918\",\"license\":\"AGPL-3.0-only\"},\"@uma/core/contracts/common/implementation/Timer.sol\":{\"content\":\"// SPDX-License-Identifier: AGPL-3.0-only\\npragma solidity ^0.8.0;\\n\\n/**\\n * @title Universal store of current contract time for testing environments.\\n */\\ncontract Timer {\\n uint256 private currentTime;\\n\\n constructor() {\\n currentTime = block.timestamp; // solhint-disable-line not-rely-on-time\\n }\\n\\n /**\\n * @notice Sets the current time.\\n * @dev Will revert if not running in test mode.\\n * @param time timestamp to set `currentTime` to.\\n */\\n function setCurrentTime(uint256 time) external {\\n currentTime = time;\\n }\\n\\n /**\\n * @notice Gets the currentTime variable set in the Timer.\\n * @return uint256 for the current Testable timestamp.\\n */\\n function getCurrentTime() public view returns (uint256) {\\n return currentTime;\\n }\\n}\\n\",\"keccak256\":\"0x9e0dd7389718bd5d1da910273a6f4cee98ee22bfc0c92bde0f0955c0e23adb5e\",\"license\":\"AGPL-3.0-only\"},\"contracts/Arbitrum_SpokePool.sol\":{\"content\":\"//SPDX-License-Identifier: Unlicense\\r\\npragma solidity ^0.8.0;\\r\\n\\r\\nimport \\\"./SpokePool.sol\\\";\\r\\nimport \\\"./SpokePoolInterface.sol\\\";\\r\\n\\r\\ninterface StandardBridgeLike {\\r\\n function outboundTransfer(\\r\\n address _l1Token,\\r\\n address _to,\\r\\n uint256 _amount,\\r\\n bytes calldata _data\\r\\n ) external payable returns (bytes memory);\\r\\n}\\r\\n\\r\\n/**\\r\\n * @notice AVM specific SpokePool.\\r\\n * @dev Uses AVM cross-domain-enabled logic for access control.\\r\\n */\\r\\n\\r\\ncontract Arbitrum_SpokePool is SpokePoolInterface, SpokePool {\\r\\n // Address of the Arbitrum L2 token gateway.\\r\\n address public l2GatewayRouter;\\r\\n\\r\\n // Admin controlled mapping of arbitrum tokens to L1 counterpart. L1 counterpart addresses\\r\\n // are neccessary to bridge tokens to L1.\\r\\n mapping(address => address) public whitelistedTokens;\\r\\n\\r\\n event ArbitrumTokensBridged(address indexed l1Token, address target, uint256 numberOfTokensBridged);\\r\\n event SetL2GatewayRouter(address indexed newL2GatewayRouter);\\r\\n event WhitelistedTokens(address indexed l2Token, address indexed l1Token);\\r\\n\\r\\n constructor(\\r\\n address _l2GatewayRouter,\\r\\n address _crossDomainAdmin,\\r\\n address _hubPool,\\r\\n address _wethAddress,\\r\\n address timerAddress\\r\\n ) SpokePool(_crossDomainAdmin, _hubPool, _wethAddress, timerAddress) {\\r\\n _setL2GatewayRouter(_l2GatewayRouter);\\r\\n }\\r\\n\\r\\n modifier onlyFromCrossDomainAdmin() {\\r\\n require(msg.sender == _applyL1ToL2Alias(crossDomainAdmin), \\\"ONLY_COUNTERPART_GATEWAY\\\");\\r\\n _;\\r\\n }\\r\\n\\r\\n /**************************************\\r\\n * CROSS-CHAIN ADMIN FUNCTIONS *\\r\\n **************************************/\\r\\n\\r\\n function setL2GatewayRouter(address newL2GatewayRouter) public onlyFromCrossDomainAdmin nonReentrant {\\r\\n _setL2GatewayRouter(newL2GatewayRouter);\\r\\n }\\r\\n\\r\\n function whitelistToken(address l2Token, address l1Token) public onlyFromCrossDomainAdmin nonReentrant {\\r\\n _whitelistToken(l2Token, l1Token);\\r\\n }\\r\\n\\r\\n function setCrossDomainAdmin(address newCrossDomainAdmin) public override onlyFromCrossDomainAdmin nonReentrant {\\r\\n _setCrossDomainAdmin(newCrossDomainAdmin);\\r\\n }\\r\\n\\r\\n function setHubPool(address newHubPool) public override onlyFromCrossDomainAdmin nonReentrant {\\r\\n _setHubPool(newHubPool);\\r\\n }\\r\\n\\r\\n function setEnableRoute(\\r\\n address originToken,\\r\\n uint256 destinationChainId,\\r\\n bool enable\\r\\n ) public override onlyFromCrossDomainAdmin nonReentrant {\\r\\n _setEnableRoute(originToken, destinationChainId, enable);\\r\\n }\\r\\n\\r\\n function setDepositQuoteTimeBuffer(uint32 buffer) public override onlyFromCrossDomainAdmin nonReentrant {\\r\\n _setDepositQuoteTimeBuffer(buffer);\\r\\n }\\r\\n\\r\\n function relayRootBundle(bytes32 relayerRefundRoot, bytes32 slowRelayFulfillmentRoot)\\r\\n public\\r\\n override\\r\\n onlyFromCrossDomainAdmin\\r\\n nonReentrant\\r\\n {\\r\\n _relayRootBundle(relayerRefundRoot, slowRelayFulfillmentRoot);\\r\\n }\\r\\n\\r\\n /**************************************\\r\\n * INTERNAL FUNCTIONS *\\r\\n **************************************/\\r\\n\\r\\n function _bridgeTokensToHubPool(RelayerRefundLeaf memory relayerRefundLeaf) internal override {\\r\\n StandardBridgeLike(l2GatewayRouter).outboundTransfer(\\r\\n whitelistedTokens[relayerRefundLeaf.l2TokenAddress], // _l1Token. Address of the L1 token to bridge over.\\r\\n hubPool, // _to. Withdraw, over the bridge, to the l1 hub pool contract.\\r\\n relayerRefundLeaf.amountToReturn, // _amount.\\r\\n \\\"\\\" // _data. We don't need to send any data for the bridging action.\\r\\n );\\r\\n emit ArbitrumTokensBridged(address(0), hubPool, relayerRefundLeaf.amountToReturn);\\r\\n }\\r\\n\\r\\n function _setL2GatewayRouter(address _l2GatewayRouter) internal {\\r\\n l2GatewayRouter = _l2GatewayRouter;\\r\\n emit SetL2GatewayRouter(l2GatewayRouter);\\r\\n }\\r\\n\\r\\n function _whitelistToken(address _l2Token, address _l1Token) internal {\\r\\n whitelistedTokens[_l2Token] = _l1Token;\\r\\n emit WhitelistedTokens(_l2Token, _l1Token);\\r\\n }\\r\\n\\r\\n // l1 addresses are transformed during l1->l2 calls. See https://developer.offchainlabs.com/docs/l1_l2_messages#address-aliasing for more information.\\r\\n function _applyL1ToL2Alias(address l1Address) internal pure returns (address l2Address) {\\r\\n unchecked {\\r\\n l2Address = address(uint160(l1Address) + uint160(0x1111000000000000000000000000000000001111));\\r\\n }\\r\\n }\\r\\n}\\r\\n\",\"keccak256\":\"0x6acbc51d327ffe6f3b646f21ff7790b853a4e6e074ce40de0ac7ae662d9cadb4\",\"license\":\"Unlicense\"},\"contracts/HubPoolInterface.sol\":{\"content\":\"// SPDX-License-Identifier: GPL-3.0-only\\r\\npragma solidity ^0.8.0;\\r\\n\\r\\nimport \\\"@openzeppelin/contracts/token/ERC20/IERC20.sol\\\";\\r\\nimport \\\"./interfaces/AdapterInterface.sol\\\";\\r\\n\\r\\ninterface HubPoolInterface {\\r\\n struct PoolRebalanceLeaf {\\r\\n // This is used to know which chain to send cross-chain transactions to (and which SpokePool to sent to).\\r\\n uint256 chainId;\\r\\n uint256[] bundleLpFees; // Total LP fee amount per token in this bundle, encompassing all associated bundled relays.\\r\\n // This array is grouped with the two above, and it represents the amount to send or request back from the\\r\\n // SpokePool. If positive, the pool will pay the SpokePool. If negative the SpokePool will pay the HubPool.\\r\\n // There can be arbitrarily complex rebalancing rules defined offchain. This number is only nonzero\\r\\n // when the rules indicate that a rebalancing action should occur. When a rebalance does not occur,\\r\\n // runningBalances for this token should change by the total relays - deposits in this bundle. When a rebalance\\r\\n // does occur, runningBalances should be set to zero for this token and the netSendAmounts should be set to the\\r\\n // previous runningBalances + relays - deposits in this bundle.\\r\\n int256[] netSendAmounts;\\r\\n // This is only here to be emitted in an event to track a running unpaid balance between the L2 pool and the L1 pool.\\r\\n // A positive number indicates that the HubPool owes the SpokePool funds. A negative number indicates that the\\r\\n // SpokePool owes the HubPool funds. See the comment above for the dynamics of this and netSendAmounts\\r\\n int256[] runningBalances;\\r\\n // Used as the index in the bitmap to track whether this leaf has been executed or not.\\r\\n uint8 leafId;\\r\\n // The following arrays are required to be the same length. They are parallel arrays for the given chainId and should be ordered by the `l1Tokens` field.\\r\\n // All whitelisted tokens with nonzero relays on this chain in this bundle in the order of whitelisting.\\r\\n address[] l1Tokens;\\r\\n }\\r\\n\\r\\n function setBond(IERC20 newBondToken, uint256 newBondAmount) external;\\r\\n\\r\\n function setCrossChainContracts(\\r\\n uint256 l2ChainId,\\r\\n address adapter,\\r\\n address spokePool\\r\\n ) external;\\r\\n\\r\\n function whitelistRoute(\\r\\n uint256 originChainId,\\r\\n uint256 destinationChainId,\\r\\n address originToken,\\r\\n address destinationToken\\r\\n ) external;\\r\\n\\r\\n function enableL1TokenForLiquidityProvision(address l1Token) external;\\r\\n\\r\\n function disableL1TokenForLiquidityProvision(address l1Token) external;\\r\\n\\r\\n function addLiquidity(address l1Token, uint256 l1TokenAmount) external payable;\\r\\n\\r\\n function removeLiquidity(\\r\\n address l1Token,\\r\\n uint256 lpTokenAmount,\\r\\n bool sendEth\\r\\n ) external;\\r\\n\\r\\n function exchangeRateCurrent(address l1Token) external returns (uint256);\\r\\n\\r\\n function liquidityUtilizationPostRelay(address token, uint256 relayedAmount) external returns (uint256);\\r\\n\\r\\n function proposeRootBundle(\\r\\n uint256[] memory bundleEvaluationBlockNumbers,\\r\\n uint8 poolRebalanceLeafCount,\\r\\n bytes32 poolRebalanceRoot,\\r\\n bytes32 relayerRefundRoot,\\r\\n bytes32 slowRelayFulfillmentRoot\\r\\n ) external;\\r\\n\\r\\n function executeRootBundle(PoolRebalanceLeaf memory poolRebalanceLeaf, bytes32[] memory proof) external;\\r\\n\\r\\n function disputeRootBundle() external;\\r\\n}\\r\\n\",\"keccak256\":\"0x493f6803156dc7129c3af9b7d5b99172ffbd9e93a98d4a44604dc0b984502777\",\"license\":\"GPL-3.0-only\"},\"contracts/MerkleLib.sol\":{\"content\":\"// SPDX-License-Identifier: GPL-3.0-only\\r\\npragma solidity ^0.8.0;\\r\\n\\r\\nimport \\\"@openzeppelin/contracts/utils/cryptography/MerkleProof.sol\\\";\\r\\nimport \\\"./SpokePoolInterface.sol\\\";\\r\\nimport \\\"./HubPoolInterface.sol\\\";\\r\\n\\r\\n/**\\r\\n * @notice Library to help with merkle roots, proofs, and claims.\\r\\n */\\r\\nlibrary MerkleLib {\\r\\n /**\\r\\n * @notice Verifies that a repayment is contained within a merkle root.\\r\\n * @param root the merkle root.\\r\\n * @param rebalance the rebalance struct.\\r\\n * @param proof the merkle proof.\\r\\n */\\r\\n function verifyPoolRebalance(\\r\\n bytes32 root,\\r\\n HubPoolInterface.PoolRebalanceLeaf memory rebalance,\\r\\n bytes32[] memory proof\\r\\n ) internal pure returns (bool) {\\r\\n return MerkleProof.verify(proof, root, keccak256(abi.encode(rebalance)));\\r\\n }\\r\\n\\r\\n /**\\r\\n * @notice Verifies that a relayer refund is contained within a merkle root.\\r\\n * @param root the merkle root.\\r\\n * @param refund the refund struct.\\r\\n * @param proof the merkle proof.\\r\\n */\\r\\n function verifyRelayerRefund(\\r\\n bytes32 root,\\r\\n SpokePoolInterface.RelayerRefundLeaf memory refund,\\r\\n bytes32[] memory proof\\r\\n ) internal pure returns (bool) {\\r\\n return MerkleProof.verify(proof, root, keccak256(abi.encode(refund)));\\r\\n }\\r\\n\\r\\n /**\\r\\n * @notice Verifies that a distribution is contained within a merkle root.\\r\\n * @param root the merkle root.\\r\\n * @param slowRelayFulfillment the relayData fulfullment struct.\\r\\n * @param proof the merkle proof.\\r\\n */\\r\\n function verifySlowRelayFulfillment(\\r\\n bytes32 root,\\r\\n SpokePoolInterface.RelayData memory slowRelayFulfillment,\\r\\n bytes32[] memory proof\\r\\n ) internal pure returns (bool) {\\r\\n return MerkleProof.verify(proof, root, keccak256(abi.encode(slowRelayFulfillment)));\\r\\n }\\r\\n\\r\\n // The following functions are primarily copied from\\r\\n // https://github.com/Uniswap/merkle-distributor/blob/master/contracts/MerkleDistributor.sol with minor changes.\\r\\n\\r\\n /**\\r\\n * @notice Tests whether a claim is contained within a claimedBitMap mapping.\\r\\n * @param claimedBitMap a simple uint256 mapping in storage used as a bitmap.\\r\\n * @param index the index to check in the bitmap.\\r\\n * @return bool indicating if the index within the claimedBitMap has been marked as claimed.\\r\\n */\\r\\n function isClaimed(mapping(uint256 => uint256) storage claimedBitMap, uint256 index) internal view returns (bool) {\\r\\n uint256 claimedWordIndex = index / 256;\\r\\n uint256 claimedBitIndex = index % 256;\\r\\n uint256 claimedWord = claimedBitMap[claimedWordIndex];\\r\\n uint256 mask = (1 << claimedBitIndex);\\r\\n return claimedWord & mask == mask;\\r\\n }\\r\\n\\r\\n /**\\r\\n * @notice Marks an index in a claimedBitMap as claimed.\\r\\n * @param claimedBitMap a simple uint256 mapping in storage used as a bitmap.\\r\\n * @param index the index to mark in the bitmap.\\r\\n */\\r\\n function setClaimed(mapping(uint256 => uint256) storage claimedBitMap, uint256 index) internal {\\r\\n uint256 claimedWordIndex = index / 256;\\r\\n uint256 claimedBitIndex = index % 256;\\r\\n claimedBitMap[claimedWordIndex] = claimedBitMap[claimedWordIndex] | (1 << claimedBitIndex);\\r\\n }\\r\\n\\r\\n /**\\r\\n * @notice Tests whether a claim is contained within a 1D claimedBitMap mapping.\\r\\n * @param claimedBitMap a simple uint256 value, encoding a 1D bitmap.\\r\\n * @param index the index to check in the bitmap.\\r\\n \\\\* @return bool indicating if the index within the claimedBitMap has been marked as claimed.\\r\\n */\\r\\n function isClaimed1D(uint256 claimedBitMap, uint256 index) internal pure returns (bool) {\\r\\n uint256 mask = (1 << index);\\r\\n return claimedBitMap & mask == mask;\\r\\n }\\r\\n\\r\\n /**\\r\\n * @notice Marks an index in a claimedBitMap as claimed.\\r\\n * @param claimedBitMap a simple uint256 mapping in storage used as a bitmap.\\r\\n * @param index the index to mark in the bitmap.\\r\\n */\\r\\n function setClaimed1D(uint256 claimedBitMap, uint256 index) internal pure returns (uint256) {\\r\\n require(index <= 255, \\\"Index out of bounds\\\");\\r\\n return claimedBitMap | (1 << index % 256);\\r\\n }\\r\\n}\\r\\n\",\"keccak256\":\"0x50079aae972160054e34f9acbad1724dc3111491c8b712b6ab1eb49ff4d9869d\",\"license\":\"GPL-3.0-only\"},\"contracts/SpokePool.sol\":{\"content\":\"// SPDX-License-Identifier: GPL-3.0-only\\r\\npragma solidity ^0.8.0;\\r\\n\\r\\nimport \\\"./MerkleLib.sol\\\";\\r\\nimport \\\"./interfaces/WETH9.sol\\\";\\r\\n\\r\\nimport \\\"@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol\\\";\\r\\nimport \\\"@openzeppelin/contracts/token/ERC20/IERC20.sol\\\";\\r\\nimport \\\"@openzeppelin/contracts/utils/Address.sol\\\";\\r\\n\\r\\nimport \\\"@openzeppelin/contracts/utils/cryptography/SignatureChecker.sol\\\";\\r\\nimport \\\"@openzeppelin/contracts/utils/cryptography/ECDSA.sol\\\";\\r\\n\\r\\nimport \\\"@uma/core/contracts/common/implementation/Testable.sol\\\";\\r\\nimport \\\"@uma/core/contracts/common/implementation/Lockable.sol\\\";\\r\\nimport \\\"@uma/core/contracts/common/implementation/MultiCaller.sol\\\";\\r\\nimport \\\"./MerkleLib.sol\\\";\\r\\nimport \\\"./SpokePoolInterface.sol\\\";\\r\\n\\r\\n/**\\r\\n * @title SpokePool\\r\\n * @notice Contract deployed on source and destination chains enabling depositors to transfer assets from source to\\r\\n * destination. Deposit orders are fulfilled by off-chain relayers who also interact with this contract. Deposited\\r\\n * tokens are locked on the source chain and relayers send the recipient the desired token currency and amount\\r\\n * on the destination chain. Locked source chain tokens are later sent over the canonical token bridge to L1.\\r\\n * @dev This contract is designed to be deployed to L2's, not mainnet.\\r\\n */\\r\\nabstract contract SpokePool is SpokePoolInterface, Testable, Lockable, MultiCaller {\\r\\n using SafeERC20 for IERC20;\\r\\n using Address for address;\\r\\n\\r\\n // Address of the L1 contract that acts as the owner of this SpokePool.\\r\\n address public crossDomainAdmin;\\r\\n\\r\\n // Address of the L1 contract that will send tokens to and receive tokens from this contract.\\r\\n address public hubPool;\\r\\n\\r\\n // Address of WETH contract for this network. If an origin token matches this, then the caller can optionally\\r\\n // instruct this contract to wrap ETH when depositing.\\r\\n WETH9 public weth;\\r\\n\\r\\n // Timestamp when contract was constructed. Relays cannot have a quote time before this.\\r\\n uint32 public deploymentTime;\\r\\n\\r\\n // Any deposit quote times greater than or less than this value to the current contract time is blocked. Forces\\r\\n // caller to use an up to date realized fee. Defaults to 10 minutes.\\r\\n uint32 public depositQuoteTimeBuffer = 600;\\r\\n\\r\\n // Use count of deposits as unique deposit identifier.\\r\\n uint32 public numberOfDeposits;\\r\\n\\r\\n // Origin token to destination token routings can be turned on or off.\\r\\n mapping(address => mapping(uint256 => bool)) public enabledDepositRoutes;\\r\\n\\r\\n struct RootBundle {\\r\\n // Merkle root of slow relays that were not fully filled and whose recipient is still owed funds from the LP pool.\\r\\n bytes32 slowRelayFulfillmentRoot;\\r\\n // Merkle root of relayer refunds.\\r\\n bytes32 relayerRefundRoot;\\r\\n // This is a 2D bitmap tracking which leafs in the relayer refund root have been claimed, with max size of\\r\\n // 256x256 leaves per root.\\r\\n mapping(uint256 => uint256) claimedBitmap;\\r\\n }\\r\\n RootBundle[] public rootBundles;\\r\\n\\r\\n // Each relay is associated with the hash of parameters that uniquely identify the original deposit and a relay\\r\\n // attempt for that deposit. The relay itself is just represented as the amount filled so far. The total amount to\\r\\n // relay, the fees, and the agents are all parameters included in the hash key.\\r\\n mapping(bytes32 => uint256) public relayFills;\\r\\n\\r\\n /****************************************\\r\\n * EVENTS *\\r\\n ****************************************/\\r\\n event SetXDomainAdmin(address indexed newAdmin);\\r\\n event SetHubPool(address indexed newHubPool);\\r\\n event EnabledDepositRoute(address indexed originToken, uint256 indexed destinationChainId, bool enabled);\\r\\n event SetDepositQuoteTimeBuffer(uint32 newBuffer);\\r\\n event FundsDeposited(\\r\\n uint256 amount,\\r\\n uint256 destinationChainId,\\r\\n uint64 relayerFeePct,\\r\\n uint32 indexed depositId,\\r\\n uint32 quoteTimestamp,\\r\\n address indexed originToken,\\r\\n address recipient,\\r\\n address indexed depositor\\r\\n );\\r\\n event FilledRelay(\\r\\n bytes32 indexed relayHash,\\r\\n uint256 totalRelayAmount,\\r\\n uint256 totalFilledAmount,\\r\\n uint256 fillAmount,\\r\\n uint256 indexed repaymentChain,\\r\\n uint256 originChainId,\\r\\n uint64 relayerFeePct,\\r\\n uint64 realizedLpFeePct,\\r\\n uint32 depositId,\\r\\n address destinationToken,\\r\\n address indexed relayer,\\r\\n address depositor,\\r\\n address recipient\\r\\n );\\r\\n event ExecutedSlowRelayFulfillmentRoot(\\r\\n bytes32 indexed relayHash,\\r\\n uint256 totalRelayAmount,\\r\\n uint256 totalFilledAmount,\\r\\n uint256 fillAmount,\\r\\n uint256 originChainId,\\r\\n uint64 relayerFeePct,\\r\\n uint64 realizedLpFeePct,\\r\\n uint32 depositId,\\r\\n address destinationToken,\\r\\n address indexed caller,\\r\\n address depositor,\\r\\n address recipient\\r\\n );\\r\\n event RelayedRootBundle(uint32 indexed rootBundleId, bytes32 relayerRefundRoot, bytes32 slowRelayFulfillmentRoot);\\r\\n event ExecutedRelayerRefundRoot(\\r\\n uint256 amountToReturn,\\r\\n uint256 chainId,\\r\\n uint256[] refundAmounts,\\r\\n uint32 indexed rootBundleId,\\r\\n uint32 indexed leafId,\\r\\n address l2TokenAddress,\\r\\n address[] refundAddresses,\\r\\n address indexed caller\\r\\n );\\r\\n event TokensBridged(\\r\\n uint256 amountToReturn,\\r\\n uint256 indexed chainId,\\r\\n uint32 indexed leafId,\\r\\n address indexed l2TokenAddress,\\r\\n address caller\\r\\n );\\r\\n\\r\\n constructor(\\r\\n address _crossDomainAdmin,\\r\\n address _hubPool,\\r\\n address _wethAddress,\\r\\n address timerAddress\\r\\n ) Testable(timerAddress) {\\r\\n _setCrossDomainAdmin(_crossDomainAdmin);\\r\\n _setHubPool(_hubPool);\\r\\n deploymentTime = uint32(getCurrentTime());\\r\\n weth = WETH9(_wethAddress);\\r\\n }\\r\\n\\r\\n /****************************************\\r\\n * MODIFIERS *\\r\\n ****************************************/\\r\\n\\r\\n modifier onlyEnabledRoute(address originToken, uint256 destinationId) {\\r\\n require(enabledDepositRoutes[originToken][destinationId], \\\"Disabled route\\\");\\r\\n _;\\r\\n }\\r\\n\\r\\n /**************************************\\r\\n * ADMIN FUNCTIONS *\\r\\n **************************************/\\r\\n\\r\\n function _setCrossDomainAdmin(address newCrossDomainAdmin) internal {\\r\\n require(newCrossDomainAdmin != address(0), \\\"Bad bridge router address\\\");\\r\\n crossDomainAdmin = newCrossDomainAdmin;\\r\\n emit SetXDomainAdmin(crossDomainAdmin);\\r\\n }\\r\\n\\r\\n function _setHubPool(address newHubPool) internal {\\r\\n require(newHubPool != address(0), \\\"Bad hub pool address\\\");\\r\\n hubPool = newHubPool;\\r\\n emit SetHubPool(hubPool);\\r\\n }\\r\\n\\r\\n function _setEnableRoute(\\r\\n address originToken,\\r\\n uint256 destinationChainId,\\r\\n bool enabled\\r\\n ) internal {\\r\\n enabledDepositRoutes[originToken][destinationChainId] = enabled;\\r\\n emit EnabledDepositRoute(originToken, destinationChainId, enabled);\\r\\n }\\r\\n\\r\\n function _setDepositQuoteTimeBuffer(uint32 _depositQuoteTimeBuffer) internal {\\r\\n depositQuoteTimeBuffer = _depositQuoteTimeBuffer;\\r\\n emit SetDepositQuoteTimeBuffer(_depositQuoteTimeBuffer);\\r\\n }\\r\\n\\r\\n /**************************************\\r\\n * DEPOSITOR FUNCTIONS *\\r\\n **************************************/\\r\\n\\r\\n /**\\r\\n * @notice Called by user to bridge funds from origin to destination chain.\\r\\n * @dev The caller must first approve this contract to spend `amount` of `originToken`.\\r\\n */\\r\\n function deposit(\\r\\n address recipient,\\r\\n address originToken,\\r\\n uint256 amount,\\r\\n uint256 destinationChainId,\\r\\n uint64 relayerFeePct,\\r\\n uint32 quoteTimestamp\\r\\n ) public payable onlyEnabledRoute(originToken, destinationChainId) nonReentrant {\\r\\n // We limit the relay fees to prevent the user spending all their funds on fees.\\r\\n require(relayerFeePct <= 0.5e18, \\\"invalid relayer fee\\\");\\r\\n // Note We assume that L2 timing cannot be compared accurately and consistently to L1 timing. Therefore,\\r\\n // `block.timestamp` is different from the L1 EVM's. Therefore, the quoteTimestamp must be within a configurable\\r\\n // buffer to allow for this variance.\\r\\n // Note also that `quoteTimestamp` cannot be less than the buffer otherwise the following arithmetic can result\\r\\n // in underflow. This isn't a problem as the deposit will revert, but the error might be unexpected for clients.\\r\\n require(\\r\\n getCurrentTime() >= quoteTimestamp - depositQuoteTimeBuffer &&\\r\\n getCurrentTime() <= quoteTimestamp + depositQuoteTimeBuffer,\\r\\n \\\"invalid quote time\\\"\\r\\n );\\r\\n // If the address of the origin token is a WETH contract and there is a msg.value with the transaction\\r\\n // then the user is sending ETH. In this case, the ETH should be deposited to WETH.\\r\\n if (originToken == address(weth) && msg.value > 0) {\\r\\n require(msg.value == amount, \\\"msg.value must match amount\\\");\\r\\n weth.deposit{ value: msg.value }();\\r\\n } else {\\r\\n // Else, it is a normal ERC20. In this case pull the token from the users wallet as per normal.\\r\\n // Note: this includes the case where the L2 user has WETH (already wrapped ETH) and wants to bridge them. In\\r\\n // this case the msg.value will be set to 0, indicating a \\\"normal\\\" ERC20 bridging action.\\r\\n IERC20(originToken).safeTransferFrom(msg.sender, address(this), amount);\\r\\n }\\r\\n\\r\\n emit FundsDeposited(\\r\\n amount,\\r\\n destinationChainId,\\r\\n relayerFeePct,\\r\\n numberOfDeposits,\\r\\n quoteTimestamp,\\r\\n originToken,\\r\\n recipient,\\r\\n msg.sender\\r\\n );\\r\\n\\r\\n numberOfDeposits += 1;\\r\\n }\\r\\n\\r\\n /**************************************\\r\\n * RELAYER FUNCTIONS *\\r\\n **************************************/\\r\\n\\r\\n function fillRelay(\\r\\n address depositor,\\r\\n address recipient,\\r\\n address destinationToken,\\r\\n uint256 totalRelayAmount,\\r\\n uint256 maxTokensToSend,\\r\\n uint256 repaymentChain,\\r\\n uint256 originChainId,\\r\\n uint64 realizedLpFeePct,\\r\\n uint64 relayerFeePct,\\r\\n uint32 depositId\\r\\n ) public nonReentrant {\\r\\n // Each relay attempt is mapped to the hash of data uniquely identifying it, which includes the deposit data\\r\\n // such as the origin chain ID and the deposit ID, and the data in a relay attempt such as who the recipient\\r\\n // is, which chain and currency the recipient wants to receive funds on, and the relay fees.\\r\\n SpokePoolInterface.RelayData memory relayData = SpokePoolInterface.RelayData({\\r\\n depositor: depositor,\\r\\n recipient: recipient,\\r\\n destinationToken: destinationToken,\\r\\n relayAmount: totalRelayAmount,\\r\\n realizedLpFeePct: realizedLpFeePct,\\r\\n relayerFeePct: relayerFeePct,\\r\\n depositId: depositId,\\r\\n originChainId: originChainId\\r\\n });\\r\\n bytes32 relayHash = _getRelayHash(relayData);\\r\\n\\r\\n uint256 fillAmountPreFees = _fillRelay(relayHash, relayData, maxTokensToSend, relayerFeePct, false);\\r\\n\\r\\n _emitFillRelay(relayHash, fillAmountPreFees, repaymentChain, relayerFeePct, relayData);\\r\\n }\\r\\n\\r\\n function fillRelayWithUpdatedFee(\\r\\n address depositor,\\r\\n address recipient,\\r\\n address destinationToken,\\r\\n uint256 totalRelayAmount,\\r\\n uint256 maxTokensToSend,\\r\\n uint256 repaymentChain,\\r\\n uint256 originChainId,\\r\\n uint64 realizedLpFeePct,\\r\\n uint64 relayerFeePct,\\r\\n uint64 newRelayerFeePct,\\r\\n uint32 depositId,\\r\\n bytes memory depositorSignature\\r\\n ) public nonReentrant {\\r\\n // Grouping the signature validation logic into brackets to address stack too deep error.\\r\\n {\\r\\n // Depositor should have signed a hash of the relayer fee % to update to and information uniquely identifying\\r\\n // the deposit to relay. This ensures that this signature cannot be re-used for other deposits. The version\\r\\n // string is included as a precaution in case this contract is upgraded.\\r\\n // Note: we use encode instead of encodePacked because it is more secure, more in the \\\"warning\\\" section\\r\\n // here: https://docs.soliditylang.org/en/v0.8.11/abi-spec.html#non-standard-packed-mode\\r\\n bytes32 expectedDepositorMessageHash = keccak256(\\r\\n abi.encode(\\\"ACROSS-V2-FEE-1.0\\\", newRelayerFeePct, depositId, originChainId)\\r\\n );\\r\\n\\r\\n // Check the hash corresponding to the https://eth.wiki/json-rpc/API#eth_sign[`eth_sign`]\\r\\n // JSON-RPC method as part of EIP-191. We use OZ's signature checker library with adds support for\\r\\n // EIP-1271 which can verify messages signed by smart contract wallets like Argent and Gnosis safes.\\r\\n // If the depositor signed a message with a different updated fee (or any other param included in the\\r\\n // above keccak156 hash), then this will revert.\\r\\n bytes32 ethSignedMessageHash = ECDSA.toEthSignedMessageHash(expectedDepositorMessageHash);\\r\\n\\r\\n _verifyDepositorUpdateFeeMessage(depositor, ethSignedMessageHash, depositorSignature);\\r\\n }\\r\\n\\r\\n // Now follow the default `fillRelay` flow with the updated fee and the original relay hash.\\r\\n RelayData memory relayData = RelayData({\\r\\n depositor: depositor,\\r\\n recipient: recipient,\\r\\n destinationToken: destinationToken,\\r\\n relayAmount: totalRelayAmount,\\r\\n realizedLpFeePct: realizedLpFeePct,\\r\\n relayerFeePct: relayerFeePct,\\r\\n depositId: depositId,\\r\\n originChainId: originChainId\\r\\n });\\r\\n bytes32 relayHash = _getRelayHash(relayData);\\r\\n uint256 fillAmountPreFees = _fillRelay(relayHash, relayData, maxTokensToSend, newRelayerFeePct, false);\\r\\n\\r\\n _emitFillRelay(relayHash, fillAmountPreFees, repaymentChain, newRelayerFeePct, relayData);\\r\\n }\\r\\n\\r\\n /**************************************\\r\\n * DATA WORKER FUNCTIONS *\\r\\n **************************************/\\r\\n function executeSlowRelayFulfillmentRoot(\\r\\n address depositor,\\r\\n address recipient,\\r\\n address destinationToken,\\r\\n uint256 totalRelayAmount,\\r\\n uint256 originChainId,\\r\\n uint64 realizedLpFeePct,\\r\\n uint64 relayerFeePct,\\r\\n uint32 depositId,\\r\\n uint32 rootBundleId,\\r\\n bytes32[] memory proof\\r\\n ) public nonReentrant {\\r\\n RelayData memory relayData = RelayData({\\r\\n depositor: depositor,\\r\\n recipient: recipient,\\r\\n destinationToken: destinationToken,\\r\\n relayAmount: totalRelayAmount,\\r\\n originChainId: originChainId,\\r\\n realizedLpFeePct: realizedLpFeePct,\\r\\n relayerFeePct: relayerFeePct,\\r\\n depositId: depositId\\r\\n });\\r\\n\\r\\n require(\\r\\n MerkleLib.verifySlowRelayFulfillment(rootBundles[rootBundleId].slowRelayFulfillmentRoot, relayData, proof),\\r\\n \\\"Invalid proof\\\"\\r\\n );\\r\\n\\r\\n bytes32 relayHash = _getRelayHash(relayData);\\r\\n\\r\\n // Wrap any ETH owned by this contract so we can send expected L2 token to recipient. This is neccessary because\\r\\n // some SpokePools will receive ETH from the canonical token bridge instead of WETH so this contract\\r\\n // might have built up an ETH balance.\\r\\n if (address(this).balance > 0) weth.deposit{ value: address(this).balance }();\\r\\n\\r\\n // Note: use relayAmount as the max amount to send, so the relay is always completely filled by the contract's\\r\\n // funds in all cases.\\r\\n uint256 fillAmountPreFees = _fillRelay(relayHash, relayData, relayData.relayAmount, relayerFeePct, true);\\r\\n\\r\\n _emitExecutedSlowRelayFulfillmentRoot(relayHash, fillAmountPreFees, relayData);\\r\\n }\\r\\n\\r\\n function executeRelayerRefundRoot(\\r\\n uint32 rootBundleId,\\r\\n SpokePoolInterface.RelayerRefundLeaf memory relayerRefundLeaf,\\r\\n bytes32[] memory proof\\r\\n ) public nonReentrant {\\r\\n // Check integrity of leaf structure:\\r\\n require(relayerRefundLeaf.chainId == chainId(), \\\"Invalid chainId\\\");\\r\\n require(relayerRefundLeaf.refundAddresses.length == relayerRefundLeaf.refundAmounts.length, \\\"invalid leaf\\\");\\r\\n\\r\\n RootBundle storage rootBundle = rootBundles[rootBundleId];\\r\\n\\r\\n // Check that `inclusionProof` proves that `relayerRefundLeaf` is contained within the relayer refund root.\\r\\n // Note: This should revert if the `relayerRefundRoot` is uninitialized.\\r\\n require(MerkleLib.verifyRelayerRefund(rootBundle.relayerRefundRoot, relayerRefundLeaf, proof), \\\"Bad Proof\\\");\\r\\n\\r\\n // Verify the leafId in the leaf has not yet been claimed.\\r\\n require(!MerkleLib.isClaimed(rootBundle.claimedBitmap, relayerRefundLeaf.leafId), \\\"Already claimed\\\");\\r\\n\\r\\n // Set leaf as claimed in bitmap.\\r\\n MerkleLib.setClaimed(rootBundle.claimedBitmap, relayerRefundLeaf.leafId);\\r\\n\\r\\n // Wrap any ETH owned by this contract so we can send expected L2 token to recipient. This is neccessary because\\r\\n // some SpokePools will receive ETH from the canonical token bridge instead of WETH.\\r\\n if (address(this).balance > 0) weth.deposit{ value: address(this).balance }();\\r\\n\\r\\n // Send each relayer refund address the associated refundAmount for the L2 token address.\\r\\n // Note: Even if the L2 token is not enabled on this spoke pool, we should still refund relayers.\\r\\n for (uint32 i = 0; i < relayerRefundLeaf.refundAmounts.length; i++) {\\r\\n uint256 amount = relayerRefundLeaf.refundAmounts[i];\\r\\n if (amount > 0)\\r\\n IERC20(relayerRefundLeaf.l2TokenAddress).safeTransfer(relayerRefundLeaf.refundAddresses[i], amount);\\r\\n }\\r\\n\\r\\n // If leaf's `amountToReturn` is positive, then send L2 --> L1 message to bridge tokens back via\\r\\n // chain-specific bridging method.\\r\\n if (relayerRefundLeaf.amountToReturn > 0) {\\r\\n _bridgeTokensToHubPool(relayerRefundLeaf);\\r\\n\\r\\n emit TokensBridged(\\r\\n relayerRefundLeaf.amountToReturn,\\r\\n relayerRefundLeaf.chainId,\\r\\n relayerRefundLeaf.leafId,\\r\\n relayerRefundLeaf.l2TokenAddress,\\r\\n msg.sender\\r\\n );\\r\\n }\\r\\n\\r\\n emit ExecutedRelayerRefundRoot(\\r\\n relayerRefundLeaf.amountToReturn,\\r\\n relayerRefundLeaf.chainId,\\r\\n relayerRefundLeaf.refundAmounts,\\r\\n rootBundleId,\\r\\n relayerRefundLeaf.leafId,\\r\\n relayerRefundLeaf.l2TokenAddress,\\r\\n relayerRefundLeaf.refundAddresses,\\r\\n msg.sender\\r\\n );\\r\\n }\\r\\n\\r\\n /**************************************\\r\\n * VIEW FUNCTIONS *\\r\\n **************************************/\\r\\n\\r\\n // Some L2s like ZKSync don't support the CHAIN_ID opcode so we allow the caller to manually set this.\\r\\n function chainId() public view virtual returns (uint256) {\\r\\n return block.chainid;\\r\\n }\\r\\n\\r\\n /**************************************\\r\\n * INTERNAL FUNCTIONS *\\r\\n **************************************/\\r\\n\\r\\n function _bridgeTokensToHubPool(SpokePoolInterface.RelayerRefundLeaf memory relayerRefundLeaf) internal virtual;\\r\\n\\r\\n // Allow L2 to implement chain specific recovering of signers from signatures because some L2s might not support\\r\\n // ecrecover, such as those with account abstraction like ZKSync.\\r\\n function _verifyDepositorUpdateFeeMessage(\\r\\n address depositor,\\r\\n bytes32 ethSignedMessageHash,\\r\\n bytes memory depositorSignature\\r\\n ) internal view virtual {\\r\\n // Note: no need to worry about reentrancy from contract deployed at `depositor` address since\\r\\n // `SignatureChecker.isValidSignatureNow` is a non state-modifying STATICCALL:\\r\\n // - https://github.com/OpenZeppelin/openzeppelin-contracts/blob/63b466901fb015538913f811c5112a2775042177/contracts/utils/cryptography/SignatureChecker.sol#L35\\r\\n // - https://github.com/ethereum/EIPs/pull/214\\r\\n require(\\r\\n SignatureChecker.isValidSignatureNow(depositor, ethSignedMessageHash, depositorSignature),\\r\\n \\\"invalid signature\\\"\\r\\n );\\r\\n }\\r\\n\\r\\n function _computeAmountPreFees(uint256 amount, uint64 feesPct) private pure returns (uint256) {\\r\\n return (1e18 * amount) / (1e18 - feesPct);\\r\\n }\\r\\n\\r\\n function _computeAmountPostFees(uint256 amount, uint64 feesPct) private pure returns (uint256) {\\r\\n return (amount * (1e18 - feesPct)) / 1e18;\\r\\n }\\r\\n\\r\\n // Should we make this public for the relayer's convenience?\\r\\n function _getRelayHash(SpokePoolInterface.RelayData memory relayData) private pure returns (bytes32) {\\r\\n return keccak256(abi.encode(relayData));\\r\\n }\\r\\n\\r\\n // Unwraps ETH and does a transfer to a recipient address. If the recipient is a smart contract then sends WETH.\\r\\n function _unwrapWETHTo(address payable to, uint256 amount) internal {\\r\\n if (address(to).isContract()) {\\r\\n IERC20(address(weth)).safeTransfer(to, amount);\\r\\n } else {\\r\\n weth.withdraw(amount);\\r\\n to.transfer(amount);\\r\\n }\\r\\n }\\r\\n\\r\\n // This internal method should be called by an external \\\"relayRootBundle\\\" function that validates the\\r\\n // cross domain sender is the HubPool. This validation step differs for each L2, which is why the implementation\\r\\n // specifics are left to the implementor of this abstract contract.\\r\\n // Once this method is executed and a distribution root is stored in this contract, then `distributeRootBundle`\\r\\n // can be called to execute each leaf in the root.\\r\\n function _relayRootBundle(bytes32 relayerRefundRoot, bytes32 slowRelayFulfillmentRoot) internal {\\r\\n uint32 rootBundleId = uint32(rootBundles.length);\\r\\n RootBundle storage rootBundle = rootBundles.push();\\r\\n rootBundle.relayerRefundRoot = relayerRefundRoot;\\r\\n rootBundle.slowRelayFulfillmentRoot = slowRelayFulfillmentRoot;\\r\\n emit RelayedRootBundle(rootBundleId, relayerRefundRoot, slowRelayFulfillmentRoot);\\r\\n }\\r\\n\\r\\n function _fillRelay(\\r\\n bytes32 relayHash,\\r\\n RelayData memory relayData,\\r\\n uint256 maxTokensToSend,\\r\\n uint64 updatableRelayerFeePct,\\r\\n bool isSlowRelay\\r\\n ) internal returns (uint256 fillAmountPreFees) {\\r\\n // We limit the relay fees to prevent the user spending all their funds on fees. Note that 0.5e18 (i.e. 50%)\\r\\n // fees are just magic numbers. The important point is to prevent the total fee from being 100%, otherwise\\r\\n // computing the amount pre fees runs into divide-by-0 issues.\\r\\n require(updatableRelayerFeePct < 0.5e18 && relayData.realizedLpFeePct < 0.5e18, \\\"invalid fees\\\");\\r\\n\\r\\n // Check that the relay has not already been completely filled. Note that the `relays` mapping will point to\\r\\n // the amount filled so far for a particular `relayHash`, so this will start at 0 and increment with each fill.\\r\\n require(relayFills[relayHash] < relayData.relayAmount, \\\"relay filled\\\");\\r\\n\\r\\n // Stores the equivalent amount to be sent by the relayer before fees have been taken out.\\r\\n fillAmountPreFees = 0;\\r\\n\\r\\n // Adding brackets \\\"stack too deep\\\" solidity error.\\r\\n if (maxTokensToSend > 0) {\\r\\n fillAmountPreFees = _computeAmountPreFees(\\r\\n maxTokensToSend,\\r\\n (relayData.realizedLpFeePct + updatableRelayerFeePct)\\r\\n );\\r\\n // If user's specified max amount to send is greater than the amount of the relay remaining pre-fees,\\r\\n // we'll pull exactly enough tokens to complete the relay.\\r\\n uint256 amountToSend = maxTokensToSend;\\r\\n if (relayData.relayAmount - relayFills[relayHash] < fillAmountPreFees) {\\r\\n fillAmountPreFees = relayData.relayAmount - relayFills[relayHash];\\r\\n amountToSend = _computeAmountPostFees(\\r\\n fillAmountPreFees,\\r\\n relayData.realizedLpFeePct + updatableRelayerFeePct\\r\\n );\\r\\n }\\r\\n relayFills[relayHash] += fillAmountPreFees;\\r\\n // If relay token is weth then unwrap and send eth.\\r\\n if (relayData.destinationToken == address(weth)) {\\r\\n // Note: WETH is already in the contract in the slow relay case.\\r\\n if (!isSlowRelay)\\r\\n IERC20(relayData.destinationToken).safeTransferFrom(msg.sender, address(this), amountToSend);\\r\\n _unwrapWETHTo(payable(relayData.recipient), amountToSend);\\r\\n // Else, this is a normal ERC20 token. Send to recipient.\\r\\n } else {\\r\\n // Note: send token directly from the contract to the user in the slow relay case.\\r\\n if (!isSlowRelay)\\r\\n IERC20(relayData.destinationToken).safeTransferFrom(msg.sender, relayData.recipient, amountToSend);\\r\\n else IERC20(relayData.destinationToken).safeTransfer(relayData.recipient, amountToSend);\\r\\n }\\r\\n }\\r\\n }\\r\\n\\r\\n function _emitFillRelay(\\r\\n bytes32 relayHash,\\r\\n uint256 fillAmount,\\r\\n uint256 repaymentChain,\\r\\n uint64 relayerFeePct,\\r\\n RelayData memory relayData\\r\\n ) internal {\\r\\n emit FilledRelay(\\r\\n relayHash,\\r\\n relayData.relayAmount,\\r\\n relayFills[relayHash],\\r\\n fillAmount,\\r\\n repaymentChain,\\r\\n relayData.originChainId,\\r\\n relayerFeePct,\\r\\n relayData.realizedLpFeePct,\\r\\n relayData.depositId,\\r\\n relayData.destinationToken,\\r\\n msg.sender,\\r\\n relayData.depositor,\\r\\n relayData.recipient\\r\\n );\\r\\n }\\r\\n\\r\\n function _emitExecutedSlowRelayFulfillmentRoot(\\r\\n bytes32 relayHash,\\r\\n uint256 fillAmount,\\r\\n RelayData memory relayData\\r\\n ) internal {\\r\\n emit ExecutedSlowRelayFulfillmentRoot(\\r\\n relayHash,\\r\\n relayData.relayAmount,\\r\\n relayFills[relayHash],\\r\\n fillAmount,\\r\\n relayData.originChainId,\\r\\n relayData.relayerFeePct,\\r\\n relayData.realizedLpFeePct,\\r\\n relayData.depositId,\\r\\n relayData.destinationToken,\\r\\n msg.sender,\\r\\n relayData.depositor,\\r\\n relayData.recipient\\r\\n );\\r\\n }\\r\\n\\r\\n // Added to enable the this contract to receive ETH. Used when unwrapping Weth.\\r\\n receive() external payable {}\\r\\n}\\r\\n\",\"keccak256\":\"0x43a82c41c699f74aafaff2f7a8ad3e32e06ffcd78c38e179c503aa4eaa40d53a\",\"license\":\"GPL-3.0-only\"},\"contracts/SpokePoolInterface.sol\":{\"content\":\"//SPDX-License-Identifier: Unlicense\\r\\npragma solidity ^0.8.0;\\r\\n\\r\\ninterface SpokePoolInterface {\\r\\n // This leaf is meant to be decoded in the SpokePool in order to pay out individual relayers for this bundle.\\r\\n struct RelayerRefundLeaf {\\r\\n // This is the amount to return to the HubPool. This occurs when there is a PoolRebalanceLeaf netSendAmount that is\\r\\n // negative. This is just that value inverted.\\r\\n uint256 amountToReturn;\\r\\n // Used to verify that this is being decoded on the correct chainId.\\r\\n uint256 chainId;\\r\\n // This array designates how much each of those addresses should be refunded.\\r\\n uint256[] refundAmounts;\\r\\n // Used as the index in the bitmap to track whether this leaf has been executed or not.\\r\\n uint32 leafId;\\r\\n // The associated L2TokenAddress that these claims apply to.\\r\\n address l2TokenAddress;\\r\\n // These two arrays must be the same length and are parallel arrays. They should be order by refundAddresses.\\r\\n // This array designates each address that must be refunded.\\r\\n address[] refundAddresses;\\r\\n }\\r\\n\\r\\n // This struct represents the data to fully-specify a relay. If any portion of this data differs, the relay is\\r\\n // considered to be completely distinct. Only one relay for a particular depositId, chainId pair should be\\r\\n // considered valid and repaid.\\r\\n struct RelayData {\\r\\n // The address that made the deposit on the origin chain.\\r\\n address depositor;\\r\\n // The recipient address on the destination chain.\\r\\n address recipient;\\r\\n // The corresponding token address on the destination chain.\\r\\n address destinationToken;\\r\\n // The total relay amount before fees are taken out.\\r\\n uint256 relayAmount;\\r\\n // Origin chain id.\\r\\n uint256 originChainId;\\r\\n // The LP Fee percentage computed by the relayer based on the deposit's quote timestamp\\r\\n // and the HubPool's utilization.\\r\\n uint64 realizedLpFeePct;\\r\\n // The relayer fee percentage specified in the deposit.\\r\\n uint64 relayerFeePct;\\r\\n // The id uniquely identifying this deposit on the origin chain.\\r\\n uint32 depositId;\\r\\n }\\r\\n\\r\\n function setCrossDomainAdmin(address newCrossDomainAdmin) external;\\r\\n\\r\\n function setHubPool(address newHubPool) external;\\r\\n\\r\\n function setEnableRoute(\\r\\n address originToken,\\r\\n uint256 destinationChainId,\\r\\n bool enable\\r\\n ) external;\\r\\n\\r\\n function setDepositQuoteTimeBuffer(uint32 buffer) external;\\r\\n\\r\\n function relayRootBundle(bytes32 relayerRefundRoot, bytes32 slowRelayRoot) external;\\r\\n}\\r\\n\",\"keccak256\":\"0xa420a9b5431195ecead66166fe4b316a0a1e86ad26514cdc6ace529e8941cf4d\",\"license\":\"Unlicense\"},\"contracts/interfaces/AdapterInterface.sol\":{\"content\":\"// SPDX-License-Identifier: AGPL-3.0-only\\npragma solidity ^0.8.0;\\n\\n/**\\n * @notice Sends cross chain messages and tokens to contracts on a specific L2 network.\\n */\\n\\ninterface AdapterInterface {\\n event HubPoolChanged(address newHubPool);\\n\\n event MessageRelayed(address target, bytes message);\\n\\n event TokensRelayed(address l1Token, address l2Token, uint256 amount, address to);\\n\\n function relayMessage(address target, bytes memory message) external payable;\\n\\n function relayTokens(\\n address l1Token,\\n address l2Token,\\n uint256 amount,\\n address to\\n ) external payable;\\n}\\n\",\"keccak256\":\"0x60e1ed2205f90655fe4152a90709be15bc9550fb3faeaf9835fee22c095bab11\",\"license\":\"AGPL-3.0-only\"},\"contracts/interfaces/WETH9.sol\":{\"content\":\"// SPDX-License-Identifier: GPL-3.0-only\\r\\npragma solidity ^0.8.0;\\r\\n\\r\\ninterface WETH9 {\\r\\n function withdraw(uint256 wad) external;\\r\\n\\r\\n function deposit() external payable;\\r\\n\\r\\n function balanceOf(address guy) external view returns (uint256 wad);\\r\\n\\r\\n function transfer(address guy, uint256 wad) external;\\r\\n}\\r\\n\",\"keccak256\":\"0x08755a7e4fc4ed75895c9b803f19552c4f0a455947dca04d86db4355114253b3\",\"license\":\"GPL-3.0-only\"}},\"version\":1}", - "bytecode": "0x60806040526003805463ffffffff60c01b1916604b60c31b1790553480156200002757600080fd5b5060405162004a1f38038062004a1f8339810160408190526200004a916200032d565b600080546001600160a81b0319166001600160a01b03831617600160a01b179055838383836200007a84620000e9565b62000085836200018f565b6200008f62000231565b600380546001600160a01b039094166001600160a01b031963ffffffff93909316600160a01b02929092166001600160c01b0319909416939093171790915550620000de9150869050620002c6565b5050505050620003b7565b6001600160a01b038116620001455760405162461bcd60e51b815260206004820152601960248201527f4261642062726964676520726f7574657220616464726573730000000000000060448201526064015b60405180910390fd5b600180546001600160a01b0319166001600160a01b0383169081179091556040517fa9e8c42c9e7fca7f62755189a16b2f5314d43d8fb24e91ba54e6d65f9314e84990600090a250565b6001600160a01b038116620001e75760405162461bcd60e51b815260206004820152601460248201527f4261642068756220706f6f6c206164647265737300000000000000000000000060448201526064016200013c565b600280546001600160a01b0319166001600160a01b0383169081179091556040517f1f17a88f67b0f49060a34bec1a4723a563620e6aa265eb640b5046dcee0759a090600090a250565b600080546001600160a01b031615620002c15760008054906101000a90046001600160a01b03166001600160a01b03166329cb924d6040518163ffffffff1660e01b8152600401602060405180830381865afa15801562000296573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190620002bc91906200039d565b905090565b504290565b600780546001600160a01b0319166001600160a01b0383169081179091556040517fdc4a5f4c066ad14c1306e624550b42395e08f992a76b416cc7b1ad11503d376c90600090a250565b80516001600160a01b03811681146200032857600080fd5b919050565b600080600080600060a086880312156200034657600080fd5b620003518662000310565b9450620003616020870162000310565b9350620003716040870162000310565b9250620003816060870162000310565b9150620003916080870162000310565b90509295509295909350565b600060208284031215620003b057600080fd5b5051919050565b61465880620003c76000396000f3fe6080604052600436106101bb5760003560e01c806389a153cc116100ec578063de7eba781161008a578063ee2a53f811610064578063ee2a53f8146105cb578063f06850f614610600578063fe45399c1461062d578063ffc351a31461064d57600080fd5b8063de7eba7814610549578063e190440214610569578063ecda10f51461059657600080fd5b8063ac9650d8116100c6578063ac9650d814610499578063c8356859146104b9578063c894c0ca146104e6578063daf9c2101461050657600080fd5b806389a153cc146104295780639a8a059214610449578063a1244c671461045c57600080fd5b80633fc8cef3116101595780634e3485c8116101335780634e3485c8146103435780635249fef1146103635780635285e058146103ae57806357f6dcb8146103db57600080fd5b80633fc8cef3146102e35780634922897814610310578063493a4f841461032357600080fd5b8063272751c711610195578063272751c7146102605780632752042e1461028057806329cb924d146102a0578063364f01a6146102c357600080fd5b80631c39c38d146101c75780631dfb2d021461021e57806322f8e5661461024057600080fd5b366101c257005b600080fd5b3480156101d357600080fd5b506000546101f49073ffffffffffffffffffffffffffffffffffffffff1681565b60405173ffffffffffffffffffffffffffffffffffffffff90911681526020015b60405180910390f35b34801561022a57600080fd5b5061023e6102393660046137b2565b61066d565b005b34801561024c57600080fd5b5061023e61025b3660046137cd565b6107c1565b34801561026c57600080fd5b5061023e61027b3660046137f4565b61086a565b34801561028c57600080fd5b5061023e61029b366004613848565b6109bd565b3480156102ac57600080fd5b506102b5610ac5565b604051908152602001610215565b3480156102cf57600080fd5b5061023e6102de366004613863565b610b7d565b3480156102ef57600080fd5b506003546101f49073ffffffffffffffffffffffffffffffffffffffff1681565b61023e61031e3660046138ae565b610cce565b34801561032f57600080fd5b5061023e61033e366004613914565b61117a565b34801561034f57600080fd5b5061023e61035e3660046137b2565b611283565b34801561036f57600080fd5b5061039e61037e366004613936565b600460209081526000928352604080842090915290825290205460ff1681565b6040519015158152602001610215565b3480156103ba57600080fd5b506001546101f49073ffffffffffffffffffffffffffffffffffffffff1681565b3480156103e757600080fd5b50600354610414907801000000000000000000000000000000000000000000000000900463ffffffff1681565b60405163ffffffff9091168152602001610215565b34801561043557600080fd5b5061023e610444366004613960565b61138b565b34801561045557600080fd5b50466102b5565b34801561046857600080fd5b50600354610414907c0100000000000000000000000000000000000000000000000000000000900463ffffffff1681565b6104ac6104a73660046139fe565b6114d9565b6040516102159190613ae9565b3480156104c557600080fd5b506007546101f49073ffffffffffffffffffffffffffffffffffffffff1681565b3480156104f257600080fd5b5061023e610501366004613d01565b6116b3565b34801561051257600080fd5b506101f46105213660046137b2565b60086020526000908152604090205473ffffffffffffffffffffffffffffffffffffffff1681565b34801561055557600080fd5b5061023e6105643660046137b2565b611b8d565b34801561057557600080fd5b506002546101f49073ffffffffffffffffffffffffffffffffffffffff1681565b3480156105a257600080fd5b506003546104149074010000000000000000000000000000000000000000900463ffffffff1681565b3480156105d757600080fd5b506105eb6105e63660046137cd565b611c95565b60408051928352602083019190915201610215565b34801561060c57600080fd5b506102b561061b3660046137cd565b60066020526000908152604090205481565b34801561063957600080fd5b5061023e610648366004613dfd565b611cc3565b34801561065957600080fd5b5061023e610668366004613f5b565b611ee5565b6001546106a39073ffffffffffffffffffffffffffffffffffffffff167311110000000000000000000000000000000011110190565b73ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161461073c576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601860248201527f4f4e4c595f434f554e544552504152545f47415445574159000000000000000060448201526064015b60405180910390fd5b6107446120cb565b610771600080547fffffffffffffffffffffff00ffffffffffffffffffffffffffffffffffffffff169055565b61077a81612151565b6107be600080547fffffffffffffffffffffff00ffffffffffffffffffffffffffffffffffffffff1674010000000000000000000000000000000000000000179055565b50565b60005473ffffffffffffffffffffffffffffffffffffffff166107e357600080fd5b6000546040517f22f8e5660000000000000000000000000000000000000000000000000000000081526004810183905273ffffffffffffffffffffffffffffffffffffffff909116906322f8e56690602401600060405180830381600087803b15801561084f57600080fd5b505af1158015610863573d6000803e3d6000fd5b5050505050565b6001546108a09073ffffffffffffffffffffffffffffffffffffffff167311110000000000000000000000000000000011110190565b73ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614610934576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601860248201527f4f4e4c595f434f554e544552504152545f4741544557415900000000000000006044820152606401610733565b61093c6120cb565b610969600080547fffffffffffffffffffffff00ffffffffffffffffffffffffffffffffffffffff169055565b61097483838361223d565b6109b8600080547fffffffffffffffffffffff00ffffffffffffffffffffffffffffffffffffffff1674010000000000000000000000000000000000000000179055565b505050565b6001546109f39073ffffffffffffffffffffffffffffffffffffffff167311110000000000000000000000000000000011110190565b73ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614610a87576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601860248201527f4f4e4c595f434f554e544552504152545f4741544557415900000000000000006044820152606401610733565b610a8f6120cb565b610abc600080547fffffffffffffffffffffff00ffffffffffffffffffffffffffffffffffffffff169055565b61077a816122d4565b6000805473ffffffffffffffffffffffffffffffffffffffff1615610b785760008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166329cb924d6040518163ffffffff1660e01b8152600401602060405180830381865afa158015610b4f573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610b739190614039565b905090565b504290565b600154610bb39073ffffffffffffffffffffffffffffffffffffffff167311110000000000000000000000000000000011110190565b73ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614610c47576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601860248201527f4f4e4c595f434f554e544552504152545f4741544557415900000000000000006044820152606401610733565b610c4f6120cb565b610c7c600080547fffffffffffffffffffffff00ffffffffffffffffffffffffffffffffffffffff169055565b610c86828261235b565b610cca600080547fffffffffffffffffffffff00ffffffffffffffffffffffffffffffffffffffff1674010000000000000000000000000000000000000000179055565b5050565b73ffffffffffffffffffffffffffffffffffffffff851660009081526004602090815260408083208684529091529020548590849060ff16610d6c576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152600e60248201527f44697361626c656420726f7574650000000000000000000000000000000000006044820152606401610733565b610d746120cb565b610da1600080547fffffffffffffffffffffff00ffffffffffffffffffffffffffffffffffffffff169055565b6706f05b59d3b200008467ffffffffffffffff161115610e1d576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601360248201527f696e76616c69642072656c6179657220666565000000000000000000000000006044820152606401610733565b600354610e4c907801000000000000000000000000000000000000000000000000900463ffffffff1684614081565b63ffffffff16610e5a610ac5565b10158015610ea35750600354610e92907801000000000000000000000000000000000000000000000000900463ffffffff16846140a6565b63ffffffff16610ea0610ac5565b11155b610f09576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601260248201527f696e76616c69642071756f74652074696d6500000000000000000000000000006044820152606401610733565b60035473ffffffffffffffffffffffffffffffffffffffff8881169116148015610f335750600034115b1561102957853414610fa1576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601b60248201527f6d73672e76616c7565206d757374206d6174636820616d6f756e7400000000006044820152606401610733565b600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663d0e30db0346040518263ffffffff1660e01b81526004016000604051808303818588803b15801561100b57600080fd5b505af115801561101f573d6000803e3d6000fd5b505050505061104b565b61104b73ffffffffffffffffffffffffffffffffffffffff88163330896123d7565b600354604080518881526020810188905267ffffffffffffffff87168183015263ffffffff868116606083015273ffffffffffffffffffffffffffffffffffffffff8c8116608084015292513394938c16937c01000000000000000000000000000000000000000000000000000000009004909116917ffc53c5b967d467d4136291c639720626f3d6dda97b4364da813e6858ad48a721919081900360a00190a460016003601c8282829054906101000a900463ffffffff1661110e91906140a6565b92506101000a81548163ffffffff021916908363ffffffff160217905550611170600080547fffffffffffffffffffffff00ffffffffffffffffffffffffffffffffffffffff1674010000000000000000000000000000000000000000179055565b5050505050505050565b6001546111b09073ffffffffffffffffffffffffffffffffffffffff167311110000000000000000000000000000000011110190565b73ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614611244576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601860248201527f4f4e4c595f434f554e544552504152545f4741544557415900000000000000006044820152606401610733565b61124c6120cb565b611279600080547fffffffffffffffffffffff00ffffffffffffffffffffffffffffffffffffffff169055565b610c8682826124b9565b6001546112b99073ffffffffffffffffffffffffffffffffffffffff167311110000000000000000000000000000000011110190565b73ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161461134d576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601860248201527f4f4e4c595f434f554e544552504152545f4741544557415900000000000000006044820152606401610733565b6113556120cb565b611382600080547fffffffffffffffffffffff00ffffffffffffffffffffffffffffffffffffffff169055565b61077a8161255f565b6113936120cb565b6113c0600080547fffffffffffffffffffffff00ffffffffffffffffffffffffffffffffffffffff169055565b60006040518061010001604052808c73ffffffffffffffffffffffffffffffffffffffff1681526020018b73ffffffffffffffffffffffffffffffffffffffff1681526020018a73ffffffffffffffffffffffffffffffffffffffff1681526020018981526020018681526020018567ffffffffffffffff1681526020018467ffffffffffffffff1681526020018363ffffffff1681525090506000611465826125ce565b9050600061147782848b8860006125fe565b905061148682828a88876128a1565b5050506114cd600080547fffffffffffffffffffffff00ffffffffffffffffffffffffffffffffffffffff1674010000000000000000000000000000000000000000179055565b50505050505050505050565b60603415611543576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601b60248201527f4f6e6c79206d756c746963616c6c207769746820302076616c756500000000006044820152606401610733565b8167ffffffffffffffff81111561155c5761155c613b69565b60405190808252806020026020018201604052801561158f57816020015b606081526020019060019003908161157a5790505b50905060005b828110156116ac57600080308686858181106115b3576115b36140ce565b90506020028101906115c591906140fd565b6040516115d3929190614162565b600060405180830381855af49150503d806000811461160e576040519150601f19603f3d011682016040523d82523d6000602084013e611613565b606091505b5091509150816116795760448151101561162c57600080fd5b6004810190508080602001905181019061164691906141a2565b6040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161073391906141f3565b8084848151811061168c5761168c6140ce565b6020026020010181905250505080806116a490614206565b915050611595565b5092915050565b6116bb6120cb565b6116e8600080547fffffffffffffffffffffff00ffffffffffffffffffffffffffffffffffffffff169055565b46826020015114611755576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152600f60248201527f496e76616c696420636861696e496400000000000000000000000000000000006044820152606401610733565b8160400151518260a0015151146117c8576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152600c60248201527f696e76616c6964206c65616600000000000000000000000000000000000000006044820152606401610733565b600060058463ffffffff16815481106117e3576117e36140ce565b90600052602060002090600302019050611802816001015484846129a6565b611868576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152600960248201527f4261642050726f6f6600000000000000000000000000000000000000000000006044820152606401610733565b61187f81600201846060015163ffffffff166129e3565b156118e6576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152600f60248201527f416c726561647920636c61696d656400000000000000000000000000000000006044820152606401610733565b6118fd81600201846060015163ffffffff16612a24565b471561198757600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663d0e30db0476040518263ffffffff1660e01b81526004016000604051808303818588803b15801561196d57600080fd5b505af1158015611981573d6000803e3d6000fd5b50505050505b60005b8360400151518163ffffffff161015611a3357600084604001518263ffffffff16815181106119bb576119bb6140ce565b602002602001015190506000811115611a2057611a208560a001518363ffffffff16815181106119ed576119ed6140ce565b602002602001015182876080015173ffffffffffffffffffffffffffffffffffffffff16612a629092919063ffffffff16565b5080611a2b8161423f565b91505061198a565b50825115611acc57611a4483612ab8565b826080015173ffffffffffffffffffffffffffffffffffffffff16836060015163ffffffff1684602001517f828fc203220356df8f072a91681caee7d5c75095e2a95e80ed5a14b384697f71866000015133604051611ac392919091825273ffffffffffffffffffffffffffffffffffffffff16602082015260400190565b60405180910390a45b3373ffffffffffffffffffffffffffffffffffffffff16836060015163ffffffff168563ffffffff167ff8bd640004bcec1b89657020f561d0b070cbdf662d0b158db9dccb0a8301bfab86600001518760200151886040015189608001518a60a00151604051611b409594939291906142e4565b60405180910390a4506109b8600080547fffffffffffffffffffffff00ffffffffffffffffffffffffffffffffffffffff1674010000000000000000000000000000000000000000179055565b600154611bc39073ffffffffffffffffffffffffffffffffffffffff167311110000000000000000000000000000000011110190565b73ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614611c57576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601860248201527f4f4e4c595f434f554e544552504152545f4741544557415900000000000000006044820152606401610733565b611c5f6120cb565b611c8c600080547fffffffffffffffffffffff00ffffffffffffffffffffffffffffffffffffffff169055565b61077a81612c06565b60058181548110611ca557600080fd5b60009182526020909120600390910201805460019091015490915082565b611ccb6120cb565b611cf8600080547fffffffffffffffffffffff00ffffffffffffffffffffffffffffffffffffffff169055565b60006040518061010001604052808c73ffffffffffffffffffffffffffffffffffffffff1681526020018b73ffffffffffffffffffffffffffffffffffffffff1681526020018a73ffffffffffffffffffffffffffffffffffffffff1681526020018981526020018881526020018767ffffffffffffffff1681526020018667ffffffffffffffff1681526020018563ffffffff168152509050611dc760058463ffffffff1681548110611dae57611dae6140ce565b9060005260206000209060030201600001548284612cf2565b611e2d576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152600d60248201527f496e76616c69642070726f6f66000000000000000000000000000000000000006044820152606401610733565b6000611e38826125ce565b90504715611ec457600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663d0e30db0476040518263ffffffff1660e01b81526004016000604051808303818588803b158015611eaa57600080fd5b505af1158015611ebe573d6000803e3d6000fd5b50505050505b6000611ed8828485606001518a60016125fe565b9050611486828285612d0a565b611eed6120cb565b611f1a600080547fffffffffffffffffffffff00ffffffffffffffffffffffffffffffffffffffff169055565b60408051608060208201819052601160a08301527f4143524f53532d56322d4645452d312e3000000000000000000000000000000060c083015267ffffffffffffffff86169282019290925263ffffffff8416606082015290810187905260009060e0016040516020818303038152906040528051906020012090506000611fa182612e03565b9050611fae8e8285612e3e565b505060006040518061010001604052808e73ffffffffffffffffffffffffffffffffffffffff1681526020018d73ffffffffffffffffffffffffffffffffffffffff1681526020018c73ffffffffffffffffffffffffffffffffffffffff1681526020018b81526020018881526020018767ffffffffffffffff1681526020018667ffffffffffffffff1681526020018463ffffffff1681525090506000612055826125ce565b9050600061206782848d8960006125fe565b905061207682828c89876128a1565b5050506120bd600080547fffffffffffffffffffffff00ffffffffffffffffffffffffffffffffffffffff1674010000000000000000000000000000000000000000179055565b505050505050505050505050565b60005474010000000000000000000000000000000000000000900460ff1661214f576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601f60248201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c006044820152606401610733565b565b73ffffffffffffffffffffffffffffffffffffffff81166121ce576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601460248201527f4261642068756220706f6f6c20616464726573730000000000000000000000006044820152606401610733565b600280547fffffffffffffffffffffffff00000000000000000000000000000000000000001673ffffffffffffffffffffffffffffffffffffffff83169081179091556040517f1f17a88f67b0f49060a34bec1a4723a563620e6aa265eb640b5046dcee0759a090600090a250565b73ffffffffffffffffffffffffffffffffffffffff8316600081815260046020908152604080832086845282529182902080547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff001685151590811790915591519182528492917f0a21fdd43d0ad0c62689ee7230a47309a050755bcc52eba00310add65297692a91015b60405180910390a3505050565b600380547fffffffff00000000ffffffffffffffffffffffffffffffffffffffffffffffff16780100000000000000000000000000000000000000000000000063ffffffff8416908102919091179091556040519081527f0e55dd180fa793d9036c804d0a116e6a7617a48e72cee1f83d92793a793fcc039060200160405180910390a150565b73ffffffffffffffffffffffffffffffffffffffff82811660008181526008602052604080822080547fffffffffffffffffffffffff0000000000000000000000000000000000000000169486169485179055517f8d7f294eaa476236fe8cb5629376a12cd37dace3d21e6a7b98f1641c4ed5f09e9190a35050565b60405173ffffffffffffffffffffffffffffffffffffffff808516602483015283166044820152606481018290526124b39085907f23b872dd00000000000000000000000000000000000000000000000000000000906084015b604080517fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe08184030181529190526020810180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff167fffffffff0000000000000000000000000000000000000000000000000000000090931692909217909152612eaf565b50505050565b60058054600181018255600091909152600381027f036b6384b5eca791c62761152d0c79bb0604c104a5fb6f4eb0703f3154bb3db181018490557f036b6384b5eca791c62761152d0c79bb0604c104a5fb6f4eb0703f3154bb3db001828155604080518581526020810185905263ffffffff8416917fc86ba04c55bc5eb2f2876b91c438849a296dbec7b08751c3074d92e04f0a77af910160405180910390a250505050565b600780547fffffffffffffffffffffffff00000000000000000000000000000000000000001673ffffffffffffffffffffffffffffffffffffffff83169081179091556040517fdc4a5f4c066ad14c1306e624550b42395e08f992a76b416cc7b1ad11503d376c90600090a250565b6000816040516020016125e19190614331565b604051602081830303815290604052805190602001209050919050565b60006706f05b59d3b200008367ffffffffffffffff1610801561263657506706f05b59d3b200008560a0015167ffffffffffffffff16105b61269c576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152600c60248201527f696e76616c6964206665657300000000000000000000000000000000000000006044820152606401610733565b606085015160008781526006602052604090205410612717576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152600c60248201527f72656c61792066696c6c656400000000000000000000000000000000000000006044820152606401610733565b50600083156128985761273984848760a0015161273491906143bd565b612fbb565b60008781526006602052604090205460608701519192508591839161275d916143e0565b101561279f57600087815260066020526040902054606087015161278191906143e0565b915061279c82858860a0015161279791906143bd565b612ff5565b90505b600087815260066020526040812080548492906127bd9084906143f7565b9091555050600354604087015173ffffffffffffffffffffffffffffffffffffffff9081169116141561282957826128165760408601516128169073ffffffffffffffffffffffffffffffffffffffff163330846123d7565b61282486602001518261301e565b612896565b826128635761282433876020015183896040015173ffffffffffffffffffffffffffffffffffffffff166123d7909392919063ffffffff16565b612896866020015182886040015173ffffffffffffffffffffffffffffffffffffffff16612a629092919063ffffffff16565b505b95945050505050565b3373ffffffffffffffffffffffffffffffffffffffff1683867f393f1765f382b5310a9186fa707a84040f8241b280a30b74112689a92a156f698460600151600660008b815260200190815260200160002054898760800151898960a001518a60e001518b604001518c600001518d602001516040516129979a99989796959493929190998a5260208a01989098526040890196909652606088019490945267ffffffffffffffff9283166080880152911660a086015263ffffffff1660c085015273ffffffffffffffffffffffffffffffffffffffff90811660e0850152908116610100840152166101208201526101400190565b60405180910390a45050505050565b60006129d98285856040516020016129be919061440f565b60405160208183030381529060405280519060200120613126565b90505b9392505050565b6000806129f2610100846144d9565b90506000612a02610100856144ed565b6000928352602095909552506040902054600190931b92831690921492915050565b6000612a32610100836144d9565b90506000612a42610100846144ed565b600092835260209490945250604090208054600190931b90921790915550565b60405173ffffffffffffffffffffffffffffffffffffffff83166024820152604481018290526109b89084907fa9059cbb0000000000000000000000000000000000000000000000000000000090606401612431565b60075460808281015173ffffffffffffffffffffffffffffffffffffffff90811660009081526008602052604080822054600254875192517f7b3a3c8b00000000000000000000000000000000000000000000000000000000815291851660048301528416602482015260448101919091526064810193909352608483015290911690637b3a3c8b9060a4016000604051808303816000875af1158015612b63573d6000803e3d6000fd5b505050506040513d6000823e601f3d9081017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0168201604052612ba991908101906141a2565b5060025481516040805173ffffffffffffffffffffffffffffffffffffffff909316835260208301919091526000917f997d81a0a8415d688a6c319736602098252bf6445e0e879326f682f11928e317910160405180910390a250565b73ffffffffffffffffffffffffffffffffffffffff8116612c83576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601960248201527f4261642062726964676520726f757465722061646472657373000000000000006044820152606401610733565b600180547fffffffffffffffffffffffff00000000000000000000000000000000000000001673ffffffffffffffffffffffffffffffffffffffff83169081179091556040517fa9e8c42c9e7fca7f62755189a16b2f5314d43d8fb24e91ba54e6d65f9314e84990600090a250565b60006129d98285856040516020016129be9190614331565b3373ffffffffffffffffffffffffffffffffffffffff16837fc1c02fe71abee2530563583daac3d7b681ef4c00db95adc3847b886da8098bc1836060015160066000888152602001908152602001600020548686608001518760c001518860a001518960e001518a604001518b600001518c602001516040516122c79a99989796959493929190998a5260208a01989098526040890196909652606088019490945267ffffffffffffffff9283166080880152911660a086015263ffffffff1660c085015273ffffffffffffffffffffffffffffffffffffffff90811660e0850152908116610100840152166101208201526101400190565b6040517f19457468657265756d205369676e6564204d6573736167653a0a3332000000006020820152603c8101829052600090605c016125e1565b612e4983838361313c565b6109b8576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601160248201527f696e76616c6964207369676e61747572650000000000000000000000000000006044820152606401610733565b6000612f11826040518060400160405280602081526020017f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c65648152508573ffffffffffffffffffffffffffffffffffffffff1661332b9092919063ffffffff16565b8051909150156109b85780806020019051810190612f2f9190614501565b6109b8576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602a60248201527f5361666545524332303a204552433230206f7065726174696f6e20646964206e60448201527f6f742073756363656564000000000000000000000000000000000000000000006064820152608401610733565b6000612fcf82670de0b6b3a764000061451e565b67ffffffffffffffff16612feb84670de0b6b3a764000061453f565b6129dc91906144d9565b6000670de0b6b3a764000061300a838261451e565b612feb9067ffffffffffffffff168561453f565b73ffffffffffffffffffffffffffffffffffffffff82163b1561305f57600354610cca9073ffffffffffffffffffffffffffffffffffffffff168383612a62565b6003546040517f2e1a7d4d0000000000000000000000000000000000000000000000000000000081526004810183905273ffffffffffffffffffffffffffffffffffffffff90911690632e1a7d4d90602401600060405180830381600087803b1580156130cb57600080fd5b505af11580156130df573d6000803e3d6000fd5b505060405173ffffffffffffffffffffffffffffffffffffffff8516925083156108fc02915083906000818181858888f193505050501580156109b8573d6000803e3d6000fd5b600082613133858461333a565b14949350505050565b600080600061314b85856133e6565b909250905060008160048111156131645761316461457c565b14801561319c57508573ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff16145b156131ac576001925050506129dc565b6000808773ffffffffffffffffffffffffffffffffffffffff16631626ba7e60e01b88886040516024016131e19291906145ab565b604080517fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe08184030181529181526020820180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff167fffffffff0000000000000000000000000000000000000000000000000000000090941693909317909252905161326a91906145c4565b600060405180830381855afa9150503d80600081146132a5576040519150601f19603f3d011682016040523d82523d6000602084013e6132aa565b606091505b50915091508180156132bd575080516020145b801561331f575080517f1626ba7e00000000000000000000000000000000000000000000000000000000906132fb90830160209081019084016145e0565b7fffffffff0000000000000000000000000000000000000000000000000000000016145b98975050505050505050565b60606129d98484600085613456565b600081815b84518110156133de57600085828151811061335c5761335c6140ce565b6020026020010151905080831161339e5760408051602081018590529081018290526060016040516020818303038152906040528051906020012092506133cb565b60408051602081018390529081018490526060016040516020818303038152906040528051906020012092505b50806133d681614206565b91505061333f565b509392505050565b60008082516041141561341d5760208301516040840151606085015160001a613411878285856135d6565b9450945050505061344f565b825160401415613447576020830151604084015161343c8683836136ee565b93509350505061344f565b506000905060025b9250929050565b6060824710156134e8576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602660248201527f416464726573733a20696e73756666696369656e742062616c616e636520666f60448201527f722063616c6c00000000000000000000000000000000000000000000000000006064820152608401610733565b843b613550576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e74726163740000006044820152606401610733565b6000808673ffffffffffffffffffffffffffffffffffffffff16858760405161357991906145c4565b60006040518083038185875af1925050503d80600081146135b6576040519150601f19603f3d011682016040523d82523d6000602084013e6135bb565b606091505b50915091506135cb828286613736565b979650505050505050565b6000807f7fffffffffffffffffffffffffffffff5d576e7357a4501ddfe92f46681b20a083111561360d57506000905060036136e5565b8460ff16601b1415801561362557508460ff16601c14155b1561363657506000905060046136e5565b6040805160008082526020820180845289905260ff881692820192909252606081018690526080810185905260019060a0016020604051602081039080840390855afa15801561368a573d6000803e3d6000fd5b50506040517fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0015191505073ffffffffffffffffffffffffffffffffffffffff81166136de576000600192509250506136e5565b9150600090505b94509492505050565b6000807f7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff831660ff84901c601b01613728878288856135d6565b935093505050935093915050565b606083156137455750816129dc565b8251156137555782518084602001fd5b816040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161073391906141f3565b803573ffffffffffffffffffffffffffffffffffffffff811681146137ad57600080fd5b919050565b6000602082840312156137c457600080fd5b6129dc82613789565b6000602082840312156137df57600080fd5b5035919050565b80151581146107be57600080fd5b60008060006060848603121561380957600080fd5b61381284613789565b9250602084013591506040840135613829816137e6565b809150509250925092565b803563ffffffff811681146137ad57600080fd5b60006020828403121561385a57600080fd5b6129dc82613834565b6000806040838503121561387657600080fd5b61387f83613789565b915061388d60208401613789565b90509250929050565b803567ffffffffffffffff811681146137ad57600080fd5b60008060008060008060c087890312156138c757600080fd5b6138d087613789565b95506138de60208801613789565b945060408701359350606087013592506138fa60808801613896565b915061390860a08801613834565b90509295509295509295565b6000806040838503121561392757600080fd5b50508035926020909101359150565b6000806040838503121561394957600080fd5b61395283613789565b946020939093013593505050565b6000806000806000806000806000806101408b8d03121561398057600080fd5b6139898b613789565b995061399760208c01613789565b98506139a560408c01613789565b975060608b0135965060808b0135955060a08b0135945060c08b013593506139cf60e08c01613896565b92506139de6101008c01613896565b91506139ed6101208c01613834565b90509295989b9194979a5092959850565b60008060208385031215613a1157600080fd5b823567ffffffffffffffff80821115613a2957600080fd5b818501915085601f830112613a3d57600080fd5b813581811115613a4c57600080fd5b8660208260051b8501011115613a6157600080fd5b60209290920196919550909350505050565b60005b83811015613a8e578181015183820152602001613a76565b838111156124b35750506000910152565b60008151808452613ab7816020860160208601613a73565b601f017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0169290920160200192915050565b6000602080830181845280855180835260408601915060408160051b870101925083870160005b82811015613b5c577fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc0888603018452613b4a858351613a9f565b94509285019290850190600101613b10565b5092979650505050505050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b60405160c0810167ffffffffffffffff81118282101715613bbb57613bbb613b69565b60405290565b604051601f82017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe016810167ffffffffffffffff81118282101715613c0857613c08613b69565b604052919050565b600067ffffffffffffffff821115613c2a57613c2a613b69565b5060051b60200190565b600082601f830112613c4557600080fd5b81356020613c5a613c5583613c10565b613bc1565b82815260059290921b84018101918181019086841115613c7957600080fd5b8286015b84811015613c945780358352918301918301613c7d565b509695505050505050565b600082601f830112613cb057600080fd5b81356020613cc0613c5583613c10565b82815260059290921b84018101918181019086841115613cdf57600080fd5b8286015b84811015613c9457613cf481613789565b8352918301918301613ce3565b600080600060608486031215613d1657600080fd5b613d1f84613834565b9250602084013567ffffffffffffffff80821115613d3c57600080fd5b9085019060c08288031215613d5057600080fd5b613d58613b98565b8235815260208301356020820152604083013582811115613d7857600080fd5b613d8489828601613c34565b604083015250613d9660608401613834565b6060820152613da760808401613789565b608082015260a083013582811115613dbe57600080fd5b613dca89828601613c9f565b60a08301525093506040860135915080821115613de657600080fd5b50613df386828701613c34565b9150509250925092565b6000806000806000806000806000806101408b8d031215613e1d57600080fd5b613e268b613789565b9950613e3460208c01613789565b9850613e4260408c01613789565b975060608b0135965060808b01359550613e5e60a08c01613896565b9450613e6c60c08c01613896565b9350613e7a60e08c01613834565b9250613e896101008c01613834565b91506101208b013567ffffffffffffffff811115613ea657600080fd5b613eb28d828e01613c34565b9150509295989b9194979a5092959850565b600067ffffffffffffffff821115613ede57613ede613b69565b50601f017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe01660200190565b600082601f830112613f1b57600080fd5b8135613f29613c5582613ec4565b818152846020838601011115613f3e57600080fd5b816020850160208301376000918101602001919091529392505050565b6000806000806000806000806000806000806101808d8f031215613f7e57600080fd5b613f878d613789565b9b50613f9560208e01613789565b9a50613fa360408e01613789565b995060608d0135985060808d0135975060a08d0135965060c08d01359550613fcd60e08e01613896565b9450613fdc6101008e01613896565b9350613feb6101208e01613896565b9250613ffa6101408e01613834565b915067ffffffffffffffff6101608e0135111561401657600080fd5b6140278e6101608f01358f01613f0a565b90509295989b509295989b509295989b565b60006020828403121561404b57600080fd5b5051919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b600063ffffffff8381169083168181101561409e5761409e614052565b039392505050565b600063ffffffff8083168185168083038211156140c5576140c5614052565b01949350505050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b60008083357fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe184360301811261413257600080fd5b83018035915067ffffffffffffffff82111561414d57600080fd5b60200191503681900382131561344f57600080fd5b8183823760009101908152919050565b6000614180613c5584613ec4565b905082815283838301111561419457600080fd5b6129dc836020830184613a73565b6000602082840312156141b457600080fd5b815167ffffffffffffffff8111156141cb57600080fd5b8201601f810184136141dc57600080fd5b6141eb84825160208401614172565b949350505050565b6020815260006129dc6020830184613a9f565b60007fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff82141561423857614238614052565b5060010190565b600063ffffffff8083168181141561425957614259614052565b6001019392505050565b600081518084526020808501945080840160005b8381101561429357815187529582019590820190600101614277565b509495945050505050565b600081518084526020808501945080840160005b8381101561429357815173ffffffffffffffffffffffffffffffffffffffff16875295820195908201906001016142b2565b85815284602082015260a06040820152600061430360a0830186614263565b73ffffffffffffffffffffffffffffffffffffffff85166060840152828103608084015261331f818561429e565b60006101008201905073ffffffffffffffffffffffffffffffffffffffff80845116835280602085015116602084015280604085015116604084015250606083015160608301526080830151608083015260a083015167ffffffffffffffff80821660a08501528060c08601511660c0850152505060e08301516116ac60e084018263ffffffff169052565b600067ffffffffffffffff8083168185168083038211156140c5576140c5614052565b6000828210156143f2576143f2614052565b500390565b6000821982111561440a5761440a614052565b500190565b6020815281516020820152602082015160408201526000604083015160c0606084015261443f60e0840182614263565b905063ffffffff606085015116608084015273ffffffffffffffffffffffffffffffffffffffff60808501511660a084015260a08401517fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe08483030160c0850152612898828261429e565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601260045260246000fd5b6000826144e8576144e86144aa565b500490565b6000826144fc576144fc6144aa565b500690565b60006020828403121561451357600080fd5b81516129dc816137e6565b600067ffffffffffffffff8381169083168181101561409e5761409e614052565b6000817fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff048311821515161561457757614577614052565b500290565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052602160045260246000fd5b8281526040602082015260006129d96040830184613a9f565b600082516145d6818460208701613a73565b9190910192915050565b6000602082840312156145f257600080fd5b81517fffffffff00000000000000000000000000000000000000000000000000000000811681146129dc57600080fdfea2646970667358221220edfd6b208ac3f4c53e37d85d8f6b559f44f72c704bc408457422327a2f806f6364736f6c634300080b0033", - "deployedBytecode": "0x6080604052600436106101bb5760003560e01c806389a153cc116100ec578063de7eba781161008a578063ee2a53f811610064578063ee2a53f8146105cb578063f06850f614610600578063fe45399c1461062d578063ffc351a31461064d57600080fd5b8063de7eba7814610549578063e190440214610569578063ecda10f51461059657600080fd5b8063ac9650d8116100c6578063ac9650d814610499578063c8356859146104b9578063c894c0ca146104e6578063daf9c2101461050657600080fd5b806389a153cc146104295780639a8a059214610449578063a1244c671461045c57600080fd5b80633fc8cef3116101595780634e3485c8116101335780634e3485c8146103435780635249fef1146103635780635285e058146103ae57806357f6dcb8146103db57600080fd5b80633fc8cef3146102e35780634922897814610310578063493a4f841461032357600080fd5b8063272751c711610195578063272751c7146102605780632752042e1461028057806329cb924d146102a0578063364f01a6146102c357600080fd5b80631c39c38d146101c75780631dfb2d021461021e57806322f8e5661461024057600080fd5b366101c257005b600080fd5b3480156101d357600080fd5b506000546101f49073ffffffffffffffffffffffffffffffffffffffff1681565b60405173ffffffffffffffffffffffffffffffffffffffff90911681526020015b60405180910390f35b34801561022a57600080fd5b5061023e6102393660046137b2565b61066d565b005b34801561024c57600080fd5b5061023e61025b3660046137cd565b6107c1565b34801561026c57600080fd5b5061023e61027b3660046137f4565b61086a565b34801561028c57600080fd5b5061023e61029b366004613848565b6109bd565b3480156102ac57600080fd5b506102b5610ac5565b604051908152602001610215565b3480156102cf57600080fd5b5061023e6102de366004613863565b610b7d565b3480156102ef57600080fd5b506003546101f49073ffffffffffffffffffffffffffffffffffffffff1681565b61023e61031e3660046138ae565b610cce565b34801561032f57600080fd5b5061023e61033e366004613914565b61117a565b34801561034f57600080fd5b5061023e61035e3660046137b2565b611283565b34801561036f57600080fd5b5061039e61037e366004613936565b600460209081526000928352604080842090915290825290205460ff1681565b6040519015158152602001610215565b3480156103ba57600080fd5b506001546101f49073ffffffffffffffffffffffffffffffffffffffff1681565b3480156103e757600080fd5b50600354610414907801000000000000000000000000000000000000000000000000900463ffffffff1681565b60405163ffffffff9091168152602001610215565b34801561043557600080fd5b5061023e610444366004613960565b61138b565b34801561045557600080fd5b50466102b5565b34801561046857600080fd5b50600354610414907c0100000000000000000000000000000000000000000000000000000000900463ffffffff1681565b6104ac6104a73660046139fe565b6114d9565b6040516102159190613ae9565b3480156104c557600080fd5b506007546101f49073ffffffffffffffffffffffffffffffffffffffff1681565b3480156104f257600080fd5b5061023e610501366004613d01565b6116b3565b34801561051257600080fd5b506101f46105213660046137b2565b60086020526000908152604090205473ffffffffffffffffffffffffffffffffffffffff1681565b34801561055557600080fd5b5061023e6105643660046137b2565b611b8d565b34801561057557600080fd5b506002546101f49073ffffffffffffffffffffffffffffffffffffffff1681565b3480156105a257600080fd5b506003546104149074010000000000000000000000000000000000000000900463ffffffff1681565b3480156105d757600080fd5b506105eb6105e63660046137cd565b611c95565b60408051928352602083019190915201610215565b34801561060c57600080fd5b506102b561061b3660046137cd565b60066020526000908152604090205481565b34801561063957600080fd5b5061023e610648366004613dfd565b611cc3565b34801561065957600080fd5b5061023e610668366004613f5b565b611ee5565b6001546106a39073ffffffffffffffffffffffffffffffffffffffff167311110000000000000000000000000000000011110190565b73ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161461073c576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601860248201527f4f4e4c595f434f554e544552504152545f47415445574159000000000000000060448201526064015b60405180910390fd5b6107446120cb565b610771600080547fffffffffffffffffffffff00ffffffffffffffffffffffffffffffffffffffff169055565b61077a81612151565b6107be600080547fffffffffffffffffffffff00ffffffffffffffffffffffffffffffffffffffff1674010000000000000000000000000000000000000000179055565b50565b60005473ffffffffffffffffffffffffffffffffffffffff166107e357600080fd5b6000546040517f22f8e5660000000000000000000000000000000000000000000000000000000081526004810183905273ffffffffffffffffffffffffffffffffffffffff909116906322f8e56690602401600060405180830381600087803b15801561084f57600080fd5b505af1158015610863573d6000803e3d6000fd5b5050505050565b6001546108a09073ffffffffffffffffffffffffffffffffffffffff167311110000000000000000000000000000000011110190565b73ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614610934576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601860248201527f4f4e4c595f434f554e544552504152545f4741544557415900000000000000006044820152606401610733565b61093c6120cb565b610969600080547fffffffffffffffffffffff00ffffffffffffffffffffffffffffffffffffffff169055565b61097483838361223d565b6109b8600080547fffffffffffffffffffffff00ffffffffffffffffffffffffffffffffffffffff1674010000000000000000000000000000000000000000179055565b505050565b6001546109f39073ffffffffffffffffffffffffffffffffffffffff167311110000000000000000000000000000000011110190565b73ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614610a87576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601860248201527f4f4e4c595f434f554e544552504152545f4741544557415900000000000000006044820152606401610733565b610a8f6120cb565b610abc600080547fffffffffffffffffffffff00ffffffffffffffffffffffffffffffffffffffff169055565b61077a816122d4565b6000805473ffffffffffffffffffffffffffffffffffffffff1615610b785760008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166329cb924d6040518163ffffffff1660e01b8152600401602060405180830381865afa158015610b4f573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610b739190614039565b905090565b504290565b600154610bb39073ffffffffffffffffffffffffffffffffffffffff167311110000000000000000000000000000000011110190565b73ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614610c47576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601860248201527f4f4e4c595f434f554e544552504152545f4741544557415900000000000000006044820152606401610733565b610c4f6120cb565b610c7c600080547fffffffffffffffffffffff00ffffffffffffffffffffffffffffffffffffffff169055565b610c86828261235b565b610cca600080547fffffffffffffffffffffff00ffffffffffffffffffffffffffffffffffffffff1674010000000000000000000000000000000000000000179055565b5050565b73ffffffffffffffffffffffffffffffffffffffff851660009081526004602090815260408083208684529091529020548590849060ff16610d6c576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152600e60248201527f44697361626c656420726f7574650000000000000000000000000000000000006044820152606401610733565b610d746120cb565b610da1600080547fffffffffffffffffffffff00ffffffffffffffffffffffffffffffffffffffff169055565b6706f05b59d3b200008467ffffffffffffffff161115610e1d576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601360248201527f696e76616c69642072656c6179657220666565000000000000000000000000006044820152606401610733565b600354610e4c907801000000000000000000000000000000000000000000000000900463ffffffff1684614081565b63ffffffff16610e5a610ac5565b10158015610ea35750600354610e92907801000000000000000000000000000000000000000000000000900463ffffffff16846140a6565b63ffffffff16610ea0610ac5565b11155b610f09576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601260248201527f696e76616c69642071756f74652074696d6500000000000000000000000000006044820152606401610733565b60035473ffffffffffffffffffffffffffffffffffffffff8881169116148015610f335750600034115b1561102957853414610fa1576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601b60248201527f6d73672e76616c7565206d757374206d6174636820616d6f756e7400000000006044820152606401610733565b600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663d0e30db0346040518263ffffffff1660e01b81526004016000604051808303818588803b15801561100b57600080fd5b505af115801561101f573d6000803e3d6000fd5b505050505061104b565b61104b73ffffffffffffffffffffffffffffffffffffffff88163330896123d7565b600354604080518881526020810188905267ffffffffffffffff87168183015263ffffffff868116606083015273ffffffffffffffffffffffffffffffffffffffff8c8116608084015292513394938c16937c01000000000000000000000000000000000000000000000000000000009004909116917ffc53c5b967d467d4136291c639720626f3d6dda97b4364da813e6858ad48a721919081900360a00190a460016003601c8282829054906101000a900463ffffffff1661110e91906140a6565b92506101000a81548163ffffffff021916908363ffffffff160217905550611170600080547fffffffffffffffffffffff00ffffffffffffffffffffffffffffffffffffffff1674010000000000000000000000000000000000000000179055565b5050505050505050565b6001546111b09073ffffffffffffffffffffffffffffffffffffffff167311110000000000000000000000000000000011110190565b73ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614611244576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601860248201527f4f4e4c595f434f554e544552504152545f4741544557415900000000000000006044820152606401610733565b61124c6120cb565b611279600080547fffffffffffffffffffffff00ffffffffffffffffffffffffffffffffffffffff169055565b610c8682826124b9565b6001546112b99073ffffffffffffffffffffffffffffffffffffffff167311110000000000000000000000000000000011110190565b73ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161461134d576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601860248201527f4f4e4c595f434f554e544552504152545f4741544557415900000000000000006044820152606401610733565b6113556120cb565b611382600080547fffffffffffffffffffffff00ffffffffffffffffffffffffffffffffffffffff169055565b61077a8161255f565b6113936120cb565b6113c0600080547fffffffffffffffffffffff00ffffffffffffffffffffffffffffffffffffffff169055565b60006040518061010001604052808c73ffffffffffffffffffffffffffffffffffffffff1681526020018b73ffffffffffffffffffffffffffffffffffffffff1681526020018a73ffffffffffffffffffffffffffffffffffffffff1681526020018981526020018681526020018567ffffffffffffffff1681526020018467ffffffffffffffff1681526020018363ffffffff1681525090506000611465826125ce565b9050600061147782848b8860006125fe565b905061148682828a88876128a1565b5050506114cd600080547fffffffffffffffffffffff00ffffffffffffffffffffffffffffffffffffffff1674010000000000000000000000000000000000000000179055565b50505050505050505050565b60603415611543576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601b60248201527f4f6e6c79206d756c746963616c6c207769746820302076616c756500000000006044820152606401610733565b8167ffffffffffffffff81111561155c5761155c613b69565b60405190808252806020026020018201604052801561158f57816020015b606081526020019060019003908161157a5790505b50905060005b828110156116ac57600080308686858181106115b3576115b36140ce565b90506020028101906115c591906140fd565b6040516115d3929190614162565b600060405180830381855af49150503d806000811461160e576040519150601f19603f3d011682016040523d82523d6000602084013e611613565b606091505b5091509150816116795760448151101561162c57600080fd5b6004810190508080602001905181019061164691906141a2565b6040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161073391906141f3565b8084848151811061168c5761168c6140ce565b6020026020010181905250505080806116a490614206565b915050611595565b5092915050565b6116bb6120cb565b6116e8600080547fffffffffffffffffffffff00ffffffffffffffffffffffffffffffffffffffff169055565b46826020015114611755576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152600f60248201527f496e76616c696420636861696e496400000000000000000000000000000000006044820152606401610733565b8160400151518260a0015151146117c8576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152600c60248201527f696e76616c6964206c65616600000000000000000000000000000000000000006044820152606401610733565b600060058463ffffffff16815481106117e3576117e36140ce565b90600052602060002090600302019050611802816001015484846129a6565b611868576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152600960248201527f4261642050726f6f6600000000000000000000000000000000000000000000006044820152606401610733565b61187f81600201846060015163ffffffff166129e3565b156118e6576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152600f60248201527f416c726561647920636c61696d656400000000000000000000000000000000006044820152606401610733565b6118fd81600201846060015163ffffffff16612a24565b471561198757600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663d0e30db0476040518263ffffffff1660e01b81526004016000604051808303818588803b15801561196d57600080fd5b505af1158015611981573d6000803e3d6000fd5b50505050505b60005b8360400151518163ffffffff161015611a3357600084604001518263ffffffff16815181106119bb576119bb6140ce565b602002602001015190506000811115611a2057611a208560a001518363ffffffff16815181106119ed576119ed6140ce565b602002602001015182876080015173ffffffffffffffffffffffffffffffffffffffff16612a629092919063ffffffff16565b5080611a2b8161423f565b91505061198a565b50825115611acc57611a4483612ab8565b826080015173ffffffffffffffffffffffffffffffffffffffff16836060015163ffffffff1684602001517f828fc203220356df8f072a91681caee7d5c75095e2a95e80ed5a14b384697f71866000015133604051611ac392919091825273ffffffffffffffffffffffffffffffffffffffff16602082015260400190565b60405180910390a45b3373ffffffffffffffffffffffffffffffffffffffff16836060015163ffffffff168563ffffffff167ff8bd640004bcec1b89657020f561d0b070cbdf662d0b158db9dccb0a8301bfab86600001518760200151886040015189608001518a60a00151604051611b409594939291906142e4565b60405180910390a4506109b8600080547fffffffffffffffffffffff00ffffffffffffffffffffffffffffffffffffffff1674010000000000000000000000000000000000000000179055565b600154611bc39073ffffffffffffffffffffffffffffffffffffffff167311110000000000000000000000000000000011110190565b73ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614611c57576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601860248201527f4f4e4c595f434f554e544552504152545f4741544557415900000000000000006044820152606401610733565b611c5f6120cb565b611c8c600080547fffffffffffffffffffffff00ffffffffffffffffffffffffffffffffffffffff169055565b61077a81612c06565b60058181548110611ca557600080fd5b60009182526020909120600390910201805460019091015490915082565b611ccb6120cb565b611cf8600080547fffffffffffffffffffffff00ffffffffffffffffffffffffffffffffffffffff169055565b60006040518061010001604052808c73ffffffffffffffffffffffffffffffffffffffff1681526020018b73ffffffffffffffffffffffffffffffffffffffff1681526020018a73ffffffffffffffffffffffffffffffffffffffff1681526020018981526020018881526020018767ffffffffffffffff1681526020018667ffffffffffffffff1681526020018563ffffffff168152509050611dc760058463ffffffff1681548110611dae57611dae6140ce565b9060005260206000209060030201600001548284612cf2565b611e2d576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152600d60248201527f496e76616c69642070726f6f66000000000000000000000000000000000000006044820152606401610733565b6000611e38826125ce565b90504715611ec457600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663d0e30db0476040518263ffffffff1660e01b81526004016000604051808303818588803b158015611eaa57600080fd5b505af1158015611ebe573d6000803e3d6000fd5b50505050505b6000611ed8828485606001518a60016125fe565b9050611486828285612d0a565b611eed6120cb565b611f1a600080547fffffffffffffffffffffff00ffffffffffffffffffffffffffffffffffffffff169055565b60408051608060208201819052601160a08301527f4143524f53532d56322d4645452d312e3000000000000000000000000000000060c083015267ffffffffffffffff86169282019290925263ffffffff8416606082015290810187905260009060e0016040516020818303038152906040528051906020012090506000611fa182612e03565b9050611fae8e8285612e3e565b505060006040518061010001604052808e73ffffffffffffffffffffffffffffffffffffffff1681526020018d73ffffffffffffffffffffffffffffffffffffffff1681526020018c73ffffffffffffffffffffffffffffffffffffffff1681526020018b81526020018881526020018767ffffffffffffffff1681526020018667ffffffffffffffff1681526020018463ffffffff1681525090506000612055826125ce565b9050600061206782848d8960006125fe565b905061207682828c89876128a1565b5050506120bd600080547fffffffffffffffffffffff00ffffffffffffffffffffffffffffffffffffffff1674010000000000000000000000000000000000000000179055565b505050505050505050505050565b60005474010000000000000000000000000000000000000000900460ff1661214f576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601f60248201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c006044820152606401610733565b565b73ffffffffffffffffffffffffffffffffffffffff81166121ce576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601460248201527f4261642068756220706f6f6c20616464726573730000000000000000000000006044820152606401610733565b600280547fffffffffffffffffffffffff00000000000000000000000000000000000000001673ffffffffffffffffffffffffffffffffffffffff83169081179091556040517f1f17a88f67b0f49060a34bec1a4723a563620e6aa265eb640b5046dcee0759a090600090a250565b73ffffffffffffffffffffffffffffffffffffffff8316600081815260046020908152604080832086845282529182902080547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff001685151590811790915591519182528492917f0a21fdd43d0ad0c62689ee7230a47309a050755bcc52eba00310add65297692a91015b60405180910390a3505050565b600380547fffffffff00000000ffffffffffffffffffffffffffffffffffffffffffffffff16780100000000000000000000000000000000000000000000000063ffffffff8416908102919091179091556040519081527f0e55dd180fa793d9036c804d0a116e6a7617a48e72cee1f83d92793a793fcc039060200160405180910390a150565b73ffffffffffffffffffffffffffffffffffffffff82811660008181526008602052604080822080547fffffffffffffffffffffffff0000000000000000000000000000000000000000169486169485179055517f8d7f294eaa476236fe8cb5629376a12cd37dace3d21e6a7b98f1641c4ed5f09e9190a35050565b60405173ffffffffffffffffffffffffffffffffffffffff808516602483015283166044820152606481018290526124b39085907f23b872dd00000000000000000000000000000000000000000000000000000000906084015b604080517fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe08184030181529190526020810180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff167fffffffff0000000000000000000000000000000000000000000000000000000090931692909217909152612eaf565b50505050565b60058054600181018255600091909152600381027f036b6384b5eca791c62761152d0c79bb0604c104a5fb6f4eb0703f3154bb3db181018490557f036b6384b5eca791c62761152d0c79bb0604c104a5fb6f4eb0703f3154bb3db001828155604080518581526020810185905263ffffffff8416917fc86ba04c55bc5eb2f2876b91c438849a296dbec7b08751c3074d92e04f0a77af910160405180910390a250505050565b600780547fffffffffffffffffffffffff00000000000000000000000000000000000000001673ffffffffffffffffffffffffffffffffffffffff83169081179091556040517fdc4a5f4c066ad14c1306e624550b42395e08f992a76b416cc7b1ad11503d376c90600090a250565b6000816040516020016125e19190614331565b604051602081830303815290604052805190602001209050919050565b60006706f05b59d3b200008367ffffffffffffffff1610801561263657506706f05b59d3b200008560a0015167ffffffffffffffff16105b61269c576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152600c60248201527f696e76616c6964206665657300000000000000000000000000000000000000006044820152606401610733565b606085015160008781526006602052604090205410612717576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152600c60248201527f72656c61792066696c6c656400000000000000000000000000000000000000006044820152606401610733565b50600083156128985761273984848760a0015161273491906143bd565b612fbb565b60008781526006602052604090205460608701519192508591839161275d916143e0565b101561279f57600087815260066020526040902054606087015161278191906143e0565b915061279c82858860a0015161279791906143bd565b612ff5565b90505b600087815260066020526040812080548492906127bd9084906143f7565b9091555050600354604087015173ffffffffffffffffffffffffffffffffffffffff9081169116141561282957826128165760408601516128169073ffffffffffffffffffffffffffffffffffffffff163330846123d7565b61282486602001518261301e565b612896565b826128635761282433876020015183896040015173ffffffffffffffffffffffffffffffffffffffff166123d7909392919063ffffffff16565b612896866020015182886040015173ffffffffffffffffffffffffffffffffffffffff16612a629092919063ffffffff16565b505b95945050505050565b3373ffffffffffffffffffffffffffffffffffffffff1683867f393f1765f382b5310a9186fa707a84040f8241b280a30b74112689a92a156f698460600151600660008b815260200190815260200160002054898760800151898960a001518a60e001518b604001518c600001518d602001516040516129979a99989796959493929190998a5260208a01989098526040890196909652606088019490945267ffffffffffffffff9283166080880152911660a086015263ffffffff1660c085015273ffffffffffffffffffffffffffffffffffffffff90811660e0850152908116610100840152166101208201526101400190565b60405180910390a45050505050565b60006129d98285856040516020016129be919061440f565b60405160208183030381529060405280519060200120613126565b90505b9392505050565b6000806129f2610100846144d9565b90506000612a02610100856144ed565b6000928352602095909552506040902054600190931b92831690921492915050565b6000612a32610100836144d9565b90506000612a42610100846144ed565b600092835260209490945250604090208054600190931b90921790915550565b60405173ffffffffffffffffffffffffffffffffffffffff83166024820152604481018290526109b89084907fa9059cbb0000000000000000000000000000000000000000000000000000000090606401612431565b60075460808281015173ffffffffffffffffffffffffffffffffffffffff90811660009081526008602052604080822054600254875192517f7b3a3c8b00000000000000000000000000000000000000000000000000000000815291851660048301528416602482015260448101919091526064810193909352608483015290911690637b3a3c8b9060a4016000604051808303816000875af1158015612b63573d6000803e3d6000fd5b505050506040513d6000823e601f3d9081017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0168201604052612ba991908101906141a2565b5060025481516040805173ffffffffffffffffffffffffffffffffffffffff909316835260208301919091526000917f997d81a0a8415d688a6c319736602098252bf6445e0e879326f682f11928e317910160405180910390a250565b73ffffffffffffffffffffffffffffffffffffffff8116612c83576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601960248201527f4261642062726964676520726f757465722061646472657373000000000000006044820152606401610733565b600180547fffffffffffffffffffffffff00000000000000000000000000000000000000001673ffffffffffffffffffffffffffffffffffffffff83169081179091556040517fa9e8c42c9e7fca7f62755189a16b2f5314d43d8fb24e91ba54e6d65f9314e84990600090a250565b60006129d98285856040516020016129be9190614331565b3373ffffffffffffffffffffffffffffffffffffffff16837fc1c02fe71abee2530563583daac3d7b681ef4c00db95adc3847b886da8098bc1836060015160066000888152602001908152602001600020548686608001518760c001518860a001518960e001518a604001518b600001518c602001516040516122c79a99989796959493929190998a5260208a01989098526040890196909652606088019490945267ffffffffffffffff9283166080880152911660a086015263ffffffff1660c085015273ffffffffffffffffffffffffffffffffffffffff90811660e0850152908116610100840152166101208201526101400190565b6040517f19457468657265756d205369676e6564204d6573736167653a0a3332000000006020820152603c8101829052600090605c016125e1565b612e4983838361313c565b6109b8576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601160248201527f696e76616c6964207369676e61747572650000000000000000000000000000006044820152606401610733565b6000612f11826040518060400160405280602081526020017f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c65648152508573ffffffffffffffffffffffffffffffffffffffff1661332b9092919063ffffffff16565b8051909150156109b85780806020019051810190612f2f9190614501565b6109b8576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602a60248201527f5361666545524332303a204552433230206f7065726174696f6e20646964206e60448201527f6f742073756363656564000000000000000000000000000000000000000000006064820152608401610733565b6000612fcf82670de0b6b3a764000061451e565b67ffffffffffffffff16612feb84670de0b6b3a764000061453f565b6129dc91906144d9565b6000670de0b6b3a764000061300a838261451e565b612feb9067ffffffffffffffff168561453f565b73ffffffffffffffffffffffffffffffffffffffff82163b1561305f57600354610cca9073ffffffffffffffffffffffffffffffffffffffff168383612a62565b6003546040517f2e1a7d4d0000000000000000000000000000000000000000000000000000000081526004810183905273ffffffffffffffffffffffffffffffffffffffff90911690632e1a7d4d90602401600060405180830381600087803b1580156130cb57600080fd5b505af11580156130df573d6000803e3d6000fd5b505060405173ffffffffffffffffffffffffffffffffffffffff8516925083156108fc02915083906000818181858888f193505050501580156109b8573d6000803e3d6000fd5b600082613133858461333a565b14949350505050565b600080600061314b85856133e6565b909250905060008160048111156131645761316461457c565b14801561319c57508573ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff16145b156131ac576001925050506129dc565b6000808773ffffffffffffffffffffffffffffffffffffffff16631626ba7e60e01b88886040516024016131e19291906145ab565b604080517fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe08184030181529181526020820180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff167fffffffff0000000000000000000000000000000000000000000000000000000090941693909317909252905161326a91906145c4565b600060405180830381855afa9150503d80600081146132a5576040519150601f19603f3d011682016040523d82523d6000602084013e6132aa565b606091505b50915091508180156132bd575080516020145b801561331f575080517f1626ba7e00000000000000000000000000000000000000000000000000000000906132fb90830160209081019084016145e0565b7fffffffff0000000000000000000000000000000000000000000000000000000016145b98975050505050505050565b60606129d98484600085613456565b600081815b84518110156133de57600085828151811061335c5761335c6140ce565b6020026020010151905080831161339e5760408051602081018590529081018290526060016040516020818303038152906040528051906020012092506133cb565b60408051602081018390529081018490526060016040516020818303038152906040528051906020012092505b50806133d681614206565b91505061333f565b509392505050565b60008082516041141561341d5760208301516040840151606085015160001a613411878285856135d6565b9450945050505061344f565b825160401415613447576020830151604084015161343c8683836136ee565b93509350505061344f565b506000905060025b9250929050565b6060824710156134e8576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602660248201527f416464726573733a20696e73756666696369656e742062616c616e636520666f60448201527f722063616c6c00000000000000000000000000000000000000000000000000006064820152608401610733565b843b613550576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e74726163740000006044820152606401610733565b6000808673ffffffffffffffffffffffffffffffffffffffff16858760405161357991906145c4565b60006040518083038185875af1925050503d80600081146135b6576040519150601f19603f3d011682016040523d82523d6000602084013e6135bb565b606091505b50915091506135cb828286613736565b979650505050505050565b6000807f7fffffffffffffffffffffffffffffff5d576e7357a4501ddfe92f46681b20a083111561360d57506000905060036136e5565b8460ff16601b1415801561362557508460ff16601c14155b1561363657506000905060046136e5565b6040805160008082526020820180845289905260ff881692820192909252606081018690526080810185905260019060a0016020604051602081039080840390855afa15801561368a573d6000803e3d6000fd5b50506040517fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0015191505073ffffffffffffffffffffffffffffffffffffffff81166136de576000600192509250506136e5565b9150600090505b94509492505050565b6000807f7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff831660ff84901c601b01613728878288856135d6565b935093505050935093915050565b606083156137455750816129dc565b8251156137555782518084602001fd5b816040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161073391906141f3565b803573ffffffffffffffffffffffffffffffffffffffff811681146137ad57600080fd5b919050565b6000602082840312156137c457600080fd5b6129dc82613789565b6000602082840312156137df57600080fd5b5035919050565b80151581146107be57600080fd5b60008060006060848603121561380957600080fd5b61381284613789565b9250602084013591506040840135613829816137e6565b809150509250925092565b803563ffffffff811681146137ad57600080fd5b60006020828403121561385a57600080fd5b6129dc82613834565b6000806040838503121561387657600080fd5b61387f83613789565b915061388d60208401613789565b90509250929050565b803567ffffffffffffffff811681146137ad57600080fd5b60008060008060008060c087890312156138c757600080fd5b6138d087613789565b95506138de60208801613789565b945060408701359350606087013592506138fa60808801613896565b915061390860a08801613834565b90509295509295509295565b6000806040838503121561392757600080fd5b50508035926020909101359150565b6000806040838503121561394957600080fd5b61395283613789565b946020939093013593505050565b6000806000806000806000806000806101408b8d03121561398057600080fd5b6139898b613789565b995061399760208c01613789565b98506139a560408c01613789565b975060608b0135965060808b0135955060a08b0135945060c08b013593506139cf60e08c01613896565b92506139de6101008c01613896565b91506139ed6101208c01613834565b90509295989b9194979a5092959850565b60008060208385031215613a1157600080fd5b823567ffffffffffffffff80821115613a2957600080fd5b818501915085601f830112613a3d57600080fd5b813581811115613a4c57600080fd5b8660208260051b8501011115613a6157600080fd5b60209290920196919550909350505050565b60005b83811015613a8e578181015183820152602001613a76565b838111156124b35750506000910152565b60008151808452613ab7816020860160208601613a73565b601f017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0169290920160200192915050565b6000602080830181845280855180835260408601915060408160051b870101925083870160005b82811015613b5c577fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc0888603018452613b4a858351613a9f565b94509285019290850190600101613b10565b5092979650505050505050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b60405160c0810167ffffffffffffffff81118282101715613bbb57613bbb613b69565b60405290565b604051601f82017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe016810167ffffffffffffffff81118282101715613c0857613c08613b69565b604052919050565b600067ffffffffffffffff821115613c2a57613c2a613b69565b5060051b60200190565b600082601f830112613c4557600080fd5b81356020613c5a613c5583613c10565b613bc1565b82815260059290921b84018101918181019086841115613c7957600080fd5b8286015b84811015613c945780358352918301918301613c7d565b509695505050505050565b600082601f830112613cb057600080fd5b81356020613cc0613c5583613c10565b82815260059290921b84018101918181019086841115613cdf57600080fd5b8286015b84811015613c9457613cf481613789565b8352918301918301613ce3565b600080600060608486031215613d1657600080fd5b613d1f84613834565b9250602084013567ffffffffffffffff80821115613d3c57600080fd5b9085019060c08288031215613d5057600080fd5b613d58613b98565b8235815260208301356020820152604083013582811115613d7857600080fd5b613d8489828601613c34565b604083015250613d9660608401613834565b6060820152613da760808401613789565b608082015260a083013582811115613dbe57600080fd5b613dca89828601613c9f565b60a08301525093506040860135915080821115613de657600080fd5b50613df386828701613c34565b9150509250925092565b6000806000806000806000806000806101408b8d031215613e1d57600080fd5b613e268b613789565b9950613e3460208c01613789565b9850613e4260408c01613789565b975060608b0135965060808b01359550613e5e60a08c01613896565b9450613e6c60c08c01613896565b9350613e7a60e08c01613834565b9250613e896101008c01613834565b91506101208b013567ffffffffffffffff811115613ea657600080fd5b613eb28d828e01613c34565b9150509295989b9194979a5092959850565b600067ffffffffffffffff821115613ede57613ede613b69565b50601f017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe01660200190565b600082601f830112613f1b57600080fd5b8135613f29613c5582613ec4565b818152846020838601011115613f3e57600080fd5b816020850160208301376000918101602001919091529392505050565b6000806000806000806000806000806000806101808d8f031215613f7e57600080fd5b613f878d613789565b9b50613f9560208e01613789565b9a50613fa360408e01613789565b995060608d0135985060808d0135975060a08d0135965060c08d01359550613fcd60e08e01613896565b9450613fdc6101008e01613896565b9350613feb6101208e01613896565b9250613ffa6101408e01613834565b915067ffffffffffffffff6101608e0135111561401657600080fd5b6140278e6101608f01358f01613f0a565b90509295989b509295989b509295989b565b60006020828403121561404b57600080fd5b5051919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b600063ffffffff8381169083168181101561409e5761409e614052565b039392505050565b600063ffffffff8083168185168083038211156140c5576140c5614052565b01949350505050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b60008083357fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe184360301811261413257600080fd5b83018035915067ffffffffffffffff82111561414d57600080fd5b60200191503681900382131561344f57600080fd5b8183823760009101908152919050565b6000614180613c5584613ec4565b905082815283838301111561419457600080fd5b6129dc836020830184613a73565b6000602082840312156141b457600080fd5b815167ffffffffffffffff8111156141cb57600080fd5b8201601f810184136141dc57600080fd5b6141eb84825160208401614172565b949350505050565b6020815260006129dc6020830184613a9f565b60007fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff82141561423857614238614052565b5060010190565b600063ffffffff8083168181141561425957614259614052565b6001019392505050565b600081518084526020808501945080840160005b8381101561429357815187529582019590820190600101614277565b509495945050505050565b600081518084526020808501945080840160005b8381101561429357815173ffffffffffffffffffffffffffffffffffffffff16875295820195908201906001016142b2565b85815284602082015260a06040820152600061430360a0830186614263565b73ffffffffffffffffffffffffffffffffffffffff85166060840152828103608084015261331f818561429e565b60006101008201905073ffffffffffffffffffffffffffffffffffffffff80845116835280602085015116602084015280604085015116604084015250606083015160608301526080830151608083015260a083015167ffffffffffffffff80821660a08501528060c08601511660c0850152505060e08301516116ac60e084018263ffffffff169052565b600067ffffffffffffffff8083168185168083038211156140c5576140c5614052565b6000828210156143f2576143f2614052565b500390565b6000821982111561440a5761440a614052565b500190565b6020815281516020820152602082015160408201526000604083015160c0606084015261443f60e0840182614263565b905063ffffffff606085015116608084015273ffffffffffffffffffffffffffffffffffffffff60808501511660a084015260a08401517fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe08483030160c0850152612898828261429e565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601260045260246000fd5b6000826144e8576144e86144aa565b500490565b6000826144fc576144fc6144aa565b500690565b60006020828403121561451357600080fd5b81516129dc816137e6565b600067ffffffffffffffff8381169083168181101561409e5761409e614052565b6000817fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff048311821515161561457757614577614052565b500290565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052602160045260246000fd5b8281526040602082015260006129d96040830184613a9f565b600082516145d6818460208701613a73565b9190910192915050565b6000602082840312156145f257600080fd5b81517fffffffff00000000000000000000000000000000000000000000000000000000811681146129dc57600080fdfea2646970667358221220edfd6b208ac3f4c53e37d85d8f6b559f44f72c704bc408457422327a2f806f6364736f6c634300080b0033", + "solcInputHash": "c8b9349311d8b5049b613ac98eb998d0", + "metadata": "{\"compiler\":{\"version\":\"0.8.13+commit.abaa5c0e\"},\"language\":\"Solidity\",\"output\":{\"abi\":[{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_l2GatewayRouter\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"_crossDomainAdmin\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"_hubPool\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"_wethAddress\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"timerAddress\",\"type\":\"address\"}],\"stateMutability\":\"nonpayable\",\"type\":\"constructor\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"l1Token\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"address\",\"name\":\"target\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"numberOfTokensBridged\",\"type\":\"uint256\"}],\"name\":\"ArbitrumTokensBridged\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"uint256\",\"name\":\"rootBundleId\",\"type\":\"uint256\"}],\"name\":\"EmergencyDeleteRootBundle\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"originToken\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"uint256\",\"name\":\"destinationChainId\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"bool\",\"name\":\"enabled\",\"type\":\"bool\"}],\"name\":\"EnabledDepositRoute\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"amountToReturn\",\"type\":\"uint256\"},{\"indexed\":true,\"internalType\":\"uint256\",\"name\":\"chainId\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"uint256[]\",\"name\":\"refundAmounts\",\"type\":\"uint256[]\"},{\"indexed\":true,\"internalType\":\"uint32\",\"name\":\"rootBundleId\",\"type\":\"uint32\"},{\"indexed\":true,\"internalType\":\"uint32\",\"name\":\"leafId\",\"type\":\"uint32\"},{\"indexed\":false,\"internalType\":\"address\",\"name\":\"l2TokenAddress\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"address[]\",\"name\":\"refundAddresses\",\"type\":\"address[]\"},{\"indexed\":false,\"internalType\":\"address\",\"name\":\"caller\",\"type\":\"address\"}],\"name\":\"ExecutedRelayerRefundRoot\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"bytes32\",\"name\":\"relayHash\",\"type\":\"bytes32\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"totalFilledAmount\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"fillAmount\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"repaymentChainId\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"originChainId\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"destinationChainId\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"uint64\",\"name\":\"relayerFeePct\",\"type\":\"uint64\"},{\"indexed\":false,\"internalType\":\"uint64\",\"name\":\"realizedLpFeePct\",\"type\":\"uint64\"},{\"indexed\":false,\"internalType\":\"uint32\",\"name\":\"depositId\",\"type\":\"uint32\"},{\"indexed\":false,\"internalType\":\"address\",\"name\":\"destinationToken\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"relayer\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"depositor\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"address\",\"name\":\"recipient\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"bool\",\"name\":\"isSlowRelay\",\"type\":\"bool\"}],\"name\":\"FilledRelay\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"originChainId\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"destinationChainId\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"uint64\",\"name\":\"relayerFeePct\",\"type\":\"uint64\"},{\"indexed\":true,\"internalType\":\"uint32\",\"name\":\"depositId\",\"type\":\"uint32\"},{\"indexed\":false,\"internalType\":\"uint32\",\"name\":\"quoteTimestamp\",\"type\":\"uint32\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"originToken\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"address\",\"name\":\"recipient\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"depositor\",\"type\":\"address\"}],\"name\":\"FundsDeposited\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"uint32\",\"name\":\"rootBundleId\",\"type\":\"uint32\"},{\"indexed\":false,\"internalType\":\"bytes32\",\"name\":\"relayerRefundRoot\",\"type\":\"bytes32\"},{\"indexed\":false,\"internalType\":\"bytes32\",\"name\":\"slowRelayRoot\",\"type\":\"bytes32\"}],\"name\":\"RelayedRootBundle\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"uint64\",\"name\":\"newRelayerFeePct\",\"type\":\"uint64\"},{\"indexed\":true,\"internalType\":\"uint32\",\"name\":\"depositId\",\"type\":\"uint32\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"depositor\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"bytes\",\"name\":\"depositorSignature\",\"type\":\"bytes\"}],\"name\":\"RequestedSpeedUpDeposit\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"uint32\",\"name\":\"newBuffer\",\"type\":\"uint32\"}],\"name\":\"SetDepositQuoteTimeBuffer\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"newHubPool\",\"type\":\"address\"}],\"name\":\"SetHubPool\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"newL2GatewayRouter\",\"type\":\"address\"}],\"name\":\"SetL2GatewayRouter\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"newAdmin\",\"type\":\"address\"}],\"name\":\"SetXDomainAdmin\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"amountToReturn\",\"type\":\"uint256\"},{\"indexed\":true,\"internalType\":\"uint256\",\"name\":\"chainId\",\"type\":\"uint256\"},{\"indexed\":true,\"internalType\":\"uint32\",\"name\":\"leafId\",\"type\":\"uint32\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"l2TokenAddress\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"address\",\"name\":\"caller\",\"type\":\"address\"}],\"name\":\"TokensBridged\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"l2Token\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"l1Token\",\"type\":\"address\"}],\"name\":\"WhitelistedTokens\",\"type\":\"event\"},{\"inputs\":[],\"name\":\"chainId\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"crossDomainAdmin\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"recipient\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"originToken\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"destinationChainId\",\"type\":\"uint256\"},{\"internalType\":\"uint64\",\"name\":\"relayerFeePct\",\"type\":\"uint64\"},{\"internalType\":\"uint32\",\"name\":\"quoteTimestamp\",\"type\":\"uint32\"}],\"name\":\"deposit\",\"outputs\":[],\"stateMutability\":\"payable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"depositQuoteTimeBuffer\",\"outputs\":[{\"internalType\":\"uint32\",\"name\":\"\",\"type\":\"uint32\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"rootBundleId\",\"type\":\"uint256\"}],\"name\":\"emergencyDeleteRootBundle\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"name\":\"enabledDepositRoutes\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint32\",\"name\":\"rootBundleId\",\"type\":\"uint32\"},{\"components\":[{\"internalType\":\"uint256\",\"name\":\"amountToReturn\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"chainId\",\"type\":\"uint256\"},{\"internalType\":\"uint256[]\",\"name\":\"refundAmounts\",\"type\":\"uint256[]\"},{\"internalType\":\"uint32\",\"name\":\"leafId\",\"type\":\"uint32\"},{\"internalType\":\"address\",\"name\":\"l2TokenAddress\",\"type\":\"address\"},{\"internalType\":\"address[]\",\"name\":\"refundAddresses\",\"type\":\"address[]\"}],\"internalType\":\"struct SpokePoolInterface.RelayerRefundLeaf\",\"name\":\"relayerRefundLeaf\",\"type\":\"tuple\"},{\"internalType\":\"bytes32[]\",\"name\":\"proof\",\"type\":\"bytes32[]\"}],\"name\":\"executeRelayerRefundRoot\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"depositor\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"recipient\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"destinationToken\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"originChainId\",\"type\":\"uint256\"},{\"internalType\":\"uint64\",\"name\":\"realizedLpFeePct\",\"type\":\"uint64\"},{\"internalType\":\"uint64\",\"name\":\"relayerFeePct\",\"type\":\"uint64\"},{\"internalType\":\"uint32\",\"name\":\"depositId\",\"type\":\"uint32\"},{\"internalType\":\"uint32\",\"name\":\"rootBundleId\",\"type\":\"uint32\"},{\"internalType\":\"bytes32[]\",\"name\":\"proof\",\"type\":\"bytes32[]\"}],\"name\":\"executeSlowRelayRoot\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"depositor\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"recipient\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"destinationToken\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"maxTokensToSend\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"repaymentChainId\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"originChainId\",\"type\":\"uint256\"},{\"internalType\":\"uint64\",\"name\":\"realizedLpFeePct\",\"type\":\"uint64\"},{\"internalType\":\"uint64\",\"name\":\"relayerFeePct\",\"type\":\"uint64\"},{\"internalType\":\"uint32\",\"name\":\"depositId\",\"type\":\"uint32\"}],\"name\":\"fillRelay\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"depositor\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"recipient\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"destinationToken\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"maxTokensToSend\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"repaymentChainId\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"originChainId\",\"type\":\"uint256\"},{\"internalType\":\"uint64\",\"name\":\"realizedLpFeePct\",\"type\":\"uint64\"},{\"internalType\":\"uint64\",\"name\":\"relayerFeePct\",\"type\":\"uint64\"},{\"internalType\":\"uint64\",\"name\":\"newRelayerFeePct\",\"type\":\"uint64\"},{\"internalType\":\"uint32\",\"name\":\"depositId\",\"type\":\"uint32\"},{\"internalType\":\"bytes\",\"name\":\"depositorSignature\",\"type\":\"bytes\"}],\"name\":\"fillRelayWithUpdatedFee\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"getCurrentTime\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"hubPool\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"l2GatewayRouter\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes[]\",\"name\":\"data\",\"type\":\"bytes[]\"}],\"name\":\"multicall\",\"outputs\":[{\"internalType\":\"bytes[]\",\"name\":\"results\",\"type\":\"bytes[]\"}],\"stateMutability\":\"payable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"numberOfDeposits\",\"outputs\":[{\"internalType\":\"uint32\",\"name\":\"\",\"type\":\"uint32\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"\",\"type\":\"bytes32\"}],\"name\":\"relayFills\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"relayerRefundRoot\",\"type\":\"bytes32\"},{\"internalType\":\"bytes32\",\"name\":\"slowRelayRoot\",\"type\":\"bytes32\"}],\"name\":\"relayRootBundle\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"name\":\"rootBundles\",\"outputs\":[{\"internalType\":\"bytes32\",\"name\":\"slowRelayRoot\",\"type\":\"bytes32\"},{\"internalType\":\"bytes32\",\"name\":\"relayerRefundRoot\",\"type\":\"bytes32\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"newCrossDomainAdmin\",\"type\":\"address\"}],\"name\":\"setCrossDomainAdmin\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"time\",\"type\":\"uint256\"}],\"name\":\"setCurrentTime\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint32\",\"name\":\"newDepositQuoteTimeBuffer\",\"type\":\"uint32\"}],\"name\":\"setDepositQuoteTimeBuffer\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"originToken\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"destinationChainId\",\"type\":\"uint256\"},{\"internalType\":\"bool\",\"name\":\"enabled\",\"type\":\"bool\"}],\"name\":\"setEnableRoute\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"newHubPool\",\"type\":\"address\"}],\"name\":\"setHubPool\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"newL2GatewayRouter\",\"type\":\"address\"}],\"name\":\"setL2GatewayRouter\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"depositor\",\"type\":\"address\"},{\"internalType\":\"uint64\",\"name\":\"newRelayerFeePct\",\"type\":\"uint64\"},{\"internalType\":\"uint32\",\"name\":\"depositId\",\"type\":\"uint32\"},{\"internalType\":\"bytes\",\"name\":\"depositorSignature\",\"type\":\"bytes\"}],\"name\":\"speedUpDeposit\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"timerAddress\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"weth\",\"outputs\":[{\"internalType\":\"contract WETH9\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"l2Token\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"l1Token\",\"type\":\"address\"}],\"name\":\"whitelistToken\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"name\":\"whitelistedTokens\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"stateMutability\":\"payable\",\"type\":\"receive\"}],\"devdoc\":{\"kind\":\"dev\",\"methods\":{\"chainId()\":{\"details\":\"Some L2s like ZKSync don't support the CHAIN_ID opcode so we allow the implementer to override this.\"},\"constructor\":{\"params\":{\"_crossDomainAdmin\":\"Cross domain admin to set. Can be changed by admin.\",\"_hubPool\":\"Hub pool address to set. Can be changed by admin.\",\"_l2GatewayRouter\":\"Address of L2 token gateway. Can be reset by admin.\",\"_wethAddress\":\"Weth address for this network to set.\",\"timerAddress\":\"Timer address to set.\"}},\"deposit(address,address,uint256,uint256,uint64,uint32)\":{\"params\":{\"amount\":\"Amount of tokens to deposit. Will be amount of tokens to receive less fees.\",\"destinationChainId\":\"Denotes network where user will receive funds from SpokePool by a relayer.\",\"originToken\":\"Token to lock into this contract to initiate deposit.\",\"quoteTimestamp\":\"Timestamp used by relayers to compute this deposit's realizedLPFeePct which is paid to LP pool on HubPool.\",\"recipient\":\"Address to receive funds at on destination chain.\",\"relayerFeePct\":\"% of deposit amount taken out to incentivize a fast relayer.\"}},\"emergencyDeleteRootBundle(uint256)\":{\"params\":{\"rootBundleId\":\"Index of the root bundle that needs to be deleted. Note: this is intentionally a uint256 to ensure that a small input range doesn't limit which indices this method is able to reach.\"}},\"executeRelayerRefundRoot(uint32,(uint256,uint256,uint256[],uint32,address,address[]),bytes32[])\":{\"params\":{\"proof\":\"Inclusion proof for this leaf in relayer refund root in root bundle.\",\"relayerRefundLeaf\":\"Contains all data necessary to reconstruct leaf contained in root bundle and to refund relayer. This data structure is explained in detail in the SpokePoolInterface.\",\"rootBundleId\":\"Unique ID of root bundle containing relayer refund root that this leaf is contained in.\"}},\"executeSlowRelayRoot(address,address,address,uint256,uint256,uint64,uint64,uint32,uint32,bytes32[])\":{\"details\":\"This function assumes that the relay's destination chain ID is the current chain ID, which prevents the caller from executing a slow relay intended for another chain on this chain.\",\"params\":{\"amount\":\"Full size of the deposit.\",\"depositId\":\"Unique deposit ID on origin spoke pool.\",\"depositor\":\"Depositor on origin chain who set this chain as the destination chain.\",\"destinationToken\":\"Token to send to recipient. Should be mapped to the origin token, origin chain ID and this chain ID via a mapping on the HubPool.\",\"originChainId\":\"Chain of SpokePool where deposit originated.\",\"proof\":\"Inclusion proof for this leaf in slow relay root in root bundle.\",\"realizedLpFeePct\":\"Fee % based on L1 HubPool utilization at deposit quote time. Deterministic based on quote time.\",\"recipient\":\"Specified recipient on this chain.\",\"relayerFeePct\":\"Original fee % to keep as relayer set by depositor.\",\"rootBundleId\":\"Unique ID of root bundle containing slow relay root that this leaf is contained in.\"}},\"fillRelay(address,address,address,uint256,uint256,uint256,uint256,uint64,uint64,uint32)\":{\"params\":{\"amount\":\"Full size of the deposit.\",\"depositId\":\"Unique deposit ID on origin spoke pool.\",\"depositor\":\"Depositor on origin chain who set this chain as the destination chain.\",\"destinationToken\":\"Token to send to recipient. Should be mapped to the origin token, origin chain ID and this chain ID via a mapping on the HubPool.\",\"maxTokensToSend\":\"Max amount of tokens to send recipient. If higher than amount, then caller will send recipient the full relay amount.\",\"originChainId\":\"Chain of SpokePool where deposit originated.\",\"realizedLpFeePct\":\"Fee % based on L1 HubPool utilization at deposit quote time. Deterministic based on quote time.\",\"recipient\":\"Specified recipient on this chain.\",\"relayerFeePct\":\"Fee % to keep as relayer, specified by depositor.\",\"repaymentChainId\":\"Chain of SpokePool where relayer wants to be refunded after the challenge window has passed.\"}},\"fillRelayWithUpdatedFee(address,address,address,uint256,uint256,uint256,uint256,uint64,uint64,uint64,uint32,bytes)\":{\"params\":{\"amount\":\"Full size of the deposit.\",\"depositId\":\"Unique deposit ID on origin spoke pool.\",\"depositor\":\"Depositor on origin chain who set this chain as the destination chain.\",\"depositorSignature\":\"Depositor-signed message containing updated fee %.\",\"destinationToken\":\"Token to send to recipient. Should be mapped to the origin token, origin chain ID and this chain ID via a mapping on the HubPool.\",\"maxTokensToSend\":\"Max amount of tokens to send recipient. If higher than amount, then caller will send recipient the full relay amount.\",\"newRelayerFeePct\":\"New fee % to keep as relayer also specified by depositor.\",\"originChainId\":\"Chain of SpokePool where deposit originated.\",\"realizedLpFeePct\":\"Fee % based on L1 HubPool utilization at deposit quote time. Deterministic based on quote time.\",\"recipient\":\"Specified recipient on this chain.\",\"relayerFeePct\":\"Original fee % to keep as relayer set by depositor.\",\"repaymentChainId\":\"Chain of SpokePool where relayer wants to be refunded after the challenge window has passed.\"}},\"getCurrentTime()\":{\"returns\":{\"_0\":\"uint for the current Testable timestamp.\"}},\"relayRootBundle(bytes32,bytes32)\":{\"params\":{\"relayerRefundRoot\":\"Merkle root containing relayer refund leaves that can be individually executed via executeRelayerRefundRoot().\",\"slowRelayRoot\":\"Merkle root containing slow relay fulfillment leaves that can be individually executed via executeSlowRelayRoot().\"}},\"setCrossDomainAdmin(address)\":{\"params\":{\"newCrossDomainAdmin\":\"New cross domain admin.\"}},\"setCurrentTime(uint256)\":{\"details\":\"Will revert if not running in test mode.\",\"params\":{\"time\":\"timestamp to set current Testable time to.\"}},\"setDepositQuoteTimeBuffer(uint32)\":{\"params\":{\"newDepositQuoteTimeBuffer\":\"New quote time buffer.\"}},\"setEnableRoute(address,uint256,bool)\":{\"params\":{\"destinationChainId\":\"Chain ID for where depositor wants to receive funds.\",\"enabled\":\"True to enable deposits, False otherwise.\",\"originToken\":\"Token that depositor can deposit to this contract.\"}},\"setHubPool(address)\":{\"params\":{\"newHubPool\":\"New hub pool.\"}},\"setL2GatewayRouter(address)\":{\"params\":{\"newL2GatewayRouter\":\"New L2 gateway router.\"}},\"speedUpDeposit(address,uint64,uint32,bytes)\":{\"params\":{\"depositId\":\"Deposit to update fee for that originated in this contract.\",\"depositor\":\"Signer of the update fee message who originally submitted the deposit. If the deposit doesn't exist, then the relayer will not be able to fill any relay, so the caller should validate that the depositor did in fact submit a relay.\",\"depositorSignature\":\"Signed message containing the depositor address, this contract chain ID, the updated relayer fee %, and the deposit ID. This signature is produced by signing a hash of data according to the EIP-191 standard. See more in the _verifyUpdateRelayerFeeMessage() comments.\",\"newRelayerFeePct\":\"New relayer fee that relayers can use.\"}},\"whitelistToken(address,address)\":{\"params\":{\"l1Token\":\"Ethereum version of l2Token.\",\"l2Token\":\"Arbitrum token.\"}}},\"version\":1},\"userdoc\":{\"kind\":\"user\",\"methods\":{\"chainId()\":{\"notice\":\"Returns chain ID for this network.\"},\"constructor\":{\"notice\":\"Construct the AVM SpokePool.\"},\"deposit(address,address,uint256,uint256,uint64,uint32)\":{\"notice\":\"Called by user to bridge funds from origin to destination chain. Depositor will effectively lock tokens in this contract and receive a destination token on the destination chain. The origin => destination token mapping is stored on the L1 HubPool.The caller must first approve this contract to spend amount of originToken.The originToken => destinationChainId must be enabled.This method is payable because the caller is able to deposit ETH if the originToken is WETH and this function will handle wrapping ETH.\"},\"emergencyDeleteRootBundle(uint256)\":{\"notice\":\"This method is intended to only be used in emergencies where a bad root bundle has reached the SpokePool.\"},\"executeRelayerRefundRoot(uint32,(uint256,uint256,uint256[],uint32,address,address[]),bytes32[])\":{\"notice\":\"Executes a relayer refund leaf stored as part of a root bundle. Will send the relayer the amount they sent to the recipient plus a relayer fee.\"},\"executeSlowRelayRoot(address,address,address,uint256,uint256,uint64,uint64,uint32,uint32,bytes32[])\":{\"notice\":\"Executes a slow relay leaf stored as part of a root bundle. Will send the full amount remaining in the relay to the recipient, less fees.\"},\"fillRelay(address,address,address,uint256,uint256,uint256,uint256,uint64,uint64,uint32)\":{\"notice\":\"Called by relayer to fulfill part of a deposit by sending destination tokens to the recipient. Relayer is expected to pass in unique identifying information for deposit that they want to fulfill, and this relay submission will be validated by off-chain data workers who can dispute this relay if any part is invalid. If the relay is valid, then the relayer will be refunded on their desired repayment chain. If relay is invalid, then relayer will not receive any refund.All of the deposit data can be found via on-chain events from the origin SpokePool, except for the realizedLpFeePct which is a function of the HubPool's utilization at the deposit quote time. This fee % is deterministic based on the quote time, so the relayer should just compute it using the canonical algorithm as described in a UMIP linked to the HubPool's identifier.\"},\"fillRelayWithUpdatedFee(address,address,address,uint256,uint256,uint256,uint256,uint64,uint64,uint64,uint32,bytes)\":{\"notice\":\"Called by relayer to execute same logic as calling fillRelay except that relayer is using an updated relayer fee %. The fee % must have been emitted in a message cryptographically signed by the depositor.By design, the depositor probably emitted the message with the updated fee by calling speedUpRelay().\"},\"getCurrentTime()\":{\"notice\":\"Gets the current time. Will return the last time set in `setCurrentTime` if running in test mode. Otherwise, it will return the block timestamp.\"},\"relayRootBundle(bytes32,bytes32)\":{\"notice\":\"This method stores a new root bundle in this contract that can be executed to refund relayers, fulfill slow relays, and send funds back to the HubPool on L1. This method can only be called by the admin and is designed to be called as part of a cross-chain message from the HubPool's executeRootBundle method.\"},\"setCrossDomainAdmin(address)\":{\"notice\":\"Change cross domain admin address. Callable by admin only.\"},\"setCurrentTime(uint256)\":{\"notice\":\"Sets the current time.\"},\"setDepositQuoteTimeBuffer(uint32)\":{\"notice\":\"Change allowance for deposit quote time to differ from current block time. Callable by admin only.\"},\"setEnableRoute(address,uint256,bool)\":{\"notice\":\"Enable/Disable an origin token => destination chain ID route for deposits. Callable by admin only.\"},\"setHubPool(address)\":{\"notice\":\"Change L1 hub pool address. Callable by admin only.\"},\"setL2GatewayRouter(address)\":{\"notice\":\"Change L2 gateway router. Callable only by admin.\"},\"speedUpDeposit(address,uint64,uint32,bytes)\":{\"notice\":\"Convenience method that depositor can use to signal to relayer to use updated fee.Relayer should only use events emitted by this function to submit fills with updated fees, otherwise they risk their fills getting disputed for being invalid, for example if the depositor never actually signed the update fee message.This function will revert if the depositor did not sign a message containing the updated fee for the deposit ID stored in this contract. If the deposit ID is for another contract, or the depositor address is incorrect, or the updated fee is incorrect, then the signature will not match and this function will revert.\"},\"whitelistToken(address,address)\":{\"notice\":\"Add L2 -> L1 token mapping. Callable only by admin.\"}},\"notice\":\"AVM specific SpokePool. Uses AVM cross-domain-enabled logic to implement admin only access to functions.\",\"version\":1}},\"settings\":{\"compilationTarget\":{\"contracts/Arbitrum_SpokePool.sol\":\"Arbitrum_SpokePool\"},\"evmVersion\":\"london\",\"libraries\":{},\"metadata\":{\"bytecodeHash\":\"ipfs\",\"useLiteralContent\":true},\"optimizer\":{\"enabled\":true,\"runs\":1000000},\"remappings\":[]},\"sources\":{\"@openzeppelin/contracts/token/ERC20/IERC20.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.5.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 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(\\n address from,\\n address to,\\n uint256 amount\\n ) external returns (bool);\\n\\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\",\"keccak256\":\"0xbbc8ac883ac3c0078ce5ad3e288fbb3ffcc8a30c3a98c0fda0114d64fc44fca2\",\"license\":\"MIT\"},\"@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts v4.4.1 (token/ERC20/utils/SafeERC20.sol)\\n\\npragma solidity ^0.8.0;\\n\\nimport \\\"../IERC20.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 function safeTransfer(\\n IERC20 token,\\n address to,\\n uint256 value\\n ) internal {\\n _callOptionalReturn(token, abi.encodeWithSelector(token.transfer.selector, to, value));\\n }\\n\\n function safeTransferFrom(\\n IERC20 token,\\n address from,\\n address to,\\n uint256 value\\n ) 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(\\n IERC20 token,\\n address spender,\\n uint256 value\\n ) 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 function safeIncreaseAllowance(\\n IERC20 token,\\n address spender,\\n uint256 value\\n ) internal {\\n uint256 newAllowance = token.allowance(address(this), spender) + value;\\n _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, newAllowance));\\n }\\n\\n function safeDecreaseAllowance(\\n IERC20 token,\\n address spender,\\n uint256 value\\n ) internal {\\n unchecked {\\n uint256 oldAllowance = token.allowance(address(this), spender);\\n require(oldAllowance >= value, \\\"SafeERC20: decreased allowance below zero\\\");\\n uint256 newAllowance = oldAllowance - value;\\n _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, newAllowance));\\n }\\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 if (returndata.length > 0) {\\n // Return data is optional\\n require(abi.decode(returndata, (bool)), \\\"SafeERC20: ERC20 operation did not succeed\\\");\\n }\\n }\\n}\\n\",\"keccak256\":\"0xc3d946432c0ddbb1f846a0d3985be71299df331b91d06732152117f62f0be2b5\",\"license\":\"MIT\"},\"@openzeppelin/contracts/utils/Address.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.5.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 *\\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://diligence.consensys.net/posts/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.5.11/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 functionCall(target, data, \\\"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(\\n address target,\\n bytes memory data,\\n uint256 value\\n ) 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 require(isContract(target), \\\"Address: call to non-contract\\\");\\n\\n (bool success, bytes memory returndata) = target.call{value: value}(data);\\n return verifyCallResult(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 require(isContract(target), \\\"Address: static call to non-contract\\\");\\n\\n (bool success, bytes memory returndata) = target.staticcall(data);\\n return verifyCallResult(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 require(isContract(target), \\\"Address: delegate call to non-contract\\\");\\n\\n (bool success, bytes memory returndata) = target.delegatecall(data);\\n return verifyCallResult(success, returndata, errorMessage);\\n }\\n\\n /**\\n * @dev Tool to verifies that a low level call was successful, and revert if it wasn't, either by bubbling the\\n * revert reason 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 // 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\\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}\\n\",\"keccak256\":\"0x2ccf9d2313a313d41a791505f2b5abfdc62191b5d4334f7f7a82691c088a1c87\",\"license\":\"MIT\"},\"@openzeppelin/contracts/utils/Strings.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts v4.4.1 (utils/Strings.sol)\\n\\npragma solidity ^0.8.0;\\n\\n/**\\n * @dev String operations.\\n */\\nlibrary Strings {\\n bytes16 private constant _HEX_SYMBOLS = \\\"0123456789abcdef\\\";\\n\\n /**\\n * @dev Converts a `uint256` to its ASCII `string` decimal representation.\\n */\\n function toString(uint256 value) internal pure returns (string memory) {\\n // Inspired by OraclizeAPI's implementation - MIT licence\\n // https://github.com/oraclize/ethereum-api/blob/b42146b063c7d6ee1358846c198246239e9360e8/oraclizeAPI_0.4.25.sol\\n\\n if (value == 0) {\\n return \\\"0\\\";\\n }\\n uint256 temp = value;\\n uint256 digits;\\n while (temp != 0) {\\n digits++;\\n temp /= 10;\\n }\\n bytes memory buffer = new bytes(digits);\\n while (value != 0) {\\n digits -= 1;\\n buffer[digits] = bytes1(uint8(48 + uint256(value % 10)));\\n value /= 10;\\n }\\n return string(buffer);\\n }\\n\\n /**\\n * @dev Converts a `uint256` to its ASCII `string` hexadecimal representation.\\n */\\n function toHexString(uint256 value) internal pure returns (string memory) {\\n if (value == 0) {\\n return \\\"0x00\\\";\\n }\\n uint256 temp = value;\\n uint256 length = 0;\\n while (temp != 0) {\\n length++;\\n temp >>= 8;\\n }\\n return toHexString(value, length);\\n }\\n\\n /**\\n * @dev Converts a `uint256` to its ASCII `string` hexadecimal representation with fixed length.\\n */\\n function toHexString(uint256 value, uint256 length) internal pure returns (string memory) {\\n bytes memory buffer = new bytes(2 * length + 2);\\n buffer[0] = \\\"0\\\";\\n buffer[1] = \\\"x\\\";\\n for (uint256 i = 2 * length + 1; i > 1; --i) {\\n buffer[i] = _HEX_SYMBOLS[value & 0xf];\\n value >>= 4;\\n }\\n require(value == 0, \\\"Strings: hex length insufficient\\\");\\n return string(buffer);\\n }\\n}\\n\",\"keccak256\":\"0x32c202bd28995dd20c4347b7c6467a6d3241c74c8ad3edcbb610cd9205916c45\",\"license\":\"MIT\"},\"@openzeppelin/contracts/utils/cryptography/ECDSA.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.5.0) (utils/cryptography/ECDSA.sol)\\n\\npragma solidity ^0.8.0;\\n\\nimport \\\"../Strings.sol\\\";\\n\\n/**\\n * @dev Elliptic Curve Digital Signature Algorithm (ECDSA) operations.\\n *\\n * These functions can be used to verify that a message was signed by the holder\\n * of the private keys of a given address.\\n */\\nlibrary ECDSA {\\n enum RecoverError {\\n NoError,\\n InvalidSignature,\\n InvalidSignatureLength,\\n InvalidSignatureS,\\n InvalidSignatureV\\n }\\n\\n function _throwError(RecoverError error) private pure {\\n if (error == RecoverError.NoError) {\\n return; // no error: do nothing\\n } else if (error == RecoverError.InvalidSignature) {\\n revert(\\\"ECDSA: invalid signature\\\");\\n } else if (error == RecoverError.InvalidSignatureLength) {\\n revert(\\\"ECDSA: invalid signature length\\\");\\n } else if (error == RecoverError.InvalidSignatureS) {\\n revert(\\\"ECDSA: invalid signature 's' value\\\");\\n } else if (error == RecoverError.InvalidSignatureV) {\\n revert(\\\"ECDSA: invalid signature 'v' value\\\");\\n }\\n }\\n\\n /**\\n * @dev Returns the address that signed a hashed message (`hash`) with\\n * `signature` or error string. This address can then be used for verification purposes.\\n *\\n * The `ecrecover` EVM opcode allows for malleable (non-unique) signatures:\\n * this function rejects them by requiring the `s` value to be in the lower\\n * half order, and the `v` value to be either 27 or 28.\\n *\\n * IMPORTANT: `hash` _must_ be the result of a hash operation for the\\n * verification to be secure: it is possible to craft signatures that\\n * recover to arbitrary addresses for non-hashed data. A safe way to ensure\\n * this is by receiving a hash of the original message (which may otherwise\\n * be too long), and then calling {toEthSignedMessageHash} on it.\\n *\\n * Documentation for signature generation:\\n * - with https://web3js.readthedocs.io/en/v1.3.4/web3-eth-accounts.html#sign[Web3.js]\\n * - with https://docs.ethers.io/v5/api/signer/#Signer-signMessage[ethers]\\n *\\n * _Available since v4.3._\\n */\\n function tryRecover(bytes32 hash, bytes memory signature) internal pure returns (address, RecoverError) {\\n // Check the signature length\\n // - case 65: r,s,v signature (standard)\\n // - case 64: r,vs signature (cf https://eips.ethereum.org/EIPS/eip-2098) _Available since v4.1._\\n if (signature.length == 65) {\\n bytes32 r;\\n bytes32 s;\\n uint8 v;\\n // ecrecover takes the signature parameters, and the only way to get them\\n // currently is to use assembly.\\n assembly {\\n r := mload(add(signature, 0x20))\\n s := mload(add(signature, 0x40))\\n v := byte(0, mload(add(signature, 0x60)))\\n }\\n return tryRecover(hash, v, r, s);\\n } else if (signature.length == 64) {\\n bytes32 r;\\n bytes32 vs;\\n // ecrecover takes the signature parameters, and the only way to get them\\n // currently is to use assembly.\\n assembly {\\n r := mload(add(signature, 0x20))\\n vs := mload(add(signature, 0x40))\\n }\\n return tryRecover(hash, r, vs);\\n } else {\\n return (address(0), RecoverError.InvalidSignatureLength);\\n }\\n }\\n\\n /**\\n * @dev Returns the address that signed a hashed message (`hash`) with\\n * `signature`. This address can then be used for verification purposes.\\n *\\n * The `ecrecover` EVM opcode allows for malleable (non-unique) signatures:\\n * this function rejects them by requiring the `s` value to be in the lower\\n * half order, and the `v` value to be either 27 or 28.\\n *\\n * IMPORTANT: `hash` _must_ be the result of a hash operation for the\\n * verification to be secure: it is possible to craft signatures that\\n * recover to arbitrary addresses for non-hashed data. A safe way to ensure\\n * this is by receiving a hash of the original message (which may otherwise\\n * be too long), and then calling {toEthSignedMessageHash} on it.\\n */\\n function recover(bytes32 hash, bytes memory signature) internal pure returns (address) {\\n (address recovered, RecoverError error) = tryRecover(hash, signature);\\n _throwError(error);\\n return recovered;\\n }\\n\\n /**\\n * @dev Overload of {ECDSA-tryRecover} that receives the `r` and `vs` short-signature fields separately.\\n *\\n * See https://eips.ethereum.org/EIPS/eip-2098[EIP-2098 short signatures]\\n *\\n * _Available since v4.3._\\n */\\n function tryRecover(\\n bytes32 hash,\\n bytes32 r,\\n bytes32 vs\\n ) internal pure returns (address, RecoverError) {\\n bytes32 s = vs & bytes32(0x7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff);\\n uint8 v = uint8((uint256(vs) >> 255) + 27);\\n return tryRecover(hash, v, r, s);\\n }\\n\\n /**\\n * @dev Overload of {ECDSA-recover} that receives the `r and `vs` short-signature fields separately.\\n *\\n * _Available since v4.2._\\n */\\n function recover(\\n bytes32 hash,\\n bytes32 r,\\n bytes32 vs\\n ) internal pure returns (address) {\\n (address recovered, RecoverError error) = tryRecover(hash, r, vs);\\n _throwError(error);\\n return recovered;\\n }\\n\\n /**\\n * @dev Overload of {ECDSA-tryRecover} that receives the `v`,\\n * `r` and `s` signature fields separately.\\n *\\n * _Available since v4.3._\\n */\\n function tryRecover(\\n bytes32 hash,\\n uint8 v,\\n bytes32 r,\\n bytes32 s\\n ) internal pure returns (address, RecoverError) {\\n // EIP-2 still allows signature malleability for ecrecover(). Remove this possibility and make the signature\\n // unique. Appendix F in the Ethereum Yellow paper (https://ethereum.github.io/yellowpaper/paper.pdf), defines\\n // the valid range for s in (301): 0 < s < secp256k1n \\u00f7 2 + 1, and for v in (302): v \\u2208 {27, 28}. Most\\n // signatures from current libraries generate a unique signature with an s-value in the lower half order.\\n //\\n // If your library generates malleable signatures, such as s-values in the upper range, calculate a new s-value\\n // with 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFEBAAEDCE6AF48A03BBFD25E8CD0364141 - s1 and flip v from 27 to 28 or\\n // vice versa. If your library also generates signatures with 0/1 for v instead 27/28, add 27 to v to accept\\n // these malleable signatures as well.\\n if (uint256(s) > 0x7FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF5D576E7357A4501DDFE92F46681B20A0) {\\n return (address(0), RecoverError.InvalidSignatureS);\\n }\\n if (v != 27 && v != 28) {\\n return (address(0), RecoverError.InvalidSignatureV);\\n }\\n\\n // If the signature is valid (and not malleable), return the signer address\\n address signer = ecrecover(hash, v, r, s);\\n if (signer == address(0)) {\\n return (address(0), RecoverError.InvalidSignature);\\n }\\n\\n return (signer, RecoverError.NoError);\\n }\\n\\n /**\\n * @dev Overload of {ECDSA-recover} that receives the `v`,\\n * `r` and `s` signature fields separately.\\n */\\n function recover(\\n bytes32 hash,\\n uint8 v,\\n bytes32 r,\\n bytes32 s\\n ) internal pure returns (address) {\\n (address recovered, RecoverError error) = tryRecover(hash, v, r, s);\\n _throwError(error);\\n return recovered;\\n }\\n\\n /**\\n * @dev Returns an Ethereum Signed Message, created from a `hash`. This\\n * produces hash corresponding to the one signed with the\\n * https://eth.wiki/json-rpc/API#eth_sign[`eth_sign`]\\n * JSON-RPC method as part of EIP-191.\\n *\\n * See {recover}.\\n */\\n function toEthSignedMessageHash(bytes32 hash) internal pure returns (bytes32) {\\n // 32 is the length in bytes of hash,\\n // enforced by the type signature above\\n return keccak256(abi.encodePacked(\\\"\\\\x19Ethereum Signed Message:\\\\n32\\\", hash));\\n }\\n\\n /**\\n * @dev Returns an Ethereum Signed Message, created from `s`. This\\n * produces hash corresponding to the one signed with the\\n * https://eth.wiki/json-rpc/API#eth_sign[`eth_sign`]\\n * JSON-RPC method as part of EIP-191.\\n *\\n * See {recover}.\\n */\\n function toEthSignedMessageHash(bytes memory s) internal pure returns (bytes32) {\\n return keccak256(abi.encodePacked(\\\"\\\\x19Ethereum Signed Message:\\\\n\\\", Strings.toString(s.length), s));\\n }\\n\\n /**\\n * @dev Returns an Ethereum Signed Typed Data, created from a\\n * `domainSeparator` and a `structHash`. This produces hash corresponding\\n * to the one signed with the\\n * https://eips.ethereum.org/EIPS/eip-712[`eth_signTypedData`]\\n * JSON-RPC method as part of EIP-712.\\n *\\n * See {recover}.\\n */\\n function toTypedDataHash(bytes32 domainSeparator, bytes32 structHash) internal pure returns (bytes32) {\\n return keccak256(abi.encodePacked(\\\"\\\\x19\\\\x01\\\", domainSeparator, structHash));\\n }\\n}\\n\",\"keccak256\":\"0x3c07f43e60e099b3b157243b3152722e73b80eeb7985c2cd73712828d7f7da29\",\"license\":\"MIT\"},\"@openzeppelin/contracts/utils/cryptography/MerkleProof.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.5.0) (utils/cryptography/MerkleProof.sol)\\n\\npragma solidity ^0.8.0;\\n\\n/**\\n * @dev These functions deal with verification of Merkle Trees proofs.\\n *\\n * The proofs can be generated using the JavaScript library\\n * https://github.com/miguelmota/merkletreejs[merkletreejs].\\n * Note: the hashing algorithm should be keccak256 and pair sorting should be enabled.\\n *\\n * See `test/utils/cryptography/MerkleProof.test.js` for some examples.\\n */\\nlibrary MerkleProof {\\n /**\\n * @dev Returns true if a `leaf` can be proved to be a part of a Merkle tree\\n * defined by `root`. For this, a `proof` must be provided, containing\\n * sibling hashes on the branch from the leaf to the root of the tree. Each\\n * pair of leaves and each pair of pre-images are assumed to be sorted.\\n */\\n function verify(\\n bytes32[] memory proof,\\n bytes32 root,\\n bytes32 leaf\\n ) internal pure returns (bool) {\\n return processProof(proof, leaf) == root;\\n }\\n\\n /**\\n * @dev Returns the rebuilt hash obtained by traversing a Merklee tree up\\n * from `leaf` using `proof`. A `proof` is valid if and only if the rebuilt\\n * hash matches the root of the tree. When processing the proof, the pairs\\n * of leafs & pre-images are assumed to be sorted.\\n *\\n * _Available since v4.4._\\n */\\n function processProof(bytes32[] memory proof, bytes32 leaf) internal pure returns (bytes32) {\\n bytes32 computedHash = leaf;\\n for (uint256 i = 0; i < proof.length; i++) {\\n bytes32 proofElement = proof[i];\\n if (computedHash <= proofElement) {\\n // Hash(current computed hash + current element of the proof)\\n computedHash = _efficientHash(computedHash, proofElement);\\n } else {\\n // Hash(current element of the proof + current computed hash)\\n computedHash = _efficientHash(proofElement, computedHash);\\n }\\n }\\n return computedHash;\\n }\\n\\n function _efficientHash(bytes32 a, bytes32 b) private pure returns (bytes32 value) {\\n assembly {\\n mstore(0x00, a)\\n mstore(0x20, b)\\n value := keccak256(0x00, 0x40)\\n }\\n }\\n}\\n\",\"keccak256\":\"0xea64fbaccbf9d8c235cf6838240ddcebb97f9fc383660289e9dff32e4fb85f7a\",\"license\":\"MIT\"},\"@uma/core/contracts/common/implementation/MultiCaller.sol\":{\"content\":\"// This contract is taken from Uniswaps'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.\\npragma solidity ^0.8.0;\\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 payable returns (bytes[] memory results) {\\n require(msg.value == 0, \\\"Only multicall with 0 value\\\");\\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\",\"keccak256\":\"0x31f18055b14fd9eeb459c6d6a88d1a60921bf3755031f6db4b709c3e01d078f7\"},\"@uma/core/contracts/common/implementation/Testable.sol\":{\"content\":\"// SPDX-License-Identifier: AGPL-3.0-only\\npragma solidity ^0.8.0;\\n\\nimport \\\"./Timer.sol\\\";\\n\\n/**\\n * @title Base class that provides time overrides, but only if being run in test mode.\\n */\\nabstract contract Testable {\\n // If the contract is being run in production, then `timerAddress` will be the 0x0 address.\\n // Note: this variable should be set on construction and never modified.\\n address public timerAddress;\\n\\n /**\\n * @notice Constructs the Testable contract. Called by child contracts.\\n * @param _timerAddress Contract that stores the current time in a testing environment.\\n * Must be set to 0x0 for production environments that use live time.\\n */\\n constructor(address _timerAddress) {\\n timerAddress = _timerAddress;\\n }\\n\\n /**\\n * @notice Reverts if not running in test mode.\\n */\\n modifier onlyIfTest {\\n require(timerAddress != address(0x0));\\n _;\\n }\\n\\n /**\\n * @notice Sets the current time.\\n * @dev Will revert if not running in test mode.\\n * @param time timestamp to set current Testable time to.\\n */\\n function setCurrentTime(uint256 time) external onlyIfTest {\\n Timer(timerAddress).setCurrentTime(time);\\n }\\n\\n /**\\n * @notice Gets the current time. Will return the last time set in `setCurrentTime` if running in test mode.\\n * Otherwise, it will return the block timestamp.\\n * @return uint for the current Testable timestamp.\\n */\\n function getCurrentTime() public view virtual returns (uint256) {\\n if (timerAddress != address(0x0)) {\\n return Timer(timerAddress).getCurrentTime();\\n } else {\\n return block.timestamp; // solhint-disable-line not-rely-on-time\\n }\\n }\\n}\\n\",\"keccak256\":\"0x0254b45747293bb800373a58d123969adec0428f7be79dc941cab10fcad09918\",\"license\":\"AGPL-3.0-only\"},\"@uma/core/contracts/common/implementation/Timer.sol\":{\"content\":\"// SPDX-License-Identifier: AGPL-3.0-only\\npragma solidity ^0.8.0;\\n\\n/**\\n * @title Universal store of current contract time for testing environments.\\n */\\ncontract Timer {\\n uint256 private currentTime;\\n\\n constructor() {\\n currentTime = block.timestamp; // solhint-disable-line not-rely-on-time\\n }\\n\\n /**\\n * @notice Sets the current time.\\n * @dev Will revert if not running in test mode.\\n * @param time timestamp to set `currentTime` to.\\n */\\n function setCurrentTime(uint256 time) external {\\n currentTime = time;\\n }\\n\\n /**\\n * @notice Gets the currentTime variable set in the Timer.\\n * @return uint256 for the current Testable timestamp.\\n */\\n function getCurrentTime() public view returns (uint256) {\\n return currentTime;\\n }\\n}\\n\",\"keccak256\":\"0x9e0dd7389718bd5d1da910273a6f4cee98ee22bfc0c92bde0f0955c0e23adb5e\",\"license\":\"AGPL-3.0-only\"},\"contracts/Arbitrum_SpokePool.sol\":{\"content\":\"// SPDX-License-Identifier: GPL-3.0-only\\npragma solidity ^0.8.0;\\n\\nimport \\\"./SpokePool.sol\\\";\\n\\ninterface StandardBridgeLike {\\n function outboundTransfer(\\n address _l1Token,\\n address _to,\\n uint256 _amount,\\n bytes calldata _data\\n ) external payable returns (bytes memory);\\n}\\n\\n/**\\n * @notice AVM specific SpokePool. Uses AVM cross-domain-enabled logic to implement admin only access to functions.\\n */\\ncontract Arbitrum_SpokePool is SpokePool {\\n // Address of the Arbitrum L2 token gateway to send funds to L1.\\n address public l2GatewayRouter;\\n\\n // Admin controlled mapping of arbitrum tokens to L1 counterpart. L1 counterpart addresses\\n // are necessary params used when bridging tokens to L1.\\n mapping(address => address) public whitelistedTokens;\\n\\n event ArbitrumTokensBridged(address indexed l1Token, address target, uint256 numberOfTokensBridged);\\n event SetL2GatewayRouter(address indexed newL2GatewayRouter);\\n event WhitelistedTokens(address indexed l2Token, address indexed l1Token);\\n\\n /**\\n * @notice Construct the AVM SpokePool.\\n * @param _l2GatewayRouter Address of L2 token gateway. Can be reset by admin.\\n * @param _crossDomainAdmin Cross domain admin to set. Can be changed by admin.\\n * @param _hubPool Hub pool address to set. Can be changed by admin.\\n * @param _wethAddress Weth address for this network to set.\\n * @param timerAddress Timer address to set.\\n */\\n constructor(\\n address _l2GatewayRouter,\\n address _crossDomainAdmin,\\n address _hubPool,\\n address _wethAddress,\\n address timerAddress\\n ) SpokePool(_crossDomainAdmin, _hubPool, _wethAddress, timerAddress) {\\n _setL2GatewayRouter(_l2GatewayRouter);\\n }\\n\\n modifier onlyFromCrossDomainAdmin() {\\n require(msg.sender == _applyL1ToL2Alias(crossDomainAdmin), \\\"ONLY_COUNTERPART_GATEWAY\\\");\\n _;\\n }\\n\\n /********************************************************\\n * ARBITRUM-SPECIFIC CROSS-CHAIN ADMIN FUNCTIONS *\\n ********************************************************/\\n\\n /**\\n * @notice Change L2 gateway router. Callable only by admin.\\n * @param newL2GatewayRouter New L2 gateway router.\\n */\\n function setL2GatewayRouter(address newL2GatewayRouter) public onlyAdmin nonReentrant {\\n _setL2GatewayRouter(newL2GatewayRouter);\\n }\\n\\n /**\\n * @notice Add L2 -> L1 token mapping. Callable only by admin.\\n * @param l2Token Arbitrum token.\\n * @param l1Token Ethereum version of l2Token.\\n */\\n function whitelistToken(address l2Token, address l1Token) public onlyAdmin nonReentrant {\\n _whitelistToken(l2Token, l1Token);\\n }\\n\\n /**************************************\\n * INTERNAL FUNCTIONS *\\n **************************************/\\n\\n function _bridgeTokensToHubPool(RelayerRefundLeaf memory relayerRefundLeaf) internal override {\\n // Check that the Ethereum counterpart of the L2 token is stored on this contract.\\n address ethereumTokenToBridge = whitelistedTokens[relayerRefundLeaf.l2TokenAddress];\\n require(ethereumTokenToBridge != address(0), \\\"Uninitialized mainnet token\\\");\\n StandardBridgeLike(l2GatewayRouter).outboundTransfer(\\n ethereumTokenToBridge, // _l1Token. Address of the L1 token to bridge over.\\n hubPool, // _to. Withdraw, over the bridge, to the l1 hub pool contract.\\n relayerRefundLeaf.amountToReturn, // _amount.\\n \\\"\\\" // _data. We don't need to send any data for the bridging action.\\n );\\n emit ArbitrumTokensBridged(address(0), hubPool, relayerRefundLeaf.amountToReturn);\\n }\\n\\n function _setL2GatewayRouter(address _l2GatewayRouter) internal {\\n l2GatewayRouter = _l2GatewayRouter;\\n emit SetL2GatewayRouter(l2GatewayRouter);\\n }\\n\\n function _whitelistToken(address _l2Token, address _l1Token) internal {\\n whitelistedTokens[_l2Token] = _l1Token;\\n emit WhitelistedTokens(_l2Token, _l1Token);\\n }\\n\\n // L1 addresses are transformed during l1->l2 calls.\\n // See https://developer.offchainlabs.com/docs/l1_l2_messages#address-aliasing for more information.\\n // This cannot be pulled directly from Arbitrum contracts because their contracts are not 0.8.X compatible and\\n // this operation takes advantage of overflows, whose behavior changed in 0.8.0.\\n function _applyL1ToL2Alias(address l1Address) internal pure returns (address l2Address) {\\n // Allows overflows as explained above.\\n unchecked {\\n l2Address = address(uint160(l1Address) + uint160(0x1111000000000000000000000000000000001111));\\n }\\n }\\n\\n // Apply AVM-specific transformation to cross domain admin address on L1.\\n function _requireAdminSender() internal override onlyFromCrossDomainAdmin {}\\n}\\n\",\"keccak256\":\"0xc268f7713116a22b39308cbf93decd4dfba223801a0013bb088aa8209d588234\",\"license\":\"GPL-3.0-only\"},\"contracts/HubPoolInterface.sol\":{\"content\":\"// SPDX-License-Identifier: GPL-3.0-only\\npragma solidity ^0.8.0;\\n\\nimport \\\"./interfaces/AdapterInterface.sol\\\";\\n\\nimport \\\"@openzeppelin/contracts/token/ERC20/IERC20.sol\\\";\\n\\n/**\\n * @notice Concise list of functions in HubPool implementation.\\n */\\ninterface HubPoolInterface {\\n // This leaf is meant to be decoded in the HubPool to rebalance tokens between HubPool and SpokePool.\\n struct PoolRebalanceLeaf {\\n // This is used to know which chain to send cross-chain transactions to (and which SpokePool to send to).\\n uint256 chainId;\\n // Total LP fee amount per token in this bundle, encompassing all associated bundled relays.\\n uint256[] bundleLpFees;\\n // This array is grouped with the two above, and it represents the amount to send or request back from the\\n // SpokePool. If positive, the pool will pay the SpokePool. If negative the SpokePool will pay the HubPool.\\n // There can be arbitrarily complex rebalancing rules defined offchain. This number is only nonzero when the\\n // rules indicate that a rebalancing action should occur. When a rebalance does occur, runningBalances should be\\n // set to zero for this token and the netSendAmounts should be set to the previous runningBalances + relays -\\n // deposits in this bundle. If non-zero then it must be set on the SpokePool's RelayerRefundLeaf amountToReturn\\n // as -1 * this value to indicate if funds are being sent from or to the SpokePool.\\n int256[] netSendAmounts;\\n // This is only here to be emitted in an event to track a running unpaid balance between the L2 pool and the L1\\n // pool. A positive number indicates that the HubPool owes the SpokePool funds. A negative number indicates that\\n // the SpokePool owes the HubPool funds. See the comment above for the dynamics of this and netSendAmounts.\\n int256[] runningBalances;\\n // Used by data worker to mark which leaves should relay roots to SpokePools, and to otherwise organize leaves.\\n // For example, each leaf should contain all the rebalance information for a single chain, but in the case where\\n // the list of l1Tokens is very large such that they all can't fit into a single leaf that can be executed under\\n // the block gas limit, then the data worker can use this groupIndex to organize them. Any leaves with\\n // a groupIndex equal to 0 will relay roots to the SpokePool, so the data worker should ensure that only one\\n // leaf for a specific chainId should have a groupIndex equal to 0.\\n uint256 groupIndex;\\n // Used as the index in the bitmap to track whether this leaf has been executed or not.\\n uint8 leafId;\\n // The following arrays are required to be the same length. They are parallel arrays for the given chainId and\\n // should be ordered by the l1Tokens field. All whitelisted tokens with nonzero relays on this chain in this\\n // bundle in the order of whitelisting.\\n address[] l1Tokens;\\n }\\n\\n // A data worker can optimistically store several merkle roots on this contract by staking a bond and calling\\n // proposeRootBundle. By staking a bond, the data worker is alleging that the merkle roots all contain valid leaves\\n // that can be executed later to:\\n // - Send funds from this contract to a SpokePool or vice versa\\n // - Send funds from a SpokePool to Relayer as a refund for a relayed deposit\\n // - Send funds from a SpokePool to a deposit recipient to fulfill a \\\"slow\\\" relay\\n // Anyone can dispute this struct if the merkle roots contain invalid leaves before the\\n // requestExpirationTimestamp. Once the expiration timestamp is passed, executeRootBundle to execute a leaf\\n // from the poolRebalanceRoot on this contract and it will simultaneously publish the relayerRefundRoot and\\n // slowRelayRoot to a SpokePool. The latter two roots, once published to the SpokePool, contain\\n // leaves that can be executed on the SpokePool to pay relayers or recipients.\\n struct RootBundle {\\n // Contains leaves instructing this contract to send funds to SpokePools.\\n bytes32 poolRebalanceRoot;\\n // Relayer refund merkle root to be published to a SpokePool.\\n bytes32 relayerRefundRoot;\\n // Slow relay merkle root to be published to a SpokePool.\\n bytes32 slowRelayRoot;\\n // This is a 1D bitmap, with max size of 256 elements, limiting us to 256 chainsIds.\\n uint256 claimedBitMap;\\n // Proposer of this root bundle.\\n address proposer;\\n // Number of pool rebalance leaves to execute in the poolRebalanceRoot. After this number\\n // of leaves are executed, a new root bundle can be proposed\\n uint8 unclaimedPoolRebalanceLeafCount;\\n // When root bundle challenge period passes and this root bundle becomes executable.\\n uint32 requestExpirationTimestamp;\\n }\\n\\n // Each whitelisted L1 token has an associated pooledToken struct that contains all information used to track the\\n // cumulative LP positions and if this token is enabled for deposits.\\n struct PooledToken {\\n // LP token given to LPs of a specific L1 token.\\n address lpToken;\\n // True if accepting new LP's.\\n bool isEnabled;\\n // Timestamp of last LP fee update.\\n uint32 lastLpFeeUpdate;\\n // Number of LP funds sent via pool rebalances to SpokePools and are expected to be sent\\n // back later.\\n int256 utilizedReserves;\\n // Number of LP funds held in contract less utilized reserves.\\n uint256 liquidReserves;\\n // Number of LP funds reserved to pay out to LPs as fees.\\n uint256 undistributedLpFees;\\n }\\n\\n // Helper contracts to facilitate cross chain actions between HubPool and SpokePool for a specific network.\\n struct CrossChainContract {\\n address adapter;\\n address spokePool;\\n }\\n\\n function setPaused(bool pause) external;\\n\\n function emergencyDeleteProposal() external;\\n\\n function relaySpokePoolAdminFunction(uint256 chainId, bytes memory functionData) external;\\n\\n function setProtocolFeeCapture(address newProtocolFeeCaptureAddress, uint256 newProtocolFeeCapturePct) external;\\n\\n function setBond(IERC20 newBondToken, uint256 newBondAmount) external;\\n\\n function setLiveness(uint32 newLiveness) external;\\n\\n function setIdentifier(bytes32 newIdentifier) external;\\n\\n function setCrossChainContracts(\\n uint256 l2ChainId,\\n address adapter,\\n address spokePool\\n ) external;\\n\\n function enableL1TokenForLiquidityProvision(address l1Token) external;\\n\\n function disableL1TokenForLiquidityProvision(address l1Token) external;\\n\\n function addLiquidity(address l1Token, uint256 l1TokenAmount) external payable;\\n\\n function removeLiquidity(\\n address l1Token,\\n uint256 lpTokenAmount,\\n bool sendEth\\n ) external;\\n\\n function exchangeRateCurrent(address l1Token) external returns (uint256);\\n\\n function liquidityUtilizationCurrent(address l1Token) external returns (uint256);\\n\\n function liquidityUtilizationPostRelay(address token, uint256 relayedAmount) external returns (uint256);\\n\\n function sync(address l1Token) external;\\n\\n function proposeRootBundle(\\n uint256[] memory bundleEvaluationBlockNumbers,\\n uint8 poolRebalanceLeafCount,\\n bytes32 poolRebalanceRoot,\\n bytes32 relayerRefundRoot,\\n bytes32 slowRelayRoot\\n ) external;\\n\\n function executeRootBundle(\\n uint256 chainId,\\n uint256 groupIndex,\\n uint256[] memory bundleLpFees,\\n int256[] memory netSendAmounts,\\n int256[] memory runningBalances,\\n uint8 leafId,\\n address[] memory l1Tokens,\\n bytes32[] memory proof\\n ) external;\\n\\n function disputeRootBundle() external;\\n\\n function claimProtocolFeesCaptured(address l1Token) external;\\n\\n function setPoolRebalanceRoute(\\n uint256 destinationChainId,\\n address l1Token,\\n address destinationToken\\n ) external;\\n\\n function setDepositRoute(\\n uint256 originChainId,\\n uint256 destinationChainId,\\n address originToken,\\n bool depositsEnabled\\n ) external;\\n\\n function poolRebalanceRoute(uint256 destinationChainId, address l1Token)\\n external\\n view\\n returns (address destinationToken);\\n\\n function loadEthForL2Calls() external payable;\\n}\\n\",\"keccak256\":\"0x71b427ffd4a1e8c0cc681bafe050c536d79464f12559e90172681e6745f2e7bc\",\"license\":\"GPL-3.0-only\"},\"contracts/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 * @dev The reason why we use this local contract instead of importing from uma/contracts is because of the addition\\n * of the internal method `functionCallStackOriginatesFromOutsideThisContract` which doesn't exist in the one exported\\n * by uma/contracts.\\n */\\ncontract Lockable {\\n bool internal _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 /**\\n * @dev Returns true if the contract is currently in a non-entered state, meaning that the origination of the call\\n * came from outside the contract. This is relevant with fallback/receive methods to see if the call came from ETH\\n * being dropped onto the contract externally or due to ETH dropped on the the contract from within a method in this\\n * contract, such as unwrapping WETH to ETH within the contract.\\n */\\n function functionCallStackOriginatesFromOutsideThisContract() internal view returns (bool) {\\n return _notEntered;\\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\",\"keccak256\":\"0xef490be5cb859c97c6f600f3b0db0d50c6e18f334d3c74c6d9e693a260eaec3e\",\"license\":\"AGPL-3.0-only\"},\"contracts/MerkleLib.sol\":{\"content\":\"// SPDX-License-Identifier: GPL-3.0-only\\npragma solidity ^0.8.0;\\n\\nimport \\\"./SpokePoolInterface.sol\\\";\\nimport \\\"./HubPoolInterface.sol\\\";\\n\\nimport \\\"@openzeppelin/contracts/utils/cryptography/MerkleProof.sol\\\";\\n\\n/**\\n * @notice Library to help with merkle roots, proofs, and claims.\\n */\\nlibrary MerkleLib {\\n /**\\n * @notice Verifies that a repayment is contained within a merkle root.\\n * @param root the merkle root.\\n * @param rebalance the rebalance struct.\\n * @param proof the merkle proof.\\n * @return bool to signal if the pool rebalance proof correctly shows inclusion of the rebalance within the tree.\\n */\\n function verifyPoolRebalance(\\n bytes32 root,\\n HubPoolInterface.PoolRebalanceLeaf memory rebalance,\\n bytes32[] memory proof\\n ) internal pure returns (bool) {\\n return MerkleProof.verify(proof, root, keccak256(abi.encode(rebalance)));\\n }\\n\\n /**\\n * @notice Verifies that a relayer refund is contained within a merkle root.\\n * @param root the merkle root.\\n * @param refund the refund struct.\\n * @param proof the merkle proof.\\n * @return bool to signal if the relayer refund proof correctly shows inclusion of the refund within the tree.\\n */\\n function verifyRelayerRefund(\\n bytes32 root,\\n SpokePoolInterface.RelayerRefundLeaf memory refund,\\n bytes32[] memory proof\\n ) internal pure returns (bool) {\\n return MerkleProof.verify(proof, root, keccak256(abi.encode(refund)));\\n }\\n\\n /**\\n * @notice Verifies that a distribution is contained within a merkle root.\\n * @param root the merkle root.\\n * @param slowRelayFulfillment the relayData fulfillment struct.\\n * @param proof the merkle proof.\\n * @return bool to signal if the slow relay's proof correctly shows inclusion of the slow relay within the tree.\\n */\\n function verifySlowRelayFulfillment(\\n bytes32 root,\\n SpokePoolInterface.RelayData memory slowRelayFulfillment,\\n bytes32[] memory proof\\n ) internal pure returns (bool) {\\n return MerkleProof.verify(proof, root, keccak256(abi.encode(slowRelayFulfillment)));\\n }\\n\\n // The following functions are primarily copied from\\n // https://github.com/Uniswap/merkle-distributor/blob/master/contracts/MerkleDistributor.sol with minor changes.\\n\\n /**\\n * @notice Tests whether a claim is contained within a claimedBitMap mapping.\\n * @param claimedBitMap a simple uint256 mapping in storage used as a bitmap.\\n * @param index the index to check in the bitmap.\\n * @return bool indicating if the index within the claimedBitMap has been marked as claimed.\\n */\\n function isClaimed(mapping(uint256 => uint256) storage claimedBitMap, uint256 index) internal view returns (bool) {\\n uint256 claimedWordIndex = index / 256;\\n uint256 claimedBitIndex = index % 256;\\n uint256 claimedWord = claimedBitMap[claimedWordIndex];\\n uint256 mask = (1 << claimedBitIndex);\\n return claimedWord & mask == mask;\\n }\\n\\n /**\\n * @notice Marks an index in a claimedBitMap as claimed.\\n * @param claimedBitMap a simple uint256 mapping in storage used as a bitmap.\\n * @param index the index to mark in the bitmap.\\n */\\n function setClaimed(mapping(uint256 => uint256) storage claimedBitMap, uint256 index) internal {\\n uint256 claimedWordIndex = index / 256;\\n uint256 claimedBitIndex = index % 256;\\n claimedBitMap[claimedWordIndex] = claimedBitMap[claimedWordIndex] | (1 << claimedBitIndex);\\n }\\n\\n /**\\n * @notice Tests whether a claim is contained within a 1D claimedBitMap mapping.\\n * @param claimedBitMap a simple uint256 value, encoding a 1D bitmap.\\n * @param index the index to check in the bitmap. Uint8 type enforces that index can't be > 255.\\n * @return bool indicating if the index within the claimedBitMap has been marked as claimed.\\n */\\n function isClaimed1D(uint256 claimedBitMap, uint8 index) internal pure returns (bool) {\\n uint256 mask = (1 << index);\\n return claimedBitMap & mask == mask;\\n }\\n\\n /**\\n * @notice Marks an index in a claimedBitMap as claimed.\\n * @param claimedBitMap a simple uint256 mapping in storage used as a bitmap. Uint8 type enforces that index\\n * can't be > 255.\\n * @param index the index to mark in the bitmap.\\n * @return uint256 representing the modified input claimedBitMap with the index set to true.\\n */\\n function setClaimed1D(uint256 claimedBitMap, uint8 index) internal pure returns (uint256) {\\n return claimedBitMap | (1 << index % 256);\\n }\\n}\\n\",\"keccak256\":\"0x5b49211d8b8e5a2792d08adb818fddc2ad8abaef45822f91ca678ceb7ea018ea\",\"license\":\"GPL-3.0-only\"},\"contracts/SpokePool.sol\":{\"content\":\"// SPDX-License-Identifier: GPL-3.0-only\\npragma solidity ^0.8.0;\\n\\nimport \\\"./MerkleLib.sol\\\";\\nimport \\\"./interfaces/WETH9.sol\\\";\\nimport \\\"./Lockable.sol\\\";\\nimport \\\"./SpokePoolInterface.sol\\\";\\n\\nimport \\\"@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol\\\";\\nimport \\\"@openzeppelin/contracts/token/ERC20/IERC20.sol\\\";\\nimport \\\"@openzeppelin/contracts/utils/Address.sol\\\";\\n\\nimport \\\"@openzeppelin/contracts/utils/cryptography/ECDSA.sol\\\";\\nimport \\\"@uma/core/contracts/common/implementation/Testable.sol\\\";\\nimport \\\"@uma/core/contracts/common/implementation/MultiCaller.sol\\\";\\n\\n/**\\n * @title SpokePool\\n * @notice Base contract deployed on source and destination chains enabling depositors to transfer assets from source to\\n * destination. Deposit orders are fulfilled by off-chain relayers who also interact with this contract. Deposited\\n * tokens are locked on the source chain and relayers send the recipient the desired token currency and amount\\n * on the destination chain. Locked source chain tokens are later sent over the canonical token bridge to L1 HubPool.\\n * Relayers are refunded with destination tokens out of this contract after another off-chain actor, a \\\"data worker\\\",\\n * submits a proof that the relayer correctly submitted a relay on this SpokePool.\\n */\\nabstract contract SpokePool is SpokePoolInterface, Testable, Lockable, MultiCaller {\\n using SafeERC20 for IERC20;\\n using Address for address;\\n\\n // Address of the L1 contract that acts as the owner of this SpokePool. If this contract is deployed on Ethereum,\\n // then this address should be set to the same owner as the HubPool and the whole system.\\n address public crossDomainAdmin;\\n\\n // Address of the L1 contract that will send tokens to and receive tokens from this contract to fund relayer\\n // refunds and slow relays.\\n address public hubPool;\\n\\n // Address of WETH contract for this network. If an origin token matches this, then the caller can optionally\\n // instruct this contract to wrap ETH when depositing.\\n WETH9 public immutable weth;\\n\\n // Any deposit quote times greater than or less than this value to the current contract time is blocked. Forces\\n // caller to use an approximately \\\"current\\\" realized fee. Defaults to 10 minutes.\\n uint32 public depositQuoteTimeBuffer = 600;\\n\\n // Count of deposits is used to construct a unique deposit identifier for this spoke pool.\\n uint32 public numberOfDeposits;\\n\\n // Origin token to destination token routings can be turned on or off, which can enable or disable deposits.\\n\\n mapping(address => mapping(uint256 => bool)) public enabledDepositRoutes;\\n\\n // This contract can store as many root bundles as the HubPool chooses to publish here.\\n RootBundle[] public rootBundles;\\n\\n // Each relay is associated with the hash of parameters that uniquely identify the original deposit and a relay\\n // attempt for that deposit. The relay itself is just represented as the amount filled so far. The total amount to\\n // relay, the fees, and the agents are all parameters included in the hash key.\\n mapping(bytes32 => uint256) public relayFills;\\n\\n /****************************************\\n * EVENTS *\\n ****************************************/\\n event SetXDomainAdmin(address indexed newAdmin);\\n event SetHubPool(address indexed newHubPool);\\n event EnabledDepositRoute(address indexed originToken, uint256 indexed destinationChainId, bool enabled);\\n event SetDepositQuoteTimeBuffer(uint32 newBuffer);\\n event FundsDeposited(\\n uint256 amount,\\n uint256 originChainId,\\n uint256 destinationChainId,\\n uint64 relayerFeePct,\\n uint32 indexed depositId,\\n uint32 quoteTimestamp,\\n address indexed originToken,\\n address recipient,\\n address indexed depositor\\n );\\n event RequestedSpeedUpDeposit(\\n uint64 newRelayerFeePct,\\n uint32 indexed depositId,\\n address indexed depositor,\\n bytes depositorSignature\\n );\\n event FilledRelay(\\n bytes32 indexed relayHash,\\n uint256 amount,\\n uint256 totalFilledAmount,\\n uint256 fillAmount,\\n uint256 repaymentChainId,\\n uint256 originChainId,\\n uint256 destinationChainId,\\n uint64 relayerFeePct,\\n uint64 realizedLpFeePct,\\n uint32 depositId,\\n address destinationToken,\\n address indexed relayer,\\n address indexed depositor,\\n address recipient,\\n bool isSlowRelay\\n );\\n event RelayedRootBundle(uint32 indexed rootBundleId, bytes32 relayerRefundRoot, bytes32 slowRelayRoot);\\n event ExecutedRelayerRefundRoot(\\n uint256 amountToReturn,\\n uint256 indexed chainId,\\n uint256[] refundAmounts,\\n uint32 indexed rootBundleId,\\n uint32 indexed leafId,\\n address l2TokenAddress,\\n address[] refundAddresses,\\n address caller\\n );\\n event TokensBridged(\\n uint256 amountToReturn,\\n uint256 indexed chainId,\\n uint32 indexed leafId,\\n address indexed l2TokenAddress,\\n address caller\\n );\\n event EmergencyDeleteRootBundle(uint256 indexed rootBundleId);\\n\\n /**\\n * @notice Construct the base SpokePool.\\n * @param _crossDomainAdmin Cross domain admin to set. Can be changed by admin.\\n * @param _hubPool Hub pool address to set. Can be changed by admin.\\n * @param _wethAddress Weth address for this network to set.\\n * @param timerAddress Timer address to set.\\n */\\n constructor(\\n address _crossDomainAdmin,\\n address _hubPool,\\n address _wethAddress,\\n address timerAddress\\n ) Testable(timerAddress) {\\n _setCrossDomainAdmin(_crossDomainAdmin);\\n _setHubPool(_hubPool);\\n weth = WETH9(_wethAddress);\\n }\\n\\n /****************************************\\n * MODIFIERS *\\n ****************************************/\\n\\n // Implementing contract needs to override _requireAdminSender() to ensure that admin functions are protected\\n // appropriately.\\n modifier onlyAdmin() {\\n _requireAdminSender();\\n _;\\n }\\n\\n /**************************************\\n * ADMIN FUNCTIONS *\\n **************************************/\\n\\n /**\\n * @notice Change cross domain admin address. Callable by admin only.\\n * @param newCrossDomainAdmin New cross domain admin.\\n */\\n function setCrossDomainAdmin(address newCrossDomainAdmin) public override onlyAdmin nonReentrant {\\n _setCrossDomainAdmin(newCrossDomainAdmin);\\n }\\n\\n /**\\n * @notice Change L1 hub pool address. Callable by admin only.\\n * @param newHubPool New hub pool.\\n */\\n function setHubPool(address newHubPool) public override onlyAdmin nonReentrant {\\n _setHubPool(newHubPool);\\n }\\n\\n /**\\n * @notice Enable/Disable an origin token => destination chain ID route for deposits. Callable by admin only.\\n * @param originToken Token that depositor can deposit to this contract.\\n * @param destinationChainId Chain ID for where depositor wants to receive funds.\\n * @param enabled True to enable deposits, False otherwise.\\n */\\n function setEnableRoute(\\n address originToken,\\n uint256 destinationChainId,\\n bool enabled\\n ) public override onlyAdmin nonReentrant {\\n enabledDepositRoutes[originToken][destinationChainId] = enabled;\\n emit EnabledDepositRoute(originToken, destinationChainId, enabled);\\n }\\n\\n /**\\n * @notice Change allowance for deposit quote time to differ from current block time. Callable by admin only.\\n * @param newDepositQuoteTimeBuffer New quote time buffer.\\n */\\n function setDepositQuoteTimeBuffer(uint32 newDepositQuoteTimeBuffer) public override onlyAdmin nonReentrant {\\n depositQuoteTimeBuffer = newDepositQuoteTimeBuffer;\\n emit SetDepositQuoteTimeBuffer(newDepositQuoteTimeBuffer);\\n }\\n\\n /**\\n * @notice This method stores a new root bundle in this contract that can be executed to refund relayers, fulfill\\n * slow relays, and send funds back to the HubPool on L1. This method can only be called by the admin and is\\n * designed to be called as part of a cross-chain message from the HubPool's executeRootBundle method.\\n * @param relayerRefundRoot Merkle root containing relayer refund leaves that can be individually executed via\\n * executeRelayerRefundRoot().\\n * @param slowRelayRoot Merkle root containing slow relay fulfillment leaves that can be individually executed via\\n * executeSlowRelayRoot().\\n */\\n function relayRootBundle(bytes32 relayerRefundRoot, bytes32 slowRelayRoot) public override onlyAdmin nonReentrant {\\n uint32 rootBundleId = uint32(rootBundles.length);\\n RootBundle storage rootBundle = rootBundles.push();\\n rootBundle.relayerRefundRoot = relayerRefundRoot;\\n rootBundle.slowRelayRoot = slowRelayRoot;\\n emit RelayedRootBundle(rootBundleId, relayerRefundRoot, slowRelayRoot);\\n }\\n\\n /**\\n * @notice This method is intended to only be used in emergencies where a bad root bundle has reached the\\n * SpokePool.\\n * @param rootBundleId Index of the root bundle that needs to be deleted. Note: this is intentionally a uint256\\n * to ensure that a small input range doesn't limit which indices this method is able to reach.\\n */\\n function emergencyDeleteRootBundle(uint256 rootBundleId) public override onlyAdmin nonReentrant {\\n delete rootBundles[rootBundleId];\\n emit EmergencyDeleteRootBundle(rootBundleId);\\n }\\n\\n /**************************************\\n * DEPOSITOR FUNCTIONS *\\n **************************************/\\n\\n /**\\n * @notice Called by user to bridge funds from origin to destination chain. Depositor will effectively lock\\n * tokens in this contract and receive a destination token on the destination chain. The origin => destination\\n * token mapping is stored on the L1 HubPool.\\n * @notice The caller must first approve this contract to spend amount of originToken.\\n * @notice The originToken => destinationChainId must be enabled.\\n * @notice This method is payable because the caller is able to deposit ETH if the originToken is WETH and this\\n * function will handle wrapping ETH.\\n * @param recipient Address to receive funds at on destination chain.\\n * @param originToken Token to lock into this contract to initiate deposit.\\n * @param amount Amount of tokens to deposit. Will be amount of tokens to receive less fees.\\n * @param destinationChainId Denotes network where user will receive funds from SpokePool by a relayer.\\n * @param relayerFeePct % of deposit amount taken out to incentivize a fast relayer.\\n * @param quoteTimestamp Timestamp used by relayers to compute this deposit's realizedLPFeePct which is paid\\n * to LP pool on HubPool.\\n */\\n function deposit(\\n address recipient,\\n address originToken,\\n uint256 amount,\\n uint256 destinationChainId,\\n uint64 relayerFeePct,\\n uint32 quoteTimestamp\\n ) public payable override nonReentrant {\\n // Check that deposit route is enabled.\\n require(enabledDepositRoutes[originToken][destinationChainId], \\\"Disabled route\\\");\\n\\n // We limit the relay fees to prevent the user spending all their funds on fees.\\n require(relayerFeePct < 0.5e18, \\\"invalid relayer fee\\\");\\n // This function assumes that L2 timing cannot be compared accurately and consistently to L1 timing. Therefore,\\n // block.timestamp is different from the L1 EVM's. Therefore, the quoteTimestamp must be within a configurable\\n // buffer of this contract's block time to allow for this variance.\\n // Note also that quoteTimestamp cannot be less than the buffer otherwise the following arithmetic can result\\n // in underflow. This isn't a problem as the deposit will revert, but the error might be unexpected for clients.\\n require(\\n getCurrentTime() >= quoteTimestamp - depositQuoteTimeBuffer &&\\n getCurrentTime() <= quoteTimestamp + depositQuoteTimeBuffer,\\n \\\"invalid quote time\\\"\\n );\\n // If the address of the origin token is a WETH contract and there is a msg.value with the transaction\\n // then the user is sending ETH. In this case, the ETH should be deposited to WETH.\\n if (originToken == address(weth) && msg.value > 0) {\\n require(msg.value == amount, \\\"msg.value must match amount\\\");\\n weth.deposit{ value: msg.value }();\\n // Else, it is a normal ERC20. In this case pull the token from the user's wallet as per normal.\\n // Note: this includes the case where the L2 user has WETH (already wrapped ETH) and wants to bridge them.\\n // In this case the msg.value will be set to 0, indicating a \\\"normal\\\" ERC20 bridging action.\\n } else IERC20(originToken).safeTransferFrom(msg.sender, address(this), amount);\\n\\n _emitDeposit(\\n amount,\\n chainId(),\\n destinationChainId,\\n relayerFeePct,\\n numberOfDeposits,\\n quoteTimestamp,\\n originToken,\\n recipient,\\n msg.sender\\n );\\n\\n // Increment count of deposits so that deposit ID for this spoke pool is unique.\\n numberOfDeposits += 1;\\n }\\n\\n /**\\n * @notice Convenience method that depositor can use to signal to relayer to use updated fee.\\n * @notice Relayer should only use events emitted by this function to submit fills with updated fees, otherwise they\\n * risk their fills getting disputed for being invalid, for example if the depositor never actually signed the\\n * update fee message.\\n * @notice This function will revert if the depositor did not sign a message containing the updated fee for the\\n * deposit ID stored in this contract. If the deposit ID is for another contract, or the depositor address is\\n * incorrect, or the updated fee is incorrect, then the signature will not match and this function will revert.\\n * @param depositor Signer of the update fee message who originally submitted the deposit. If the deposit doesn't\\n * exist, then the relayer will not be able to fill any relay, so the caller should validate that the depositor\\n * did in fact submit a relay.\\n * @param newRelayerFeePct New relayer fee that relayers can use.\\n * @param depositId Deposit to update fee for that originated in this contract.\\n * @param depositorSignature Signed message containing the depositor address, this contract chain ID, the updated\\n * relayer fee %, and the deposit ID. This signature is produced by signing a hash of data according to the\\n * EIP-191 standard. See more in the _verifyUpdateRelayerFeeMessage() comments.\\n */\\n function speedUpDeposit(\\n address depositor,\\n uint64 newRelayerFeePct,\\n uint32 depositId,\\n bytes memory depositorSignature\\n ) public override nonReentrant {\\n require(newRelayerFeePct < 0.5e18, \\\"invalid relayer fee\\\");\\n\\n _verifyUpdateRelayerFeeMessage(depositor, chainId(), newRelayerFeePct, depositId, depositorSignature);\\n\\n // Assuming the above checks passed, a relayer can take the signature and the updated relayer fee information\\n // from the following event to submit a fill with an updated fee %.\\n emit RequestedSpeedUpDeposit(newRelayerFeePct, depositId, depositor, depositorSignature);\\n }\\n\\n /**************************************\\n * RELAYER FUNCTIONS *\\n **************************************/\\n\\n /**\\n * @notice Called by relayer to fulfill part of a deposit by sending destination tokens to the recipient.\\n * Relayer is expected to pass in unique identifying information for deposit that they want to fulfill, and this\\n * relay submission will be validated by off-chain data workers who can dispute this relay if any part is invalid.\\n * If the relay is valid, then the relayer will be refunded on their desired repayment chain. If relay is invalid,\\n * then relayer will not receive any refund.\\n * @notice All of the deposit data can be found via on-chain events from the origin SpokePool, except for the\\n * realizedLpFeePct which is a function of the HubPool's utilization at the deposit quote time. This fee %\\n * is deterministic based on the quote time, so the relayer should just compute it using the canonical algorithm\\n * as described in a UMIP linked to the HubPool's identifier.\\n * @param depositor Depositor on origin chain who set this chain as the destination chain.\\n * @param recipient Specified recipient on this chain.\\n * @param destinationToken Token to send to recipient. Should be mapped to the origin token, origin chain ID\\n * and this chain ID via a mapping on the HubPool.\\n * @param amount Full size of the deposit.\\n * @param maxTokensToSend Max amount of tokens to send recipient. If higher than amount, then caller will\\n * send recipient the full relay amount.\\n * @param repaymentChainId Chain of SpokePool where relayer wants to be refunded after the challenge window has\\n * passed.\\n * @param originChainId Chain of SpokePool where deposit originated.\\n * @param realizedLpFeePct Fee % based on L1 HubPool utilization at deposit quote time. Deterministic based on\\n * quote time.\\n * @param relayerFeePct Fee % to keep as relayer, specified by depositor.\\n * @param depositId Unique deposit ID on origin spoke pool.\\n */\\n function fillRelay(\\n address depositor,\\n address recipient,\\n address destinationToken,\\n uint256 amount,\\n uint256 maxTokensToSend,\\n uint256 repaymentChainId,\\n uint256 originChainId,\\n uint64 realizedLpFeePct,\\n uint64 relayerFeePct,\\n uint32 depositId\\n ) public nonReentrant {\\n // Each relay attempt is mapped to the hash of data uniquely identifying it, which includes the deposit data\\n // such as the origin chain ID and the deposit ID, and the data in a relay attempt such as who the recipient\\n // is, which chain and currency the recipient wants to receive funds on, and the relay fees.\\n SpokePoolInterface.RelayData memory relayData = SpokePoolInterface.RelayData({\\n depositor: depositor,\\n recipient: recipient,\\n destinationToken: destinationToken,\\n amount: amount,\\n realizedLpFeePct: realizedLpFeePct,\\n relayerFeePct: relayerFeePct,\\n depositId: depositId,\\n originChainId: originChainId,\\n destinationChainId: chainId()\\n });\\n bytes32 relayHash = _getRelayHash(relayData);\\n\\n uint256 fillAmountPreFees = _fillRelay(relayHash, relayData, maxTokensToSend, relayerFeePct, false);\\n\\n _emitFillRelay(relayHash, fillAmountPreFees, repaymentChainId, relayerFeePct, relayData, false);\\n }\\n\\n /**\\n * @notice Called by relayer to execute same logic as calling fillRelay except that relayer is using an updated\\n * relayer fee %. The fee % must have been emitted in a message cryptographically signed by the depositor.\\n * @notice By design, the depositor probably emitted the message with the updated fee by calling speedUpRelay().\\n * @param depositor Depositor on origin chain who set this chain as the destination chain.\\n * @param recipient Specified recipient on this chain.\\n * @param destinationToken Token to send to recipient. Should be mapped to the origin token, origin chain ID\\n * and this chain ID via a mapping on the HubPool.\\n * @param amount Full size of the deposit.\\n * @param maxTokensToSend Max amount of tokens to send recipient. If higher than amount, then caller will\\n * send recipient the full relay amount.\\n * @param repaymentChainId Chain of SpokePool where relayer wants to be refunded after the challenge window has\\n * passed.\\n * @param originChainId Chain of SpokePool where deposit originated.\\n * @param realizedLpFeePct Fee % based on L1 HubPool utilization at deposit quote time. Deterministic based on\\n * quote time.\\n * @param relayerFeePct Original fee % to keep as relayer set by depositor.\\n * @param newRelayerFeePct New fee % to keep as relayer also specified by depositor.\\n * @param depositId Unique deposit ID on origin spoke pool.\\n * @param depositorSignature Depositor-signed message containing updated fee %.\\n */\\n function fillRelayWithUpdatedFee(\\n address depositor,\\n address recipient,\\n address destinationToken,\\n uint256 amount,\\n uint256 maxTokensToSend,\\n uint256 repaymentChainId,\\n uint256 originChainId,\\n uint64 realizedLpFeePct,\\n uint64 relayerFeePct,\\n uint64 newRelayerFeePct,\\n uint32 depositId,\\n bytes memory depositorSignature\\n ) public override nonReentrant {\\n _verifyUpdateRelayerFeeMessage(depositor, originChainId, newRelayerFeePct, depositId, depositorSignature);\\n\\n // Now follow the default fillRelay flow with the updated fee and the original relay hash.\\n RelayData memory relayData = RelayData({\\n depositor: depositor,\\n recipient: recipient,\\n destinationToken: destinationToken,\\n amount: amount,\\n realizedLpFeePct: realizedLpFeePct,\\n relayerFeePct: relayerFeePct,\\n depositId: depositId,\\n originChainId: originChainId,\\n destinationChainId: chainId()\\n });\\n bytes32 relayHash = _getRelayHash(relayData);\\n uint256 fillAmountPreFees = _fillRelay(relayHash, relayData, maxTokensToSend, newRelayerFeePct, false);\\n\\n _emitFillRelay(relayHash, fillAmountPreFees, repaymentChainId, newRelayerFeePct, relayData, false);\\n }\\n\\n /**************************************\\n * DATA WORKER FUNCTIONS *\\n **************************************/\\n\\n /**\\n * @notice Executes a slow relay leaf stored as part of a root bundle. Will send the full amount remaining in the\\n * relay to the recipient, less fees.\\n * @dev This function assumes that the relay's destination chain ID is the current chain ID, which prevents\\n * the caller from executing a slow relay intended for another chain on this chain.\\n * @param depositor Depositor on origin chain who set this chain as the destination chain.\\n * @param recipient Specified recipient on this chain.\\n * @param destinationToken Token to send to recipient. Should be mapped to the origin token, origin chain ID\\n * and this chain ID via a mapping on the HubPool.\\n * @param amount Full size of the deposit.\\n * @param originChainId Chain of SpokePool where deposit originated.\\n * @param realizedLpFeePct Fee % based on L1 HubPool utilization at deposit quote time. Deterministic based on\\n * quote time.\\n * @param relayerFeePct Original fee % to keep as relayer set by depositor.\\n * @param depositId Unique deposit ID on origin spoke pool.\\n * @param rootBundleId Unique ID of root bundle containing slow relay root that this leaf is contained in.\\n * @param proof Inclusion proof for this leaf in slow relay root in root bundle.\\n */\\n function executeSlowRelayRoot(\\n address depositor,\\n address recipient,\\n address destinationToken,\\n uint256 amount,\\n uint256 originChainId,\\n uint64 realizedLpFeePct,\\n uint64 relayerFeePct,\\n uint32 depositId,\\n uint32 rootBundleId,\\n bytes32[] memory proof\\n ) public virtual override nonReentrant {\\n _executeSlowRelayRoot(\\n depositor,\\n recipient,\\n destinationToken,\\n amount,\\n originChainId,\\n chainId(),\\n realizedLpFeePct,\\n relayerFeePct,\\n depositId,\\n rootBundleId,\\n proof\\n );\\n }\\n\\n /**\\n * @notice Executes a relayer refund leaf stored as part of a root bundle. Will send the relayer the amount they\\n * sent to the recipient plus a relayer fee.\\n * @param rootBundleId Unique ID of root bundle containing relayer refund root that this leaf is contained in.\\n * @param relayerRefundLeaf Contains all data necessary to reconstruct leaf contained in root bundle and to\\n * refund relayer. This data structure is explained in detail in the SpokePoolInterface.\\n * @param proof Inclusion proof for this leaf in relayer refund root in root bundle.\\n */\\n function executeRelayerRefundRoot(\\n uint32 rootBundleId,\\n SpokePoolInterface.RelayerRefundLeaf memory relayerRefundLeaf,\\n bytes32[] memory proof\\n ) public virtual override nonReentrant {\\n _executeRelayerRefundRoot(rootBundleId, relayerRefundLeaf, proof);\\n }\\n\\n /**************************************\\n * VIEW FUNCTIONS *\\n **************************************/\\n\\n /**\\n * @notice Returns chain ID for this network.\\n * @dev Some L2s like ZKSync don't support the CHAIN_ID opcode so we allow the implementer to override this.\\n */\\n function chainId() public view virtual override returns (uint256) {\\n return block.chainid;\\n }\\n\\n /**************************************\\n * INTERNAL FUNCTIONS *\\n **************************************/\\n\\n // Verifies inclusion proof of leaf in root, sends relayer their refund, and sends to HubPool any rebalance\\n // transfers.\\n function _executeRelayerRefundRoot(\\n uint32 rootBundleId,\\n SpokePoolInterface.RelayerRefundLeaf memory relayerRefundLeaf,\\n bytes32[] memory proof\\n ) internal {\\n // Check integrity of leaf structure:\\n require(relayerRefundLeaf.chainId == chainId(), \\\"Invalid chainId\\\");\\n require(relayerRefundLeaf.refundAddresses.length == relayerRefundLeaf.refundAmounts.length, \\\"invalid leaf\\\");\\n\\n RootBundle storage rootBundle = rootBundles[rootBundleId];\\n\\n // Check that inclusionProof proves that relayerRefundLeaf is contained within the relayer refund root.\\n // Note: This should revert if the relayerRefundRoot is uninitialized.\\n require(MerkleLib.verifyRelayerRefund(rootBundle.relayerRefundRoot, relayerRefundLeaf, proof), \\\"Bad Proof\\\");\\n\\n // Verify the leafId in the leaf has not yet been claimed.\\n require(!MerkleLib.isClaimed(rootBundle.claimedBitmap, relayerRefundLeaf.leafId), \\\"Already claimed\\\");\\n\\n // Set leaf as claimed in bitmap. This is passed by reference to the storage rootBundle.\\n MerkleLib.setClaimed(rootBundle.claimedBitmap, relayerRefundLeaf.leafId);\\n\\n // Send each relayer refund address the associated refundAmount for the L2 token address.\\n // Note: Even if the L2 token is not enabled on this spoke pool, we should still refund relayers.\\n for (uint32 i = 0; i < relayerRefundLeaf.refundAmounts.length; i++) {\\n uint256 amount = relayerRefundLeaf.refundAmounts[i];\\n if (amount > 0)\\n IERC20(relayerRefundLeaf.l2TokenAddress).safeTransfer(relayerRefundLeaf.refundAddresses[i], amount);\\n }\\n\\n // If leaf's amountToReturn is positive, then send L2 --> L1 message to bridge tokens back via\\n // chain-specific bridging method.\\n if (relayerRefundLeaf.amountToReturn > 0) {\\n _bridgeTokensToHubPool(relayerRefundLeaf);\\n\\n emit TokensBridged(\\n relayerRefundLeaf.amountToReturn,\\n relayerRefundLeaf.chainId,\\n relayerRefundLeaf.leafId,\\n relayerRefundLeaf.l2TokenAddress,\\n msg.sender\\n );\\n }\\n\\n emit ExecutedRelayerRefundRoot(\\n relayerRefundLeaf.amountToReturn,\\n relayerRefundLeaf.chainId,\\n relayerRefundLeaf.refundAmounts,\\n rootBundleId,\\n relayerRefundLeaf.leafId,\\n relayerRefundLeaf.l2TokenAddress,\\n relayerRefundLeaf.refundAddresses,\\n msg.sender\\n );\\n }\\n\\n // Verifies inclusion proof of leaf in root and sends recipient remainder of relay. Marks relay as filled.\\n function _executeSlowRelayRoot(\\n address depositor,\\n address recipient,\\n address destinationToken,\\n uint256 amount,\\n uint256 originChainId,\\n uint256 destinationChainId,\\n uint64 realizedLpFeePct,\\n uint64 relayerFeePct,\\n uint32 depositId,\\n uint32 rootBundleId,\\n bytes32[] memory proof\\n ) internal {\\n RelayData memory relayData = RelayData({\\n depositor: depositor,\\n recipient: recipient,\\n destinationToken: destinationToken,\\n amount: amount,\\n originChainId: originChainId,\\n destinationChainId: destinationChainId,\\n realizedLpFeePct: realizedLpFeePct,\\n relayerFeePct: relayerFeePct,\\n depositId: depositId\\n });\\n\\n require(\\n MerkleLib.verifySlowRelayFulfillment(rootBundles[rootBundleId].slowRelayRoot, relayData, proof),\\n \\\"Invalid proof\\\"\\n );\\n\\n bytes32 relayHash = _getRelayHash(relayData);\\n\\n // Note: use relayAmount as the max amount to send, so the relay is always completely filled by the contract's\\n // funds in all cases. As this is a slow relay we set the relayerFeePct to 0. This effectively refunds the\\n // relayer component of the relayerFee thereby only charging the depositor the LpFee.\\n uint256 fillAmountPreFees = _fillRelay(relayHash, relayData, relayData.amount, 0, true);\\n\\n // Note: Set repayment chain ID to 0 to indicate that there is no repayment to be made. The off-chain data\\n // worker can use repaymentChainId=0 as a signal to ignore such relays for refunds. Also, set the relayerFeePct\\n // to 0 as slow relays do not pay the caller of this method (depositor is refunded this fee).\\n _emitFillRelay(relayHash, fillAmountPreFees, 0, 0, relayData, true);\\n }\\n\\n function _setCrossDomainAdmin(address newCrossDomainAdmin) internal {\\n require(newCrossDomainAdmin != address(0), \\\"Bad bridge router address\\\");\\n crossDomainAdmin = newCrossDomainAdmin;\\n emit SetXDomainAdmin(crossDomainAdmin);\\n }\\n\\n function _setHubPool(address newHubPool) internal {\\n require(newHubPool != address(0), \\\"Bad hub pool address\\\");\\n hubPool = newHubPool;\\n emit SetHubPool(hubPool);\\n }\\n\\n // Should be overriden by implementing contract depending on how L2 handles sending tokens to L1.\\n function _bridgeTokensToHubPool(SpokePoolInterface.RelayerRefundLeaf memory relayerRefundLeaf) internal virtual;\\n\\n function _verifyUpdateRelayerFeeMessage(\\n address depositor,\\n uint256 originChainId,\\n uint64 newRelayerFeePct,\\n uint32 depositId,\\n bytes memory depositorSignature\\n ) internal view {\\n // A depositor can request to speed up an un-relayed deposit by signing a hash containing the relayer\\n // fee % to update to and information uniquely identifying the deposit to relay. This information ensures\\n // that this signature cannot be re-used for other deposits. The version string is included as a precaution\\n // in case this contract is upgraded.\\n // Note: we use encode instead of encodePacked because it is more secure, more in the \\\"warning\\\" section\\n // here: https://docs.soliditylang.org/en/v0.8.11/abi-spec.html#non-standard-packed-mode\\n bytes32 expectedDepositorMessageHash = keccak256(\\n abi.encode(\\\"ACROSS-V2-FEE-1.0\\\", newRelayerFeePct, depositId, originChainId)\\n );\\n\\n // Check the hash corresponding to the https://eth.wiki/json-rpc/API#eth_sign[eth_sign]\\n // If the depositor signed a message with a different updated fee (or any other param included in the\\n // above keccak156 hash), then this will revert.\\n bytes32 ethSignedMessageHash = ECDSA.toEthSignedMessageHash(expectedDepositorMessageHash);\\n\\n _verifyDepositorUpdateFeeMessage(depositor, ethSignedMessageHash, depositorSignature);\\n }\\n\\n // This function is isolated and made virtual to allow different L2's to implement chain specific recovery of\\n // signers from signatures because some L2s might not support ecrecover. To be safe, consider always reverting\\n // this function for L2s where ecrecover is different from how it works on Ethereum, otherwise there is the\\n // potential to forge a signature from the depositor using a different private key than the original depositor's.\\n function _verifyDepositorUpdateFeeMessage(\\n address depositor,\\n bytes32 ethSignedMessageHash,\\n bytes memory depositorSignature\\n ) internal view virtual {\\n // Note: We purposefully do not support EIP-191 signatures (meaning that multisigs and smart contract wallets\\n // like Argent are not supported) because of the possibility that a multisig that signed a message on the origin\\n // chain does not have a parallel on this destination chain.\\n require(depositor == ECDSA.recover(ethSignedMessageHash, depositorSignature), \\\"invalid signature\\\");\\n }\\n\\n function _computeAmountPreFees(uint256 amount, uint64 feesPct) private pure returns (uint256) {\\n return (1e18 * amount) / (1e18 - feesPct);\\n }\\n\\n function _computeAmountPostFees(uint256 amount, uint64 feesPct) private pure returns (uint256) {\\n return (amount * (1e18 - feesPct)) / 1e18;\\n }\\n\\n function _getRelayHash(SpokePoolInterface.RelayData memory relayData) private pure returns (bytes32) {\\n return keccak256(abi.encode(relayData));\\n }\\n\\n // Unwraps ETH and does a transfer to a recipient address. If the recipient is a smart contract then sends WETH.\\n function _unwrapWETHTo(address payable to, uint256 amount) internal {\\n if (address(to).isContract()) {\\n IERC20(address(weth)).safeTransfer(to, amount);\\n } else {\\n weth.withdraw(amount);\\n to.transfer(amount);\\n }\\n }\\n\\n /**\\n * @notice Caller specifies the max amount of tokens to send to user. Based on this amount and the amount of the\\n * relay remaining (as stored in the relayFills mapping), pull the amount of tokens from the caller\\n * and send to the recipient.\\n * @dev relayFills keeps track of pre-fee fill amounts as a convenience to relayers who want to specify round\\n * numbers for the maxTokensToSend parameter or convenient numbers like 100 (i.e. relayers who will fully\\n * fill any relay up to 100 tokens, and partial fill with 100 tokens for larger relays).\\n * @dev Caller must approve this contract to transfer up to maxTokensToSend of the relayData.destinationToken.\\n * The amount to be sent might end up less if there is insufficient relay amount remaining to be sent.\\n */\\n function _fillRelay(\\n bytes32 relayHash,\\n RelayData memory relayData,\\n uint256 maxTokensToSend,\\n uint64 updatableRelayerFeePct,\\n bool useContractFunds\\n ) internal returns (uint256 fillAmountPreFees) {\\n // We limit the relay fees to prevent the user spending all their funds on fees. Note that 0.5e18 (i.e. 50%)\\n // fees are just magic numbers. The important point is to prevent the total fee from being 100%, otherwise\\n // computing the amount pre fees runs into divide-by-0 issues.\\n require(updatableRelayerFeePct < 0.5e18 && relayData.realizedLpFeePct < 0.5e18, \\\"invalid fees\\\");\\n\\n // Check that the relay has not already been completely filled. Note that the relays mapping will point to\\n // the amount filled so far for a particular relayHash, so this will start at 0 and increment with each fill.\\n require(relayFills[relayHash] < relayData.amount, \\\"relay filled\\\");\\n\\n // Stores the equivalent amount to be sent by the relayer before fees have been taken out.\\n if (maxTokensToSend == 0) return 0;\\n\\n // Derive the amount of the relay filled if the caller wants to send exactly maxTokensToSend tokens to\\n // the recipient. For example, if the user wants to send 10 tokens to the recipient, the full relay amount\\n // is 100, and the fee %'s total 5%, then this computation would return ~10.5, meaning that to fill 10.5/100\\n // of the full relay size, the caller would need to send 10 tokens to the user.\\n fillAmountPreFees = _computeAmountPreFees(\\n maxTokensToSend,\\n (relayData.realizedLpFeePct + updatableRelayerFeePct)\\n );\\n // If user's specified max amount to send is greater than the amount of the relay remaining pre-fees,\\n // we'll pull exactly enough tokens to complete the relay.\\n uint256 amountToSend = maxTokensToSend;\\n uint256 amountRemainingInRelay = relayData.amount - relayFills[relayHash];\\n if (amountRemainingInRelay < fillAmountPreFees) {\\n fillAmountPreFees = amountRemainingInRelay;\\n\\n // The user will fulfill the remainder of the relay, so we need to compute exactly how many tokens post-fees\\n // that they need to send to the recipient. Note that if the relayer is filled using contract funds then\\n // this is a slow relay.\\n amountToSend = _computeAmountPostFees(\\n fillAmountPreFees,\\n relayData.realizedLpFeePct + updatableRelayerFeePct\\n );\\n }\\n\\n // relayFills keeps track of pre-fee fill amounts as a convenience to relayers who want to specify round\\n // numbers for the maxTokensToSend parameter or convenient numbers like 100 (i.e. relayers who will fully\\n // fill any relay up to 100 tokens, and partial fill with 100 tokens for larger relays).\\n relayFills[relayHash] += fillAmountPreFees;\\n\\n // If relay token is weth then unwrap and send eth.\\n if (relayData.destinationToken == address(weth)) {\\n // Note: useContractFunds is True if we want to send funds to the recipient directly out of this contract,\\n // otherwise we expect the caller to send funds to the recipient. If useContractFunds is True and the\\n // recipient wants WETH, then we can assume that WETH is already in the contract, otherwise we'll need the\\n // the user to send WETH to this contract. Regardless, we'll need to unwrap it before sending to the user.\\n if (!useContractFunds)\\n IERC20(relayData.destinationToken).safeTransferFrom(msg.sender, address(this), amountToSend);\\n _unwrapWETHTo(payable(relayData.recipient), amountToSend);\\n // Else, this is a normal ERC20 token. Send to recipient.\\n } else {\\n // Note: Similar to note above, send token directly from the contract to the user in the slow relay case.\\n if (!useContractFunds)\\n IERC20(relayData.destinationToken).safeTransferFrom(msg.sender, relayData.recipient, amountToSend);\\n else IERC20(relayData.destinationToken).safeTransfer(relayData.recipient, amountToSend);\\n }\\n }\\n\\n // The following internal methods emit events with many params to overcome solidity stack too deep issues.\\n function _emitFillRelay(\\n bytes32 relayHash,\\n uint256 fillAmount,\\n uint256 repaymentChainId,\\n uint64 relayerFeePct,\\n RelayData memory relayData,\\n bool isSlowRelay\\n ) internal {\\n emit FilledRelay(\\n relayHash,\\n relayData.amount,\\n relayFills[relayHash],\\n fillAmount,\\n repaymentChainId,\\n relayData.originChainId,\\n relayData.destinationChainId,\\n relayerFeePct,\\n relayData.realizedLpFeePct,\\n relayData.depositId,\\n relayData.destinationToken,\\n msg.sender,\\n relayData.depositor,\\n relayData.recipient,\\n isSlowRelay\\n );\\n }\\n\\n function _emitDeposit(\\n uint256 amount,\\n uint256 originChainId,\\n uint256 destinationChainId,\\n uint64 relayerFeePct,\\n uint32 depositId,\\n uint32 quoteTimestamp,\\n address originToken,\\n address recipient,\\n address depositor\\n ) internal {\\n emit FundsDeposited(\\n amount,\\n originChainId,\\n destinationChainId,\\n relayerFeePct,\\n depositId,\\n quoteTimestamp,\\n originToken,\\n recipient,\\n depositor\\n );\\n }\\n\\n // Implementing contract needs to override this to ensure that only the appropriate cross chain admin can execute\\n // certain admin functions. For L2 contracts, the cross chain admin refers to some L1 address or contract, and for\\n // L1, this would just be the same admin of the HubPool.\\n function _requireAdminSender() internal virtual;\\n\\n // Added to enable the this contract to receive ETH. Used when unwrapping Weth.\\n receive() external payable {}\\n}\\n\",\"keccak256\":\"0x460bea0562b87af55699b2ec0e53735b2224039573f9c5243815541263588bc1\",\"license\":\"GPL-3.0-only\"},\"contracts/SpokePoolInterface.sol\":{\"content\":\"// SPDX-License-Identifier: GPL-3.0-only\\npragma solidity ^0.8.0;\\n\\n/**\\n * @notice Contains common data structures and functions used by all SpokePool implementations.\\n */\\ninterface SpokePoolInterface {\\n // This leaf is meant to be decoded in the SpokePool to pay out successful relayers.\\n struct RelayerRefundLeaf {\\n // This is the amount to return to the HubPool. This occurs when there is a PoolRebalanceLeaf netSendAmount that\\n // is negative. This is just the negative of this value.\\n uint256 amountToReturn;\\n // Used to verify that this is being executed on the correct destination chainId.\\n uint256 chainId;\\n // This array designates how much each of those addresses should be refunded.\\n uint256[] refundAmounts;\\n // Used as the index in the bitmap to track whether this leaf has been executed or not.\\n uint32 leafId;\\n // The associated L2TokenAddress that these claims apply to.\\n address l2TokenAddress;\\n // Must be same length as refundAmounts and designates each address that must be refunded.\\n address[] refundAddresses;\\n }\\n\\n // This struct represents the data to fully specify a relay. If any portion of this data differs, the relay is\\n // considered to be completely distinct. Only one relay for a particular depositId, chainId pair should be\\n // considered valid and repaid. This data is hashed and inserted into the slow relay merkle root so that an off\\n // chain validator can choose when to refund slow relayers.\\n struct RelayData {\\n // The address that made the deposit on the origin chain.\\n address depositor;\\n // The recipient address on the destination chain.\\n address recipient;\\n // The corresponding token address on the destination chain.\\n address destinationToken;\\n // The total relay amount before fees are taken out.\\n uint256 amount;\\n // Origin chain id.\\n uint256 originChainId;\\n // Destination chain id.\\n uint256 destinationChainId;\\n // The LP Fee percentage computed by the relayer based on the deposit's quote timestamp\\n // and the HubPool's utilization.\\n uint64 realizedLpFeePct;\\n // The relayer fee percentage specified in the deposit.\\n uint64 relayerFeePct;\\n // The id uniquely identifying this deposit on the origin chain.\\n uint32 depositId;\\n }\\n\\n // Stores collection of merkle roots that can be published to this contract from the HubPool, which are referenced\\n // by \\\"data workers\\\" via inclusion proofs to execute leaves in the roots.\\n struct RootBundle {\\n // Merkle root of slow relays that were not fully filled and whose recipient is still owed funds from the LP pool.\\n bytes32 slowRelayRoot;\\n // Merkle root of relayer refunds for successful relays.\\n bytes32 relayerRefundRoot;\\n // This is a 2D bitmap tracking which leaves in the relayer refund root have been claimed, with max size of\\n // 256x256 leaves per root.\\n mapping(uint256 => uint256) claimedBitmap;\\n }\\n\\n function setCrossDomainAdmin(address newCrossDomainAdmin) external;\\n\\n function setHubPool(address newHubPool) external;\\n\\n function setEnableRoute(\\n address originToken,\\n uint256 destinationChainId,\\n bool enable\\n ) external;\\n\\n function setDepositQuoteTimeBuffer(uint32 buffer) external;\\n\\n function relayRootBundle(bytes32 relayerRefundRoot, bytes32 slowRelayRoot) external;\\n\\n function emergencyDeleteRootBundle(uint256 rootBundleId) external;\\n\\n function deposit(\\n address recipient,\\n address originToken,\\n uint256 amount,\\n uint256 destinationChainId,\\n uint64 relayerFeePct,\\n uint32 quoteTimestamp\\n ) external payable;\\n\\n function speedUpDeposit(\\n address depositor,\\n uint64 newRelayerFeePct,\\n uint32 depositId,\\n bytes memory depositorSignature\\n ) external;\\n\\n function fillRelay(\\n address depositor,\\n address recipient,\\n address destinationToken,\\n uint256 amount,\\n uint256 maxTokensToSend,\\n uint256 repaymentChainId,\\n uint256 originChainId,\\n uint64 realizedLpFeePct,\\n uint64 relayerFeePct,\\n uint32 depositId\\n ) external;\\n\\n function fillRelayWithUpdatedFee(\\n address depositor,\\n address recipient,\\n address destinationToken,\\n uint256 amount,\\n uint256 maxTokensToSend,\\n uint256 repaymentChainId,\\n uint256 originChainId,\\n uint64 realizedLpFeePct,\\n uint64 relayerFeePct,\\n uint64 newRelayerFeePct,\\n uint32 depositId,\\n bytes memory depositorSignature\\n ) external;\\n\\n function executeSlowRelayRoot(\\n address depositor,\\n address recipient,\\n address destinationToken,\\n uint256 amount,\\n uint256 originChainId,\\n uint64 realizedLpFeePct,\\n uint64 relayerFeePct,\\n uint32 depositId,\\n uint32 rootBundleId,\\n bytes32[] memory proof\\n ) external;\\n\\n function executeRelayerRefundRoot(\\n uint32 rootBundleId,\\n SpokePoolInterface.RelayerRefundLeaf memory relayerRefundLeaf,\\n bytes32[] memory proof\\n ) external;\\n\\n function chainId() external view returns (uint256);\\n}\\n\",\"keccak256\":\"0xe0ae593c1cd9c8204f0b7a3f226a5d4bd30d580692d2ecb2a33548b5b4e75f12\",\"license\":\"GPL-3.0-only\"},\"contracts/interfaces/AdapterInterface.sol\":{\"content\":\"// SPDX-License-Identifier: AGPL-3.0-only\\npragma solidity ^0.8.0;\\n\\n/**\\n * @notice Sends cross chain messages and tokens to contracts on a specific L2 network.\\n */\\n\\ninterface AdapterInterface {\\n event MessageRelayed(address target, bytes message);\\n\\n event TokensRelayed(address l1Token, address l2Token, uint256 amount, address to);\\n\\n function relayMessage(address target, bytes memory message) external payable;\\n\\n function relayTokens(\\n address l1Token,\\n address l2Token,\\n uint256 amount,\\n address to\\n ) external payable;\\n}\\n\",\"keccak256\":\"0xbd7091006acbdfe72b21ce985f964f0682a2316d9d3b38967beeb55f4ae5118c\",\"license\":\"AGPL-3.0-only\"},\"contracts/interfaces/WETH9.sol\":{\"content\":\"// SPDX-License-Identifier: GPL-3.0-only\\npragma solidity ^0.8.0;\\n\\ninterface WETH9 {\\n function withdraw(uint256 wad) external;\\n\\n function deposit() external payable;\\n\\n function balanceOf(address guy) external view returns (uint256 wad);\\n\\n function transfer(address guy, uint256 wad) external;\\n}\\n\",\"keccak256\":\"0x7b444d0840b1f76eee9bf39d74830f70644395613b96cce2d80fc50785a82eaa\",\"license\":\"GPL-3.0-only\"}},\"version\":1}", + "bytecode": "0x60a06040526002805463ffffffff60a01b1916604b60a31b1790553480156200002757600080fd5b5060405162004831380380620048318339810160408190526200004a916200025a565b600080546001600160a81b0319166001600160a01b03831617600160a01b179055838383836200007a84620000ab565b620000858362000151565b506001600160a01b031660805250620000a0905085620001f3565b5050505050620002ca565b6001600160a01b038116620001075760405162461bcd60e51b815260206004820152601960248201527f4261642062726964676520726f7574657220616464726573730000000000000060448201526064015b60405180910390fd5b600180546001600160a01b0319166001600160a01b0383169081179091556040517fa9e8c42c9e7fca7f62755189a16b2f5314d43d8fb24e91ba54e6d65f9314e84990600090a250565b6001600160a01b038116620001a95760405162461bcd60e51b815260206004820152601460248201527f4261642068756220706f6f6c20616464726573730000000000000000000000006044820152606401620000fe565b600280546001600160a01b0319166001600160a01b0383169081179091556040517f1f17a88f67b0f49060a34bec1a4723a563620e6aa265eb640b5046dcee0759a090600090a250565b600680546001600160a01b0319166001600160a01b0383169081179091556040517fdc4a5f4c066ad14c1306e624550b42395e08f992a76b416cc7b1ad11503d376c90600090a250565b80516001600160a01b03811681146200025557600080fd5b919050565b600080600080600060a086880312156200027357600080fd5b6200027e866200023d565b94506200028e602087016200023d565b93506200029e604087016200023d565b9250620002ae606087016200023d565b9150620002be608087016200023d565b90509295509295909350565b608051614528620003096000396000818161030001528181610d4c01528181610e1501528181611fcf01528181612a5f0152612ab501526145286000f3fe6080604052600436106101c65760003560e01c806389a153cc116100f7578063daf9c21011610095578063ee2a53f811610064578063ee2a53f8146105e0578063f06850f614610615578063f500697c14610642578063ffc351a31461066257600080fd5b8063daf9c21014610530578063de7eba7814610573578063e190440214610593578063e282d5b9146105c057600080fd5b8063a1244c67116100d1578063a1244c671461048a578063ac9650d8146104c3578063c8356859146104e3578063c894c0ca1461051057600080fd5b806389a153cc146104375780638a7860ce146104575780639a8a05921461047757600080fd5b80633fc8cef3116101645780634e3485c81161013e5780634e3485c8146103555780635249fef1146103755780635285e058146103c057806357f6dcb8146103ed57600080fd5b80633fc8cef3146102ee5780634922897814610322578063493a4f841461033557600080fd5b8063272751c7116101a0578063272751c71461026b5780632752042e1461028b57806329cb924d146102ab578063364f01a6146102ce57600080fd5b80631c39c38d146101d25780631dfb2d021461022957806322f8e5661461024b57600080fd5b366101cd57005b600080fd5b3480156101de57600080fd5b506000546101ff9073ffffffffffffffffffffffffffffffffffffffff1681565b60405173ffffffffffffffffffffffffffffffffffffffff90911681526020015b60405180910390f35b34801561023557600080fd5b50610249610244366004613629565b610682565b005b34801561025757600080fd5b50610249610266366004613644565b61070f565b34801561027757600080fd5b5061024961028636600461366b565b6107b8565b34801561029757600080fd5b506102496102a63660046136bf565b6108cf565b3480156102b757600080fd5b506102c06109d0565b604051908152602001610220565b3480156102da57600080fd5b506102496102e93660046136da565b610a88565b3480156102fa57600080fd5b506101ff7f000000000000000000000000000000000000000000000000000000000000000081565b610249610330366004613725565b610b17565b34801561034157600080fd5b5061024961035036600461378b565b610f7e565b34801561036157600080fd5b50610249610370366004613629565b6110a1565b34801561038157600080fd5b506103b06103903660046137ad565b600360209081526000928352604080842090915290825290205460ff1681565b6040519015158152602001610220565b3480156103cc57600080fd5b506001546101ff9073ffffffffffffffffffffffffffffffffffffffff1681565b3480156103f957600080fd5b506002546104229074010000000000000000000000000000000000000000900463ffffffff1681565b60405163ffffffff9091168152602001610220565b34801561044357600080fd5b506102496104523660046137d7565b6110e7565b34801561046357600080fd5b50610249610472366004613644565b611243565b34801561048357600080fd5b50466102c0565b34801561049657600080fd5b50600254610422907801000000000000000000000000000000000000000000000000900463ffffffff1681565b6104d66104d1366004613875565b611317565b6040516102209190613960565b3480156104ef57600080fd5b506006546101ff9073ffffffffffffffffffffffffffffffffffffffff1681565b34801561051c57600080fd5b5061024961052b366004613b78565b6114f1565b34801561053c57600080fd5b506101ff61054b366004613629565b60076020526000908152604090205473ffffffffffffffffffffffffffffffffffffffff1681565b34801561057f57600080fd5b5061024961058e366004613629565b611575565b34801561059f57600080fd5b506002546101ff9073ffffffffffffffffffffffffffffffffffffffff1681565b3480156105cc57600080fd5b506102496105db366004613d0b565b6115bb565b3480156105ec57600080fd5b506106006105fb366004613644565b611719565b60408051928352602083019190915201610220565b34801561062157600080fd5b506102c0610630366004613644565b60056020526000908152604090205481565b34801561064e57600080fd5b5061024961065d366004613d7a565b611747565b34801561066e57600080fd5b5061024961067d366004613e41565b6117d3565b61068a61193e565b610692611a0a565b6106bf600080547fffffffffffffffffffffff00ffffffffffffffffffffffffffffffffffffffff169055565b6106c881611a8e565b61070c600080547fffffffffffffffffffffff00ffffffffffffffffffffffffffffffffffffffff1674010000000000000000000000000000000000000000179055565b50565b60005473ffffffffffffffffffffffffffffffffffffffff1661073157600080fd5b6000546040517f22f8e5660000000000000000000000000000000000000000000000000000000081526004810183905273ffffffffffffffffffffffffffffffffffffffff909116906322f8e56690602401600060405180830381600087803b15801561079d57600080fd5b505af11580156107b1573d6000803e3d6000fd5b5050505050565b6107c061193e565b6107c8611a0a565b6107f5600080547fffffffffffffffffffffff00ffffffffffffffffffffffffffffffffffffffff169055565b73ffffffffffffffffffffffffffffffffffffffff8316600081815260036020908152604080832086845282529182902080547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff001685151590811790915591519182528492917f0a21fdd43d0ad0c62689ee7230a47309a050755bcc52eba00310add65297692a910160405180910390a36108ca600080547fffffffffffffffffffffff00ffffffffffffffffffffffffffffffffffffffff1674010000000000000000000000000000000000000000179055565b505050565b6108d761193e565b6108df611a0a565b61090c600080547fffffffffffffffffffffff00ffffffffffffffffffffffffffffffffffffffff169055565b600280547fffffffffffffffff00000000ffffffffffffffffffffffffffffffffffffffff167401000000000000000000000000000000000000000063ffffffff8416908102919091179091556040519081527f0e55dd180fa793d9036c804d0a116e6a7617a48e72cee1f83d92793a793fcc039060200160405180910390a161070c600080547fffffffffffffffffffffff00ffffffffffffffffffffffffffffffffffffffff1674010000000000000000000000000000000000000000179055565b6000805473ffffffffffffffffffffffffffffffffffffffff1615610a835760008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166329cb924d6040518163ffffffff1660e01b8152600401602060405180830381865afa158015610a5a573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610a7e9190613f1f565b905090565b504290565b610a9061193e565b610a98611a0a565b610ac5600080547fffffffffffffffffffffff00ffffffffffffffffffffffffffffffffffffffff169055565b610acf8282611b7a565b610b13600080547fffffffffffffffffffffff00ffffffffffffffffffffffffffffffffffffffff1674010000000000000000000000000000000000000000179055565b5050565b610b1f611a0a565b610b4c600080547fffffffffffffffffffffff00ffffffffffffffffffffffffffffffffffffffff169055565b73ffffffffffffffffffffffffffffffffffffffff8516600090815260036020908152604080832086845290915290205460ff16610beb576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152600e60248201527f44697361626c656420726f75746500000000000000000000000000000000000060448201526064015b60405180910390fd5b6706f05b59d3b200008267ffffffffffffffff1610610c66576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601360248201527f696e76616c69642072656c6179657220666565000000000000000000000000006044820152606401610be2565b600254610c919074010000000000000000000000000000000000000000900463ffffffff1682613f67565b63ffffffff16610c9f6109d0565b10158015610ce45750600254610cd39074010000000000000000000000000000000000000000900463ffffffff1682613f8c565b63ffffffff16610ce16109d0565b11155b610d4a576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601260248201527f696e76616c69642071756f74652074696d6500000000000000000000000000006044820152606401610be2565b7f000000000000000000000000000000000000000000000000000000000000000073ffffffffffffffffffffffffffffffffffffffff168573ffffffffffffffffffffffffffffffffffffffff16148015610da55750600034115b15610e9957833414610e13576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601b60248201527f6d73672e76616c7565206d757374206d6174636820616d6f756e7400000000006044820152606401610be2565b7f000000000000000000000000000000000000000000000000000000000000000073ffffffffffffffffffffffffffffffffffffffff1663d0e30db0346040518263ffffffff1660e01b81526004016000604051808303818588803b158015610e7b57600080fd5b505af1158015610e8f573d6000803e3d6000fd5b5050505050610ebb565b610ebb73ffffffffffffffffffffffffffffffffffffffff8616333087611bf6565b610ef28446600254869086907801000000000000000000000000000000000000000000000000900463ffffffff16868b8d33611cd2565b6001600260188282829054906101000a900463ffffffff16610f149190613f8c565b92506101000a81548163ffffffff021916908363ffffffff160217905550610f76600080547fffffffffffffffffffffff00ffffffffffffffffffffffffffffffffffffffff1674010000000000000000000000000000000000000000179055565b505050505050565b610f8661193e565b610f8e611a0a565b610fbb600080547fffffffffffffffffffffff00ffffffffffffffffffffffffffffffffffffffff169055565b60048054600181018255600091909152600381027f8a35acfbc15ff81a39ae7d344fd709f28e8600b4aa8c65c6b64bfe7fe36bd19c81018490557f8a35acfbc15ff81a39ae7d344fd709f28e8600b4aa8c65c6b64bfe7fe36bd19b01828155604080518581526020810185905263ffffffff8416917fc86ba04c55bc5eb2f2876b91c438849a296dbec7b08751c3074d92e04f0a77af910160405180910390a25050610b13600080547fffffffffffffffffffffff00ffffffffffffffffffffffffffffffffffffffff1674010000000000000000000000000000000000000000179055565b6110a961193e565b6110b1611a0a565b6110de600080547fffffffffffffffffffffff00ffffffffffffffffffffffffffffffffffffffff169055565b6106c881611d63565b6110ef611a0a565b61111c600080547fffffffffffffffffffffff00ffffffffffffffffffffffffffffffffffffffff169055565b60006040518061012001604052808c73ffffffffffffffffffffffffffffffffffffffff1681526020018b73ffffffffffffffffffffffffffffffffffffffff1681526020018a73ffffffffffffffffffffffffffffffffffffffff1681526020018981526020018681526020016111914690565b81526020018567ffffffffffffffff1681526020018467ffffffffffffffff1681526020018363ffffffff16815250905060006111cd82611dd2565b905060006111df82848b886000611e02565b90506111f082828a888760006120af565b505050611237600080547fffffffffffffffffffffff00ffffffffffffffffffffffffffffffffffffffff1674010000000000000000000000000000000000000000179055565b50505050505050505050565b61124b61193e565b611253611a0a565b611280600080547fffffffffffffffffffffff00ffffffffffffffffffffffffffffffffffffffff169055565b6004818154811061129357611293613fb4565b60009182526020822060039091020181815560010181905560405182917f3569b846531b754c99cb80df3f49cd72fa6fe106aaee5ab8e0caf35a9d7ce88d91a261070c600080547fffffffffffffffffffffff00ffffffffffffffffffffffffffffffffffffffff1674010000000000000000000000000000000000000000179055565b60603415611381576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601b60248201527f4f6e6c79206d756c746963616c6c207769746820302076616c756500000000006044820152606401610be2565b8167ffffffffffffffff81111561139a5761139a6139e0565b6040519080825280602002602001820160405280156113cd57816020015b60608152602001906001900390816113b85790505b50905060005b828110156114ea57600080308686858181106113f1576113f1613fb4565b90506020028101906114039190613fe3565b604051611411929190614048565b600060405180830381855af49150503d806000811461144c576040519150601f19603f3d011682016040523d82523d6000602084013e611451565b606091505b5091509150816114b75760448151101561146a57600080fd5b600481019050808060200190518101906114849190614088565b6040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610be291906140d1565b808484815181106114ca576114ca613fb4565b6020026020010181905250505080806114e2906140e4565b9150506113d3565b5092915050565b6114f9611a0a565b611526600080547fffffffffffffffffffffff00ffffffffffffffffffffffffffffffffffffffff169055565b6115318383836121e4565b6108ca600080547fffffffffffffffffffffff00ffffffffffffffffffffffffffffffffffffffff1674010000000000000000000000000000000000000000179055565b61157d61193e565b611585611a0a565b6115b2600080547fffffffffffffffffffffff00ffffffffffffffffffffffffffffffffffffffff169055565b6106c8816125aa565b6115c3611a0a565b6115f0600080547fffffffffffffffffffffff00ffffffffffffffffffffffffffffffffffffffff169055565b6706f05b59d3b200008367ffffffffffffffff161061166b576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601360248201527f696e76616c69642072656c6179657220666565000000000000000000000000006044820152606401610be2565b6116788446858585612696565b8373ffffffffffffffffffffffffffffffffffffffff168263ffffffff167fb9de16bf376724405019a10ef4fedac57fecd292bf86c08d81d7c42d394d5d3785846040516116c792919061411c565b60405180910390a3611713600080547fffffffffffffffffffffff00ffffffffffffffffffffffffffffffffffffffff1674010000000000000000000000000000000000000000179055565b50505050565b6004818154811061172957600080fd5b60009182526020909120600390910201805460019091015490915082565b61174f611a0a565b61177c600080547fffffffffffffffffffffff00ffffffffffffffffffffffffffffffffffffffff169055565b61178f8a8a8a8a8a468b8b8b8b8b612733565b611237600080547fffffffffffffffffffffff00ffffffffffffffffffffffffffffffffffffffff1674010000000000000000000000000000000000000000179055565b6117db611a0a565b611808600080547fffffffffffffffffffffff00ffffffffffffffffffffffffffffffffffffffff169055565b6118158c87858585612696565b60006040518061012001604052808e73ffffffffffffffffffffffffffffffffffffffff1681526020018d73ffffffffffffffffffffffffffffffffffffffff1681526020018c73ffffffffffffffffffffffffffffffffffffffff1681526020018b815260200188815260200161188a4690565b81526020018767ffffffffffffffff1681526020018667ffffffffffffffff1681526020018463ffffffff16815250905060006118c682611dd2565b905060006118d882848d896000611e02565b90506118e982828c898760006120af565b505050611930600080547fffffffffffffffffffffff00ffffffffffffffffffffffffffffffffffffffff1674010000000000000000000000000000000000000000179055565b505050505050505050505050565b6001546119749073ffffffffffffffffffffffffffffffffffffffff167311110000000000000000000000000000000011110190565b73ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614611a08576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601860248201527f4f4e4c595f434f554e544552504152545f4741544557415900000000000000006044820152606401610be2565b565b60005474010000000000000000000000000000000000000000900460ff16611a08576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601f60248201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c006044820152606401610be2565b73ffffffffffffffffffffffffffffffffffffffff8116611b0b576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601460248201527f4261642068756220706f6f6c20616464726573730000000000000000000000006044820152606401610be2565b600280547fffffffffffffffffffffffff00000000000000000000000000000000000000001673ffffffffffffffffffffffffffffffffffffffff83169081179091556040517f1f17a88f67b0f49060a34bec1a4723a563620e6aa265eb640b5046dcee0759a090600090a250565b73ffffffffffffffffffffffffffffffffffffffff82811660008181526007602052604080822080547fffffffffffffffffffffffff0000000000000000000000000000000000000000169486169485179055517f8d7f294eaa476236fe8cb5629376a12cd37dace3d21e6a7b98f1641c4ed5f09e9190a35050565b60405173ffffffffffffffffffffffffffffffffffffffff808516602483015283166044820152606481018290526117139085907f23b872dd00000000000000000000000000000000000000000000000000000000906084015b604080517fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe08184030181529190526020810180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff167fffffffff00000000000000000000000000000000000000000000000000000000909316929092179091526128b2565b604080518a8152602081018a905290810188905267ffffffffffffffff8716606082015263ffffffff858116608083015273ffffffffffffffffffffffffffffffffffffffff84811660a084015280841692908616918816907f4a4fc49abd237bfd7f4ac82d6c7a284c69daaea5154430cff04ad7482c6c42549060c00160405180910390a4505050505050505050565b600680547fffffffffffffffffffffffff00000000000000000000000000000000000000001673ffffffffffffffffffffffffffffffffffffffff83169081179091556040517fdc4a5f4c066ad14c1306e624550b42395e08f992a76b416cc7b1ad11503d376c90600090a250565b600081604051602001611de5919061413f565b604051602081830303815290604052805190602001209050919050565b60006706f05b59d3b200008367ffffffffffffffff16108015611e3a57506706f05b59d3b200008560c0015167ffffffffffffffff16105b611ea0576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152600c60248201527f696e76616c6964206665657300000000000000000000000000000000000000006044820152606401610be2565b606085015160008781526005602052604090205410611f1b576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152600c60248201527f72656c61792066696c6c656400000000000000000000000000000000000000006044820152606401610be2565b83600003611f2b575060006120a6565b611f4484848760c00151611f3f91906141e6565b6129be565b60008781526005602052604081205460608801519293508692611f679190614209565b905082811015611f9057809250611f8d83868960c00151611f8891906141e6565b6129ff565b91505b60008881526005602052604081208054859290611fae908490614220565b9091555050604087015173ffffffffffffffffffffffffffffffffffffffff7f0000000000000000000000000000000000000000000000000000000000000000811691160361203657836120235760408701516120239073ffffffffffffffffffffffffffffffffffffffff16333085611bf6565b612031876020015183612a28565b6120a3565b8361207057612031338860200151848a6040015173ffffffffffffffffffffffffffffffffffffffff16611bf6909392919063ffffffff16565b6120a3876020015183896040015173ffffffffffffffffffffffffffffffffffffffff16612b699092919063ffffffff16565b50505b95945050505050565b816000015173ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16877f1d59c1d19baf4b4de03cec9c844258e7ca2f2004975025eb14fe9a5e1d4e0d888560600151600560008c8152602001908152602001600020548a8a89608001518a60a001518c8c60c001518d61010001518e604001518f602001518f6040516121d49c9b9a999897969594939291909b8c5260208c019a909a5260408b019890985260608a0196909652608089019490945260a088019290925267ffffffffffffffff90811660c08801521660e086015263ffffffff1661010085015273ffffffffffffffffffffffffffffffffffffffff9081166101208501521661014083015215156101608201526101800190565b60405180910390a4505050505050565b46826020015114612251576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152600f60248201527f496e76616c696420636861696e496400000000000000000000000000000000006044820152606401610be2565b8160400151518260a0015151146122c4576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152600c60248201527f696e76616c6964206c65616600000000000000000000000000000000000000006044820152606401610be2565b600060048463ffffffff16815481106122df576122df613fb4565b906000526020600020906003020190506122fe81600101548484612bbf565b612364576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152600960248201527f4261642050726f6f6600000000000000000000000000000000000000000000006044820152606401610be2565b61237b81600201846060015163ffffffff16612bfa565b156123e2576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152600f60248201527f416c726561647920636c61696d656400000000000000000000000000000000006044820152606401610be2565b6123f981600201846060015163ffffffff16612c3b565b60005b8360400151518163ffffffff1610156124a557600084604001518263ffffffff168151811061242d5761242d613fb4565b602002602001015190506000811115612492576124928560a001518363ffffffff168151811061245f5761245f613fb4565b602002602001015182876080015173ffffffffffffffffffffffffffffffffffffffff16612b699092919063ffffffff16565b508061249d81614238565b9150506123fc565b5082511561253e576124b683612c79565b826080015173ffffffffffffffffffffffffffffffffffffffff16836060015163ffffffff1684602001517f828fc203220356df8f072a91681caee7d5c75095e2a95e80ed5a14b384697f7186600001513360405161253592919091825273ffffffffffffffffffffffffffffffffffffffff16602082015260400190565b60405180910390a45b826060015163ffffffff168463ffffffff1684602001517ff8bd640004bcec1b89657020f561d0b070cbdf662d0b158db9dccb0a8301bfab8660000151876040015188608001518960a001513360405161259c9594939291906142dc565b60405180910390a450505050565b73ffffffffffffffffffffffffffffffffffffffff8116612627576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601960248201527f4261642062726964676520726f757465722061646472657373000000000000006044820152606401610be2565b600180547fffffffffffffffffffffffff00000000000000000000000000000000000000001673ffffffffffffffffffffffffffffffffffffffff83169081179091556040517fa9e8c42c9e7fca7f62755189a16b2f5314d43d8fb24e91ba54e6d65f9314e84990600090a250565b60408051608060208201819052601160a08301527f4143524f53532d56322d4645452d312e3000000000000000000000000000000060c083015267ffffffffffffffff86169282019290925263ffffffff8416606082015290810185905260009060e001604051602081830303815290604052805190602001209050600061271d82612e45565b905061272a878285612e80565b50505050505050565b60006040518061012001604052808d73ffffffffffffffffffffffffffffffffffffffff1681526020018c73ffffffffffffffffffffffffffffffffffffffff1681526020018b73ffffffffffffffffffffffffffffffffffffffff1681526020018a81526020018981526020018881526020018767ffffffffffffffff1681526020018667ffffffffffffffff1681526020018563ffffffff16815250905061280860048463ffffffff16815481106127ef576127ef613fb4565b9060005260206000209060030201600001548284612f1e565b61286e576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152600d60248201527f496e76616c69642070726f6f66000000000000000000000000000000000000006044820152606401610be2565b600061287982611dd2565b905060006128908284856060015160006001611e02565b90506128a282826000808760016120af565b5050505050505050505050505050565b6000612914826040518060400160405280602081526020017f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c65648152508573ffffffffffffffffffffffffffffffffffffffff16612f369092919063ffffffff16565b8051909150156108ca5780806020019051810190612932919061433a565b6108ca576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602a60248201527f5361666545524332303a204552433230206f7065726174696f6e20646964206e60448201527f6f742073756363656564000000000000000000000000000000000000000000006064820152608401610be2565b60006129d282670de0b6b3a7640000614357565b67ffffffffffffffff166129ee84670de0b6b3a7640000614378565b6129f891906143e4565b9392505050565b6000670de0b6b3a7640000612a148382614357565b6129ee9067ffffffffffffffff1685614378565b73ffffffffffffffffffffffffffffffffffffffff82163b15612a8657610b1373ffffffffffffffffffffffffffffffffffffffff7f0000000000000000000000000000000000000000000000000000000000000000168383612b69565b6040517f2e1a7d4d000000000000000000000000000000000000000000000000000000008152600481018290527f000000000000000000000000000000000000000000000000000000000000000073ffffffffffffffffffffffffffffffffffffffff1690632e1a7d4d90602401600060405180830381600087803b158015612b0e57600080fd5b505af1158015612b22573d6000803e3d6000fd5b505060405173ffffffffffffffffffffffffffffffffffffffff8516925083156108fc02915083906000818181858888f193505050501580156108ca573d6000803e3d6000fd5b60405173ffffffffffffffffffffffffffffffffffffffff83166024820152604481018290526108ca9084907fa9059cbb0000000000000000000000000000000000000000000000000000000090606401611c50565b6000612bf2828585604051602001612bd791906143f8565b60405160208183030381529060405280519060200120612f45565b949350505050565b600080612c09610100846143e4565b90506000612c1961010085614493565b6000928352602095909552506040902054600190931b92831690921492915050565b6000612c49610100836143e4565b90506000612c5961010084614493565b600092835260209490945250604090208054600190931b90921790915550565b608081015173ffffffffffffffffffffffffffffffffffffffff9081166000908152600760205260409020541680612d0d576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601b60248201527f556e696e697469616c697a6564206d61696e6e657420746f6b656e00000000006044820152606401610be2565b60065460025483516040517f7b3a3c8b00000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff8581166004830152928316602482015260448101919091526080606482015260006084820152911690637b3a3c8b9060a4016000604051808303816000875af1158015612da1573d6000803e3d6000fd5b505050506040513d6000823e601f3d9081017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0168201604052612de79190810190614088565b5060025482516040805173ffffffffffffffffffffffffffffffffffffffff909316835260208301919091526000917f997d81a0a8415d688a6c319736602098252bf6445e0e879326f682f11928e317910160405180910390a25050565b6040517f19457468657265756d205369676e6564204d6573736167653a0a3332000000006020820152603c8101829052600090605c01611de5565b612e8a8282612f5b565b73ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff16146108ca576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601160248201527f696e76616c6964207369676e61747572650000000000000000000000000000006044820152606401610be2565b6000612bf2828585604051602001612bd7919061413f565b6060612bf28484600085612f7f565b600082612f528584613115565b14949350505050565b6000806000612f6a8585613181565b91509150612f77816131ef565b509392505050565b606082471015613011576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602660248201527f416464726573733a20696e73756666696369656e742062616c616e636520666f60448201527f722063616c6c00000000000000000000000000000000000000000000000000006064820152608401610be2565b73ffffffffffffffffffffffffffffffffffffffff85163b61308f576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e74726163740000006044820152606401610be2565b6000808673ffffffffffffffffffffffffffffffffffffffff1685876040516130b891906144a7565b60006040518083038185875af1925050503d80600081146130f5576040519150601f19603f3d011682016040523d82523d6000602084013e6130fa565b606091505b509150915061310a828286613443565b979650505050505050565b600081815b8451811015612f7757600085828151811061313757613137613fb4565b6020026020010151905080831161315d576000838152602082905260409020925061316e565b600081815260208490526040902092505b5080613179816140e4565b91505061311a565b60008082516041036131b75760208301516040840151606085015160001a6131ab87828585613496565b945094505050506131e8565b82516040036131e057602083015160408401516131d58683836135ae565b9350935050506131e8565b506000905060025b9250929050565b6000816004811115613203576132036144c3565b0361320b5750565b600181600481111561321f5761321f6144c3565b03613286576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601860248201527f45434453413a20696e76616c6964207369676e617475726500000000000000006044820152606401610be2565b600281600481111561329a5761329a6144c3565b03613301576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601f60248201527f45434453413a20696e76616c6964207369676e6174757265206c656e677468006044820152606401610be2565b6003816004811115613315576133156144c3565b036133a2576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602260248201527f45434453413a20696e76616c6964207369676e6174757265202773272076616c60448201527f75650000000000000000000000000000000000000000000000000000000000006064820152608401610be2565b60048160048111156133b6576133b66144c3565b0361070c576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602260248201527f45434453413a20696e76616c6964207369676e6174757265202776272076616c60448201527f75650000000000000000000000000000000000000000000000000000000000006064820152608401610be2565b606083156134525750816129f8565b8251156134625782518084602001fd5b816040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610be291906140d1565b6000807f7fffffffffffffffffffffffffffffff5d576e7357a4501ddfe92f46681b20a08311156134cd57506000905060036135a5565b8460ff16601b141580156134e557508460ff16601c14155b156134f657506000905060046135a5565b6040805160008082526020820180845289905260ff881692820192909252606081018690526080810185905260019060a0016020604051602081039080840390855afa15801561354a573d6000803e3d6000fd5b50506040517fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0015191505073ffffffffffffffffffffffffffffffffffffffff811661359e576000600192509250506135a5565b9150600090505b94509492505050565b6000807f7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff8316816135e460ff86901c601b614220565b90506135f287828885613496565b935093505050935093915050565b803573ffffffffffffffffffffffffffffffffffffffff8116811461362457600080fd5b919050565b60006020828403121561363b57600080fd5b6129f882613600565b60006020828403121561365657600080fd5b5035919050565b801515811461070c57600080fd5b60008060006060848603121561368057600080fd5b61368984613600565b92506020840135915060408401356136a08161365d565b809150509250925092565b803563ffffffff8116811461362457600080fd5b6000602082840312156136d157600080fd5b6129f8826136ab565b600080604083850312156136ed57600080fd5b6136f683613600565b915061370460208401613600565b90509250929050565b803567ffffffffffffffff8116811461362457600080fd5b60008060008060008060c0878903121561373e57600080fd5b61374787613600565b955061375560208801613600565b945060408701359350606087013592506137716080880161370d565b915061377f60a088016136ab565b90509295509295509295565b6000806040838503121561379e57600080fd5b50508035926020909101359150565b600080604083850312156137c057600080fd5b6137c983613600565b946020939093013593505050565b6000806000806000806000806000806101408b8d0312156137f757600080fd5b6138008b613600565b995061380e60208c01613600565b985061381c60408c01613600565b975060608b0135965060808b0135955060a08b0135945060c08b0135935061384660e08c0161370d565b92506138556101008c0161370d565b91506138646101208c016136ab565b90509295989b9194979a5092959850565b6000806020838503121561388857600080fd5b823567ffffffffffffffff808211156138a057600080fd5b818501915085601f8301126138b457600080fd5b8135818111156138c357600080fd5b8660208260051b85010111156138d857600080fd5b60209290920196919550909350505050565b60005b838110156139055781810151838201526020016138ed565b838111156117135750506000910152565b6000815180845261392e8160208601602086016138ea565b601f017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0169290920160200192915050565b6000602080830181845280855180835260408601915060408160051b870101925083870160005b828110156139d3577fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc08886030184526139c1858351613916565b94509285019290850190600101613987565b5092979650505050505050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b60405160c0810167ffffffffffffffff81118282101715613a3257613a326139e0565b60405290565b604051601f82017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe016810167ffffffffffffffff81118282101715613a7f57613a7f6139e0565b604052919050565b600067ffffffffffffffff821115613aa157613aa16139e0565b5060051b60200190565b600082601f830112613abc57600080fd5b81356020613ad1613acc83613a87565b613a38565b82815260059290921b84018101918181019086841115613af057600080fd5b8286015b84811015613b0b5780358352918301918301613af4565b509695505050505050565b600082601f830112613b2757600080fd5b81356020613b37613acc83613a87565b82815260059290921b84018101918181019086841115613b5657600080fd5b8286015b84811015613b0b57613b6b81613600565b8352918301918301613b5a565b600080600060608486031215613b8d57600080fd5b613b96846136ab565b9250602084013567ffffffffffffffff80821115613bb357600080fd5b9085019060c08288031215613bc757600080fd5b613bcf613a0f565b8235815260208301356020820152604083013582811115613bef57600080fd5b613bfb89828601613aab565b604083015250613c0d606084016136ab565b6060820152613c1e60808401613600565b608082015260a083013582811115613c3557600080fd5b613c4189828601613b16565b60a08301525093506040860135915080821115613c5d57600080fd5b50613c6a86828701613aab565b9150509250925092565b600067ffffffffffffffff821115613c8e57613c8e6139e0565b50601f017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe01660200190565b600082601f830112613ccb57600080fd5b8135613cd9613acc82613c74565b818152846020838601011115613cee57600080fd5b816020850160208301376000918101602001919091529392505050565b60008060008060808587031215613d2157600080fd5b613d2a85613600565b9350613d386020860161370d565b9250613d46604086016136ab565b9150606085013567ffffffffffffffff811115613d6257600080fd5b613d6e87828801613cba565b91505092959194509250565b6000806000806000806000806000806101408b8d031215613d9a57600080fd5b613da38b613600565b9950613db160208c01613600565b9850613dbf60408c01613600565b975060608b0135965060808b01359550613ddb60a08c0161370d565b9450613de960c08c0161370d565b9350613df760e08c016136ab565b9250613e066101008c016136ab565b91506101208b013567ffffffffffffffff811115613e2357600080fd5b613e2f8d828e01613aab565b9150509295989b9194979a5092959850565b6000806000806000806000806000806000806101808d8f031215613e6457600080fd5b613e6d8d613600565b9b50613e7b60208e01613600565b9a50613e8960408e01613600565b995060608d0135985060808d0135975060a08d0135965060c08d01359550613eb360e08e0161370d565b9450613ec26101008e0161370d565b9350613ed16101208e0161370d565b9250613ee06101408e016136ab565b915067ffffffffffffffff6101608e01351115613efc57600080fd5b613f0d8e6101608f01358f01613cba565b90509295989b509295989b509295989b565b600060208284031215613f3157600080fd5b5051919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b600063ffffffff83811690831681811015613f8457613f84613f38565b039392505050565b600063ffffffff808316818516808303821115613fab57613fab613f38565b01949350505050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b60008083357fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe184360301811261401857600080fd5b83018035915067ffffffffffffffff82111561403357600080fd5b6020019150368190038213156131e857600080fd5b8183823760009101908152919050565b6000614066613acc84613c74565b905082815283838301111561407a57600080fd5b6129f88360208301846138ea565b60006020828403121561409a57600080fd5b815167ffffffffffffffff8111156140b157600080fd5b8201601f810184136140c257600080fd5b612bf284825160208401614058565b6020815260006129f86020830184613916565b60007fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff820361411557614115613f38565b5060010190565b67ffffffffffffffff83168152604060208201526000612bf26040830184613916565b815173ffffffffffffffffffffffffffffffffffffffff90811682526020808401518216908301526040808401519182169083015261012082019050606083015160608301526080830151608083015260a083015160a083015260c08301516141b460c084018267ffffffffffffffff169052565b5060e08301516141d060e084018267ffffffffffffffff169052565b506101009283015163ffffffff16919092015290565b600067ffffffffffffffff808316818516808303821115613fab57613fab613f38565b60008282101561421b5761421b613f38565b500390565b6000821982111561423357614233613f38565b500190565b600063ffffffff80831681810361425157614251613f38565b6001019392505050565b600081518084526020808501945080840160005b8381101561428b5781518752958201959082019060010161426f565b509495945050505050565b600081518084526020808501945080840160005b8381101561428b57815173ffffffffffffffffffffffffffffffffffffffff16875295820195908201906001016142aa565b85815260a0602082015260006142f560a083018761425b565b73ffffffffffffffffffffffffffffffffffffffff808716604085015283820360608501526143248287614296565b9250808516608085015250509695505050505050565b60006020828403121561434c57600080fd5b81516129f88161365d565b600067ffffffffffffffff83811690831681811015613f8457613f84613f38565b6000817fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff04831182151516156143b0576143b0613f38565b500290565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601260045260246000fd5b6000826143f3576143f36143b5565b500490565b6020815281516020820152602082015160408201526000604083015160c0606084015261442860e084018261425b565b905063ffffffff606085015116608084015273ffffffffffffffffffffffffffffffffffffffff60808501511660a084015260a08401517fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe08483030160c08501526120a68282614296565b6000826144a2576144a26143b5565b500690565b600082516144b98184602087016138ea565b9190910192915050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052602160045260246000fdfea26469706673582212200366289a2afa53961ee89e12be7aa19d0583eb8987acfd894558f08599d1737364736f6c634300080d0033", + "deployedBytecode": "0x6080604052600436106101c65760003560e01c806389a153cc116100f7578063daf9c21011610095578063ee2a53f811610064578063ee2a53f8146105e0578063f06850f614610615578063f500697c14610642578063ffc351a31461066257600080fd5b8063daf9c21014610530578063de7eba7814610573578063e190440214610593578063e282d5b9146105c057600080fd5b8063a1244c67116100d1578063a1244c671461048a578063ac9650d8146104c3578063c8356859146104e3578063c894c0ca1461051057600080fd5b806389a153cc146104375780638a7860ce146104575780639a8a05921461047757600080fd5b80633fc8cef3116101645780634e3485c81161013e5780634e3485c8146103555780635249fef1146103755780635285e058146103c057806357f6dcb8146103ed57600080fd5b80633fc8cef3146102ee5780634922897814610322578063493a4f841461033557600080fd5b8063272751c7116101a0578063272751c71461026b5780632752042e1461028b57806329cb924d146102ab578063364f01a6146102ce57600080fd5b80631c39c38d146101d25780631dfb2d021461022957806322f8e5661461024b57600080fd5b366101cd57005b600080fd5b3480156101de57600080fd5b506000546101ff9073ffffffffffffffffffffffffffffffffffffffff1681565b60405173ffffffffffffffffffffffffffffffffffffffff90911681526020015b60405180910390f35b34801561023557600080fd5b50610249610244366004613629565b610682565b005b34801561025757600080fd5b50610249610266366004613644565b61070f565b34801561027757600080fd5b5061024961028636600461366b565b6107b8565b34801561029757600080fd5b506102496102a63660046136bf565b6108cf565b3480156102b757600080fd5b506102c06109d0565b604051908152602001610220565b3480156102da57600080fd5b506102496102e93660046136da565b610a88565b3480156102fa57600080fd5b506101ff7f000000000000000000000000000000000000000000000000000000000000000081565b610249610330366004613725565b610b17565b34801561034157600080fd5b5061024961035036600461378b565b610f7e565b34801561036157600080fd5b50610249610370366004613629565b6110a1565b34801561038157600080fd5b506103b06103903660046137ad565b600360209081526000928352604080842090915290825290205460ff1681565b6040519015158152602001610220565b3480156103cc57600080fd5b506001546101ff9073ffffffffffffffffffffffffffffffffffffffff1681565b3480156103f957600080fd5b506002546104229074010000000000000000000000000000000000000000900463ffffffff1681565b60405163ffffffff9091168152602001610220565b34801561044357600080fd5b506102496104523660046137d7565b6110e7565b34801561046357600080fd5b50610249610472366004613644565b611243565b34801561048357600080fd5b50466102c0565b34801561049657600080fd5b50600254610422907801000000000000000000000000000000000000000000000000900463ffffffff1681565b6104d66104d1366004613875565b611317565b6040516102209190613960565b3480156104ef57600080fd5b506006546101ff9073ffffffffffffffffffffffffffffffffffffffff1681565b34801561051c57600080fd5b5061024961052b366004613b78565b6114f1565b34801561053c57600080fd5b506101ff61054b366004613629565b60076020526000908152604090205473ffffffffffffffffffffffffffffffffffffffff1681565b34801561057f57600080fd5b5061024961058e366004613629565b611575565b34801561059f57600080fd5b506002546101ff9073ffffffffffffffffffffffffffffffffffffffff1681565b3480156105cc57600080fd5b506102496105db366004613d0b565b6115bb565b3480156105ec57600080fd5b506106006105fb366004613644565b611719565b60408051928352602083019190915201610220565b34801561062157600080fd5b506102c0610630366004613644565b60056020526000908152604090205481565b34801561064e57600080fd5b5061024961065d366004613d7a565b611747565b34801561066e57600080fd5b5061024961067d366004613e41565b6117d3565b61068a61193e565b610692611a0a565b6106bf600080547fffffffffffffffffffffff00ffffffffffffffffffffffffffffffffffffffff169055565b6106c881611a8e565b61070c600080547fffffffffffffffffffffff00ffffffffffffffffffffffffffffffffffffffff1674010000000000000000000000000000000000000000179055565b50565b60005473ffffffffffffffffffffffffffffffffffffffff1661073157600080fd5b6000546040517f22f8e5660000000000000000000000000000000000000000000000000000000081526004810183905273ffffffffffffffffffffffffffffffffffffffff909116906322f8e56690602401600060405180830381600087803b15801561079d57600080fd5b505af11580156107b1573d6000803e3d6000fd5b5050505050565b6107c061193e565b6107c8611a0a565b6107f5600080547fffffffffffffffffffffff00ffffffffffffffffffffffffffffffffffffffff169055565b73ffffffffffffffffffffffffffffffffffffffff8316600081815260036020908152604080832086845282529182902080547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff001685151590811790915591519182528492917f0a21fdd43d0ad0c62689ee7230a47309a050755bcc52eba00310add65297692a910160405180910390a36108ca600080547fffffffffffffffffffffff00ffffffffffffffffffffffffffffffffffffffff1674010000000000000000000000000000000000000000179055565b505050565b6108d761193e565b6108df611a0a565b61090c600080547fffffffffffffffffffffff00ffffffffffffffffffffffffffffffffffffffff169055565b600280547fffffffffffffffff00000000ffffffffffffffffffffffffffffffffffffffff167401000000000000000000000000000000000000000063ffffffff8416908102919091179091556040519081527f0e55dd180fa793d9036c804d0a116e6a7617a48e72cee1f83d92793a793fcc039060200160405180910390a161070c600080547fffffffffffffffffffffff00ffffffffffffffffffffffffffffffffffffffff1674010000000000000000000000000000000000000000179055565b6000805473ffffffffffffffffffffffffffffffffffffffff1615610a835760008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166329cb924d6040518163ffffffff1660e01b8152600401602060405180830381865afa158015610a5a573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610a7e9190613f1f565b905090565b504290565b610a9061193e565b610a98611a0a565b610ac5600080547fffffffffffffffffffffff00ffffffffffffffffffffffffffffffffffffffff169055565b610acf8282611b7a565b610b13600080547fffffffffffffffffffffff00ffffffffffffffffffffffffffffffffffffffff1674010000000000000000000000000000000000000000179055565b5050565b610b1f611a0a565b610b4c600080547fffffffffffffffffffffff00ffffffffffffffffffffffffffffffffffffffff169055565b73ffffffffffffffffffffffffffffffffffffffff8516600090815260036020908152604080832086845290915290205460ff16610beb576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152600e60248201527f44697361626c656420726f75746500000000000000000000000000000000000060448201526064015b60405180910390fd5b6706f05b59d3b200008267ffffffffffffffff1610610c66576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601360248201527f696e76616c69642072656c6179657220666565000000000000000000000000006044820152606401610be2565b600254610c919074010000000000000000000000000000000000000000900463ffffffff1682613f67565b63ffffffff16610c9f6109d0565b10158015610ce45750600254610cd39074010000000000000000000000000000000000000000900463ffffffff1682613f8c565b63ffffffff16610ce16109d0565b11155b610d4a576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601260248201527f696e76616c69642071756f74652074696d6500000000000000000000000000006044820152606401610be2565b7f000000000000000000000000000000000000000000000000000000000000000073ffffffffffffffffffffffffffffffffffffffff168573ffffffffffffffffffffffffffffffffffffffff16148015610da55750600034115b15610e9957833414610e13576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601b60248201527f6d73672e76616c7565206d757374206d6174636820616d6f756e7400000000006044820152606401610be2565b7f000000000000000000000000000000000000000000000000000000000000000073ffffffffffffffffffffffffffffffffffffffff1663d0e30db0346040518263ffffffff1660e01b81526004016000604051808303818588803b158015610e7b57600080fd5b505af1158015610e8f573d6000803e3d6000fd5b5050505050610ebb565b610ebb73ffffffffffffffffffffffffffffffffffffffff8616333087611bf6565b610ef28446600254869086907801000000000000000000000000000000000000000000000000900463ffffffff16868b8d33611cd2565b6001600260188282829054906101000a900463ffffffff16610f149190613f8c565b92506101000a81548163ffffffff021916908363ffffffff160217905550610f76600080547fffffffffffffffffffffff00ffffffffffffffffffffffffffffffffffffffff1674010000000000000000000000000000000000000000179055565b505050505050565b610f8661193e565b610f8e611a0a565b610fbb600080547fffffffffffffffffffffff00ffffffffffffffffffffffffffffffffffffffff169055565b60048054600181018255600091909152600381027f8a35acfbc15ff81a39ae7d344fd709f28e8600b4aa8c65c6b64bfe7fe36bd19c81018490557f8a35acfbc15ff81a39ae7d344fd709f28e8600b4aa8c65c6b64bfe7fe36bd19b01828155604080518581526020810185905263ffffffff8416917fc86ba04c55bc5eb2f2876b91c438849a296dbec7b08751c3074d92e04f0a77af910160405180910390a25050610b13600080547fffffffffffffffffffffff00ffffffffffffffffffffffffffffffffffffffff1674010000000000000000000000000000000000000000179055565b6110a961193e565b6110b1611a0a565b6110de600080547fffffffffffffffffffffff00ffffffffffffffffffffffffffffffffffffffff169055565b6106c881611d63565b6110ef611a0a565b61111c600080547fffffffffffffffffffffff00ffffffffffffffffffffffffffffffffffffffff169055565b60006040518061012001604052808c73ffffffffffffffffffffffffffffffffffffffff1681526020018b73ffffffffffffffffffffffffffffffffffffffff1681526020018a73ffffffffffffffffffffffffffffffffffffffff1681526020018981526020018681526020016111914690565b81526020018567ffffffffffffffff1681526020018467ffffffffffffffff1681526020018363ffffffff16815250905060006111cd82611dd2565b905060006111df82848b886000611e02565b90506111f082828a888760006120af565b505050611237600080547fffffffffffffffffffffff00ffffffffffffffffffffffffffffffffffffffff1674010000000000000000000000000000000000000000179055565b50505050505050505050565b61124b61193e565b611253611a0a565b611280600080547fffffffffffffffffffffff00ffffffffffffffffffffffffffffffffffffffff169055565b6004818154811061129357611293613fb4565b60009182526020822060039091020181815560010181905560405182917f3569b846531b754c99cb80df3f49cd72fa6fe106aaee5ab8e0caf35a9d7ce88d91a261070c600080547fffffffffffffffffffffff00ffffffffffffffffffffffffffffffffffffffff1674010000000000000000000000000000000000000000179055565b60603415611381576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601b60248201527f4f6e6c79206d756c746963616c6c207769746820302076616c756500000000006044820152606401610be2565b8167ffffffffffffffff81111561139a5761139a6139e0565b6040519080825280602002602001820160405280156113cd57816020015b60608152602001906001900390816113b85790505b50905060005b828110156114ea57600080308686858181106113f1576113f1613fb4565b90506020028101906114039190613fe3565b604051611411929190614048565b600060405180830381855af49150503d806000811461144c576040519150601f19603f3d011682016040523d82523d6000602084013e611451565b606091505b5091509150816114b75760448151101561146a57600080fd5b600481019050808060200190518101906114849190614088565b6040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610be291906140d1565b808484815181106114ca576114ca613fb4565b6020026020010181905250505080806114e2906140e4565b9150506113d3565b5092915050565b6114f9611a0a565b611526600080547fffffffffffffffffffffff00ffffffffffffffffffffffffffffffffffffffff169055565b6115318383836121e4565b6108ca600080547fffffffffffffffffffffff00ffffffffffffffffffffffffffffffffffffffff1674010000000000000000000000000000000000000000179055565b61157d61193e565b611585611a0a565b6115b2600080547fffffffffffffffffffffff00ffffffffffffffffffffffffffffffffffffffff169055565b6106c8816125aa565b6115c3611a0a565b6115f0600080547fffffffffffffffffffffff00ffffffffffffffffffffffffffffffffffffffff169055565b6706f05b59d3b200008367ffffffffffffffff161061166b576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601360248201527f696e76616c69642072656c6179657220666565000000000000000000000000006044820152606401610be2565b6116788446858585612696565b8373ffffffffffffffffffffffffffffffffffffffff168263ffffffff167fb9de16bf376724405019a10ef4fedac57fecd292bf86c08d81d7c42d394d5d3785846040516116c792919061411c565b60405180910390a3611713600080547fffffffffffffffffffffff00ffffffffffffffffffffffffffffffffffffffff1674010000000000000000000000000000000000000000179055565b50505050565b6004818154811061172957600080fd5b60009182526020909120600390910201805460019091015490915082565b61174f611a0a565b61177c600080547fffffffffffffffffffffff00ffffffffffffffffffffffffffffffffffffffff169055565b61178f8a8a8a8a8a468b8b8b8b8b612733565b611237600080547fffffffffffffffffffffff00ffffffffffffffffffffffffffffffffffffffff1674010000000000000000000000000000000000000000179055565b6117db611a0a565b611808600080547fffffffffffffffffffffff00ffffffffffffffffffffffffffffffffffffffff169055565b6118158c87858585612696565b60006040518061012001604052808e73ffffffffffffffffffffffffffffffffffffffff1681526020018d73ffffffffffffffffffffffffffffffffffffffff1681526020018c73ffffffffffffffffffffffffffffffffffffffff1681526020018b815260200188815260200161188a4690565b81526020018767ffffffffffffffff1681526020018667ffffffffffffffff1681526020018463ffffffff16815250905060006118c682611dd2565b905060006118d882848d896000611e02565b90506118e982828c898760006120af565b505050611930600080547fffffffffffffffffffffff00ffffffffffffffffffffffffffffffffffffffff1674010000000000000000000000000000000000000000179055565b505050505050505050505050565b6001546119749073ffffffffffffffffffffffffffffffffffffffff167311110000000000000000000000000000000011110190565b73ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614611a08576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601860248201527f4f4e4c595f434f554e544552504152545f4741544557415900000000000000006044820152606401610be2565b565b60005474010000000000000000000000000000000000000000900460ff16611a08576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601f60248201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c006044820152606401610be2565b73ffffffffffffffffffffffffffffffffffffffff8116611b0b576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601460248201527f4261642068756220706f6f6c20616464726573730000000000000000000000006044820152606401610be2565b600280547fffffffffffffffffffffffff00000000000000000000000000000000000000001673ffffffffffffffffffffffffffffffffffffffff83169081179091556040517f1f17a88f67b0f49060a34bec1a4723a563620e6aa265eb640b5046dcee0759a090600090a250565b73ffffffffffffffffffffffffffffffffffffffff82811660008181526007602052604080822080547fffffffffffffffffffffffff0000000000000000000000000000000000000000169486169485179055517f8d7f294eaa476236fe8cb5629376a12cd37dace3d21e6a7b98f1641c4ed5f09e9190a35050565b60405173ffffffffffffffffffffffffffffffffffffffff808516602483015283166044820152606481018290526117139085907f23b872dd00000000000000000000000000000000000000000000000000000000906084015b604080517fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe08184030181529190526020810180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff167fffffffff00000000000000000000000000000000000000000000000000000000909316929092179091526128b2565b604080518a8152602081018a905290810188905267ffffffffffffffff8716606082015263ffffffff858116608083015273ffffffffffffffffffffffffffffffffffffffff84811660a084015280841692908616918816907f4a4fc49abd237bfd7f4ac82d6c7a284c69daaea5154430cff04ad7482c6c42549060c00160405180910390a4505050505050505050565b600680547fffffffffffffffffffffffff00000000000000000000000000000000000000001673ffffffffffffffffffffffffffffffffffffffff83169081179091556040517fdc4a5f4c066ad14c1306e624550b42395e08f992a76b416cc7b1ad11503d376c90600090a250565b600081604051602001611de5919061413f565b604051602081830303815290604052805190602001209050919050565b60006706f05b59d3b200008367ffffffffffffffff16108015611e3a57506706f05b59d3b200008560c0015167ffffffffffffffff16105b611ea0576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152600c60248201527f696e76616c6964206665657300000000000000000000000000000000000000006044820152606401610be2565b606085015160008781526005602052604090205410611f1b576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152600c60248201527f72656c61792066696c6c656400000000000000000000000000000000000000006044820152606401610be2565b83600003611f2b575060006120a6565b611f4484848760c00151611f3f91906141e6565b6129be565b60008781526005602052604081205460608801519293508692611f679190614209565b905082811015611f9057809250611f8d83868960c00151611f8891906141e6565b6129ff565b91505b60008881526005602052604081208054859290611fae908490614220565b9091555050604087015173ffffffffffffffffffffffffffffffffffffffff7f0000000000000000000000000000000000000000000000000000000000000000811691160361203657836120235760408701516120239073ffffffffffffffffffffffffffffffffffffffff16333085611bf6565b612031876020015183612a28565b6120a3565b8361207057612031338860200151848a6040015173ffffffffffffffffffffffffffffffffffffffff16611bf6909392919063ffffffff16565b6120a3876020015183896040015173ffffffffffffffffffffffffffffffffffffffff16612b699092919063ffffffff16565b50505b95945050505050565b816000015173ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16877f1d59c1d19baf4b4de03cec9c844258e7ca2f2004975025eb14fe9a5e1d4e0d888560600151600560008c8152602001908152602001600020548a8a89608001518a60a001518c8c60c001518d61010001518e604001518f602001518f6040516121d49c9b9a999897969594939291909b8c5260208c019a909a5260408b019890985260608a0196909652608089019490945260a088019290925267ffffffffffffffff90811660c08801521660e086015263ffffffff1661010085015273ffffffffffffffffffffffffffffffffffffffff9081166101208501521661014083015215156101608201526101800190565b60405180910390a4505050505050565b46826020015114612251576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152600f60248201527f496e76616c696420636861696e496400000000000000000000000000000000006044820152606401610be2565b8160400151518260a0015151146122c4576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152600c60248201527f696e76616c6964206c65616600000000000000000000000000000000000000006044820152606401610be2565b600060048463ffffffff16815481106122df576122df613fb4565b906000526020600020906003020190506122fe81600101548484612bbf565b612364576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152600960248201527f4261642050726f6f6600000000000000000000000000000000000000000000006044820152606401610be2565b61237b81600201846060015163ffffffff16612bfa565b156123e2576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152600f60248201527f416c726561647920636c61696d656400000000000000000000000000000000006044820152606401610be2565b6123f981600201846060015163ffffffff16612c3b565b60005b8360400151518163ffffffff1610156124a557600084604001518263ffffffff168151811061242d5761242d613fb4565b602002602001015190506000811115612492576124928560a001518363ffffffff168151811061245f5761245f613fb4565b602002602001015182876080015173ffffffffffffffffffffffffffffffffffffffff16612b699092919063ffffffff16565b508061249d81614238565b9150506123fc565b5082511561253e576124b683612c79565b826080015173ffffffffffffffffffffffffffffffffffffffff16836060015163ffffffff1684602001517f828fc203220356df8f072a91681caee7d5c75095e2a95e80ed5a14b384697f7186600001513360405161253592919091825273ffffffffffffffffffffffffffffffffffffffff16602082015260400190565b60405180910390a45b826060015163ffffffff168463ffffffff1684602001517ff8bd640004bcec1b89657020f561d0b070cbdf662d0b158db9dccb0a8301bfab8660000151876040015188608001518960a001513360405161259c9594939291906142dc565b60405180910390a450505050565b73ffffffffffffffffffffffffffffffffffffffff8116612627576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601960248201527f4261642062726964676520726f757465722061646472657373000000000000006044820152606401610be2565b600180547fffffffffffffffffffffffff00000000000000000000000000000000000000001673ffffffffffffffffffffffffffffffffffffffff83169081179091556040517fa9e8c42c9e7fca7f62755189a16b2f5314d43d8fb24e91ba54e6d65f9314e84990600090a250565b60408051608060208201819052601160a08301527f4143524f53532d56322d4645452d312e3000000000000000000000000000000060c083015267ffffffffffffffff86169282019290925263ffffffff8416606082015290810185905260009060e001604051602081830303815290604052805190602001209050600061271d82612e45565b905061272a878285612e80565b50505050505050565b60006040518061012001604052808d73ffffffffffffffffffffffffffffffffffffffff1681526020018c73ffffffffffffffffffffffffffffffffffffffff1681526020018b73ffffffffffffffffffffffffffffffffffffffff1681526020018a81526020018981526020018881526020018767ffffffffffffffff1681526020018667ffffffffffffffff1681526020018563ffffffff16815250905061280860048463ffffffff16815481106127ef576127ef613fb4565b9060005260206000209060030201600001548284612f1e565b61286e576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152600d60248201527f496e76616c69642070726f6f66000000000000000000000000000000000000006044820152606401610be2565b600061287982611dd2565b905060006128908284856060015160006001611e02565b90506128a282826000808760016120af565b5050505050505050505050505050565b6000612914826040518060400160405280602081526020017f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c65648152508573ffffffffffffffffffffffffffffffffffffffff16612f369092919063ffffffff16565b8051909150156108ca5780806020019051810190612932919061433a565b6108ca576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602a60248201527f5361666545524332303a204552433230206f7065726174696f6e20646964206e60448201527f6f742073756363656564000000000000000000000000000000000000000000006064820152608401610be2565b60006129d282670de0b6b3a7640000614357565b67ffffffffffffffff166129ee84670de0b6b3a7640000614378565b6129f891906143e4565b9392505050565b6000670de0b6b3a7640000612a148382614357565b6129ee9067ffffffffffffffff1685614378565b73ffffffffffffffffffffffffffffffffffffffff82163b15612a8657610b1373ffffffffffffffffffffffffffffffffffffffff7f0000000000000000000000000000000000000000000000000000000000000000168383612b69565b6040517f2e1a7d4d000000000000000000000000000000000000000000000000000000008152600481018290527f000000000000000000000000000000000000000000000000000000000000000073ffffffffffffffffffffffffffffffffffffffff1690632e1a7d4d90602401600060405180830381600087803b158015612b0e57600080fd5b505af1158015612b22573d6000803e3d6000fd5b505060405173ffffffffffffffffffffffffffffffffffffffff8516925083156108fc02915083906000818181858888f193505050501580156108ca573d6000803e3d6000fd5b60405173ffffffffffffffffffffffffffffffffffffffff83166024820152604481018290526108ca9084907fa9059cbb0000000000000000000000000000000000000000000000000000000090606401611c50565b6000612bf2828585604051602001612bd791906143f8565b60405160208183030381529060405280519060200120612f45565b949350505050565b600080612c09610100846143e4565b90506000612c1961010085614493565b6000928352602095909552506040902054600190931b92831690921492915050565b6000612c49610100836143e4565b90506000612c5961010084614493565b600092835260209490945250604090208054600190931b90921790915550565b608081015173ffffffffffffffffffffffffffffffffffffffff9081166000908152600760205260409020541680612d0d576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601b60248201527f556e696e697469616c697a6564206d61696e6e657420746f6b656e00000000006044820152606401610be2565b60065460025483516040517f7b3a3c8b00000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff8581166004830152928316602482015260448101919091526080606482015260006084820152911690637b3a3c8b9060a4016000604051808303816000875af1158015612da1573d6000803e3d6000fd5b505050506040513d6000823e601f3d9081017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0168201604052612de79190810190614088565b5060025482516040805173ffffffffffffffffffffffffffffffffffffffff909316835260208301919091526000917f997d81a0a8415d688a6c319736602098252bf6445e0e879326f682f11928e317910160405180910390a25050565b6040517f19457468657265756d205369676e6564204d6573736167653a0a3332000000006020820152603c8101829052600090605c01611de5565b612e8a8282612f5b565b73ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff16146108ca576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601160248201527f696e76616c6964207369676e61747572650000000000000000000000000000006044820152606401610be2565b6000612bf2828585604051602001612bd7919061413f565b6060612bf28484600085612f7f565b600082612f528584613115565b14949350505050565b6000806000612f6a8585613181565b91509150612f77816131ef565b509392505050565b606082471015613011576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602660248201527f416464726573733a20696e73756666696369656e742062616c616e636520666f60448201527f722063616c6c00000000000000000000000000000000000000000000000000006064820152608401610be2565b73ffffffffffffffffffffffffffffffffffffffff85163b61308f576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e74726163740000006044820152606401610be2565b6000808673ffffffffffffffffffffffffffffffffffffffff1685876040516130b891906144a7565b60006040518083038185875af1925050503d80600081146130f5576040519150601f19603f3d011682016040523d82523d6000602084013e6130fa565b606091505b509150915061310a828286613443565b979650505050505050565b600081815b8451811015612f7757600085828151811061313757613137613fb4565b6020026020010151905080831161315d576000838152602082905260409020925061316e565b600081815260208490526040902092505b5080613179816140e4565b91505061311a565b60008082516041036131b75760208301516040840151606085015160001a6131ab87828585613496565b945094505050506131e8565b82516040036131e057602083015160408401516131d58683836135ae565b9350935050506131e8565b506000905060025b9250929050565b6000816004811115613203576132036144c3565b0361320b5750565b600181600481111561321f5761321f6144c3565b03613286576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601860248201527f45434453413a20696e76616c6964207369676e617475726500000000000000006044820152606401610be2565b600281600481111561329a5761329a6144c3565b03613301576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601f60248201527f45434453413a20696e76616c6964207369676e6174757265206c656e677468006044820152606401610be2565b6003816004811115613315576133156144c3565b036133a2576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602260248201527f45434453413a20696e76616c6964207369676e6174757265202773272076616c60448201527f75650000000000000000000000000000000000000000000000000000000000006064820152608401610be2565b60048160048111156133b6576133b66144c3565b0361070c576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602260248201527f45434453413a20696e76616c6964207369676e6174757265202776272076616c60448201527f75650000000000000000000000000000000000000000000000000000000000006064820152608401610be2565b606083156134525750816129f8565b8251156134625782518084602001fd5b816040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610be291906140d1565b6000807f7fffffffffffffffffffffffffffffff5d576e7357a4501ddfe92f46681b20a08311156134cd57506000905060036135a5565b8460ff16601b141580156134e557508460ff16601c14155b156134f657506000905060046135a5565b6040805160008082526020820180845289905260ff881692820192909252606081018690526080810185905260019060a0016020604051602081039080840390855afa15801561354a573d6000803e3d6000fd5b50506040517fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0015191505073ffffffffffffffffffffffffffffffffffffffff811661359e576000600192509250506135a5565b9150600090505b94509492505050565b6000807f7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff8316816135e460ff86901c601b614220565b90506135f287828885613496565b935093505050935093915050565b803573ffffffffffffffffffffffffffffffffffffffff8116811461362457600080fd5b919050565b60006020828403121561363b57600080fd5b6129f882613600565b60006020828403121561365657600080fd5b5035919050565b801515811461070c57600080fd5b60008060006060848603121561368057600080fd5b61368984613600565b92506020840135915060408401356136a08161365d565b809150509250925092565b803563ffffffff8116811461362457600080fd5b6000602082840312156136d157600080fd5b6129f8826136ab565b600080604083850312156136ed57600080fd5b6136f683613600565b915061370460208401613600565b90509250929050565b803567ffffffffffffffff8116811461362457600080fd5b60008060008060008060c0878903121561373e57600080fd5b61374787613600565b955061375560208801613600565b945060408701359350606087013592506137716080880161370d565b915061377f60a088016136ab565b90509295509295509295565b6000806040838503121561379e57600080fd5b50508035926020909101359150565b600080604083850312156137c057600080fd5b6137c983613600565b946020939093013593505050565b6000806000806000806000806000806101408b8d0312156137f757600080fd5b6138008b613600565b995061380e60208c01613600565b985061381c60408c01613600565b975060608b0135965060808b0135955060a08b0135945060c08b0135935061384660e08c0161370d565b92506138556101008c0161370d565b91506138646101208c016136ab565b90509295989b9194979a5092959850565b6000806020838503121561388857600080fd5b823567ffffffffffffffff808211156138a057600080fd5b818501915085601f8301126138b457600080fd5b8135818111156138c357600080fd5b8660208260051b85010111156138d857600080fd5b60209290920196919550909350505050565b60005b838110156139055781810151838201526020016138ed565b838111156117135750506000910152565b6000815180845261392e8160208601602086016138ea565b601f017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0169290920160200192915050565b6000602080830181845280855180835260408601915060408160051b870101925083870160005b828110156139d3577fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc08886030184526139c1858351613916565b94509285019290850190600101613987565b5092979650505050505050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b60405160c0810167ffffffffffffffff81118282101715613a3257613a326139e0565b60405290565b604051601f82017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe016810167ffffffffffffffff81118282101715613a7f57613a7f6139e0565b604052919050565b600067ffffffffffffffff821115613aa157613aa16139e0565b5060051b60200190565b600082601f830112613abc57600080fd5b81356020613ad1613acc83613a87565b613a38565b82815260059290921b84018101918181019086841115613af057600080fd5b8286015b84811015613b0b5780358352918301918301613af4565b509695505050505050565b600082601f830112613b2757600080fd5b81356020613b37613acc83613a87565b82815260059290921b84018101918181019086841115613b5657600080fd5b8286015b84811015613b0b57613b6b81613600565b8352918301918301613b5a565b600080600060608486031215613b8d57600080fd5b613b96846136ab565b9250602084013567ffffffffffffffff80821115613bb357600080fd5b9085019060c08288031215613bc757600080fd5b613bcf613a0f565b8235815260208301356020820152604083013582811115613bef57600080fd5b613bfb89828601613aab565b604083015250613c0d606084016136ab565b6060820152613c1e60808401613600565b608082015260a083013582811115613c3557600080fd5b613c4189828601613b16565b60a08301525093506040860135915080821115613c5d57600080fd5b50613c6a86828701613aab565b9150509250925092565b600067ffffffffffffffff821115613c8e57613c8e6139e0565b50601f017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe01660200190565b600082601f830112613ccb57600080fd5b8135613cd9613acc82613c74565b818152846020838601011115613cee57600080fd5b816020850160208301376000918101602001919091529392505050565b60008060008060808587031215613d2157600080fd5b613d2a85613600565b9350613d386020860161370d565b9250613d46604086016136ab565b9150606085013567ffffffffffffffff811115613d6257600080fd5b613d6e87828801613cba565b91505092959194509250565b6000806000806000806000806000806101408b8d031215613d9a57600080fd5b613da38b613600565b9950613db160208c01613600565b9850613dbf60408c01613600565b975060608b0135965060808b01359550613ddb60a08c0161370d565b9450613de960c08c0161370d565b9350613df760e08c016136ab565b9250613e066101008c016136ab565b91506101208b013567ffffffffffffffff811115613e2357600080fd5b613e2f8d828e01613aab565b9150509295989b9194979a5092959850565b6000806000806000806000806000806000806101808d8f031215613e6457600080fd5b613e6d8d613600565b9b50613e7b60208e01613600565b9a50613e8960408e01613600565b995060608d0135985060808d0135975060a08d0135965060c08d01359550613eb360e08e0161370d565b9450613ec26101008e0161370d565b9350613ed16101208e0161370d565b9250613ee06101408e016136ab565b915067ffffffffffffffff6101608e01351115613efc57600080fd5b613f0d8e6101608f01358f01613cba565b90509295989b509295989b509295989b565b600060208284031215613f3157600080fd5b5051919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b600063ffffffff83811690831681811015613f8457613f84613f38565b039392505050565b600063ffffffff808316818516808303821115613fab57613fab613f38565b01949350505050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b60008083357fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe184360301811261401857600080fd5b83018035915067ffffffffffffffff82111561403357600080fd5b6020019150368190038213156131e857600080fd5b8183823760009101908152919050565b6000614066613acc84613c74565b905082815283838301111561407a57600080fd5b6129f88360208301846138ea565b60006020828403121561409a57600080fd5b815167ffffffffffffffff8111156140b157600080fd5b8201601f810184136140c257600080fd5b612bf284825160208401614058565b6020815260006129f86020830184613916565b60007fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff820361411557614115613f38565b5060010190565b67ffffffffffffffff83168152604060208201526000612bf26040830184613916565b815173ffffffffffffffffffffffffffffffffffffffff90811682526020808401518216908301526040808401519182169083015261012082019050606083015160608301526080830151608083015260a083015160a083015260c08301516141b460c084018267ffffffffffffffff169052565b5060e08301516141d060e084018267ffffffffffffffff169052565b506101009283015163ffffffff16919092015290565b600067ffffffffffffffff808316818516808303821115613fab57613fab613f38565b60008282101561421b5761421b613f38565b500390565b6000821982111561423357614233613f38565b500190565b600063ffffffff80831681810361425157614251613f38565b6001019392505050565b600081518084526020808501945080840160005b8381101561428b5781518752958201959082019060010161426f565b509495945050505050565b600081518084526020808501945080840160005b8381101561428b57815173ffffffffffffffffffffffffffffffffffffffff16875295820195908201906001016142aa565b85815260a0602082015260006142f560a083018761425b565b73ffffffffffffffffffffffffffffffffffffffff808716604085015283820360608501526143248287614296565b9250808516608085015250509695505050505050565b60006020828403121561434c57600080fd5b81516129f88161365d565b600067ffffffffffffffff83811690831681811015613f8457613f84613f38565b6000817fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff04831182151516156143b0576143b0613f38565b500290565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601260045260246000fd5b6000826143f3576143f36143b5565b500490565b6020815281516020820152602082015160408201526000604083015160c0606084015261442860e084018261425b565b905063ffffffff606085015116608084015273ffffffffffffffffffffffffffffffffffffffff60808501511660a084015260a08401517fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe08483030160c08501526120a68282614296565b6000826144a2576144a26143b5565b500690565b600082516144b98184602087016138ea565b9190910192915050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052602160045260246000fdfea26469706673582212200366289a2afa53961ee89e12be7aa19d0583eb8987acfd894558f08599d1737364736f6c634300080d0033", "devdoc": { - "details": "Uses AVM cross-domain-enabled logic for access control.", "kind": "dev", "methods": { + "chainId()": { + "details": "Some L2s like ZKSync don't support the CHAIN_ID opcode so we allow the implementer to override this." + }, + "constructor": { + "params": { + "_crossDomainAdmin": "Cross domain admin to set. Can be changed by admin.", + "_hubPool": "Hub pool address to set. Can be changed by admin.", + "_l2GatewayRouter": "Address of L2 token gateway. Can be reset by admin.", + "_wethAddress": "Weth address for this network to set.", + "timerAddress": "Timer address to set." + } + }, "deposit(address,address,uint256,uint256,uint64,uint32)": { - "details": "The caller must first approve this contract to spend `amount` of `originToken`." + "params": { + "amount": "Amount of tokens to deposit. Will be amount of tokens to receive less fees.", + "destinationChainId": "Denotes network where user will receive funds from SpokePool by a relayer.", + "originToken": "Token to lock into this contract to initiate deposit.", + "quoteTimestamp": "Timestamp used by relayers to compute this deposit's realizedLPFeePct which is paid to LP pool on HubPool.", + "recipient": "Address to receive funds at on destination chain.", + "relayerFeePct": "% of deposit amount taken out to incentivize a fast relayer." + } + }, + "emergencyDeleteRootBundle(uint256)": { + "params": { + "rootBundleId": "Index of the root bundle that needs to be deleted. Note: this is intentionally a uint256 to ensure that a small input range doesn't limit which indices this method is able to reach." + } + }, + "executeRelayerRefundRoot(uint32,(uint256,uint256,uint256[],uint32,address,address[]),bytes32[])": { + "params": { + "proof": "Inclusion proof for this leaf in relayer refund root in root bundle.", + "relayerRefundLeaf": "Contains all data necessary to reconstruct leaf contained in root bundle and to refund relayer. This data structure is explained in detail in the SpokePoolInterface.", + "rootBundleId": "Unique ID of root bundle containing relayer refund root that this leaf is contained in." + } + }, + "executeSlowRelayRoot(address,address,address,uint256,uint256,uint64,uint64,uint32,uint32,bytes32[])": { + "details": "This function assumes that the relay's destination chain ID is the current chain ID, which prevents the caller from executing a slow relay intended for another chain on this chain.", + "params": { + "amount": "Full size of the deposit.", + "depositId": "Unique deposit ID on origin spoke pool.", + "depositor": "Depositor on origin chain who set this chain as the destination chain.", + "destinationToken": "Token to send to recipient. Should be mapped to the origin token, origin chain ID and this chain ID via a mapping on the HubPool.", + "originChainId": "Chain of SpokePool where deposit originated.", + "proof": "Inclusion proof for this leaf in slow relay root in root bundle.", + "realizedLpFeePct": "Fee % based on L1 HubPool utilization at deposit quote time. Deterministic based on quote time.", + "recipient": "Specified recipient on this chain.", + "relayerFeePct": "Original fee % to keep as relayer set by depositor.", + "rootBundleId": "Unique ID of root bundle containing slow relay root that this leaf is contained in." + } + }, + "fillRelay(address,address,address,uint256,uint256,uint256,uint256,uint64,uint64,uint32)": { + "params": { + "amount": "Full size of the deposit.", + "depositId": "Unique deposit ID on origin spoke pool.", + "depositor": "Depositor on origin chain who set this chain as the destination chain.", + "destinationToken": "Token to send to recipient. Should be mapped to the origin token, origin chain ID and this chain ID via a mapping on the HubPool.", + "maxTokensToSend": "Max amount of tokens to send recipient. If higher than amount, then caller will send recipient the full relay amount.", + "originChainId": "Chain of SpokePool where deposit originated.", + "realizedLpFeePct": "Fee % based on L1 HubPool utilization at deposit quote time. Deterministic based on quote time.", + "recipient": "Specified recipient on this chain.", + "relayerFeePct": "Fee % to keep as relayer, specified by depositor.", + "repaymentChainId": "Chain of SpokePool where relayer wants to be refunded after the challenge window has passed." + } + }, + "fillRelayWithUpdatedFee(address,address,address,uint256,uint256,uint256,uint256,uint64,uint64,uint64,uint32,bytes)": { + "params": { + "amount": "Full size of the deposit.", + "depositId": "Unique deposit ID on origin spoke pool.", + "depositor": "Depositor on origin chain who set this chain as the destination chain.", + "depositorSignature": "Depositor-signed message containing updated fee %.", + "destinationToken": "Token to send to recipient. Should be mapped to the origin token, origin chain ID and this chain ID via a mapping on the HubPool.", + "maxTokensToSend": "Max amount of tokens to send recipient. If higher than amount, then caller will send recipient the full relay amount.", + "newRelayerFeePct": "New fee % to keep as relayer also specified by depositor.", + "originChainId": "Chain of SpokePool where deposit originated.", + "realizedLpFeePct": "Fee % based on L1 HubPool utilization at deposit quote time. Deterministic based on quote time.", + "recipient": "Specified recipient on this chain.", + "relayerFeePct": "Original fee % to keep as relayer set by depositor.", + "repaymentChainId": "Chain of SpokePool where relayer wants to be refunded after the challenge window has passed." + } }, "getCurrentTime()": { "returns": { "_0": "uint for the current Testable timestamp." } }, + "relayRootBundle(bytes32,bytes32)": { + "params": { + "relayerRefundRoot": "Merkle root containing relayer refund leaves that can be individually executed via executeRelayerRefundRoot().", + "slowRelayRoot": "Merkle root containing slow relay fulfillment leaves that can be individually executed via executeSlowRelayRoot()." + } + }, + "setCrossDomainAdmin(address)": { + "params": { + "newCrossDomainAdmin": "New cross domain admin." + } + }, "setCurrentTime(uint256)": { "details": "Will revert if not running in test mode.", "params": { "time": "timestamp to set current Testable time to." } + }, + "setDepositQuoteTimeBuffer(uint32)": { + "params": { + "newDepositQuoteTimeBuffer": "New quote time buffer." + } + }, + "setEnableRoute(address,uint256,bool)": { + "params": { + "destinationChainId": "Chain ID for where depositor wants to receive funds.", + "enabled": "True to enable deposits, False otherwise.", + "originToken": "Token that depositor can deposit to this contract." + } + }, + "setHubPool(address)": { + "params": { + "newHubPool": "New hub pool." + } + }, + "setL2GatewayRouter(address)": { + "params": { + "newL2GatewayRouter": "New L2 gateway router." + } + }, + "speedUpDeposit(address,uint64,uint32,bytes)": { + "params": { + "depositId": "Deposit to update fee for that originated in this contract.", + "depositor": "Signer of the update fee message who originally submitted the deposit. If the deposit doesn't exist, then the relayer will not be able to fill any relay, so the caller should validate that the depositor did in fact submit a relay.", + "depositorSignature": "Signed message containing the depositor address, this contract chain ID, the updated relayer fee %, and the deposit ID. This signature is produced by signing a hash of data according to the EIP-191 standard. See more in the _verifyUpdateRelayerFeeMessage() comments.", + "newRelayerFeePct": "New relayer fee that relayers can use." + } + }, + "whitelistToken(address,address)": { + "params": { + "l1Token": "Ethereum version of l2Token.", + "l2Token": "Arbitrum token." + } } }, "version": 1 @@ -1222,23 +1355,68 @@ "userdoc": { "kind": "user", "methods": { + "chainId()": { + "notice": "Returns chain ID for this network." + }, + "constructor": { + "notice": "Construct the AVM SpokePool." + }, "deposit(address,address,uint256,uint256,uint64,uint32)": { - "notice": "Called by user to bridge funds from origin to destination chain." + "notice": "Called by user to bridge funds from origin to destination chain. Depositor will effectively lock tokens in this contract and receive a destination token on the destination chain. The origin => destination token mapping is stored on the L1 HubPool.The caller must first approve this contract to spend amount of originToken.The originToken => destinationChainId must be enabled.This method is payable because the caller is able to deposit ETH if the originToken is WETH and this function will handle wrapping ETH." + }, + "emergencyDeleteRootBundle(uint256)": { + "notice": "This method is intended to only be used in emergencies where a bad root bundle has reached the SpokePool." + }, + "executeRelayerRefundRoot(uint32,(uint256,uint256,uint256[],uint32,address,address[]),bytes32[])": { + "notice": "Executes a relayer refund leaf stored as part of a root bundle. Will send the relayer the amount they sent to the recipient plus a relayer fee." + }, + "executeSlowRelayRoot(address,address,address,uint256,uint256,uint64,uint64,uint32,uint32,bytes32[])": { + "notice": "Executes a slow relay leaf stored as part of a root bundle. Will send the full amount remaining in the relay to the recipient, less fees." + }, + "fillRelay(address,address,address,uint256,uint256,uint256,uint256,uint64,uint64,uint32)": { + "notice": "Called by relayer to fulfill part of a deposit by sending destination tokens to the recipient. Relayer is expected to pass in unique identifying information for deposit that they want to fulfill, and this relay submission will be validated by off-chain data workers who can dispute this relay if any part is invalid. If the relay is valid, then the relayer will be refunded on their desired repayment chain. If relay is invalid, then relayer will not receive any refund.All of the deposit data can be found via on-chain events from the origin SpokePool, except for the realizedLpFeePct which is a function of the HubPool's utilization at the deposit quote time. This fee % is deterministic based on the quote time, so the relayer should just compute it using the canonical algorithm as described in a UMIP linked to the HubPool's identifier." + }, + "fillRelayWithUpdatedFee(address,address,address,uint256,uint256,uint256,uint256,uint64,uint64,uint64,uint32,bytes)": { + "notice": "Called by relayer to execute same logic as calling fillRelay except that relayer is using an updated relayer fee %. The fee % must have been emitted in a message cryptographically signed by the depositor.By design, the depositor probably emitted the message with the updated fee by calling speedUpRelay()." }, "getCurrentTime()": { "notice": "Gets the current time. Will return the last time set in `setCurrentTime` if running in test mode. Otherwise, it will return the block timestamp." }, + "relayRootBundle(bytes32,bytes32)": { + "notice": "This method stores a new root bundle in this contract that can be executed to refund relayers, fulfill slow relays, and send funds back to the HubPool on L1. This method can only be called by the admin and is designed to be called as part of a cross-chain message from the HubPool's executeRootBundle method." + }, + "setCrossDomainAdmin(address)": { + "notice": "Change cross domain admin address. Callable by admin only." + }, "setCurrentTime(uint256)": { "notice": "Sets the current time." + }, + "setDepositQuoteTimeBuffer(uint32)": { + "notice": "Change allowance for deposit quote time to differ from current block time. Callable by admin only." + }, + "setEnableRoute(address,uint256,bool)": { + "notice": "Enable/Disable an origin token => destination chain ID route for deposits. Callable by admin only." + }, + "setHubPool(address)": { + "notice": "Change L1 hub pool address. Callable by admin only." + }, + "setL2GatewayRouter(address)": { + "notice": "Change L2 gateway router. Callable only by admin." + }, + "speedUpDeposit(address,uint64,uint32,bytes)": { + "notice": "Convenience method that depositor can use to signal to relayer to use updated fee.Relayer should only use events emitted by this function to submit fills with updated fees, otherwise they risk their fills getting disputed for being invalid, for example if the depositor never actually signed the update fee message.This function will revert if the depositor did not sign a message containing the updated fee for the deposit ID stored in this contract. If the deposit ID is for another contract, or the depositor address is incorrect, or the updated fee is incorrect, then the signature will not match and this function will revert." + }, + "whitelistToken(address,address)": { + "notice": "Add L2 -> L1 token mapping. Callable only by admin." } }, - "notice": "AVM specific SpokePool.", + "notice": "AVM specific SpokePool. Uses AVM cross-domain-enabled logic to implement admin only access to functions.", "version": 1 }, "storageLayout": { "storage": [ { - "astId": 5882, + "astId": 5790, "contract": "contracts/Arbitrum_SpokePool.sol:Arbitrum_SpokePool", "label": "timerAddress", "offset": 0, @@ -1246,7 +1424,7 @@ "type": "t_address" }, { - "astId": 5108, + "astId": 7084, "contract": "contracts/Arbitrum_SpokePool.sol:Arbitrum_SpokePool", "label": "_notEntered", "offset": 20, @@ -1254,7 +1432,7 @@ "type": "t_bool" }, { - "astId": 7840, + "astId": 8179, "contract": "contracts/Arbitrum_SpokePool.sol:Arbitrum_SpokePool", "label": "crossDomainAdmin", "offset": 0, @@ -1262,7 +1440,7 @@ "type": "t_address" }, { - "astId": 7842, + "astId": 8181, "contract": "contracts/Arbitrum_SpokePool.sol:Arbitrum_SpokePool", "label": "hubPool", "offset": 0, @@ -1270,75 +1448,59 @@ "type": "t_address" }, { - "astId": 7845, - "contract": "contracts/Arbitrum_SpokePool.sol:Arbitrum_SpokePool", - "label": "weth", - "offset": 0, - "slot": "3", - "type": "t_contract(WETH9)9921" - }, - { - "astId": 7847, - "contract": "contracts/Arbitrum_SpokePool.sol:Arbitrum_SpokePool", - "label": "deploymentTime", - "offset": 20, - "slot": "3", - "type": "t_uint32" - }, - { - "astId": 7850, + "astId": 8187, "contract": "contracts/Arbitrum_SpokePool.sol:Arbitrum_SpokePool", "label": "depositQuoteTimeBuffer", - "offset": 24, - "slot": "3", + "offset": 20, + "slot": "2", "type": "t_uint32" }, { - "astId": 7852, + "astId": 8189, "contract": "contracts/Arbitrum_SpokePool.sol:Arbitrum_SpokePool", "label": "numberOfDeposits", - "offset": 28, - "slot": "3", + "offset": 24, + "slot": "2", "type": "t_uint32" }, { - "astId": 7858, + "astId": 8195, "contract": "contracts/Arbitrum_SpokePool.sol:Arbitrum_SpokePool", "label": "enabledDepositRoutes", "offset": 0, - "slot": "4", + "slot": "3", "type": "t_mapping(t_address,t_mapping(t_uint256,t_bool))" }, { - "astId": 7871, + "astId": 8199, "contract": "contracts/Arbitrum_SpokePool.sol:Arbitrum_SpokePool", "label": "rootBundles", "offset": 0, - "slot": "5", - "type": "t_array(t_struct(RootBundle)7867_storage)dyn_storage" + "slot": "4", + "type": "t_array(t_struct(RootBundle)9627_storage)dyn_storage" }, { - "astId": 7875, + "astId": 8203, "contract": "contracts/Arbitrum_SpokePool.sol:Arbitrum_SpokePool", "label": "relayFills", "offset": 0, - "slot": "6", + "slot": "5", "type": "t_mapping(t_bytes32,t_uint256)" }, { - "astId": 6677, + "astId": 6582, "contract": "contracts/Arbitrum_SpokePool.sol:Arbitrum_SpokePool", "label": "l2GatewayRouter", "offset": 0, - "slot": "7", + "slot": "6", "type": "t_address" }, { - "astId": 6681, + "astId": 6586, "contract": "contracts/Arbitrum_SpokePool.sol:Arbitrum_SpokePool", "label": "whitelistedTokens", "offset": 0, - "slot": "8", + "slot": "7", "type": "t_mapping(t_address,t_address)" } ], @@ -1348,10 +1510,10 @@ "label": "address", "numberOfBytes": "20" }, - "t_array(t_struct(RootBundle)7867_storage)dyn_storage": { - "base": "t_struct(RootBundle)7867_storage", + "t_array(t_struct(RootBundle)9627_storage)dyn_storage": { + "base": "t_struct(RootBundle)9627_storage", "encoding": "dynamic_array", - "label": "struct SpokePool.RootBundle[]", + "label": "struct SpokePoolInterface.RootBundle[]", "numberOfBytes": "32" }, "t_bool": { @@ -1364,11 +1526,6 @@ "label": "bytes32", "numberOfBytes": "32" }, - "t_contract(WETH9)9921": { - "encoding": "inplace", - "label": "contract WETH9", - "numberOfBytes": "20" - }, "t_mapping(t_address,t_address)": { "encoding": "mapping", "key": "t_address", @@ -1404,20 +1561,20 @@ "numberOfBytes": "32", "value": "t_uint256" }, - "t_struct(RootBundle)7867_storage": { + "t_struct(RootBundle)9627_storage": { "encoding": "inplace", - "label": "struct SpokePool.RootBundle", + "label": "struct SpokePoolInterface.RootBundle", "members": [ { - "astId": 7860, + "astId": 9620, "contract": "contracts/Arbitrum_SpokePool.sol:Arbitrum_SpokePool", - "label": "slowRelayFulfillmentRoot", + "label": "slowRelayRoot", "offset": 0, "slot": "0", "type": "t_bytes32" }, { - "astId": 7862, + "astId": 9622, "contract": "contracts/Arbitrum_SpokePool.sol:Arbitrum_SpokePool", "label": "relayerRefundRoot", "offset": 0, @@ -1425,7 +1582,7 @@ "type": "t_bytes32" }, { - "astId": 7866, + "astId": 9626, "contract": "contracts/Arbitrum_SpokePool.sol:Arbitrum_SpokePool", "label": "claimedBitmap", "offset": 0, diff --git a/deployments/arbitrum-rinkeby/Ethereum_SpokePool.json b/deployments/arbitrum-rinkeby/Ethereum_SpokePool.json deleted file mode 100644 index d908a48ad..000000000 --- a/deployments/arbitrum-rinkeby/Ethereum_SpokePool.json +++ /dev/null @@ -1,1371 +0,0 @@ -{ - "address": "0xC3956eb1FC4Da1fD2400cC4682a5a62a1F31806D", - "abi": [ - { - "inputs": [ - { - "internalType": "address", - "name": "_crossDomainAdmin", - "type": "address" - }, - { - "internalType": "address", - "name": "_hubPool", - "type": "address" - }, - { - "internalType": "address", - "name": "_wethAddress", - "type": "address" - }, - { - "internalType": "address", - "name": "timerAddress", - "type": "address" - } - ], - "stateMutability": "nonpayable", - "type": "constructor" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": true, - "internalType": "address", - "name": "originToken", - "type": "address" - }, - { - "indexed": true, - "internalType": "uint256", - "name": "destinationChainId", - "type": "uint256" - }, - { - "indexed": false, - "internalType": "bool", - "name": "enabled", - "type": "bool" - } - ], - "name": "EnabledDepositRoute", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": false, - "internalType": "uint256", - "name": "amountToReturn", - "type": "uint256" - }, - { - "indexed": false, - "internalType": "uint256", - "name": "chainId", - "type": "uint256" - }, - { - "indexed": false, - "internalType": "uint256[]", - "name": "refundAmounts", - "type": "uint256[]" - }, - { - "indexed": true, - "internalType": "uint32", - "name": "rootBundleId", - "type": "uint32" - }, - { - "indexed": true, - "internalType": "uint32", - "name": "leafId", - "type": "uint32" - }, - { - "indexed": false, - "internalType": "address", - "name": "l2TokenAddress", - "type": "address" - }, - { - "indexed": false, - "internalType": "address[]", - "name": "refundAddresses", - "type": "address[]" - }, - { - "indexed": true, - "internalType": "address", - "name": "caller", - "type": "address" - } - ], - "name": "ExecutedRelayerRefundRoot", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": true, - "internalType": "bytes32", - "name": "relayHash", - "type": "bytes32" - }, - { - "indexed": false, - "internalType": "uint256", - "name": "totalRelayAmount", - "type": "uint256" - }, - { - "indexed": false, - "internalType": "uint256", - "name": "totalFilledAmount", - "type": "uint256" - }, - { - "indexed": false, - "internalType": "uint256", - "name": "fillAmount", - "type": "uint256" - }, - { - "indexed": false, - "internalType": "uint256", - "name": "originChainId", - "type": "uint256" - }, - { - "indexed": false, - "internalType": "uint64", - "name": "relayerFeePct", - "type": "uint64" - }, - { - "indexed": false, - "internalType": "uint64", - "name": "realizedLpFeePct", - "type": "uint64" - }, - { - "indexed": false, - "internalType": "uint32", - "name": "depositId", - "type": "uint32" - }, - { - "indexed": false, - "internalType": "address", - "name": "destinationToken", - "type": "address" - }, - { - "indexed": true, - "internalType": "address", - "name": "caller", - "type": "address" - }, - { - "indexed": false, - "internalType": "address", - "name": "depositor", - "type": "address" - }, - { - "indexed": false, - "internalType": "address", - "name": "recipient", - "type": "address" - } - ], - "name": "ExecutedSlowRelayFulfillmentRoot", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": true, - "internalType": "bytes32", - "name": "relayHash", - "type": "bytes32" - }, - { - "indexed": false, - "internalType": "uint256", - "name": "totalRelayAmount", - "type": "uint256" - }, - { - "indexed": false, - "internalType": "uint256", - "name": "totalFilledAmount", - "type": "uint256" - }, - { - "indexed": false, - "internalType": "uint256", - "name": "fillAmount", - "type": "uint256" - }, - { - "indexed": true, - "internalType": "uint256", - "name": "repaymentChain", - "type": "uint256" - }, - { - "indexed": false, - "internalType": "uint256", - "name": "originChainId", - "type": "uint256" - }, - { - "indexed": false, - "internalType": "uint64", - "name": "relayerFeePct", - "type": "uint64" - }, - { - "indexed": false, - "internalType": "uint64", - "name": "realizedLpFeePct", - "type": "uint64" - }, - { - "indexed": false, - "internalType": "uint32", - "name": "depositId", - "type": "uint32" - }, - { - "indexed": false, - "internalType": "address", - "name": "destinationToken", - "type": "address" - }, - { - "indexed": true, - "internalType": "address", - "name": "relayer", - "type": "address" - }, - { - "indexed": false, - "internalType": "address", - "name": "depositor", - "type": "address" - }, - { - "indexed": false, - "internalType": "address", - "name": "recipient", - "type": "address" - } - ], - "name": "FilledRelay", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": false, - "internalType": "uint256", - "name": "amount", - "type": "uint256" - }, - { - "indexed": false, - "internalType": "uint256", - "name": "destinationChainId", - "type": "uint256" - }, - { - "indexed": false, - "internalType": "uint64", - "name": "relayerFeePct", - "type": "uint64" - }, - { - "indexed": true, - "internalType": "uint32", - "name": "depositId", - "type": "uint32" - }, - { - "indexed": false, - "internalType": "uint32", - "name": "quoteTimestamp", - "type": "uint32" - }, - { - "indexed": true, - "internalType": "address", - "name": "originToken", - "type": "address" - }, - { - "indexed": false, - "internalType": "address", - "name": "recipient", - "type": "address" - }, - { - "indexed": true, - "internalType": "address", - "name": "depositor", - "type": "address" - } - ], - "name": "FundsDeposited", - "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" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": true, - "internalType": "uint32", - "name": "rootBundleId", - "type": "uint32" - }, - { - "indexed": false, - "internalType": "bytes32", - "name": "relayerRefundRoot", - "type": "bytes32" - }, - { - "indexed": false, - "internalType": "bytes32", - "name": "slowRelayFulfillmentRoot", - "type": "bytes32" - } - ], - "name": "RelayedRootBundle", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": false, - "internalType": "uint32", - "name": "newBuffer", - "type": "uint32" - } - ], - "name": "SetDepositQuoteTimeBuffer", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": true, - "internalType": "address", - "name": "newHubPool", - "type": "address" - } - ], - "name": "SetHubPool", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": true, - "internalType": "address", - "name": "newAdmin", - "type": "address" - } - ], - "name": "SetXDomainAdmin", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": false, - "internalType": "uint256", - "name": "amountToReturn", - "type": "uint256" - }, - { - "indexed": true, - "internalType": "uint256", - "name": "chainId", - "type": "uint256" - }, - { - "indexed": true, - "internalType": "uint32", - "name": "leafId", - "type": "uint32" - }, - { - "indexed": true, - "internalType": "address", - "name": "l2TokenAddress", - "type": "address" - }, - { - "indexed": false, - "internalType": "address", - "name": "caller", - "type": "address" - } - ], - "name": "TokensBridged", - "type": "event" - }, - { - "inputs": [], - "name": "chainId", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "crossDomainAdmin", - "outputs": [ - { - "internalType": "address", - "name": "", - "type": "address" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "deploymentTime", - "outputs": [ - { - "internalType": "uint32", - "name": "", - "type": "uint32" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "recipient", - "type": "address" - }, - { - "internalType": "address", - "name": "originToken", - "type": "address" - }, - { - "internalType": "uint256", - "name": "amount", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "destinationChainId", - "type": "uint256" - }, - { - "internalType": "uint64", - "name": "relayerFeePct", - "type": "uint64" - }, - { - "internalType": "uint32", - "name": "quoteTimestamp", - "type": "uint32" - } - ], - "name": "deposit", - "outputs": [], - "stateMutability": "payable", - "type": "function" - }, - { - "inputs": [], - "name": "depositQuoteTimeBuffer", - "outputs": [ - { - "internalType": "uint32", - "name": "", - "type": "uint32" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "", - "type": "address" - }, - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "name": "enabledDepositRoutes", - "outputs": [ - { - "internalType": "bool", - "name": "", - "type": "bool" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "uint32", - "name": "rootBundleId", - "type": "uint32" - }, - { - "components": [ - { - "internalType": "uint256", - "name": "amountToReturn", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "chainId", - "type": "uint256" - }, - { - "internalType": "uint256[]", - "name": "refundAmounts", - "type": "uint256[]" - }, - { - "internalType": "uint32", - "name": "leafId", - "type": "uint32" - }, - { - "internalType": "address", - "name": "l2TokenAddress", - "type": "address" - }, - { - "internalType": "address[]", - "name": "refundAddresses", - "type": "address[]" - } - ], - "internalType": "struct SpokePoolInterface.RelayerRefundLeaf", - "name": "relayerRefundLeaf", - "type": "tuple" - }, - { - "internalType": "bytes32[]", - "name": "proof", - "type": "bytes32[]" - } - ], - "name": "executeRelayerRefundRoot", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "depositor", - "type": "address" - }, - { - "internalType": "address", - "name": "recipient", - "type": "address" - }, - { - "internalType": "address", - "name": "destinationToken", - "type": "address" - }, - { - "internalType": "uint256", - "name": "totalRelayAmount", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "originChainId", - "type": "uint256" - }, - { - "internalType": "uint64", - "name": "realizedLpFeePct", - "type": "uint64" - }, - { - "internalType": "uint64", - "name": "relayerFeePct", - "type": "uint64" - }, - { - "internalType": "uint32", - "name": "depositId", - "type": "uint32" - }, - { - "internalType": "uint32", - "name": "rootBundleId", - "type": "uint32" - }, - { - "internalType": "bytes32[]", - "name": "proof", - "type": "bytes32[]" - } - ], - "name": "executeSlowRelayFulfillmentRoot", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "depositor", - "type": "address" - }, - { - "internalType": "address", - "name": "recipient", - "type": "address" - }, - { - "internalType": "address", - "name": "destinationToken", - "type": "address" - }, - { - "internalType": "uint256", - "name": "totalRelayAmount", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "maxTokensToSend", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "repaymentChain", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "originChainId", - "type": "uint256" - }, - { - "internalType": "uint64", - "name": "realizedLpFeePct", - "type": "uint64" - }, - { - "internalType": "uint64", - "name": "relayerFeePct", - "type": "uint64" - }, - { - "internalType": "uint32", - "name": "depositId", - "type": "uint32" - } - ], - "name": "fillRelay", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "depositor", - "type": "address" - }, - { - "internalType": "address", - "name": "recipient", - "type": "address" - }, - { - "internalType": "address", - "name": "destinationToken", - "type": "address" - }, - { - "internalType": "uint256", - "name": "totalRelayAmount", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "maxTokensToSend", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "repaymentChain", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "originChainId", - "type": "uint256" - }, - { - "internalType": "uint64", - "name": "realizedLpFeePct", - "type": "uint64" - }, - { - "internalType": "uint64", - "name": "relayerFeePct", - "type": "uint64" - }, - { - "internalType": "uint64", - "name": "newRelayerFeePct", - "type": "uint64" - }, - { - "internalType": "uint32", - "name": "depositId", - "type": "uint32" - }, - { - "internalType": "bytes", - "name": "depositorSignature", - "type": "bytes" - } - ], - "name": "fillRelayWithUpdatedFee", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [], - "name": "getCurrentTime", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "hubPool", - "outputs": [ - { - "internalType": "address", - "name": "", - "type": "address" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "bytes[]", - "name": "data", - "type": "bytes[]" - } - ], - "name": "multicall", - "outputs": [ - { - "internalType": "bytes[]", - "name": "results", - "type": "bytes[]" - } - ], - "stateMutability": "payable", - "type": "function" - }, - { - "inputs": [], - "name": "numberOfDeposits", - "outputs": [ - { - "internalType": "uint32", - "name": "", - "type": "uint32" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "owner", - "outputs": [ - { - "internalType": "address", - "name": "", - "type": "address" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "bytes32", - "name": "", - "type": "bytes32" - } - ], - "name": "relayFills", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "bytes32", - "name": "relayerRefundRoot", - "type": "bytes32" - }, - { - "internalType": "bytes32", - "name": "slowRelayFulfillmentRoot", - "type": "bytes32" - } - ], - "name": "relayRootBundle", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [], - "name": "renounceOwnership", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "name": "rootBundles", - "outputs": [ - { - "internalType": "bytes32", - "name": "slowRelayFulfillmentRoot", - "type": "bytes32" - }, - { - "internalType": "bytes32", - "name": "relayerRefundRoot", - "type": "bytes32" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "newCrossDomainAdmin", - "type": "address" - } - ], - "name": "setCrossDomainAdmin", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "uint256", - "name": "time", - "type": "uint256" - } - ], - "name": "setCurrentTime", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "uint32", - "name": "buffer", - "type": "uint32" - } - ], - "name": "setDepositQuoteTimeBuffer", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "originToken", - "type": "address" - }, - { - "internalType": "uint256", - "name": "destinationChainId", - "type": "uint256" - }, - { - "internalType": "bool", - "name": "enable", - "type": "bool" - } - ], - "name": "setEnableRoute", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "newHubPool", - "type": "address" - } - ], - "name": "setHubPool", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [], - "name": "timerAddress", - "outputs": [ - { - "internalType": "address", - "name": "", - "type": "address" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "newOwner", - "type": "address" - } - ], - "name": "transferOwnership", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [], - "name": "weth", - "outputs": [ - { - "internalType": "contract WETH9", - "name": "", - "type": "address" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "stateMutability": "payable", - "type": "receive" - } - ], - "transactionHash": "0x4179b914b6bef8df10cac91c5189b6c5e5252e5e95ff32a2cfc34264ad7b30b1", - "receipt": { - "to": null, - "from": "0x9A8f92a830A5cB89a3816e3D267CB7791c16b04D", - "contractAddress": "0xC3956eb1FC4Da1fD2400cC4682a5a62a1F31806D", - "transactionIndex": 0, - "gasUsed": "57840965", - "logsBloom": "0x00000000000000000000000000000000000000000000010000c08000000000000000000000000000000000000800000000200000000000000000000000000000000000000000000000000000000000000001000000000000000000000000000000000000020000001000000000000820000800000000000000000000040000400000000000000000000000000000000040000000000000000004000000000000000000000000000000000000000000000000000000000400000000000000000000000100000000800000000000000080000080000000000000000000000020000001000000000000000000000000000000000400000000000000000000000000", - "blockHash": "0x3a83371f26a057cc012c1182e879403134fe32edbf53f9116924d32fe0547520", - "transactionHash": "0x4179b914b6bef8df10cac91c5189b6c5e5252e5e95ff32a2cfc34264ad7b30b1", - "logs": [ - { - "transactionIndex": 0, - "blockNumber": 9829575, - "transactionHash": "0x4179b914b6bef8df10cac91c5189b6c5e5252e5e95ff32a2cfc34264ad7b30b1", - "address": "0xC3956eb1FC4Da1fD2400cC4682a5a62a1F31806D", - "topics": [ - "0xa9e8c42c9e7fca7f62755189a16b2f5314d43d8fb24e91ba54e6d65f9314e849", - "0x000000000000000000000000e7e46605d378efb9564ed4ddd488300b91ddf828" - ], - "data": "0x", - "logIndex": 0, - "blockHash": "0x3a83371f26a057cc012c1182e879403134fe32edbf53f9116924d32fe0547520" - }, - { - "transactionIndex": 0, - "blockNumber": 9829575, - "transactionHash": "0x4179b914b6bef8df10cac91c5189b6c5e5252e5e95ff32a2cfc34264ad7b30b1", - "address": "0xC3956eb1FC4Da1fD2400cC4682a5a62a1F31806D", - "topics": [ - "0x1f17a88f67b0f49060a34bec1a4723a563620e6aa265eb640b5046dcee0759a0", - "0x000000000000000000000000fa6326fdf1f149b63d116576fcfbc7e15cc0355a" - ], - "data": "0x", - "logIndex": 1, - "blockHash": "0x3a83371f26a057cc012c1182e879403134fe32edbf53f9116924d32fe0547520" - }, - { - "transactionIndex": 0, - "blockNumber": 9829575, - "transactionHash": "0x4179b914b6bef8df10cac91c5189b6c5e5252e5e95ff32a2cfc34264ad7b30b1", - "address": "0xC3956eb1FC4Da1fD2400cC4682a5a62a1F31806D", - "topics": [ - "0x8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0", - "0x0000000000000000000000000000000000000000000000000000000000000000", - "0x0000000000000000000000009a8f92a830a5cb89a3816e3d267cb7791c16b04d" - ], - "data": "0x", - "logIndex": 2, - "blockHash": "0x3a83371f26a057cc012c1182e879403134fe32edbf53f9116924d32fe0547520" - } - ], - "blockNumber": 9829575, - "cumulativeGasUsed": "27386204", - "status": 1, - "byzantium": true - }, - "args": [ - "0xE7e46605D378Efb9564ED4Ddd488300b91ddf828", - "0xFA6326FdF1f149B63d116576fCfbc7e15cc0355A", - "0xc778417E063141139Fce010982780140Aa0cD5Ab", - "0x0000000000000000000000000000000000000000" - ], - "numDeployments": 1, - "solcInputHash": "a1881af3726e467ac35772874a89bba0", - "metadata": "{\"compiler\":{\"version\":\"0.8.11+commit.d7f03943\"},\"language\":\"Solidity\",\"output\":{\"abi\":[{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_crossDomainAdmin\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"_hubPool\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"_wethAddress\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"timerAddress\",\"type\":\"address\"}],\"stateMutability\":\"nonpayable\",\"type\":\"constructor\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"originToken\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"uint256\",\"name\":\"destinationChainId\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"bool\",\"name\":\"enabled\",\"type\":\"bool\"}],\"name\":\"EnabledDepositRoute\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"amountToReturn\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"chainId\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"uint256[]\",\"name\":\"refundAmounts\",\"type\":\"uint256[]\"},{\"indexed\":true,\"internalType\":\"uint32\",\"name\":\"rootBundleId\",\"type\":\"uint32\"},{\"indexed\":true,\"internalType\":\"uint32\",\"name\":\"leafId\",\"type\":\"uint32\"},{\"indexed\":false,\"internalType\":\"address\",\"name\":\"l2TokenAddress\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"address[]\",\"name\":\"refundAddresses\",\"type\":\"address[]\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"caller\",\"type\":\"address\"}],\"name\":\"ExecutedRelayerRefundRoot\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"bytes32\",\"name\":\"relayHash\",\"type\":\"bytes32\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"totalRelayAmount\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"totalFilledAmount\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"fillAmount\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"originChainId\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"uint64\",\"name\":\"relayerFeePct\",\"type\":\"uint64\"},{\"indexed\":false,\"internalType\":\"uint64\",\"name\":\"realizedLpFeePct\",\"type\":\"uint64\"},{\"indexed\":false,\"internalType\":\"uint32\",\"name\":\"depositId\",\"type\":\"uint32\"},{\"indexed\":false,\"internalType\":\"address\",\"name\":\"destinationToken\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"caller\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"address\",\"name\":\"depositor\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"address\",\"name\":\"recipient\",\"type\":\"address\"}],\"name\":\"ExecutedSlowRelayFulfillmentRoot\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"bytes32\",\"name\":\"relayHash\",\"type\":\"bytes32\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"totalRelayAmount\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"totalFilledAmount\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"fillAmount\",\"type\":\"uint256\"},{\"indexed\":true,\"internalType\":\"uint256\",\"name\":\"repaymentChain\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"originChainId\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"uint64\",\"name\":\"relayerFeePct\",\"type\":\"uint64\"},{\"indexed\":false,\"internalType\":\"uint64\",\"name\":\"realizedLpFeePct\",\"type\":\"uint64\"},{\"indexed\":false,\"internalType\":\"uint32\",\"name\":\"depositId\",\"type\":\"uint32\"},{\"indexed\":false,\"internalType\":\"address\",\"name\":\"destinationToken\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"relayer\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"address\",\"name\":\"depositor\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"address\",\"name\":\"recipient\",\"type\":\"address\"}],\"name\":\"FilledRelay\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"destinationChainId\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"uint64\",\"name\":\"relayerFeePct\",\"type\":\"uint64\"},{\"indexed\":true,\"internalType\":\"uint32\",\"name\":\"depositId\",\"type\":\"uint32\"},{\"indexed\":false,\"internalType\":\"uint32\",\"name\":\"quoteTimestamp\",\"type\":\"uint32\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"originToken\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"address\",\"name\":\"recipient\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"depositor\",\"type\":\"address\"}],\"name\":\"FundsDeposited\",\"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\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"uint32\",\"name\":\"rootBundleId\",\"type\":\"uint32\"},{\"indexed\":false,\"internalType\":\"bytes32\",\"name\":\"relayerRefundRoot\",\"type\":\"bytes32\"},{\"indexed\":false,\"internalType\":\"bytes32\",\"name\":\"slowRelayFulfillmentRoot\",\"type\":\"bytes32\"}],\"name\":\"RelayedRootBundle\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"uint32\",\"name\":\"newBuffer\",\"type\":\"uint32\"}],\"name\":\"SetDepositQuoteTimeBuffer\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"newHubPool\",\"type\":\"address\"}],\"name\":\"SetHubPool\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"newAdmin\",\"type\":\"address\"}],\"name\":\"SetXDomainAdmin\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"amountToReturn\",\"type\":\"uint256\"},{\"indexed\":true,\"internalType\":\"uint256\",\"name\":\"chainId\",\"type\":\"uint256\"},{\"indexed\":true,\"internalType\":\"uint32\",\"name\":\"leafId\",\"type\":\"uint32\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"l2TokenAddress\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"address\",\"name\":\"caller\",\"type\":\"address\"}],\"name\":\"TokensBridged\",\"type\":\"event\"},{\"inputs\":[],\"name\":\"chainId\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"crossDomainAdmin\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"deploymentTime\",\"outputs\":[{\"internalType\":\"uint32\",\"name\":\"\",\"type\":\"uint32\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"recipient\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"originToken\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"destinationChainId\",\"type\":\"uint256\"},{\"internalType\":\"uint64\",\"name\":\"relayerFeePct\",\"type\":\"uint64\"},{\"internalType\":\"uint32\",\"name\":\"quoteTimestamp\",\"type\":\"uint32\"}],\"name\":\"deposit\",\"outputs\":[],\"stateMutability\":\"payable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"depositQuoteTimeBuffer\",\"outputs\":[{\"internalType\":\"uint32\",\"name\":\"\",\"type\":\"uint32\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"name\":\"enabledDepositRoutes\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint32\",\"name\":\"rootBundleId\",\"type\":\"uint32\"},{\"components\":[{\"internalType\":\"uint256\",\"name\":\"amountToReturn\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"chainId\",\"type\":\"uint256\"},{\"internalType\":\"uint256[]\",\"name\":\"refundAmounts\",\"type\":\"uint256[]\"},{\"internalType\":\"uint32\",\"name\":\"leafId\",\"type\":\"uint32\"},{\"internalType\":\"address\",\"name\":\"l2TokenAddress\",\"type\":\"address\"},{\"internalType\":\"address[]\",\"name\":\"refundAddresses\",\"type\":\"address[]\"}],\"internalType\":\"struct SpokePoolInterface.RelayerRefundLeaf\",\"name\":\"relayerRefundLeaf\",\"type\":\"tuple\"},{\"internalType\":\"bytes32[]\",\"name\":\"proof\",\"type\":\"bytes32[]\"}],\"name\":\"executeRelayerRefundRoot\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"depositor\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"recipient\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"destinationToken\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"totalRelayAmount\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"originChainId\",\"type\":\"uint256\"},{\"internalType\":\"uint64\",\"name\":\"realizedLpFeePct\",\"type\":\"uint64\"},{\"internalType\":\"uint64\",\"name\":\"relayerFeePct\",\"type\":\"uint64\"},{\"internalType\":\"uint32\",\"name\":\"depositId\",\"type\":\"uint32\"},{\"internalType\":\"uint32\",\"name\":\"rootBundleId\",\"type\":\"uint32\"},{\"internalType\":\"bytes32[]\",\"name\":\"proof\",\"type\":\"bytes32[]\"}],\"name\":\"executeSlowRelayFulfillmentRoot\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"depositor\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"recipient\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"destinationToken\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"totalRelayAmount\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"maxTokensToSend\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"repaymentChain\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"originChainId\",\"type\":\"uint256\"},{\"internalType\":\"uint64\",\"name\":\"realizedLpFeePct\",\"type\":\"uint64\"},{\"internalType\":\"uint64\",\"name\":\"relayerFeePct\",\"type\":\"uint64\"},{\"internalType\":\"uint32\",\"name\":\"depositId\",\"type\":\"uint32\"}],\"name\":\"fillRelay\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"depositor\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"recipient\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"destinationToken\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"totalRelayAmount\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"maxTokensToSend\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"repaymentChain\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"originChainId\",\"type\":\"uint256\"},{\"internalType\":\"uint64\",\"name\":\"realizedLpFeePct\",\"type\":\"uint64\"},{\"internalType\":\"uint64\",\"name\":\"relayerFeePct\",\"type\":\"uint64\"},{\"internalType\":\"uint64\",\"name\":\"newRelayerFeePct\",\"type\":\"uint64\"},{\"internalType\":\"uint32\",\"name\":\"depositId\",\"type\":\"uint32\"},{\"internalType\":\"bytes\",\"name\":\"depositorSignature\",\"type\":\"bytes\"}],\"name\":\"fillRelayWithUpdatedFee\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"getCurrentTime\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"hubPool\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes[]\",\"name\":\"data\",\"type\":\"bytes[]\"}],\"name\":\"multicall\",\"outputs\":[{\"internalType\":\"bytes[]\",\"name\":\"results\",\"type\":\"bytes[]\"}],\"stateMutability\":\"payable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"numberOfDeposits\",\"outputs\":[{\"internalType\":\"uint32\",\"name\":\"\",\"type\":\"uint32\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"owner\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"\",\"type\":\"bytes32\"}],\"name\":\"relayFills\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"relayerRefundRoot\",\"type\":\"bytes32\"},{\"internalType\":\"bytes32\",\"name\":\"slowRelayFulfillmentRoot\",\"type\":\"bytes32\"}],\"name\":\"relayRootBundle\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"renounceOwnership\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"name\":\"rootBundles\",\"outputs\":[{\"internalType\":\"bytes32\",\"name\":\"slowRelayFulfillmentRoot\",\"type\":\"bytes32\"},{\"internalType\":\"bytes32\",\"name\":\"relayerRefundRoot\",\"type\":\"bytes32\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"newCrossDomainAdmin\",\"type\":\"address\"}],\"name\":\"setCrossDomainAdmin\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"time\",\"type\":\"uint256\"}],\"name\":\"setCurrentTime\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint32\",\"name\":\"buffer\",\"type\":\"uint32\"}],\"name\":\"setDepositQuoteTimeBuffer\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"originToken\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"destinationChainId\",\"type\":\"uint256\"},{\"internalType\":\"bool\",\"name\":\"enable\",\"type\":\"bool\"}],\"name\":\"setEnableRoute\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"newHubPool\",\"type\":\"address\"}],\"name\":\"setHubPool\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"timerAddress\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"newOwner\",\"type\":\"address\"}],\"name\":\"transferOwnership\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"weth\",\"outputs\":[{\"internalType\":\"contract WETH9\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"stateMutability\":\"payable\",\"type\":\"receive\"}],\"devdoc\":{\"details\":\"Used on Ethereum L1 to facilitate L2->L1 transfers.\",\"kind\":\"dev\",\"methods\":{\"deposit(address,address,uint256,uint256,uint64,uint32)\":{\"details\":\"The caller must first approve this contract to spend `amount` of `originToken`.\"},\"getCurrentTime()\":{\"returns\":{\"_0\":\"uint for the current Testable timestamp.\"}},\"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 anymore. Can only be called by the current owner. NOTE: Renouncing ownership will leave the contract without an owner, thereby removing any functionality that is only available to the owner.\"},\"setCurrentTime(uint256)\":{\"details\":\"Will revert if not running in test mode.\",\"params\":{\"time\":\"timestamp to set current Testable time to.\"}},\"transferOwnership(address)\":{\"details\":\"Transfers ownership of the contract to a new account (`newOwner`). Can only be called by the current owner.\"}},\"version\":1},\"userdoc\":{\"kind\":\"user\",\"methods\":{\"deposit(address,address,uint256,uint256,uint64,uint32)\":{\"notice\":\"Called by user to bridge funds from origin to destination chain.\"},\"getCurrentTime()\":{\"notice\":\"Gets the current time. Will return the last time set in `setCurrentTime` if running in test mode. Otherwise, it will return the block timestamp.\"},\"setCurrentTime(uint256)\":{\"notice\":\"Sets the current time.\"}},\"notice\":\"Ethereum L1 specific SpokePool.\",\"version\":1}},\"settings\":{\"compilationTarget\":{\"contracts/Ethereum_SpokePool.sol\":\"Ethereum_SpokePool\"},\"evmVersion\":\"london\",\"libraries\":{},\"metadata\":{\"bytecodeHash\":\"ipfs\",\"useLiteralContent\":true},\"optimizer\":{\"enabled\":true,\"runs\":1000000},\"remappings\":[]},\"sources\":{\"@openzeppelin/contracts/access/Ownable.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts v4.4.1 (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 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 called by any account other than the owner.\\n */\\n modifier onlyOwner() {\\n require(owner() == _msgSender(), \\\"Ownable: caller is not the owner\\\");\\n _;\\n }\\n\\n /**\\n * @dev Leaves the contract without owner. It will not be possible to call\\n * `onlyOwner` functions anymore. Can only be called by the current owner.\\n *\\n * NOTE: Renouncing ownership will leave the contract without an owner,\\n * thereby removing 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\",\"keccak256\":\"0x24e0364e503a9bbde94c715d26573a76f14cd2a202d45f96f52134ab806b67b9\",\"license\":\"MIT\"},\"@openzeppelin/contracts/interfaces/IERC1271.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts v4.4.1 (interfaces/IERC1271.sol)\\n\\npragma solidity ^0.8.0;\\n\\n/**\\n * @dev Interface of the ERC1271 standard signature validation method for\\n * contracts as defined in https://eips.ethereum.org/EIPS/eip-1271[ERC-1271].\\n *\\n * _Available since v4.1._\\n */\\ninterface IERC1271 {\\n /**\\n * @dev Should return whether the signature provided is valid for the provided data\\n * @param hash Hash of the data to be signed\\n * @param signature Signature byte array associated with _data\\n */\\n function isValidSignature(bytes32 hash, bytes memory signature) external view returns (bytes4 magicValue);\\n}\\n\",\"keccak256\":\"0x0705a4b1b86d7b0bd8432118f226ba139c44b9dcaba0a6eafba2dd7d0639c544\",\"license\":\"MIT\"},\"@openzeppelin/contracts/token/ERC20/IERC20.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts v4.4.1 (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 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 `recipient`.\\n *\\n * Returns a boolean value indicating whether the operation succeeded.\\n *\\n * Emits a {Transfer} event.\\n */\\n function transfer(address recipient, 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 `sender` to `recipient` 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(\\n address sender,\\n address recipient,\\n uint256 amount\\n ) external returns (bool);\\n\\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\",\"keccak256\":\"0x61437cb513a887a1bbad006e7b1c8b414478427d33de47c5600af3c748f108da\",\"license\":\"MIT\"},\"@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts v4.4.1 (token/ERC20/utils/SafeERC20.sol)\\n\\npragma solidity ^0.8.0;\\n\\nimport \\\"../IERC20.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 function safeTransfer(\\n IERC20 token,\\n address to,\\n uint256 value\\n ) internal {\\n _callOptionalReturn(token, abi.encodeWithSelector(token.transfer.selector, to, value));\\n }\\n\\n function safeTransferFrom(\\n IERC20 token,\\n address from,\\n address to,\\n uint256 value\\n ) 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(\\n IERC20 token,\\n address spender,\\n uint256 value\\n ) 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 function safeIncreaseAllowance(\\n IERC20 token,\\n address spender,\\n uint256 value\\n ) internal {\\n uint256 newAllowance = token.allowance(address(this), spender) + value;\\n _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, newAllowance));\\n }\\n\\n function safeDecreaseAllowance(\\n IERC20 token,\\n address spender,\\n uint256 value\\n ) internal {\\n unchecked {\\n uint256 oldAllowance = token.allowance(address(this), spender);\\n require(oldAllowance >= value, \\\"SafeERC20: decreased allowance below zero\\\");\\n uint256 newAllowance = oldAllowance - value;\\n _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, newAllowance));\\n }\\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 if (returndata.length > 0) {\\n // Return data is optional\\n require(abi.decode(returndata, (bool)), \\\"SafeERC20: ERC20 operation did not succeed\\\");\\n }\\n }\\n}\\n\",\"keccak256\":\"0xc3d946432c0ddbb1f846a0d3985be71299df331b91d06732152117f62f0be2b5\",\"license\":\"MIT\"},\"@openzeppelin/contracts/utils/Address.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts v4.4.1 (utils/Address.sol)\\n\\npragma solidity ^0.8.0;\\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 */\\n function isContract(address account) internal view returns (bool) {\\n // This method relies on extcodesize, which returns 0 for contracts in\\n // construction, since the code is only stored at the end of the\\n // constructor execution.\\n\\n uint256 size;\\n assembly {\\n size := extcodesize(account)\\n }\\n return size > 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://diligence.consensys.net/posts/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.5.11/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 functionCall(target, data, \\\"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(\\n address target,\\n bytes memory data,\\n uint256 value\\n ) 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 require(isContract(target), \\\"Address: call to non-contract\\\");\\n\\n (bool success, bytes memory returndata) = target.call{value: value}(data);\\n return verifyCallResult(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 require(isContract(target), \\\"Address: static call to non-contract\\\");\\n\\n (bool success, bytes memory returndata) = target.staticcall(data);\\n return verifyCallResult(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 require(isContract(target), \\\"Address: delegate call to non-contract\\\");\\n\\n (bool success, bytes memory returndata) = target.delegatecall(data);\\n return verifyCallResult(success, returndata, errorMessage);\\n }\\n\\n /**\\n * @dev Tool to verifies that a low level call was successful, and revert if it wasn't, either by bubbling the\\n * revert reason 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 // 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\\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}\\n\",\"keccak256\":\"0x51b758a8815ecc9596c66c37d56b1d33883a444631a3f916b9fe65cb863ef7c4\",\"license\":\"MIT\"},\"@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\",\"keccak256\":\"0xe2e337e6dde9ef6b680e07338c493ebea1b5fd09b43424112868e9cc1706bca7\",\"license\":\"MIT\"},\"@openzeppelin/contracts/utils/Strings.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts v4.4.1 (utils/Strings.sol)\\n\\npragma solidity ^0.8.0;\\n\\n/**\\n * @dev String operations.\\n */\\nlibrary Strings {\\n bytes16 private constant _HEX_SYMBOLS = \\\"0123456789abcdef\\\";\\n\\n /**\\n * @dev Converts a `uint256` to its ASCII `string` decimal representation.\\n */\\n function toString(uint256 value) internal pure returns (string memory) {\\n // Inspired by OraclizeAPI's implementation - MIT licence\\n // https://github.com/oraclize/ethereum-api/blob/b42146b063c7d6ee1358846c198246239e9360e8/oraclizeAPI_0.4.25.sol\\n\\n if (value == 0) {\\n return \\\"0\\\";\\n }\\n uint256 temp = value;\\n uint256 digits;\\n while (temp != 0) {\\n digits++;\\n temp /= 10;\\n }\\n bytes memory buffer = new bytes(digits);\\n while (value != 0) {\\n digits -= 1;\\n buffer[digits] = bytes1(uint8(48 + uint256(value % 10)));\\n value /= 10;\\n }\\n return string(buffer);\\n }\\n\\n /**\\n * @dev Converts a `uint256` to its ASCII `string` hexadecimal representation.\\n */\\n function toHexString(uint256 value) internal pure returns (string memory) {\\n if (value == 0) {\\n return \\\"0x00\\\";\\n }\\n uint256 temp = value;\\n uint256 length = 0;\\n while (temp != 0) {\\n length++;\\n temp >>= 8;\\n }\\n return toHexString(value, length);\\n }\\n\\n /**\\n * @dev Converts a `uint256` to its ASCII `string` hexadecimal representation with fixed length.\\n */\\n function toHexString(uint256 value, uint256 length) internal pure returns (string memory) {\\n bytes memory buffer = new bytes(2 * length + 2);\\n buffer[0] = \\\"0\\\";\\n buffer[1] = \\\"x\\\";\\n for (uint256 i = 2 * length + 1; i > 1; --i) {\\n buffer[i] = _HEX_SYMBOLS[value & 0xf];\\n value >>= 4;\\n }\\n require(value == 0, \\\"Strings: hex length insufficient\\\");\\n return string(buffer);\\n }\\n}\\n\",\"keccak256\":\"0x32c202bd28995dd20c4347b7c6467a6d3241c74c8ad3edcbb610cd9205916c45\",\"license\":\"MIT\"},\"@openzeppelin/contracts/utils/cryptography/ECDSA.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts v4.4.1 (utils/cryptography/ECDSA.sol)\\n\\npragma solidity ^0.8.0;\\n\\nimport \\\"../Strings.sol\\\";\\n\\n/**\\n * @dev Elliptic Curve Digital Signature Algorithm (ECDSA) operations.\\n *\\n * These functions can be used to verify that a message was signed by the holder\\n * of the private keys of a given address.\\n */\\nlibrary ECDSA {\\n enum RecoverError {\\n NoError,\\n InvalidSignature,\\n InvalidSignatureLength,\\n InvalidSignatureS,\\n InvalidSignatureV\\n }\\n\\n function _throwError(RecoverError error) private pure {\\n if (error == RecoverError.NoError) {\\n return; // no error: do nothing\\n } else if (error == RecoverError.InvalidSignature) {\\n revert(\\\"ECDSA: invalid signature\\\");\\n } else if (error == RecoverError.InvalidSignatureLength) {\\n revert(\\\"ECDSA: invalid signature length\\\");\\n } else if (error == RecoverError.InvalidSignatureS) {\\n revert(\\\"ECDSA: invalid signature 's' value\\\");\\n } else if (error == RecoverError.InvalidSignatureV) {\\n revert(\\\"ECDSA: invalid signature 'v' value\\\");\\n }\\n }\\n\\n /**\\n * @dev Returns the address that signed a hashed message (`hash`) with\\n * `signature` or error string. This address can then be used for verification purposes.\\n *\\n * The `ecrecover` EVM opcode allows for malleable (non-unique) signatures:\\n * this function rejects them by requiring the `s` value to be in the lower\\n * half order, and the `v` value to be either 27 or 28.\\n *\\n * IMPORTANT: `hash` _must_ be the result of a hash operation for the\\n * verification to be secure: it is possible to craft signatures that\\n * recover to arbitrary addresses for non-hashed data. A safe way to ensure\\n * this is by receiving a hash of the original message (which may otherwise\\n * be too long), and then calling {toEthSignedMessageHash} on it.\\n *\\n * Documentation for signature generation:\\n * - with https://web3js.readthedocs.io/en/v1.3.4/web3-eth-accounts.html#sign[Web3.js]\\n * - with https://docs.ethers.io/v5/api/signer/#Signer-signMessage[ethers]\\n *\\n * _Available since v4.3._\\n */\\n function tryRecover(bytes32 hash, bytes memory signature) internal pure returns (address, RecoverError) {\\n // Check the signature length\\n // - case 65: r,s,v signature (standard)\\n // - case 64: r,vs signature (cf https://eips.ethereum.org/EIPS/eip-2098) _Available since v4.1._\\n if (signature.length == 65) {\\n bytes32 r;\\n bytes32 s;\\n uint8 v;\\n // ecrecover takes the signature parameters, and the only way to get them\\n // currently is to use assembly.\\n assembly {\\n r := mload(add(signature, 0x20))\\n s := mload(add(signature, 0x40))\\n v := byte(0, mload(add(signature, 0x60)))\\n }\\n return tryRecover(hash, v, r, s);\\n } else if (signature.length == 64) {\\n bytes32 r;\\n bytes32 vs;\\n // ecrecover takes the signature parameters, and the only way to get them\\n // currently is to use assembly.\\n assembly {\\n r := mload(add(signature, 0x20))\\n vs := mload(add(signature, 0x40))\\n }\\n return tryRecover(hash, r, vs);\\n } else {\\n return (address(0), RecoverError.InvalidSignatureLength);\\n }\\n }\\n\\n /**\\n * @dev Returns the address that signed a hashed message (`hash`) with\\n * `signature`. This address can then be used for verification purposes.\\n *\\n * The `ecrecover` EVM opcode allows for malleable (non-unique) signatures:\\n * this function rejects them by requiring the `s` value to be in the lower\\n * half order, and the `v` value to be either 27 or 28.\\n *\\n * IMPORTANT: `hash` _must_ be the result of a hash operation for the\\n * verification to be secure: it is possible to craft signatures that\\n * recover to arbitrary addresses for non-hashed data. A safe way to ensure\\n * this is by receiving a hash of the original message (which may otherwise\\n * be too long), and then calling {toEthSignedMessageHash} on it.\\n */\\n function recover(bytes32 hash, bytes memory signature) internal pure returns (address) {\\n (address recovered, RecoverError error) = tryRecover(hash, signature);\\n _throwError(error);\\n return recovered;\\n }\\n\\n /**\\n * @dev Overload of {ECDSA-tryRecover} that receives the `r` and `vs` short-signature fields separately.\\n *\\n * See https://eips.ethereum.org/EIPS/eip-2098[EIP-2098 short signatures]\\n *\\n * _Available since v4.3._\\n */\\n function tryRecover(\\n bytes32 hash,\\n bytes32 r,\\n bytes32 vs\\n ) internal pure returns (address, RecoverError) {\\n bytes32 s;\\n uint8 v;\\n assembly {\\n s := and(vs, 0x7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff)\\n v := add(shr(255, vs), 27)\\n }\\n return tryRecover(hash, v, r, s);\\n }\\n\\n /**\\n * @dev Overload of {ECDSA-recover} that receives the `r and `vs` short-signature fields separately.\\n *\\n * _Available since v4.2._\\n */\\n function recover(\\n bytes32 hash,\\n bytes32 r,\\n bytes32 vs\\n ) internal pure returns (address) {\\n (address recovered, RecoverError error) = tryRecover(hash, r, vs);\\n _throwError(error);\\n return recovered;\\n }\\n\\n /**\\n * @dev Overload of {ECDSA-tryRecover} that receives the `v`,\\n * `r` and `s` signature fields separately.\\n *\\n * _Available since v4.3._\\n */\\n function tryRecover(\\n bytes32 hash,\\n uint8 v,\\n bytes32 r,\\n bytes32 s\\n ) internal pure returns (address, RecoverError) {\\n // EIP-2 still allows signature malleability for ecrecover(). Remove this possibility and make the signature\\n // unique. Appendix F in the Ethereum Yellow paper (https://ethereum.github.io/yellowpaper/paper.pdf), defines\\n // the valid range for s in (301): 0 < s < secp256k1n \\u00f7 2 + 1, and for v in (302): v \\u2208 {27, 28}. Most\\n // signatures from current libraries generate a unique signature with an s-value in the lower half order.\\n //\\n // If your library generates malleable signatures, such as s-values in the upper range, calculate a new s-value\\n // with 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFEBAAEDCE6AF48A03BBFD25E8CD0364141 - s1 and flip v from 27 to 28 or\\n // vice versa. If your library also generates signatures with 0/1 for v instead 27/28, add 27 to v to accept\\n // these malleable signatures as well.\\n if (uint256(s) > 0x7FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF5D576E7357A4501DDFE92F46681B20A0) {\\n return (address(0), RecoverError.InvalidSignatureS);\\n }\\n if (v != 27 && v != 28) {\\n return (address(0), RecoverError.InvalidSignatureV);\\n }\\n\\n // If the signature is valid (and not malleable), return the signer address\\n address signer = ecrecover(hash, v, r, s);\\n if (signer == address(0)) {\\n return (address(0), RecoverError.InvalidSignature);\\n }\\n\\n return (signer, RecoverError.NoError);\\n }\\n\\n /**\\n * @dev Overload of {ECDSA-recover} that receives the `v`,\\n * `r` and `s` signature fields separately.\\n */\\n function recover(\\n bytes32 hash,\\n uint8 v,\\n bytes32 r,\\n bytes32 s\\n ) internal pure returns (address) {\\n (address recovered, RecoverError error) = tryRecover(hash, v, r, s);\\n _throwError(error);\\n return recovered;\\n }\\n\\n /**\\n * @dev Returns an Ethereum Signed Message, created from a `hash`. This\\n * produces hash corresponding to the one signed with the\\n * https://eth.wiki/json-rpc/API#eth_sign[`eth_sign`]\\n * JSON-RPC method as part of EIP-191.\\n *\\n * See {recover}.\\n */\\n function toEthSignedMessageHash(bytes32 hash) internal pure returns (bytes32) {\\n // 32 is the length in bytes of hash,\\n // enforced by the type signature above\\n return keccak256(abi.encodePacked(\\\"\\\\x19Ethereum Signed Message:\\\\n32\\\", hash));\\n }\\n\\n /**\\n * @dev Returns an Ethereum Signed Message, created from `s`. This\\n * produces hash corresponding to the one signed with the\\n * https://eth.wiki/json-rpc/API#eth_sign[`eth_sign`]\\n * JSON-RPC method as part of EIP-191.\\n *\\n * See {recover}.\\n */\\n function toEthSignedMessageHash(bytes memory s) internal pure returns (bytes32) {\\n return keccak256(abi.encodePacked(\\\"\\\\x19Ethereum Signed Message:\\\\n\\\", Strings.toString(s.length), s));\\n }\\n\\n /**\\n * @dev Returns an Ethereum Signed Typed Data, created from a\\n * `domainSeparator` and a `structHash`. This produces hash corresponding\\n * to the one signed with the\\n * https://eips.ethereum.org/EIPS/eip-712[`eth_signTypedData`]\\n * JSON-RPC method as part of EIP-712.\\n *\\n * See {recover}.\\n */\\n function toTypedDataHash(bytes32 domainSeparator, bytes32 structHash) internal pure returns (bytes32) {\\n return keccak256(abi.encodePacked(\\\"\\\\x19\\\\x01\\\", domainSeparator, structHash));\\n }\\n}\\n\",\"keccak256\":\"0xe9e291de7ffe06e66503c6700b1bb84ff6e0989cbb974653628d8994e7c97f03\",\"license\":\"MIT\"},\"@openzeppelin/contracts/utils/cryptography/MerkleProof.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts v4.4.1 (utils/cryptography/MerkleProof.sol)\\n\\npragma solidity ^0.8.0;\\n\\n/**\\n * @dev These functions deal with verification of Merkle Trees proofs.\\n *\\n * The proofs can be generated using the JavaScript library\\n * https://github.com/miguelmota/merkletreejs[merkletreejs].\\n * Note: the hashing algorithm should be keccak256 and pair sorting should be enabled.\\n *\\n * See `test/utils/cryptography/MerkleProof.test.js` for some examples.\\n */\\nlibrary MerkleProof {\\n /**\\n * @dev Returns true if a `leaf` can be proved to be a part of a Merkle tree\\n * defined by `root`. For this, a `proof` must be provided, containing\\n * sibling hashes on the branch from the leaf to the root of the tree. Each\\n * pair of leaves and each pair of pre-images are assumed to be sorted.\\n */\\n function verify(\\n bytes32[] memory proof,\\n bytes32 root,\\n bytes32 leaf\\n ) internal pure returns (bool) {\\n return processProof(proof, leaf) == root;\\n }\\n\\n /**\\n * @dev Returns the rebuilt hash obtained by traversing a Merklee tree up\\n * from `leaf` using `proof`. A `proof` is valid if and only if the rebuilt\\n * hash matches the root of the tree. When processing the proof, the pairs\\n * of leafs & pre-images are assumed to be sorted.\\n *\\n * _Available since v4.4._\\n */\\n function processProof(bytes32[] memory proof, bytes32 leaf) internal pure returns (bytes32) {\\n bytes32 computedHash = leaf;\\n for (uint256 i = 0; i < proof.length; i++) {\\n bytes32 proofElement = proof[i];\\n if (computedHash <= proofElement) {\\n // Hash(current computed hash + current element of the proof)\\n computedHash = keccak256(abi.encodePacked(computedHash, proofElement));\\n } else {\\n // Hash(current element of the proof + current computed hash)\\n computedHash = keccak256(abi.encodePacked(proofElement, computedHash));\\n }\\n }\\n return computedHash;\\n }\\n}\\n\",\"keccak256\":\"0x9c35727c74a6ffd8d02237b414e7bfb532c0323b1088709def98ea5c628157de\",\"license\":\"MIT\"},\"@openzeppelin/contracts/utils/cryptography/SignatureChecker.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts v4.4.1 (utils/cryptography/SignatureChecker.sol)\\n\\npragma solidity ^0.8.0;\\n\\nimport \\\"./ECDSA.sol\\\";\\nimport \\\"../Address.sol\\\";\\nimport \\\"../../interfaces/IERC1271.sol\\\";\\n\\n/**\\n * @dev Signature verification helper: Provide a single mechanism to verify both private-key (EOA) ECDSA signature and\\n * ERC1271 contract signatures. Using this instead of ECDSA.recover in your contract will make them compatible with\\n * smart contract wallets such as Argent and Gnosis.\\n *\\n * Note: unlike ECDSA signatures, contract signature's are revocable, and the outcome of this function can thus change\\n * through time. It could return true at block N and false at block N+1 (or the opposite).\\n *\\n * _Available since v4.1._\\n */\\nlibrary SignatureChecker {\\n function isValidSignatureNow(\\n address signer,\\n bytes32 hash,\\n bytes memory signature\\n ) internal view returns (bool) {\\n (address recovered, ECDSA.RecoverError error) = ECDSA.tryRecover(hash, signature);\\n if (error == ECDSA.RecoverError.NoError && recovered == signer) {\\n return true;\\n }\\n\\n (bool success, bytes memory result) = signer.staticcall(\\n abi.encodeWithSelector(IERC1271.isValidSignature.selector, hash, signature)\\n );\\n return (success && result.length == 32 && abi.decode(result, (bytes4)) == IERC1271.isValidSignature.selector);\\n }\\n}\\n\",\"keccak256\":\"0x448837ee3c81795bb58732fd56e8ec9b5194ab6a05a415e960da852fbaa23d01\",\"license\":\"MIT\"},\"@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\",\"keccak256\":\"0xcd34b3f83b61a096b53020749f327096d5cacd89c2393d947595afb934496ad4\",\"license\":\"AGPL-3.0-only\"},\"@uma/core/contracts/common/implementation/MultiCaller.sol\":{\"content\":\"// This contract is taken from Uniswaps'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.\\npragma solidity ^0.8.0;\\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 payable returns (bytes[] memory results) {\\n require(msg.value == 0, \\\"Only multicall with 0 value\\\");\\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\",\"keccak256\":\"0x31f18055b14fd9eeb459c6d6a88d1a60921bf3755031f6db4b709c3e01d078f7\"},\"@uma/core/contracts/common/implementation/Testable.sol\":{\"content\":\"// SPDX-License-Identifier: AGPL-3.0-only\\npragma solidity ^0.8.0;\\n\\nimport \\\"./Timer.sol\\\";\\n\\n/**\\n * @title Base class that provides time overrides, but only if being run in test mode.\\n */\\nabstract contract Testable {\\n // If the contract is being run in production, then `timerAddress` will be the 0x0 address.\\n // Note: this variable should be set on construction and never modified.\\n address public timerAddress;\\n\\n /**\\n * @notice Constructs the Testable contract. Called by child contracts.\\n * @param _timerAddress Contract that stores the current time in a testing environment.\\n * Must be set to 0x0 for production environments that use live time.\\n */\\n constructor(address _timerAddress) {\\n timerAddress = _timerAddress;\\n }\\n\\n /**\\n * @notice Reverts if not running in test mode.\\n */\\n modifier onlyIfTest {\\n require(timerAddress != address(0x0));\\n _;\\n }\\n\\n /**\\n * @notice Sets the current time.\\n * @dev Will revert if not running in test mode.\\n * @param time timestamp to set current Testable time to.\\n */\\n function setCurrentTime(uint256 time) external onlyIfTest {\\n Timer(timerAddress).setCurrentTime(time);\\n }\\n\\n /**\\n * @notice Gets the current time. Will return the last time set in `setCurrentTime` if running in test mode.\\n * Otherwise, it will return the block timestamp.\\n * @return uint for the current Testable timestamp.\\n */\\n function getCurrentTime() public view virtual returns (uint256) {\\n if (timerAddress != address(0x0)) {\\n return Timer(timerAddress).getCurrentTime();\\n } else {\\n return block.timestamp; // solhint-disable-line not-rely-on-time\\n }\\n }\\n}\\n\",\"keccak256\":\"0x0254b45747293bb800373a58d123969adec0428f7be79dc941cab10fcad09918\",\"license\":\"AGPL-3.0-only\"},\"@uma/core/contracts/common/implementation/Timer.sol\":{\"content\":\"// SPDX-License-Identifier: AGPL-3.0-only\\npragma solidity ^0.8.0;\\n\\n/**\\n * @title Universal store of current contract time for testing environments.\\n */\\ncontract Timer {\\n uint256 private currentTime;\\n\\n constructor() {\\n currentTime = block.timestamp; // solhint-disable-line not-rely-on-time\\n }\\n\\n /**\\n * @notice Sets the current time.\\n * @dev Will revert if not running in test mode.\\n * @param time timestamp to set `currentTime` to.\\n */\\n function setCurrentTime(uint256 time) external {\\n currentTime = time;\\n }\\n\\n /**\\n * @notice Gets the currentTime variable set in the Timer.\\n * @return uint256 for the current Testable timestamp.\\n */\\n function getCurrentTime() public view returns (uint256) {\\n return currentTime;\\n }\\n}\\n\",\"keccak256\":\"0x9e0dd7389718bd5d1da910273a6f4cee98ee22bfc0c92bde0f0955c0e23adb5e\",\"license\":\"AGPL-3.0-only\"},\"contracts/Ethereum_SpokePool.sol\":{\"content\":\"//SPDX-License-Identifier: Unlicense\\r\\npragma solidity ^0.8.0;\\r\\n\\r\\nimport \\\"./interfaces/WETH9.sol\\\";\\r\\n\\r\\nimport \\\"@openzeppelin/contracts/access/Ownable.sol\\\";\\r\\nimport \\\"@openzeppelin/contracts/token/ERC20/IERC20.sol\\\";\\r\\n\\r\\nimport \\\"./SpokePool.sol\\\";\\r\\nimport \\\"./SpokePoolInterface.sol\\\";\\r\\n\\r\\n/**\\r\\n * @notice Ethereum L1 specific SpokePool.\\r\\n * @dev Used on Ethereum L1 to facilitate L2->L1 transfers.\\r\\n */\\r\\n\\r\\ncontract Ethereum_SpokePool is SpokePoolInterface, SpokePool, Ownable {\\r\\n constructor(\\r\\n address _crossDomainAdmin,\\r\\n address _hubPool,\\r\\n address _wethAddress,\\r\\n address timerAddress\\r\\n ) SpokePool(_crossDomainAdmin, _hubPool, _wethAddress, timerAddress) {}\\r\\n\\r\\n /**************************************\\r\\n * ADMIN FUNCTIONS *\\r\\n **************************************/\\r\\n\\r\\n function setCrossDomainAdmin(address newCrossDomainAdmin) public override onlyOwner nonReentrant {\\r\\n _setCrossDomainAdmin(newCrossDomainAdmin);\\r\\n }\\r\\n\\r\\n function setHubPool(address newHubPool) public override onlyOwner nonReentrant {\\r\\n _setHubPool(newHubPool);\\r\\n }\\r\\n\\r\\n function setEnableRoute(\\r\\n address originToken,\\r\\n uint256 destinationChainId,\\r\\n bool enable\\r\\n ) public override onlyOwner nonReentrant {\\r\\n _setEnableRoute(originToken, destinationChainId, enable);\\r\\n }\\r\\n\\r\\n function setDepositQuoteTimeBuffer(uint32 buffer) public override onlyOwner nonReentrant {\\r\\n _setDepositQuoteTimeBuffer(buffer);\\r\\n }\\r\\n\\r\\n function relayRootBundle(bytes32 relayerRefundRoot, bytes32 slowRelayFulfillmentRoot)\\r\\n public\\r\\n override\\r\\n onlyOwner\\r\\n nonReentrant\\r\\n {\\r\\n _relayRootBundle(relayerRefundRoot, slowRelayFulfillmentRoot);\\r\\n }\\r\\n\\r\\n function _bridgeTokensToHubPool(RelayerRefundLeaf memory relayerRefundLeaf) internal override {\\r\\n IERC20(relayerRefundLeaf.l2TokenAddress).transfer(hubPool, relayerRefundLeaf.amountToReturn);\\r\\n }\\r\\n}\\r\\n\",\"keccak256\":\"0xc2accea60f97d3e0227ee08e54fb6153bbb32f0aae4c2403452cf8253118c47c\",\"license\":\"Unlicense\"},\"contracts/HubPoolInterface.sol\":{\"content\":\"// SPDX-License-Identifier: GPL-3.0-only\\r\\npragma solidity ^0.8.0;\\r\\n\\r\\nimport \\\"@openzeppelin/contracts/token/ERC20/IERC20.sol\\\";\\r\\nimport \\\"./interfaces/AdapterInterface.sol\\\";\\r\\n\\r\\ninterface HubPoolInterface {\\r\\n struct PoolRebalanceLeaf {\\r\\n // This is used to know which chain to send cross-chain transactions to (and which SpokePool to sent to).\\r\\n uint256 chainId;\\r\\n uint256[] bundleLpFees; // Total LP fee amount per token in this bundle, encompassing all associated bundled relays.\\r\\n // This array is grouped with the two above, and it represents the amount to send or request back from the\\r\\n // SpokePool. If positive, the pool will pay the SpokePool. If negative the SpokePool will pay the HubPool.\\r\\n // There can be arbitrarily complex rebalancing rules defined offchain. This number is only nonzero\\r\\n // when the rules indicate that a rebalancing action should occur. When a rebalance does not occur,\\r\\n // runningBalances for this token should change by the total relays - deposits in this bundle. When a rebalance\\r\\n // does occur, runningBalances should be set to zero for this token and the netSendAmounts should be set to the\\r\\n // previous runningBalances + relays - deposits in this bundle.\\r\\n int256[] netSendAmounts;\\r\\n // This is only here to be emitted in an event to track a running unpaid balance between the L2 pool and the L1 pool.\\r\\n // A positive number indicates that the HubPool owes the SpokePool funds. A negative number indicates that the\\r\\n // SpokePool owes the HubPool funds. See the comment above for the dynamics of this and netSendAmounts\\r\\n int256[] runningBalances;\\r\\n // Used as the index in the bitmap to track whether this leaf has been executed or not.\\r\\n uint8 leafId;\\r\\n // The following arrays are required to be the same length. They are parallel arrays for the given chainId and should be ordered by the `l1Tokens` field.\\r\\n // All whitelisted tokens with nonzero relays on this chain in this bundle in the order of whitelisting.\\r\\n address[] l1Tokens;\\r\\n }\\r\\n\\r\\n function setBond(IERC20 newBondToken, uint256 newBondAmount) external;\\r\\n\\r\\n function setCrossChainContracts(\\r\\n uint256 l2ChainId,\\r\\n address adapter,\\r\\n address spokePool\\r\\n ) external;\\r\\n\\r\\n function whitelistRoute(\\r\\n uint256 originChainId,\\r\\n uint256 destinationChainId,\\r\\n address originToken,\\r\\n address destinationToken\\r\\n ) external;\\r\\n\\r\\n function enableL1TokenForLiquidityProvision(address l1Token) external;\\r\\n\\r\\n function disableL1TokenForLiquidityProvision(address l1Token) external;\\r\\n\\r\\n function addLiquidity(address l1Token, uint256 l1TokenAmount) external payable;\\r\\n\\r\\n function removeLiquidity(\\r\\n address l1Token,\\r\\n uint256 lpTokenAmount,\\r\\n bool sendEth\\r\\n ) external;\\r\\n\\r\\n function exchangeRateCurrent(address l1Token) external returns (uint256);\\r\\n\\r\\n function liquidityUtilizationPostRelay(address token, uint256 relayedAmount) external returns (uint256);\\r\\n\\r\\n function proposeRootBundle(\\r\\n uint256[] memory bundleEvaluationBlockNumbers,\\r\\n uint8 poolRebalanceLeafCount,\\r\\n bytes32 poolRebalanceRoot,\\r\\n bytes32 relayerRefundRoot,\\r\\n bytes32 slowRelayFulfillmentRoot\\r\\n ) external;\\r\\n\\r\\n function executeRootBundle(PoolRebalanceLeaf memory poolRebalanceLeaf, bytes32[] memory proof) external;\\r\\n\\r\\n function disputeRootBundle() external;\\r\\n}\\r\\n\",\"keccak256\":\"0x493f6803156dc7129c3af9b7d5b99172ffbd9e93a98d4a44604dc0b984502777\",\"license\":\"GPL-3.0-only\"},\"contracts/MerkleLib.sol\":{\"content\":\"// SPDX-License-Identifier: GPL-3.0-only\\r\\npragma solidity ^0.8.0;\\r\\n\\r\\nimport \\\"@openzeppelin/contracts/utils/cryptography/MerkleProof.sol\\\";\\r\\nimport \\\"./SpokePoolInterface.sol\\\";\\r\\nimport \\\"./HubPoolInterface.sol\\\";\\r\\n\\r\\n/**\\r\\n * @notice Library to help with merkle roots, proofs, and claims.\\r\\n */\\r\\nlibrary MerkleLib {\\r\\n /**\\r\\n * @notice Verifies that a repayment is contained within a merkle root.\\r\\n * @param root the merkle root.\\r\\n * @param rebalance the rebalance struct.\\r\\n * @param proof the merkle proof.\\r\\n */\\r\\n function verifyPoolRebalance(\\r\\n bytes32 root,\\r\\n HubPoolInterface.PoolRebalanceLeaf memory rebalance,\\r\\n bytes32[] memory proof\\r\\n ) internal pure returns (bool) {\\r\\n return MerkleProof.verify(proof, root, keccak256(abi.encode(rebalance)));\\r\\n }\\r\\n\\r\\n /**\\r\\n * @notice Verifies that a relayer refund is contained within a merkle root.\\r\\n * @param root the merkle root.\\r\\n * @param refund the refund struct.\\r\\n * @param proof the merkle proof.\\r\\n */\\r\\n function verifyRelayerRefund(\\r\\n bytes32 root,\\r\\n SpokePoolInterface.RelayerRefundLeaf memory refund,\\r\\n bytes32[] memory proof\\r\\n ) internal pure returns (bool) {\\r\\n return MerkleProof.verify(proof, root, keccak256(abi.encode(refund)));\\r\\n }\\r\\n\\r\\n /**\\r\\n * @notice Verifies that a distribution is contained within a merkle root.\\r\\n * @param root the merkle root.\\r\\n * @param slowRelayFulfillment the relayData fulfullment struct.\\r\\n * @param proof the merkle proof.\\r\\n */\\r\\n function verifySlowRelayFulfillment(\\r\\n bytes32 root,\\r\\n SpokePoolInterface.RelayData memory slowRelayFulfillment,\\r\\n bytes32[] memory proof\\r\\n ) internal pure returns (bool) {\\r\\n return MerkleProof.verify(proof, root, keccak256(abi.encode(slowRelayFulfillment)));\\r\\n }\\r\\n\\r\\n // The following functions are primarily copied from\\r\\n // https://github.com/Uniswap/merkle-distributor/blob/master/contracts/MerkleDistributor.sol with minor changes.\\r\\n\\r\\n /**\\r\\n * @notice Tests whether a claim is contained within a claimedBitMap mapping.\\r\\n * @param claimedBitMap a simple uint256 mapping in storage used as a bitmap.\\r\\n * @param index the index to check in the bitmap.\\r\\n * @return bool indicating if the index within the claimedBitMap has been marked as claimed.\\r\\n */\\r\\n function isClaimed(mapping(uint256 => uint256) storage claimedBitMap, uint256 index) internal view returns (bool) {\\r\\n uint256 claimedWordIndex = index / 256;\\r\\n uint256 claimedBitIndex = index % 256;\\r\\n uint256 claimedWord = claimedBitMap[claimedWordIndex];\\r\\n uint256 mask = (1 << claimedBitIndex);\\r\\n return claimedWord & mask == mask;\\r\\n }\\r\\n\\r\\n /**\\r\\n * @notice Marks an index in a claimedBitMap as claimed.\\r\\n * @param claimedBitMap a simple uint256 mapping in storage used as a bitmap.\\r\\n * @param index the index to mark in the bitmap.\\r\\n */\\r\\n function setClaimed(mapping(uint256 => uint256) storage claimedBitMap, uint256 index) internal {\\r\\n uint256 claimedWordIndex = index / 256;\\r\\n uint256 claimedBitIndex = index % 256;\\r\\n claimedBitMap[claimedWordIndex] = claimedBitMap[claimedWordIndex] | (1 << claimedBitIndex);\\r\\n }\\r\\n\\r\\n /**\\r\\n * @notice Tests whether a claim is contained within a 1D claimedBitMap mapping.\\r\\n * @param claimedBitMap a simple uint256 value, encoding a 1D bitmap.\\r\\n * @param index the index to check in the bitmap.\\r\\n \\\\* @return bool indicating if the index within the claimedBitMap has been marked as claimed.\\r\\n */\\r\\n function isClaimed1D(uint256 claimedBitMap, uint256 index) internal pure returns (bool) {\\r\\n uint256 mask = (1 << index);\\r\\n return claimedBitMap & mask == mask;\\r\\n }\\r\\n\\r\\n /**\\r\\n * @notice Marks an index in a claimedBitMap as claimed.\\r\\n * @param claimedBitMap a simple uint256 mapping in storage used as a bitmap.\\r\\n * @param index the index to mark in the bitmap.\\r\\n */\\r\\n function setClaimed1D(uint256 claimedBitMap, uint256 index) internal pure returns (uint256) {\\r\\n require(index <= 255, \\\"Index out of bounds\\\");\\r\\n return claimedBitMap | (1 << index % 256);\\r\\n }\\r\\n}\\r\\n\",\"keccak256\":\"0x50079aae972160054e34f9acbad1724dc3111491c8b712b6ab1eb49ff4d9869d\",\"license\":\"GPL-3.0-only\"},\"contracts/SpokePool.sol\":{\"content\":\"// SPDX-License-Identifier: GPL-3.0-only\\r\\npragma solidity ^0.8.0;\\r\\n\\r\\nimport \\\"./MerkleLib.sol\\\";\\r\\nimport \\\"./interfaces/WETH9.sol\\\";\\r\\n\\r\\nimport \\\"@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol\\\";\\r\\nimport \\\"@openzeppelin/contracts/token/ERC20/IERC20.sol\\\";\\r\\nimport \\\"@openzeppelin/contracts/utils/Address.sol\\\";\\r\\n\\r\\nimport \\\"@openzeppelin/contracts/utils/cryptography/SignatureChecker.sol\\\";\\r\\nimport \\\"@openzeppelin/contracts/utils/cryptography/ECDSA.sol\\\";\\r\\n\\r\\nimport \\\"@uma/core/contracts/common/implementation/Testable.sol\\\";\\r\\nimport \\\"@uma/core/contracts/common/implementation/Lockable.sol\\\";\\r\\nimport \\\"@uma/core/contracts/common/implementation/MultiCaller.sol\\\";\\r\\nimport \\\"./MerkleLib.sol\\\";\\r\\nimport \\\"./SpokePoolInterface.sol\\\";\\r\\n\\r\\n/**\\r\\n * @title SpokePool\\r\\n * @notice Contract deployed on source and destination chains enabling depositors to transfer assets from source to\\r\\n * destination. Deposit orders are fulfilled by off-chain relayers who also interact with this contract. Deposited\\r\\n * tokens are locked on the source chain and relayers send the recipient the desired token currency and amount\\r\\n * on the destination chain. Locked source chain tokens are later sent over the canonical token bridge to L1.\\r\\n * @dev This contract is designed to be deployed to L2's, not mainnet.\\r\\n */\\r\\nabstract contract SpokePool is SpokePoolInterface, Testable, Lockable, MultiCaller {\\r\\n using SafeERC20 for IERC20;\\r\\n using Address for address;\\r\\n\\r\\n // Address of the L1 contract that acts as the owner of this SpokePool.\\r\\n address public crossDomainAdmin;\\r\\n\\r\\n // Address of the L1 contract that will send tokens to and receive tokens from this contract.\\r\\n address public hubPool;\\r\\n\\r\\n // Address of WETH contract for this network. If an origin token matches this, then the caller can optionally\\r\\n // instruct this contract to wrap ETH when depositing.\\r\\n WETH9 public weth;\\r\\n\\r\\n // Timestamp when contract was constructed. Relays cannot have a quote time before this.\\r\\n uint32 public deploymentTime;\\r\\n\\r\\n // Any deposit quote times greater than or less than this value to the current contract time is blocked. Forces\\r\\n // caller to use an up to date realized fee. Defaults to 10 minutes.\\r\\n uint32 public depositQuoteTimeBuffer = 600;\\r\\n\\r\\n // Use count of deposits as unique deposit identifier.\\r\\n uint32 public numberOfDeposits;\\r\\n\\r\\n // Origin token to destination token routings can be turned on or off.\\r\\n mapping(address => mapping(uint256 => bool)) public enabledDepositRoutes;\\r\\n\\r\\n struct RootBundle {\\r\\n // Merkle root of slow relays that were not fully filled and whose recipient is still owed funds from the LP pool.\\r\\n bytes32 slowRelayFulfillmentRoot;\\r\\n // Merkle root of relayer refunds.\\r\\n bytes32 relayerRefundRoot;\\r\\n // This is a 2D bitmap tracking which leafs in the relayer refund root have been claimed, with max size of\\r\\n // 256x256 leaves per root.\\r\\n mapping(uint256 => uint256) claimedBitmap;\\r\\n }\\r\\n RootBundle[] public rootBundles;\\r\\n\\r\\n // Each relay is associated with the hash of parameters that uniquely identify the original deposit and a relay\\r\\n // attempt for that deposit. The relay itself is just represented as the amount filled so far. The total amount to\\r\\n // relay, the fees, and the agents are all parameters included in the hash key.\\r\\n mapping(bytes32 => uint256) public relayFills;\\r\\n\\r\\n /****************************************\\r\\n * EVENTS *\\r\\n ****************************************/\\r\\n event SetXDomainAdmin(address indexed newAdmin);\\r\\n event SetHubPool(address indexed newHubPool);\\r\\n event EnabledDepositRoute(address indexed originToken, uint256 indexed destinationChainId, bool enabled);\\r\\n event SetDepositQuoteTimeBuffer(uint32 newBuffer);\\r\\n event FundsDeposited(\\r\\n uint256 amount,\\r\\n uint256 destinationChainId,\\r\\n uint64 relayerFeePct,\\r\\n uint32 indexed depositId,\\r\\n uint32 quoteTimestamp,\\r\\n address indexed originToken,\\r\\n address recipient,\\r\\n address indexed depositor\\r\\n );\\r\\n event FilledRelay(\\r\\n bytes32 indexed relayHash,\\r\\n uint256 totalRelayAmount,\\r\\n uint256 totalFilledAmount,\\r\\n uint256 fillAmount,\\r\\n uint256 indexed repaymentChain,\\r\\n uint256 originChainId,\\r\\n uint64 relayerFeePct,\\r\\n uint64 realizedLpFeePct,\\r\\n uint32 depositId,\\r\\n address destinationToken,\\r\\n address indexed relayer,\\r\\n address depositor,\\r\\n address recipient\\r\\n );\\r\\n event ExecutedSlowRelayFulfillmentRoot(\\r\\n bytes32 indexed relayHash,\\r\\n uint256 totalRelayAmount,\\r\\n uint256 totalFilledAmount,\\r\\n uint256 fillAmount,\\r\\n uint256 originChainId,\\r\\n uint64 relayerFeePct,\\r\\n uint64 realizedLpFeePct,\\r\\n uint32 depositId,\\r\\n address destinationToken,\\r\\n address indexed caller,\\r\\n address depositor,\\r\\n address recipient\\r\\n );\\r\\n event RelayedRootBundle(uint32 indexed rootBundleId, bytes32 relayerRefundRoot, bytes32 slowRelayFulfillmentRoot);\\r\\n event ExecutedRelayerRefundRoot(\\r\\n uint256 amountToReturn,\\r\\n uint256 chainId,\\r\\n uint256[] refundAmounts,\\r\\n uint32 indexed rootBundleId,\\r\\n uint32 indexed leafId,\\r\\n address l2TokenAddress,\\r\\n address[] refundAddresses,\\r\\n address indexed caller\\r\\n );\\r\\n event TokensBridged(\\r\\n uint256 amountToReturn,\\r\\n uint256 indexed chainId,\\r\\n uint32 indexed leafId,\\r\\n address indexed l2TokenAddress,\\r\\n address caller\\r\\n );\\r\\n\\r\\n constructor(\\r\\n address _crossDomainAdmin,\\r\\n address _hubPool,\\r\\n address _wethAddress,\\r\\n address timerAddress\\r\\n ) Testable(timerAddress) {\\r\\n _setCrossDomainAdmin(_crossDomainAdmin);\\r\\n _setHubPool(_hubPool);\\r\\n deploymentTime = uint32(getCurrentTime());\\r\\n weth = WETH9(_wethAddress);\\r\\n }\\r\\n\\r\\n /****************************************\\r\\n * MODIFIERS *\\r\\n ****************************************/\\r\\n\\r\\n modifier onlyEnabledRoute(address originToken, uint256 destinationId) {\\r\\n require(enabledDepositRoutes[originToken][destinationId], \\\"Disabled route\\\");\\r\\n _;\\r\\n }\\r\\n\\r\\n /**************************************\\r\\n * ADMIN FUNCTIONS *\\r\\n **************************************/\\r\\n\\r\\n function _setCrossDomainAdmin(address newCrossDomainAdmin) internal {\\r\\n require(newCrossDomainAdmin != address(0), \\\"Bad bridge router address\\\");\\r\\n crossDomainAdmin = newCrossDomainAdmin;\\r\\n emit SetXDomainAdmin(crossDomainAdmin);\\r\\n }\\r\\n\\r\\n function _setHubPool(address newHubPool) internal {\\r\\n require(newHubPool != address(0), \\\"Bad hub pool address\\\");\\r\\n hubPool = newHubPool;\\r\\n emit SetHubPool(hubPool);\\r\\n }\\r\\n\\r\\n function _setEnableRoute(\\r\\n address originToken,\\r\\n uint256 destinationChainId,\\r\\n bool enabled\\r\\n ) internal {\\r\\n enabledDepositRoutes[originToken][destinationChainId] = enabled;\\r\\n emit EnabledDepositRoute(originToken, destinationChainId, enabled);\\r\\n }\\r\\n\\r\\n function _setDepositQuoteTimeBuffer(uint32 _depositQuoteTimeBuffer) internal {\\r\\n depositQuoteTimeBuffer = _depositQuoteTimeBuffer;\\r\\n emit SetDepositQuoteTimeBuffer(_depositQuoteTimeBuffer);\\r\\n }\\r\\n\\r\\n /**************************************\\r\\n * DEPOSITOR FUNCTIONS *\\r\\n **************************************/\\r\\n\\r\\n /**\\r\\n * @notice Called by user to bridge funds from origin to destination chain.\\r\\n * @dev The caller must first approve this contract to spend `amount` of `originToken`.\\r\\n */\\r\\n function deposit(\\r\\n address recipient,\\r\\n address originToken,\\r\\n uint256 amount,\\r\\n uint256 destinationChainId,\\r\\n uint64 relayerFeePct,\\r\\n uint32 quoteTimestamp\\r\\n ) public payable onlyEnabledRoute(originToken, destinationChainId) nonReentrant {\\r\\n // We limit the relay fees to prevent the user spending all their funds on fees.\\r\\n require(relayerFeePct <= 0.5e18, \\\"invalid relayer fee\\\");\\r\\n // Note We assume that L2 timing cannot be compared accurately and consistently to L1 timing. Therefore,\\r\\n // `block.timestamp` is different from the L1 EVM's. Therefore, the quoteTimestamp must be within a configurable\\r\\n // buffer to allow for this variance.\\r\\n // Note also that `quoteTimestamp` cannot be less than the buffer otherwise the following arithmetic can result\\r\\n // in underflow. This isn't a problem as the deposit will revert, but the error might be unexpected for clients.\\r\\n require(\\r\\n getCurrentTime() >= quoteTimestamp - depositQuoteTimeBuffer &&\\r\\n getCurrentTime() <= quoteTimestamp + depositQuoteTimeBuffer,\\r\\n \\\"invalid quote time\\\"\\r\\n );\\r\\n // If the address of the origin token is a WETH contract and there is a msg.value with the transaction\\r\\n // then the user is sending ETH. In this case, the ETH should be deposited to WETH.\\r\\n if (originToken == address(weth) && msg.value > 0) {\\r\\n require(msg.value == amount, \\\"msg.value must match amount\\\");\\r\\n weth.deposit{ value: msg.value }();\\r\\n } else {\\r\\n // Else, it is a normal ERC20. In this case pull the token from the users wallet as per normal.\\r\\n // Note: this includes the case where the L2 user has WETH (already wrapped ETH) and wants to bridge them. In\\r\\n // this case the msg.value will be set to 0, indicating a \\\"normal\\\" ERC20 bridging action.\\r\\n IERC20(originToken).safeTransferFrom(msg.sender, address(this), amount);\\r\\n }\\r\\n\\r\\n emit FundsDeposited(\\r\\n amount,\\r\\n destinationChainId,\\r\\n relayerFeePct,\\r\\n numberOfDeposits,\\r\\n quoteTimestamp,\\r\\n originToken,\\r\\n recipient,\\r\\n msg.sender\\r\\n );\\r\\n\\r\\n numberOfDeposits += 1;\\r\\n }\\r\\n\\r\\n /**************************************\\r\\n * RELAYER FUNCTIONS *\\r\\n **************************************/\\r\\n\\r\\n function fillRelay(\\r\\n address depositor,\\r\\n address recipient,\\r\\n address destinationToken,\\r\\n uint256 totalRelayAmount,\\r\\n uint256 maxTokensToSend,\\r\\n uint256 repaymentChain,\\r\\n uint256 originChainId,\\r\\n uint64 realizedLpFeePct,\\r\\n uint64 relayerFeePct,\\r\\n uint32 depositId\\r\\n ) public nonReentrant {\\r\\n // Each relay attempt is mapped to the hash of data uniquely identifying it, which includes the deposit data\\r\\n // such as the origin chain ID and the deposit ID, and the data in a relay attempt such as who the recipient\\r\\n // is, which chain and currency the recipient wants to receive funds on, and the relay fees.\\r\\n SpokePoolInterface.RelayData memory relayData = SpokePoolInterface.RelayData({\\r\\n depositor: depositor,\\r\\n recipient: recipient,\\r\\n destinationToken: destinationToken,\\r\\n relayAmount: totalRelayAmount,\\r\\n realizedLpFeePct: realizedLpFeePct,\\r\\n relayerFeePct: relayerFeePct,\\r\\n depositId: depositId,\\r\\n originChainId: originChainId\\r\\n });\\r\\n bytes32 relayHash = _getRelayHash(relayData);\\r\\n\\r\\n uint256 fillAmountPreFees = _fillRelay(relayHash, relayData, maxTokensToSend, relayerFeePct, false);\\r\\n\\r\\n _emitFillRelay(relayHash, fillAmountPreFees, repaymentChain, relayerFeePct, relayData);\\r\\n }\\r\\n\\r\\n function fillRelayWithUpdatedFee(\\r\\n address depositor,\\r\\n address recipient,\\r\\n address destinationToken,\\r\\n uint256 totalRelayAmount,\\r\\n uint256 maxTokensToSend,\\r\\n uint256 repaymentChain,\\r\\n uint256 originChainId,\\r\\n uint64 realizedLpFeePct,\\r\\n uint64 relayerFeePct,\\r\\n uint64 newRelayerFeePct,\\r\\n uint32 depositId,\\r\\n bytes memory depositorSignature\\r\\n ) public nonReentrant {\\r\\n // Grouping the signature validation logic into brackets to address stack too deep error.\\r\\n {\\r\\n // Depositor should have signed a hash of the relayer fee % to update to and information uniquely identifying\\r\\n // the deposit to relay. This ensures that this signature cannot be re-used for other deposits. The version\\r\\n // string is included as a precaution in case this contract is upgraded.\\r\\n // Note: we use encode instead of encodePacked because it is more secure, more in the \\\"warning\\\" section\\r\\n // here: https://docs.soliditylang.org/en/v0.8.11/abi-spec.html#non-standard-packed-mode\\r\\n bytes32 expectedDepositorMessageHash = keccak256(\\r\\n abi.encode(\\\"ACROSS-V2-FEE-1.0\\\", newRelayerFeePct, depositId, originChainId)\\r\\n );\\r\\n\\r\\n // Check the hash corresponding to the https://eth.wiki/json-rpc/API#eth_sign[`eth_sign`]\\r\\n // JSON-RPC method as part of EIP-191. We use OZ's signature checker library with adds support for\\r\\n // EIP-1271 which can verify messages signed by smart contract wallets like Argent and Gnosis safes.\\r\\n // If the depositor signed a message with a different updated fee (or any other param included in the\\r\\n // above keccak156 hash), then this will revert.\\r\\n bytes32 ethSignedMessageHash = ECDSA.toEthSignedMessageHash(expectedDepositorMessageHash);\\r\\n\\r\\n _verifyDepositorUpdateFeeMessage(depositor, ethSignedMessageHash, depositorSignature);\\r\\n }\\r\\n\\r\\n // Now follow the default `fillRelay` flow with the updated fee and the original relay hash.\\r\\n RelayData memory relayData = RelayData({\\r\\n depositor: depositor,\\r\\n recipient: recipient,\\r\\n destinationToken: destinationToken,\\r\\n relayAmount: totalRelayAmount,\\r\\n realizedLpFeePct: realizedLpFeePct,\\r\\n relayerFeePct: relayerFeePct,\\r\\n depositId: depositId,\\r\\n originChainId: originChainId\\r\\n });\\r\\n bytes32 relayHash = _getRelayHash(relayData);\\r\\n uint256 fillAmountPreFees = _fillRelay(relayHash, relayData, maxTokensToSend, newRelayerFeePct, false);\\r\\n\\r\\n _emitFillRelay(relayHash, fillAmountPreFees, repaymentChain, newRelayerFeePct, relayData);\\r\\n }\\r\\n\\r\\n /**************************************\\r\\n * DATA WORKER FUNCTIONS *\\r\\n **************************************/\\r\\n function executeSlowRelayFulfillmentRoot(\\r\\n address depositor,\\r\\n address recipient,\\r\\n address destinationToken,\\r\\n uint256 totalRelayAmount,\\r\\n uint256 originChainId,\\r\\n uint64 realizedLpFeePct,\\r\\n uint64 relayerFeePct,\\r\\n uint32 depositId,\\r\\n uint32 rootBundleId,\\r\\n bytes32[] memory proof\\r\\n ) public nonReentrant {\\r\\n RelayData memory relayData = RelayData({\\r\\n depositor: depositor,\\r\\n recipient: recipient,\\r\\n destinationToken: destinationToken,\\r\\n relayAmount: totalRelayAmount,\\r\\n originChainId: originChainId,\\r\\n realizedLpFeePct: realizedLpFeePct,\\r\\n relayerFeePct: relayerFeePct,\\r\\n depositId: depositId\\r\\n });\\r\\n\\r\\n require(\\r\\n MerkleLib.verifySlowRelayFulfillment(rootBundles[rootBundleId].slowRelayFulfillmentRoot, relayData, proof),\\r\\n \\\"Invalid proof\\\"\\r\\n );\\r\\n\\r\\n bytes32 relayHash = _getRelayHash(relayData);\\r\\n\\r\\n // Wrap any ETH owned by this contract so we can send expected L2 token to recipient. This is neccessary because\\r\\n // some SpokePools will receive ETH from the canonical token bridge instead of WETH so this contract\\r\\n // might have built up an ETH balance.\\r\\n if (address(this).balance > 0) weth.deposit{ value: address(this).balance }();\\r\\n\\r\\n // Note: use relayAmount as the max amount to send, so the relay is always completely filled by the contract's\\r\\n // funds in all cases.\\r\\n uint256 fillAmountPreFees = _fillRelay(relayHash, relayData, relayData.relayAmount, relayerFeePct, true);\\r\\n\\r\\n _emitExecutedSlowRelayFulfillmentRoot(relayHash, fillAmountPreFees, relayData);\\r\\n }\\r\\n\\r\\n function executeRelayerRefundRoot(\\r\\n uint32 rootBundleId,\\r\\n SpokePoolInterface.RelayerRefundLeaf memory relayerRefundLeaf,\\r\\n bytes32[] memory proof\\r\\n ) public nonReentrant {\\r\\n // Check integrity of leaf structure:\\r\\n require(relayerRefundLeaf.chainId == chainId(), \\\"Invalid chainId\\\");\\r\\n require(relayerRefundLeaf.refundAddresses.length == relayerRefundLeaf.refundAmounts.length, \\\"invalid leaf\\\");\\r\\n\\r\\n RootBundle storage rootBundle = rootBundles[rootBundleId];\\r\\n\\r\\n // Check that `inclusionProof` proves that `relayerRefundLeaf` is contained within the relayer refund root.\\r\\n // Note: This should revert if the `relayerRefundRoot` is uninitialized.\\r\\n require(MerkleLib.verifyRelayerRefund(rootBundle.relayerRefundRoot, relayerRefundLeaf, proof), \\\"Bad Proof\\\");\\r\\n\\r\\n // Verify the leafId in the leaf has not yet been claimed.\\r\\n require(!MerkleLib.isClaimed(rootBundle.claimedBitmap, relayerRefundLeaf.leafId), \\\"Already claimed\\\");\\r\\n\\r\\n // Set leaf as claimed in bitmap.\\r\\n MerkleLib.setClaimed(rootBundle.claimedBitmap, relayerRefundLeaf.leafId);\\r\\n\\r\\n // Wrap any ETH owned by this contract so we can send expected L2 token to recipient. This is neccessary because\\r\\n // some SpokePools will receive ETH from the canonical token bridge instead of WETH.\\r\\n if (address(this).balance > 0) weth.deposit{ value: address(this).balance }();\\r\\n\\r\\n // Send each relayer refund address the associated refundAmount for the L2 token address.\\r\\n // Note: Even if the L2 token is not enabled on this spoke pool, we should still refund relayers.\\r\\n for (uint32 i = 0; i < relayerRefundLeaf.refundAmounts.length; i++) {\\r\\n uint256 amount = relayerRefundLeaf.refundAmounts[i];\\r\\n if (amount > 0)\\r\\n IERC20(relayerRefundLeaf.l2TokenAddress).safeTransfer(relayerRefundLeaf.refundAddresses[i], amount);\\r\\n }\\r\\n\\r\\n // If leaf's `amountToReturn` is positive, then send L2 --> L1 message to bridge tokens back via\\r\\n // chain-specific bridging method.\\r\\n if (relayerRefundLeaf.amountToReturn > 0) {\\r\\n _bridgeTokensToHubPool(relayerRefundLeaf);\\r\\n\\r\\n emit TokensBridged(\\r\\n relayerRefundLeaf.amountToReturn,\\r\\n relayerRefundLeaf.chainId,\\r\\n relayerRefundLeaf.leafId,\\r\\n relayerRefundLeaf.l2TokenAddress,\\r\\n msg.sender\\r\\n );\\r\\n }\\r\\n\\r\\n emit ExecutedRelayerRefundRoot(\\r\\n relayerRefundLeaf.amountToReturn,\\r\\n relayerRefundLeaf.chainId,\\r\\n relayerRefundLeaf.refundAmounts,\\r\\n rootBundleId,\\r\\n relayerRefundLeaf.leafId,\\r\\n relayerRefundLeaf.l2TokenAddress,\\r\\n relayerRefundLeaf.refundAddresses,\\r\\n msg.sender\\r\\n );\\r\\n }\\r\\n\\r\\n /**************************************\\r\\n * VIEW FUNCTIONS *\\r\\n **************************************/\\r\\n\\r\\n // Some L2s like ZKSync don't support the CHAIN_ID opcode so we allow the caller to manually set this.\\r\\n function chainId() public view virtual returns (uint256) {\\r\\n return block.chainid;\\r\\n }\\r\\n\\r\\n /**************************************\\r\\n * INTERNAL FUNCTIONS *\\r\\n **************************************/\\r\\n\\r\\n function _bridgeTokensToHubPool(SpokePoolInterface.RelayerRefundLeaf memory relayerRefundLeaf) internal virtual;\\r\\n\\r\\n // Allow L2 to implement chain specific recovering of signers from signatures because some L2s might not support\\r\\n // ecrecover, such as those with account abstraction like ZKSync.\\r\\n function _verifyDepositorUpdateFeeMessage(\\r\\n address depositor,\\r\\n bytes32 ethSignedMessageHash,\\r\\n bytes memory depositorSignature\\r\\n ) internal view virtual {\\r\\n // Note: no need to worry about reentrancy from contract deployed at `depositor` address since\\r\\n // `SignatureChecker.isValidSignatureNow` is a non state-modifying STATICCALL:\\r\\n // - https://github.com/OpenZeppelin/openzeppelin-contracts/blob/63b466901fb015538913f811c5112a2775042177/contracts/utils/cryptography/SignatureChecker.sol#L35\\r\\n // - https://github.com/ethereum/EIPs/pull/214\\r\\n require(\\r\\n SignatureChecker.isValidSignatureNow(depositor, ethSignedMessageHash, depositorSignature),\\r\\n \\\"invalid signature\\\"\\r\\n );\\r\\n }\\r\\n\\r\\n function _computeAmountPreFees(uint256 amount, uint64 feesPct) private pure returns (uint256) {\\r\\n return (1e18 * amount) / (1e18 - feesPct);\\r\\n }\\r\\n\\r\\n function _computeAmountPostFees(uint256 amount, uint64 feesPct) private pure returns (uint256) {\\r\\n return (amount * (1e18 - feesPct)) / 1e18;\\r\\n }\\r\\n\\r\\n // Should we make this public for the relayer's convenience?\\r\\n function _getRelayHash(SpokePoolInterface.RelayData memory relayData) private pure returns (bytes32) {\\r\\n return keccak256(abi.encode(relayData));\\r\\n }\\r\\n\\r\\n // Unwraps ETH and does a transfer to a recipient address. If the recipient is a smart contract then sends WETH.\\r\\n function _unwrapWETHTo(address payable to, uint256 amount) internal {\\r\\n if (address(to).isContract()) {\\r\\n IERC20(address(weth)).safeTransfer(to, amount);\\r\\n } else {\\r\\n weth.withdraw(amount);\\r\\n to.transfer(amount);\\r\\n }\\r\\n }\\r\\n\\r\\n // This internal method should be called by an external \\\"relayRootBundle\\\" function that validates the\\r\\n // cross domain sender is the HubPool. This validation step differs for each L2, which is why the implementation\\r\\n // specifics are left to the implementor of this abstract contract.\\r\\n // Once this method is executed and a distribution root is stored in this contract, then `distributeRootBundle`\\r\\n // can be called to execute each leaf in the root.\\r\\n function _relayRootBundle(bytes32 relayerRefundRoot, bytes32 slowRelayFulfillmentRoot) internal {\\r\\n uint32 rootBundleId = uint32(rootBundles.length);\\r\\n RootBundle storage rootBundle = rootBundles.push();\\r\\n rootBundle.relayerRefundRoot = relayerRefundRoot;\\r\\n rootBundle.slowRelayFulfillmentRoot = slowRelayFulfillmentRoot;\\r\\n emit RelayedRootBundle(rootBundleId, relayerRefundRoot, slowRelayFulfillmentRoot);\\r\\n }\\r\\n\\r\\n function _fillRelay(\\r\\n bytes32 relayHash,\\r\\n RelayData memory relayData,\\r\\n uint256 maxTokensToSend,\\r\\n uint64 updatableRelayerFeePct,\\r\\n bool isSlowRelay\\r\\n ) internal returns (uint256 fillAmountPreFees) {\\r\\n // We limit the relay fees to prevent the user spending all their funds on fees. Note that 0.5e18 (i.e. 50%)\\r\\n // fees are just magic numbers. The important point is to prevent the total fee from being 100%, otherwise\\r\\n // computing the amount pre fees runs into divide-by-0 issues.\\r\\n require(updatableRelayerFeePct < 0.5e18 && relayData.realizedLpFeePct < 0.5e18, \\\"invalid fees\\\");\\r\\n\\r\\n // Check that the relay has not already been completely filled. Note that the `relays` mapping will point to\\r\\n // the amount filled so far for a particular `relayHash`, so this will start at 0 and increment with each fill.\\r\\n require(relayFills[relayHash] < relayData.relayAmount, \\\"relay filled\\\");\\r\\n\\r\\n // Stores the equivalent amount to be sent by the relayer before fees have been taken out.\\r\\n fillAmountPreFees = 0;\\r\\n\\r\\n // Adding brackets \\\"stack too deep\\\" solidity error.\\r\\n if (maxTokensToSend > 0) {\\r\\n fillAmountPreFees = _computeAmountPreFees(\\r\\n maxTokensToSend,\\r\\n (relayData.realizedLpFeePct + updatableRelayerFeePct)\\r\\n );\\r\\n // If user's specified max amount to send is greater than the amount of the relay remaining pre-fees,\\r\\n // we'll pull exactly enough tokens to complete the relay.\\r\\n uint256 amountToSend = maxTokensToSend;\\r\\n if (relayData.relayAmount - relayFills[relayHash] < fillAmountPreFees) {\\r\\n fillAmountPreFees = relayData.relayAmount - relayFills[relayHash];\\r\\n amountToSend = _computeAmountPostFees(\\r\\n fillAmountPreFees,\\r\\n relayData.realizedLpFeePct + updatableRelayerFeePct\\r\\n );\\r\\n }\\r\\n relayFills[relayHash] += fillAmountPreFees;\\r\\n // If relay token is weth then unwrap and send eth.\\r\\n if (relayData.destinationToken == address(weth)) {\\r\\n // Note: WETH is already in the contract in the slow relay case.\\r\\n if (!isSlowRelay)\\r\\n IERC20(relayData.destinationToken).safeTransferFrom(msg.sender, address(this), amountToSend);\\r\\n _unwrapWETHTo(payable(relayData.recipient), amountToSend);\\r\\n // Else, this is a normal ERC20 token. Send to recipient.\\r\\n } else {\\r\\n // Note: send token directly from the contract to the user in the slow relay case.\\r\\n if (!isSlowRelay)\\r\\n IERC20(relayData.destinationToken).safeTransferFrom(msg.sender, relayData.recipient, amountToSend);\\r\\n else IERC20(relayData.destinationToken).safeTransfer(relayData.recipient, amountToSend);\\r\\n }\\r\\n }\\r\\n }\\r\\n\\r\\n function _emitFillRelay(\\r\\n bytes32 relayHash,\\r\\n uint256 fillAmount,\\r\\n uint256 repaymentChain,\\r\\n uint64 relayerFeePct,\\r\\n RelayData memory relayData\\r\\n ) internal {\\r\\n emit FilledRelay(\\r\\n relayHash,\\r\\n relayData.relayAmount,\\r\\n relayFills[relayHash],\\r\\n fillAmount,\\r\\n repaymentChain,\\r\\n relayData.originChainId,\\r\\n relayerFeePct,\\r\\n relayData.realizedLpFeePct,\\r\\n relayData.depositId,\\r\\n relayData.destinationToken,\\r\\n msg.sender,\\r\\n relayData.depositor,\\r\\n relayData.recipient\\r\\n );\\r\\n }\\r\\n\\r\\n function _emitExecutedSlowRelayFulfillmentRoot(\\r\\n bytes32 relayHash,\\r\\n uint256 fillAmount,\\r\\n RelayData memory relayData\\r\\n ) internal {\\r\\n emit ExecutedSlowRelayFulfillmentRoot(\\r\\n relayHash,\\r\\n relayData.relayAmount,\\r\\n relayFills[relayHash],\\r\\n fillAmount,\\r\\n relayData.originChainId,\\r\\n relayData.relayerFeePct,\\r\\n relayData.realizedLpFeePct,\\r\\n relayData.depositId,\\r\\n relayData.destinationToken,\\r\\n msg.sender,\\r\\n relayData.depositor,\\r\\n relayData.recipient\\r\\n );\\r\\n }\\r\\n\\r\\n // Added to enable the this contract to receive ETH. Used when unwrapping Weth.\\r\\n receive() external payable {}\\r\\n}\\r\\n\",\"keccak256\":\"0x43a82c41c699f74aafaff2f7a8ad3e32e06ffcd78c38e179c503aa4eaa40d53a\",\"license\":\"GPL-3.0-only\"},\"contracts/SpokePoolInterface.sol\":{\"content\":\"//SPDX-License-Identifier: Unlicense\\r\\npragma solidity ^0.8.0;\\r\\n\\r\\ninterface SpokePoolInterface {\\r\\n // This leaf is meant to be decoded in the SpokePool in order to pay out individual relayers for this bundle.\\r\\n struct RelayerRefundLeaf {\\r\\n // This is the amount to return to the HubPool. This occurs when there is a PoolRebalanceLeaf netSendAmount that is\\r\\n // negative. This is just that value inverted.\\r\\n uint256 amountToReturn;\\r\\n // Used to verify that this is being decoded on the correct chainId.\\r\\n uint256 chainId;\\r\\n // This array designates how much each of those addresses should be refunded.\\r\\n uint256[] refundAmounts;\\r\\n // Used as the index in the bitmap to track whether this leaf has been executed or not.\\r\\n uint32 leafId;\\r\\n // The associated L2TokenAddress that these claims apply to.\\r\\n address l2TokenAddress;\\r\\n // These two arrays must be the same length and are parallel arrays. They should be order by refundAddresses.\\r\\n // This array designates each address that must be refunded.\\r\\n address[] refundAddresses;\\r\\n }\\r\\n\\r\\n // This struct represents the data to fully-specify a relay. If any portion of this data differs, the relay is\\r\\n // considered to be completely distinct. Only one relay for a particular depositId, chainId pair should be\\r\\n // considered valid and repaid.\\r\\n struct RelayData {\\r\\n // The address that made the deposit on the origin chain.\\r\\n address depositor;\\r\\n // The recipient address on the destination chain.\\r\\n address recipient;\\r\\n // The corresponding token address on the destination chain.\\r\\n address destinationToken;\\r\\n // The total relay amount before fees are taken out.\\r\\n uint256 relayAmount;\\r\\n // Origin chain id.\\r\\n uint256 originChainId;\\r\\n // The LP Fee percentage computed by the relayer based on the deposit's quote timestamp\\r\\n // and the HubPool's utilization.\\r\\n uint64 realizedLpFeePct;\\r\\n // The relayer fee percentage specified in the deposit.\\r\\n uint64 relayerFeePct;\\r\\n // The id uniquely identifying this deposit on the origin chain.\\r\\n uint32 depositId;\\r\\n }\\r\\n\\r\\n function setCrossDomainAdmin(address newCrossDomainAdmin) external;\\r\\n\\r\\n function setHubPool(address newHubPool) external;\\r\\n\\r\\n function setEnableRoute(\\r\\n address originToken,\\r\\n uint256 destinationChainId,\\r\\n bool enable\\r\\n ) external;\\r\\n\\r\\n function setDepositQuoteTimeBuffer(uint32 buffer) external;\\r\\n\\r\\n function relayRootBundle(bytes32 relayerRefundRoot, bytes32 slowRelayRoot) external;\\r\\n}\\r\\n\",\"keccak256\":\"0xa420a9b5431195ecead66166fe4b316a0a1e86ad26514cdc6ace529e8941cf4d\",\"license\":\"Unlicense\"},\"contracts/interfaces/AdapterInterface.sol\":{\"content\":\"// SPDX-License-Identifier: AGPL-3.0-only\\npragma solidity ^0.8.0;\\n\\n/**\\n * @notice Sends cross chain messages and tokens to contracts on a specific L2 network.\\n */\\n\\ninterface AdapterInterface {\\n event HubPoolChanged(address newHubPool);\\n\\n event MessageRelayed(address target, bytes message);\\n\\n event TokensRelayed(address l1Token, address l2Token, uint256 amount, address to);\\n\\n function relayMessage(address target, bytes memory message) external payable;\\n\\n function relayTokens(\\n address l1Token,\\n address l2Token,\\n uint256 amount,\\n address to\\n ) external payable;\\n}\\n\",\"keccak256\":\"0x60e1ed2205f90655fe4152a90709be15bc9550fb3faeaf9835fee22c095bab11\",\"license\":\"AGPL-3.0-only\"},\"contracts/interfaces/WETH9.sol\":{\"content\":\"// SPDX-License-Identifier: GPL-3.0-only\\r\\npragma solidity ^0.8.0;\\r\\n\\r\\ninterface WETH9 {\\r\\n function withdraw(uint256 wad) external;\\r\\n\\r\\n function deposit() external payable;\\r\\n\\r\\n function balanceOf(address guy) external view returns (uint256 wad);\\r\\n\\r\\n function transfer(address guy, uint256 wad) external;\\r\\n}\\r\\n\",\"keccak256\":\"0x08755a7e4fc4ed75895c9b803f19552c4f0a455947dca04d86db4355114253b3\",\"license\":\"GPL-3.0-only\"}},\"version\":1}", - "bytecode": "0x60806040526003805463ffffffff60c01b1916604b60c31b1790553480156200002757600080fd5b5060405162004695380380620046958339810160408190526200004a916200033b565b600080546001600160a81b0319166001600160a01b03831617600160a01b179055838383836200007a84620000ef565b620000858362000195565b6200008f62000237565b600380546001600160a01b039094166001600160a01b031963ffffffff93909316600160a01b02929092166001600160c01b0319909416939093171790915550620000e59150620000df90503390565b620002cc565b50505050620003b2565b6001600160a01b0381166200014b5760405162461bcd60e51b815260206004820152601960248201527f4261642062726964676520726f7574657220616464726573730000000000000060448201526064015b60405180910390fd5b600180546001600160a01b0319166001600160a01b0383169081179091556040517fa9e8c42c9e7fca7f62755189a16b2f5314d43d8fb24e91ba54e6d65f9314e84990600090a250565b6001600160a01b038116620001ed5760405162461bcd60e51b815260206004820152601460248201527f4261642068756220706f6f6c2061646472657373000000000000000000000000604482015260640162000142565b600280546001600160a01b0319166001600160a01b0383169081179091556040517f1f17a88f67b0f49060a34bec1a4723a563620e6aa265eb640b5046dcee0759a090600090a250565b600080546001600160a01b031615620002c75760008054906101000a90046001600160a01b03166001600160a01b03166329cb924d6040518163ffffffff1660e01b8152600401602060405180830381865afa1580156200029c573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190620002c2919062000398565b905090565b504290565b600780546001600160a01b038381166001600160a01b0319831681179093556040519116919082907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e090600090a35050565b80516001600160a01b03811681146200033657600080fd5b919050565b600080600080608085870312156200035257600080fd5b6200035d856200031e565b93506200036d602086016200031e565b92506200037d604086016200031e565b91506200038d606086016200031e565b905092959194509250565b600060208284031215620003ab57600080fd5b5051919050565b6142d380620003c26000396000f3fe6080604052600436106101b05760003560e01c806389a153cc116100ec578063e19044021161008a578063f06850f611610064578063f06850f614610585578063f2fde38b146105b2578063fe45399c146105d2578063ffc351a3146105f257600080fd5b8063e1904402146104ee578063ecda10f51461051b578063ee2a53f81461055057600080fd5b8063a1244c67116100c6578063a1244c6714610451578063ac9650d81461048e578063c894c0ca146104ae578063de7eba78146104ce57600080fd5b806389a153cc146103f35780638da5cb5b146104135780639a8a05921461043e57600080fd5b80633fc8cef3116101595780635249fef1116101335780635249fef1146103185780635285e0581461036357806357f6dcb814610390578063715018a6146103de57600080fd5b80633fc8cef3146102b857806349228978146102e5578063493a4f84146102f857600080fd5b8063272751c71161018a578063272751c7146102555780632752042e1461027557806329cb924d1461029557600080fd5b80631c39c38d146101bc5780631dfb2d021461021357806322f8e5661461023557600080fd5b366101b757005b600080fd5b3480156101c857600080fd5b506000546101e99073ffffffffffffffffffffffffffffffffffffffff1681565b60405173ffffffffffffffffffffffffffffffffffffffff90911681526020015b60405180910390f35b34801561021f57600080fd5b5061023361022e366004613473565b610612565b005b34801561024157600080fd5b5061023361025036600461348e565b61071d565b34801561026157600080fd5b506102336102703660046134b5565b6107c6565b34801561028157600080fd5b50610233610290366004613509565b6108d0565b3480156102a157600080fd5b506102aa61098f565b60405190815260200161020a565b3480156102c457600080fd5b506003546101e99073ffffffffffffffffffffffffffffffffffffffff1681565b6102336102f336600461353c565b610a47565b34801561030457600080fd5b506102336103133660046135a2565b610ef3565b34801561032457600080fd5b506103536103333660046135c4565b600460209081526000928352604080842090915290825290205460ff1681565b604051901515815260200161020a565b34801561036f57600080fd5b506001546101e99073ffffffffffffffffffffffffffffffffffffffff1681565b34801561039c57600080fd5b506003546103c9907801000000000000000000000000000000000000000000000000900463ffffffff1681565b60405163ffffffff909116815260200161020a565b3480156103ea57600080fd5b50610233610ffb565b3480156103ff57600080fd5b5061023361040e3660046135ee565b611088565b34801561041f57600080fd5b5060075473ffffffffffffffffffffffffffffffffffffffff166101e9565b34801561044a57600080fd5b50466102aa565b34801561045d57600080fd5b506003546103c9907c0100000000000000000000000000000000000000000000000000000000900463ffffffff1681565b6104a161049c36600461368c565b6111d6565b60405161020a9190613777565b3480156104ba57600080fd5b506102336104c936600461398f565b6113b0565b3480156104da57600080fd5b506102336104e9366004613473565b61188a565b3480156104fa57600080fd5b506002546101e99073ffffffffffffffffffffffffffffffffffffffff1681565b34801561052757600080fd5b506003546103c99074010000000000000000000000000000000000000000900463ffffffff1681565b34801561055c57600080fd5b5061057061056b36600461348e565b611949565b6040805192835260208301919091520161020a565b34801561059157600080fd5b506102aa6105a036600461348e565b60066020526000908152604090205481565b3480156105be57600080fd5b506102336105cd366004613473565b611977565b3480156105de57600080fd5b506102336105ed366004613a8b565b611aa4565b3480156105fe57600080fd5b5061023361060d366004613be9565b611cc6565b60075473ffffffffffffffffffffffffffffffffffffffff163314610698576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657260448201526064015b60405180910390fd5b6106a0611eac565b6106cd600080547fffffffffffffffffffffff00ffffffffffffffffffffffffffffffffffffffff169055565b6106d681611f30565b61071a600080547fffffffffffffffffffffff00ffffffffffffffffffffffffffffffffffffffff1674010000000000000000000000000000000000000000179055565b50565b60005473ffffffffffffffffffffffffffffffffffffffff1661073f57600080fd5b6000546040517f22f8e5660000000000000000000000000000000000000000000000000000000081526004810183905273ffffffffffffffffffffffffffffffffffffffff909116906322f8e56690602401600060405180830381600087803b1580156107ab57600080fd5b505af11580156107bf573d6000803e3d6000fd5b5050505050565b60075473ffffffffffffffffffffffffffffffffffffffff163314610847576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604482015260640161068f565b61084f611eac565b61087c600080547fffffffffffffffffffffff00ffffffffffffffffffffffffffffffffffffffff169055565b61088783838361201c565b6108cb600080547fffffffffffffffffffffff00ffffffffffffffffffffffffffffffffffffffff1674010000000000000000000000000000000000000000179055565b505050565b60075473ffffffffffffffffffffffffffffffffffffffff163314610951576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604482015260640161068f565b610959611eac565b610986600080547fffffffffffffffffffffff00ffffffffffffffffffffffffffffffffffffffff169055565b6106d6816120b3565b6000805473ffffffffffffffffffffffffffffffffffffffff1615610a425760008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166329cb924d6040518163ffffffff1660e01b8152600401602060405180830381865afa158015610a19573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610a3d9190613cc7565b905090565b504290565b73ffffffffffffffffffffffffffffffffffffffff851660009081526004602090815260408083208684529091529020548590849060ff16610ae5576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152600e60248201527f44697361626c656420726f757465000000000000000000000000000000000000604482015260640161068f565b610aed611eac565b610b1a600080547fffffffffffffffffffffff00ffffffffffffffffffffffffffffffffffffffff169055565b6706f05b59d3b200008467ffffffffffffffff161115610b96576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601360248201527f696e76616c69642072656c617965722066656500000000000000000000000000604482015260640161068f565b600354610bc5907801000000000000000000000000000000000000000000000000900463ffffffff1684613d0f565b63ffffffff16610bd361098f565b10158015610c1c5750600354610c0b907801000000000000000000000000000000000000000000000000900463ffffffff1684613d34565b63ffffffff16610c1961098f565b11155b610c82576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601260248201527f696e76616c69642071756f74652074696d650000000000000000000000000000604482015260640161068f565b60035473ffffffffffffffffffffffffffffffffffffffff8881169116148015610cac5750600034115b15610da257853414610d1a576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601b60248201527f6d73672e76616c7565206d757374206d6174636820616d6f756e740000000000604482015260640161068f565b600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663d0e30db0346040518263ffffffff1660e01b81526004016000604051808303818588803b158015610d8457600080fd5b505af1158015610d98573d6000803e3d6000fd5b5050505050610dc4565b610dc473ffffffffffffffffffffffffffffffffffffffff881633308961213a565b600354604080518881526020810188905267ffffffffffffffff87168183015263ffffffff868116606083015273ffffffffffffffffffffffffffffffffffffffff8c8116608084015292513394938c16937c01000000000000000000000000000000000000000000000000000000009004909116917ffc53c5b967d467d4136291c639720626f3d6dda97b4364da813e6858ad48a721919081900360a00190a460016003601c8282829054906101000a900463ffffffff16610e879190613d34565b92506101000a81548163ffffffff021916908363ffffffff160217905550610ee9600080547fffffffffffffffffffffff00ffffffffffffffffffffffffffffffffffffffff1674010000000000000000000000000000000000000000179055565b5050505050505050565b60075473ffffffffffffffffffffffffffffffffffffffff163314610f74576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604482015260640161068f565b610f7c611eac565b610fa9600080547fffffffffffffffffffffff00ffffffffffffffffffffffffffffffffffffffff169055565b610fb3828261221c565b610ff7600080547fffffffffffffffffffffff00ffffffffffffffffffffffffffffffffffffffff1674010000000000000000000000000000000000000000179055565b5050565b60075473ffffffffffffffffffffffffffffffffffffffff16331461107c576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604482015260640161068f565b61108660006122c2565b565b611090611eac565b6110bd600080547fffffffffffffffffffffff00ffffffffffffffffffffffffffffffffffffffff169055565b60006040518061010001604052808c73ffffffffffffffffffffffffffffffffffffffff1681526020018b73ffffffffffffffffffffffffffffffffffffffff1681526020018a73ffffffffffffffffffffffffffffffffffffffff1681526020018981526020018681526020018567ffffffffffffffff1681526020018467ffffffffffffffff1681526020018363ffffffff168152509050600061116282612339565b9050600061117482848b886000612369565b905061118382828a888761260c565b5050506111ca600080547fffffffffffffffffffffff00ffffffffffffffffffffffffffffffffffffffff1674010000000000000000000000000000000000000000179055565b50505050505050505050565b60603415611240576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601b60248201527f4f6e6c79206d756c746963616c6c207769746820302076616c75650000000000604482015260640161068f565b8167ffffffffffffffff811115611259576112596137f7565b60405190808252806020026020018201604052801561128c57816020015b60608152602001906001900390816112775790505b50905060005b828110156113a957600080308686858181106112b0576112b0613d5c565b90506020028101906112c29190613d8b565b6040516112d0929190613df0565b600060405180830381855af49150503d806000811461130b576040519150601f19603f3d011682016040523d82523d6000602084013e611310565b606091505b5091509150816113765760448151101561132957600080fd5b600481019050808060200190518101906113439190613e00565b6040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161068f9190613e6e565b8084848151811061138957611389613d5c565b6020026020010181905250505080806113a190613e81565b915050611292565b5092915050565b6113b8611eac565b6113e5600080547fffffffffffffffffffffff00ffffffffffffffffffffffffffffffffffffffff169055565b46826020015114611452576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152600f60248201527f496e76616c696420636861696e49640000000000000000000000000000000000604482015260640161068f565b8160400151518260a0015151146114c5576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152600c60248201527f696e76616c6964206c6561660000000000000000000000000000000000000000604482015260640161068f565b600060058463ffffffff16815481106114e0576114e0613d5c565b906000526020600020906003020190506114ff81600101548484612711565b611565576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152600960248201527f4261642050726f6f660000000000000000000000000000000000000000000000604482015260640161068f565b61157c81600201846060015163ffffffff1661274e565b156115e3576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152600f60248201527f416c726561647920636c61696d65640000000000000000000000000000000000604482015260640161068f565b6115fa81600201846060015163ffffffff1661278f565b471561168457600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663d0e30db0476040518263ffffffff1660e01b81526004016000604051808303818588803b15801561166a57600080fd5b505af115801561167e573d6000803e3d6000fd5b50505050505b60005b8360400151518163ffffffff16101561173057600084604001518263ffffffff16815181106116b8576116b8613d5c565b60200260200101519050600081111561171d5761171d8560a001518363ffffffff16815181106116ea576116ea613d5c565b602002602001015182876080015173ffffffffffffffffffffffffffffffffffffffff166127cd9092919063ffffffff16565b508061172881613eba565b915050611687565b508251156117c95761174183612823565b826080015173ffffffffffffffffffffffffffffffffffffffff16836060015163ffffffff1684602001517f828fc203220356df8f072a91681caee7d5c75095e2a95e80ed5a14b384697f718660000151336040516117c092919091825273ffffffffffffffffffffffffffffffffffffffff16602082015260400190565b60405180910390a45b3373ffffffffffffffffffffffffffffffffffffffff16836060015163ffffffff168563ffffffff167ff8bd640004bcec1b89657020f561d0b070cbdf662d0b158db9dccb0a8301bfab86600001518760200151886040015189608001518a60a0015160405161183d959493929190613f5f565b60405180910390a4506108cb600080547fffffffffffffffffffffff00ffffffffffffffffffffffffffffffffffffffff1674010000000000000000000000000000000000000000179055565b60075473ffffffffffffffffffffffffffffffffffffffff16331461190b576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604482015260640161068f565b611913611eac565b611940600080547fffffffffffffffffffffff00ffffffffffffffffffffffffffffffffffffffff169055565b6106d6816128c7565b6005818154811061195957600080fd5b60009182526020909120600390910201805460019091015490915082565b60075473ffffffffffffffffffffffffffffffffffffffff1633146119f8576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604482015260640161068f565b73ffffffffffffffffffffffffffffffffffffffff8116611a9b576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201527f6464726573730000000000000000000000000000000000000000000000000000606482015260840161068f565b61071a816122c2565b611aac611eac565b611ad9600080547fffffffffffffffffffffff00ffffffffffffffffffffffffffffffffffffffff169055565b60006040518061010001604052808c73ffffffffffffffffffffffffffffffffffffffff1681526020018b73ffffffffffffffffffffffffffffffffffffffff1681526020018a73ffffffffffffffffffffffffffffffffffffffff1681526020018981526020018881526020018767ffffffffffffffff1681526020018667ffffffffffffffff1681526020018563ffffffff168152509050611ba860058463ffffffff1681548110611b8f57611b8f613d5c565b90600052602060002090600302016000015482846129b3565b611c0e576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152600d60248201527f496e76616c69642070726f6f6600000000000000000000000000000000000000604482015260640161068f565b6000611c1982612339565b90504715611ca557600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663d0e30db0476040518263ffffffff1660e01b81526004016000604051808303818588803b158015611c8b57600080fd5b505af1158015611c9f573d6000803e3d6000fd5b50505050505b6000611cb9828485606001518a6001612369565b90506111838282856129cb565b611cce611eac565b611cfb600080547fffffffffffffffffffffff00ffffffffffffffffffffffffffffffffffffffff169055565b60408051608060208201819052601160a08301527f4143524f53532d56322d4645452d312e3000000000000000000000000000000060c083015267ffffffffffffffff86169282019290925263ffffffff8416606082015290810187905260009060e0016040516020818303038152906040528051906020012090506000611d8282612ac4565b9050611d8f8e8285612aff565b505060006040518061010001604052808e73ffffffffffffffffffffffffffffffffffffffff1681526020018d73ffffffffffffffffffffffffffffffffffffffff1681526020018c73ffffffffffffffffffffffffffffffffffffffff1681526020018b81526020018881526020018767ffffffffffffffff1681526020018667ffffffffffffffff1681526020018463ffffffff1681525090506000611e3682612339565b90506000611e4882848d896000612369565b9050611e5782828c898761260c565b505050611e9e600080547fffffffffffffffffffffff00ffffffffffffffffffffffffffffffffffffffff1674010000000000000000000000000000000000000000179055565b505050505050505050505050565b60005474010000000000000000000000000000000000000000900460ff16611086576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601f60248201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c00604482015260640161068f565b73ffffffffffffffffffffffffffffffffffffffff8116611fad576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601460248201527f4261642068756220706f6f6c2061646472657373000000000000000000000000604482015260640161068f565b600280547fffffffffffffffffffffffff00000000000000000000000000000000000000001673ffffffffffffffffffffffffffffffffffffffff83169081179091556040517f1f17a88f67b0f49060a34bec1a4723a563620e6aa265eb640b5046dcee0759a090600090a250565b73ffffffffffffffffffffffffffffffffffffffff8316600081815260046020908152604080832086845282529182902080547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff001685151590811790915591519182528492917f0a21fdd43d0ad0c62689ee7230a47309a050755bcc52eba00310add65297692a91015b60405180910390a3505050565b600380547fffffffff00000000ffffffffffffffffffffffffffffffffffffffffffffffff16780100000000000000000000000000000000000000000000000063ffffffff8416908102919091179091556040519081527f0e55dd180fa793d9036c804d0a116e6a7617a48e72cee1f83d92793a793fcc039060200160405180910390a150565b60405173ffffffffffffffffffffffffffffffffffffffff808516602483015283166044820152606481018290526122169085907f23b872dd00000000000000000000000000000000000000000000000000000000906084015b604080517fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe08184030181529190526020810180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff167fffffffff0000000000000000000000000000000000000000000000000000000090931692909217909152612b70565b50505050565b60058054600181018255600091909152600381027f036b6384b5eca791c62761152d0c79bb0604c104a5fb6f4eb0703f3154bb3db181018490557f036b6384b5eca791c62761152d0c79bb0604c104a5fb6f4eb0703f3154bb3db001828155604080518581526020810185905263ffffffff8416917fc86ba04c55bc5eb2f2876b91c438849a296dbec7b08751c3074d92e04f0a77af910160405180910390a250505050565b6007805473ffffffffffffffffffffffffffffffffffffffff8381167fffffffffffffffffffffffff0000000000000000000000000000000000000000831681179093556040519116919082907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e090600090a35050565b60008160405160200161234c9190613fac565b604051602081830303815290604052805190602001209050919050565b60006706f05b59d3b200008367ffffffffffffffff161080156123a157506706f05b59d3b200008560a0015167ffffffffffffffff16105b612407576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152600c60248201527f696e76616c696420666565730000000000000000000000000000000000000000604482015260640161068f565b606085015160008781526006602052604090205410612482576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152600c60248201527f72656c61792066696c6c65640000000000000000000000000000000000000000604482015260640161068f565b5060008315612603576124a484848760a0015161249f9190614038565b612c7c565b6000878152600660205260409020546060870151919250859183916124c89161405b565b101561250a5760008781526006602052604090205460608701516124ec919061405b565b915061250782858860a001516125029190614038565b612cb6565b90505b60008781526006602052604081208054849290612528908490614072565b9091555050600354604087015173ffffffffffffffffffffffffffffffffffffffff9081169116141561259457826125815760408601516125819073ffffffffffffffffffffffffffffffffffffffff1633308461213a565b61258f866020015182612cdf565b612601565b826125ce5761258f33876020015183896040015173ffffffffffffffffffffffffffffffffffffffff1661213a909392919063ffffffff16565b612601866020015182886040015173ffffffffffffffffffffffffffffffffffffffff166127cd9092919063ffffffff16565b505b95945050505050565b3373ffffffffffffffffffffffffffffffffffffffff1683867f393f1765f382b5310a9186fa707a84040f8241b280a30b74112689a92a156f698460600151600660008b815260200190815260200160002054898760800151898960a001518a60e001518b604001518c600001518d602001516040516127029a99989796959493929190998a5260208a01989098526040890196909652606088019490945267ffffffffffffffff9283166080880152911660a086015263ffffffff1660c085015273ffffffffffffffffffffffffffffffffffffffff90811660e0850152908116610100840152166101208201526101400190565b60405180910390a45050505050565b6000612744828585604051602001612729919061408a565b60405160208183030381529060405280519060200120612de7565b90505b9392505050565b60008061275d61010084614154565b9050600061276d61010085614168565b6000928352602095909552506040902054600190931b92831690921492915050565b600061279d61010083614154565b905060006127ad61010084614168565b600092835260209490945250604090208054600190931b90921790915550565b60405173ffffffffffffffffffffffffffffffffffffffff83166024820152604481018290526108cb9084907fa9059cbb0000000000000000000000000000000000000000000000000000000090606401612194565b608081015160025482516040517fa9059cbb00000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff9283166004820152602481019190915291169063a9059cbb906044016020604051808303816000875af11580156128a3573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610ff7919061417c565b73ffffffffffffffffffffffffffffffffffffffff8116612944576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601960248201527f4261642062726964676520726f75746572206164647265737300000000000000604482015260640161068f565b600180547fffffffffffffffffffffffff00000000000000000000000000000000000000001673ffffffffffffffffffffffffffffffffffffffff83169081179091556040517fa9e8c42c9e7fca7f62755189a16b2f5314d43d8fb24e91ba54e6d65f9314e84990600090a250565b60006127448285856040516020016127299190613fac565b3373ffffffffffffffffffffffffffffffffffffffff16837fc1c02fe71abee2530563583daac3d7b681ef4c00db95adc3847b886da8098bc1836060015160066000888152602001908152602001600020548686608001518760c001518860a001518960e001518a604001518b600001518c602001516040516120a69a99989796959493929190998a5260208a01989098526040890196909652606088019490945267ffffffffffffffff9283166080880152911660a086015263ffffffff1660c085015273ffffffffffffffffffffffffffffffffffffffff90811660e0850152908116610100840152166101208201526101400190565b6040517f19457468657265756d205369676e6564204d6573736167653a0a3332000000006020820152603c8101829052600090605c0161234c565b612b0a838383612dfd565b6108cb576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601160248201527f696e76616c6964207369676e6174757265000000000000000000000000000000604482015260640161068f565b6000612bd2826040518060400160405280602081526020017f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c65648152508573ffffffffffffffffffffffffffffffffffffffff16612fec9092919063ffffffff16565b8051909150156108cb5780806020019051810190612bf0919061417c565b6108cb576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602a60248201527f5361666545524332303a204552433230206f7065726174696f6e20646964206e60448201527f6f74207375636365656400000000000000000000000000000000000000000000606482015260840161068f565b6000612c9082670de0b6b3a7640000614199565b67ffffffffffffffff16612cac84670de0b6b3a76400006141ba565b6127479190614154565b6000670de0b6b3a7640000612ccb8382614199565b612cac9067ffffffffffffffff16856141ba565b73ffffffffffffffffffffffffffffffffffffffff82163b15612d2057600354610ff79073ffffffffffffffffffffffffffffffffffffffff1683836127cd565b6003546040517f2e1a7d4d0000000000000000000000000000000000000000000000000000000081526004810183905273ffffffffffffffffffffffffffffffffffffffff90911690632e1a7d4d90602401600060405180830381600087803b158015612d8c57600080fd5b505af1158015612da0573d6000803e3d6000fd5b505060405173ffffffffffffffffffffffffffffffffffffffff8516925083156108fc02915083906000818181858888f193505050501580156108cb573d6000803e3d6000fd5b600082612df48584612ffb565b14949350505050565b6000806000612e0c85856130a7565b90925090506000816004811115612e2557612e256141f7565b148015612e5d57508573ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff16145b15612e6d57600192505050612747565b6000808773ffffffffffffffffffffffffffffffffffffffff16631626ba7e60e01b8888604051602401612ea2929190614226565b604080517fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe08184030181529181526020820180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff167fffffffff00000000000000000000000000000000000000000000000000000000909416939093179092529051612f2b919061423f565b600060405180830381855afa9150503d8060008114612f66576040519150601f19603f3d011682016040523d82523d6000602084013e612f6b565b606091505b5091509150818015612f7e575080516020145b8015612fe0575080517f1626ba7e0000000000000000000000000000000000000000000000000000000090612fbc908301602090810190840161425b565b7fffffffff0000000000000000000000000000000000000000000000000000000016145b98975050505050505050565b60606127448484600085613117565b600081815b845181101561309f57600085828151811061301d5761301d613d5c565b6020026020010151905080831161305f57604080516020810185905290810182905260600160405160208183030381529060405280519060200120925061308c565b60408051602081018390529081018490526060016040516020818303038152906040528051906020012092505b508061309781613e81565b915050613000565b509392505050565b6000808251604114156130de5760208301516040840151606085015160001a6130d287828585613297565b94509450505050613110565b82516040141561310857602083015160408401516130fd8683836133af565b935093505050613110565b506000905060025b9250929050565b6060824710156131a9576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602660248201527f416464726573733a20696e73756666696369656e742062616c616e636520666f60448201527f722063616c6c0000000000000000000000000000000000000000000000000000606482015260840161068f565b843b613211576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e7472616374000000604482015260640161068f565b6000808673ffffffffffffffffffffffffffffffffffffffff16858760405161323a919061423f565b60006040518083038185875af1925050503d8060008114613277576040519150601f19603f3d011682016040523d82523d6000602084013e61327c565b606091505b509150915061328c8282866133f7565b979650505050505050565b6000807f7fffffffffffffffffffffffffffffff5d576e7357a4501ddfe92f46681b20a08311156132ce57506000905060036133a6565b8460ff16601b141580156132e657508460ff16601c14155b156132f757506000905060046133a6565b6040805160008082526020820180845289905260ff881692820192909252606081018690526080810185905260019060a0016020604051602081039080840390855afa15801561334b573d6000803e3d6000fd5b50506040517fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0015191505073ffffffffffffffffffffffffffffffffffffffff811661339f576000600192509250506133a6565b9150600090505b94509492505050565b6000807f7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff831660ff84901c601b016133e987828885613297565b935093505050935093915050565b60608315613406575081612747565b8251156134165782518084602001fd5b816040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161068f9190613e6e565b803573ffffffffffffffffffffffffffffffffffffffff8116811461346e57600080fd5b919050565b60006020828403121561348557600080fd5b6127478261344a565b6000602082840312156134a057600080fd5b5035919050565b801515811461071a57600080fd5b6000806000606084860312156134ca57600080fd5b6134d38461344a565b92506020840135915060408401356134ea816134a7565b809150509250925092565b803563ffffffff8116811461346e57600080fd5b60006020828403121561351b57600080fd5b612747826134f5565b803567ffffffffffffffff8116811461346e57600080fd5b60008060008060008060c0878903121561355557600080fd5b61355e8761344a565b955061356c6020880161344a565b9450604087013593506060870135925061358860808801613524565b915061359660a088016134f5565b90509295509295509295565b600080604083850312156135b557600080fd5b50508035926020909101359150565b600080604083850312156135d757600080fd5b6135e08361344a565b946020939093013593505050565b6000806000806000806000806000806101408b8d03121561360e57600080fd5b6136178b61344a565b995061362560208c0161344a565b985061363360408c0161344a565b975060608b0135965060808b0135955060a08b0135945060c08b0135935061365d60e08c01613524565b925061366c6101008c01613524565b915061367b6101208c016134f5565b90509295989b9194979a5092959850565b6000806020838503121561369f57600080fd5b823567ffffffffffffffff808211156136b757600080fd5b818501915085601f8301126136cb57600080fd5b8135818111156136da57600080fd5b8660208260051b85010111156136ef57600080fd5b60209290920196919550909350505050565b60005b8381101561371c578181015183820152602001613704565b838111156122165750506000910152565b60008151808452613745816020860160208601613701565b601f017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0169290920160200192915050565b6000602080830181845280855180835260408601915060408160051b870101925083870160005b828110156137ea577fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc08886030184526137d885835161372d565b9450928501929085019060010161379e565b5092979650505050505050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b60405160c0810167ffffffffffffffff81118282101715613849576138496137f7565b60405290565b604051601f82017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe016810167ffffffffffffffff81118282101715613896576138966137f7565b604052919050565b600067ffffffffffffffff8211156138b8576138b86137f7565b5060051b60200190565b600082601f8301126138d357600080fd5b813560206138e86138e38361389e565b61384f565b82815260059290921b8401810191818101908684111561390757600080fd5b8286015b84811015613922578035835291830191830161390b565b509695505050505050565b600082601f83011261393e57600080fd5b8135602061394e6138e38361389e565b82815260059290921b8401810191818101908684111561396d57600080fd5b8286015b84811015613922576139828161344a565b8352918301918301613971565b6000806000606084860312156139a457600080fd5b6139ad846134f5565b9250602084013567ffffffffffffffff808211156139ca57600080fd5b9085019060c082880312156139de57600080fd5b6139e6613826565b8235815260208301356020820152604083013582811115613a0657600080fd5b613a12898286016138c2565b604083015250613a24606084016134f5565b6060820152613a356080840161344a565b608082015260a083013582811115613a4c57600080fd5b613a588982860161392d565b60a08301525093506040860135915080821115613a7457600080fd5b50613a81868287016138c2565b9150509250925092565b6000806000806000806000806000806101408b8d031215613aab57600080fd5b613ab48b61344a565b9950613ac260208c0161344a565b9850613ad060408c0161344a565b975060608b0135965060808b01359550613aec60a08c01613524565b9450613afa60c08c01613524565b9350613b0860e08c016134f5565b9250613b176101008c016134f5565b91506101208b013567ffffffffffffffff811115613b3457600080fd5b613b408d828e016138c2565b9150509295989b9194979a5092959850565b600067ffffffffffffffff821115613b6c57613b6c6137f7565b50601f017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe01660200190565b600082601f830112613ba957600080fd5b8135613bb76138e382613b52565b818152846020838601011115613bcc57600080fd5b816020850160208301376000918101602001919091529392505050565b6000806000806000806000806000806000806101808d8f031215613c0c57600080fd5b613c158d61344a565b9b50613c2360208e0161344a565b9a50613c3160408e0161344a565b995060608d0135985060808d0135975060a08d0135965060c08d01359550613c5b60e08e01613524565b9450613c6a6101008e01613524565b9350613c796101208e01613524565b9250613c886101408e016134f5565b915067ffffffffffffffff6101608e01351115613ca457600080fd5b613cb58e6101608f01358f01613b98565b90509295989b509295989b509295989b565b600060208284031215613cd957600080fd5b5051919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b600063ffffffff83811690831681811015613d2c57613d2c613ce0565b039392505050565b600063ffffffff808316818516808303821115613d5357613d53613ce0565b01949350505050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b60008083357fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe1843603018112613dc057600080fd5b83018035915067ffffffffffffffff821115613ddb57600080fd5b60200191503681900382131561311057600080fd5b8183823760009101908152919050565b600060208284031215613e1257600080fd5b815167ffffffffffffffff811115613e2957600080fd5b8201601f81018413613e3a57600080fd5b8051613e486138e382613b52565b818152856020838501011115613e5d57600080fd5b612603826020830160208601613701565b602081526000612747602083018461372d565b60007fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff821415613eb357613eb3613ce0565b5060010190565b600063ffffffff80831681811415613ed457613ed4613ce0565b6001019392505050565b600081518084526020808501945080840160005b83811015613f0e57815187529582019590820190600101613ef2565b509495945050505050565b600081518084526020808501945080840160005b83811015613f0e57815173ffffffffffffffffffffffffffffffffffffffff1687529582019590820190600101613f2d565b85815284602082015260a060408201526000613f7e60a0830186613ede565b73ffffffffffffffffffffffffffffffffffffffff851660608401528281036080840152612fe08185613f19565b60006101008201905073ffffffffffffffffffffffffffffffffffffffff80845116835280602085015116602084015280604085015116604084015250606083015160608301526080830151608083015260a083015167ffffffffffffffff80821660a08501528060c08601511660c0850152505060e08301516113a960e084018263ffffffff169052565b600067ffffffffffffffff808316818516808303821115613d5357613d53613ce0565b60008282101561406d5761406d613ce0565b500390565b6000821982111561408557614085613ce0565b500190565b6020815281516020820152602082015160408201526000604083015160c060608401526140ba60e0840182613ede565b905063ffffffff606085015116608084015273ffffffffffffffffffffffffffffffffffffffff60808501511660a084015260a08401517fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe08483030160c08501526126038282613f19565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601260045260246000fd5b60008261416357614163614125565b500490565b60008261417757614177614125565b500690565b60006020828403121561418e57600080fd5b8151612747816134a7565b600067ffffffffffffffff83811690831681811015613d2c57613d2c613ce0565b6000817fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff04831182151516156141f2576141f2613ce0565b500290565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052602160045260246000fd5b828152604060208201526000612744604083018461372d565b60008251614251818460208701613701565b9190910192915050565b60006020828403121561426d57600080fd5b81517fffffffff000000000000000000000000000000000000000000000000000000008116811461274757600080fdfea264697066735822122031217f7bdb9ad94347a2b7912e1467daed140345b839fd6819e85f6ed9bdd8a064736f6c634300080b0033", - "deployedBytecode": "0x6080604052600436106101b05760003560e01c806389a153cc116100ec578063e19044021161008a578063f06850f611610064578063f06850f614610585578063f2fde38b146105b2578063fe45399c146105d2578063ffc351a3146105f257600080fd5b8063e1904402146104ee578063ecda10f51461051b578063ee2a53f81461055057600080fd5b8063a1244c67116100c6578063a1244c6714610451578063ac9650d81461048e578063c894c0ca146104ae578063de7eba78146104ce57600080fd5b806389a153cc146103f35780638da5cb5b146104135780639a8a05921461043e57600080fd5b80633fc8cef3116101595780635249fef1116101335780635249fef1146103185780635285e0581461036357806357f6dcb814610390578063715018a6146103de57600080fd5b80633fc8cef3146102b857806349228978146102e5578063493a4f84146102f857600080fd5b8063272751c71161018a578063272751c7146102555780632752042e1461027557806329cb924d1461029557600080fd5b80631c39c38d146101bc5780631dfb2d021461021357806322f8e5661461023557600080fd5b366101b757005b600080fd5b3480156101c857600080fd5b506000546101e99073ffffffffffffffffffffffffffffffffffffffff1681565b60405173ffffffffffffffffffffffffffffffffffffffff90911681526020015b60405180910390f35b34801561021f57600080fd5b5061023361022e366004613473565b610612565b005b34801561024157600080fd5b5061023361025036600461348e565b61071d565b34801561026157600080fd5b506102336102703660046134b5565b6107c6565b34801561028157600080fd5b50610233610290366004613509565b6108d0565b3480156102a157600080fd5b506102aa61098f565b60405190815260200161020a565b3480156102c457600080fd5b506003546101e99073ffffffffffffffffffffffffffffffffffffffff1681565b6102336102f336600461353c565b610a47565b34801561030457600080fd5b506102336103133660046135a2565b610ef3565b34801561032457600080fd5b506103536103333660046135c4565b600460209081526000928352604080842090915290825290205460ff1681565b604051901515815260200161020a565b34801561036f57600080fd5b506001546101e99073ffffffffffffffffffffffffffffffffffffffff1681565b34801561039c57600080fd5b506003546103c9907801000000000000000000000000000000000000000000000000900463ffffffff1681565b60405163ffffffff909116815260200161020a565b3480156103ea57600080fd5b50610233610ffb565b3480156103ff57600080fd5b5061023361040e3660046135ee565b611088565b34801561041f57600080fd5b5060075473ffffffffffffffffffffffffffffffffffffffff166101e9565b34801561044a57600080fd5b50466102aa565b34801561045d57600080fd5b506003546103c9907c0100000000000000000000000000000000000000000000000000000000900463ffffffff1681565b6104a161049c36600461368c565b6111d6565b60405161020a9190613777565b3480156104ba57600080fd5b506102336104c936600461398f565b6113b0565b3480156104da57600080fd5b506102336104e9366004613473565b61188a565b3480156104fa57600080fd5b506002546101e99073ffffffffffffffffffffffffffffffffffffffff1681565b34801561052757600080fd5b506003546103c99074010000000000000000000000000000000000000000900463ffffffff1681565b34801561055c57600080fd5b5061057061056b36600461348e565b611949565b6040805192835260208301919091520161020a565b34801561059157600080fd5b506102aa6105a036600461348e565b60066020526000908152604090205481565b3480156105be57600080fd5b506102336105cd366004613473565b611977565b3480156105de57600080fd5b506102336105ed366004613a8b565b611aa4565b3480156105fe57600080fd5b5061023361060d366004613be9565b611cc6565b60075473ffffffffffffffffffffffffffffffffffffffff163314610698576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657260448201526064015b60405180910390fd5b6106a0611eac565b6106cd600080547fffffffffffffffffffffff00ffffffffffffffffffffffffffffffffffffffff169055565b6106d681611f30565b61071a600080547fffffffffffffffffffffff00ffffffffffffffffffffffffffffffffffffffff1674010000000000000000000000000000000000000000179055565b50565b60005473ffffffffffffffffffffffffffffffffffffffff1661073f57600080fd5b6000546040517f22f8e5660000000000000000000000000000000000000000000000000000000081526004810183905273ffffffffffffffffffffffffffffffffffffffff909116906322f8e56690602401600060405180830381600087803b1580156107ab57600080fd5b505af11580156107bf573d6000803e3d6000fd5b5050505050565b60075473ffffffffffffffffffffffffffffffffffffffff163314610847576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604482015260640161068f565b61084f611eac565b61087c600080547fffffffffffffffffffffff00ffffffffffffffffffffffffffffffffffffffff169055565b61088783838361201c565b6108cb600080547fffffffffffffffffffffff00ffffffffffffffffffffffffffffffffffffffff1674010000000000000000000000000000000000000000179055565b505050565b60075473ffffffffffffffffffffffffffffffffffffffff163314610951576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604482015260640161068f565b610959611eac565b610986600080547fffffffffffffffffffffff00ffffffffffffffffffffffffffffffffffffffff169055565b6106d6816120b3565b6000805473ffffffffffffffffffffffffffffffffffffffff1615610a425760008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166329cb924d6040518163ffffffff1660e01b8152600401602060405180830381865afa158015610a19573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610a3d9190613cc7565b905090565b504290565b73ffffffffffffffffffffffffffffffffffffffff851660009081526004602090815260408083208684529091529020548590849060ff16610ae5576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152600e60248201527f44697361626c656420726f757465000000000000000000000000000000000000604482015260640161068f565b610aed611eac565b610b1a600080547fffffffffffffffffffffff00ffffffffffffffffffffffffffffffffffffffff169055565b6706f05b59d3b200008467ffffffffffffffff161115610b96576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601360248201527f696e76616c69642072656c617965722066656500000000000000000000000000604482015260640161068f565b600354610bc5907801000000000000000000000000000000000000000000000000900463ffffffff1684613d0f565b63ffffffff16610bd361098f565b10158015610c1c5750600354610c0b907801000000000000000000000000000000000000000000000000900463ffffffff1684613d34565b63ffffffff16610c1961098f565b11155b610c82576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601260248201527f696e76616c69642071756f74652074696d650000000000000000000000000000604482015260640161068f565b60035473ffffffffffffffffffffffffffffffffffffffff8881169116148015610cac5750600034115b15610da257853414610d1a576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601b60248201527f6d73672e76616c7565206d757374206d6174636820616d6f756e740000000000604482015260640161068f565b600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663d0e30db0346040518263ffffffff1660e01b81526004016000604051808303818588803b158015610d8457600080fd5b505af1158015610d98573d6000803e3d6000fd5b5050505050610dc4565b610dc473ffffffffffffffffffffffffffffffffffffffff881633308961213a565b600354604080518881526020810188905267ffffffffffffffff87168183015263ffffffff868116606083015273ffffffffffffffffffffffffffffffffffffffff8c8116608084015292513394938c16937c01000000000000000000000000000000000000000000000000000000009004909116917ffc53c5b967d467d4136291c639720626f3d6dda97b4364da813e6858ad48a721919081900360a00190a460016003601c8282829054906101000a900463ffffffff16610e879190613d34565b92506101000a81548163ffffffff021916908363ffffffff160217905550610ee9600080547fffffffffffffffffffffff00ffffffffffffffffffffffffffffffffffffffff1674010000000000000000000000000000000000000000179055565b5050505050505050565b60075473ffffffffffffffffffffffffffffffffffffffff163314610f74576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604482015260640161068f565b610f7c611eac565b610fa9600080547fffffffffffffffffffffff00ffffffffffffffffffffffffffffffffffffffff169055565b610fb3828261221c565b610ff7600080547fffffffffffffffffffffff00ffffffffffffffffffffffffffffffffffffffff1674010000000000000000000000000000000000000000179055565b5050565b60075473ffffffffffffffffffffffffffffffffffffffff16331461107c576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604482015260640161068f565b61108660006122c2565b565b611090611eac565b6110bd600080547fffffffffffffffffffffff00ffffffffffffffffffffffffffffffffffffffff169055565b60006040518061010001604052808c73ffffffffffffffffffffffffffffffffffffffff1681526020018b73ffffffffffffffffffffffffffffffffffffffff1681526020018a73ffffffffffffffffffffffffffffffffffffffff1681526020018981526020018681526020018567ffffffffffffffff1681526020018467ffffffffffffffff1681526020018363ffffffff168152509050600061116282612339565b9050600061117482848b886000612369565b905061118382828a888761260c565b5050506111ca600080547fffffffffffffffffffffff00ffffffffffffffffffffffffffffffffffffffff1674010000000000000000000000000000000000000000179055565b50505050505050505050565b60603415611240576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601b60248201527f4f6e6c79206d756c746963616c6c207769746820302076616c75650000000000604482015260640161068f565b8167ffffffffffffffff811115611259576112596137f7565b60405190808252806020026020018201604052801561128c57816020015b60608152602001906001900390816112775790505b50905060005b828110156113a957600080308686858181106112b0576112b0613d5c565b90506020028101906112c29190613d8b565b6040516112d0929190613df0565b600060405180830381855af49150503d806000811461130b576040519150601f19603f3d011682016040523d82523d6000602084013e611310565b606091505b5091509150816113765760448151101561132957600080fd5b600481019050808060200190518101906113439190613e00565b6040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161068f9190613e6e565b8084848151811061138957611389613d5c565b6020026020010181905250505080806113a190613e81565b915050611292565b5092915050565b6113b8611eac565b6113e5600080547fffffffffffffffffffffff00ffffffffffffffffffffffffffffffffffffffff169055565b46826020015114611452576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152600f60248201527f496e76616c696420636861696e49640000000000000000000000000000000000604482015260640161068f565b8160400151518260a0015151146114c5576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152600c60248201527f696e76616c6964206c6561660000000000000000000000000000000000000000604482015260640161068f565b600060058463ffffffff16815481106114e0576114e0613d5c565b906000526020600020906003020190506114ff81600101548484612711565b611565576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152600960248201527f4261642050726f6f660000000000000000000000000000000000000000000000604482015260640161068f565b61157c81600201846060015163ffffffff1661274e565b156115e3576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152600f60248201527f416c726561647920636c61696d65640000000000000000000000000000000000604482015260640161068f565b6115fa81600201846060015163ffffffff1661278f565b471561168457600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663d0e30db0476040518263ffffffff1660e01b81526004016000604051808303818588803b15801561166a57600080fd5b505af115801561167e573d6000803e3d6000fd5b50505050505b60005b8360400151518163ffffffff16101561173057600084604001518263ffffffff16815181106116b8576116b8613d5c565b60200260200101519050600081111561171d5761171d8560a001518363ffffffff16815181106116ea576116ea613d5c565b602002602001015182876080015173ffffffffffffffffffffffffffffffffffffffff166127cd9092919063ffffffff16565b508061172881613eba565b915050611687565b508251156117c95761174183612823565b826080015173ffffffffffffffffffffffffffffffffffffffff16836060015163ffffffff1684602001517f828fc203220356df8f072a91681caee7d5c75095e2a95e80ed5a14b384697f718660000151336040516117c092919091825273ffffffffffffffffffffffffffffffffffffffff16602082015260400190565b60405180910390a45b3373ffffffffffffffffffffffffffffffffffffffff16836060015163ffffffff168563ffffffff167ff8bd640004bcec1b89657020f561d0b070cbdf662d0b158db9dccb0a8301bfab86600001518760200151886040015189608001518a60a0015160405161183d959493929190613f5f565b60405180910390a4506108cb600080547fffffffffffffffffffffff00ffffffffffffffffffffffffffffffffffffffff1674010000000000000000000000000000000000000000179055565b60075473ffffffffffffffffffffffffffffffffffffffff16331461190b576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604482015260640161068f565b611913611eac565b611940600080547fffffffffffffffffffffff00ffffffffffffffffffffffffffffffffffffffff169055565b6106d6816128c7565b6005818154811061195957600080fd5b60009182526020909120600390910201805460019091015490915082565b60075473ffffffffffffffffffffffffffffffffffffffff1633146119f8576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604482015260640161068f565b73ffffffffffffffffffffffffffffffffffffffff8116611a9b576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201527f6464726573730000000000000000000000000000000000000000000000000000606482015260840161068f565b61071a816122c2565b611aac611eac565b611ad9600080547fffffffffffffffffffffff00ffffffffffffffffffffffffffffffffffffffff169055565b60006040518061010001604052808c73ffffffffffffffffffffffffffffffffffffffff1681526020018b73ffffffffffffffffffffffffffffffffffffffff1681526020018a73ffffffffffffffffffffffffffffffffffffffff1681526020018981526020018881526020018767ffffffffffffffff1681526020018667ffffffffffffffff1681526020018563ffffffff168152509050611ba860058463ffffffff1681548110611b8f57611b8f613d5c565b90600052602060002090600302016000015482846129b3565b611c0e576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152600d60248201527f496e76616c69642070726f6f6600000000000000000000000000000000000000604482015260640161068f565b6000611c1982612339565b90504715611ca557600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663d0e30db0476040518263ffffffff1660e01b81526004016000604051808303818588803b158015611c8b57600080fd5b505af1158015611c9f573d6000803e3d6000fd5b50505050505b6000611cb9828485606001518a6001612369565b90506111838282856129cb565b611cce611eac565b611cfb600080547fffffffffffffffffffffff00ffffffffffffffffffffffffffffffffffffffff169055565b60408051608060208201819052601160a08301527f4143524f53532d56322d4645452d312e3000000000000000000000000000000060c083015267ffffffffffffffff86169282019290925263ffffffff8416606082015290810187905260009060e0016040516020818303038152906040528051906020012090506000611d8282612ac4565b9050611d8f8e8285612aff565b505060006040518061010001604052808e73ffffffffffffffffffffffffffffffffffffffff1681526020018d73ffffffffffffffffffffffffffffffffffffffff1681526020018c73ffffffffffffffffffffffffffffffffffffffff1681526020018b81526020018881526020018767ffffffffffffffff1681526020018667ffffffffffffffff1681526020018463ffffffff1681525090506000611e3682612339565b90506000611e4882848d896000612369565b9050611e5782828c898761260c565b505050611e9e600080547fffffffffffffffffffffff00ffffffffffffffffffffffffffffffffffffffff1674010000000000000000000000000000000000000000179055565b505050505050505050505050565b60005474010000000000000000000000000000000000000000900460ff16611086576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601f60248201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c00604482015260640161068f565b73ffffffffffffffffffffffffffffffffffffffff8116611fad576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601460248201527f4261642068756220706f6f6c2061646472657373000000000000000000000000604482015260640161068f565b600280547fffffffffffffffffffffffff00000000000000000000000000000000000000001673ffffffffffffffffffffffffffffffffffffffff83169081179091556040517f1f17a88f67b0f49060a34bec1a4723a563620e6aa265eb640b5046dcee0759a090600090a250565b73ffffffffffffffffffffffffffffffffffffffff8316600081815260046020908152604080832086845282529182902080547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff001685151590811790915591519182528492917f0a21fdd43d0ad0c62689ee7230a47309a050755bcc52eba00310add65297692a91015b60405180910390a3505050565b600380547fffffffff00000000ffffffffffffffffffffffffffffffffffffffffffffffff16780100000000000000000000000000000000000000000000000063ffffffff8416908102919091179091556040519081527f0e55dd180fa793d9036c804d0a116e6a7617a48e72cee1f83d92793a793fcc039060200160405180910390a150565b60405173ffffffffffffffffffffffffffffffffffffffff808516602483015283166044820152606481018290526122169085907f23b872dd00000000000000000000000000000000000000000000000000000000906084015b604080517fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe08184030181529190526020810180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff167fffffffff0000000000000000000000000000000000000000000000000000000090931692909217909152612b70565b50505050565b60058054600181018255600091909152600381027f036b6384b5eca791c62761152d0c79bb0604c104a5fb6f4eb0703f3154bb3db181018490557f036b6384b5eca791c62761152d0c79bb0604c104a5fb6f4eb0703f3154bb3db001828155604080518581526020810185905263ffffffff8416917fc86ba04c55bc5eb2f2876b91c438849a296dbec7b08751c3074d92e04f0a77af910160405180910390a250505050565b6007805473ffffffffffffffffffffffffffffffffffffffff8381167fffffffffffffffffffffffff0000000000000000000000000000000000000000831681179093556040519116919082907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e090600090a35050565b60008160405160200161234c9190613fac565b604051602081830303815290604052805190602001209050919050565b60006706f05b59d3b200008367ffffffffffffffff161080156123a157506706f05b59d3b200008560a0015167ffffffffffffffff16105b612407576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152600c60248201527f696e76616c696420666565730000000000000000000000000000000000000000604482015260640161068f565b606085015160008781526006602052604090205410612482576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152600c60248201527f72656c61792066696c6c65640000000000000000000000000000000000000000604482015260640161068f565b5060008315612603576124a484848760a0015161249f9190614038565b612c7c565b6000878152600660205260409020546060870151919250859183916124c89161405b565b101561250a5760008781526006602052604090205460608701516124ec919061405b565b915061250782858860a001516125029190614038565b612cb6565b90505b60008781526006602052604081208054849290612528908490614072565b9091555050600354604087015173ffffffffffffffffffffffffffffffffffffffff9081169116141561259457826125815760408601516125819073ffffffffffffffffffffffffffffffffffffffff1633308461213a565b61258f866020015182612cdf565b612601565b826125ce5761258f33876020015183896040015173ffffffffffffffffffffffffffffffffffffffff1661213a909392919063ffffffff16565b612601866020015182886040015173ffffffffffffffffffffffffffffffffffffffff166127cd9092919063ffffffff16565b505b95945050505050565b3373ffffffffffffffffffffffffffffffffffffffff1683867f393f1765f382b5310a9186fa707a84040f8241b280a30b74112689a92a156f698460600151600660008b815260200190815260200160002054898760800151898960a001518a60e001518b604001518c600001518d602001516040516127029a99989796959493929190998a5260208a01989098526040890196909652606088019490945267ffffffffffffffff9283166080880152911660a086015263ffffffff1660c085015273ffffffffffffffffffffffffffffffffffffffff90811660e0850152908116610100840152166101208201526101400190565b60405180910390a45050505050565b6000612744828585604051602001612729919061408a565b60405160208183030381529060405280519060200120612de7565b90505b9392505050565b60008061275d61010084614154565b9050600061276d61010085614168565b6000928352602095909552506040902054600190931b92831690921492915050565b600061279d61010083614154565b905060006127ad61010084614168565b600092835260209490945250604090208054600190931b90921790915550565b60405173ffffffffffffffffffffffffffffffffffffffff83166024820152604481018290526108cb9084907fa9059cbb0000000000000000000000000000000000000000000000000000000090606401612194565b608081015160025482516040517fa9059cbb00000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff9283166004820152602481019190915291169063a9059cbb906044016020604051808303816000875af11580156128a3573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610ff7919061417c565b73ffffffffffffffffffffffffffffffffffffffff8116612944576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601960248201527f4261642062726964676520726f75746572206164647265737300000000000000604482015260640161068f565b600180547fffffffffffffffffffffffff00000000000000000000000000000000000000001673ffffffffffffffffffffffffffffffffffffffff83169081179091556040517fa9e8c42c9e7fca7f62755189a16b2f5314d43d8fb24e91ba54e6d65f9314e84990600090a250565b60006127448285856040516020016127299190613fac565b3373ffffffffffffffffffffffffffffffffffffffff16837fc1c02fe71abee2530563583daac3d7b681ef4c00db95adc3847b886da8098bc1836060015160066000888152602001908152602001600020548686608001518760c001518860a001518960e001518a604001518b600001518c602001516040516120a69a99989796959493929190998a5260208a01989098526040890196909652606088019490945267ffffffffffffffff9283166080880152911660a086015263ffffffff1660c085015273ffffffffffffffffffffffffffffffffffffffff90811660e0850152908116610100840152166101208201526101400190565b6040517f19457468657265756d205369676e6564204d6573736167653a0a3332000000006020820152603c8101829052600090605c0161234c565b612b0a838383612dfd565b6108cb576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601160248201527f696e76616c6964207369676e6174757265000000000000000000000000000000604482015260640161068f565b6000612bd2826040518060400160405280602081526020017f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c65648152508573ffffffffffffffffffffffffffffffffffffffff16612fec9092919063ffffffff16565b8051909150156108cb5780806020019051810190612bf0919061417c565b6108cb576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602a60248201527f5361666545524332303a204552433230206f7065726174696f6e20646964206e60448201527f6f74207375636365656400000000000000000000000000000000000000000000606482015260840161068f565b6000612c9082670de0b6b3a7640000614199565b67ffffffffffffffff16612cac84670de0b6b3a76400006141ba565b6127479190614154565b6000670de0b6b3a7640000612ccb8382614199565b612cac9067ffffffffffffffff16856141ba565b73ffffffffffffffffffffffffffffffffffffffff82163b15612d2057600354610ff79073ffffffffffffffffffffffffffffffffffffffff1683836127cd565b6003546040517f2e1a7d4d0000000000000000000000000000000000000000000000000000000081526004810183905273ffffffffffffffffffffffffffffffffffffffff90911690632e1a7d4d90602401600060405180830381600087803b158015612d8c57600080fd5b505af1158015612da0573d6000803e3d6000fd5b505060405173ffffffffffffffffffffffffffffffffffffffff8516925083156108fc02915083906000818181858888f193505050501580156108cb573d6000803e3d6000fd5b600082612df48584612ffb565b14949350505050565b6000806000612e0c85856130a7565b90925090506000816004811115612e2557612e256141f7565b148015612e5d57508573ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff16145b15612e6d57600192505050612747565b6000808773ffffffffffffffffffffffffffffffffffffffff16631626ba7e60e01b8888604051602401612ea2929190614226565b604080517fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe08184030181529181526020820180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff167fffffffff00000000000000000000000000000000000000000000000000000000909416939093179092529051612f2b919061423f565b600060405180830381855afa9150503d8060008114612f66576040519150601f19603f3d011682016040523d82523d6000602084013e612f6b565b606091505b5091509150818015612f7e575080516020145b8015612fe0575080517f1626ba7e0000000000000000000000000000000000000000000000000000000090612fbc908301602090810190840161425b565b7fffffffff0000000000000000000000000000000000000000000000000000000016145b98975050505050505050565b60606127448484600085613117565b600081815b845181101561309f57600085828151811061301d5761301d613d5c565b6020026020010151905080831161305f57604080516020810185905290810182905260600160405160208183030381529060405280519060200120925061308c565b60408051602081018390529081018490526060016040516020818303038152906040528051906020012092505b508061309781613e81565b915050613000565b509392505050565b6000808251604114156130de5760208301516040840151606085015160001a6130d287828585613297565b94509450505050613110565b82516040141561310857602083015160408401516130fd8683836133af565b935093505050613110565b506000905060025b9250929050565b6060824710156131a9576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602660248201527f416464726573733a20696e73756666696369656e742062616c616e636520666f60448201527f722063616c6c0000000000000000000000000000000000000000000000000000606482015260840161068f565b843b613211576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e7472616374000000604482015260640161068f565b6000808673ffffffffffffffffffffffffffffffffffffffff16858760405161323a919061423f565b60006040518083038185875af1925050503d8060008114613277576040519150601f19603f3d011682016040523d82523d6000602084013e61327c565b606091505b509150915061328c8282866133f7565b979650505050505050565b6000807f7fffffffffffffffffffffffffffffff5d576e7357a4501ddfe92f46681b20a08311156132ce57506000905060036133a6565b8460ff16601b141580156132e657508460ff16601c14155b156132f757506000905060046133a6565b6040805160008082526020820180845289905260ff881692820192909252606081018690526080810185905260019060a0016020604051602081039080840390855afa15801561334b573d6000803e3d6000fd5b50506040517fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0015191505073ffffffffffffffffffffffffffffffffffffffff811661339f576000600192509250506133a6565b9150600090505b94509492505050565b6000807f7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff831660ff84901c601b016133e987828885613297565b935093505050935093915050565b60608315613406575081612747565b8251156134165782518084602001fd5b816040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161068f9190613e6e565b803573ffffffffffffffffffffffffffffffffffffffff8116811461346e57600080fd5b919050565b60006020828403121561348557600080fd5b6127478261344a565b6000602082840312156134a057600080fd5b5035919050565b801515811461071a57600080fd5b6000806000606084860312156134ca57600080fd5b6134d38461344a565b92506020840135915060408401356134ea816134a7565b809150509250925092565b803563ffffffff8116811461346e57600080fd5b60006020828403121561351b57600080fd5b612747826134f5565b803567ffffffffffffffff8116811461346e57600080fd5b60008060008060008060c0878903121561355557600080fd5b61355e8761344a565b955061356c6020880161344a565b9450604087013593506060870135925061358860808801613524565b915061359660a088016134f5565b90509295509295509295565b600080604083850312156135b557600080fd5b50508035926020909101359150565b600080604083850312156135d757600080fd5b6135e08361344a565b946020939093013593505050565b6000806000806000806000806000806101408b8d03121561360e57600080fd5b6136178b61344a565b995061362560208c0161344a565b985061363360408c0161344a565b975060608b0135965060808b0135955060a08b0135945060c08b0135935061365d60e08c01613524565b925061366c6101008c01613524565b915061367b6101208c016134f5565b90509295989b9194979a5092959850565b6000806020838503121561369f57600080fd5b823567ffffffffffffffff808211156136b757600080fd5b818501915085601f8301126136cb57600080fd5b8135818111156136da57600080fd5b8660208260051b85010111156136ef57600080fd5b60209290920196919550909350505050565b60005b8381101561371c578181015183820152602001613704565b838111156122165750506000910152565b60008151808452613745816020860160208601613701565b601f017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0169290920160200192915050565b6000602080830181845280855180835260408601915060408160051b870101925083870160005b828110156137ea577fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc08886030184526137d885835161372d565b9450928501929085019060010161379e565b5092979650505050505050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b60405160c0810167ffffffffffffffff81118282101715613849576138496137f7565b60405290565b604051601f82017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe016810167ffffffffffffffff81118282101715613896576138966137f7565b604052919050565b600067ffffffffffffffff8211156138b8576138b86137f7565b5060051b60200190565b600082601f8301126138d357600080fd5b813560206138e86138e38361389e565b61384f565b82815260059290921b8401810191818101908684111561390757600080fd5b8286015b84811015613922578035835291830191830161390b565b509695505050505050565b600082601f83011261393e57600080fd5b8135602061394e6138e38361389e565b82815260059290921b8401810191818101908684111561396d57600080fd5b8286015b84811015613922576139828161344a565b8352918301918301613971565b6000806000606084860312156139a457600080fd5b6139ad846134f5565b9250602084013567ffffffffffffffff808211156139ca57600080fd5b9085019060c082880312156139de57600080fd5b6139e6613826565b8235815260208301356020820152604083013582811115613a0657600080fd5b613a12898286016138c2565b604083015250613a24606084016134f5565b6060820152613a356080840161344a565b608082015260a083013582811115613a4c57600080fd5b613a588982860161392d565b60a08301525093506040860135915080821115613a7457600080fd5b50613a81868287016138c2565b9150509250925092565b6000806000806000806000806000806101408b8d031215613aab57600080fd5b613ab48b61344a565b9950613ac260208c0161344a565b9850613ad060408c0161344a565b975060608b0135965060808b01359550613aec60a08c01613524565b9450613afa60c08c01613524565b9350613b0860e08c016134f5565b9250613b176101008c016134f5565b91506101208b013567ffffffffffffffff811115613b3457600080fd5b613b408d828e016138c2565b9150509295989b9194979a5092959850565b600067ffffffffffffffff821115613b6c57613b6c6137f7565b50601f017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe01660200190565b600082601f830112613ba957600080fd5b8135613bb76138e382613b52565b818152846020838601011115613bcc57600080fd5b816020850160208301376000918101602001919091529392505050565b6000806000806000806000806000806000806101808d8f031215613c0c57600080fd5b613c158d61344a565b9b50613c2360208e0161344a565b9a50613c3160408e0161344a565b995060608d0135985060808d0135975060a08d0135965060c08d01359550613c5b60e08e01613524565b9450613c6a6101008e01613524565b9350613c796101208e01613524565b9250613c886101408e016134f5565b915067ffffffffffffffff6101608e01351115613ca457600080fd5b613cb58e6101608f01358f01613b98565b90509295989b509295989b509295989b565b600060208284031215613cd957600080fd5b5051919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b600063ffffffff83811690831681811015613d2c57613d2c613ce0565b039392505050565b600063ffffffff808316818516808303821115613d5357613d53613ce0565b01949350505050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b60008083357fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe1843603018112613dc057600080fd5b83018035915067ffffffffffffffff821115613ddb57600080fd5b60200191503681900382131561311057600080fd5b8183823760009101908152919050565b600060208284031215613e1257600080fd5b815167ffffffffffffffff811115613e2957600080fd5b8201601f81018413613e3a57600080fd5b8051613e486138e382613b52565b818152856020838501011115613e5d57600080fd5b612603826020830160208601613701565b602081526000612747602083018461372d565b60007fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff821415613eb357613eb3613ce0565b5060010190565b600063ffffffff80831681811415613ed457613ed4613ce0565b6001019392505050565b600081518084526020808501945080840160005b83811015613f0e57815187529582019590820190600101613ef2565b509495945050505050565b600081518084526020808501945080840160005b83811015613f0e57815173ffffffffffffffffffffffffffffffffffffffff1687529582019590820190600101613f2d565b85815284602082015260a060408201526000613f7e60a0830186613ede565b73ffffffffffffffffffffffffffffffffffffffff851660608401528281036080840152612fe08185613f19565b60006101008201905073ffffffffffffffffffffffffffffffffffffffff80845116835280602085015116602084015280604085015116604084015250606083015160608301526080830151608083015260a083015167ffffffffffffffff80821660a08501528060c08601511660c0850152505060e08301516113a960e084018263ffffffff169052565b600067ffffffffffffffff808316818516808303821115613d5357613d53613ce0565b60008282101561406d5761406d613ce0565b500390565b6000821982111561408557614085613ce0565b500190565b6020815281516020820152602082015160408201526000604083015160c060608401526140ba60e0840182613ede565b905063ffffffff606085015116608084015273ffffffffffffffffffffffffffffffffffffffff60808501511660a084015260a08401517fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe08483030160c08501526126038282613f19565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601260045260246000fd5b60008261416357614163614125565b500490565b60008261417757614177614125565b500690565b60006020828403121561418e57600080fd5b8151612747816134a7565b600067ffffffffffffffff83811690831681811015613d2c57613d2c613ce0565b6000817fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff04831182151516156141f2576141f2613ce0565b500290565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052602160045260246000fd5b828152604060208201526000612744604083018461372d565b60008251614251818460208701613701565b9190910192915050565b60006020828403121561426d57600080fd5b81517fffffffff000000000000000000000000000000000000000000000000000000008116811461274757600080fdfea264697066735822122031217f7bdb9ad94347a2b7912e1467daed140345b839fd6819e85f6ed9bdd8a064736f6c634300080b0033", - "devdoc": { - "details": "Used on Ethereum L1 to facilitate L2->L1 transfers.", - "kind": "dev", - "methods": { - "deposit(address,address,uint256,uint256,uint64,uint32)": { - "details": "The caller must first approve this contract to spend `amount` of `originToken`." - }, - "getCurrentTime()": { - "returns": { - "_0": "uint for the current Testable timestamp." - } - }, - "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 anymore. Can only be called by the current owner. NOTE: Renouncing ownership will leave the contract without an owner, thereby removing any functionality that is only available to the owner." - }, - "setCurrentTime(uint256)": { - "details": "Will revert if not running in test mode.", - "params": { - "time": "timestamp to set current Testable time to." - } - }, - "transferOwnership(address)": { - "details": "Transfers ownership of the contract to a new account (`newOwner`). Can only be called by the current owner." - } - }, - "version": 1 - }, - "userdoc": { - "kind": "user", - "methods": { - "deposit(address,address,uint256,uint256,uint64,uint32)": { - "notice": "Called by user to bridge funds from origin to destination chain." - }, - "getCurrentTime()": { - "notice": "Gets the current time. Will return the last time set in `setCurrentTime` if running in test mode. Otherwise, it will return the block timestamp." - }, - "setCurrentTime(uint256)": { - "notice": "Sets the current time." - } - }, - "notice": "Ethereum L1 specific SpokePool.", - "version": 1 - }, - "storageLayout": { - "storage": [ - { - "astId": 5882, - "contract": "contracts/Ethereum_SpokePool.sol:Ethereum_SpokePool", - "label": "timerAddress", - "offset": 0, - "slot": "0", - "type": "t_address" - }, - { - "astId": 5108, - "contract": "contracts/Ethereum_SpokePool.sol:Ethereum_SpokePool", - "label": "_notEntered", - "offset": 20, - "slot": "0", - "type": "t_bool" - }, - { - "astId": 7836, - "contract": "contracts/Ethereum_SpokePool.sol:Ethereum_SpokePool", - "label": "crossDomainAdmin", - "offset": 0, - "slot": "1", - "type": "t_address" - }, - { - "astId": 7838, - "contract": "contracts/Ethereum_SpokePool.sol:Ethereum_SpokePool", - "label": "hubPool", - "offset": 0, - "slot": "2", - "type": "t_address" - }, - { - "astId": 7841, - "contract": "contracts/Ethereum_SpokePool.sol:Ethereum_SpokePool", - "label": "weth", - "offset": 0, - "slot": "3", - "type": "t_contract(WETH9)9917" - }, - { - "astId": 7843, - "contract": "contracts/Ethereum_SpokePool.sol:Ethereum_SpokePool", - "label": "deploymentTime", - "offset": 20, - "slot": "3", - "type": "t_uint32" - }, - { - "astId": 7846, - "contract": "contracts/Ethereum_SpokePool.sol:Ethereum_SpokePool", - "label": "depositQuoteTimeBuffer", - "offset": 24, - "slot": "3", - "type": "t_uint32" - }, - { - "astId": 7848, - "contract": "contracts/Ethereum_SpokePool.sol:Ethereum_SpokePool", - "label": "numberOfDeposits", - "offset": 28, - "slot": "3", - "type": "t_uint32" - }, - { - "astId": 7854, - "contract": "contracts/Ethereum_SpokePool.sol:Ethereum_SpokePool", - "label": "enabledDepositRoutes", - "offset": 0, - "slot": "4", - "type": "t_mapping(t_address,t_mapping(t_uint256,t_bool))" - }, - { - "astId": 7867, - "contract": "contracts/Ethereum_SpokePool.sol:Ethereum_SpokePool", - "label": "rootBundles", - "offset": 0, - "slot": "5", - "type": "t_array(t_struct(RootBundle)7863_storage)dyn_storage" - }, - { - "astId": 7871, - "contract": "contracts/Ethereum_SpokePool.sol:Ethereum_SpokePool", - "label": "relayFills", - "offset": 0, - "slot": "6", - "type": "t_mapping(t_bytes32,t_uint256)" - }, - { - "astId": 400, - "contract": "contracts/Ethereum_SpokePool.sol:Ethereum_SpokePool", - "label": "_owner", - "offset": 0, - "slot": "7", - "type": "t_address" - } - ], - "types": { - "t_address": { - "encoding": "inplace", - "label": "address", - "numberOfBytes": "20" - }, - "t_array(t_struct(RootBundle)7863_storage)dyn_storage": { - "base": "t_struct(RootBundle)7863_storage", - "encoding": "dynamic_array", - "label": "struct SpokePool.RootBundle[]", - "numberOfBytes": "32" - }, - "t_bool": { - "encoding": "inplace", - "label": "bool", - "numberOfBytes": "1" - }, - "t_bytes32": { - "encoding": "inplace", - "label": "bytes32", - "numberOfBytes": "32" - }, - "t_contract(WETH9)9917": { - "encoding": "inplace", - "label": "contract WETH9", - "numberOfBytes": "20" - }, - "t_mapping(t_address,t_mapping(t_uint256,t_bool))": { - "encoding": "mapping", - "key": "t_address", - "label": "mapping(address => mapping(uint256 => bool))", - "numberOfBytes": "32", - "value": "t_mapping(t_uint256,t_bool)" - }, - "t_mapping(t_bytes32,t_uint256)": { - "encoding": "mapping", - "key": "t_bytes32", - "label": "mapping(bytes32 => uint256)", - "numberOfBytes": "32", - "value": "t_uint256" - }, - "t_mapping(t_uint256,t_bool)": { - "encoding": "mapping", - "key": "t_uint256", - "label": "mapping(uint256 => bool)", - "numberOfBytes": "32", - "value": "t_bool" - }, - "t_mapping(t_uint256,t_uint256)": { - "encoding": "mapping", - "key": "t_uint256", - "label": "mapping(uint256 => uint256)", - "numberOfBytes": "32", - "value": "t_uint256" - }, - "t_struct(RootBundle)7863_storage": { - "encoding": "inplace", - "label": "struct SpokePool.RootBundle", - "members": [ - { - "astId": 7856, - "contract": "contracts/Ethereum_SpokePool.sol:Ethereum_SpokePool", - "label": "slowRelayFulfillmentRoot", - "offset": 0, - "slot": "0", - "type": "t_bytes32" - }, - { - "astId": 7858, - "contract": "contracts/Ethereum_SpokePool.sol:Ethereum_SpokePool", - "label": "relayerRefundRoot", - "offset": 0, - "slot": "1", - "type": "t_bytes32" - }, - { - "astId": 7862, - "contract": "contracts/Ethereum_SpokePool.sol:Ethereum_SpokePool", - "label": "claimedBitmap", - "offset": 0, - "slot": "2", - "type": "t_mapping(t_uint256,t_uint256)" - } - ], - "numberOfBytes": "96" - }, - "t_uint256": { - "encoding": "inplace", - "label": "uint256", - "numberOfBytes": "32" - }, - "t_uint32": { - "encoding": "inplace", - "label": "uint32", - "numberOfBytes": "4" - } - } - } -} diff --git a/deployments/arbitrum-rinkeby/LpTokenFactory.json b/deployments/arbitrum-rinkeby/LpTokenFactory.json deleted file mode 100644 index 67e322fe2..000000000 --- a/deployments/arbitrum-rinkeby/LpTokenFactory.json +++ /dev/null @@ -1,60 +0,0 @@ -{ - "address": "0x7da554228555C8Bf3748403573d48a2138C6b848", - "abi": [ - { - "inputs": [ - { - "internalType": "address", - "name": "l1Token", - "type": "address" - } - ], - "name": "createLpToken", - "outputs": [ - { - "internalType": "address", - "name": "", - "type": "address" - } - ], - "stateMutability": "nonpayable", - "type": "function" - } - ], - "transactionHash": "0xf8606cb9865eee214390bd5ed0b796baa84f0ef34c744cb1fad58468466459e0", - "receipt": { - "to": null, - "from": "0x9A8f92a830A5cB89a3816e3D267CB7791c16b04D", - "contractAddress": "0x7da554228555C8Bf3748403573d48a2138C6b848", - "transactionIndex": 0, - "gasUsed": "37091099", - "logsBloom": "0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", - "blockHash": "0x3cde5c66cf27ca26bff7e79f31804587fee858e823addaa8927e78cfc9c1c8f6", - "transactionHash": "0xf8606cb9865eee214390bd5ed0b796baa84f0ef34c744cb1fad58468466459e0", - "logs": [], - "blockNumber": 9792688, - "cumulativeGasUsed": "18231098", - "status": 1, - "byzantium": true - }, - "args": [], - "numDeployments": 1, - "solcInputHash": "cee77d8f3a5225b985a9cf3439956316", - "metadata": "{\"compiler\":{\"version\":\"0.8.11+commit.d7f03943\"},\"language\":\"Solidity\",\"output\":{\"abi\":[{\"inputs\":[{\"internalType\":\"address\",\"name\":\"l1Token\",\"type\":\"address\"}],\"name\":\"createLpToken\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"nonpayable\",\"type\":\"function\"}],\"devdoc\":{\"kind\":\"dev\",\"methods\":{},\"version\":1},\"userdoc\":{\"kind\":\"user\",\"methods\":{},\"version\":1}},\"settings\":{\"compilationTarget\":{\"contracts/LpTokenFactory.sol\":\"LpTokenFactory\"},\"evmVersion\":\"london\",\"libraries\":{},\"metadata\":{\"bytecodeHash\":\"ipfs\",\"useLiteralContent\":true},\"optimizer\":{\"enabled\":true,\"runs\":1000000},\"remappings\":[]},\"sources\":{\"@openzeppelin/contracts/token/ERC20/ERC20.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts v4.4.1 (token/ERC20/ERC20.sol)\\n\\npragma solidity ^0.8.0;\\n\\nimport \\\"./IERC20.sol\\\";\\nimport \\\"./extensions/IERC20Metadata.sol\\\";\\nimport \\\"../../utils/Context.sol\\\";\\n\\n/**\\n * @dev Implementation of the {IERC20} interface.\\n *\\n * This implementation is agnostic to the way tokens are created. This means\\n * that a supply mechanism has to be added in a derived contract using {_mint}.\\n * For a generic mechanism see {ERC20PresetMinterPauser}.\\n *\\n * TIP: For a detailed writeup see our guide\\n * https://forum.zeppelin.solutions/t/how-to-implement-erc20-supply-mechanisms/226[How\\n * to implement supply mechanisms].\\n *\\n * We have followed general OpenZeppelin Contracts guidelines: functions revert\\n * instead returning `false` on failure. This behavior is nonetheless\\n * conventional and does not conflict with the expectations of ERC20\\n * applications.\\n *\\n * Additionally, an {Approval} event is emitted on calls to {transferFrom}.\\n * This allows applications to reconstruct the allowance for all accounts just\\n * by listening to said events. Other implementations of the EIP may not emit\\n * these events, as it isn't required by the specification.\\n *\\n * Finally, the non-standard {decreaseAllowance} and {increaseAllowance}\\n * functions have been added to mitigate the well-known issues around setting\\n * allowances. See {IERC20-approve}.\\n */\\ncontract ERC20 is Context, IERC20, IERC20Metadata {\\n mapping(address => uint256) private _balances;\\n\\n mapping(address => mapping(address => uint256)) private _allowances;\\n\\n uint256 private _totalSupply;\\n\\n string private _name;\\n string private _symbol;\\n\\n /**\\n * @dev Sets the values for {name} and {symbol}.\\n *\\n * The default value of {decimals} is 18. To select a different value for\\n * {decimals} you should overload it.\\n *\\n * All two of these values are immutable: they can only be set once during\\n * construction.\\n */\\n constructor(string memory name_, string memory symbol_) {\\n _name = name_;\\n _symbol = symbol_;\\n }\\n\\n /**\\n * @dev Returns the name of the token.\\n */\\n function name() public view virtual override returns (string memory) {\\n return _name;\\n }\\n\\n /**\\n * @dev Returns the symbol of the token, usually a shorter version of the\\n * name.\\n */\\n function symbol() public view virtual override returns (string memory) {\\n return _symbol;\\n }\\n\\n /**\\n * @dev Returns the number of decimals used to get its user representation.\\n * For example, if `decimals` equals `2`, a balance of `505` tokens should\\n * be displayed to a user as `5.05` (`505 / 10 ** 2`).\\n *\\n * Tokens usually opt for a value of 18, imitating the relationship between\\n * Ether and Wei. This is the value {ERC20} uses, unless this function is\\n * overridden;\\n *\\n * NOTE: This information is only used for _display_ purposes: it in\\n * no way affects any of the arithmetic of the contract, including\\n * {IERC20-balanceOf} and {IERC20-transfer}.\\n */\\n function decimals() public view virtual override returns (uint8) {\\n return 18;\\n }\\n\\n /**\\n * @dev See {IERC20-totalSupply}.\\n */\\n function totalSupply() public view virtual override returns (uint256) {\\n return _totalSupply;\\n }\\n\\n /**\\n * @dev See {IERC20-balanceOf}.\\n */\\n function balanceOf(address account) public view virtual override returns (uint256) {\\n return _balances[account];\\n }\\n\\n /**\\n * @dev See {IERC20-transfer}.\\n *\\n * Requirements:\\n *\\n * - `recipient` cannot be the zero address.\\n * - the caller must have a balance of at least `amount`.\\n */\\n function transfer(address recipient, uint256 amount) public virtual override returns (bool) {\\n _transfer(_msgSender(), recipient, amount);\\n return true;\\n }\\n\\n /**\\n * @dev See {IERC20-allowance}.\\n */\\n function allowance(address owner, address spender) public view virtual override returns (uint256) {\\n return _allowances[owner][spender];\\n }\\n\\n /**\\n * @dev See {IERC20-approve}.\\n *\\n * Requirements:\\n *\\n * - `spender` cannot be the zero address.\\n */\\n function approve(address spender, uint256 amount) public virtual override returns (bool) {\\n _approve(_msgSender(), spender, amount);\\n return true;\\n }\\n\\n /**\\n * @dev See {IERC20-transferFrom}.\\n *\\n * Emits an {Approval} event indicating the updated allowance. This is not\\n * required by the EIP. See the note at the beginning of {ERC20}.\\n *\\n * Requirements:\\n *\\n * - `sender` and `recipient` cannot be the zero address.\\n * - `sender` must have a balance of at least `amount`.\\n * - the caller must have allowance for ``sender``'s tokens of at least\\n * `amount`.\\n */\\n function transferFrom(\\n address sender,\\n address recipient,\\n uint256 amount\\n ) public virtual override returns (bool) {\\n _transfer(sender, recipient, amount);\\n\\n uint256 currentAllowance = _allowances[sender][_msgSender()];\\n require(currentAllowance >= amount, \\\"ERC20: transfer amount exceeds allowance\\\");\\n unchecked {\\n _approve(sender, _msgSender(), currentAllowance - amount);\\n }\\n\\n return true;\\n }\\n\\n /**\\n * @dev Atomically increases the allowance granted to `spender` by the caller.\\n *\\n * This is an alternative to {approve} that can be used as a mitigation for\\n * problems described in {IERC20-approve}.\\n *\\n * Emits an {Approval} event indicating the updated allowance.\\n *\\n * Requirements:\\n *\\n * - `spender` cannot be the zero address.\\n */\\n function increaseAllowance(address spender, uint256 addedValue) public virtual returns (bool) {\\n _approve(_msgSender(), spender, _allowances[_msgSender()][spender] + addedValue);\\n return true;\\n }\\n\\n /**\\n * @dev Atomically decreases the allowance granted to `spender` by the caller.\\n *\\n * This is an alternative to {approve} that can be used as a mitigation for\\n * problems described in {IERC20-approve}.\\n *\\n * Emits an {Approval} event indicating the updated allowance.\\n *\\n * Requirements:\\n *\\n * - `spender` cannot be the zero address.\\n * - `spender` must have allowance for the caller of at least\\n * `subtractedValue`.\\n */\\n function decreaseAllowance(address spender, uint256 subtractedValue) public virtual returns (bool) {\\n uint256 currentAllowance = _allowances[_msgSender()][spender];\\n require(currentAllowance >= subtractedValue, \\\"ERC20: decreased allowance below zero\\\");\\n unchecked {\\n _approve(_msgSender(), spender, currentAllowance - subtractedValue);\\n }\\n\\n return true;\\n }\\n\\n /**\\n * @dev Moves `amount` of tokens from `sender` to `recipient`.\\n *\\n * This internal function is equivalent to {transfer}, and can be used to\\n * e.g. implement automatic token fees, slashing mechanisms, etc.\\n *\\n * Emits a {Transfer} event.\\n *\\n * Requirements:\\n *\\n * - `sender` cannot be the zero address.\\n * - `recipient` cannot be the zero address.\\n * - `sender` must have a balance of at least `amount`.\\n */\\n function _transfer(\\n address sender,\\n address recipient,\\n uint256 amount\\n ) internal virtual {\\n require(sender != address(0), \\\"ERC20: transfer from the zero address\\\");\\n require(recipient != address(0), \\\"ERC20: transfer to the zero address\\\");\\n\\n _beforeTokenTransfer(sender, recipient, amount);\\n\\n uint256 senderBalance = _balances[sender];\\n require(senderBalance >= amount, \\\"ERC20: transfer amount exceeds balance\\\");\\n unchecked {\\n _balances[sender] = senderBalance - amount;\\n }\\n _balances[recipient] += amount;\\n\\n emit Transfer(sender, recipient, amount);\\n\\n _afterTokenTransfer(sender, recipient, amount);\\n }\\n\\n /** @dev Creates `amount` tokens and assigns them to `account`, increasing\\n * the total supply.\\n *\\n * Emits a {Transfer} event with `from` set to the zero address.\\n *\\n * Requirements:\\n *\\n * - `account` cannot be the zero address.\\n */\\n function _mint(address account, uint256 amount) internal virtual {\\n require(account != address(0), \\\"ERC20: mint to the zero address\\\");\\n\\n _beforeTokenTransfer(address(0), account, amount);\\n\\n _totalSupply += amount;\\n _balances[account] += amount;\\n emit Transfer(address(0), account, amount);\\n\\n _afterTokenTransfer(address(0), account, amount);\\n }\\n\\n /**\\n * @dev Destroys `amount` tokens from `account`, reducing the\\n * total supply.\\n *\\n * Emits a {Transfer} event with `to` set to the zero address.\\n *\\n * Requirements:\\n *\\n * - `account` cannot be the zero address.\\n * - `account` must have at least `amount` tokens.\\n */\\n function _burn(address account, uint256 amount) internal virtual {\\n require(account != address(0), \\\"ERC20: burn from the zero address\\\");\\n\\n _beforeTokenTransfer(account, address(0), amount);\\n\\n uint256 accountBalance = _balances[account];\\n require(accountBalance >= amount, \\\"ERC20: burn amount exceeds balance\\\");\\n unchecked {\\n _balances[account] = accountBalance - amount;\\n }\\n _totalSupply -= amount;\\n\\n emit Transfer(account, address(0), amount);\\n\\n _afterTokenTransfer(account, address(0), amount);\\n }\\n\\n /**\\n * @dev Sets `amount` as the allowance of `spender` over the `owner` s tokens.\\n *\\n * This internal function is equivalent to `approve`, and can be used to\\n * e.g. set automatic allowances for certain subsystems, etc.\\n *\\n * Emits an {Approval} event.\\n *\\n * Requirements:\\n *\\n * - `owner` cannot be the zero address.\\n * - `spender` cannot be the zero address.\\n */\\n function _approve(\\n address owner,\\n address spender,\\n uint256 amount\\n ) internal virtual {\\n require(owner != address(0), \\\"ERC20: approve from the zero address\\\");\\n require(spender != address(0), \\\"ERC20: approve to the zero address\\\");\\n\\n _allowances[owner][spender] = amount;\\n emit Approval(owner, spender, amount);\\n }\\n\\n /**\\n * @dev Hook that is called before any transfer of tokens. This includes\\n * minting and burning.\\n *\\n * Calling conditions:\\n *\\n * - when `from` and `to` are both non-zero, `amount` of ``from``'s tokens\\n * will be transferred to `to`.\\n * - when `from` is zero, `amount` tokens will be minted for `to`.\\n * - when `to` is zero, `amount` of ``from``'s tokens will be burned.\\n * - `from` and `to` are never both zero.\\n *\\n * To learn more about hooks, head to xref:ROOT:extending-contracts.adoc#using-hooks[Using Hooks].\\n */\\n function _beforeTokenTransfer(\\n address from,\\n address to,\\n uint256 amount\\n ) internal virtual {}\\n\\n /**\\n * @dev Hook that is called after any transfer of tokens. This includes\\n * minting and burning.\\n *\\n * Calling conditions:\\n *\\n * - when `from` and `to` are both non-zero, `amount` of ``from``'s tokens\\n * has been transferred to `to`.\\n * - when `from` is zero, `amount` tokens have been minted for `to`.\\n * - when `to` is zero, `amount` of ``from``'s tokens have been burned.\\n * - `from` and `to` are never both zero.\\n *\\n * To learn more about hooks, head to xref:ROOT:extending-contracts.adoc#using-hooks[Using Hooks].\\n */\\n function _afterTokenTransfer(\\n address from,\\n address to,\\n uint256 amount\\n ) internal virtual {}\\n}\\n\",\"keccak256\":\"0xd1d8caaeb45f78e0b0715664d56c220c283c89bf8b8c02954af86404d6b367f8\",\"license\":\"MIT\"},\"@openzeppelin/contracts/token/ERC20/IERC20.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts v4.4.1 (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 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 `recipient`.\\n *\\n * Returns a boolean value indicating whether the operation succeeded.\\n *\\n * Emits a {Transfer} event.\\n */\\n function transfer(address recipient, 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 `sender` to `recipient` 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(\\n address sender,\\n address recipient,\\n uint256 amount\\n ) external returns (bool);\\n\\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\",\"keccak256\":\"0x61437cb513a887a1bbad006e7b1c8b414478427d33de47c5600af3c748f108da\",\"license\":\"MIT\"},\"@openzeppelin/contracts/token/ERC20/extensions/IERC20Metadata.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts v4.4.1 (token/ERC20/extensions/IERC20Metadata.sol)\\n\\npragma solidity ^0.8.0;\\n\\nimport \\\"../IERC20.sol\\\";\\n\\n/**\\n * @dev Interface for the optional metadata functions from the ERC20 standard.\\n *\\n * _Available since v4.1._\\n */\\ninterface IERC20Metadata is IERC20 {\\n /**\\n * @dev Returns the name of the token.\\n */\\n function name() external view returns (string memory);\\n\\n /**\\n * @dev Returns the symbol of the token.\\n */\\n function symbol() external view returns (string memory);\\n\\n /**\\n * @dev Returns the decimals places of the token.\\n */\\n function decimals() external view returns (uint8);\\n}\\n\",\"keccak256\":\"0x8de418a5503946cabe331f35fe242d3201a73f67f77aaeb7110acb1f30423aca\",\"license\":\"MIT\"},\"@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\",\"keccak256\":\"0xe2e337e6dde9ef6b680e07338c493ebea1b5fd09b43424112868e9cc1706bca7\",\"license\":\"MIT\"},\"@uma/core/contracts/common/implementation/ExpandedERC20.sol\":{\"content\":\"// SPDX-License-Identifier: AGPL-3.0-only\\npragma solidity ^0.8.0;\\n\\nimport \\\"@openzeppelin/contracts/token/ERC20/ERC20.sol\\\";\\nimport \\\"./MultiRole.sol\\\";\\nimport \\\"../interfaces/ExpandedIERC20.sol\\\";\\n\\n/**\\n * @title An ERC20 with permissioned burning and minting. The contract deployer will initially\\n * be the owner who is capable of adding new roles.\\n */\\ncontract ExpandedERC20 is ExpandedIERC20, ERC20, MultiRole {\\n enum Roles {\\n // Can set the minter and burner.\\n Owner,\\n // Addresses that can mint new tokens.\\n Minter,\\n // Addresses that can burn tokens that address owns.\\n Burner\\n }\\n\\n uint8 _decimals;\\n\\n /**\\n * @notice Constructs the ExpandedERC20.\\n * @param _tokenName The name which describes the new token.\\n * @param _tokenSymbol The ticker abbreviation of the name. Ideally < 5 chars.\\n * @param _tokenDecimals The number of decimals to define token precision.\\n */\\n constructor(\\n string memory _tokenName,\\n string memory _tokenSymbol,\\n uint8 _tokenDecimals\\n ) ERC20(_tokenName, _tokenSymbol) {\\n _decimals = _tokenDecimals;\\n _createExclusiveRole(uint256(Roles.Owner), uint256(Roles.Owner), msg.sender);\\n _createSharedRole(uint256(Roles.Minter), uint256(Roles.Owner), new address[](0));\\n _createSharedRole(uint256(Roles.Burner), uint256(Roles.Owner), new address[](0));\\n }\\n\\n function decimals() public view virtual override(ERC20) returns (uint8) {\\n return _decimals;\\n }\\n\\n /**\\n * @dev Mints `value` tokens to `recipient`, returning true on success.\\n * @param recipient address to mint to.\\n * @param value amount of tokens to mint.\\n * @return True if the mint succeeded, or False.\\n */\\n function mint(address recipient, uint256 value)\\n external\\n override\\n onlyRoleHolder(uint256(Roles.Minter))\\n returns (bool)\\n {\\n _mint(recipient, value);\\n return true;\\n }\\n\\n /**\\n * @dev Burns `value` tokens owned by `msg.sender`.\\n * @param value amount of tokens to burn.\\n */\\n function burn(uint256 value) external override onlyRoleHolder(uint256(Roles.Burner)) {\\n _burn(msg.sender, value);\\n }\\n\\n /**\\n * @dev Burns `value` tokens owned by `recipient`.\\n * @param recipient address to burn tokens from.\\n * @param value amount of tokens to burn.\\n * @return True if the burn succeeded, or False.\\n */\\n function burnFrom(address recipient, uint256 value)\\n external\\n override\\n onlyRoleHolder(uint256(Roles.Burner))\\n returns (bool)\\n {\\n _burn(recipient, value);\\n return true;\\n }\\n\\n /**\\n * @notice Add Minter role to account.\\n * @dev The caller must have the Owner role.\\n * @param account The address to which the Minter role is added.\\n */\\n function addMinter(address account) external virtual override {\\n addMember(uint256(Roles.Minter), account);\\n }\\n\\n /**\\n * @notice Add Burner role to account.\\n * @dev The caller must have the Owner role.\\n * @param account The address to which the Burner role is added.\\n */\\n function addBurner(address account) external virtual override {\\n addMember(uint256(Roles.Burner), account);\\n }\\n\\n /**\\n * @notice Reset Owner role to account.\\n * @dev The caller must have the Owner role.\\n * @param account The new holder of the Owner role.\\n */\\n function resetOwner(address account) external virtual override {\\n resetMember(uint256(Roles.Owner), account);\\n }\\n}\\n\",\"keccak256\":\"0x8201459d3f78a1f97da7c421f2fbb859924d4facfc5fc235ba65d85bf12b2229\",\"license\":\"AGPL-3.0-only\"},\"@uma/core/contracts/common/implementation/MultiRole.sol\":{\"content\":\"// SPDX-License-Identifier: AGPL-3.0-only\\npragma solidity ^0.8.0;\\n\\nlibrary Exclusive {\\n struct RoleMembership {\\n address member;\\n }\\n\\n function isMember(RoleMembership storage roleMembership, address memberToCheck) internal view returns (bool) {\\n return roleMembership.member == memberToCheck;\\n }\\n\\n function resetMember(RoleMembership storage roleMembership, address newMember) internal {\\n require(newMember != address(0x0), \\\"Cannot set an exclusive role to 0x0\\\");\\n roleMembership.member = newMember;\\n }\\n\\n function getMember(RoleMembership storage roleMembership) internal view returns (address) {\\n return roleMembership.member;\\n }\\n\\n function init(RoleMembership storage roleMembership, address initialMember) internal {\\n resetMember(roleMembership, initialMember);\\n }\\n}\\n\\nlibrary Shared {\\n struct RoleMembership {\\n mapping(address => bool) members;\\n }\\n\\n function isMember(RoleMembership storage roleMembership, address memberToCheck) internal view returns (bool) {\\n return roleMembership.members[memberToCheck];\\n }\\n\\n function addMember(RoleMembership storage roleMembership, address memberToAdd) internal {\\n require(memberToAdd != address(0x0), \\\"Cannot add 0x0 to a shared role\\\");\\n roleMembership.members[memberToAdd] = true;\\n }\\n\\n function removeMember(RoleMembership storage roleMembership, address memberToRemove) internal {\\n roleMembership.members[memberToRemove] = false;\\n }\\n\\n function init(RoleMembership storage roleMembership, address[] memory initialMembers) internal {\\n for (uint256 i = 0; i < initialMembers.length; i++) {\\n addMember(roleMembership, initialMembers[i]);\\n }\\n }\\n}\\n\\n/**\\n * @title Base class to manage permissions for the derived class.\\n */\\nabstract contract MultiRole {\\n using Exclusive for Exclusive.RoleMembership;\\n using Shared for Shared.RoleMembership;\\n\\n enum RoleType { Invalid, Exclusive, Shared }\\n\\n struct Role {\\n uint256 managingRole;\\n RoleType roleType;\\n Exclusive.RoleMembership exclusiveRoleMembership;\\n Shared.RoleMembership sharedRoleMembership;\\n }\\n\\n mapping(uint256 => Role) private roles;\\n\\n event ResetExclusiveMember(uint256 indexed roleId, address indexed newMember, address indexed manager);\\n event AddedSharedMember(uint256 indexed roleId, address indexed newMember, address indexed manager);\\n event RemovedSharedMember(uint256 indexed roleId, address indexed oldMember, address indexed manager);\\n\\n /**\\n * @notice Reverts unless the caller is a member of the specified roleId.\\n */\\n modifier onlyRoleHolder(uint256 roleId) {\\n require(holdsRole(roleId, msg.sender), \\\"Sender does not hold required role\\\");\\n _;\\n }\\n\\n /**\\n * @notice Reverts unless the caller is a member of the manager role for the specified roleId.\\n */\\n modifier onlyRoleManager(uint256 roleId) {\\n require(holdsRole(roles[roleId].managingRole, msg.sender), \\\"Can only be called by a role manager\\\");\\n _;\\n }\\n\\n /**\\n * @notice Reverts unless the roleId represents an initialized, exclusive roleId.\\n */\\n modifier onlyExclusive(uint256 roleId) {\\n require(roles[roleId].roleType == RoleType.Exclusive, \\\"Must be called on an initialized Exclusive role\\\");\\n _;\\n }\\n\\n /**\\n * @notice Reverts unless the roleId represents an initialized, shared roleId.\\n */\\n modifier onlyShared(uint256 roleId) {\\n require(roles[roleId].roleType == RoleType.Shared, \\\"Must be called on an initialized Shared role\\\");\\n _;\\n }\\n\\n /**\\n * @notice Whether `memberToCheck` is a member of roleId.\\n * @dev Reverts if roleId does not correspond to an initialized role.\\n * @param roleId the Role to check.\\n * @param memberToCheck the address to check.\\n * @return True if `memberToCheck` is a member of `roleId`.\\n */\\n function holdsRole(uint256 roleId, address memberToCheck) public view returns (bool) {\\n Role storage role = roles[roleId];\\n if (role.roleType == RoleType.Exclusive) {\\n return role.exclusiveRoleMembership.isMember(memberToCheck);\\n } else if (role.roleType == RoleType.Shared) {\\n return role.sharedRoleMembership.isMember(memberToCheck);\\n }\\n revert(\\\"Invalid roleId\\\");\\n }\\n\\n /**\\n * @notice Changes the exclusive role holder of `roleId` to `newMember`.\\n * @dev Reverts if the caller is not a member of the managing role for `roleId` or if `roleId` is not an\\n * initialized, ExclusiveRole.\\n * @param roleId the ExclusiveRole membership to modify.\\n * @param newMember the new ExclusiveRole member.\\n */\\n function resetMember(uint256 roleId, address newMember) public onlyExclusive(roleId) onlyRoleManager(roleId) {\\n roles[roleId].exclusiveRoleMembership.resetMember(newMember);\\n emit ResetExclusiveMember(roleId, newMember, msg.sender);\\n }\\n\\n /**\\n * @notice Gets the current holder of the exclusive role, `roleId`.\\n * @dev Reverts if `roleId` does not represent an initialized, exclusive role.\\n * @param roleId the ExclusiveRole membership to check.\\n * @return the address of the current ExclusiveRole member.\\n */\\n function getMember(uint256 roleId) public view onlyExclusive(roleId) returns (address) {\\n return roles[roleId].exclusiveRoleMembership.getMember();\\n }\\n\\n /**\\n * @notice Adds `newMember` to the shared role, `roleId`.\\n * @dev Reverts if `roleId` does not represent an initialized, SharedRole or if the caller is not a member of the\\n * managing role for `roleId`.\\n * @param roleId the SharedRole membership to modify.\\n * @param newMember the new SharedRole member.\\n */\\n function addMember(uint256 roleId, address newMember) public onlyShared(roleId) onlyRoleManager(roleId) {\\n roles[roleId].sharedRoleMembership.addMember(newMember);\\n emit AddedSharedMember(roleId, newMember, msg.sender);\\n }\\n\\n /**\\n * @notice Removes `memberToRemove` from the shared role, `roleId`.\\n * @dev Reverts if `roleId` does not represent an initialized, SharedRole or if the caller is not a member of the\\n * managing role for `roleId`.\\n * @param roleId the SharedRole membership to modify.\\n * @param memberToRemove the current SharedRole member to remove.\\n */\\n function removeMember(uint256 roleId, address memberToRemove) public onlyShared(roleId) onlyRoleManager(roleId) {\\n roles[roleId].sharedRoleMembership.removeMember(memberToRemove);\\n emit RemovedSharedMember(roleId, memberToRemove, msg.sender);\\n }\\n\\n /**\\n * @notice Removes caller from the role, `roleId`.\\n * @dev Reverts if the caller is not a member of the role for `roleId` or if `roleId` is not an\\n * initialized, SharedRole.\\n * @param roleId the SharedRole membership to modify.\\n */\\n function renounceMembership(uint256 roleId) public onlyShared(roleId) onlyRoleHolder(roleId) {\\n roles[roleId].sharedRoleMembership.removeMember(msg.sender);\\n emit RemovedSharedMember(roleId, msg.sender, msg.sender);\\n }\\n\\n /**\\n * @notice Reverts if `roleId` is not initialized.\\n */\\n modifier onlyValidRole(uint256 roleId) {\\n require(roles[roleId].roleType != RoleType.Invalid, \\\"Attempted to use an invalid roleId\\\");\\n _;\\n }\\n\\n /**\\n * @notice Reverts if `roleId` is initialized.\\n */\\n modifier onlyInvalidRole(uint256 roleId) {\\n require(roles[roleId].roleType == RoleType.Invalid, \\\"Cannot use a pre-existing role\\\");\\n _;\\n }\\n\\n /**\\n * @notice Internal method to initialize a shared role, `roleId`, which will be managed by `managingRoleId`.\\n * `initialMembers` will be immediately added to the role.\\n * @dev Should be called by derived contracts, usually at construction time. Will revert if the role is already\\n * initialized.\\n */\\n function _createSharedRole(\\n uint256 roleId,\\n uint256 managingRoleId,\\n address[] memory initialMembers\\n ) internal onlyInvalidRole(roleId) {\\n Role storage role = roles[roleId];\\n role.roleType = RoleType.Shared;\\n role.managingRole = managingRoleId;\\n role.sharedRoleMembership.init(initialMembers);\\n require(\\n roles[managingRoleId].roleType != RoleType.Invalid,\\n \\\"Attempted to use an invalid role to manage a shared role\\\"\\n );\\n }\\n\\n /**\\n * @notice Internal method to initialize an exclusive role, `roleId`, which will be managed by `managingRoleId`.\\n * `initialMember` will be immediately added to the role.\\n * @dev Should be called by derived contracts, usually at construction time. Will revert if the role is already\\n * initialized.\\n */\\n function _createExclusiveRole(\\n uint256 roleId,\\n uint256 managingRoleId,\\n address initialMember\\n ) internal onlyInvalidRole(roleId) {\\n Role storage role = roles[roleId];\\n role.roleType = RoleType.Exclusive;\\n role.managingRole = managingRoleId;\\n role.exclusiveRoleMembership.init(initialMember);\\n require(\\n roles[managingRoleId].roleType != RoleType.Invalid,\\n \\\"Attempted to use an invalid role to manage an exclusive role\\\"\\n );\\n }\\n}\\n\",\"keccak256\":\"0x134c5a2f847832705be631f2b4eb2a3e23a91a2f0e63560abb481e85eeebfae6\",\"license\":\"AGPL-3.0-only\"},\"@uma/core/contracts/common/interfaces/ExpandedIERC20.sol\":{\"content\":\"// SPDX-License-Identifier: AGPL-3.0-only\\npragma solidity ^0.8.0;\\n\\nimport \\\"@openzeppelin/contracts/token/ERC20/IERC20.sol\\\";\\n\\n/**\\n * @title ERC20 interface that includes burn and mint methods.\\n */\\nabstract contract ExpandedIERC20 is IERC20 {\\n /**\\n * @notice Burns a specific amount of the caller's tokens.\\n * @dev Only burns the caller's tokens, so it is safe to leave this method permissionless.\\n */\\n function burn(uint256 value) external virtual;\\n\\n /**\\n * @dev Burns `value` tokens owned by `recipient`.\\n * @param recipient address to burn tokens from.\\n * @param value amount of tokens to burn.\\n */\\n function burnFrom(address recipient, uint256 value) external virtual returns (bool);\\n\\n /**\\n * @notice Mints tokens and adds them to the balance of the `to` address.\\n * @dev This method should be permissioned to only allow designated parties to mint tokens.\\n */\\n function mint(address to, uint256 value) external virtual returns (bool);\\n\\n function addMinter(address account) external virtual;\\n\\n function addBurner(address account) external virtual;\\n\\n function resetOwner(address account) external virtual;\\n}\\n\",\"keccak256\":\"0xb8252039cba45f1c19cd677f150a9823a5d6e1845cad90e3041d97c96f273c26\",\"license\":\"AGPL-3.0-only\"},\"contracts/LpTokenFactory.sol\":{\"content\":\"// SPDX-License-Identifier: GPL-3.0-only\\npragma solidity ^0.8.0;\\n\\nimport \\\"./interfaces/LpTokenFactoryInterface.sol\\\";\\n\\nimport \\\"@uma/core/contracts/common/implementation/ExpandedERC20.sol\\\";\\n\\ncontract LpTokenFactory is LpTokenFactoryInterface {\\n function createLpToken(address l1Token) public returns (address) {\\n ExpandedERC20 lpToken = new ExpandedERC20(\\n _append(\\\"Across \\\", IERC20Metadata(l1Token).name(), \\\" LP Token\\\"), // LP Token Name\\n _append(\\\"Av2-\\\", IERC20Metadata(l1Token).symbol(), \\\"-LP\\\"), // LP Token Symbol\\n IERC20Metadata(l1Token).decimals() // LP Token Decimals\\n );\\n lpToken.addMember(1, msg.sender); // Set this contract as the LP Token's minter.\\n lpToken.addMember(2, msg.sender); // Set this contract as the LP Token's burner.\\n\\n return address(lpToken);\\n }\\n\\n function _append(\\n string memory a,\\n string memory b,\\n string memory c\\n ) internal pure returns (string memory) {\\n return string(abi.encodePacked(a, b, c));\\n }\\n}\\n\",\"keccak256\":\"0x51b55f2c875ae6e1c8e2dd867201c962a4f8c4a74a63a83f4ab94ed00cf6c954\",\"license\":\"GPL-3.0-only\"},\"contracts/interfaces/LpTokenFactoryInterface.sol\":{\"content\":\"// SPDX-License-Identifier: AGPL-3.0-only\\npragma solidity ^0.8.0;\\n\\nimport \\\"@openzeppelin/contracts/token/ERC20/IERC20.sol\\\";\\n\\ninterface LpTokenFactoryInterface {\\n function createLpToken(address l1Token) external returns (address);\\n}\\n\",\"keccak256\":\"0xbff9f636f087e2c5acc05be2da6fe26d3558f0ff6d270f8738bd8027b4ac8eff\",\"license\":\"AGPL-3.0-only\"}},\"version\":1}", - "bytecode": "0x608060405234801561001057600080fd5b50612cfa806100206000396000f3fe60806040523480156200001157600080fd5b50600436106200002e5760003560e01c8063fc2f1b6e1462000033575b600080fd5b6200004a620000443660046200048f565b62000073565b60405173ffffffffffffffffffffffffffffffffffffffff909116815260200160405180910390f35b600080620001806040518060400160405280600781526020017f4163726f737320000000000000000000000000000000000000000000000000008152508473ffffffffffffffffffffffffffffffffffffffff166306fdde036040518163ffffffff1660e01b8152600401600060405180830381865afa158015620000fc573d6000803e3d6000fd5b505050506040513d6000823e601f3d9081017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe016820160405262000144919081019062000530565b6040518060400160405280600981526020017f204c5020546f6b656e000000000000000000000000000000000000000000000081525062000450565b6200028a6040518060400160405280600481526020017f4176322d000000000000000000000000000000000000000000000000000000008152508573ffffffffffffffffffffffffffffffffffffffff166395d89b416040518163ffffffff1660e01b8152600401600060405180830381865afa15801562000206573d6000803e3d6000fd5b505050506040513d6000823e601f3d9081017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe01682016040526200024e919081019062000530565b6040518060400160405280600381526020017f2d4c50000000000000000000000000000000000000000000000000000000000081525062000450565b8473ffffffffffffffffffffffffffffffffffffffff1663313ce5676040518163ffffffff1660e01b8152600401602060405180830381865afa158015620002d6573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190620002fc919062000607565b6040516200030a9062000481565b620003189392919062000678565b604051809103906000f08015801562000335573d6000803e3d6000fd5b506040517f74d0a6760000000000000000000000000000000000000000000000000000000081526001600482015233602482015290915073ffffffffffffffffffffffffffffffffffffffff8216906374d0a67690604401600060405180830381600087803b158015620003a857600080fd5b505af1158015620003bd573d6000803e3d6000fd5b50506040517f74d0a6760000000000000000000000000000000000000000000000000000000081526002600482015233602482015273ffffffffffffffffffffffffffffffffffffffff841692506374d0a6769150604401600060405180830381600087803b1580156200043057600080fd5b505af115801562000445573d6000803e3d6000fd5b509295945050505050565b60608383836040516020016200046993929190620006b5565b60405160208183030381529060405290509392505050565b6125c680620006ff83390190565b600060208284031215620004a257600080fd5b813573ffffffffffffffffffffffffffffffffffffffff81168114620004c757600080fd5b9392505050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b60005b838110156200051a57818101518382015260200162000500565b838111156200052a576000848401525b50505050565b6000602082840312156200054357600080fd5b815167ffffffffffffffff808211156200055c57600080fd5b818401915084601f8301126200057157600080fd5b815181811115620005865762000586620004ce565b604051601f82017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0908116603f01168101908382118183101715620005cf57620005cf620004ce565b81604052828152876020848701011115620005e957600080fd5b620005fc836020830160208801620004fd565b979650505050505050565b6000602082840312156200061a57600080fd5b815160ff81168114620004c757600080fd5b6000815180845262000646816020860160208601620004fd565b601f017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0169290920160200192915050565b6060815260006200068d60608301866200062c565b8281036020840152620006a181866200062c565b91505060ff83166040830152949350505050565b60008451620006c9818460208901620004fd565b845190830190620006df818360208901620004fd565b8451910190620006f4818360208801620004fd565b019594505050505056fe60806040523480156200001157600080fd5b50604051620025c6380380620025c6833981016040819052620000349162000623565b8251839083906200004d906003906020850190620004b0565b50805162000063906004906020840190620004b0565b50506006805460ff191660ff8416179055506200008360008033620000b5565b620000a060015b6040805160008082526020820190925262000206565b620000ac60026200008a565b5050506200073b565b826000808281526005602052604090206001015460ff166002811115620000e057620000e0620006a8565b14620001335760405162461bcd60e51b815260206004820152601e60248201527f43616e6e6f74207573652061207072652d6578697374696e6720726f6c65000060448201526064015b60405180910390fd5b60008481526005602052604090206001808201805460ff1916828002179055508381556200017160028201846200034d602090811b620011d917901c565b60008481526005602052604081206001015460ff1660028111156200019a576200019a620006a8565b1415620001ff5760405162461bcd60e51b815260206004820152603c6024820152600080516020620025a683398151915260448201527f20746f206d616e61676520616e206578636c757369766520726f6c650000000060648201526084016200012a565b5050505050565b826000808281526005602052604090206001015460ff166002811115620002315762000231620006a8565b14620002805760405162461bcd60e51b815260206004820152601e60248201527f43616e6e6f74207573652061207072652d6578697374696e6720726f6c65000060448201526064016200012a565b600084815260056020908152604090912060018101805460ff1916600217905584815590620002bf9060038301908590620011e36200035d821b17901c565b60008481526005602052604081206001015460ff166002811115620002e857620002e8620006a8565b1415620001ff5760405162461bcd60e51b81526020600482015260386024820152600080516020620025a683398151915260448201527f20746f206d616e61676520612073686172656420726f6c65000000000000000060648201526084016200012a565b620003598282620003b2565b5050565b60005b8151811015620003ad576200039883838381518110620003845762000384620006be565b60200260200101516200043360201b60201c565b80620003a481620006d4565b91505062000360565b505050565b6001600160a01b038116620004165760405162461bcd60e51b815260206004820152602360248201527f43616e6e6f742073657420616e206578636c757369766520726f6c6520746f2060448201526203078360ec1b60648201526084016200012a565b81546001600160a01b0319166001600160a01b0391909116179055565b6001600160a01b0381166200048b5760405162461bcd60e51b815260206004820152601f60248201527f43616e6e6f74206164642030783020746f20612073686172656420726f6c650060448201526064016200012a565b6001600160a01b0316600090815260209190915260409020805460ff19166001179055565b828054620004be90620006fe565b90600052602060002090601f016020900481019282620004e257600085556200052d565b82601f10620004fd57805160ff19168380011785556200052d565b828001600101855582156200052d579182015b828111156200052d57825182559160200191906001019062000510565b506200053b9291506200053f565b5090565b5b808211156200053b576000815560010162000540565b634e487b7160e01b600052604160045260246000fd5b600082601f8301126200057e57600080fd5b81516001600160401b03808211156200059b576200059b62000556565b604051601f8301601f19908116603f01168101908282118183101715620005c657620005c662000556565b81604052838152602092508683858801011115620005e357600080fd5b600091505b83821015620006075785820183015181830184015290820190620005e8565b83821115620006195760008385830101525b9695505050505050565b6000806000606084860312156200063957600080fd5b83516001600160401b03808211156200065157600080fd5b6200065f878388016200056c565b945060208601519150808211156200067657600080fd5b5062000685868287016200056c565b925050604084015160ff811681146200069d57600080fd5b809150509250925092565b634e487b7160e01b600052602160045260246000fd5b634e487b7160e01b600052603260045260246000fd5b6000600019821415620006f757634e487b7160e01b600052601160045260246000fd5b5060010190565b600181811c908216806200071357607f821691505b602082108114156200073557634e487b7160e01b600052602260045260246000fd5b50919050565b611e5b806200074b6000396000f3fe608060405234801561001057600080fd5b506004361061018d5760003560e01c806374d0a676116100e3578063a9059cbb1161008c578063d97c05be11610066578063d97c05be14610369578063dd62ed3e1461037c578063f44637ba146103c257600080fd5b8063a9059cbb1461030b578063aaa14ca31461031e578063ab3545e51461033157600080fd5b806395d89b41116100bd57806395d89b41146102dd578063983b2d56146102e5578063a457c2d7146102f857600080fd5b806374d0a676146102a457806379cc6790146102b75780637cdc1cb9146102ca57600080fd5b806339509351116101455780636be7658b1161011f5780636be7658b1461024857806370a082311461025b57806373cc802a1461029157600080fd5b8063395093511461020d57806340c10f191461022057806342966c681461023357600080fd5b806318160ddd1161017657806318160ddd146101d357806323b872dd146101e5578063313ce567146101f857600080fd5b806306fdde0314610192578063095ea7b3146101b0575b600080fd5b61019a6103d5565b6040516101a79190611b4f565b60405180910390f35b6101c36101be366004611beb565b610467565b60405190151581526020016101a7565b6002545b6040519081526020016101a7565b6101c36101f3366004611c15565b61047e565b60065460405160ff90911681526020016101a7565b6101c361021b366004611beb565b610569565b6101c361022e366004611beb565b6105b2565b610246610241366004611c51565b610660565b005b610246610256366004611c6a565b610706565b6101d7610269366004611c96565b73ffffffffffffffffffffffffffffffffffffffff1660009081526020819052604090205490565b61024661029f366004611c96565b6108ed565b6102466102b2366004611c6a565b6108fb565b6101c36102c5366004611beb565b610abd565b6101c36102d8366004611c6a565b610b61565b61019a610c6b565b6102466102f3366004611c96565b610c7a565b6101c3610306366004611beb565b610c86565b6101c3610319366004611beb565b610d54565b61024661032c366004611c51565b610d61565b61034461033f366004611c51565b610f24565b60405173ffffffffffffffffffffffffffffffffffffffff90911681526020016101a7565b610246610377366004611c6a565b61100d565b6101d761038a366004611cb8565b73ffffffffffffffffffffffffffffffffffffffff918216600090815260016020908152604080832093909416825291909152205490565b6102466103d0366004611c96565b6111cf565b6060600380546103e490611ce2565b80601f016020809104026020016040519081016040528092919081815260200182805461041090611ce2565b801561045d5780601f106104325761010080835404028352916020019161045d565b820191906000526020600020905b81548152906001019060200180831161044057829003601f168201915b5050505050905090565b6000610474338484611229565b5060015b92915050565b600061048b8484846113dc565b73ffffffffffffffffffffffffffffffffffffffff8416600090815260016020908152604080832033845290915290205482811015610551576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602860248201527f45524332303a207472616e7366657220616d6f756e742065786365656473206160448201527f6c6c6f77616e636500000000000000000000000000000000000000000000000060648201526084015b60405180910390fd5b61055e8533858403611229565b506001949350505050565b33600081815260016020908152604080832073ffffffffffffffffffffffffffffffffffffffff8716845290915281205490916104749185906105ad908690611d5f565b611229565b600060016105c08133610b61565b61064c576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602260248201527f53656e64657220646f6573206e6f7420686f6c6420726571756972656420726f60448201527f6c650000000000000000000000000000000000000000000000000000000000006064820152608401610548565b6106568484611690565b5060019392505050565b600261066c8133610b61565b6106f8576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602260248201527f53656e64657220646f6573206e6f7420686f6c6420726571756972656420726f60448201527f6c650000000000000000000000000000000000000000000000000000000000006064820152608401610548565b61070233836117b0565b5050565b81600260008281526005602052604090206001015460ff16600281111561072f5761072f611d77565b146107bc576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602c60248201527f4d7573742062652063616c6c6564206f6e20616e20696e697469616c697a656460448201527f2053686172656420726f6c6500000000000000000000000000000000000000006064820152608401610548565b60008381526005602052604090205483906107d79033610b61565b610862576040517f08c379a0000000000000000000000000000000000000000000000000000000008152602060048201526024808201527f43616e206f6e6c792062652063616c6c6564206279206120726f6c65206d616e60448201527f61676572000000000000000000000000000000000000000000000000000000006064820152608401610548565b600084815260056020908152604080832073ffffffffffffffffffffffffffffffffffffffff8716808552600390910190925280832080547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0016905551339287917feb3e33034c392e69263b04ec0fa376dc12784a41b6676c7f31b936cbc0fbb5af9190a450505050565b6108f860008261100d565b50565b81600260008281526005602052604090206001015460ff16600281111561092457610924611d77565b146109b1576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602c60248201527f4d7573742062652063616c6c6564206f6e20616e20696e697469616c697a656460448201527f2053686172656420726f6c6500000000000000000000000000000000000000006064820152608401610548565b60008381526005602052604090205483906109cc9033610b61565b610a57576040517f08c379a0000000000000000000000000000000000000000000000000000000008152602060048201526024808201527f43616e206f6e6c792062652063616c6c6564206279206120726f6c65206d616e60448201527f61676572000000000000000000000000000000000000000000000000000000006064820152608401610548565b6000848152600560205260409020610a72906003018461199d565b604051339073ffffffffffffffffffffffffffffffffffffffff85169086907f63502af7324ff6db91ab38f8236a648727d9385ea6c782073dd4882d8a61a48f90600090a450505050565b60006002610acb8133610b61565b610b57576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602260248201527f53656e64657220646f6573206e6f7420686f6c6420726571756972656420726f60448201527f6c650000000000000000000000000000000000000000000000000000000000006064820152608401610548565b61065684846117b0565b600082815260056020526040812060018082015460ff166002811115610b8957610b89611d77565b1415610bb857600281015473ffffffffffffffffffffffffffffffffffffffff8481169116145b915050610478565b6002600182015460ff166002811115610bd357610bd3611d77565b1415610c095773ffffffffffffffffffffffffffffffffffffffff8316600090815260038201602052604090205460ff16610bb0565b6040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152600e60248201527f496e76616c696420726f6c6549640000000000000000000000000000000000006044820152606401610548565b6060600480546103e490611ce2565b6108f860015b826108fb565b33600090815260016020908152604080832073ffffffffffffffffffffffffffffffffffffffff8616845290915281205482811015610d47576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602560248201527f45524332303a2064656372656173656420616c6c6f77616e63652062656c6f7760448201527f207a65726f0000000000000000000000000000000000000000000000000000006064820152608401610548565b6106563385858403611229565b60006104743384846113dc565b80600260008281526005602052604090206001015460ff166002811115610d8a57610d8a611d77565b14610e17576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602c60248201527f4d7573742062652063616c6c6564206f6e20616e20696e697469616c697a656460448201527f2053686172656420726f6c6500000000000000000000000000000000000000006064820152608401610548565b81610e228133610b61565b610eae576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602260248201527f53656e64657220646f6573206e6f7420686f6c6420726571756972656420726f60448201527f6c650000000000000000000000000000000000000000000000000000000000006064820152608401610548565b6000838152600560209081526040808320338452600301909152902080547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff001690556040513390819085907feb3e33034c392e69263b04ec0fa376dc12784a41b6676c7f31b936cbc0fbb5af90600090a4505050565b600081600160008281526005602052604090206001015460ff166002811115610f4f57610f4f611d77565b14610fdc576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602f60248201527f4d7573742062652063616c6c6564206f6e20616e20696e697469616c697a656460448201527f204578636c757369766520726f6c6500000000000000000000000000000000006064820152608401610548565b60008381526005602052604090206002015473ffffffffffffffffffffffffffffffffffffffff1691505b50919050565b81600160008281526005602052604090206001015460ff16600281111561103657611036611d77565b146110c3576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602f60248201527f4d7573742062652063616c6c6564206f6e20616e20696e697469616c697a656460448201527f204578636c757369766520726f6c6500000000000000000000000000000000006064820152608401610548565b60008381526005602052604090205483906110de9033610b61565b611169576040517f08c379a0000000000000000000000000000000000000000000000000000000008152602060048201526024808201527f43616e206f6e6c792062652063616c6c6564206279206120726f6c65206d616e60448201527f61676572000000000000000000000000000000000000000000000000000000006064820152608401610548565b60008481526005602052604090206111849060020184611a6a565b604051339073ffffffffffffffffffffffffffffffffffffffff85169086907f3b855c56b409b671c7112789d022675eb639d0bcb8896f1b6197c132f799e74690600090a450505050565b6108f86002610c80565b6107028282611a6a565b60005b8151811015611224576112128383838151811061120557611205611da6565b602002602001015161199d565b8061121c81611dd5565b9150506111e6565b505050565b73ffffffffffffffffffffffffffffffffffffffff83166112cb576040517f08c379a0000000000000000000000000000000000000000000000000000000008152602060048201526024808201527f45524332303a20617070726f76652066726f6d20746865207a65726f2061646460448201527f72657373000000000000000000000000000000000000000000000000000000006064820152608401610548565b73ffffffffffffffffffffffffffffffffffffffff821661136e576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602260248201527f45524332303a20617070726f766520746f20746865207a65726f20616464726560448201527f73730000000000000000000000000000000000000000000000000000000000006064820152608401610548565b73ffffffffffffffffffffffffffffffffffffffff83811660008181526001602090815260408083209487168084529482529182902085905590518481527f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925910160405180910390a3505050565b73ffffffffffffffffffffffffffffffffffffffff831661147f576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602560248201527f45524332303a207472616e736665722066726f6d20746865207a65726f20616460448201527f64726573730000000000000000000000000000000000000000000000000000006064820152608401610548565b73ffffffffffffffffffffffffffffffffffffffff8216611522576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602360248201527f45524332303a207472616e7366657220746f20746865207a65726f206164647260448201527f65737300000000000000000000000000000000000000000000000000000000006064820152608401610548565b73ffffffffffffffffffffffffffffffffffffffff8316600090815260208190526040902054818110156115d8576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602660248201527f45524332303a207472616e7366657220616d6f756e742065786365656473206260448201527f616c616e636500000000000000000000000000000000000000000000000000006064820152608401610548565b73ffffffffffffffffffffffffffffffffffffffff80851660009081526020819052604080822085850390559185168152908120805484929061161c908490611d5f565b925050819055508273ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef8460405161168291815260200190565b60405180910390a350505050565b73ffffffffffffffffffffffffffffffffffffffff821661170d576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601f60248201527f45524332303a206d696e7420746f20746865207a65726f2061646472657373006044820152606401610548565b806002600082825461171f9190611d5f565b909155505073ffffffffffffffffffffffffffffffffffffffff821660009081526020819052604081208054839290611759908490611d5f565b909155505060405181815273ffffffffffffffffffffffffffffffffffffffff8316906000907fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef9060200160405180910390a35050565b73ffffffffffffffffffffffffffffffffffffffff8216611853576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602160248201527f45524332303a206275726e2066726f6d20746865207a65726f2061646472657360448201527f73000000000000000000000000000000000000000000000000000000000000006064820152608401610548565b73ffffffffffffffffffffffffffffffffffffffff821660009081526020819052604090205481811015611909576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602260248201527f45524332303a206275726e20616d6f756e7420657863656564732062616c616e60448201527f63650000000000000000000000000000000000000000000000000000000000006064820152608401610548565b73ffffffffffffffffffffffffffffffffffffffff83166000908152602081905260408120838303905560028054849290611945908490611e0e565b909155505060405182815260009073ffffffffffffffffffffffffffffffffffffffff8516907fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef9060200160405180910390a3505050565b73ffffffffffffffffffffffffffffffffffffffff8116611a1a576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601f60248201527f43616e6e6f74206164642030783020746f20612073686172656420726f6c65006044820152606401610548565b73ffffffffffffffffffffffffffffffffffffffff1660009081526020919091526040902080547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff00166001179055565b73ffffffffffffffffffffffffffffffffffffffff8116611b0d576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602360248201527f43616e6e6f742073657420616e206578636c757369766520726f6c6520746f2060448201527f30783000000000000000000000000000000000000000000000000000000000006064820152608401610548565b81547fffffffffffffffffffffffff00000000000000000000000000000000000000001673ffffffffffffffffffffffffffffffffffffffff91909116179055565b600060208083528351808285015260005b81811015611b7c57858101830151858201604001528201611b60565b81811115611b8e576000604083870101525b50601f017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe016929092016040019392505050565b803573ffffffffffffffffffffffffffffffffffffffff81168114611be657600080fd5b919050565b60008060408385031215611bfe57600080fd5b611c0783611bc2565b946020939093013593505050565b600080600060608486031215611c2a57600080fd5b611c3384611bc2565b9250611c4160208501611bc2565b9150604084013590509250925092565b600060208284031215611c6357600080fd5b5035919050565b60008060408385031215611c7d57600080fd5b82359150611c8d60208401611bc2565b90509250929050565b600060208284031215611ca857600080fd5b611cb182611bc2565b9392505050565b60008060408385031215611ccb57600080fd5b611cd483611bc2565b9150611c8d60208401611bc2565b600181811c90821680611cf657607f821691505b60208210811415611007577f4e487b7100000000000000000000000000000000000000000000000000000000600052602260045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b60008219821115611d7257611d72611d30565b500190565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052602160045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b60007fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff821415611e0757611e07611d30565b5060010190565b600082821015611e2057611e20611d30565b50039056fea26469706673582212206711b075929f95fe84e8886d266c57cb729d320a6e18d9be873ebf48ca86bf8764736f6c634300080b0033417474656d7074656420746f2075736520616e20696e76616c696420726f6c65a26469706673582212208f4dfad5cf85f250d1f373171e32179d88acdd0fe441528253448fa05bbbe45464736f6c634300080b0033", - "deployedBytecode": "0x60806040523480156200001157600080fd5b50600436106200002e5760003560e01c8063fc2f1b6e1462000033575b600080fd5b6200004a620000443660046200048f565b62000073565b60405173ffffffffffffffffffffffffffffffffffffffff909116815260200160405180910390f35b600080620001806040518060400160405280600781526020017f4163726f737320000000000000000000000000000000000000000000000000008152508473ffffffffffffffffffffffffffffffffffffffff166306fdde036040518163ffffffff1660e01b8152600401600060405180830381865afa158015620000fc573d6000803e3d6000fd5b505050506040513d6000823e601f3d9081017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe016820160405262000144919081019062000530565b6040518060400160405280600981526020017f204c5020546f6b656e000000000000000000000000000000000000000000000081525062000450565b6200028a6040518060400160405280600481526020017f4176322d000000000000000000000000000000000000000000000000000000008152508573ffffffffffffffffffffffffffffffffffffffff166395d89b416040518163ffffffff1660e01b8152600401600060405180830381865afa15801562000206573d6000803e3d6000fd5b505050506040513d6000823e601f3d9081017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe01682016040526200024e919081019062000530565b6040518060400160405280600381526020017f2d4c50000000000000000000000000000000000000000000000000000000000081525062000450565b8473ffffffffffffffffffffffffffffffffffffffff1663313ce5676040518163ffffffff1660e01b8152600401602060405180830381865afa158015620002d6573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190620002fc919062000607565b6040516200030a9062000481565b620003189392919062000678565b604051809103906000f08015801562000335573d6000803e3d6000fd5b506040517f74d0a6760000000000000000000000000000000000000000000000000000000081526001600482015233602482015290915073ffffffffffffffffffffffffffffffffffffffff8216906374d0a67690604401600060405180830381600087803b158015620003a857600080fd5b505af1158015620003bd573d6000803e3d6000fd5b50506040517f74d0a6760000000000000000000000000000000000000000000000000000000081526002600482015233602482015273ffffffffffffffffffffffffffffffffffffffff841692506374d0a6769150604401600060405180830381600087803b1580156200043057600080fd5b505af115801562000445573d6000803e3d6000fd5b509295945050505050565b60608383836040516020016200046993929190620006b5565b60405160208183030381529060405290509392505050565b6125c680620006ff83390190565b600060208284031215620004a257600080fd5b813573ffffffffffffffffffffffffffffffffffffffff81168114620004c757600080fd5b9392505050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b60005b838110156200051a57818101518382015260200162000500565b838111156200052a576000848401525b50505050565b6000602082840312156200054357600080fd5b815167ffffffffffffffff808211156200055c57600080fd5b818401915084601f8301126200057157600080fd5b815181811115620005865762000586620004ce565b604051601f82017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0908116603f01168101908382118183101715620005cf57620005cf620004ce565b81604052828152876020848701011115620005e957600080fd5b620005fc836020830160208801620004fd565b979650505050505050565b6000602082840312156200061a57600080fd5b815160ff81168114620004c757600080fd5b6000815180845262000646816020860160208601620004fd565b601f017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0169290920160200192915050565b6060815260006200068d60608301866200062c565b8281036020840152620006a181866200062c565b91505060ff83166040830152949350505050565b60008451620006c9818460208901620004fd565b845190830190620006df818360208901620004fd565b8451910190620006f4818360208801620004fd565b019594505050505056fe60806040523480156200001157600080fd5b50604051620025c6380380620025c6833981016040819052620000349162000623565b8251839083906200004d906003906020850190620004b0565b50805162000063906004906020840190620004b0565b50506006805460ff191660ff8416179055506200008360008033620000b5565b620000a060015b6040805160008082526020820190925262000206565b620000ac60026200008a565b5050506200073b565b826000808281526005602052604090206001015460ff166002811115620000e057620000e0620006a8565b14620001335760405162461bcd60e51b815260206004820152601e60248201527f43616e6e6f74207573652061207072652d6578697374696e6720726f6c65000060448201526064015b60405180910390fd5b60008481526005602052604090206001808201805460ff1916828002179055508381556200017160028201846200034d602090811b620011d917901c565b60008481526005602052604081206001015460ff1660028111156200019a576200019a620006a8565b1415620001ff5760405162461bcd60e51b815260206004820152603c6024820152600080516020620025a683398151915260448201527f20746f206d616e61676520616e206578636c757369766520726f6c650000000060648201526084016200012a565b5050505050565b826000808281526005602052604090206001015460ff166002811115620002315762000231620006a8565b14620002805760405162461bcd60e51b815260206004820152601e60248201527f43616e6e6f74207573652061207072652d6578697374696e6720726f6c65000060448201526064016200012a565b600084815260056020908152604090912060018101805460ff1916600217905584815590620002bf9060038301908590620011e36200035d821b17901c565b60008481526005602052604081206001015460ff166002811115620002e857620002e8620006a8565b1415620001ff5760405162461bcd60e51b81526020600482015260386024820152600080516020620025a683398151915260448201527f20746f206d616e61676520612073686172656420726f6c65000000000000000060648201526084016200012a565b620003598282620003b2565b5050565b60005b8151811015620003ad576200039883838381518110620003845762000384620006be565b60200260200101516200043360201b60201c565b80620003a481620006d4565b91505062000360565b505050565b6001600160a01b038116620004165760405162461bcd60e51b815260206004820152602360248201527f43616e6e6f742073657420616e206578636c757369766520726f6c6520746f2060448201526203078360ec1b60648201526084016200012a565b81546001600160a01b0319166001600160a01b0391909116179055565b6001600160a01b0381166200048b5760405162461bcd60e51b815260206004820152601f60248201527f43616e6e6f74206164642030783020746f20612073686172656420726f6c650060448201526064016200012a565b6001600160a01b0316600090815260209190915260409020805460ff19166001179055565b828054620004be90620006fe565b90600052602060002090601f016020900481019282620004e257600085556200052d565b82601f10620004fd57805160ff19168380011785556200052d565b828001600101855582156200052d579182015b828111156200052d57825182559160200191906001019062000510565b506200053b9291506200053f565b5090565b5b808211156200053b576000815560010162000540565b634e487b7160e01b600052604160045260246000fd5b600082601f8301126200057e57600080fd5b81516001600160401b03808211156200059b576200059b62000556565b604051601f8301601f19908116603f01168101908282118183101715620005c657620005c662000556565b81604052838152602092508683858801011115620005e357600080fd5b600091505b83821015620006075785820183015181830184015290820190620005e8565b83821115620006195760008385830101525b9695505050505050565b6000806000606084860312156200063957600080fd5b83516001600160401b03808211156200065157600080fd5b6200065f878388016200056c565b945060208601519150808211156200067657600080fd5b5062000685868287016200056c565b925050604084015160ff811681146200069d57600080fd5b809150509250925092565b634e487b7160e01b600052602160045260246000fd5b634e487b7160e01b600052603260045260246000fd5b6000600019821415620006f757634e487b7160e01b600052601160045260246000fd5b5060010190565b600181811c908216806200071357607f821691505b602082108114156200073557634e487b7160e01b600052602260045260246000fd5b50919050565b611e5b806200074b6000396000f3fe608060405234801561001057600080fd5b506004361061018d5760003560e01c806374d0a676116100e3578063a9059cbb1161008c578063d97c05be11610066578063d97c05be14610369578063dd62ed3e1461037c578063f44637ba146103c257600080fd5b8063a9059cbb1461030b578063aaa14ca31461031e578063ab3545e51461033157600080fd5b806395d89b41116100bd57806395d89b41146102dd578063983b2d56146102e5578063a457c2d7146102f857600080fd5b806374d0a676146102a457806379cc6790146102b75780637cdc1cb9146102ca57600080fd5b806339509351116101455780636be7658b1161011f5780636be7658b1461024857806370a082311461025b57806373cc802a1461029157600080fd5b8063395093511461020d57806340c10f191461022057806342966c681461023357600080fd5b806318160ddd1161017657806318160ddd146101d357806323b872dd146101e5578063313ce567146101f857600080fd5b806306fdde0314610192578063095ea7b3146101b0575b600080fd5b61019a6103d5565b6040516101a79190611b4f565b60405180910390f35b6101c36101be366004611beb565b610467565b60405190151581526020016101a7565b6002545b6040519081526020016101a7565b6101c36101f3366004611c15565b61047e565b60065460405160ff90911681526020016101a7565b6101c361021b366004611beb565b610569565b6101c361022e366004611beb565b6105b2565b610246610241366004611c51565b610660565b005b610246610256366004611c6a565b610706565b6101d7610269366004611c96565b73ffffffffffffffffffffffffffffffffffffffff1660009081526020819052604090205490565b61024661029f366004611c96565b6108ed565b6102466102b2366004611c6a565b6108fb565b6101c36102c5366004611beb565b610abd565b6101c36102d8366004611c6a565b610b61565b61019a610c6b565b6102466102f3366004611c96565b610c7a565b6101c3610306366004611beb565b610c86565b6101c3610319366004611beb565b610d54565b61024661032c366004611c51565b610d61565b61034461033f366004611c51565b610f24565b60405173ffffffffffffffffffffffffffffffffffffffff90911681526020016101a7565b610246610377366004611c6a565b61100d565b6101d761038a366004611cb8565b73ffffffffffffffffffffffffffffffffffffffff918216600090815260016020908152604080832093909416825291909152205490565b6102466103d0366004611c96565b6111cf565b6060600380546103e490611ce2565b80601f016020809104026020016040519081016040528092919081815260200182805461041090611ce2565b801561045d5780601f106104325761010080835404028352916020019161045d565b820191906000526020600020905b81548152906001019060200180831161044057829003601f168201915b5050505050905090565b6000610474338484611229565b5060015b92915050565b600061048b8484846113dc565b73ffffffffffffffffffffffffffffffffffffffff8416600090815260016020908152604080832033845290915290205482811015610551576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602860248201527f45524332303a207472616e7366657220616d6f756e742065786365656473206160448201527f6c6c6f77616e636500000000000000000000000000000000000000000000000060648201526084015b60405180910390fd5b61055e8533858403611229565b506001949350505050565b33600081815260016020908152604080832073ffffffffffffffffffffffffffffffffffffffff8716845290915281205490916104749185906105ad908690611d5f565b611229565b600060016105c08133610b61565b61064c576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602260248201527f53656e64657220646f6573206e6f7420686f6c6420726571756972656420726f60448201527f6c650000000000000000000000000000000000000000000000000000000000006064820152608401610548565b6106568484611690565b5060019392505050565b600261066c8133610b61565b6106f8576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602260248201527f53656e64657220646f6573206e6f7420686f6c6420726571756972656420726f60448201527f6c650000000000000000000000000000000000000000000000000000000000006064820152608401610548565b61070233836117b0565b5050565b81600260008281526005602052604090206001015460ff16600281111561072f5761072f611d77565b146107bc576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602c60248201527f4d7573742062652063616c6c6564206f6e20616e20696e697469616c697a656460448201527f2053686172656420726f6c6500000000000000000000000000000000000000006064820152608401610548565b60008381526005602052604090205483906107d79033610b61565b610862576040517f08c379a0000000000000000000000000000000000000000000000000000000008152602060048201526024808201527f43616e206f6e6c792062652063616c6c6564206279206120726f6c65206d616e60448201527f61676572000000000000000000000000000000000000000000000000000000006064820152608401610548565b600084815260056020908152604080832073ffffffffffffffffffffffffffffffffffffffff8716808552600390910190925280832080547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0016905551339287917feb3e33034c392e69263b04ec0fa376dc12784a41b6676c7f31b936cbc0fbb5af9190a450505050565b6108f860008261100d565b50565b81600260008281526005602052604090206001015460ff16600281111561092457610924611d77565b146109b1576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602c60248201527f4d7573742062652063616c6c6564206f6e20616e20696e697469616c697a656460448201527f2053686172656420726f6c6500000000000000000000000000000000000000006064820152608401610548565b60008381526005602052604090205483906109cc9033610b61565b610a57576040517f08c379a0000000000000000000000000000000000000000000000000000000008152602060048201526024808201527f43616e206f6e6c792062652063616c6c6564206279206120726f6c65206d616e60448201527f61676572000000000000000000000000000000000000000000000000000000006064820152608401610548565b6000848152600560205260409020610a72906003018461199d565b604051339073ffffffffffffffffffffffffffffffffffffffff85169086907f63502af7324ff6db91ab38f8236a648727d9385ea6c782073dd4882d8a61a48f90600090a450505050565b60006002610acb8133610b61565b610b57576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602260248201527f53656e64657220646f6573206e6f7420686f6c6420726571756972656420726f60448201527f6c650000000000000000000000000000000000000000000000000000000000006064820152608401610548565b61065684846117b0565b600082815260056020526040812060018082015460ff166002811115610b8957610b89611d77565b1415610bb857600281015473ffffffffffffffffffffffffffffffffffffffff8481169116145b915050610478565b6002600182015460ff166002811115610bd357610bd3611d77565b1415610c095773ffffffffffffffffffffffffffffffffffffffff8316600090815260038201602052604090205460ff16610bb0565b6040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152600e60248201527f496e76616c696420726f6c6549640000000000000000000000000000000000006044820152606401610548565b6060600480546103e490611ce2565b6108f860015b826108fb565b33600090815260016020908152604080832073ffffffffffffffffffffffffffffffffffffffff8616845290915281205482811015610d47576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602560248201527f45524332303a2064656372656173656420616c6c6f77616e63652062656c6f7760448201527f207a65726f0000000000000000000000000000000000000000000000000000006064820152608401610548565b6106563385858403611229565b60006104743384846113dc565b80600260008281526005602052604090206001015460ff166002811115610d8a57610d8a611d77565b14610e17576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602c60248201527f4d7573742062652063616c6c6564206f6e20616e20696e697469616c697a656460448201527f2053686172656420726f6c6500000000000000000000000000000000000000006064820152608401610548565b81610e228133610b61565b610eae576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602260248201527f53656e64657220646f6573206e6f7420686f6c6420726571756972656420726f60448201527f6c650000000000000000000000000000000000000000000000000000000000006064820152608401610548565b6000838152600560209081526040808320338452600301909152902080547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff001690556040513390819085907feb3e33034c392e69263b04ec0fa376dc12784a41b6676c7f31b936cbc0fbb5af90600090a4505050565b600081600160008281526005602052604090206001015460ff166002811115610f4f57610f4f611d77565b14610fdc576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602f60248201527f4d7573742062652063616c6c6564206f6e20616e20696e697469616c697a656460448201527f204578636c757369766520726f6c6500000000000000000000000000000000006064820152608401610548565b60008381526005602052604090206002015473ffffffffffffffffffffffffffffffffffffffff1691505b50919050565b81600160008281526005602052604090206001015460ff16600281111561103657611036611d77565b146110c3576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602f60248201527f4d7573742062652063616c6c6564206f6e20616e20696e697469616c697a656460448201527f204578636c757369766520726f6c6500000000000000000000000000000000006064820152608401610548565b60008381526005602052604090205483906110de9033610b61565b611169576040517f08c379a0000000000000000000000000000000000000000000000000000000008152602060048201526024808201527f43616e206f6e6c792062652063616c6c6564206279206120726f6c65206d616e60448201527f61676572000000000000000000000000000000000000000000000000000000006064820152608401610548565b60008481526005602052604090206111849060020184611a6a565b604051339073ffffffffffffffffffffffffffffffffffffffff85169086907f3b855c56b409b671c7112789d022675eb639d0bcb8896f1b6197c132f799e74690600090a450505050565b6108f86002610c80565b6107028282611a6a565b60005b8151811015611224576112128383838151811061120557611205611da6565b602002602001015161199d565b8061121c81611dd5565b9150506111e6565b505050565b73ffffffffffffffffffffffffffffffffffffffff83166112cb576040517f08c379a0000000000000000000000000000000000000000000000000000000008152602060048201526024808201527f45524332303a20617070726f76652066726f6d20746865207a65726f2061646460448201527f72657373000000000000000000000000000000000000000000000000000000006064820152608401610548565b73ffffffffffffffffffffffffffffffffffffffff821661136e576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602260248201527f45524332303a20617070726f766520746f20746865207a65726f20616464726560448201527f73730000000000000000000000000000000000000000000000000000000000006064820152608401610548565b73ffffffffffffffffffffffffffffffffffffffff83811660008181526001602090815260408083209487168084529482529182902085905590518481527f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925910160405180910390a3505050565b73ffffffffffffffffffffffffffffffffffffffff831661147f576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602560248201527f45524332303a207472616e736665722066726f6d20746865207a65726f20616460448201527f64726573730000000000000000000000000000000000000000000000000000006064820152608401610548565b73ffffffffffffffffffffffffffffffffffffffff8216611522576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602360248201527f45524332303a207472616e7366657220746f20746865207a65726f206164647260448201527f65737300000000000000000000000000000000000000000000000000000000006064820152608401610548565b73ffffffffffffffffffffffffffffffffffffffff8316600090815260208190526040902054818110156115d8576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602660248201527f45524332303a207472616e7366657220616d6f756e742065786365656473206260448201527f616c616e636500000000000000000000000000000000000000000000000000006064820152608401610548565b73ffffffffffffffffffffffffffffffffffffffff80851660009081526020819052604080822085850390559185168152908120805484929061161c908490611d5f565b925050819055508273ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef8460405161168291815260200190565b60405180910390a350505050565b73ffffffffffffffffffffffffffffffffffffffff821661170d576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601f60248201527f45524332303a206d696e7420746f20746865207a65726f2061646472657373006044820152606401610548565b806002600082825461171f9190611d5f565b909155505073ffffffffffffffffffffffffffffffffffffffff821660009081526020819052604081208054839290611759908490611d5f565b909155505060405181815273ffffffffffffffffffffffffffffffffffffffff8316906000907fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef9060200160405180910390a35050565b73ffffffffffffffffffffffffffffffffffffffff8216611853576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602160248201527f45524332303a206275726e2066726f6d20746865207a65726f2061646472657360448201527f73000000000000000000000000000000000000000000000000000000000000006064820152608401610548565b73ffffffffffffffffffffffffffffffffffffffff821660009081526020819052604090205481811015611909576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602260248201527f45524332303a206275726e20616d6f756e7420657863656564732062616c616e60448201527f63650000000000000000000000000000000000000000000000000000000000006064820152608401610548565b73ffffffffffffffffffffffffffffffffffffffff83166000908152602081905260408120838303905560028054849290611945908490611e0e565b909155505060405182815260009073ffffffffffffffffffffffffffffffffffffffff8516907fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef9060200160405180910390a3505050565b73ffffffffffffffffffffffffffffffffffffffff8116611a1a576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601f60248201527f43616e6e6f74206164642030783020746f20612073686172656420726f6c65006044820152606401610548565b73ffffffffffffffffffffffffffffffffffffffff1660009081526020919091526040902080547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff00166001179055565b73ffffffffffffffffffffffffffffffffffffffff8116611b0d576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602360248201527f43616e6e6f742073657420616e206578636c757369766520726f6c6520746f2060448201527f30783000000000000000000000000000000000000000000000000000000000006064820152608401610548565b81547fffffffffffffffffffffffff00000000000000000000000000000000000000001673ffffffffffffffffffffffffffffffffffffffff91909116179055565b600060208083528351808285015260005b81811015611b7c57858101830151858201604001528201611b60565b81811115611b8e576000604083870101525b50601f017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe016929092016040019392505050565b803573ffffffffffffffffffffffffffffffffffffffff81168114611be657600080fd5b919050565b60008060408385031215611bfe57600080fd5b611c0783611bc2565b946020939093013593505050565b600080600060608486031215611c2a57600080fd5b611c3384611bc2565b9250611c4160208501611bc2565b9150604084013590509250925092565b600060208284031215611c6357600080fd5b5035919050565b60008060408385031215611c7d57600080fd5b82359150611c8d60208401611bc2565b90509250929050565b600060208284031215611ca857600080fd5b611cb182611bc2565b9392505050565b60008060408385031215611ccb57600080fd5b611cd483611bc2565b9150611c8d60208401611bc2565b600181811c90821680611cf657607f821691505b60208210811415611007577f4e487b7100000000000000000000000000000000000000000000000000000000600052602260045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b60008219821115611d7257611d72611d30565b500190565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052602160045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b60007fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff821415611e0757611e07611d30565b5060010190565b600082821015611e2057611e20611d30565b50039056fea26469706673582212206711b075929f95fe84e8886d266c57cb729d320a6e18d9be873ebf48ca86bf8764736f6c634300080b0033417474656d7074656420746f2075736520616e20696e76616c696420726f6c65a26469706673582212208f4dfad5cf85f250d1f373171e32179d88acdd0fe441528253448fa05bbbe45464736f6c634300080b0033", - "devdoc": { - "kind": "dev", - "methods": {}, - "version": 1 - }, - "userdoc": { - "kind": "user", - "methods": {}, - "version": 1 - }, - "storageLayout": { - "storage": [], - "types": null - } -} diff --git a/deployments/arbitrum-rinkeby/solcInputs/a1881af3726e467ac35772874a89bba0.json b/deployments/arbitrum-rinkeby/solcInputs/a1881af3726e467ac35772874a89bba0.json deleted file mode 100644 index 9d0c51bba..000000000 --- a/deployments/arbitrum-rinkeby/solcInputs/a1881af3726e467ac35772874a89bba0.json +++ /dev/null @@ -1,195 +0,0 @@ -{ - "language": "Solidity", - "sources": { - "contracts/Arbitrum_SpokePool.sol": { - "content": "//SPDX-License-Identifier: Unlicense\r\npragma solidity ^0.8.0;\r\n\r\nimport \"./SpokePool.sol\";\r\nimport \"./SpokePoolInterface.sol\";\r\n\r\ninterface StandardBridgeLike {\r\n function outboundTransfer(\r\n address _l1Token,\r\n address _to,\r\n uint256 _amount,\r\n bytes calldata _data\r\n ) external payable returns (bytes memory);\r\n}\r\n\r\n/**\r\n * @notice AVM specific SpokePool.\r\n * @dev Uses AVM cross-domain-enabled logic for access control.\r\n */\r\n\r\ncontract Arbitrum_SpokePool is SpokePoolInterface, SpokePool {\r\n // Address of the Arbitrum L2 token gateway.\r\n address public l2GatewayRouter;\r\n\r\n // Admin controlled mapping of arbitrum tokens to L1 counterpart. L1 counterpart addresses\r\n // are neccessary to bridge tokens to L1.\r\n mapping(address => address) public whitelistedTokens;\r\n\r\n event ArbitrumTokensBridged(address indexed l1Token, address target, uint256 numberOfTokensBridged);\r\n event SetL2GatewayRouter(address indexed newL2GatewayRouter);\r\n event WhitelistedTokens(address indexed l2Token, address indexed l1Token);\r\n\r\n constructor(\r\n address _l2GatewayRouter,\r\n address _crossDomainAdmin,\r\n address _hubPool,\r\n address _wethAddress,\r\n address timerAddress\r\n ) SpokePool(_crossDomainAdmin, _hubPool, _wethAddress, timerAddress) {\r\n _setL2GatewayRouter(_l2GatewayRouter);\r\n }\r\n\r\n modifier onlyFromCrossDomainAdmin() {\r\n require(msg.sender == _applyL1ToL2Alias(crossDomainAdmin), \"ONLY_COUNTERPART_GATEWAY\");\r\n _;\r\n }\r\n\r\n /**************************************\r\n * CROSS-CHAIN ADMIN FUNCTIONS *\r\n **************************************/\r\n\r\n function setL2GatewayRouter(address newL2GatewayRouter) public onlyFromCrossDomainAdmin nonReentrant {\r\n _setL2GatewayRouter(newL2GatewayRouter);\r\n }\r\n\r\n function whitelistToken(address l2Token, address l1Token) public onlyFromCrossDomainAdmin nonReentrant {\r\n _whitelistToken(l2Token, l1Token);\r\n }\r\n\r\n function setCrossDomainAdmin(address newCrossDomainAdmin) public override onlyFromCrossDomainAdmin nonReentrant {\r\n _setCrossDomainAdmin(newCrossDomainAdmin);\r\n }\r\n\r\n function setHubPool(address newHubPool) public override onlyFromCrossDomainAdmin nonReentrant {\r\n _setHubPool(newHubPool);\r\n }\r\n\r\n function setEnableRoute(\r\n address originToken,\r\n uint256 destinationChainId,\r\n bool enable\r\n ) public override onlyFromCrossDomainAdmin nonReentrant {\r\n _setEnableRoute(originToken, destinationChainId, enable);\r\n }\r\n\r\n function setDepositQuoteTimeBuffer(uint32 buffer) public override onlyFromCrossDomainAdmin nonReentrant {\r\n _setDepositQuoteTimeBuffer(buffer);\r\n }\r\n\r\n function relayRootBundle(bytes32 relayerRefundRoot, bytes32 slowRelayFulfillmentRoot)\r\n public\r\n override\r\n onlyFromCrossDomainAdmin\r\n nonReentrant\r\n {\r\n _relayRootBundle(relayerRefundRoot, slowRelayFulfillmentRoot);\r\n }\r\n\r\n /**************************************\r\n * INTERNAL FUNCTIONS *\r\n **************************************/\r\n\r\n function _bridgeTokensToHubPool(RelayerRefundLeaf memory relayerRefundLeaf) internal override {\r\n StandardBridgeLike(l2GatewayRouter).outboundTransfer(\r\n whitelistedTokens[relayerRefundLeaf.l2TokenAddress], // _l1Token. Address of the L1 token to bridge over.\r\n hubPool, // _to. Withdraw, over the bridge, to the l1 hub pool contract.\r\n relayerRefundLeaf.amountToReturn, // _amount.\r\n \"\" // _data. We don't need to send any data for the bridging action.\r\n );\r\n emit ArbitrumTokensBridged(address(0), hubPool, relayerRefundLeaf.amountToReturn);\r\n }\r\n\r\n function _setL2GatewayRouter(address _l2GatewayRouter) internal {\r\n l2GatewayRouter = _l2GatewayRouter;\r\n emit SetL2GatewayRouter(l2GatewayRouter);\r\n }\r\n\r\n function _whitelistToken(address _l2Token, address _l1Token) internal {\r\n whitelistedTokens[_l2Token] = _l1Token;\r\n emit WhitelistedTokens(_l2Token, _l1Token);\r\n }\r\n\r\n // l1 addresses are transformed during l1->l2 calls. See https://developer.offchainlabs.com/docs/l1_l2_messages#address-aliasing for more information.\r\n function _applyL1ToL2Alias(address l1Address) internal pure returns (address l2Address) {\r\n unchecked {\r\n l2Address = address(uint160(l1Address) + uint160(0x1111000000000000000000000000000000001111));\r\n }\r\n }\r\n}\r\n" - }, - "contracts/SpokePool.sol": { - "content": "// SPDX-License-Identifier: GPL-3.0-only\r\npragma solidity ^0.8.0;\r\n\r\nimport \"./MerkleLib.sol\";\r\nimport \"./interfaces/WETH9.sol\";\r\n\r\nimport \"@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol\";\r\nimport \"@openzeppelin/contracts/token/ERC20/IERC20.sol\";\r\nimport \"@openzeppelin/contracts/utils/Address.sol\";\r\n\r\nimport \"@openzeppelin/contracts/utils/cryptography/SignatureChecker.sol\";\r\nimport \"@openzeppelin/contracts/utils/cryptography/ECDSA.sol\";\r\n\r\nimport \"@uma/core/contracts/common/implementation/Testable.sol\";\r\nimport \"@uma/core/contracts/common/implementation/Lockable.sol\";\r\nimport \"@uma/core/contracts/common/implementation/MultiCaller.sol\";\r\nimport \"./MerkleLib.sol\";\r\nimport \"./SpokePoolInterface.sol\";\r\n\r\n/**\r\n * @title SpokePool\r\n * @notice Contract deployed on source and destination chains enabling depositors to transfer assets from source to\r\n * destination. Deposit orders are fulfilled by off-chain relayers who also interact with this contract. Deposited\r\n * tokens are locked on the source chain and relayers send the recipient the desired token currency and amount\r\n * on the destination chain. Locked source chain tokens are later sent over the canonical token bridge to L1.\r\n * @dev This contract is designed to be deployed to L2's, not mainnet.\r\n */\r\nabstract contract SpokePool is SpokePoolInterface, Testable, Lockable, MultiCaller {\r\n using SafeERC20 for IERC20;\r\n using Address for address;\r\n\r\n // Address of the L1 contract that acts as the owner of this SpokePool.\r\n address public crossDomainAdmin;\r\n\r\n // Address of the L1 contract that will send tokens to and receive tokens from this contract.\r\n address public hubPool;\r\n\r\n // Address of WETH contract for this network. If an origin token matches this, then the caller can optionally\r\n // instruct this contract to wrap ETH when depositing.\r\n WETH9 public weth;\r\n\r\n // Timestamp when contract was constructed. Relays cannot have a quote time before this.\r\n uint32 public deploymentTime;\r\n\r\n // Any deposit quote times greater than or less than this value to the current contract time is blocked. Forces\r\n // caller to use an up to date realized fee. Defaults to 10 minutes.\r\n uint32 public depositQuoteTimeBuffer = 600;\r\n\r\n // Use count of deposits as unique deposit identifier.\r\n uint32 public numberOfDeposits;\r\n\r\n // Origin token to destination token routings can be turned on or off.\r\n mapping(address => mapping(uint256 => bool)) public enabledDepositRoutes;\r\n\r\n struct RootBundle {\r\n // Merkle root of slow relays that were not fully filled and whose recipient is still owed funds from the LP pool.\r\n bytes32 slowRelayFulfillmentRoot;\r\n // Merkle root of relayer refunds.\r\n bytes32 relayerRefundRoot;\r\n // This is a 2D bitmap tracking which leafs in the relayer refund root have been claimed, with max size of\r\n // 256x256 leaves per root.\r\n mapping(uint256 => uint256) claimedBitmap;\r\n }\r\n RootBundle[] public rootBundles;\r\n\r\n // Each relay is associated with the hash of parameters that uniquely identify the original deposit and a relay\r\n // attempt for that deposit. The relay itself is just represented as the amount filled so far. The total amount to\r\n // relay, the fees, and the agents are all parameters included in the hash key.\r\n mapping(bytes32 => uint256) public relayFills;\r\n\r\n /****************************************\r\n * EVENTS *\r\n ****************************************/\r\n event SetXDomainAdmin(address indexed newAdmin);\r\n event SetHubPool(address indexed newHubPool);\r\n event EnabledDepositRoute(address indexed originToken, uint256 indexed destinationChainId, bool enabled);\r\n event SetDepositQuoteTimeBuffer(uint32 newBuffer);\r\n event FundsDeposited(\r\n uint256 amount,\r\n uint256 destinationChainId,\r\n uint64 relayerFeePct,\r\n uint32 indexed depositId,\r\n uint32 quoteTimestamp,\r\n address indexed originToken,\r\n address recipient,\r\n address indexed depositor\r\n );\r\n event FilledRelay(\r\n bytes32 indexed relayHash,\r\n uint256 totalRelayAmount,\r\n uint256 totalFilledAmount,\r\n uint256 fillAmount,\r\n uint256 indexed repaymentChain,\r\n uint256 originChainId,\r\n uint64 relayerFeePct,\r\n uint64 realizedLpFeePct,\r\n uint32 depositId,\r\n address destinationToken,\r\n address indexed relayer,\r\n address depositor,\r\n address recipient\r\n );\r\n event ExecutedSlowRelayFulfillmentRoot(\r\n bytes32 indexed relayHash,\r\n uint256 totalRelayAmount,\r\n uint256 totalFilledAmount,\r\n uint256 fillAmount,\r\n uint256 originChainId,\r\n uint64 relayerFeePct,\r\n uint64 realizedLpFeePct,\r\n uint32 depositId,\r\n address destinationToken,\r\n address indexed caller,\r\n address depositor,\r\n address recipient\r\n );\r\n event RelayedRootBundle(uint32 indexed rootBundleId, bytes32 relayerRefundRoot, bytes32 slowRelayFulfillmentRoot);\r\n event ExecutedRelayerRefundRoot(\r\n uint256 amountToReturn,\r\n uint256 chainId,\r\n uint256[] refundAmounts,\r\n uint32 indexed rootBundleId,\r\n uint32 indexed leafId,\r\n address l2TokenAddress,\r\n address[] refundAddresses,\r\n address indexed caller\r\n );\r\n event TokensBridged(\r\n uint256 amountToReturn,\r\n uint256 indexed chainId,\r\n uint32 indexed leafId,\r\n address indexed l2TokenAddress,\r\n address caller\r\n );\r\n\r\n constructor(\r\n address _crossDomainAdmin,\r\n address _hubPool,\r\n address _wethAddress,\r\n address timerAddress\r\n ) Testable(timerAddress) {\r\n _setCrossDomainAdmin(_crossDomainAdmin);\r\n _setHubPool(_hubPool);\r\n deploymentTime = uint32(getCurrentTime());\r\n weth = WETH9(_wethAddress);\r\n }\r\n\r\n /****************************************\r\n * MODIFIERS *\r\n ****************************************/\r\n\r\n modifier onlyEnabledRoute(address originToken, uint256 destinationId) {\r\n require(enabledDepositRoutes[originToken][destinationId], \"Disabled route\");\r\n _;\r\n }\r\n\r\n /**************************************\r\n * ADMIN FUNCTIONS *\r\n **************************************/\r\n\r\n function _setCrossDomainAdmin(address newCrossDomainAdmin) internal {\r\n require(newCrossDomainAdmin != address(0), \"Bad bridge router address\");\r\n crossDomainAdmin = newCrossDomainAdmin;\r\n emit SetXDomainAdmin(crossDomainAdmin);\r\n }\r\n\r\n function _setHubPool(address newHubPool) internal {\r\n require(newHubPool != address(0), \"Bad hub pool address\");\r\n hubPool = newHubPool;\r\n emit SetHubPool(hubPool);\r\n }\r\n\r\n function _setEnableRoute(\r\n address originToken,\r\n uint256 destinationChainId,\r\n bool enabled\r\n ) internal {\r\n enabledDepositRoutes[originToken][destinationChainId] = enabled;\r\n emit EnabledDepositRoute(originToken, destinationChainId, enabled);\r\n }\r\n\r\n function _setDepositQuoteTimeBuffer(uint32 _depositQuoteTimeBuffer) internal {\r\n depositQuoteTimeBuffer = _depositQuoteTimeBuffer;\r\n emit SetDepositQuoteTimeBuffer(_depositQuoteTimeBuffer);\r\n }\r\n\r\n /**************************************\r\n * DEPOSITOR FUNCTIONS *\r\n **************************************/\r\n\r\n /**\r\n * @notice Called by user to bridge funds from origin to destination chain.\r\n * @dev The caller must first approve this contract to spend `amount` of `originToken`.\r\n */\r\n function deposit(\r\n address recipient,\r\n address originToken,\r\n uint256 amount,\r\n uint256 destinationChainId,\r\n uint64 relayerFeePct,\r\n uint32 quoteTimestamp\r\n ) public payable onlyEnabledRoute(originToken, destinationChainId) nonReentrant {\r\n // We limit the relay fees to prevent the user spending all their funds on fees.\r\n require(relayerFeePct <= 0.5e18, \"invalid relayer fee\");\r\n // Note We assume that L2 timing cannot be compared accurately and consistently to L1 timing. Therefore,\r\n // `block.timestamp` is different from the L1 EVM's. Therefore, the quoteTimestamp must be within a configurable\r\n // buffer to allow for this variance.\r\n // Note also that `quoteTimestamp` cannot be less than the buffer otherwise the following arithmetic can result\r\n // in underflow. This isn't a problem as the deposit will revert, but the error might be unexpected for clients.\r\n require(\r\n getCurrentTime() >= quoteTimestamp - depositQuoteTimeBuffer &&\r\n getCurrentTime() <= quoteTimestamp + depositQuoteTimeBuffer,\r\n \"invalid quote time\"\r\n );\r\n // If the address of the origin token is a WETH contract and there is a msg.value with the transaction\r\n // then the user is sending ETH. In this case, the ETH should be deposited to WETH.\r\n if (originToken == address(weth) && msg.value > 0) {\r\n require(msg.value == amount, \"msg.value must match amount\");\r\n weth.deposit{ value: msg.value }();\r\n } else {\r\n // Else, it is a normal ERC20. In this case pull the token from the users wallet as per normal.\r\n // Note: this includes the case where the L2 user has WETH (already wrapped ETH) and wants to bridge them. In\r\n // this case the msg.value will be set to 0, indicating a \"normal\" ERC20 bridging action.\r\n IERC20(originToken).safeTransferFrom(msg.sender, address(this), amount);\r\n }\r\n\r\n emit FundsDeposited(\r\n amount,\r\n destinationChainId,\r\n relayerFeePct,\r\n numberOfDeposits,\r\n quoteTimestamp,\r\n originToken,\r\n recipient,\r\n msg.sender\r\n );\r\n\r\n numberOfDeposits += 1;\r\n }\r\n\r\n /**************************************\r\n * RELAYER FUNCTIONS *\r\n **************************************/\r\n\r\n function fillRelay(\r\n address depositor,\r\n address recipient,\r\n address destinationToken,\r\n uint256 totalRelayAmount,\r\n uint256 maxTokensToSend,\r\n uint256 repaymentChain,\r\n uint256 originChainId,\r\n uint64 realizedLpFeePct,\r\n uint64 relayerFeePct,\r\n uint32 depositId\r\n ) public nonReentrant {\r\n // Each relay attempt is mapped to the hash of data uniquely identifying it, which includes the deposit data\r\n // such as the origin chain ID and the deposit ID, and the data in a relay attempt such as who the recipient\r\n // is, which chain and currency the recipient wants to receive funds on, and the relay fees.\r\n SpokePoolInterface.RelayData memory relayData = SpokePoolInterface.RelayData({\r\n depositor: depositor,\r\n recipient: recipient,\r\n destinationToken: destinationToken,\r\n relayAmount: totalRelayAmount,\r\n realizedLpFeePct: realizedLpFeePct,\r\n relayerFeePct: relayerFeePct,\r\n depositId: depositId,\r\n originChainId: originChainId\r\n });\r\n bytes32 relayHash = _getRelayHash(relayData);\r\n\r\n uint256 fillAmountPreFees = _fillRelay(relayHash, relayData, maxTokensToSend, relayerFeePct, false);\r\n\r\n _emitFillRelay(relayHash, fillAmountPreFees, repaymentChain, relayerFeePct, relayData);\r\n }\r\n\r\n function fillRelayWithUpdatedFee(\r\n address depositor,\r\n address recipient,\r\n address destinationToken,\r\n uint256 totalRelayAmount,\r\n uint256 maxTokensToSend,\r\n uint256 repaymentChain,\r\n uint256 originChainId,\r\n uint64 realizedLpFeePct,\r\n uint64 relayerFeePct,\r\n uint64 newRelayerFeePct,\r\n uint32 depositId,\r\n bytes memory depositorSignature\r\n ) public nonReentrant {\r\n // Grouping the signature validation logic into brackets to address stack too deep error.\r\n {\r\n // Depositor should have signed a hash of the relayer fee % to update to and information uniquely identifying\r\n // the deposit to relay. This ensures that this signature cannot be re-used for other deposits. The version\r\n // string is included as a precaution in case this contract is upgraded.\r\n // Note: we use encode instead of encodePacked because it is more secure, more in the \"warning\" section\r\n // here: https://docs.soliditylang.org/en/v0.8.11/abi-spec.html#non-standard-packed-mode\r\n bytes32 expectedDepositorMessageHash = keccak256(\r\n abi.encode(\"ACROSS-V2-FEE-1.0\", newRelayerFeePct, depositId, originChainId)\r\n );\r\n\r\n // Check the hash corresponding to the https://eth.wiki/json-rpc/API#eth_sign[`eth_sign`]\r\n // JSON-RPC method as part of EIP-191. We use OZ's signature checker library with adds support for\r\n // EIP-1271 which can verify messages signed by smart contract wallets like Argent and Gnosis safes.\r\n // If the depositor signed a message with a different updated fee (or any other param included in the\r\n // above keccak156 hash), then this will revert.\r\n bytes32 ethSignedMessageHash = ECDSA.toEthSignedMessageHash(expectedDepositorMessageHash);\r\n\r\n _verifyDepositorUpdateFeeMessage(depositor, ethSignedMessageHash, depositorSignature);\r\n }\r\n\r\n // Now follow the default `fillRelay` flow with the updated fee and the original relay hash.\r\n RelayData memory relayData = RelayData({\r\n depositor: depositor,\r\n recipient: recipient,\r\n destinationToken: destinationToken,\r\n relayAmount: totalRelayAmount,\r\n realizedLpFeePct: realizedLpFeePct,\r\n relayerFeePct: relayerFeePct,\r\n depositId: depositId,\r\n originChainId: originChainId\r\n });\r\n bytes32 relayHash = _getRelayHash(relayData);\r\n uint256 fillAmountPreFees = _fillRelay(relayHash, relayData, maxTokensToSend, newRelayerFeePct, false);\r\n\r\n _emitFillRelay(relayHash, fillAmountPreFees, repaymentChain, newRelayerFeePct, relayData);\r\n }\r\n\r\n /**************************************\r\n * DATA WORKER FUNCTIONS *\r\n **************************************/\r\n function executeSlowRelayFulfillmentRoot(\r\n address depositor,\r\n address recipient,\r\n address destinationToken,\r\n uint256 totalRelayAmount,\r\n uint256 originChainId,\r\n uint64 realizedLpFeePct,\r\n uint64 relayerFeePct,\r\n uint32 depositId,\r\n uint32 rootBundleId,\r\n bytes32[] memory proof\r\n ) public nonReentrant {\r\n RelayData memory relayData = RelayData({\r\n depositor: depositor,\r\n recipient: recipient,\r\n destinationToken: destinationToken,\r\n relayAmount: totalRelayAmount,\r\n originChainId: originChainId,\r\n realizedLpFeePct: realizedLpFeePct,\r\n relayerFeePct: relayerFeePct,\r\n depositId: depositId\r\n });\r\n\r\n require(\r\n MerkleLib.verifySlowRelayFulfillment(rootBundles[rootBundleId].slowRelayFulfillmentRoot, relayData, proof),\r\n \"Invalid proof\"\r\n );\r\n\r\n bytes32 relayHash = _getRelayHash(relayData);\r\n\r\n // Wrap any ETH owned by this contract so we can send expected L2 token to recipient. This is neccessary because\r\n // some SpokePools will receive ETH from the canonical token bridge instead of WETH so this contract\r\n // might have built up an ETH balance.\r\n if (address(this).balance > 0) weth.deposit{ value: address(this).balance }();\r\n\r\n // Note: use relayAmount as the max amount to send, so the relay is always completely filled by the contract's\r\n // funds in all cases.\r\n uint256 fillAmountPreFees = _fillRelay(relayHash, relayData, relayData.relayAmount, relayerFeePct, true);\r\n\r\n _emitExecutedSlowRelayFulfillmentRoot(relayHash, fillAmountPreFees, relayData);\r\n }\r\n\r\n function executeRelayerRefundRoot(\r\n uint32 rootBundleId,\r\n SpokePoolInterface.RelayerRefundLeaf memory relayerRefundLeaf,\r\n bytes32[] memory proof\r\n ) public nonReentrant {\r\n // Check integrity of leaf structure:\r\n require(relayerRefundLeaf.chainId == chainId(), \"Invalid chainId\");\r\n require(relayerRefundLeaf.refundAddresses.length == relayerRefundLeaf.refundAmounts.length, \"invalid leaf\");\r\n\r\n RootBundle storage rootBundle = rootBundles[rootBundleId];\r\n\r\n // Check that `inclusionProof` proves that `relayerRefundLeaf` is contained within the relayer refund root.\r\n // Note: This should revert if the `relayerRefundRoot` is uninitialized.\r\n require(MerkleLib.verifyRelayerRefund(rootBundle.relayerRefundRoot, relayerRefundLeaf, proof), \"Bad Proof\");\r\n\r\n // Verify the leafId in the leaf has not yet been claimed.\r\n require(!MerkleLib.isClaimed(rootBundle.claimedBitmap, relayerRefundLeaf.leafId), \"Already claimed\");\r\n\r\n // Set leaf as claimed in bitmap.\r\n MerkleLib.setClaimed(rootBundle.claimedBitmap, relayerRefundLeaf.leafId);\r\n\r\n // Wrap any ETH owned by this contract so we can send expected L2 token to recipient. This is neccessary because\r\n // some SpokePools will receive ETH from the canonical token bridge instead of WETH.\r\n if (address(this).balance > 0) weth.deposit{ value: address(this).balance }();\r\n\r\n // Send each relayer refund address the associated refundAmount for the L2 token address.\r\n // Note: Even if the L2 token is not enabled on this spoke pool, we should still refund relayers.\r\n for (uint32 i = 0; i < relayerRefundLeaf.refundAmounts.length; i++) {\r\n uint256 amount = relayerRefundLeaf.refundAmounts[i];\r\n if (amount > 0)\r\n IERC20(relayerRefundLeaf.l2TokenAddress).safeTransfer(relayerRefundLeaf.refundAddresses[i], amount);\r\n }\r\n\r\n // If leaf's `amountToReturn` is positive, then send L2 --> L1 message to bridge tokens back via\r\n // chain-specific bridging method.\r\n if (relayerRefundLeaf.amountToReturn > 0) {\r\n _bridgeTokensToHubPool(relayerRefundLeaf);\r\n\r\n emit TokensBridged(\r\n relayerRefundLeaf.amountToReturn,\r\n relayerRefundLeaf.chainId,\r\n relayerRefundLeaf.leafId,\r\n relayerRefundLeaf.l2TokenAddress,\r\n msg.sender\r\n );\r\n }\r\n\r\n emit ExecutedRelayerRefundRoot(\r\n relayerRefundLeaf.amountToReturn,\r\n relayerRefundLeaf.chainId,\r\n relayerRefundLeaf.refundAmounts,\r\n rootBundleId,\r\n relayerRefundLeaf.leafId,\r\n relayerRefundLeaf.l2TokenAddress,\r\n relayerRefundLeaf.refundAddresses,\r\n msg.sender\r\n );\r\n }\r\n\r\n /**************************************\r\n * VIEW FUNCTIONS *\r\n **************************************/\r\n\r\n // Some L2s like ZKSync don't support the CHAIN_ID opcode so we allow the caller to manually set this.\r\n function chainId() public view virtual returns (uint256) {\r\n return block.chainid;\r\n }\r\n\r\n /**************************************\r\n * INTERNAL FUNCTIONS *\r\n **************************************/\r\n\r\n function _bridgeTokensToHubPool(SpokePoolInterface.RelayerRefundLeaf memory relayerRefundLeaf) internal virtual;\r\n\r\n // Allow L2 to implement chain specific recovering of signers from signatures because some L2s might not support\r\n // ecrecover, such as those with account abstraction like ZKSync.\r\n function _verifyDepositorUpdateFeeMessage(\r\n address depositor,\r\n bytes32 ethSignedMessageHash,\r\n bytes memory depositorSignature\r\n ) internal view virtual {\r\n // Note: no need to worry about reentrancy from contract deployed at `depositor` address since\r\n // `SignatureChecker.isValidSignatureNow` is a non state-modifying STATICCALL:\r\n // - https://github.com/OpenZeppelin/openzeppelin-contracts/blob/63b466901fb015538913f811c5112a2775042177/contracts/utils/cryptography/SignatureChecker.sol#L35\r\n // - https://github.com/ethereum/EIPs/pull/214\r\n require(\r\n SignatureChecker.isValidSignatureNow(depositor, ethSignedMessageHash, depositorSignature),\r\n \"invalid signature\"\r\n );\r\n }\r\n\r\n function _computeAmountPreFees(uint256 amount, uint64 feesPct) private pure returns (uint256) {\r\n return (1e18 * amount) / (1e18 - feesPct);\r\n }\r\n\r\n function _computeAmountPostFees(uint256 amount, uint64 feesPct) private pure returns (uint256) {\r\n return (amount * (1e18 - feesPct)) / 1e18;\r\n }\r\n\r\n // Should we make this public for the relayer's convenience?\r\n function _getRelayHash(SpokePoolInterface.RelayData memory relayData) private pure returns (bytes32) {\r\n return keccak256(abi.encode(relayData));\r\n }\r\n\r\n // Unwraps ETH and does a transfer to a recipient address. If the recipient is a smart contract then sends WETH.\r\n function _unwrapWETHTo(address payable to, uint256 amount) internal {\r\n if (address(to).isContract()) {\r\n IERC20(address(weth)).safeTransfer(to, amount);\r\n } else {\r\n weth.withdraw(amount);\r\n to.transfer(amount);\r\n }\r\n }\r\n\r\n // This internal method should be called by an external \"relayRootBundle\" function that validates the\r\n // cross domain sender is the HubPool. This validation step differs for each L2, which is why the implementation\r\n // specifics are left to the implementor of this abstract contract.\r\n // Once this method is executed and a distribution root is stored in this contract, then `distributeRootBundle`\r\n // can be called to execute each leaf in the root.\r\n function _relayRootBundle(bytes32 relayerRefundRoot, bytes32 slowRelayFulfillmentRoot) internal {\r\n uint32 rootBundleId = uint32(rootBundles.length);\r\n RootBundle storage rootBundle = rootBundles.push();\r\n rootBundle.relayerRefundRoot = relayerRefundRoot;\r\n rootBundle.slowRelayFulfillmentRoot = slowRelayFulfillmentRoot;\r\n emit RelayedRootBundle(rootBundleId, relayerRefundRoot, slowRelayFulfillmentRoot);\r\n }\r\n\r\n function _fillRelay(\r\n bytes32 relayHash,\r\n RelayData memory relayData,\r\n uint256 maxTokensToSend,\r\n uint64 updatableRelayerFeePct,\r\n bool isSlowRelay\r\n ) internal returns (uint256 fillAmountPreFees) {\r\n // We limit the relay fees to prevent the user spending all their funds on fees. Note that 0.5e18 (i.e. 50%)\r\n // fees are just magic numbers. The important point is to prevent the total fee from being 100%, otherwise\r\n // computing the amount pre fees runs into divide-by-0 issues.\r\n require(updatableRelayerFeePct < 0.5e18 && relayData.realizedLpFeePct < 0.5e18, \"invalid fees\");\r\n\r\n // Check that the relay has not already been completely filled. Note that the `relays` mapping will point to\r\n // the amount filled so far for a particular `relayHash`, so this will start at 0 and increment with each fill.\r\n require(relayFills[relayHash] < relayData.relayAmount, \"relay filled\");\r\n\r\n // Stores the equivalent amount to be sent by the relayer before fees have been taken out.\r\n fillAmountPreFees = 0;\r\n\r\n // Adding brackets \"stack too deep\" solidity error.\r\n if (maxTokensToSend > 0) {\r\n fillAmountPreFees = _computeAmountPreFees(\r\n maxTokensToSend,\r\n (relayData.realizedLpFeePct + updatableRelayerFeePct)\r\n );\r\n // If user's specified max amount to send is greater than the amount of the relay remaining pre-fees,\r\n // we'll pull exactly enough tokens to complete the relay.\r\n uint256 amountToSend = maxTokensToSend;\r\n if (relayData.relayAmount - relayFills[relayHash] < fillAmountPreFees) {\r\n fillAmountPreFees = relayData.relayAmount - relayFills[relayHash];\r\n amountToSend = _computeAmountPostFees(\r\n fillAmountPreFees,\r\n relayData.realizedLpFeePct + updatableRelayerFeePct\r\n );\r\n }\r\n relayFills[relayHash] += fillAmountPreFees;\r\n // If relay token is weth then unwrap and send eth.\r\n if (relayData.destinationToken == address(weth)) {\r\n // Note: WETH is already in the contract in the slow relay case.\r\n if (!isSlowRelay)\r\n IERC20(relayData.destinationToken).safeTransferFrom(msg.sender, address(this), amountToSend);\r\n _unwrapWETHTo(payable(relayData.recipient), amountToSend);\r\n // Else, this is a normal ERC20 token. Send to recipient.\r\n } else {\r\n // Note: send token directly from the contract to the user in the slow relay case.\r\n if (!isSlowRelay)\r\n IERC20(relayData.destinationToken).safeTransferFrom(msg.sender, relayData.recipient, amountToSend);\r\n else IERC20(relayData.destinationToken).safeTransfer(relayData.recipient, amountToSend);\r\n }\r\n }\r\n }\r\n\r\n function _emitFillRelay(\r\n bytes32 relayHash,\r\n uint256 fillAmount,\r\n uint256 repaymentChain,\r\n uint64 relayerFeePct,\r\n RelayData memory relayData\r\n ) internal {\r\n emit FilledRelay(\r\n relayHash,\r\n relayData.relayAmount,\r\n relayFills[relayHash],\r\n fillAmount,\r\n repaymentChain,\r\n relayData.originChainId,\r\n relayerFeePct,\r\n relayData.realizedLpFeePct,\r\n relayData.depositId,\r\n relayData.destinationToken,\r\n msg.sender,\r\n relayData.depositor,\r\n relayData.recipient\r\n );\r\n }\r\n\r\n function _emitExecutedSlowRelayFulfillmentRoot(\r\n bytes32 relayHash,\r\n uint256 fillAmount,\r\n RelayData memory relayData\r\n ) internal {\r\n emit ExecutedSlowRelayFulfillmentRoot(\r\n relayHash,\r\n relayData.relayAmount,\r\n relayFills[relayHash],\r\n fillAmount,\r\n relayData.originChainId,\r\n relayData.relayerFeePct,\r\n relayData.realizedLpFeePct,\r\n relayData.depositId,\r\n relayData.destinationToken,\r\n msg.sender,\r\n relayData.depositor,\r\n relayData.recipient\r\n );\r\n }\r\n\r\n // Added to enable the this contract to receive ETH. Used when unwrapping Weth.\r\n receive() external payable {}\r\n}\r\n" - }, - "contracts/SpokePoolInterface.sol": { - "content": "//SPDX-License-Identifier: Unlicense\r\npragma solidity ^0.8.0;\r\n\r\ninterface SpokePoolInterface {\r\n // This leaf is meant to be decoded in the SpokePool in order to pay out individual relayers for this bundle.\r\n struct RelayerRefundLeaf {\r\n // This is the amount to return to the HubPool. This occurs when there is a PoolRebalanceLeaf netSendAmount that is\r\n // negative. This is just that value inverted.\r\n uint256 amountToReturn;\r\n // Used to verify that this is being decoded on the correct chainId.\r\n uint256 chainId;\r\n // This array designates how much each of those addresses should be refunded.\r\n uint256[] refundAmounts;\r\n // Used as the index in the bitmap to track whether this leaf has been executed or not.\r\n uint32 leafId;\r\n // The associated L2TokenAddress that these claims apply to.\r\n address l2TokenAddress;\r\n // These two arrays must be the same length and are parallel arrays. They should be order by refundAddresses.\r\n // This array designates each address that must be refunded.\r\n address[] refundAddresses;\r\n }\r\n\r\n // This struct represents the data to fully-specify a relay. If any portion of this data differs, the relay is\r\n // considered to be completely distinct. Only one relay for a particular depositId, chainId pair should be\r\n // considered valid and repaid.\r\n struct RelayData {\r\n // The address that made the deposit on the origin chain.\r\n address depositor;\r\n // The recipient address on the destination chain.\r\n address recipient;\r\n // The corresponding token address on the destination chain.\r\n address destinationToken;\r\n // The total relay amount before fees are taken out.\r\n uint256 relayAmount;\r\n // Origin chain id.\r\n uint256 originChainId;\r\n // The LP Fee percentage computed by the relayer based on the deposit's quote timestamp\r\n // and the HubPool's utilization.\r\n uint64 realizedLpFeePct;\r\n // The relayer fee percentage specified in the deposit.\r\n uint64 relayerFeePct;\r\n // The id uniquely identifying this deposit on the origin chain.\r\n uint32 depositId;\r\n }\r\n\r\n function setCrossDomainAdmin(address newCrossDomainAdmin) external;\r\n\r\n function setHubPool(address newHubPool) external;\r\n\r\n function setEnableRoute(\r\n address originToken,\r\n uint256 destinationChainId,\r\n bool enable\r\n ) external;\r\n\r\n function setDepositQuoteTimeBuffer(uint32 buffer) external;\r\n\r\n function relayRootBundle(bytes32 relayerRefundRoot, bytes32 slowRelayRoot) external;\r\n}\r\n" - }, - "contracts/MerkleLib.sol": { - "content": "// SPDX-License-Identifier: GPL-3.0-only\r\npragma solidity ^0.8.0;\r\n\r\nimport \"@openzeppelin/contracts/utils/cryptography/MerkleProof.sol\";\r\nimport \"./SpokePoolInterface.sol\";\r\nimport \"./HubPoolInterface.sol\";\r\n\r\n/**\r\n * @notice Library to help with merkle roots, proofs, and claims.\r\n */\r\nlibrary MerkleLib {\r\n /**\r\n * @notice Verifies that a repayment is contained within a merkle root.\r\n * @param root the merkle root.\r\n * @param rebalance the rebalance struct.\r\n * @param proof the merkle proof.\r\n */\r\n function verifyPoolRebalance(\r\n bytes32 root,\r\n HubPoolInterface.PoolRebalanceLeaf memory rebalance,\r\n bytes32[] memory proof\r\n ) internal pure returns (bool) {\r\n return MerkleProof.verify(proof, root, keccak256(abi.encode(rebalance)));\r\n }\r\n\r\n /**\r\n * @notice Verifies that a relayer refund is contained within a merkle root.\r\n * @param root the merkle root.\r\n * @param refund the refund struct.\r\n * @param proof the merkle proof.\r\n */\r\n function verifyRelayerRefund(\r\n bytes32 root,\r\n SpokePoolInterface.RelayerRefundLeaf memory refund,\r\n bytes32[] memory proof\r\n ) internal pure returns (bool) {\r\n return MerkleProof.verify(proof, root, keccak256(abi.encode(refund)));\r\n }\r\n\r\n /**\r\n * @notice Verifies that a distribution is contained within a merkle root.\r\n * @param root the merkle root.\r\n * @param slowRelayFulfillment the relayData fulfullment struct.\r\n * @param proof the merkle proof.\r\n */\r\n function verifySlowRelayFulfillment(\r\n bytes32 root,\r\n SpokePoolInterface.RelayData memory slowRelayFulfillment,\r\n bytes32[] memory proof\r\n ) internal pure returns (bool) {\r\n return MerkleProof.verify(proof, root, keccak256(abi.encode(slowRelayFulfillment)));\r\n }\r\n\r\n // The following functions are primarily copied from\r\n // https://github.com/Uniswap/merkle-distributor/blob/master/contracts/MerkleDistributor.sol with minor changes.\r\n\r\n /**\r\n * @notice Tests whether a claim is contained within a claimedBitMap mapping.\r\n * @param claimedBitMap a simple uint256 mapping in storage used as a bitmap.\r\n * @param index the index to check in the bitmap.\r\n * @return bool indicating if the index within the claimedBitMap has been marked as claimed.\r\n */\r\n function isClaimed(mapping(uint256 => uint256) storage claimedBitMap, uint256 index) internal view returns (bool) {\r\n uint256 claimedWordIndex = index / 256;\r\n uint256 claimedBitIndex = index % 256;\r\n uint256 claimedWord = claimedBitMap[claimedWordIndex];\r\n uint256 mask = (1 << claimedBitIndex);\r\n return claimedWord & mask == mask;\r\n }\r\n\r\n /**\r\n * @notice Marks an index in a claimedBitMap as claimed.\r\n * @param claimedBitMap a simple uint256 mapping in storage used as a bitmap.\r\n * @param index the index to mark in the bitmap.\r\n */\r\n function setClaimed(mapping(uint256 => uint256) storage claimedBitMap, uint256 index) internal {\r\n uint256 claimedWordIndex = index / 256;\r\n uint256 claimedBitIndex = index % 256;\r\n claimedBitMap[claimedWordIndex] = claimedBitMap[claimedWordIndex] | (1 << claimedBitIndex);\r\n }\r\n\r\n /**\r\n * @notice Tests whether a claim is contained within a 1D claimedBitMap mapping.\r\n * @param claimedBitMap a simple uint256 value, encoding a 1D bitmap.\r\n * @param index the index to check in the bitmap.\r\n \\* @return bool indicating if the index within the claimedBitMap has been marked as claimed.\r\n */\r\n function isClaimed1D(uint256 claimedBitMap, uint256 index) internal pure returns (bool) {\r\n uint256 mask = (1 << index);\r\n return claimedBitMap & mask == mask;\r\n }\r\n\r\n /**\r\n * @notice Marks an index in a claimedBitMap as claimed.\r\n * @param claimedBitMap a simple uint256 mapping in storage used as a bitmap.\r\n * @param index the index to mark in the bitmap.\r\n */\r\n function setClaimed1D(uint256 claimedBitMap, uint256 index) internal pure returns (uint256) {\r\n require(index <= 255, \"Index out of bounds\");\r\n return claimedBitMap | (1 << index % 256);\r\n }\r\n}\r\n" - }, - "contracts/interfaces/WETH9.sol": { - "content": "// SPDX-License-Identifier: GPL-3.0-only\r\npragma solidity ^0.8.0;\r\n\r\ninterface WETH9 {\r\n function withdraw(uint256 wad) external;\r\n\r\n function deposit() external payable;\r\n\r\n function balanceOf(address guy) external view returns (uint256 wad);\r\n\r\n function transfer(address guy, uint256 wad) external;\r\n}\r\n" - }, - "@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol": { - "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts v4.4.1 (token/ERC20/utils/SafeERC20.sol)\n\npragma solidity ^0.8.0;\n\nimport \"../IERC20.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 function safeTransfer(\n IERC20 token,\n address to,\n uint256 value\n ) internal {\n _callOptionalReturn(token, abi.encodeWithSelector(token.transfer.selector, to, value));\n }\n\n function safeTransferFrom(\n IERC20 token,\n address from,\n address to,\n uint256 value\n ) 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(\n IERC20 token,\n address spender,\n uint256 value\n ) 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 function safeIncreaseAllowance(\n IERC20 token,\n address spender,\n uint256 value\n ) internal {\n uint256 newAllowance = token.allowance(address(this), spender) + value;\n _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, newAllowance));\n }\n\n function safeDecreaseAllowance(\n IERC20 token,\n address spender,\n uint256 value\n ) internal {\n unchecked {\n uint256 oldAllowance = token.allowance(address(this), spender);\n require(oldAllowance >= value, \"SafeERC20: decreased allowance below zero\");\n uint256 newAllowance = oldAllowance - value;\n _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, newAllowance));\n }\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 if (returndata.length > 0) {\n // Return data is optional\n require(abi.decode(returndata, (bool)), \"SafeERC20: ERC20 operation did not succeed\");\n }\n }\n}\n" - }, - "@openzeppelin/contracts/token/ERC20/IERC20.sol": { - "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts v4.4.1 (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 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 `recipient`.\n *\n * Returns a boolean value indicating whether the operation succeeded.\n *\n * Emits a {Transfer} event.\n */\n function transfer(address recipient, 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 `sender` to `recipient` 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(\n address sender,\n address recipient,\n uint256 amount\n ) external returns (bool);\n\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" - }, - "@openzeppelin/contracts/utils/Address.sol": { - "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts v4.4.1 (utils/Address.sol)\n\npragma solidity ^0.8.0;\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 */\n function isContract(address account) internal view returns (bool) {\n // This method relies on extcodesize, which returns 0 for contracts in\n // construction, since the code is only stored at the end of the\n // constructor execution.\n\n uint256 size;\n assembly {\n size := extcodesize(account)\n }\n return size > 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://diligence.consensys.net/posts/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.5.11/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 functionCall(target, data, \"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(\n address target,\n bytes memory data,\n uint256 value\n ) 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 require(isContract(target), \"Address: call to non-contract\");\n\n (bool success, bytes memory returndata) = target.call{value: value}(data);\n return verifyCallResult(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 require(isContract(target), \"Address: static call to non-contract\");\n\n (bool success, bytes memory returndata) = target.staticcall(data);\n return verifyCallResult(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 require(isContract(target), \"Address: delegate call to non-contract\");\n\n (bool success, bytes memory returndata) = target.delegatecall(data);\n return verifyCallResult(success, returndata, errorMessage);\n }\n\n /**\n * @dev Tool to verifies that a low level call was successful, and revert if it wasn't, either by bubbling the\n * revert reason 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 // 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\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}\n" - }, - "@openzeppelin/contracts/utils/cryptography/SignatureChecker.sol": { - "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts v4.4.1 (utils/cryptography/SignatureChecker.sol)\n\npragma solidity ^0.8.0;\n\nimport \"./ECDSA.sol\";\nimport \"../Address.sol\";\nimport \"../../interfaces/IERC1271.sol\";\n\n/**\n * @dev Signature verification helper: Provide a single mechanism to verify both private-key (EOA) ECDSA signature and\n * ERC1271 contract signatures. Using this instead of ECDSA.recover in your contract will make them compatible with\n * smart contract wallets such as Argent and Gnosis.\n *\n * Note: unlike ECDSA signatures, contract signature's are revocable, and the outcome of this function can thus change\n * through time. It could return true at block N and false at block N+1 (or the opposite).\n *\n * _Available since v4.1._\n */\nlibrary SignatureChecker {\n function isValidSignatureNow(\n address signer,\n bytes32 hash,\n bytes memory signature\n ) internal view returns (bool) {\n (address recovered, ECDSA.RecoverError error) = ECDSA.tryRecover(hash, signature);\n if (error == ECDSA.RecoverError.NoError && recovered == signer) {\n return true;\n }\n\n (bool success, bytes memory result) = signer.staticcall(\n abi.encodeWithSelector(IERC1271.isValidSignature.selector, hash, signature)\n );\n return (success && result.length == 32 && abi.decode(result, (bytes4)) == IERC1271.isValidSignature.selector);\n }\n}\n" - }, - "@openzeppelin/contracts/utils/cryptography/ECDSA.sol": { - "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts v4.4.1 (utils/cryptography/ECDSA.sol)\n\npragma solidity ^0.8.0;\n\nimport \"../Strings.sol\";\n\n/**\n * @dev Elliptic Curve Digital Signature Algorithm (ECDSA) operations.\n *\n * These functions can be used to verify that a message was signed by the holder\n * of the private keys of a given address.\n */\nlibrary ECDSA {\n enum RecoverError {\n NoError,\n InvalidSignature,\n InvalidSignatureLength,\n InvalidSignatureS,\n InvalidSignatureV\n }\n\n function _throwError(RecoverError error) private pure {\n if (error == RecoverError.NoError) {\n return; // no error: do nothing\n } else if (error == RecoverError.InvalidSignature) {\n revert(\"ECDSA: invalid signature\");\n } else if (error == RecoverError.InvalidSignatureLength) {\n revert(\"ECDSA: invalid signature length\");\n } else if (error == RecoverError.InvalidSignatureS) {\n revert(\"ECDSA: invalid signature 's' value\");\n } else if (error == RecoverError.InvalidSignatureV) {\n revert(\"ECDSA: invalid signature 'v' value\");\n }\n }\n\n /**\n * @dev Returns the address that signed a hashed message (`hash`) with\n * `signature` or error string. This address can then be used for verification purposes.\n *\n * The `ecrecover` EVM opcode allows for malleable (non-unique) signatures:\n * this function rejects them by requiring the `s` value to be in the lower\n * half order, and the `v` value to be either 27 or 28.\n *\n * IMPORTANT: `hash` _must_ be the result of a hash operation for the\n * verification to be secure: it is possible to craft signatures that\n * recover to arbitrary addresses for non-hashed data. A safe way to ensure\n * this is by receiving a hash of the original message (which may otherwise\n * be too long), and then calling {toEthSignedMessageHash} on it.\n *\n * Documentation for signature generation:\n * - with https://web3js.readthedocs.io/en/v1.3.4/web3-eth-accounts.html#sign[Web3.js]\n * - with https://docs.ethers.io/v5/api/signer/#Signer-signMessage[ethers]\n *\n * _Available since v4.3._\n */\n function tryRecover(bytes32 hash, bytes memory signature) internal pure returns (address, RecoverError) {\n // Check the signature length\n // - case 65: r,s,v signature (standard)\n // - case 64: r,vs signature (cf https://eips.ethereum.org/EIPS/eip-2098) _Available since v4.1._\n if (signature.length == 65) {\n bytes32 r;\n bytes32 s;\n uint8 v;\n // ecrecover takes the signature parameters, and the only way to get them\n // currently is to use assembly.\n assembly {\n r := mload(add(signature, 0x20))\n s := mload(add(signature, 0x40))\n v := byte(0, mload(add(signature, 0x60)))\n }\n return tryRecover(hash, v, r, s);\n } else if (signature.length == 64) {\n bytes32 r;\n bytes32 vs;\n // ecrecover takes the signature parameters, and the only way to get them\n // currently is to use assembly.\n assembly {\n r := mload(add(signature, 0x20))\n vs := mload(add(signature, 0x40))\n }\n return tryRecover(hash, r, vs);\n } else {\n return (address(0), RecoverError.InvalidSignatureLength);\n }\n }\n\n /**\n * @dev Returns the address that signed a hashed message (`hash`) with\n * `signature`. This address can then be used for verification purposes.\n *\n * The `ecrecover` EVM opcode allows for malleable (non-unique) signatures:\n * this function rejects them by requiring the `s` value to be in the lower\n * half order, and the `v` value to be either 27 or 28.\n *\n * IMPORTANT: `hash` _must_ be the result of a hash operation for the\n * verification to be secure: it is possible to craft signatures that\n * recover to arbitrary addresses for non-hashed data. A safe way to ensure\n * this is by receiving a hash of the original message (which may otherwise\n * be too long), and then calling {toEthSignedMessageHash} on it.\n */\n function recover(bytes32 hash, bytes memory signature) internal pure returns (address) {\n (address recovered, RecoverError error) = tryRecover(hash, signature);\n _throwError(error);\n return recovered;\n }\n\n /**\n * @dev Overload of {ECDSA-tryRecover} that receives the `r` and `vs` short-signature fields separately.\n *\n * See https://eips.ethereum.org/EIPS/eip-2098[EIP-2098 short signatures]\n *\n * _Available since v4.3._\n */\n function tryRecover(\n bytes32 hash,\n bytes32 r,\n bytes32 vs\n ) internal pure returns (address, RecoverError) {\n bytes32 s;\n uint8 v;\n assembly {\n s := and(vs, 0x7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff)\n v := add(shr(255, vs), 27)\n }\n return tryRecover(hash, v, r, s);\n }\n\n /**\n * @dev Overload of {ECDSA-recover} that receives the `r and `vs` short-signature fields separately.\n *\n * _Available since v4.2._\n */\n function recover(\n bytes32 hash,\n bytes32 r,\n bytes32 vs\n ) internal pure returns (address) {\n (address recovered, RecoverError error) = tryRecover(hash, r, vs);\n _throwError(error);\n return recovered;\n }\n\n /**\n * @dev Overload of {ECDSA-tryRecover} that receives the `v`,\n * `r` and `s` signature fields separately.\n *\n * _Available since v4.3._\n */\n function tryRecover(\n bytes32 hash,\n uint8 v,\n bytes32 r,\n bytes32 s\n ) internal pure returns (address, RecoverError) {\n // EIP-2 still allows signature malleability for ecrecover(). Remove this possibility and make the signature\n // unique. Appendix F in the Ethereum Yellow paper (https://ethereum.github.io/yellowpaper/paper.pdf), defines\n // the valid range for s in (301): 0 < s < secp256k1n ÷ 2 + 1, and for v in (302): v ∈ {27, 28}. Most\n // signatures from current libraries generate a unique signature with an s-value in the lower half order.\n //\n // If your library generates malleable signatures, such as s-values in the upper range, calculate a new s-value\n // with 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFEBAAEDCE6AF48A03BBFD25E8CD0364141 - s1 and flip v from 27 to 28 or\n // vice versa. If your library also generates signatures with 0/1 for v instead 27/28, add 27 to v to accept\n // these malleable signatures as well.\n if (uint256(s) > 0x7FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF5D576E7357A4501DDFE92F46681B20A0) {\n return (address(0), RecoverError.InvalidSignatureS);\n }\n if (v != 27 && v != 28) {\n return (address(0), RecoverError.InvalidSignatureV);\n }\n\n // If the signature is valid (and not malleable), return the signer address\n address signer = ecrecover(hash, v, r, s);\n if (signer == address(0)) {\n return (address(0), RecoverError.InvalidSignature);\n }\n\n return (signer, RecoverError.NoError);\n }\n\n /**\n * @dev Overload of {ECDSA-recover} that receives the `v`,\n * `r` and `s` signature fields separately.\n */\n function recover(\n bytes32 hash,\n uint8 v,\n bytes32 r,\n bytes32 s\n ) internal pure returns (address) {\n (address recovered, RecoverError error) = tryRecover(hash, v, r, s);\n _throwError(error);\n return recovered;\n }\n\n /**\n * @dev Returns an Ethereum Signed Message, created from a `hash`. This\n * produces hash corresponding to the one signed with the\n * https://eth.wiki/json-rpc/API#eth_sign[`eth_sign`]\n * JSON-RPC method as part of EIP-191.\n *\n * See {recover}.\n */\n function toEthSignedMessageHash(bytes32 hash) internal pure returns (bytes32) {\n // 32 is the length in bytes of hash,\n // enforced by the type signature above\n return keccak256(abi.encodePacked(\"\\x19Ethereum Signed Message:\\n32\", hash));\n }\n\n /**\n * @dev Returns an Ethereum Signed Message, created from `s`. This\n * produces hash corresponding to the one signed with the\n * https://eth.wiki/json-rpc/API#eth_sign[`eth_sign`]\n * JSON-RPC method as part of EIP-191.\n *\n * See {recover}.\n */\n function toEthSignedMessageHash(bytes memory s) internal pure returns (bytes32) {\n return keccak256(abi.encodePacked(\"\\x19Ethereum Signed Message:\\n\", Strings.toString(s.length), s));\n }\n\n /**\n * @dev Returns an Ethereum Signed Typed Data, created from a\n * `domainSeparator` and a `structHash`. This produces hash corresponding\n * to the one signed with the\n * https://eips.ethereum.org/EIPS/eip-712[`eth_signTypedData`]\n * JSON-RPC method as part of EIP-712.\n *\n * See {recover}.\n */\n function toTypedDataHash(bytes32 domainSeparator, bytes32 structHash) internal pure returns (bytes32) {\n return keccak256(abi.encodePacked(\"\\x19\\x01\", domainSeparator, structHash));\n }\n}\n" - }, - "@uma/core/contracts/common/implementation/Testable.sol": { - "content": "// SPDX-License-Identifier: AGPL-3.0-only\npragma solidity ^0.8.0;\n\nimport \"./Timer.sol\";\n\n/**\n * @title Base class that provides time overrides, but only if being run in test mode.\n */\nabstract contract Testable {\n // If the contract is being run in production, then `timerAddress` will be the 0x0 address.\n // Note: this variable should be set on construction and never modified.\n address public timerAddress;\n\n /**\n * @notice Constructs the Testable contract. Called by child contracts.\n * @param _timerAddress Contract that stores the current time in a testing environment.\n * Must be set to 0x0 for production environments that use live time.\n */\n constructor(address _timerAddress) {\n timerAddress = _timerAddress;\n }\n\n /**\n * @notice Reverts if not running in test mode.\n */\n modifier onlyIfTest {\n require(timerAddress != address(0x0));\n _;\n }\n\n /**\n * @notice Sets the current time.\n * @dev Will revert if not running in test mode.\n * @param time timestamp to set current Testable time to.\n */\n function setCurrentTime(uint256 time) external onlyIfTest {\n Timer(timerAddress).setCurrentTime(time);\n }\n\n /**\n * @notice Gets the current time. Will return the last time set in `setCurrentTime` if running in test mode.\n * Otherwise, it will return the block timestamp.\n * @return uint for the current Testable timestamp.\n */\n function getCurrentTime() public view virtual returns (uint256) {\n if (timerAddress != address(0x0)) {\n return Timer(timerAddress).getCurrentTime();\n } else {\n return block.timestamp; // solhint-disable-line not-rely-on-time\n }\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" - }, - "@uma/core/contracts/common/implementation/MultiCaller.sol": { - "content": "// This contract is taken from Uniswaps'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.\npragma solidity ^0.8.0;\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 payable returns (bytes[] memory results) {\n require(msg.value == 0, \"Only multicall with 0 value\");\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" - }, - "@openzeppelin/contracts/utils/cryptography/MerkleProof.sol": { - "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts v4.4.1 (utils/cryptography/MerkleProof.sol)\n\npragma solidity ^0.8.0;\n\n/**\n * @dev These functions deal with verification of Merkle Trees proofs.\n *\n * The proofs can be generated using the JavaScript library\n * https://github.com/miguelmota/merkletreejs[merkletreejs].\n * Note: the hashing algorithm should be keccak256 and pair sorting should be enabled.\n *\n * See `test/utils/cryptography/MerkleProof.test.js` for some examples.\n */\nlibrary MerkleProof {\n /**\n * @dev Returns true if a `leaf` can be proved to be a part of a Merkle tree\n * defined by `root`. For this, a `proof` must be provided, containing\n * sibling hashes on the branch from the leaf to the root of the tree. Each\n * pair of leaves and each pair of pre-images are assumed to be sorted.\n */\n function verify(\n bytes32[] memory proof,\n bytes32 root,\n bytes32 leaf\n ) internal pure returns (bool) {\n return processProof(proof, leaf) == root;\n }\n\n /**\n * @dev Returns the rebuilt hash obtained by traversing a Merklee tree up\n * from `leaf` using `proof`. A `proof` is valid if and only if the rebuilt\n * hash matches the root of the tree. When processing the proof, the pairs\n * of leafs & pre-images are assumed to be sorted.\n *\n * _Available since v4.4._\n */\n function processProof(bytes32[] memory proof, bytes32 leaf) internal pure returns (bytes32) {\n bytes32 computedHash = leaf;\n for (uint256 i = 0; i < proof.length; i++) {\n bytes32 proofElement = proof[i];\n if (computedHash <= proofElement) {\n // Hash(current computed hash + current element of the proof)\n computedHash = keccak256(abi.encodePacked(computedHash, proofElement));\n } else {\n // Hash(current element of the proof + current computed hash)\n computedHash = keccak256(abi.encodePacked(proofElement, computedHash));\n }\n }\n return computedHash;\n }\n}\n" - }, - "contracts/HubPoolInterface.sol": { - "content": "// SPDX-License-Identifier: GPL-3.0-only\r\npragma solidity ^0.8.0;\r\n\r\nimport \"@openzeppelin/contracts/token/ERC20/IERC20.sol\";\r\nimport \"./interfaces/AdapterInterface.sol\";\r\n\r\ninterface HubPoolInterface {\r\n struct PoolRebalanceLeaf {\r\n // This is used to know which chain to send cross-chain transactions to (and which SpokePool to sent to).\r\n uint256 chainId;\r\n uint256[] bundleLpFees; // Total LP fee amount per token in this bundle, encompassing all associated bundled relays.\r\n // This array is grouped with the two above, and it represents the amount to send or request back from the\r\n // SpokePool. If positive, the pool will pay the SpokePool. If negative the SpokePool will pay the HubPool.\r\n // There can be arbitrarily complex rebalancing rules defined offchain. This number is only nonzero\r\n // when the rules indicate that a rebalancing action should occur. When a rebalance does not occur,\r\n // runningBalances for this token should change by the total relays - deposits in this bundle. When a rebalance\r\n // does occur, runningBalances should be set to zero for this token and the netSendAmounts should be set to the\r\n // previous runningBalances + relays - deposits in this bundle.\r\n int256[] netSendAmounts;\r\n // This is only here to be emitted in an event to track a running unpaid balance between the L2 pool and the L1 pool.\r\n // A positive number indicates that the HubPool owes the SpokePool funds. A negative number indicates that the\r\n // SpokePool owes the HubPool funds. See the comment above for the dynamics of this and netSendAmounts\r\n int256[] runningBalances;\r\n // Used as the index in the bitmap to track whether this leaf has been executed or not.\r\n uint8 leafId;\r\n // The following arrays are required to be the same length. They are parallel arrays for the given chainId and should be ordered by the `l1Tokens` field.\r\n // All whitelisted tokens with nonzero relays on this chain in this bundle in the order of whitelisting.\r\n address[] l1Tokens;\r\n }\r\n\r\n function setBond(IERC20 newBondToken, uint256 newBondAmount) external;\r\n\r\n function setCrossChainContracts(\r\n uint256 l2ChainId,\r\n address adapter,\r\n address spokePool\r\n ) external;\r\n\r\n function whitelistRoute(\r\n uint256 originChainId,\r\n uint256 destinationChainId,\r\n address originToken,\r\n address destinationToken\r\n ) external;\r\n\r\n function enableL1TokenForLiquidityProvision(address l1Token) external;\r\n\r\n function disableL1TokenForLiquidityProvision(address l1Token) external;\r\n\r\n function addLiquidity(address l1Token, uint256 l1TokenAmount) external payable;\r\n\r\n function removeLiquidity(\r\n address l1Token,\r\n uint256 lpTokenAmount,\r\n bool sendEth\r\n ) external;\r\n\r\n function exchangeRateCurrent(address l1Token) external returns (uint256);\r\n\r\n function liquidityUtilizationPostRelay(address token, uint256 relayedAmount) external returns (uint256);\r\n\r\n function proposeRootBundle(\r\n uint256[] memory bundleEvaluationBlockNumbers,\r\n uint8 poolRebalanceLeafCount,\r\n bytes32 poolRebalanceRoot,\r\n bytes32 relayerRefundRoot,\r\n bytes32 slowRelayFulfillmentRoot\r\n ) external;\r\n\r\n function executeRootBundle(PoolRebalanceLeaf memory poolRebalanceLeaf, bytes32[] memory proof) external;\r\n\r\n function disputeRootBundle() external;\r\n}\r\n" - }, - "contracts/interfaces/AdapterInterface.sol": { - "content": "// SPDX-License-Identifier: AGPL-3.0-only\npragma solidity ^0.8.0;\n\n/**\n * @notice Sends cross chain messages and tokens to contracts on a specific L2 network.\n */\n\ninterface AdapterInterface {\n event HubPoolChanged(address newHubPool);\n\n event MessageRelayed(address target, bytes message);\n\n event TokensRelayed(address l1Token, address l2Token, uint256 amount, address to);\n\n function relayMessage(address target, bytes memory message) external payable;\n\n function relayTokens(\n address l1Token,\n address l2Token,\n uint256 amount,\n address to\n ) external payable;\n}\n" - }, - "@openzeppelin/contracts/interfaces/IERC1271.sol": { - "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts v4.4.1 (interfaces/IERC1271.sol)\n\npragma solidity ^0.8.0;\n\n/**\n * @dev Interface of the ERC1271 standard signature validation method for\n * contracts as defined in https://eips.ethereum.org/EIPS/eip-1271[ERC-1271].\n *\n * _Available since v4.1._\n */\ninterface IERC1271 {\n /**\n * @dev Should return whether the signature provided is valid for the provided data\n * @param hash Hash of the data to be signed\n * @param signature Signature byte array associated with _data\n */\n function isValidSignature(bytes32 hash, bytes memory signature) external view returns (bytes4 magicValue);\n}\n" - }, - "@openzeppelin/contracts/utils/Strings.sol": { - "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts v4.4.1 (utils/Strings.sol)\n\npragma solidity ^0.8.0;\n\n/**\n * @dev String operations.\n */\nlibrary Strings {\n bytes16 private constant _HEX_SYMBOLS = \"0123456789abcdef\";\n\n /**\n * @dev Converts a `uint256` to its ASCII `string` decimal representation.\n */\n function toString(uint256 value) internal pure returns (string memory) {\n // Inspired by OraclizeAPI's implementation - MIT licence\n // https://github.com/oraclize/ethereum-api/blob/b42146b063c7d6ee1358846c198246239e9360e8/oraclizeAPI_0.4.25.sol\n\n if (value == 0) {\n return \"0\";\n }\n uint256 temp = value;\n uint256 digits;\n while (temp != 0) {\n digits++;\n temp /= 10;\n }\n bytes memory buffer = new bytes(digits);\n while (value != 0) {\n digits -= 1;\n buffer[digits] = bytes1(uint8(48 + uint256(value % 10)));\n value /= 10;\n }\n return string(buffer);\n }\n\n /**\n * @dev Converts a `uint256` to its ASCII `string` hexadecimal representation.\n */\n function toHexString(uint256 value) internal pure returns (string memory) {\n if (value == 0) {\n return \"0x00\";\n }\n uint256 temp = value;\n uint256 length = 0;\n while (temp != 0) {\n length++;\n temp >>= 8;\n }\n return toHexString(value, length);\n }\n\n /**\n * @dev Converts a `uint256` to its ASCII `string` hexadecimal representation with fixed length.\n */\n function toHexString(uint256 value, uint256 length) internal pure returns (string memory) {\n bytes memory buffer = new bytes(2 * length + 2);\n buffer[0] = \"0\";\n buffer[1] = \"x\";\n for (uint256 i = 2 * length + 1; i > 1; --i) {\n buffer[i] = _HEX_SYMBOLS[value & 0xf];\n value >>= 4;\n }\n require(value == 0, \"Strings: hex length insufficient\");\n return string(buffer);\n }\n}\n" - }, - "@uma/core/contracts/common/implementation/Timer.sol": { - "content": "// SPDX-License-Identifier: AGPL-3.0-only\npragma solidity ^0.8.0;\n\n/**\n * @title Universal store of current contract time for testing environments.\n */\ncontract Timer {\n uint256 private currentTime;\n\n constructor() {\n currentTime = block.timestamp; // solhint-disable-line not-rely-on-time\n }\n\n /**\n * @notice Sets the current time.\n * @dev Will revert if not running in test mode.\n * @param time timestamp to set `currentTime` to.\n */\n function setCurrentTime(uint256 time) external {\n currentTime = time;\n }\n\n /**\n * @notice Gets the currentTime variable set in the Timer.\n * @return uint256 for the current Testable timestamp.\n */\n function getCurrentTime() public view returns (uint256) {\n return currentTime;\n }\n}\n" - }, - "contracts/test/MockSpokePool.sol": { - "content": "//SPDX-License-Identifier: Unlicense\r\npragma solidity ^0.8.0;\r\n\r\nimport \"../SpokePool.sol\";\r\nimport \"../SpokePoolInterface.sol\";\r\n\r\n/**\r\n * @title MockSpokePool\r\n * @notice Implements admin internal methods to test internal logic.\r\n */\r\ncontract MockSpokePool is SpokePoolInterface, SpokePool {\r\n constructor(\r\n address _crossDomainAdmin,\r\n address _hubPool,\r\n address _wethAddress,\r\n address timerAddress\r\n ) SpokePool(_crossDomainAdmin, _hubPool, _wethAddress, timerAddress) {}\r\n\r\n function setCrossDomainAdmin(address newCrossDomainAdmin) public override {\r\n _setCrossDomainAdmin(newCrossDomainAdmin);\r\n }\r\n\r\n function setHubPool(address newHubPool) public override {\r\n _setHubPool(newHubPool);\r\n }\r\n\r\n function setEnableRoute(\r\n address originToken,\r\n uint256 destinationChainId,\r\n bool enable\r\n ) public override {\r\n _setEnableRoute(originToken, destinationChainId, enable);\r\n }\r\n\r\n function setDepositQuoteTimeBuffer(uint32 buffer) public override {\r\n _setDepositQuoteTimeBuffer(buffer);\r\n }\r\n\r\n function relayRootBundle(bytes32 relayerRefundRoot, bytes32 slowRelayFulfillmentRoot) public override {\r\n _relayRootBundle(relayerRefundRoot, slowRelayFulfillmentRoot);\r\n }\r\n\r\n function _bridgeTokensToHubPool(RelayerRefundLeaf memory relayerRefundLeaf) internal override {}\r\n}\r\n" - }, - "contracts/Optimism_SpokePool.sol": { - "content": "//SPDX-License-Identifier: Unlicense\r\npragma solidity ^0.8.0;\r\n\r\nimport \"./interfaces/WETH9.sol\";\r\n\r\nimport \"@eth-optimism/contracts/libraries/bridge/CrossDomainEnabled.sol\";\r\nimport \"@eth-optimism/contracts/libraries/constants/Lib_PredeployAddresses.sol\";\r\nimport \"@eth-optimism/contracts/L2/messaging/IL2ERC20Bridge.sol\";\r\nimport \"./SpokePool.sol\";\r\nimport \"./SpokePoolInterface.sol\";\r\n\r\n/**\r\n * @notice OVM specific SpokePool.\r\n * @dev Uses OVM cross-domain-enabled logic for access control.\r\n */\r\n\r\ncontract Optimism_SpokePool is CrossDomainEnabled, SpokePoolInterface, SpokePool {\r\n // \"l1Gas\" parameter used in call to bridge tokens from this contract back to L1 via `IL2ERC20Bridge`.\r\n uint32 public l1Gas = 5_000_000;\r\n\r\n address public l2Eth = address(Lib_PredeployAddresses.OVM_ETH);\r\n\r\n event OptimismTokensBridged(address indexed l2Token, address target, uint256 numberOfTokensBridged, uint256 l1Gas);\r\n event SetL1Gas(uint32 indexed newL1Gas);\r\n\r\n constructor(\r\n address _crossDomainAdmin,\r\n address _hubPool,\r\n address timerAddress\r\n )\r\n CrossDomainEnabled(Lib_PredeployAddresses.L2_CROSS_DOMAIN_MESSENGER)\r\n SpokePool(_crossDomainAdmin, _hubPool, 0x4200000000000000000000000000000000000006, timerAddress)\r\n {}\r\n\r\n /**************************************\r\n * CROSS-CHAIN ADMIN FUNCTIONS *\r\n **************************************/\r\n\r\n function setL1GasLimit(uint32 newl1Gas) public onlyFromCrossDomainAccount(crossDomainAdmin) {\r\n _setL1GasLimit(newl1Gas);\r\n }\r\n\r\n function setCrossDomainAdmin(address newCrossDomainAdmin)\r\n public\r\n override\r\n onlyFromCrossDomainAccount(crossDomainAdmin)\r\n nonReentrant\r\n {\r\n _setCrossDomainAdmin(newCrossDomainAdmin);\r\n }\r\n\r\n function setHubPool(address newHubPool) public override onlyFromCrossDomainAccount(crossDomainAdmin) nonReentrant {\r\n _setHubPool(newHubPool);\r\n }\r\n\r\n function setEnableRoute(\r\n address originToken,\r\n uint256 destinationChainId,\r\n bool enable\r\n ) public override onlyFromCrossDomainAccount(crossDomainAdmin) nonReentrant {\r\n _setEnableRoute(originToken, destinationChainId, enable);\r\n }\r\n\r\n function setDepositQuoteTimeBuffer(uint32 buffer)\r\n public\r\n override\r\n onlyFromCrossDomainAccount(crossDomainAdmin)\r\n nonReentrant\r\n {\r\n _setDepositQuoteTimeBuffer(buffer);\r\n }\r\n\r\n function relayRootBundle(bytes32 relayerRefundRoot, bytes32 slowRelayFulfillmentRoot)\r\n public\r\n override\r\n onlyFromCrossDomainAccount(crossDomainAdmin)\r\n nonReentrant\r\n {\r\n _relayRootBundle(relayerRefundRoot, slowRelayFulfillmentRoot);\r\n }\r\n\r\n /**************************************\r\n * INTERNAL FUNCTIONS *\r\n **************************************/\r\n\r\n function _setL1GasLimit(uint32 _l1Gas) internal {\r\n l1Gas = _l1Gas;\r\n emit SetL1Gas(l1Gas);\r\n }\r\n\r\n function _bridgeTokensToHubPool(RelayerRefundLeaf memory relayerRefundLeaf) internal override {\r\n // If the token being bridged is WETH then we need to first unwrap it to ETH and then send ETH over the\r\n // canonical bridge. On Optimism, this is address 0xDeadDeAddeAddEAddeadDEaDDEAdDeaDDeAD0000.\r\n if (relayerRefundLeaf.l2TokenAddress == address(weth)) {\r\n WETH9(relayerRefundLeaf.l2TokenAddress).withdraw(relayerRefundLeaf.amountToReturn); // Unwrap ETH.\r\n relayerRefundLeaf.l2TokenAddress = l2Eth; // Set the l2TokenAddress to ETH.\r\n }\r\n IL2ERC20Bridge(Lib_PredeployAddresses.L2_STANDARD_BRIDGE).withdrawTo(\r\n relayerRefundLeaf.l2TokenAddress, // _l2Token. Address of the L2 token to bridge over.\r\n hubPool, // _to. Withdraw, over the bridge, to the l1 pool contract.\r\n relayerRefundLeaf.amountToReturn, // _amount.\r\n l1Gas, // _l1Gas. Unused, but included for potential forward compatibility considerations\r\n \"\" // _data. We don't need to send any data for the bridging action.\r\n );\r\n\r\n emit OptimismTokensBridged(relayerRefundLeaf.l2TokenAddress, hubPool, relayerRefundLeaf.amountToReturn, l1Gas);\r\n }\r\n}\r\n" - }, - "@eth-optimism/contracts/libraries/bridge/CrossDomainEnabled.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma solidity >0.5.0 <0.9.0;\n\n/* Interface Imports */\nimport { ICrossDomainMessenger } from \"./ICrossDomainMessenger.sol\";\n\n/**\n * @title CrossDomainEnabled\n * @dev Helper contract for contracts performing cross-domain communications\n *\n * Compiler used: defined by inheriting contract\n */\ncontract CrossDomainEnabled {\n /*************\n * Variables *\n *************/\n\n // Messenger contract used to send and recieve messages from the other domain.\n address public messenger;\n\n /***************\n * Constructor *\n ***************/\n\n /**\n * @param _messenger Address of the CrossDomainMessenger on the current layer.\n */\n constructor(address _messenger) {\n messenger = _messenger;\n }\n\n /**********************\n * Function Modifiers *\n **********************/\n\n /**\n * Enforces that the modified function is only callable by a specific cross-domain account.\n * @param _sourceDomainAccount The only account on the originating domain which is\n * authenticated to call this function.\n */\n modifier onlyFromCrossDomainAccount(address _sourceDomainAccount) {\n require(\n msg.sender == address(getCrossDomainMessenger()),\n \"OVM_XCHAIN: messenger contract unauthenticated\"\n );\n\n require(\n getCrossDomainMessenger().xDomainMessageSender() == _sourceDomainAccount,\n \"OVM_XCHAIN: wrong sender of cross-domain message\"\n );\n\n _;\n }\n\n /**********************\n * Internal Functions *\n **********************/\n\n /**\n * Gets the messenger, usually from storage. This function is exposed in case a child contract\n * needs to override.\n * @return The address of the cross-domain messenger contract which should be used.\n */\n function getCrossDomainMessenger() internal virtual returns (ICrossDomainMessenger) {\n return ICrossDomainMessenger(messenger);\n }\n\n /**q\n * Sends a message to an account on another domain\n * @param _crossDomainTarget The intended recipient on the destination domain\n * @param _message The data to send to the target (usually calldata to a function with\n * `onlyFromCrossDomainAccount()`)\n * @param _gasLimit The gasLimit for the receipt of the message on the target domain.\n */\n function sendCrossDomainMessage(\n address _crossDomainTarget,\n uint32 _gasLimit,\n bytes memory _message\n ) internal {\n // slither-disable-next-line reentrancy-events, reentrancy-benign\n getCrossDomainMessenger().sendMessage(_crossDomainTarget, _message, _gasLimit);\n }\n}\n" - }, - "@eth-optimism/contracts/libraries/constants/Lib_PredeployAddresses.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.9;\n\n/**\n * @title Lib_PredeployAddresses\n */\nlibrary Lib_PredeployAddresses {\n address internal constant L2_TO_L1_MESSAGE_PASSER = 0x4200000000000000000000000000000000000000;\n address internal constant L1_MESSAGE_SENDER = 0x4200000000000000000000000000000000000001;\n address internal constant DEPLOYER_WHITELIST = 0x4200000000000000000000000000000000000002;\n address payable internal constant OVM_ETH = payable(0xDeadDeAddeAddEAddeadDEaDDEAdDeaDDeAD0000);\n address internal constant L2_CROSS_DOMAIN_MESSENGER =\n 0x4200000000000000000000000000000000000007;\n address internal constant LIB_ADDRESS_MANAGER = 0x4200000000000000000000000000000000000008;\n address internal constant PROXY_EOA = 0x4200000000000000000000000000000000000009;\n address internal constant L2_STANDARD_BRIDGE = 0x4200000000000000000000000000000000000010;\n address internal constant SEQUENCER_FEE_WALLET = 0x4200000000000000000000000000000000000011;\n address internal constant L2_STANDARD_TOKEN_FACTORY =\n 0x4200000000000000000000000000000000000012;\n address internal constant L1_BLOCK_NUMBER = 0x4200000000000000000000000000000000000013;\n}\n" - }, - "@eth-optimism/contracts/L2/messaging/IL2ERC20Bridge.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.9;\n\n/**\n * @title IL2ERC20Bridge\n */\ninterface IL2ERC20Bridge {\n /**********\n * Events *\n **********/\n\n event WithdrawalInitiated(\n address indexed _l1Token,\n address indexed _l2Token,\n address indexed _from,\n address _to,\n uint256 _amount,\n bytes _data\n );\n\n event DepositFinalized(\n address indexed _l1Token,\n address indexed _l2Token,\n address indexed _from,\n address _to,\n uint256 _amount,\n bytes _data\n );\n\n event DepositFailed(\n address indexed _l1Token,\n address indexed _l2Token,\n address indexed _from,\n address _to,\n uint256 _amount,\n bytes _data\n );\n\n /********************\n * Public Functions *\n ********************/\n\n /**\n * @dev get the address of the corresponding L1 bridge contract.\n * @return Address of the corresponding L1 bridge contract.\n */\n function l1TokenBridge() external returns (address);\n\n /**\n * @dev initiate a withdraw of some tokens to the caller's account on L1\n * @param _l2Token Address of L2 token where withdrawal was initiated.\n * @param _amount Amount of the token to withdraw.\n * param _l1Gas Unused, but included for potential forward compatibility considerations.\n * @param _data Optional data to forward to L1. This data is provided\n * solely as a convenience for external contracts. Aside from enforcing a maximum\n * length, these contracts provide no guarantees about its content.\n */\n function withdraw(\n address _l2Token,\n uint256 _amount,\n uint32 _l1Gas,\n bytes calldata _data\n ) external;\n\n /**\n * @dev initiate a withdraw of some token to a recipient's account on L1.\n * @param _l2Token Address of L2 token where withdrawal is initiated.\n * @param _to L1 adress to credit the withdrawal to.\n * @param _amount Amount of the token to withdraw.\n * param _l1Gas Unused, but included for potential forward compatibility considerations.\n * @param _data Optional data to forward to L1. This data is provided\n * solely as a convenience for external contracts. Aside from enforcing a maximum\n * length, these contracts provide no guarantees about its content.\n */\n function withdrawTo(\n address _l2Token,\n address _to,\n uint256 _amount,\n uint32 _l1Gas,\n bytes calldata _data\n ) external;\n\n /*************************\n * Cross-chain Functions *\n *************************/\n\n /**\n * @dev Complete a deposit from L1 to L2, and credits funds to the recipient's balance of this\n * L2 token. This call will fail if it did not originate from a corresponding deposit in\n * L1StandardTokenBridge.\n * @param _l1Token Address for the l1 token this is called with\n * @param _l2Token Address for the l2 token this is called with\n * @param _from Account to pull the deposit from on L2.\n * @param _to Address to receive the withdrawal at\n * @param _amount Amount of the token to withdraw\n * @param _data Data provider by the sender on L1. This data is provided\n * solely as a convenience for external contracts. Aside from enforcing a maximum\n * length, these contracts provide no guarantees about its content.\n */\n function finalizeDeposit(\n address _l1Token,\n address _l2Token,\n address _from,\n address _to,\n uint256 _amount,\n bytes calldata _data\n ) external;\n}\n" - }, - "@eth-optimism/contracts/libraries/bridge/ICrossDomainMessenger.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma solidity >0.5.0 <0.9.0;\n\n/**\n * @title ICrossDomainMessenger\n */\ninterface ICrossDomainMessenger {\n /**********\n * Events *\n **********/\n\n event SentMessage(\n address indexed target,\n address sender,\n bytes message,\n uint256 messageNonce,\n uint256 gasLimit\n );\n event RelayedMessage(bytes32 indexed msgHash);\n event FailedRelayedMessage(bytes32 indexed msgHash);\n\n /*************\n * Variables *\n *************/\n\n function xDomainMessageSender() external view returns (address);\n\n /********************\n * Public Functions *\n ********************/\n\n /**\n * Sends a cross domain message to the target messenger.\n * @param _target Target contract address.\n * @param _message Message to send to the target.\n * @param _gasLimit Gas limit for the provided message.\n */\n function sendMessage(\n address _target,\n bytes calldata _message,\n uint32 _gasLimit\n ) external;\n}\n" - }, - "contracts/chain-adapters/Optimism_Adapter.sol": { - "content": "// SPDX-License-Identifier: AGPL-3.0-only\r\npragma solidity ^0.8.0;\r\n\r\nimport \"./Base_Adapter.sol\";\r\nimport \"../interfaces/AdapterInterface.sol\";\r\nimport \"../interfaces/WETH9.sol\";\r\n\r\nimport \"@eth-optimism/contracts/libraries/bridge/CrossDomainEnabled.sol\";\r\nimport \"@eth-optimism/contracts/L1/messaging/IL1StandardBridge.sol\";\r\n\r\nimport \"@uma/core/contracts/common/implementation/Lockable.sol\";\r\n\r\nimport \"@openzeppelin/contracts/token/ERC20/IERC20.sol\";\r\n\r\n/**\r\n * @notice Sends cross chain messages Optimism L2 network.\r\n * @dev This contract's owner should be set to the some multisig or admin contract. The Owner can simply set the L2 gas\r\n * and the HubPool. The HubPool is the only contract that can relay tokens and messages over the bridge.\r\n */\r\ncontract Optimism_Adapter is Base_Adapter, CrossDomainEnabled, Lockable {\r\n uint32 public l2GasLimit = 5_000_000;\r\n\r\n WETH9 public l1Weth;\r\n\r\n IL1StandardBridge public l1StandardBridge;\r\n\r\n event L2GasLimitSet(uint32 newGasLimit);\r\n\r\n constructor(\r\n WETH9 _l1Weth,\r\n address _hubPool,\r\n address _crossDomainMessenger,\r\n IL1StandardBridge _l1StandardBridge\r\n ) CrossDomainEnabled(_crossDomainMessenger) Base_Adapter(_hubPool) {\r\n l1Weth = _l1Weth;\r\n l1StandardBridge = _l1StandardBridge;\r\n }\r\n\r\n function setL2GasLimit(uint32 _l2GasLimit) public onlyOwner {\r\n l2GasLimit = _l2GasLimit;\r\n emit L2GasLimitSet(l2GasLimit);\r\n }\r\n\r\n function relayMessage(address target, bytes memory message) external payable override nonReentrant onlyHubPool {\r\n sendCrossDomainMessage(target, uint32(l2GasLimit), message);\r\n emit MessageRelayed(target, message);\r\n }\r\n\r\n function relayTokens(\r\n address l1Token,\r\n address l2Token,\r\n uint256 amount,\r\n address to\r\n ) external payable override nonReentrant onlyHubPool {\r\n // If the l1Token is weth then unwrap it to ETH then send the ETH to the standard bridge.\r\n if (l1Token == address(l1Weth)) {\r\n l1Weth.withdraw(amount);\r\n l1StandardBridge.depositETHTo{ value: amount }(to, l2GasLimit, \"\");\r\n } else {\r\n IERC20(l1Token).approve(address(l1StandardBridge), amount);\r\n l1StandardBridge.depositERC20To(l1Token, l2Token, to, amount, l2GasLimit, \"\");\r\n }\r\n emit TokensRelayed(l1Token, l2Token, amount, to);\r\n }\r\n\r\n // Added to enable the Optimism_Adapter to receive ETH. used when unwrapping WETH.\r\n receive() external payable {}\r\n}\r\n" - }, - "contracts/chain-adapters/Base_Adapter.sol": { - "content": "// SPDX-License-Identifier: AGPL-3.0-only\npragma solidity ^0.8.0;\nimport \"../interfaces/AdapterInterface.sol\";\n\nimport \"@openzeppelin/contracts/access/Ownable.sol\";\n\nabstract contract Base_Adapter is Ownable, AdapterInterface {\n address public hubPool;\n\n modifier onlyHubPool() {\n require(msg.sender == hubPool, \"Can only be called by hubPool\");\n _;\n }\n\n constructor(address _hubPool) {\n hubPool = _hubPool;\n }\n\n function setHubPool(address _hubPool) public onlyOwner {\n hubPool = _hubPool;\n emit HubPoolChanged(_hubPool);\n }\n}\n" - }, - "@eth-optimism/contracts/L1/messaging/IL1StandardBridge.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma solidity >0.5.0 <0.9.0;\n\nimport \"./IL1ERC20Bridge.sol\";\n\n/**\n * @title IL1StandardBridge\n */\ninterface IL1StandardBridge is IL1ERC20Bridge {\n /**********\n * Events *\n **********/\n event ETHDepositInitiated(\n address indexed _from,\n address indexed _to,\n uint256 _amount,\n bytes _data\n );\n\n event ETHWithdrawalFinalized(\n address indexed _from,\n address indexed _to,\n uint256 _amount,\n bytes _data\n );\n\n /********************\n * Public Functions *\n ********************/\n\n /**\n * @dev Deposit an amount of the ETH to the caller's balance on L2.\n * @param _l2Gas Gas limit required to complete the deposit on L2.\n * @param _data Optional data to forward to L2. This data is provided\n * solely as a convenience for external contracts. Aside from enforcing a maximum\n * length, these contracts provide no guarantees about its content.\n */\n function depositETH(uint32 _l2Gas, bytes calldata _data) external payable;\n\n /**\n * @dev Deposit an amount of ETH to a recipient's balance on L2.\n * @param _to L2 address to credit the withdrawal to.\n * @param _l2Gas Gas limit required to complete the deposit on L2.\n * @param _data Optional data to forward to L2. This data is provided\n * solely as a convenience for external contracts. Aside from enforcing a maximum\n * length, these contracts provide no guarantees about its content.\n */\n function depositETHTo(\n address _to,\n uint32 _l2Gas,\n bytes calldata _data\n ) external payable;\n\n /*************************\n * Cross-chain Functions *\n *************************/\n\n /**\n * @dev Complete a withdrawal from L2 to L1, and credit funds to the recipient's balance of the\n * L1 ETH token. Since only the xDomainMessenger can call this function, it will never be called\n * before the withdrawal is finalized.\n * @param _from L2 address initiating the transfer.\n * @param _to L1 address to credit the withdrawal to.\n * @param _amount Amount of the ERC20 to deposit.\n * @param _data Optional data to forward to L2. This data is provided\n * solely as a convenience for external contracts. Aside from enforcing a maximum\n * length, these contracts provide no guarantees about its content.\n */\n function finalizeETHWithdrawal(\n address _from,\n address _to,\n uint256 _amount,\n bytes calldata _data\n ) external;\n}\n" - }, - "@openzeppelin/contracts/access/Ownable.sol": { - "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts v4.4.1 (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 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 called by any account other than the owner.\n */\n modifier onlyOwner() {\n require(owner() == _msgSender(), \"Ownable: caller is not the owner\");\n _;\n }\n\n /**\n * @dev Leaves the contract without owner. It will not be possible to call\n * `onlyOwner` functions anymore. Can only be called by the current owner.\n *\n * NOTE: Renouncing ownership will leave the contract without an owner,\n * thereby removing 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/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" - }, - "@eth-optimism/contracts/L1/messaging/IL1ERC20Bridge.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma solidity >0.5.0 <0.9.0;\n\n/**\n * @title IL1ERC20Bridge\n */\ninterface IL1ERC20Bridge {\n /**********\n * Events *\n **********/\n\n event ERC20DepositInitiated(\n address indexed _l1Token,\n address indexed _l2Token,\n address indexed _from,\n address _to,\n uint256 _amount,\n bytes _data\n );\n\n event ERC20WithdrawalFinalized(\n address indexed _l1Token,\n address indexed _l2Token,\n address indexed _from,\n address _to,\n uint256 _amount,\n bytes _data\n );\n\n /********************\n * Public Functions *\n ********************/\n\n /**\n * @dev get the address of the corresponding L2 bridge contract.\n * @return Address of the corresponding L2 bridge contract.\n */\n function l2TokenBridge() external returns (address);\n\n /**\n * @dev deposit an amount of the ERC20 to the caller's balance on L2.\n * @param _l1Token Address of the L1 ERC20 we are depositing\n * @param _l2Token Address of the L1 respective L2 ERC20\n * @param _amount Amount of the ERC20 to deposit\n * @param _l2Gas Gas limit required to complete the deposit on L2.\n * @param _data Optional data to forward to L2. This data is provided\n * solely as a convenience for external contracts. Aside from enforcing a maximum\n * length, these contracts provide no guarantees about its content.\n */\n function depositERC20(\n address _l1Token,\n address _l2Token,\n uint256 _amount,\n uint32 _l2Gas,\n bytes calldata _data\n ) external;\n\n /**\n * @dev deposit an amount of ERC20 to a recipient's balance on L2.\n * @param _l1Token Address of the L1 ERC20 we are depositing\n * @param _l2Token Address of the L1 respective L2 ERC20\n * @param _to L2 address to credit the withdrawal to.\n * @param _amount Amount of the ERC20 to deposit.\n * @param _l2Gas Gas limit required to complete the deposit on L2.\n * @param _data Optional data to forward to L2. This data is provided\n * solely as a convenience for external contracts. Aside from enforcing a maximum\n * length, these contracts provide no guarantees about its content.\n */\n function depositERC20To(\n address _l1Token,\n address _l2Token,\n address _to,\n uint256 _amount,\n uint32 _l2Gas,\n bytes calldata _data\n ) external;\n\n /*************************\n * Cross-chain Functions *\n *************************/\n\n /**\n * @dev Complete a withdrawal from L2 to L1, and credit funds to the recipient's balance of the\n * L1 ERC20 token.\n * This call will fail if the initialized withdrawal from L2 has not been finalized.\n *\n * @param _l1Token Address of L1 token to finalizeWithdrawal for.\n * @param _l2Token Address of L2 token where withdrawal was initiated.\n * @param _from L2 address initiating the transfer.\n * @param _to L1 address to credit the withdrawal to.\n * @param _amount Amount of the ERC20 to deposit.\n * @param _data Data provided by the sender on L2. This data is provided\n * solely as a convenience for external contracts. Aside from enforcing a maximum\n * length, these contracts provide no guarantees about its content.\n */\n function finalizeERC20Withdrawal(\n address _l1Token,\n address _l2Token,\n address _from,\n address _to,\n uint256 _amount,\n bytes calldata _data\n ) external;\n}\n" - }, - "@openzeppelin/contracts/token/ERC20/extensions/IERC20Metadata.sol": { - "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts v4.4.1 (token/ERC20/extensions/IERC20Metadata.sol)\n\npragma solidity ^0.8.0;\n\nimport \"../IERC20.sol\";\n\n/**\n * @dev Interface for the optional metadata functions from the ERC20 standard.\n *\n * _Available since v4.1._\n */\ninterface IERC20Metadata is IERC20 {\n /**\n * @dev Returns the name of the token.\n */\n function name() external view returns (string memory);\n\n /**\n * @dev Returns the symbol of the token.\n */\n function symbol() external view returns (string memory);\n\n /**\n * @dev Returns the decimals places of the token.\n */\n function decimals() external view returns (uint8);\n}\n" - }, - "@openzeppelin/contracts/token/ERC20/ERC20.sol": { - "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts v4.4.1 (token/ERC20/ERC20.sol)\n\npragma solidity ^0.8.0;\n\nimport \"./IERC20.sol\";\nimport \"./extensions/IERC20Metadata.sol\";\nimport \"../../utils/Context.sol\";\n\n/**\n * @dev Implementation of the {IERC20} interface.\n *\n * This implementation is agnostic to the way tokens are created. This means\n * that a supply mechanism has to be added in a derived contract using {_mint}.\n * For a generic mechanism see {ERC20PresetMinterPauser}.\n *\n * TIP: For a detailed writeup see our guide\n * https://forum.zeppelin.solutions/t/how-to-implement-erc20-supply-mechanisms/226[How\n * to implement supply mechanisms].\n *\n * We have followed general OpenZeppelin Contracts guidelines: functions revert\n * instead returning `false` on failure. This behavior is nonetheless\n * conventional and does not conflict with the expectations of ERC20\n * applications.\n *\n * Additionally, an {Approval} event is emitted on calls to {transferFrom}.\n * This allows applications to reconstruct the allowance for all accounts just\n * by listening to said events. Other implementations of the EIP may not emit\n * these events, as it isn't required by the specification.\n *\n * Finally, the non-standard {decreaseAllowance} and {increaseAllowance}\n * functions have been added to mitigate the well-known issues around setting\n * allowances. See {IERC20-approve}.\n */\ncontract ERC20 is Context, IERC20, IERC20Metadata {\n mapping(address => uint256) private _balances;\n\n mapping(address => mapping(address => uint256)) private _allowances;\n\n uint256 private _totalSupply;\n\n string private _name;\n string private _symbol;\n\n /**\n * @dev Sets the values for {name} and {symbol}.\n *\n * The default value of {decimals} is 18. To select a different value for\n * {decimals} you should overload it.\n *\n * All two of these values are immutable: they can only be set once during\n * construction.\n */\n constructor(string memory name_, string memory symbol_) {\n _name = name_;\n _symbol = symbol_;\n }\n\n /**\n * @dev Returns the name of the token.\n */\n function name() public view virtual override returns (string memory) {\n return _name;\n }\n\n /**\n * @dev Returns the symbol of the token, usually a shorter version of the\n * name.\n */\n function symbol() public view virtual override returns (string memory) {\n return _symbol;\n }\n\n /**\n * @dev Returns the number of decimals used to get its user representation.\n * For example, if `decimals` equals `2`, a balance of `505` tokens should\n * be displayed to a user as `5.05` (`505 / 10 ** 2`).\n *\n * Tokens usually opt for a value of 18, imitating the relationship between\n * Ether and Wei. This is the value {ERC20} uses, unless this function is\n * overridden;\n *\n * NOTE: This information is only used for _display_ purposes: it in\n * no way affects any of the arithmetic of the contract, including\n * {IERC20-balanceOf} and {IERC20-transfer}.\n */\n function decimals() public view virtual override returns (uint8) {\n return 18;\n }\n\n /**\n * @dev See {IERC20-totalSupply}.\n */\n function totalSupply() public view virtual override returns (uint256) {\n return _totalSupply;\n }\n\n /**\n * @dev See {IERC20-balanceOf}.\n */\n function balanceOf(address account) public view virtual override returns (uint256) {\n return _balances[account];\n }\n\n /**\n * @dev See {IERC20-transfer}.\n *\n * Requirements:\n *\n * - `recipient` cannot be the zero address.\n * - the caller must have a balance of at least `amount`.\n */\n function transfer(address recipient, uint256 amount) public virtual override returns (bool) {\n _transfer(_msgSender(), recipient, amount);\n return true;\n }\n\n /**\n * @dev See {IERC20-allowance}.\n */\n function allowance(address owner, address spender) public view virtual override returns (uint256) {\n return _allowances[owner][spender];\n }\n\n /**\n * @dev See {IERC20-approve}.\n *\n * Requirements:\n *\n * - `spender` cannot be the zero address.\n */\n function approve(address spender, uint256 amount) public virtual override returns (bool) {\n _approve(_msgSender(), spender, amount);\n return true;\n }\n\n /**\n * @dev See {IERC20-transferFrom}.\n *\n * Emits an {Approval} event indicating the updated allowance. This is not\n * required by the EIP. See the note at the beginning of {ERC20}.\n *\n * Requirements:\n *\n * - `sender` and `recipient` cannot be the zero address.\n * - `sender` must have a balance of at least `amount`.\n * - the caller must have allowance for ``sender``'s tokens of at least\n * `amount`.\n */\n function transferFrom(\n address sender,\n address recipient,\n uint256 amount\n ) public virtual override returns (bool) {\n _transfer(sender, recipient, amount);\n\n uint256 currentAllowance = _allowances[sender][_msgSender()];\n require(currentAllowance >= amount, \"ERC20: transfer amount exceeds allowance\");\n unchecked {\n _approve(sender, _msgSender(), currentAllowance - amount);\n }\n\n return true;\n }\n\n /**\n * @dev Atomically increases the allowance granted to `spender` by the caller.\n *\n * This is an alternative to {approve} that can be used as a mitigation for\n * problems described in {IERC20-approve}.\n *\n * Emits an {Approval} event indicating the updated allowance.\n *\n * Requirements:\n *\n * - `spender` cannot be the zero address.\n */\n function increaseAllowance(address spender, uint256 addedValue) public virtual returns (bool) {\n _approve(_msgSender(), spender, _allowances[_msgSender()][spender] + addedValue);\n return true;\n }\n\n /**\n * @dev Atomically decreases the allowance granted to `spender` by the caller.\n *\n * This is an alternative to {approve} that can be used as a mitigation for\n * problems described in {IERC20-approve}.\n *\n * Emits an {Approval} event indicating the updated allowance.\n *\n * Requirements:\n *\n * - `spender` cannot be the zero address.\n * - `spender` must have allowance for the caller of at least\n * `subtractedValue`.\n */\n function decreaseAllowance(address spender, uint256 subtractedValue) public virtual returns (bool) {\n uint256 currentAllowance = _allowances[_msgSender()][spender];\n require(currentAllowance >= subtractedValue, \"ERC20: decreased allowance below zero\");\n unchecked {\n _approve(_msgSender(), spender, currentAllowance - subtractedValue);\n }\n\n return true;\n }\n\n /**\n * @dev Moves `amount` of tokens from `sender` to `recipient`.\n *\n * This internal function is equivalent to {transfer}, and can be used to\n * e.g. implement automatic token fees, slashing mechanisms, etc.\n *\n * Emits a {Transfer} event.\n *\n * Requirements:\n *\n * - `sender` cannot be the zero address.\n * - `recipient` cannot be the zero address.\n * - `sender` must have a balance of at least `amount`.\n */\n function _transfer(\n address sender,\n address recipient,\n uint256 amount\n ) internal virtual {\n require(sender != address(0), \"ERC20: transfer from the zero address\");\n require(recipient != address(0), \"ERC20: transfer to the zero address\");\n\n _beforeTokenTransfer(sender, recipient, amount);\n\n uint256 senderBalance = _balances[sender];\n require(senderBalance >= amount, \"ERC20: transfer amount exceeds balance\");\n unchecked {\n _balances[sender] = senderBalance - amount;\n }\n _balances[recipient] += amount;\n\n emit Transfer(sender, recipient, amount);\n\n _afterTokenTransfer(sender, recipient, amount);\n }\n\n /** @dev Creates `amount` tokens and assigns them to `account`, increasing\n * the total supply.\n *\n * Emits a {Transfer} event with `from` set to the zero address.\n *\n * Requirements:\n *\n * - `account` cannot be the zero address.\n */\n function _mint(address account, uint256 amount) internal virtual {\n require(account != address(0), \"ERC20: mint to the zero address\");\n\n _beforeTokenTransfer(address(0), account, amount);\n\n _totalSupply += amount;\n _balances[account] += amount;\n emit Transfer(address(0), account, amount);\n\n _afterTokenTransfer(address(0), account, amount);\n }\n\n /**\n * @dev Destroys `amount` tokens from `account`, reducing the\n * total supply.\n *\n * Emits a {Transfer} event with `to` set to the zero address.\n *\n * Requirements:\n *\n * - `account` cannot be the zero address.\n * - `account` must have at least `amount` tokens.\n */\n function _burn(address account, uint256 amount) internal virtual {\n require(account != address(0), \"ERC20: burn from the zero address\");\n\n _beforeTokenTransfer(account, address(0), amount);\n\n uint256 accountBalance = _balances[account];\n require(accountBalance >= amount, \"ERC20: burn amount exceeds balance\");\n unchecked {\n _balances[account] = accountBalance - amount;\n }\n _totalSupply -= amount;\n\n emit Transfer(account, address(0), amount);\n\n _afterTokenTransfer(account, address(0), amount);\n }\n\n /**\n * @dev Sets `amount` as the allowance of `spender` over the `owner` s tokens.\n *\n * This internal function is equivalent to `approve`, and can be used to\n * e.g. set automatic allowances for certain subsystems, etc.\n *\n * Emits an {Approval} event.\n *\n * Requirements:\n *\n * - `owner` cannot be the zero address.\n * - `spender` cannot be the zero address.\n */\n function _approve(\n address owner,\n address spender,\n uint256 amount\n ) internal virtual {\n require(owner != address(0), \"ERC20: approve from the zero address\");\n require(spender != address(0), \"ERC20: approve to the zero address\");\n\n _allowances[owner][spender] = amount;\n emit Approval(owner, spender, amount);\n }\n\n /**\n * @dev Hook that is called before any transfer of tokens. This includes\n * minting and burning.\n *\n * Calling conditions:\n *\n * - when `from` and `to` are both non-zero, `amount` of ``from``'s tokens\n * will be transferred to `to`.\n * - when `from` is zero, `amount` tokens will be minted for `to`.\n * - when `to` is zero, `amount` of ``from``'s tokens will be burned.\n * - `from` and `to` are never both zero.\n *\n * To learn more about hooks, head to xref:ROOT:extending-contracts.adoc#using-hooks[Using Hooks].\n */\n function _beforeTokenTransfer(\n address from,\n address to,\n uint256 amount\n ) internal virtual {}\n\n /**\n * @dev Hook that is called after any transfer of tokens. This includes\n * minting and burning.\n *\n * Calling conditions:\n *\n * - when `from` and `to` are both non-zero, `amount` of ``from``'s tokens\n * has been transferred to `to`.\n * - when `from` is zero, `amount` tokens have been minted for `to`.\n * - when `to` is zero, `amount` of ``from``'s tokens have been burned.\n * - `from` and `to` are never both zero.\n *\n * To learn more about hooks, head to xref:ROOT:extending-contracts.adoc#using-hooks[Using Hooks].\n */\n function _afterTokenTransfer(\n address from,\n address to,\n uint256 amount\n ) internal virtual {}\n}\n" - }, - "contracts/chain-adapters/Ethereum_Adapter.sol": { - "content": "// SPDX-License-Identifier: AGPL-3.0-only\r\npragma solidity ^0.8.0;\r\n\r\nimport \"./Base_Adapter.sol\";\r\nimport \"../interfaces/AdapterInterface.sol\";\r\nimport \"../interfaces/WETH9.sol\";\r\n\r\nimport \"@uma/core/contracts/common/implementation/Lockable.sol\";\r\n\r\nimport \"@openzeppelin/contracts/token/ERC20/IERC20.sol\";\r\nimport \"@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol\";\r\n\r\ncontract Ethereum_Adapter is Base_Adapter, Lockable {\r\n using SafeERC20 for IERC20;\r\n\r\n constructor(address _hubPool) Base_Adapter(_hubPool) {}\r\n\r\n function relayMessage(address target, bytes memory message) external payable override nonReentrant onlyHubPool {\r\n _executeCall(target, message);\r\n emit MessageRelayed(target, message);\r\n }\r\n\r\n function relayTokens(\r\n address l1Token,\r\n address l2Token, // l2Token is unused for L1.\r\n uint256 amount,\r\n address to\r\n ) external payable override nonReentrant onlyHubPool {\r\n IERC20(l1Token).safeTransfer(to, amount);\r\n emit TokensRelayed(l1Token, l2Token, amount, to);\r\n }\r\n\r\n // Note: this snippet of code is copied from Governor.sol.\r\n function _executeCall(address to, bytes memory data) private {\r\n // Note: this snippet of code is copied from Governor.sol and modified to not include any \"value\" field.\r\n // solhint-disable-next-line no-inline-assembly\r\n\r\n bool success;\r\n assembly {\r\n let inputData := add(data, 0x20)\r\n let inputDataSize := mload(data)\r\n // Hardcode value to be 0 for relayed governance calls in order to avoid addressing complexity of bridging\r\n // value cross-chain.\r\n success := call(gas(), to, 0, inputData, inputDataSize, 0, 0)\r\n }\r\n require(success, \"execute call failed\");\r\n }\r\n\r\n receive() external payable {}\r\n}\r\n" - }, - "contracts/chain-adapters/Arbitrum_Adapter.sol": { - "content": "// SPDX-License-Identifier: AGPL-3.0-only\r\npragma solidity ^0.8.0;\r\n\r\nimport \"./Base_Adapter.sol\";\r\nimport \"../interfaces/AdapterInterface.sol\";\r\nimport \"../interfaces/WETH9.sol\";\r\n\r\nimport \"@uma/core/contracts/common/implementation/Lockable.sol\";\r\n\r\nimport \"@openzeppelin/contracts/token/ERC20/IERC20.sol\";\r\n\r\ninterface ArbitrumL1InboxLike {\r\n function createRetryableTicket(\r\n address destAddr,\r\n uint256 arbTxCallValue,\r\n uint256 maxSubmissionCost,\r\n address submissionRefundAddress,\r\n address valueRefundAddress,\r\n uint256 maxGas,\r\n uint256 gasPriceBid,\r\n bytes calldata data\r\n ) external payable returns (uint256);\r\n}\r\n\r\ninterface ArbitrumL1ERC20GatewayLike {\r\n function outboundTransfer(\r\n address _token,\r\n address _to,\r\n uint256 _amount,\r\n uint256 _maxGas,\r\n uint256 _gasPriceBid,\r\n bytes calldata _data\r\n ) external payable returns (bytes memory);\r\n}\r\n\r\ncontract Arbitrum_Adapter is Base_Adapter, Lockable {\r\n // Gas limit for immediate L2 execution attempt (can be estimated via NodeInterface.estimateRetryableTicket).\r\n // NodeInterface precompile interface exists at L2 address 0x00000000000000000000000000000000000000C8\r\n uint32 public l2GasLimit = 5_000_000;\r\n\r\n // Amount of ETH allocated to pay for the base submission fee. The base submission fee is a parameter unique to\r\n // retryable transactions; the user is charged the base submission fee to cover the storage costs of keeping their\r\n // ticket’s calldata in the retry buffer. (current base submission fee is queryable via\r\n // ArbRetryableTx.getSubmissionPrice). ArbRetryableTicket precompile interface exists at L2 address\r\n // 0x000000000000000000000000000000000000006E.\r\n uint256 public l2MaxSubmissionCost = 0.1e18;\r\n\r\n // L2 Gas price bid for immediate L2 execution attempt (queryable via standard eth*gasPrice RPC)\r\n uint256 public l2GasPrice = 10e9; // 10 gWei\r\n\r\n // This address on L2 receives extra ETH that is left over after relaying a message via the inbox.\r\n address public l2RefundL2Address;\r\n\r\n ArbitrumL1InboxLike public l1Inbox;\r\n\r\n ArbitrumL1ERC20GatewayLike public l1ERC20Gateway;\r\n\r\n event L2GasLimitSet(uint32 newL2GasLimit);\r\n\r\n event L2MaxSubmissionCostSet(uint256 newL2MaxSubmissionCost);\r\n\r\n event L2GasPriceSet(uint256 newL2GasPrice);\r\n\r\n event L2RefundL2AddressSet(address newL2RefundL2Address);\r\n\r\n constructor(\r\n address _hubPool,\r\n ArbitrumL1InboxLike _l1ArbitrumInbox,\r\n ArbitrumL1ERC20GatewayLike _l1ERC20Gateway\r\n ) Base_Adapter(_hubPool) {\r\n l1Inbox = _l1ArbitrumInbox;\r\n l1ERC20Gateway = _l1ERC20Gateway;\r\n\r\n l2RefundL2Address = owner();\r\n }\r\n\r\n function setL2GasLimit(uint32 _l2GasLimit) public onlyOwner {\r\n l2GasLimit = _l2GasLimit;\r\n emit L2GasLimitSet(l2GasLimit);\r\n }\r\n\r\n function setL2MaxSubmissionCost(uint256 _l2MaxSubmissionCost) public onlyOwner {\r\n l2MaxSubmissionCost = _l2MaxSubmissionCost;\r\n emit L2MaxSubmissionCostSet(l2MaxSubmissionCost);\r\n }\r\n\r\n function setL2GasPrice(uint256 _l2GasPrice) public onlyOwner {\r\n l2GasPrice = _l2GasPrice;\r\n emit L2GasPriceSet(l2GasPrice);\r\n }\r\n\r\n function setL2RefundL2Address(address _l2RefundL2Address) public onlyOwner {\r\n l2RefundL2Address = _l2RefundL2Address;\r\n emit L2RefundL2AddressSet(l2RefundL2Address);\r\n }\r\n\r\n function relayMessage(address target, bytes memory message) external payable override nonReentrant onlyHubPool {\r\n uint256 requiredL1CallValue = getL1CallValue();\r\n require(address(this).balance >= requiredL1CallValue, \"Insufficient ETH balance\");\r\n\r\n l1Inbox.createRetryableTicket{ value: requiredL1CallValue }(\r\n target, // destAddr destination L2 contract address\r\n 0, // l2CallValue call value for retryable L2 message\r\n l2MaxSubmissionCost, // maxSubmissionCost Max gas deducted from user's L2 balance to cover base submission fee\r\n l2RefundL2Address, // excessFeeRefundAddress maxgas x gasprice - execution cost gets credited here on L2 balance\r\n l2RefundL2Address, // callValueRefundAddress l2Callvalue gets credited here on L2 if retryable txn times out or gets cancelled\r\n l2GasLimit, // maxGas Max gas deducted from user's L2 balance to cover L2 execution\r\n l2GasPrice, // gasPriceBid price bid for L2 execution\r\n message // data ABI encoded data of L2 message\r\n );\r\n\r\n emit MessageRelayed(target, message);\r\n }\r\n\r\n function relayTokens(\r\n address l1Token,\r\n address l2Token, // l2Token is unused for Arbitrum.\r\n uint256 amount,\r\n address to\r\n ) external payable override nonReentrant onlyHubPool {\r\n l1ERC20Gateway.outboundTransfer(l1Token, to, amount, l2GasLimit, l2GasPrice, \"\");\r\n emit TokensRelayed(l1Token, l2Token, amount, to);\r\n }\r\n\r\n function getL1CallValue() public view returns (uint256) {\r\n return l2MaxSubmissionCost + l2GasPrice * l2GasLimit;\r\n }\r\n\r\n receive() external payable {}\r\n}\r\n" - }, - "contracts/Ethereum_SpokePool.sol": { - "content": "//SPDX-License-Identifier: Unlicense\r\npragma solidity ^0.8.0;\r\n\r\nimport \"./interfaces/WETH9.sol\";\r\n\r\nimport \"@openzeppelin/contracts/access/Ownable.sol\";\r\nimport \"@openzeppelin/contracts/token/ERC20/IERC20.sol\";\r\n\r\nimport \"./SpokePool.sol\";\r\nimport \"./SpokePoolInterface.sol\";\r\n\r\n/**\r\n * @notice Ethereum L1 specific SpokePool.\r\n * @dev Used on Ethereum L1 to facilitate L2->L1 transfers.\r\n */\r\n\r\ncontract Ethereum_SpokePool is SpokePoolInterface, SpokePool, Ownable {\r\n constructor(\r\n address _crossDomainAdmin,\r\n address _hubPool,\r\n address _wethAddress,\r\n address timerAddress\r\n ) SpokePool(_crossDomainAdmin, _hubPool, _wethAddress, timerAddress) {}\r\n\r\n /**************************************\r\n * ADMIN FUNCTIONS *\r\n **************************************/\r\n\r\n function setCrossDomainAdmin(address newCrossDomainAdmin) public override onlyOwner nonReentrant {\r\n _setCrossDomainAdmin(newCrossDomainAdmin);\r\n }\r\n\r\n function setHubPool(address newHubPool) public override onlyOwner nonReentrant {\r\n _setHubPool(newHubPool);\r\n }\r\n\r\n function setEnableRoute(\r\n address originToken,\r\n uint256 destinationChainId,\r\n bool enable\r\n ) public override onlyOwner nonReentrant {\r\n _setEnableRoute(originToken, destinationChainId, enable);\r\n }\r\n\r\n function setDepositQuoteTimeBuffer(uint32 buffer) public override onlyOwner nonReentrant {\r\n _setDepositQuoteTimeBuffer(buffer);\r\n }\r\n\r\n function relayRootBundle(bytes32 relayerRefundRoot, bytes32 slowRelayFulfillmentRoot)\r\n public\r\n override\r\n onlyOwner\r\n nonReentrant\r\n {\r\n _relayRootBundle(relayerRefundRoot, slowRelayFulfillmentRoot);\r\n }\r\n\r\n function _bridgeTokensToHubPool(RelayerRefundLeaf memory relayerRefundLeaf) internal override {\r\n IERC20(relayerRefundLeaf.l2TokenAddress).transfer(hubPool, relayerRefundLeaf.amountToReturn);\r\n }\r\n}\r\n" - }, - "contracts/chain-adapters/Mock_Adapter.sol": { - "content": "// SPDX-License-Identifier: AGPL-3.0-only\npragma solidity ^0.8.0;\n\nimport \"./Base_Adapter.sol\";\nimport \"@openzeppelin/contracts/token/ERC20/IERC20.sol\";\n\n/**\n * @notice Sends cross chain messages Optimism L2 network.\n * @dev This contract's owner should be set to the BridgeAdmin deployed on the same L1 network so that only the\n * BridgeAdmin can call cross-chain administrative functions on the L2 SpokePool via this messenger.\n */\ncontract Mock_Adapter is Base_Adapter {\n event RelayMessageCalled(address target, bytes message, address caller);\n\n event RelayTokensCalled(address l1Token, address l2Token, uint256 amount, address to, address caller);\n\n function relayMessage(address target, bytes memory message) external payable override onlyHubPool {\n emit RelayMessageCalled(target, message, msg.sender);\n }\n\n constructor(address _hubPool) Base_Adapter(_hubPool) {}\n\n function relayTokens(\n address l1Token,\n address l2Token,\n uint256 amount,\n address to\n ) external payable override onlyHubPool {\n emit RelayTokensCalled(l1Token, l2Token, amount, to, msg.sender);\n }\n}\n" - }, - "contracts/test/MerkleLibTest.sol": { - "content": "// SPDX-License-Identifier: GPL-3.0-only\r\npragma solidity ^0.8.0;\r\n\r\nimport \"../MerkleLib.sol\";\r\nimport \"../HubPoolInterface.sol\";\r\nimport \"../SpokePoolInterface.sol\";\r\n\r\n/**\r\n * @notice Contract to test the MerkleLib.\r\n */\r\ncontract MerkleLibTest {\r\n mapping(uint256 => uint256) public claimedBitMap;\r\n\r\n uint256 public claimedBitMap1D;\r\n\r\n function verifyPoolRebalance(\r\n bytes32 root,\r\n HubPoolInterface.PoolRebalanceLeaf memory rebalance,\r\n bytes32[] memory proof\r\n ) public pure returns (bool) {\r\n return MerkleLib.verifyPoolRebalance(root, rebalance, proof);\r\n }\r\n\r\n function verifyRelayerRefund(\r\n bytes32 root,\r\n SpokePoolInterface.RelayerRefundLeaf memory refund,\r\n bytes32[] memory proof\r\n ) public pure returns (bool) {\r\n return MerkleLib.verifyRelayerRefund(root, refund, proof);\r\n }\r\n\r\n function verifySlowRelayFulfillment(\r\n bytes32 root,\r\n SpokePoolInterface.RelayData memory slowRelayFulfillment,\r\n bytes32[] memory proof\r\n ) public pure returns (bool) {\r\n return MerkleLib.verifySlowRelayFulfillment(root, slowRelayFulfillment, proof);\r\n }\r\n\r\n function isClaimed(uint256 index) public view returns (bool) {\r\n return MerkleLib.isClaimed(claimedBitMap, index);\r\n }\r\n\r\n function setClaimed(uint256 index) public {\r\n MerkleLib.setClaimed(claimedBitMap, index);\r\n }\r\n\r\n function isClaimed1D(uint256 index) public view returns (bool) {\r\n return MerkleLib.isClaimed1D(claimedBitMap1D, index);\r\n }\r\n\r\n function setClaimed1D(uint256 index) public {\r\n claimedBitMap1D = MerkleLib.setClaimed1D(claimedBitMap1D, index);\r\n }\r\n}\r\n" - }, - "@uma/core/contracts/common/interfaces/ExpandedIERC20.sol": { - "content": "// SPDX-License-Identifier: AGPL-3.0-only\npragma solidity ^0.8.0;\n\nimport \"@openzeppelin/contracts/token/ERC20/IERC20.sol\";\n\n/**\n * @title ERC20 interface that includes burn and mint methods.\n */\nabstract contract ExpandedIERC20 is IERC20 {\n /**\n * @notice Burns a specific amount of the caller's tokens.\n * @dev Only burns the caller's tokens, so it is safe to leave this method permissionless.\n */\n function burn(uint256 value) external virtual;\n\n /**\n * @dev Burns `value` tokens owned by `recipient`.\n * @param recipient address to burn tokens from.\n * @param value amount of tokens to burn.\n */\n function burnFrom(address recipient, uint256 value) external virtual returns (bool);\n\n /**\n * @notice Mints tokens and adds them to the balance of the `to` address.\n * @dev This method should be permissioned to only allow designated parties to mint tokens.\n */\n function mint(address to, uint256 value) external virtual returns (bool);\n\n function addMinter(address account) external virtual;\n\n function addBurner(address account) external virtual;\n\n function resetOwner(address account) external virtual;\n}\n" - }, - "@uma/core/contracts/common/implementation/ExpandedERC20.sol": { - "content": "// SPDX-License-Identifier: AGPL-3.0-only\npragma solidity ^0.8.0;\n\nimport \"@openzeppelin/contracts/token/ERC20/ERC20.sol\";\nimport \"./MultiRole.sol\";\nimport \"../interfaces/ExpandedIERC20.sol\";\n\n/**\n * @title An ERC20 with permissioned burning and minting. The contract deployer will initially\n * be the owner who is capable of adding new roles.\n */\ncontract ExpandedERC20 is ExpandedIERC20, ERC20, MultiRole {\n enum Roles {\n // Can set the minter and burner.\n Owner,\n // Addresses that can mint new tokens.\n Minter,\n // Addresses that can burn tokens that address owns.\n Burner\n }\n\n uint8 _decimals;\n\n /**\n * @notice Constructs the ExpandedERC20.\n * @param _tokenName The name which describes the new token.\n * @param _tokenSymbol The ticker abbreviation of the name. Ideally < 5 chars.\n * @param _tokenDecimals The number of decimals to define token precision.\n */\n constructor(\n string memory _tokenName,\n string memory _tokenSymbol,\n uint8 _tokenDecimals\n ) ERC20(_tokenName, _tokenSymbol) {\n _decimals = _tokenDecimals;\n _createExclusiveRole(uint256(Roles.Owner), uint256(Roles.Owner), msg.sender);\n _createSharedRole(uint256(Roles.Minter), uint256(Roles.Owner), new address[](0));\n _createSharedRole(uint256(Roles.Burner), uint256(Roles.Owner), new address[](0));\n }\n\n function decimals() public view virtual override(ERC20) returns (uint8) {\n return _decimals;\n }\n\n /**\n * @dev Mints `value` tokens to `recipient`, returning true on success.\n * @param recipient address to mint to.\n * @param value amount of tokens to mint.\n * @return True if the mint succeeded, or False.\n */\n function mint(address recipient, uint256 value)\n external\n override\n onlyRoleHolder(uint256(Roles.Minter))\n returns (bool)\n {\n _mint(recipient, value);\n return true;\n }\n\n /**\n * @dev Burns `value` tokens owned by `msg.sender`.\n * @param value amount of tokens to burn.\n */\n function burn(uint256 value) external override onlyRoleHolder(uint256(Roles.Burner)) {\n _burn(msg.sender, value);\n }\n\n /**\n * @dev Burns `value` tokens owned by `recipient`.\n * @param recipient address to burn tokens from.\n * @param value amount of tokens to burn.\n * @return True if the burn succeeded, or False.\n */\n function burnFrom(address recipient, uint256 value)\n external\n override\n onlyRoleHolder(uint256(Roles.Burner))\n returns (bool)\n {\n _burn(recipient, value);\n return true;\n }\n\n /**\n * @notice Add Minter role to account.\n * @dev The caller must have the Owner role.\n * @param account The address to which the Minter role is added.\n */\n function addMinter(address account) external virtual override {\n addMember(uint256(Roles.Minter), account);\n }\n\n /**\n * @notice Add Burner role to account.\n * @dev The caller must have the Owner role.\n * @param account The address to which the Burner role is added.\n */\n function addBurner(address account) external virtual override {\n addMember(uint256(Roles.Burner), account);\n }\n\n /**\n * @notice Reset Owner role to account.\n * @dev The caller must have the Owner role.\n * @param account The new holder of the Owner role.\n */\n function resetOwner(address account) external virtual override {\n resetMember(uint256(Roles.Owner), account);\n }\n}\n" - }, - "@uma/core/contracts/common/implementation/MultiRole.sol": { - "content": "// SPDX-License-Identifier: AGPL-3.0-only\npragma solidity ^0.8.0;\n\nlibrary Exclusive {\n struct RoleMembership {\n address member;\n }\n\n function isMember(RoleMembership storage roleMembership, address memberToCheck) internal view returns (bool) {\n return roleMembership.member == memberToCheck;\n }\n\n function resetMember(RoleMembership storage roleMembership, address newMember) internal {\n require(newMember != address(0x0), \"Cannot set an exclusive role to 0x0\");\n roleMembership.member = newMember;\n }\n\n function getMember(RoleMembership storage roleMembership) internal view returns (address) {\n return roleMembership.member;\n }\n\n function init(RoleMembership storage roleMembership, address initialMember) internal {\n resetMember(roleMembership, initialMember);\n }\n}\n\nlibrary Shared {\n struct RoleMembership {\n mapping(address => bool) members;\n }\n\n function isMember(RoleMembership storage roleMembership, address memberToCheck) internal view returns (bool) {\n return roleMembership.members[memberToCheck];\n }\n\n function addMember(RoleMembership storage roleMembership, address memberToAdd) internal {\n require(memberToAdd != address(0x0), \"Cannot add 0x0 to a shared role\");\n roleMembership.members[memberToAdd] = true;\n }\n\n function removeMember(RoleMembership storage roleMembership, address memberToRemove) internal {\n roleMembership.members[memberToRemove] = false;\n }\n\n function init(RoleMembership storage roleMembership, address[] memory initialMembers) internal {\n for (uint256 i = 0; i < initialMembers.length; i++) {\n addMember(roleMembership, initialMembers[i]);\n }\n }\n}\n\n/**\n * @title Base class to manage permissions for the derived class.\n */\nabstract contract MultiRole {\n using Exclusive for Exclusive.RoleMembership;\n using Shared for Shared.RoleMembership;\n\n enum RoleType { Invalid, Exclusive, Shared }\n\n struct Role {\n uint256 managingRole;\n RoleType roleType;\n Exclusive.RoleMembership exclusiveRoleMembership;\n Shared.RoleMembership sharedRoleMembership;\n }\n\n mapping(uint256 => Role) private roles;\n\n event ResetExclusiveMember(uint256 indexed roleId, address indexed newMember, address indexed manager);\n event AddedSharedMember(uint256 indexed roleId, address indexed newMember, address indexed manager);\n event RemovedSharedMember(uint256 indexed roleId, address indexed oldMember, address indexed manager);\n\n /**\n * @notice Reverts unless the caller is a member of the specified roleId.\n */\n modifier onlyRoleHolder(uint256 roleId) {\n require(holdsRole(roleId, msg.sender), \"Sender does not hold required role\");\n _;\n }\n\n /**\n * @notice Reverts unless the caller is a member of the manager role for the specified roleId.\n */\n modifier onlyRoleManager(uint256 roleId) {\n require(holdsRole(roles[roleId].managingRole, msg.sender), \"Can only be called by a role manager\");\n _;\n }\n\n /**\n * @notice Reverts unless the roleId represents an initialized, exclusive roleId.\n */\n modifier onlyExclusive(uint256 roleId) {\n require(roles[roleId].roleType == RoleType.Exclusive, \"Must be called on an initialized Exclusive role\");\n _;\n }\n\n /**\n * @notice Reverts unless the roleId represents an initialized, shared roleId.\n */\n modifier onlyShared(uint256 roleId) {\n require(roles[roleId].roleType == RoleType.Shared, \"Must be called on an initialized Shared role\");\n _;\n }\n\n /**\n * @notice Whether `memberToCheck` is a member of roleId.\n * @dev Reverts if roleId does not correspond to an initialized role.\n * @param roleId the Role to check.\n * @param memberToCheck the address to check.\n * @return True if `memberToCheck` is a member of `roleId`.\n */\n function holdsRole(uint256 roleId, address memberToCheck) public view returns (bool) {\n Role storage role = roles[roleId];\n if (role.roleType == RoleType.Exclusive) {\n return role.exclusiveRoleMembership.isMember(memberToCheck);\n } else if (role.roleType == RoleType.Shared) {\n return role.sharedRoleMembership.isMember(memberToCheck);\n }\n revert(\"Invalid roleId\");\n }\n\n /**\n * @notice Changes the exclusive role holder of `roleId` to `newMember`.\n * @dev Reverts if the caller is not a member of the managing role for `roleId` or if `roleId` is not an\n * initialized, ExclusiveRole.\n * @param roleId the ExclusiveRole membership to modify.\n * @param newMember the new ExclusiveRole member.\n */\n function resetMember(uint256 roleId, address newMember) public onlyExclusive(roleId) onlyRoleManager(roleId) {\n roles[roleId].exclusiveRoleMembership.resetMember(newMember);\n emit ResetExclusiveMember(roleId, newMember, msg.sender);\n }\n\n /**\n * @notice Gets the current holder of the exclusive role, `roleId`.\n * @dev Reverts if `roleId` does not represent an initialized, exclusive role.\n * @param roleId the ExclusiveRole membership to check.\n * @return the address of the current ExclusiveRole member.\n */\n function getMember(uint256 roleId) public view onlyExclusive(roleId) returns (address) {\n return roles[roleId].exclusiveRoleMembership.getMember();\n }\n\n /**\n * @notice Adds `newMember` to the shared role, `roleId`.\n * @dev Reverts if `roleId` does not represent an initialized, SharedRole or if the caller is not a member of the\n * managing role for `roleId`.\n * @param roleId the SharedRole membership to modify.\n * @param newMember the new SharedRole member.\n */\n function addMember(uint256 roleId, address newMember) public onlyShared(roleId) onlyRoleManager(roleId) {\n roles[roleId].sharedRoleMembership.addMember(newMember);\n emit AddedSharedMember(roleId, newMember, msg.sender);\n }\n\n /**\n * @notice Removes `memberToRemove` from the shared role, `roleId`.\n * @dev Reverts if `roleId` does not represent an initialized, SharedRole or if the caller is not a member of the\n * managing role for `roleId`.\n * @param roleId the SharedRole membership to modify.\n * @param memberToRemove the current SharedRole member to remove.\n */\n function removeMember(uint256 roleId, address memberToRemove) public onlyShared(roleId) onlyRoleManager(roleId) {\n roles[roleId].sharedRoleMembership.removeMember(memberToRemove);\n emit RemovedSharedMember(roleId, memberToRemove, msg.sender);\n }\n\n /**\n * @notice Removes caller from the role, `roleId`.\n * @dev Reverts if the caller is not a member of the role for `roleId` or if `roleId` is not an\n * initialized, SharedRole.\n * @param roleId the SharedRole membership to modify.\n */\n function renounceMembership(uint256 roleId) public onlyShared(roleId) onlyRoleHolder(roleId) {\n roles[roleId].sharedRoleMembership.removeMember(msg.sender);\n emit RemovedSharedMember(roleId, msg.sender, msg.sender);\n }\n\n /**\n * @notice Reverts if `roleId` is not initialized.\n */\n modifier onlyValidRole(uint256 roleId) {\n require(roles[roleId].roleType != RoleType.Invalid, \"Attempted to use an invalid roleId\");\n _;\n }\n\n /**\n * @notice Reverts if `roleId` is initialized.\n */\n modifier onlyInvalidRole(uint256 roleId) {\n require(roles[roleId].roleType == RoleType.Invalid, \"Cannot use a pre-existing role\");\n _;\n }\n\n /**\n * @notice Internal method to initialize a shared role, `roleId`, which will be managed by `managingRoleId`.\n * `initialMembers` will be immediately added to the role.\n * @dev Should be called by derived contracts, usually at construction time. Will revert if the role is already\n * initialized.\n */\n function _createSharedRole(\n uint256 roleId,\n uint256 managingRoleId,\n address[] memory initialMembers\n ) internal onlyInvalidRole(roleId) {\n Role storage role = roles[roleId];\n role.roleType = RoleType.Shared;\n role.managingRole = managingRoleId;\n role.sharedRoleMembership.init(initialMembers);\n require(\n roles[managingRoleId].roleType != RoleType.Invalid,\n \"Attempted to use an invalid role to manage a shared role\"\n );\n }\n\n /**\n * @notice Internal method to initialize an exclusive role, `roleId`, which will be managed by `managingRoleId`.\n * `initialMember` will be immediately added to the role.\n * @dev Should be called by derived contracts, usually at construction time. Will revert if the role is already\n * initialized.\n */\n function _createExclusiveRole(\n uint256 roleId,\n uint256 managingRoleId,\n address initialMember\n ) internal onlyInvalidRole(roleId) {\n Role storage role = roles[roleId];\n role.roleType = RoleType.Exclusive;\n role.managingRole = managingRoleId;\n role.exclusiveRoleMembership.init(initialMember);\n require(\n roles[managingRoleId].roleType != RoleType.Invalid,\n \"Attempted to use an invalid role to manage an exclusive role\"\n );\n }\n}\n" - }, - "contracts/LpTokenFactory.sol": { - "content": "// SPDX-License-Identifier: GPL-3.0-only\npragma solidity ^0.8.0;\n\nimport \"./interfaces/LpTokenFactoryInterface.sol\";\n\nimport \"@uma/core/contracts/common/implementation/ExpandedERC20.sol\";\n\ncontract LpTokenFactory is LpTokenFactoryInterface {\n function createLpToken(address l1Token) public returns (address) {\n ExpandedERC20 lpToken = new ExpandedERC20(\n _append(\"Across \", IERC20Metadata(l1Token).name(), \" LP Token\"), // LP Token Name\n _append(\"Av2-\", IERC20Metadata(l1Token).symbol(), \"-LP\"), // LP Token Symbol\n IERC20Metadata(l1Token).decimals() // LP Token Decimals\n );\n lpToken.addMember(1, msg.sender); // Set this contract as the LP Token's minter.\n lpToken.addMember(2, msg.sender); // Set this contract as the LP Token's burner.\n\n return address(lpToken);\n }\n\n function _append(\n string memory a,\n string memory b,\n string memory c\n ) internal pure returns (string memory) {\n return string(abi.encodePacked(a, b, c));\n }\n}\n" - }, - "contracts/interfaces/LpTokenFactoryInterface.sol": { - "content": "// SPDX-License-Identifier: AGPL-3.0-only\npragma solidity ^0.8.0;\n\nimport \"@openzeppelin/contracts/token/ERC20/IERC20.sol\";\n\ninterface LpTokenFactoryInterface {\n function createLpToken(address l1Token) external returns (address);\n}\n" - }, - "@uma/core/contracts/oracle/interfaces/SkinnyOptimisticOracleInterface.sol": { - "content": "// SPDX-License-Identifier: AGPL-3.0-only\npragma solidity ^0.8.0;\n\nimport \"@openzeppelin/contracts/token/ERC20/IERC20.sol\";\nimport \"../interfaces/OptimisticOracleInterface.sol\";\n\n/**\n * @title Interface for the gas-cost-reduced version of the OptimisticOracle.\n * @notice Differences from normal OptimisticOracle:\n * - refundOnDispute: flag is removed, by default there are no refunds on disputes.\n * - customizing request parameters: In the OptimisticOracle, parameters like `bond` and `customLiveness` can be reset\n * after a request is already made via `requestPrice`. In the SkinnyOptimisticOracle, these parameters can only be\n * set in `requestPrice`, which has an expanded input set.\n * - settleAndGetPrice: Replaced by `settle`, which can only be called once per settleable request. The resolved price\n * can be fetched via the `Settle` event or the return value of `settle`.\n * - general changes to interface: Functions that interact with existing requests all require the parameters of the\n * request to modify to be passed as input. These parameters must match with the existing request parameters or the\n * function will revert. This change reflects the internal refactor to store hashed request parameters instead of the\n * full request struct.\n * @dev Interface used by financial contracts to interact with the Oracle. Voters will use a different interface.\n */\nabstract contract SkinnyOptimisticOracleInterface {\n // Struct representing a price request. Note that this differs from the OptimisticOracleInterface's Request struct\n // in that refundOnDispute is removed.\n struct Request {\n address proposer; // Address of the proposer.\n address disputer; // Address of the disputer.\n IERC20 currency; // ERC20 token used to pay rewards and fees.\n bool settled; // True if the request is settled.\n int256 proposedPrice; // Price that the proposer submitted.\n int256 resolvedPrice; // Price resolved once the request is settled.\n uint256 expirationTime; // Time at which the request auto-settles without a dispute.\n uint256 reward; // Amount of the currency to pay to the proposer on settlement.\n uint256 finalFee; // Final fee to pay to the Store upon request to the DVM.\n uint256 bond; // Bond that the proposer and disputer must pay on top of the final fee.\n uint256 customLiveness; // Custom liveness value set by the requester.\n }\n\n // This value must be <= the Voting contract's `ancillaryBytesLimit` value otherwise it is possible\n // that a price can be requested to this contract successfully, but cannot be disputed because the DVM refuses\n // to accept a price request made with ancillary data length over a certain size.\n uint256 public constant ancillaryBytesLimit = 8192;\n\n /**\n * @notice Requests a new price.\n * @param identifier price identifier being requested.\n * @param timestamp timestamp of the price being requested.\n * @param ancillaryData ancillary data representing additional args being passed with the price request.\n * @param currency ERC20 token used for payment of rewards and fees. Must be approved for use with the DVM.\n * @param reward reward offered to a successful proposer. Will be pulled from the caller. Note: this can be 0,\n * which could make sense if the contract requests and proposes the value in the same call or\n * provides its own reward system.\n * @param bond custom proposal bond to set for request. If set to 0, defaults to the final fee.\n * @param customLiveness custom proposal liveness to set for request.\n * @return totalBond default bond + final fee that the proposer and disputer will be required to pay.\n */\n function requestPrice(\n bytes32 identifier,\n uint32 timestamp,\n bytes memory ancillaryData,\n IERC20 currency,\n uint256 reward,\n uint256 bond,\n uint256 customLiveness\n ) external virtual returns (uint256 totalBond);\n\n /**\n * @notice Proposes a price value on another address' behalf. Note: this address will receive any rewards that come\n * from this proposal. However, any bonds are pulled from the caller.\n * @param requester sender of the initial price request.\n * @param identifier price identifier to identify the existing request.\n * @param timestamp timestamp to identify the existing request.\n * @param ancillaryData ancillary data of the price being requested.\n * @param request price request parameters whose hash must match the request that the caller wants to\n * propose a price for.\n * @param proposer address to set as the proposer.\n * @param proposedPrice price being proposed.\n * @return totalBond the amount that's pulled from the caller's wallet as a bond. The bond will be returned to\n * the proposer once settled if the proposal is correct.\n */\n function proposePriceFor(\n address requester,\n bytes32 identifier,\n uint32 timestamp,\n bytes memory ancillaryData,\n Request memory request,\n address proposer,\n int256 proposedPrice\n ) public virtual returns (uint256 totalBond);\n\n /**\n * @notice Proposes a price value where caller is the proposer.\n * @param requester sender of the initial price request.\n * @param identifier price identifier to identify the existing request.\n * @param timestamp timestamp to identify the existing request.\n * @param ancillaryData ancillary data of the price being requested.\n * @param request price request parameters whose hash must match the request that the caller wants to\n * propose a price for.\n * @param proposedPrice price being proposed.\n * @return totalBond the amount that's pulled from the caller's wallet as a bond. The bond will be returned to\n * the proposer once settled if the proposal is correct.\n */\n function proposePrice(\n address requester,\n bytes32 identifier,\n uint32 timestamp,\n bytes memory ancillaryData,\n Request memory request,\n int256 proposedPrice\n ) external virtual returns (uint256 totalBond);\n\n /**\n * @notice Combines logic of requestPrice and proposePrice while taking advantage of gas savings from not having to\n * overwrite Request params that a normal requestPrice() => proposePrice() flow would entail. Note: The proposer\n * will receive any rewards that come from this proposal. However, any bonds are pulled from the caller.\n * @dev The caller is the requester, but the proposer can be customized.\n * @param identifier price identifier to identify the existing request.\n * @param timestamp timestamp to identify the existing request.\n * @param ancillaryData ancillary data of the price being requested.\n * @param currency ERC20 token used for payment of rewards and fees. Must be approved for use with the DVM.\n * @param reward reward offered to a successful proposer. Will be pulled from the caller. Note: this can be 0,\n * which could make sense if the contract requests and proposes the value in the same call or\n * provides its own reward system.\n * @param bond custom proposal bond to set for request. If set to 0, defaults to the final fee.\n * @param customLiveness custom proposal liveness to set for request.\n * @param proposer address to set as the proposer.\n * @param proposedPrice price being proposed.\n * @return totalBond the amount that's pulled from the caller's wallet as a bond. The bond will be returned to\n * the proposer once settled if the proposal is correct.\n */\n function requestAndProposePriceFor(\n bytes32 identifier,\n uint32 timestamp,\n bytes memory ancillaryData,\n IERC20 currency,\n uint256 reward,\n uint256 bond,\n uint256 customLiveness,\n address proposer,\n int256 proposedPrice\n ) external virtual returns (uint256 totalBond);\n\n /**\n * @notice Disputes a price request with an active proposal on another address' behalf. Note: this address will\n * receive any rewards that come from this dispute. However, any bonds are pulled from the caller.\n * @param identifier price identifier to identify the existing request.\n * @param timestamp timestamp to identify the existing request.\n * @param ancillaryData ancillary data of the price being requested.\n * @param request price request parameters whose hash must match the request that the caller wants to\n * dispute.\n * @param disputer address to set as the disputer.\n * @param requester sender of the initial price request.\n * @return totalBond the amount that's pulled from the caller's wallet as a bond. The bond will be returned to\n * the disputer once settled if the dispute was valid (the proposal was incorrect).\n */\n function disputePriceFor(\n bytes32 identifier,\n uint32 timestamp,\n bytes memory ancillaryData,\n Request memory request,\n address disputer,\n address requester\n ) public virtual returns (uint256 totalBond);\n\n /**\n * @notice Disputes a price request with an active proposal where caller is the disputer.\n * @param requester sender of the initial price request.\n * @param identifier price identifier to identify the existing request.\n * @param timestamp timestamp to identify the existing request.\n * @param ancillaryData ancillary data of the price being requested.\n * @param request price request parameters whose hash must match the request that the caller wants to\n * dispute.\n * @return totalBond the amount that's pulled from the caller's wallet as a bond. The bond will be returned to\n * the disputer once settled if the dispute was valid (the proposal was incorrect).\n */\n function disputePrice(\n address requester,\n bytes32 identifier,\n uint32 timestamp,\n bytes memory ancillaryData,\n Request memory request\n ) external virtual returns (uint256 totalBond);\n\n /**\n * @notice Attempts to settle an outstanding price request. Will revert if it isn't settleable.\n * @param requester sender of the initial price request.\n * @param identifier price identifier to identify the existing request.\n * @param timestamp timestamp to identify the existing request.\n * @param ancillaryData ancillary data of the price being requested.\n * @param request price request parameters whose hash must match the request that the caller wants to\n * settle.\n * @return payout the amount that the \"winner\" (proposer or disputer) receives on settlement. This amount includes\n * the returned bonds as well as additional rewards.\n * @return resolvedPrice the price that the request settled to.\n */\n function settle(\n address requester,\n bytes32 identifier,\n uint32 timestamp,\n bytes memory ancillaryData,\n Request memory request\n ) external virtual returns (uint256 payout, int256 resolvedPrice);\n\n /**\n * @notice Computes the current state of a price request. See the State enum for more details.\n * @param requester sender of the initial price request.\n * @param identifier price identifier to identify the existing request.\n * @param timestamp timestamp to identify the existing request.\n * @param ancillaryData ancillary data of the price being requested.\n * @param request price request parameters.\n * @return the State.\n */\n function getState(\n address requester,\n bytes32 identifier,\n uint32 timestamp,\n bytes memory ancillaryData,\n Request memory request\n ) external virtual returns (OptimisticOracleInterface.State);\n\n /**\n * @notice Checks if a given request has resolved, expired or been settled (i.e the optimistic oracle has a price).\n * @param requester sender of the initial price request.\n * @param identifier price identifier to identify the existing request.\n * @param timestamp timestamp to identify the existing request.\n * @param ancillaryData ancillary data of the price being requested.\n * @param request price request parameters. The hash of these parameters must match with the request hash that is\n * associated with the price request unique ID {requester, identifier, timestamp, ancillaryData}, or this method\n * will revert.\n * @return boolean indicating true if price exists and false if not.\n */\n function hasPrice(\n address requester,\n bytes32 identifier,\n uint32 timestamp,\n bytes memory ancillaryData,\n Request memory request\n ) public virtual returns (bool);\n\n /**\n * @notice Generates stamped ancillary data in the format that it would be used in the case of a price dispute.\n * @param ancillaryData ancillary data of the price being requested.\n * @param requester sender of the initial price request.\n * @return the stamped ancillary bytes.\n */\n function stampAncillaryData(bytes memory ancillaryData, address requester)\n public\n pure\n virtual\n returns (bytes memory);\n}\n" - }, - "@uma/core/contracts/oracle/interfaces/OptimisticOracleInterface.sol": { - "content": "// SPDX-License-Identifier: AGPL-3.0-only\npragma solidity ^0.8.0;\n\nimport \"@openzeppelin/contracts/token/ERC20/IERC20.sol\";\n\n/**\n * @title Financial contract facing Oracle interface.\n * @dev Interface used by financial contracts to interact with the Oracle. Voters will use a different interface.\n */\nabstract contract OptimisticOracleInterface {\n // Struct representing the state of a price request.\n enum State {\n Invalid, // Never requested.\n Requested, // Requested, no other actions taken.\n Proposed, // Proposed, but not expired or disputed yet.\n Expired, // Proposed, not disputed, past liveness.\n Disputed, // Disputed, but no DVM price returned yet.\n Resolved, // Disputed and DVM price is available.\n Settled // Final price has been set in the contract (can get here from Expired or Resolved).\n }\n\n // Struct representing a price request.\n struct Request {\n address proposer; // Address of the proposer.\n address disputer; // Address of the disputer.\n IERC20 currency; // ERC20 token used to pay rewards and fees.\n bool settled; // True if the request is settled.\n bool refundOnDispute; // True if the requester should be refunded their reward on dispute.\n int256 proposedPrice; // Price that the proposer submitted.\n int256 resolvedPrice; // Price resolved once the request is settled.\n uint256 expirationTime; // Time at which the request auto-settles without a dispute.\n uint256 reward; // Amount of the currency to pay to the proposer on settlement.\n uint256 finalFee; // Final fee to pay to the Store upon request to the DVM.\n uint256 bond; // Bond that the proposer and disputer must pay on top of the final fee.\n uint256 customLiveness; // Custom liveness value set by the requester.\n }\n\n // This value must be <= the Voting contract's `ancillaryBytesLimit` value otherwise it is possible\n // that a price can be requested to this contract successfully, but cannot be disputed because the DVM refuses\n // to accept a price request made with ancillary data length over a certain size.\n uint256 public constant ancillaryBytesLimit = 8192;\n\n /**\n * @notice Requests a new price.\n * @param identifier price identifier being requested.\n * @param timestamp timestamp of the price being requested.\n * @param ancillaryData ancillary data representing additional args being passed with the price request.\n * @param currency ERC20 token used for payment of rewards and fees. Must be approved for use with the DVM.\n * @param reward reward offered to a successful proposer. Will be pulled from the caller. Note: this can be 0,\n * which could make sense if the contract requests and proposes the value in the same call or\n * provides its own reward system.\n * @return totalBond default bond (final fee) + final fee that the proposer and disputer will be required to pay.\n * This can be changed with a subsequent call to setBond().\n */\n function requestPrice(\n bytes32 identifier,\n uint256 timestamp,\n bytes memory ancillaryData,\n IERC20 currency,\n uint256 reward\n ) external virtual returns (uint256 totalBond);\n\n /**\n * @notice Set the proposal bond associated with a price request.\n * @param identifier price identifier to identify the existing request.\n * @param timestamp timestamp to identify the existing request.\n * @param ancillaryData ancillary data of the price being requested.\n * @param bond custom bond amount to set.\n * @return totalBond new bond + final fee that the proposer and disputer will be required to pay. This can be\n * changed again with a subsequent call to setBond().\n */\n function setBond(\n bytes32 identifier,\n uint256 timestamp,\n bytes memory ancillaryData,\n uint256 bond\n ) external virtual returns (uint256 totalBond);\n\n /**\n * @notice Sets the request to refund the reward if the proposal is disputed. This can help to \"hedge\" the caller\n * in the event of a dispute-caused delay. Note: in the event of a dispute, the winner still receives the other's\n * bond, so there is still profit to be made even if the reward is refunded.\n * @param identifier price identifier to identify the existing request.\n * @param timestamp timestamp to identify the existing request.\n * @param ancillaryData ancillary data of the price being requested.\n */\n function setRefundOnDispute(\n bytes32 identifier,\n uint256 timestamp,\n bytes memory ancillaryData\n ) external virtual;\n\n /**\n * @notice Sets a custom liveness value for the request. Liveness is the amount of time a proposal must wait before\n * being auto-resolved.\n * @param identifier price identifier to identify the existing request.\n * @param timestamp timestamp to identify the existing request.\n * @param ancillaryData ancillary data of the price being requested.\n * @param customLiveness new custom liveness.\n */\n function setCustomLiveness(\n bytes32 identifier,\n uint256 timestamp,\n bytes memory ancillaryData,\n uint256 customLiveness\n ) external virtual;\n\n /**\n * @notice Proposes a price value on another address' behalf. Note: this address will receive any rewards that come\n * from this proposal. However, any bonds are pulled from the caller.\n * @param proposer address to set as the proposer.\n * @param requester sender of the initial price request.\n * @param identifier price identifier to identify the existing request.\n * @param timestamp timestamp to identify the existing request.\n * @param ancillaryData ancillary data of the price being requested.\n * @param proposedPrice price being proposed.\n * @return totalBond the amount that's pulled from the caller's wallet as a bond. The bond will be returned to\n * the proposer once settled if the proposal is correct.\n */\n function proposePriceFor(\n address proposer,\n address requester,\n bytes32 identifier,\n uint256 timestamp,\n bytes memory ancillaryData,\n int256 proposedPrice\n ) public virtual returns (uint256 totalBond);\n\n /**\n * @notice Proposes a price value for an existing price request.\n * @param requester sender of the initial price request.\n * @param identifier price identifier to identify the existing request.\n * @param timestamp timestamp to identify the existing request.\n * @param ancillaryData ancillary data of the price being requested.\n * @param proposedPrice price being proposed.\n * @return totalBond the amount that's pulled from the proposer's wallet as a bond. The bond will be returned to\n * the proposer once settled if the proposal is correct.\n */\n function proposePrice(\n address requester,\n bytes32 identifier,\n uint256 timestamp,\n bytes memory ancillaryData,\n int256 proposedPrice\n ) external virtual returns (uint256 totalBond);\n\n /**\n * @notice Disputes a price request with an active proposal on another address' behalf. Note: this address will\n * receive any rewards that come from this dispute. However, any bonds are pulled from the caller.\n * @param disputer address to set as the disputer.\n * @param requester sender of the initial price request.\n * @param identifier price identifier to identify the existing request.\n * @param timestamp timestamp to identify the existing request.\n * @param ancillaryData ancillary data of the price being requested.\n * @return totalBond the amount that's pulled from the caller's wallet as a bond. The bond will be returned to\n * the disputer once settled if the dispute was value (the proposal was incorrect).\n */\n function disputePriceFor(\n address disputer,\n address requester,\n bytes32 identifier,\n uint256 timestamp,\n bytes memory ancillaryData\n ) public virtual returns (uint256 totalBond);\n\n /**\n * @notice Disputes a price value for an existing price request with an active proposal.\n * @param requester sender of the initial price request.\n * @param identifier price identifier to identify the existing request.\n * @param timestamp timestamp to identify the existing request.\n * @param ancillaryData ancillary data of the price being requested.\n * @return totalBond the amount that's pulled from the disputer's wallet as a bond. The bond will be returned to\n * the disputer once settled if the dispute was valid (the proposal was incorrect).\n */\n function disputePrice(\n address requester,\n bytes32 identifier,\n uint256 timestamp,\n bytes memory ancillaryData\n ) external virtual returns (uint256 totalBond);\n\n /**\n * @notice Retrieves a price that was previously requested by a caller. Reverts if the request is not settled\n * or settleable. Note: this method is not view so that this call may actually settle the price request if it\n * hasn't been settled.\n * @param identifier price identifier to identify the existing request.\n * @param timestamp timestamp to identify the existing request.\n * @param ancillaryData ancillary data of the price being requested.\n * @return resolved price.\n */\n function settleAndGetPrice(\n bytes32 identifier,\n uint256 timestamp,\n bytes memory ancillaryData\n ) external virtual returns (int256);\n\n /**\n * @notice Attempts to settle an outstanding price request. Will revert if it isn't settleable.\n * @param requester sender of the initial price request.\n * @param identifier price identifier to identify the existing request.\n * @param timestamp timestamp to identify the existing request.\n * @param ancillaryData ancillary data of the price being requested.\n * @return payout the amount that the \"winner\" (proposer or disputer) receives on settlement. This amount includes\n * the returned bonds as well as additional rewards.\n */\n function settle(\n address requester,\n bytes32 identifier,\n uint256 timestamp,\n bytes memory ancillaryData\n ) external virtual returns (uint256 payout);\n\n /**\n * @notice Gets the current data structure containing all information about a price request.\n * @param requester sender of the initial price request.\n * @param identifier price identifier to identify the existing request.\n * @param timestamp timestamp to identify the existing request.\n * @param ancillaryData ancillary data of the price being requested.\n * @return the Request data structure.\n */\n function getRequest(\n address requester,\n bytes32 identifier,\n uint256 timestamp,\n bytes memory ancillaryData\n ) public view virtual returns (Request memory);\n\n /**\n * @notice Returns the state of a price request.\n * @param requester sender of the initial price request.\n * @param identifier price identifier to identify the existing request.\n * @param timestamp timestamp to identify the existing request.\n * @param ancillaryData ancillary data of the price being requested.\n * @return the State enum value.\n */\n function getState(\n address requester,\n bytes32 identifier,\n uint256 timestamp,\n bytes memory ancillaryData\n ) public view virtual returns (State);\n\n /**\n * @notice Checks if a given request has resolved or been settled (i.e the optimistic oracle has a price).\n * @param requester sender of the initial price request.\n * @param identifier price identifier to identify the existing request.\n * @param timestamp timestamp to identify the existing request.\n * @param ancillaryData ancillary data of the price being requested.\n * @return true if price has resolved or settled, false otherwise.\n */\n function hasPrice(\n address requester,\n bytes32 identifier,\n uint256 timestamp,\n bytes memory ancillaryData\n ) public view virtual returns (bool);\n\n function stampAncillaryData(bytes memory ancillaryData, address requester)\n public\n view\n virtual\n returns (bytes memory);\n}\n" - }, - "@uma/core/contracts/oracle/interfaces/StoreInterface.sol": { - "content": "// SPDX-License-Identifier: AGPL-3.0-only\npragma solidity ^0.8.0;\n\nimport \"@openzeppelin/contracts/token/ERC20/IERC20.sol\";\nimport \"../../common/implementation/FixedPoint.sol\";\n\n/**\n * @title Interface that allows financial contracts to pay oracle fees for their use of the system.\n */\ninterface StoreInterface {\n /**\n * @notice Pays Oracle fees in ETH to the store.\n * @dev To be used by contracts whose margin currency is ETH.\n */\n function payOracleFees() external payable;\n\n /**\n * @notice Pays oracle fees in the margin currency, erc20Address, to the store.\n * @dev To be used if the margin currency is an ERC20 token rather than ETH.\n * @param erc20Address address of the ERC20 token used to pay the fee.\n * @param amount number of tokens to transfer. An approval for at least this amount must exist.\n */\n function payOracleFeesErc20(address erc20Address, FixedPoint.Unsigned calldata amount) external;\n\n /**\n * @notice Computes the regular oracle fees that a contract should pay for a period.\n * @param startTime defines the beginning time from which the fee is paid.\n * @param endTime end time until which the fee is paid.\n * @param pfc \"profit from corruption\", or the maximum amount of margin currency that a\n * token sponsor could extract from the contract through corrupting the price feed in their favor.\n * @return regularFee amount owed for the duration from start to end time for the given pfc.\n * @return latePenalty for paying the fee after the deadline.\n */\n function computeRegularFee(\n uint256 startTime,\n uint256 endTime,\n FixedPoint.Unsigned calldata pfc\n ) external view returns (FixedPoint.Unsigned memory regularFee, FixedPoint.Unsigned memory latePenalty);\n\n /**\n * @notice Computes the final oracle fees that a contract should pay at settlement.\n * @param currency token used to pay the final fee.\n * @return finalFee amount due.\n */\n function computeFinalFee(address currency) external view returns (FixedPoint.Unsigned memory);\n}\n" - }, - "@uma/core/contracts/common/implementation/FixedPoint.sol": { - "content": "// SPDX-License-Identifier: AGPL-3.0-only\npragma solidity ^0.8.0;\n\nimport \"@openzeppelin/contracts/utils/math/SafeMath.sol\";\nimport \"@openzeppelin/contracts/utils/math/SignedSafeMath.sol\";\n\n/**\n * @title Library for fixed point arithmetic on uints\n */\nlibrary FixedPoint {\n using SafeMath for uint256;\n using SignedSafeMath for int256;\n\n // Supports 18 decimals. E.g., 1e18 represents \"1\", 5e17 represents \"0.5\".\n // For unsigned values:\n // This can represent a value up to (2^256 - 1)/10^18 = ~10^59. 10^59 will be stored internally as uint256 10^77.\n uint256 private constant FP_SCALING_FACTOR = 10**18;\n\n // --------------------------------------- UNSIGNED -----------------------------------------------------------------------------\n struct Unsigned {\n uint256 rawValue;\n }\n\n /**\n * @notice Constructs an `Unsigned` from an unscaled uint, e.g., `b=5` gets stored internally as `5*(10**18)`.\n * @param a uint to convert into a FixedPoint.\n * @return the converted FixedPoint.\n */\n function fromUnscaledUint(uint256 a) internal pure returns (Unsigned memory) {\n return Unsigned(a.mul(FP_SCALING_FACTOR));\n }\n\n /**\n * @notice Whether `a` is equal to `b`.\n * @param a a FixedPoint.\n * @param b a uint256.\n * @return True if equal, or False.\n */\n function isEqual(Unsigned memory a, uint256 b) internal pure returns (bool) {\n return a.rawValue == fromUnscaledUint(b).rawValue;\n }\n\n /**\n * @notice Whether `a` is equal to `b`.\n * @param a a FixedPoint.\n * @param b a FixedPoint.\n * @return True if equal, or False.\n */\n function isEqual(Unsigned memory a, Unsigned memory b) internal pure returns (bool) {\n return a.rawValue == b.rawValue;\n }\n\n /**\n * @notice Whether `a` is greater than `b`.\n * @param a a FixedPoint.\n * @param b a FixedPoint.\n * @return True if `a > b`, or False.\n */\n function isGreaterThan(Unsigned memory a, Unsigned memory b) internal pure returns (bool) {\n return a.rawValue > b.rawValue;\n }\n\n /**\n * @notice Whether `a` is greater than `b`.\n * @param a a FixedPoint.\n * @param b a uint256.\n * @return True if `a > b`, or False.\n */\n function isGreaterThan(Unsigned memory a, uint256 b) internal pure returns (bool) {\n return a.rawValue > fromUnscaledUint(b).rawValue;\n }\n\n /**\n * @notice Whether `a` is greater than `b`.\n * @param a a uint256.\n * @param b a FixedPoint.\n * @return True if `a > b`, or False.\n */\n function isGreaterThan(uint256 a, Unsigned memory b) internal pure returns (bool) {\n return fromUnscaledUint(a).rawValue > b.rawValue;\n }\n\n /**\n * @notice Whether `a` is greater than or equal to `b`.\n * @param a a FixedPoint.\n * @param b a FixedPoint.\n * @return True if `a >= b`, or False.\n */\n function isGreaterThanOrEqual(Unsigned memory a, Unsigned memory b) internal pure returns (bool) {\n return a.rawValue >= b.rawValue;\n }\n\n /**\n * @notice Whether `a` is greater than or equal to `b`.\n * @param a a FixedPoint.\n * @param b a uint256.\n * @return True if `a >= b`, or False.\n */\n function isGreaterThanOrEqual(Unsigned memory a, uint256 b) internal pure returns (bool) {\n return a.rawValue >= fromUnscaledUint(b).rawValue;\n }\n\n /**\n * @notice Whether `a` is greater than or equal to `b`.\n * @param a a uint256.\n * @param b a FixedPoint.\n * @return True if `a >= b`, or False.\n */\n function isGreaterThanOrEqual(uint256 a, Unsigned memory b) internal pure returns (bool) {\n return fromUnscaledUint(a).rawValue >= b.rawValue;\n }\n\n /**\n * @notice Whether `a` is less than `b`.\n * @param a a FixedPoint.\n * @param b a FixedPoint.\n * @return True if `a < b`, or False.\n */\n function isLessThan(Unsigned memory a, Unsigned memory b) internal pure returns (bool) {\n return a.rawValue < b.rawValue;\n }\n\n /**\n * @notice Whether `a` is less than `b`.\n * @param a a FixedPoint.\n * @param b a uint256.\n * @return True if `a < b`, or False.\n */\n function isLessThan(Unsigned memory a, uint256 b) internal pure returns (bool) {\n return a.rawValue < fromUnscaledUint(b).rawValue;\n }\n\n /**\n * @notice Whether `a` is less than `b`.\n * @param a a uint256.\n * @param b a FixedPoint.\n * @return True if `a < b`, or False.\n */\n function isLessThan(uint256 a, Unsigned memory b) internal pure returns (bool) {\n return fromUnscaledUint(a).rawValue < b.rawValue;\n }\n\n /**\n * @notice Whether `a` is less than or equal to `b`.\n * @param a a FixedPoint.\n * @param b a FixedPoint.\n * @return True if `a <= b`, or False.\n */\n function isLessThanOrEqual(Unsigned memory a, Unsigned memory b) internal pure returns (bool) {\n return a.rawValue <= b.rawValue;\n }\n\n /**\n * @notice Whether `a` is less than or equal to `b`.\n * @param a a FixedPoint.\n * @param b a uint256.\n * @return True if `a <= b`, or False.\n */\n function isLessThanOrEqual(Unsigned memory a, uint256 b) internal pure returns (bool) {\n return a.rawValue <= fromUnscaledUint(b).rawValue;\n }\n\n /**\n * @notice Whether `a` is less than or equal to `b`.\n * @param a a uint256.\n * @param b a FixedPoint.\n * @return True if `a <= b`, or False.\n */\n function isLessThanOrEqual(uint256 a, Unsigned memory b) internal pure returns (bool) {\n return fromUnscaledUint(a).rawValue <= b.rawValue;\n }\n\n /**\n * @notice The minimum of `a` and `b`.\n * @param a a FixedPoint.\n * @param b a FixedPoint.\n * @return the minimum of `a` and `b`.\n */\n function min(Unsigned memory a, Unsigned memory b) internal pure returns (Unsigned memory) {\n return a.rawValue < b.rawValue ? a : b;\n }\n\n /**\n * @notice The maximum of `a` and `b`.\n * @param a a FixedPoint.\n * @param b a FixedPoint.\n * @return the maximum of `a` and `b`.\n */\n function max(Unsigned memory a, Unsigned memory b) internal pure returns (Unsigned memory) {\n return a.rawValue > b.rawValue ? a : b;\n }\n\n /**\n * @notice Adds two `Unsigned`s, reverting on overflow.\n * @param a a FixedPoint.\n * @param b a FixedPoint.\n * @return the sum of `a` and `b`.\n */\n function add(Unsigned memory a, Unsigned memory b) internal pure returns (Unsigned memory) {\n return Unsigned(a.rawValue.add(b.rawValue));\n }\n\n /**\n * @notice Adds an `Unsigned` to an unscaled uint, reverting on overflow.\n * @param a a FixedPoint.\n * @param b a uint256.\n * @return the sum of `a` and `b`.\n */\n function add(Unsigned memory a, uint256 b) internal pure returns (Unsigned memory) {\n return add(a, fromUnscaledUint(b));\n }\n\n /**\n * @notice Subtracts two `Unsigned`s, reverting on overflow.\n * @param a a FixedPoint.\n * @param b a FixedPoint.\n * @return the difference of `a` and `b`.\n */\n function sub(Unsigned memory a, Unsigned memory b) internal pure returns (Unsigned memory) {\n return Unsigned(a.rawValue.sub(b.rawValue));\n }\n\n /**\n * @notice Subtracts an unscaled uint256 from an `Unsigned`, reverting on overflow.\n * @param a a FixedPoint.\n * @param b a uint256.\n * @return the difference of `a` and `b`.\n */\n function sub(Unsigned memory a, uint256 b) internal pure returns (Unsigned memory) {\n return sub(a, fromUnscaledUint(b));\n }\n\n /**\n * @notice Subtracts an `Unsigned` from an unscaled uint256, reverting on overflow.\n * @param a a uint256.\n * @param b a FixedPoint.\n * @return the difference of `a` and `b`.\n */\n function sub(uint256 a, Unsigned memory b) internal pure returns (Unsigned memory) {\n return sub(fromUnscaledUint(a), b);\n }\n\n /**\n * @notice Multiplies two `Unsigned`s, reverting on overflow.\n * @dev This will \"floor\" the product.\n * @param a a FixedPoint.\n * @param b a FixedPoint.\n * @return the product of `a` and `b`.\n */\n function mul(Unsigned memory a, Unsigned memory b) internal pure returns (Unsigned memory) {\n // There are two caveats with this computation:\n // 1. Max output for the represented number is ~10^41, otherwise an intermediate value overflows. 10^41 is\n // stored internally as a uint256 ~10^59.\n // 2. Results that can't be represented exactly are truncated not rounded. E.g., 1.4 * 2e-18 = 2.8e-18, which\n // would round to 3, but this computation produces the result 2.\n // No need to use SafeMath because FP_SCALING_FACTOR != 0.\n return Unsigned(a.rawValue.mul(b.rawValue) / FP_SCALING_FACTOR);\n }\n\n /**\n * @notice Multiplies an `Unsigned` and an unscaled uint256, reverting on overflow.\n * @dev This will \"floor\" the product.\n * @param a a FixedPoint.\n * @param b a uint256.\n * @return the product of `a` and `b`.\n */\n function mul(Unsigned memory a, uint256 b) internal pure returns (Unsigned memory) {\n return Unsigned(a.rawValue.mul(b));\n }\n\n /**\n * @notice Multiplies two `Unsigned`s and \"ceil's\" the product, reverting on overflow.\n * @param a a FixedPoint.\n * @param b a FixedPoint.\n * @return the product of `a` and `b`.\n */\n function mulCeil(Unsigned memory a, Unsigned memory b) internal pure returns (Unsigned memory) {\n uint256 mulRaw = a.rawValue.mul(b.rawValue);\n uint256 mulFloor = mulRaw / FP_SCALING_FACTOR;\n uint256 mod = mulRaw.mod(FP_SCALING_FACTOR);\n if (mod != 0) {\n return Unsigned(mulFloor.add(1));\n } else {\n return Unsigned(mulFloor);\n }\n }\n\n /**\n * @notice Multiplies an `Unsigned` and an unscaled uint256 and \"ceil's\" the product, reverting on overflow.\n * @param a a FixedPoint.\n * @param b a FixedPoint.\n * @return the product of `a` and `b`.\n */\n function mulCeil(Unsigned memory a, uint256 b) internal pure returns (Unsigned memory) {\n // Since b is an uint, there is no risk of truncation and we can just mul it normally\n return Unsigned(a.rawValue.mul(b));\n }\n\n /**\n * @notice Divides one `Unsigned` by an `Unsigned`, reverting on overflow or division by 0.\n * @dev This will \"floor\" the quotient.\n * @param a a FixedPoint numerator.\n * @param b a FixedPoint denominator.\n * @return the quotient of `a` divided by `b`.\n */\n function div(Unsigned memory a, Unsigned memory b) internal pure returns (Unsigned memory) {\n // There are two caveats with this computation:\n // 1. Max value for the number dividend `a` represents is ~10^41, otherwise an intermediate value overflows.\n // 10^41 is stored internally as a uint256 10^59.\n // 2. Results that can't be represented exactly are truncated not rounded. E.g., 2 / 3 = 0.6 repeating, which\n // would round to 0.666666666666666667, but this computation produces the result 0.666666666666666666.\n return Unsigned(a.rawValue.mul(FP_SCALING_FACTOR).div(b.rawValue));\n }\n\n /**\n * @notice Divides one `Unsigned` by an unscaled uint256, reverting on overflow or division by 0.\n * @dev This will \"floor\" the quotient.\n * @param a a FixedPoint numerator.\n * @param b a uint256 denominator.\n * @return the quotient of `a` divided by `b`.\n */\n function div(Unsigned memory a, uint256 b) internal pure returns (Unsigned memory) {\n return Unsigned(a.rawValue.div(b));\n }\n\n /**\n * @notice Divides one unscaled uint256 by an `Unsigned`, reverting on overflow or division by 0.\n * @dev This will \"floor\" the quotient.\n * @param a a uint256 numerator.\n * @param b a FixedPoint denominator.\n * @return the quotient of `a` divided by `b`.\n */\n function div(uint256 a, Unsigned memory b) internal pure returns (Unsigned memory) {\n return div(fromUnscaledUint(a), b);\n }\n\n /**\n * @notice Divides one `Unsigned` by an `Unsigned` and \"ceil's\" the quotient, reverting on overflow or division by 0.\n * @param a a FixedPoint numerator.\n * @param b a FixedPoint denominator.\n * @return the quotient of `a` divided by `b`.\n */\n function divCeil(Unsigned memory a, Unsigned memory b) internal pure returns (Unsigned memory) {\n uint256 aScaled = a.rawValue.mul(FP_SCALING_FACTOR);\n uint256 divFloor = aScaled.div(b.rawValue);\n uint256 mod = aScaled.mod(b.rawValue);\n if (mod != 0) {\n return Unsigned(divFloor.add(1));\n } else {\n return Unsigned(divFloor);\n }\n }\n\n /**\n * @notice Divides one `Unsigned` by an unscaled uint256 and \"ceil's\" the quotient, reverting on overflow or division by 0.\n * @param a a FixedPoint numerator.\n * @param b a uint256 denominator.\n * @return the quotient of `a` divided by `b`.\n */\n function divCeil(Unsigned memory a, uint256 b) internal pure returns (Unsigned memory) {\n // Because it is possible that a quotient gets truncated, we can't just call \"Unsigned(a.rawValue.div(b))\"\n // similarly to mulCeil with a uint256 as the second parameter. Therefore we need to convert b into an Unsigned.\n // This creates the possibility of overflow if b is very large.\n return divCeil(a, fromUnscaledUint(b));\n }\n\n /**\n * @notice Raises an `Unsigned` to the power of an unscaled uint256, reverting on overflow. E.g., `b=2` squares `a`.\n * @dev This will \"floor\" the result.\n * @param a a FixedPoint numerator.\n * @param b a uint256 denominator.\n * @return output is `a` to the power of `b`.\n */\n function pow(Unsigned memory a, uint256 b) internal pure returns (Unsigned memory output) {\n output = fromUnscaledUint(1);\n for (uint256 i = 0; i < b; i = i.add(1)) {\n output = mul(output, a);\n }\n }\n\n // ------------------------------------------------- SIGNED -------------------------------------------------------------\n // Supports 18 decimals. E.g., 1e18 represents \"1\", 5e17 represents \"0.5\".\n // For signed values:\n // This can represent a value up (or down) to +-(2^255 - 1)/10^18 = ~10^58. 10^58 will be stored internally as int256 10^76.\n int256 private constant SFP_SCALING_FACTOR = 10**18;\n\n struct Signed {\n int256 rawValue;\n }\n\n function fromSigned(Signed memory a) internal pure returns (Unsigned memory) {\n require(a.rawValue >= 0, \"Negative value provided\");\n return Unsigned(uint256(a.rawValue));\n }\n\n function fromUnsigned(Unsigned memory a) internal pure returns (Signed memory) {\n require(a.rawValue <= uint256(type(int256).max), \"Unsigned too large\");\n return Signed(int256(a.rawValue));\n }\n\n /**\n * @notice Constructs a `Signed` from an unscaled int, e.g., `b=5` gets stored internally as `5*(10**18)`.\n * @param a int to convert into a FixedPoint.Signed.\n * @return the converted FixedPoint.Signed.\n */\n function fromUnscaledInt(int256 a) internal pure returns (Signed memory) {\n return Signed(a.mul(SFP_SCALING_FACTOR));\n }\n\n /**\n * @notice Whether `a` is equal to `b`.\n * @param a a FixedPoint.Signed.\n * @param b a int256.\n * @return True if equal, or False.\n */\n function isEqual(Signed memory a, int256 b) internal pure returns (bool) {\n return a.rawValue == fromUnscaledInt(b).rawValue;\n }\n\n /**\n * @notice Whether `a` is equal to `b`.\n * @param a a FixedPoint.Signed.\n * @param b a FixedPoint.Signed.\n * @return True if equal, or False.\n */\n function isEqual(Signed memory a, Signed memory b) internal pure returns (bool) {\n return a.rawValue == b.rawValue;\n }\n\n /**\n * @notice Whether `a` is greater than `b`.\n * @param a a FixedPoint.Signed.\n * @param b a FixedPoint.Signed.\n * @return True if `a > b`, or False.\n */\n function isGreaterThan(Signed memory a, Signed memory b) internal pure returns (bool) {\n return a.rawValue > b.rawValue;\n }\n\n /**\n * @notice Whether `a` is greater than `b`.\n * @param a a FixedPoint.Signed.\n * @param b an int256.\n * @return True if `a > b`, or False.\n */\n function isGreaterThan(Signed memory a, int256 b) internal pure returns (bool) {\n return a.rawValue > fromUnscaledInt(b).rawValue;\n }\n\n /**\n * @notice Whether `a` is greater than `b`.\n * @param a an int256.\n * @param b a FixedPoint.Signed.\n * @return True if `a > b`, or False.\n */\n function isGreaterThan(int256 a, Signed memory b) internal pure returns (bool) {\n return fromUnscaledInt(a).rawValue > b.rawValue;\n }\n\n /**\n * @notice Whether `a` is greater than or equal to `b`.\n * @param a a FixedPoint.Signed.\n * @param b a FixedPoint.Signed.\n * @return True if `a >= b`, or False.\n */\n function isGreaterThanOrEqual(Signed memory a, Signed memory b) internal pure returns (bool) {\n return a.rawValue >= b.rawValue;\n }\n\n /**\n * @notice Whether `a` is greater than or equal to `b`.\n * @param a a FixedPoint.Signed.\n * @param b an int256.\n * @return True if `a >= b`, or False.\n */\n function isGreaterThanOrEqual(Signed memory a, int256 b) internal pure returns (bool) {\n return a.rawValue >= fromUnscaledInt(b).rawValue;\n }\n\n /**\n * @notice Whether `a` is greater than or equal to `b`.\n * @param a an int256.\n * @param b a FixedPoint.Signed.\n * @return True if `a >= b`, or False.\n */\n function isGreaterThanOrEqual(int256 a, Signed memory b) internal pure returns (bool) {\n return fromUnscaledInt(a).rawValue >= b.rawValue;\n }\n\n /**\n * @notice Whether `a` is less than `b`.\n * @param a a FixedPoint.Signed.\n * @param b a FixedPoint.Signed.\n * @return True if `a < b`, or False.\n */\n function isLessThan(Signed memory a, Signed memory b) internal pure returns (bool) {\n return a.rawValue < b.rawValue;\n }\n\n /**\n * @notice Whether `a` is less than `b`.\n * @param a a FixedPoint.Signed.\n * @param b an int256.\n * @return True if `a < b`, or False.\n */\n function isLessThan(Signed memory a, int256 b) internal pure returns (bool) {\n return a.rawValue < fromUnscaledInt(b).rawValue;\n }\n\n /**\n * @notice Whether `a` is less than `b`.\n * @param a an int256.\n * @param b a FixedPoint.Signed.\n * @return True if `a < b`, or False.\n */\n function isLessThan(int256 a, Signed memory b) internal pure returns (bool) {\n return fromUnscaledInt(a).rawValue < b.rawValue;\n }\n\n /**\n * @notice Whether `a` is less than or equal to `b`.\n * @param a a FixedPoint.Signed.\n * @param b a FixedPoint.Signed.\n * @return True if `a <= b`, or False.\n */\n function isLessThanOrEqual(Signed memory a, Signed memory b) internal pure returns (bool) {\n return a.rawValue <= b.rawValue;\n }\n\n /**\n * @notice Whether `a` is less than or equal to `b`.\n * @param a a FixedPoint.Signed.\n * @param b an int256.\n * @return True if `a <= b`, or False.\n */\n function isLessThanOrEqual(Signed memory a, int256 b) internal pure returns (bool) {\n return a.rawValue <= fromUnscaledInt(b).rawValue;\n }\n\n /**\n * @notice Whether `a` is less than or equal to `b`.\n * @param a an int256.\n * @param b a FixedPoint.Signed.\n * @return True if `a <= b`, or False.\n */\n function isLessThanOrEqual(int256 a, Signed memory b) internal pure returns (bool) {\n return fromUnscaledInt(a).rawValue <= b.rawValue;\n }\n\n /**\n * @notice The minimum of `a` and `b`.\n * @param a a FixedPoint.Signed.\n * @param b a FixedPoint.Signed.\n * @return the minimum of `a` and `b`.\n */\n function min(Signed memory a, Signed memory b) internal pure returns (Signed memory) {\n return a.rawValue < b.rawValue ? a : b;\n }\n\n /**\n * @notice The maximum of `a` and `b`.\n * @param a a FixedPoint.Signed.\n * @param b a FixedPoint.Signed.\n * @return the maximum of `a` and `b`.\n */\n function max(Signed memory a, Signed memory b) internal pure returns (Signed memory) {\n return a.rawValue > b.rawValue ? a : b;\n }\n\n /**\n * @notice Adds two `Signed`s, reverting on overflow.\n * @param a a FixedPoint.Signed.\n * @param b a FixedPoint.Signed.\n * @return the sum of `a` and `b`.\n */\n function add(Signed memory a, Signed memory b) internal pure returns (Signed memory) {\n return Signed(a.rawValue.add(b.rawValue));\n }\n\n /**\n * @notice Adds an `Signed` to an unscaled int, reverting on overflow.\n * @param a a FixedPoint.Signed.\n * @param b an int256.\n * @return the sum of `a` and `b`.\n */\n function add(Signed memory a, int256 b) internal pure returns (Signed memory) {\n return add(a, fromUnscaledInt(b));\n }\n\n /**\n * @notice Subtracts two `Signed`s, reverting on overflow.\n * @param a a FixedPoint.Signed.\n * @param b a FixedPoint.Signed.\n * @return the difference of `a` and `b`.\n */\n function sub(Signed memory a, Signed memory b) internal pure returns (Signed memory) {\n return Signed(a.rawValue.sub(b.rawValue));\n }\n\n /**\n * @notice Subtracts an unscaled int256 from an `Signed`, reverting on overflow.\n * @param a a FixedPoint.Signed.\n * @param b an int256.\n * @return the difference of `a` and `b`.\n */\n function sub(Signed memory a, int256 b) internal pure returns (Signed memory) {\n return sub(a, fromUnscaledInt(b));\n }\n\n /**\n * @notice Subtracts an `Signed` from an unscaled int256, reverting on overflow.\n * @param a an int256.\n * @param b a FixedPoint.Signed.\n * @return the difference of `a` and `b`.\n */\n function sub(int256 a, Signed memory b) internal pure returns (Signed memory) {\n return sub(fromUnscaledInt(a), b);\n }\n\n /**\n * @notice Multiplies two `Signed`s, reverting on overflow.\n * @dev This will \"floor\" the product.\n * @param a a FixedPoint.Signed.\n * @param b a FixedPoint.Signed.\n * @return the product of `a` and `b`.\n */\n function mul(Signed memory a, Signed memory b) internal pure returns (Signed memory) {\n // There are two caveats with this computation:\n // 1. Max output for the represented number is ~10^41, otherwise an intermediate value overflows. 10^41 is\n // stored internally as an int256 ~10^59.\n // 2. Results that can't be represented exactly are truncated not rounded. E.g., 1.4 * 2e-18 = 2.8e-18, which\n // would round to 3, but this computation produces the result 2.\n // No need to use SafeMath because SFP_SCALING_FACTOR != 0.\n return Signed(a.rawValue.mul(b.rawValue) / SFP_SCALING_FACTOR);\n }\n\n /**\n * @notice Multiplies an `Signed` and an unscaled int256, reverting on overflow.\n * @dev This will \"floor\" the product.\n * @param a a FixedPoint.Signed.\n * @param b an int256.\n * @return the product of `a` and `b`.\n */\n function mul(Signed memory a, int256 b) internal pure returns (Signed memory) {\n return Signed(a.rawValue.mul(b));\n }\n\n /**\n * @notice Multiplies two `Signed`s and \"ceil's\" the product, reverting on overflow.\n * @param a a FixedPoint.Signed.\n * @param b a FixedPoint.Signed.\n * @return the product of `a` and `b`.\n */\n function mulAwayFromZero(Signed memory a, Signed memory b) internal pure returns (Signed memory) {\n int256 mulRaw = a.rawValue.mul(b.rawValue);\n int256 mulTowardsZero = mulRaw / SFP_SCALING_FACTOR;\n // Manual mod because SignedSafeMath doesn't support it.\n int256 mod = mulRaw % SFP_SCALING_FACTOR;\n if (mod != 0) {\n bool isResultPositive = isLessThan(a, 0) == isLessThan(b, 0);\n int256 valueToAdd = isResultPositive ? int256(1) : int256(-1);\n return Signed(mulTowardsZero.add(valueToAdd));\n } else {\n return Signed(mulTowardsZero);\n }\n }\n\n /**\n * @notice Multiplies an `Signed` and an unscaled int256 and \"ceil's\" the product, reverting on overflow.\n * @param a a FixedPoint.Signed.\n * @param b a FixedPoint.Signed.\n * @return the product of `a` and `b`.\n */\n function mulAwayFromZero(Signed memory a, int256 b) internal pure returns (Signed memory) {\n // Since b is an int, there is no risk of truncation and we can just mul it normally\n return Signed(a.rawValue.mul(b));\n }\n\n /**\n * @notice Divides one `Signed` by an `Signed`, reverting on overflow or division by 0.\n * @dev This will \"floor\" the quotient.\n * @param a a FixedPoint numerator.\n * @param b a FixedPoint denominator.\n * @return the quotient of `a` divided by `b`.\n */\n function div(Signed memory a, Signed memory b) internal pure returns (Signed memory) {\n // There are two caveats with this computation:\n // 1. Max value for the number dividend `a` represents is ~10^41, otherwise an intermediate value overflows.\n // 10^41 is stored internally as an int256 10^59.\n // 2. Results that can't be represented exactly are truncated not rounded. E.g., 2 / 3 = 0.6 repeating, which\n // would round to 0.666666666666666667, but this computation produces the result 0.666666666666666666.\n return Signed(a.rawValue.mul(SFP_SCALING_FACTOR).div(b.rawValue));\n }\n\n /**\n * @notice Divides one `Signed` by an unscaled int256, reverting on overflow or division by 0.\n * @dev This will \"floor\" the quotient.\n * @param a a FixedPoint numerator.\n * @param b an int256 denominator.\n * @return the quotient of `a` divided by `b`.\n */\n function div(Signed memory a, int256 b) internal pure returns (Signed memory) {\n return Signed(a.rawValue.div(b));\n }\n\n /**\n * @notice Divides one unscaled int256 by an `Signed`, reverting on overflow or division by 0.\n * @dev This will \"floor\" the quotient.\n * @param a an int256 numerator.\n * @param b a FixedPoint denominator.\n * @return the quotient of `a` divided by `b`.\n */\n function div(int256 a, Signed memory b) internal pure returns (Signed memory) {\n return div(fromUnscaledInt(a), b);\n }\n\n /**\n * @notice Divides one `Signed` by an `Signed` and \"ceil's\" the quotient, reverting on overflow or division by 0.\n * @param a a FixedPoint numerator.\n * @param b a FixedPoint denominator.\n * @return the quotient of `a` divided by `b`.\n */\n function divAwayFromZero(Signed memory a, Signed memory b) internal pure returns (Signed memory) {\n int256 aScaled = a.rawValue.mul(SFP_SCALING_FACTOR);\n int256 divTowardsZero = aScaled.div(b.rawValue);\n // Manual mod because SignedSafeMath doesn't support it.\n int256 mod = aScaled % b.rawValue;\n if (mod != 0) {\n bool isResultPositive = isLessThan(a, 0) == isLessThan(b, 0);\n int256 valueToAdd = isResultPositive ? int256(1) : int256(-1);\n return Signed(divTowardsZero.add(valueToAdd));\n } else {\n return Signed(divTowardsZero);\n }\n }\n\n /**\n * @notice Divides one `Signed` by an unscaled int256 and \"ceil's\" the quotient, reverting on overflow or division by 0.\n * @param a a FixedPoint numerator.\n * @param b an int256 denominator.\n * @return the quotient of `a` divided by `b`.\n */\n function divAwayFromZero(Signed memory a, int256 b) internal pure returns (Signed memory) {\n // Because it is possible that a quotient gets truncated, we can't just call \"Signed(a.rawValue.div(b))\"\n // similarly to mulCeil with an int256 as the second parameter. Therefore we need to convert b into an Signed.\n // This creates the possibility of overflow if b is very large.\n return divAwayFromZero(a, fromUnscaledInt(b));\n }\n\n /**\n * @notice Raises an `Signed` to the power of an unscaled uint256, reverting on overflow. E.g., `b=2` squares `a`.\n * @dev This will \"floor\" the result.\n * @param a a FixedPoint.Signed.\n * @param b a uint256 (negative exponents are not allowed).\n * @return output is `a` to the power of `b`.\n */\n function pow(Signed memory a, uint256 b) internal pure returns (Signed memory output) {\n output = fromUnscaledInt(1);\n for (uint256 i = 0; i < b; i = i.add(1)) {\n output = mul(output, a);\n }\n }\n}\n" - }, - "@openzeppelin/contracts/utils/math/SafeMath.sol": { - "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts v4.4.1 (utils/math/SafeMath.sol)\n\npragma solidity ^0.8.0;\n\n// CAUTION\n// This version of SafeMath should only be used with Solidity 0.8 or later,\n// because it relies on the compiler's built in overflow checks.\n\n/**\n * @dev Wrappers over Solidity's arithmetic operations.\n *\n * NOTE: `SafeMath` is generally not needed starting with Solidity 0.8, since the compiler\n * now has built in overflow checking.\n */\nlibrary SafeMath {\n /**\n * @dev Returns the addition of two unsigned integers, with an overflow flag.\n *\n * _Available since v3.4._\n */\n function tryAdd(uint256 a, uint256 b) internal pure returns (bool, uint256) {\n unchecked {\n uint256 c = a + b;\n if (c < a) return (false, 0);\n return (true, c);\n }\n }\n\n /**\n * @dev Returns the substraction of two unsigned integers, with an overflow flag.\n *\n * _Available since v3.4._\n */\n function trySub(uint256 a, uint256 b) internal pure returns (bool, uint256) {\n unchecked {\n if (b > a) return (false, 0);\n return (true, a - b);\n }\n }\n\n /**\n * @dev Returns the multiplication of two unsigned integers, with an overflow flag.\n *\n * _Available since v3.4._\n */\n function tryMul(uint256 a, uint256 b) internal pure returns (bool, uint256) {\n unchecked {\n // Gas optimization: this is cheaper than requiring 'a' not being zero, but the\n // benefit is lost if 'b' is also tested.\n // See: https://github.com/OpenZeppelin/openzeppelin-contracts/pull/522\n if (a == 0) return (true, 0);\n uint256 c = a * b;\n if (c / a != b) return (false, 0);\n return (true, c);\n }\n }\n\n /**\n * @dev Returns the division of two unsigned integers, with a division by zero flag.\n *\n * _Available since v3.4._\n */\n function tryDiv(uint256 a, uint256 b) internal pure returns (bool, uint256) {\n unchecked {\n if (b == 0) return (false, 0);\n return (true, a / b);\n }\n }\n\n /**\n * @dev Returns the remainder of dividing two unsigned integers, with a division by zero flag.\n *\n * _Available since v3.4._\n */\n function tryMod(uint256 a, uint256 b) internal pure returns (bool, uint256) {\n unchecked {\n if (b == 0) return (false, 0);\n return (true, a % b);\n }\n }\n\n /**\n * @dev Returns the addition of two unsigned integers, reverting on\n * overflow.\n *\n * Counterpart to Solidity's `+` operator.\n *\n * Requirements:\n *\n * - Addition cannot overflow.\n */\n function add(uint256 a, uint256 b) internal pure returns (uint256) {\n return a + b;\n }\n\n /**\n * @dev Returns the subtraction of two unsigned integers, reverting on\n * overflow (when the result is negative).\n *\n * Counterpart to Solidity's `-` operator.\n *\n * Requirements:\n *\n * - Subtraction cannot overflow.\n */\n function sub(uint256 a, uint256 b) internal pure returns (uint256) {\n return a - b;\n }\n\n /**\n * @dev Returns the multiplication of two unsigned integers, reverting on\n * overflow.\n *\n * Counterpart to Solidity's `*` operator.\n *\n * Requirements:\n *\n * - Multiplication cannot overflow.\n */\n function mul(uint256 a, uint256 b) internal pure returns (uint256) {\n return a * b;\n }\n\n /**\n * @dev Returns the integer division of two unsigned integers, reverting on\n * division by zero. The result is rounded towards zero.\n *\n * Counterpart to Solidity's `/` operator.\n *\n * Requirements:\n *\n * - The divisor cannot be zero.\n */\n function div(uint256 a, uint256 b) internal pure returns (uint256) {\n return a / b;\n }\n\n /**\n * @dev Returns the remainder of dividing two unsigned integers. (unsigned integer modulo),\n * reverting when dividing by zero.\n *\n * Counterpart to Solidity's `%` operator. This function uses a `revert`\n * opcode (which leaves remaining gas untouched) while Solidity uses an\n * invalid opcode to revert (consuming all remaining gas).\n *\n * Requirements:\n *\n * - The divisor cannot be zero.\n */\n function mod(uint256 a, uint256 b) internal pure returns (uint256) {\n return a % b;\n }\n\n /**\n * @dev Returns the subtraction of two unsigned integers, reverting with custom message on\n * overflow (when the result is negative).\n *\n * CAUTION: This function is deprecated because it requires allocating memory for the error\n * message unnecessarily. For custom revert reasons use {trySub}.\n *\n * Counterpart to Solidity's `-` operator.\n *\n * Requirements:\n *\n * - Subtraction cannot overflow.\n */\n function sub(\n uint256 a,\n uint256 b,\n string memory errorMessage\n ) internal pure returns (uint256) {\n unchecked {\n require(b <= a, errorMessage);\n return a - b;\n }\n }\n\n /**\n * @dev Returns the integer division of two unsigned integers, reverting with custom message on\n * division by zero. The result is rounded towards zero.\n *\n * Counterpart to Solidity's `/` operator. Note: this function uses a\n * `revert` opcode (which leaves remaining gas untouched) while Solidity\n * uses an invalid opcode to revert (consuming all remaining gas).\n *\n * Requirements:\n *\n * - The divisor cannot be zero.\n */\n function div(\n uint256 a,\n uint256 b,\n string memory errorMessage\n ) internal pure returns (uint256) {\n unchecked {\n require(b > 0, errorMessage);\n return a / b;\n }\n }\n\n /**\n * @dev Returns the remainder of dividing two unsigned integers. (unsigned integer modulo),\n * reverting with custom message when dividing by zero.\n *\n * CAUTION: This function is deprecated because it requires allocating memory for the error\n * message unnecessarily. For custom revert reasons use {tryMod}.\n *\n * Counterpart to Solidity's `%` operator. This function uses a `revert`\n * opcode (which leaves remaining gas untouched) while Solidity uses an\n * invalid opcode to revert (consuming all remaining gas).\n *\n * Requirements:\n *\n * - The divisor cannot be zero.\n */\n function mod(\n uint256 a,\n uint256 b,\n string memory errorMessage\n ) internal pure returns (uint256) {\n unchecked {\n require(b > 0, errorMessage);\n return a % b;\n }\n }\n}\n" - }, - "@openzeppelin/contracts/utils/math/SignedSafeMath.sol": { - "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts v4.4.1 (utils/math/SignedSafeMath.sol)\n\npragma solidity ^0.8.0;\n\n/**\n * @dev Wrappers over Solidity's arithmetic operations.\n *\n * NOTE: `SignedSafeMath` is no longer needed starting with Solidity 0.8. The compiler\n * now has built in overflow checking.\n */\nlibrary SignedSafeMath {\n /**\n * @dev Returns the multiplication of two signed integers, reverting on\n * overflow.\n *\n * Counterpart to Solidity's `*` operator.\n *\n * Requirements:\n *\n * - Multiplication cannot overflow.\n */\n function mul(int256 a, int256 b) internal pure returns (int256) {\n return a * b;\n }\n\n /**\n * @dev Returns the integer division of two signed integers. Reverts on\n * division by zero. The result is rounded towards zero.\n *\n * Counterpart to Solidity's `/` operator.\n *\n * Requirements:\n *\n * - The divisor cannot be zero.\n */\n function div(int256 a, int256 b) internal pure returns (int256) {\n return a / b;\n }\n\n /**\n * @dev Returns the subtraction of two signed integers, reverting on\n * overflow.\n *\n * Counterpart to Solidity's `-` operator.\n *\n * Requirements:\n *\n * - Subtraction cannot overflow.\n */\n function sub(int256 a, int256 b) internal pure returns (int256) {\n return a - b;\n }\n\n /**\n * @dev Returns the addition of two signed integers, reverting on\n * overflow.\n *\n * Counterpart to Solidity's `+` operator.\n *\n * Requirements:\n *\n * - Addition cannot overflow.\n */\n function add(int256 a, int256 b) internal pure returns (int256) {\n return a + b;\n }\n}\n" - }, - "@uma/core/contracts/oracle/interfaces/FinderInterface.sol": { - "content": "// SPDX-License-Identifier: AGPL-3.0-only\npragma solidity ^0.8.0;\n\n/**\n * @title Provides addresses of the live contracts implementing certain interfaces.\n * @dev Examples are the Oracle or Store interfaces.\n */\ninterface FinderInterface {\n /**\n * @notice Updates the address of the contract that implements `interfaceName`.\n * @param interfaceName bytes32 encoding of the interface name that is either changed or registered.\n * @param implementationAddress address of the deployed contract that implements the interface.\n */\n function changeImplementationAddress(bytes32 interfaceName, address implementationAddress) external;\n\n /**\n * @notice Gets the address of the contract that implements the given `interfaceName`.\n * @param interfaceName queried interface.\n * @return implementationAddress address of the deployed contract that implements the interface.\n */\n function getImplementationAddress(bytes32 interfaceName) external view returns (address);\n}\n" - }, - "@uma/core/contracts/oracle/interfaces/IdentifierWhitelistInterface.sol": { - "content": "// SPDX-License-Identifier: AGPL-3.0-only\npragma solidity ^0.8.0;\n\n/**\n * @title Interface for whitelists of supported identifiers that the oracle can provide prices for.\n */\ninterface IdentifierWhitelistInterface {\n /**\n * @notice Adds the provided identifier as a supported identifier.\n * @dev Price requests using this identifier will succeed after this call.\n * @param identifier bytes32 encoding of the string identifier. Eg: BTC/USD.\n */\n function addSupportedIdentifier(bytes32 identifier) external;\n\n /**\n * @notice Removes the identifier from the whitelist.\n * @dev Price requests using this identifier will no longer succeed after this call.\n * @param identifier bytes32 encoding of the string identifier. Eg: BTC/USD.\n */\n function removeSupportedIdentifier(bytes32 identifier) external;\n\n /**\n * @notice Checks whether an identifier is on the whitelist.\n * @param identifier bytes32 encoding of the string identifier. Eg: BTC/USD.\n * @return bool if the identifier is supported (or not).\n */\n function isIdentifierSupported(bytes32 identifier) external view returns (bool);\n}\n" - }, - "@uma/core/contracts/common/interfaces/AddressWhitelistInterface.sol": { - "content": "// SPDX-License-Identifier: AGPL-3.0-only\npragma solidity ^0.8.0;\n\ninterface AddressWhitelistInterface {\n function addToWhitelist(address newElement) external;\n\n function removeFromWhitelist(address newElement) external;\n\n function isOnWhitelist(address newElement) external view returns (bool);\n\n function getWhitelist() external view returns (address[] memory);\n}\n" - }, - "@uma/core/contracts/common/implementation/AncillaryData.sol": { - "content": "// SPDX-License-Identifier: AGPL-3.0-only\npragma solidity ^0.8.0;\n\n/**\n * @title Library for encoding and decoding ancillary data for DVM price requests.\n * @notice We assume that on-chain ancillary data can be formatted directly from bytes to utf8 encoding via\n * web3.utils.hexToUtf8, and that clients will parse the utf8-encoded ancillary data as a comma-delimitted key-value\n * dictionary. Therefore, this library provides internal methods that aid appending to ancillary data from Solidity\n * smart contracts. More details on UMA's ancillary data guidelines below:\n * https://docs.google.com/document/d/1zhKKjgY1BupBGPPrY_WOJvui0B6DMcd-xDR8-9-SPDw/edit\n */\nlibrary AncillaryData {\n // This converts the bottom half of a bytes32 input to hex in a highly gas-optimized way.\n // Source: the brilliant implementation at https://gitter.im/ethereum/solidity?at=5840d23416207f7b0ed08c9b.\n function toUtf8Bytes32Bottom(bytes32 bytesIn) private pure returns (bytes32) {\n unchecked {\n uint256 x = uint256(bytesIn);\n\n // Nibble interleave\n x = x & 0x00000000000000000000000000000000ffffffffffffffffffffffffffffffff;\n x = (x | (x * 2**64)) & 0x0000000000000000ffffffffffffffff0000000000000000ffffffffffffffff;\n x = (x | (x * 2**32)) & 0x00000000ffffffff00000000ffffffff00000000ffffffff00000000ffffffff;\n x = (x | (x * 2**16)) & 0x0000ffff0000ffff0000ffff0000ffff0000ffff0000ffff0000ffff0000ffff;\n x = (x | (x * 2**8)) & 0x00ff00ff00ff00ff00ff00ff00ff00ff00ff00ff00ff00ff00ff00ff00ff00ff;\n x = (x | (x * 2**4)) & 0x0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f;\n\n // Hex encode\n uint256 h = (x & 0x0808080808080808080808080808080808080808080808080808080808080808) / 8;\n uint256 i = (x & 0x0404040404040404040404040404040404040404040404040404040404040404) / 4;\n uint256 j = (x & 0x0202020202020202020202020202020202020202020202020202020202020202) / 2;\n x = x + (h & (i | j)) * 0x27 + 0x3030303030303030303030303030303030303030303030303030303030303030;\n\n // Return the result.\n return bytes32(x);\n }\n }\n\n /**\n * @notice Returns utf8-encoded bytes32 string that can be read via web3.utils.hexToUtf8.\n * @dev Will return bytes32 in all lower case hex characters and without the leading 0x.\n * This has minor changes from the toUtf8BytesAddress to control for the size of the input.\n * @param bytesIn bytes32 to encode.\n * @return utf8 encoded bytes32.\n */\n function toUtf8Bytes(bytes32 bytesIn) internal pure returns (bytes memory) {\n return abi.encodePacked(toUtf8Bytes32Bottom(bytesIn >> 128), toUtf8Bytes32Bottom(bytesIn));\n }\n\n /**\n * @notice Returns utf8-encoded address that can be read via web3.utils.hexToUtf8.\n * Source: https://ethereum.stackexchange.com/questions/8346/convert-address-to-string/8447#8447\n * @dev Will return address in all lower case characters and without the leading 0x.\n * @param x address to encode.\n * @return utf8 encoded address bytes.\n */\n function toUtf8BytesAddress(address x) internal pure returns (bytes memory) {\n return\n abi.encodePacked(toUtf8Bytes32Bottom(bytes32(bytes20(x)) >> 128), bytes8(toUtf8Bytes32Bottom(bytes20(x))));\n }\n\n /**\n * @notice Converts a uint into a base-10, UTF-8 representation stored in a `string` type.\n * @dev This method is based off of this code: https://stackoverflow.com/a/65707309.\n */\n function toUtf8BytesUint(uint256 x) internal pure returns (bytes memory) {\n if (x == 0) {\n return \"0\";\n }\n uint256 j = x;\n uint256 len;\n while (j != 0) {\n len++;\n j /= 10;\n }\n bytes memory bstr = new bytes(len);\n uint256 k = len;\n while (x != 0) {\n k = k - 1;\n uint8 temp = (48 + uint8(x - (x / 10) * 10));\n bytes1 b1 = bytes1(temp);\n bstr[k] = b1;\n x /= 10;\n }\n return bstr;\n }\n\n function appendKeyValueBytes32(\n bytes memory currentAncillaryData,\n bytes memory key,\n bytes32 value\n ) internal pure returns (bytes memory) {\n bytes memory prefix = constructPrefix(currentAncillaryData, key);\n return abi.encodePacked(currentAncillaryData, prefix, toUtf8Bytes(value));\n }\n\n /**\n * @notice Adds \"key:value\" to `currentAncillaryData` where `value` is an address that first needs to be converted\n * to utf8 bytes. For example, if `utf8(currentAncillaryData)=\"k1:v1\"`, then this function will return\n * `utf8(k1:v1,key:value)`, and if `currentAncillaryData` is blank, then this will return `utf8(key:value)`.\n * @param currentAncillaryData This bytes data should ideally be able to be utf8-decoded, but its OK if not.\n * @param key Again, this bytes data should ideally be able to be utf8-decoded, but its OK if not.\n * @param value An address to set as the value in the key:value pair to append to `currentAncillaryData`.\n * @return Newly appended ancillary data.\n */\n function appendKeyValueAddress(\n bytes memory currentAncillaryData,\n bytes memory key,\n address value\n ) internal pure returns (bytes memory) {\n bytes memory prefix = constructPrefix(currentAncillaryData, key);\n return abi.encodePacked(currentAncillaryData, prefix, toUtf8BytesAddress(value));\n }\n\n /**\n * @notice Adds \"key:value\" to `currentAncillaryData` where `value` is a uint that first needs to be converted\n * to utf8 bytes. For example, if `utf8(currentAncillaryData)=\"k1:v1\"`, then this function will return\n * `utf8(k1:v1,key:value)`, and if `currentAncillaryData` is blank, then this will return `utf8(key:value)`.\n * @param currentAncillaryData This bytes data should ideally be able to be utf8-decoded, but its OK if not.\n * @param key Again, this bytes data should ideally be able to be utf8-decoded, but its OK if not.\n * @param value A uint to set as the value in the key:value pair to append to `currentAncillaryData`.\n * @return Newly appended ancillary data.\n */\n function appendKeyValueUint(\n bytes memory currentAncillaryData,\n bytes memory key,\n uint256 value\n ) internal pure returns (bytes memory) {\n bytes memory prefix = constructPrefix(currentAncillaryData, key);\n return abi.encodePacked(currentAncillaryData, prefix, toUtf8BytesUint(value));\n }\n\n /**\n * @notice Helper method that returns the left hand side of a \"key:value\" pair plus the colon \":\" and a leading\n * comma \",\" if the `currentAncillaryData` is not empty. The return value is intended to be prepended as a prefix to\n * some utf8 value that is ultimately added to a comma-delimited, key-value dictionary.\n */\n function constructPrefix(bytes memory currentAncillaryData, bytes memory key) internal pure returns (bytes memory) {\n if (currentAncillaryData.length > 0) {\n return abi.encodePacked(\",\", key, \":\");\n } else {\n return abi.encodePacked(key, \":\");\n }\n }\n}\n" - }, - "@uma/core/contracts/oracle/implementation/Constants.sol": { - "content": "// SPDX-License-Identifier: AGPL-3.0-only\npragma solidity ^0.8.0;\n\n/**\n * @title Stores common interface names used throughout the DVM by registration in the Finder.\n */\nlibrary OracleInterfaces {\n bytes32 public constant Oracle = \"Oracle\";\n bytes32 public constant IdentifierWhitelist = \"IdentifierWhitelist\";\n bytes32 public constant Store = \"Store\";\n bytes32 public constant FinancialContractsAdmin = \"FinancialContractsAdmin\";\n bytes32 public constant Registry = \"Registry\";\n bytes32 public constant CollateralWhitelist = \"CollateralWhitelist\";\n bytes32 public constant OptimisticOracle = \"OptimisticOracle\";\n bytes32 public constant Bridge = \"Bridge\";\n bytes32 public constant GenericHandler = \"GenericHandler\";\n bytes32 public constant SkinnyOptimisticOracle = \"SkinnyOptimisticOracle\";\n bytes32 public constant ChildMessenger = \"ChildMessenger\";\n bytes32 public constant OracleHub = \"OracleHub\";\n bytes32 public constant OracleSpoke = \"OracleSpoke\";\n}\n\n/**\n * @title Commonly re-used values for contracts associated with the OptimisticOracle.\n */\nlibrary OptimisticOracleConstraints {\n // Any price request submitted to the OptimisticOracle must contain ancillary data no larger than this value.\n // This value must be <= the Voting contract's `ancillaryBytesLimit` constant value otherwise it is possible\n // that a price can be requested to the OptimisticOracle successfully, but cannot be resolved by the DVM which\n // refuses to accept a price request made with ancillary data length over a certain size.\n uint256 public constant ancillaryBytesLimit = 8192;\n}\n" - }, - "contracts/Lockable.sol": { - "content": "// SPDX-License-Identifier: AGPL-3.0-only\r\npragma solidity ^0.8.0;\r\n\r\n/**\r\n * @title A contract that provides modifiers to prevent reentrancy to state-changing and view-only methods. This contract\r\n * is inspired by https://github.com/OpenZeppelin/openzeppelin-contracts/blob/master/contracts/utils/ReentrancyGuard.sol\r\n * and https://github.com/balancer-labs/balancer-core/blob/master/contracts/BPool.sol.\r\n */\r\ncontract Lockable {\r\n bool internal _notEntered;\r\n\r\n constructor() {\r\n // Storing an initial non-zero value makes deployment a bit more expensive, but in exchange the refund on every\r\n // call to nonReentrant will be lower in amount. Since refunds are capped to a percentage of the total\r\n // transaction's gas, it is best to keep them low in cases like this one, to increase the likelihood of the full\r\n // refund coming into effect.\r\n _notEntered = true;\r\n }\r\n\r\n /**\r\n * @dev Prevents a contract from calling itself, directly or indirectly.\r\n * Calling a `nonReentrant` function from another `nonReentrant` function is not supported. It is possible to\r\n * prevent this from happening by making the `nonReentrant` function external, and making it call a `private`\r\n * function that does the actual state modification.\r\n */\r\n modifier nonReentrant() {\r\n _preEntranceCheck();\r\n _preEntranceSet();\r\n _;\r\n _postEntranceReset();\r\n }\r\n\r\n /**\r\n * @dev Designed to prevent a view-only method from being re-entered during a call to a `nonReentrant()` state-changing method.\r\n */\r\n modifier nonReentrantView() {\r\n _preEntranceCheck();\r\n _;\r\n }\r\n\r\n /**\r\n * @dev Returns true if the contract is currently in a non-entered state, meaning that the origination of the call\r\n * came from outside the contract. This is relevant with fallback/receive methods to see if the call came from ETH\r\n * being dropped onto the contract externally or due to ETH dropped on the the contract from within a method in this\r\n * contract, such as unwrapping WETH to ETH within the contract.\r\n */\r\n function functionCallStackOriginatesFromOutsideThisContract() internal view returns (bool) {\r\n return _notEntered;\r\n }\r\n\r\n // Internal methods are used to avoid copying the require statement's bytecode to every `nonReentrant()` method.\r\n // On entry into a function, `_preEntranceCheck()` should always be called to check if the function is being\r\n // re-entered. Then, if the function modifies state, it should call `_postEntranceSet()`, perform its logic, and\r\n // then call `_postEntranceReset()`.\r\n // View-only methods can simply call `_preEntranceCheck()` to make sure that it is not being re-entered.\r\n function _preEntranceCheck() internal view {\r\n // On the first call to nonReentrant, _notEntered will be true\r\n require(_notEntered, \"ReentrancyGuard: reentrant call\");\r\n }\r\n\r\n function _preEntranceSet() internal {\r\n // Any calls to nonReentrant after this point will fail\r\n _notEntered = false;\r\n }\r\n\r\n function _postEntranceReset() internal {\r\n // By storing the original value once again, a refund is triggered (see\r\n // https://eips.ethereum.org/EIPS/eip-2200)\r\n _notEntered = true;\r\n }\r\n}\r\n" - } - }, - "settings": { - "optimizer": { - "enabled": true, - "runs": 1000000 - }, - "outputSelection": { - "*": { - "*": [ - "abi", - "evm.bytecode", - "evm.deployedBytecode", - "evm.methodIdentifiers", - "metadata", - "devdoc", - "userdoc", - "storageLayout", - "evm.gasEstimates" - ], - "": ["ast"] - } - }, - "metadata": { - "useLiteralContent": true - } - } -} diff --git a/deployments/arbitrum-rinkeby/solcInputs/c8b9349311d8b5049b613ac98eb998d0.json b/deployments/arbitrum-rinkeby/solcInputs/c8b9349311d8b5049b613ac98eb998d0.json new file mode 100644 index 000000000..dfb09219e --- /dev/null +++ b/deployments/arbitrum-rinkeby/solcInputs/c8b9349311d8b5049b613ac98eb998d0.json @@ -0,0 +1,198 @@ +{ + "language": "Solidity", + "sources": { + "contracts/Arbitrum_SpokePool.sol": { + "content": "// SPDX-License-Identifier: GPL-3.0-only\npragma solidity ^0.8.0;\n\nimport \"./SpokePool.sol\";\n\ninterface StandardBridgeLike {\n function outboundTransfer(\n address _l1Token,\n address _to,\n uint256 _amount,\n bytes calldata _data\n ) external payable returns (bytes memory);\n}\n\n/**\n * @notice AVM specific SpokePool. Uses AVM cross-domain-enabled logic to implement admin only access to functions.\n */\ncontract Arbitrum_SpokePool is SpokePool {\n // Address of the Arbitrum L2 token gateway to send funds to L1.\n address public l2GatewayRouter;\n\n // Admin controlled mapping of arbitrum tokens to L1 counterpart. L1 counterpart addresses\n // are necessary params used when bridging tokens to L1.\n mapping(address => address) public whitelistedTokens;\n\n event ArbitrumTokensBridged(address indexed l1Token, address target, uint256 numberOfTokensBridged);\n event SetL2GatewayRouter(address indexed newL2GatewayRouter);\n event WhitelistedTokens(address indexed l2Token, address indexed l1Token);\n\n /**\n * @notice Construct the AVM SpokePool.\n * @param _l2GatewayRouter Address of L2 token gateway. Can be reset by admin.\n * @param _crossDomainAdmin Cross domain admin to set. Can be changed by admin.\n * @param _hubPool Hub pool address to set. Can be changed by admin.\n * @param _wethAddress Weth address for this network to set.\n * @param timerAddress Timer address to set.\n */\n constructor(\n address _l2GatewayRouter,\n address _crossDomainAdmin,\n address _hubPool,\n address _wethAddress,\n address timerAddress\n ) SpokePool(_crossDomainAdmin, _hubPool, _wethAddress, timerAddress) {\n _setL2GatewayRouter(_l2GatewayRouter);\n }\n\n modifier onlyFromCrossDomainAdmin() {\n require(msg.sender == _applyL1ToL2Alias(crossDomainAdmin), \"ONLY_COUNTERPART_GATEWAY\");\n _;\n }\n\n /********************************************************\n * ARBITRUM-SPECIFIC CROSS-CHAIN ADMIN FUNCTIONS *\n ********************************************************/\n\n /**\n * @notice Change L2 gateway router. Callable only by admin.\n * @param newL2GatewayRouter New L2 gateway router.\n */\n function setL2GatewayRouter(address newL2GatewayRouter) public onlyAdmin nonReentrant {\n _setL2GatewayRouter(newL2GatewayRouter);\n }\n\n /**\n * @notice Add L2 -> L1 token mapping. Callable only by admin.\n * @param l2Token Arbitrum token.\n * @param l1Token Ethereum version of l2Token.\n */\n function whitelistToken(address l2Token, address l1Token) public onlyAdmin nonReentrant {\n _whitelistToken(l2Token, l1Token);\n }\n\n /**************************************\n * INTERNAL FUNCTIONS *\n **************************************/\n\n function _bridgeTokensToHubPool(RelayerRefundLeaf memory relayerRefundLeaf) internal override {\n // Check that the Ethereum counterpart of the L2 token is stored on this contract.\n address ethereumTokenToBridge = whitelistedTokens[relayerRefundLeaf.l2TokenAddress];\n require(ethereumTokenToBridge != address(0), \"Uninitialized mainnet token\");\n StandardBridgeLike(l2GatewayRouter).outboundTransfer(\n ethereumTokenToBridge, // _l1Token. Address of the L1 token to bridge over.\n hubPool, // _to. Withdraw, over the bridge, to the l1 hub pool contract.\n relayerRefundLeaf.amountToReturn, // _amount.\n \"\" // _data. We don't need to send any data for the bridging action.\n );\n emit ArbitrumTokensBridged(address(0), hubPool, relayerRefundLeaf.amountToReturn);\n }\n\n function _setL2GatewayRouter(address _l2GatewayRouter) internal {\n l2GatewayRouter = _l2GatewayRouter;\n emit SetL2GatewayRouter(l2GatewayRouter);\n }\n\n function _whitelistToken(address _l2Token, address _l1Token) internal {\n whitelistedTokens[_l2Token] = _l1Token;\n emit WhitelistedTokens(_l2Token, _l1Token);\n }\n\n // L1 addresses are transformed during l1->l2 calls.\n // See https://developer.offchainlabs.com/docs/l1_l2_messages#address-aliasing for more information.\n // This cannot be pulled directly from Arbitrum contracts because their contracts are not 0.8.X compatible and\n // this operation takes advantage of overflows, whose behavior changed in 0.8.0.\n function _applyL1ToL2Alias(address l1Address) internal pure returns (address l2Address) {\n // Allows overflows as explained above.\n unchecked {\n l2Address = address(uint160(l1Address) + uint160(0x1111000000000000000000000000000000001111));\n }\n }\n\n // Apply AVM-specific transformation to cross domain admin address on L1.\n function _requireAdminSender() internal override onlyFromCrossDomainAdmin {}\n}\n" + }, + "contracts/SpokePool.sol": { + "content": "// SPDX-License-Identifier: GPL-3.0-only\npragma solidity ^0.8.0;\n\nimport \"./MerkleLib.sol\";\nimport \"./interfaces/WETH9.sol\";\nimport \"./Lockable.sol\";\nimport \"./SpokePoolInterface.sol\";\n\nimport \"@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol\";\nimport \"@openzeppelin/contracts/token/ERC20/IERC20.sol\";\nimport \"@openzeppelin/contracts/utils/Address.sol\";\n\nimport \"@openzeppelin/contracts/utils/cryptography/ECDSA.sol\";\nimport \"@uma/core/contracts/common/implementation/Testable.sol\";\nimport \"@uma/core/contracts/common/implementation/MultiCaller.sol\";\n\n/**\n * @title SpokePool\n * @notice Base contract deployed on source and destination chains enabling depositors to transfer assets from source to\n * destination. Deposit orders are fulfilled by off-chain relayers who also interact with this contract. Deposited\n * tokens are locked on the source chain and relayers send the recipient the desired token currency and amount\n * on the destination chain. Locked source chain tokens are later sent over the canonical token bridge to L1 HubPool.\n * Relayers are refunded with destination tokens out of this contract after another off-chain actor, a \"data worker\",\n * submits a proof that the relayer correctly submitted a relay on this SpokePool.\n */\nabstract contract SpokePool is SpokePoolInterface, Testable, Lockable, MultiCaller {\n using SafeERC20 for IERC20;\n using Address for address;\n\n // Address of the L1 contract that acts as the owner of this SpokePool. If this contract is deployed on Ethereum,\n // then this address should be set to the same owner as the HubPool and the whole system.\n address public crossDomainAdmin;\n\n // Address of the L1 contract that will send tokens to and receive tokens from this contract to fund relayer\n // refunds and slow relays.\n address public hubPool;\n\n // Address of WETH contract for this network. If an origin token matches this, then the caller can optionally\n // instruct this contract to wrap ETH when depositing.\n WETH9 public immutable weth;\n\n // Any deposit quote times greater than or less than this value to the current contract time is blocked. Forces\n // caller to use an approximately \"current\" realized fee. Defaults to 10 minutes.\n uint32 public depositQuoteTimeBuffer = 600;\n\n // Count of deposits is used to construct a unique deposit identifier for this spoke pool.\n uint32 public numberOfDeposits;\n\n // Origin token to destination token routings can be turned on or off, which can enable or disable deposits.\n\n mapping(address => mapping(uint256 => bool)) public enabledDepositRoutes;\n\n // This contract can store as many root bundles as the HubPool chooses to publish here.\n RootBundle[] public rootBundles;\n\n // Each relay is associated with the hash of parameters that uniquely identify the original deposit and a relay\n // attempt for that deposit. The relay itself is just represented as the amount filled so far. The total amount to\n // relay, the fees, and the agents are all parameters included in the hash key.\n mapping(bytes32 => uint256) public relayFills;\n\n /****************************************\n * EVENTS *\n ****************************************/\n event SetXDomainAdmin(address indexed newAdmin);\n event SetHubPool(address indexed newHubPool);\n event EnabledDepositRoute(address indexed originToken, uint256 indexed destinationChainId, bool enabled);\n event SetDepositQuoteTimeBuffer(uint32 newBuffer);\n event FundsDeposited(\n uint256 amount,\n uint256 originChainId,\n uint256 destinationChainId,\n uint64 relayerFeePct,\n uint32 indexed depositId,\n uint32 quoteTimestamp,\n address indexed originToken,\n address recipient,\n address indexed depositor\n );\n event RequestedSpeedUpDeposit(\n uint64 newRelayerFeePct,\n uint32 indexed depositId,\n address indexed depositor,\n bytes depositorSignature\n );\n event FilledRelay(\n bytes32 indexed relayHash,\n uint256 amount,\n uint256 totalFilledAmount,\n uint256 fillAmount,\n uint256 repaymentChainId,\n uint256 originChainId,\n uint256 destinationChainId,\n uint64 relayerFeePct,\n uint64 realizedLpFeePct,\n uint32 depositId,\n address destinationToken,\n address indexed relayer,\n address indexed depositor,\n address recipient,\n bool isSlowRelay\n );\n event RelayedRootBundle(uint32 indexed rootBundleId, bytes32 relayerRefundRoot, bytes32 slowRelayRoot);\n event ExecutedRelayerRefundRoot(\n uint256 amountToReturn,\n uint256 indexed chainId,\n uint256[] refundAmounts,\n uint32 indexed rootBundleId,\n uint32 indexed leafId,\n address l2TokenAddress,\n address[] refundAddresses,\n address caller\n );\n event TokensBridged(\n uint256 amountToReturn,\n uint256 indexed chainId,\n uint32 indexed leafId,\n address indexed l2TokenAddress,\n address caller\n );\n event EmergencyDeleteRootBundle(uint256 indexed rootBundleId);\n\n /**\n * @notice Construct the base SpokePool.\n * @param _crossDomainAdmin Cross domain admin to set. Can be changed by admin.\n * @param _hubPool Hub pool address to set. Can be changed by admin.\n * @param _wethAddress Weth address for this network to set.\n * @param timerAddress Timer address to set.\n */\n constructor(\n address _crossDomainAdmin,\n address _hubPool,\n address _wethAddress,\n address timerAddress\n ) Testable(timerAddress) {\n _setCrossDomainAdmin(_crossDomainAdmin);\n _setHubPool(_hubPool);\n weth = WETH9(_wethAddress);\n }\n\n /****************************************\n * MODIFIERS *\n ****************************************/\n\n // Implementing contract needs to override _requireAdminSender() to ensure that admin functions are protected\n // appropriately.\n modifier onlyAdmin() {\n _requireAdminSender();\n _;\n }\n\n /**************************************\n * ADMIN FUNCTIONS *\n **************************************/\n\n /**\n * @notice Change cross domain admin address. Callable by admin only.\n * @param newCrossDomainAdmin New cross domain admin.\n */\n function setCrossDomainAdmin(address newCrossDomainAdmin) public override onlyAdmin nonReentrant {\n _setCrossDomainAdmin(newCrossDomainAdmin);\n }\n\n /**\n * @notice Change L1 hub pool address. Callable by admin only.\n * @param newHubPool New hub pool.\n */\n function setHubPool(address newHubPool) public override onlyAdmin nonReentrant {\n _setHubPool(newHubPool);\n }\n\n /**\n * @notice Enable/Disable an origin token => destination chain ID route for deposits. Callable by admin only.\n * @param originToken Token that depositor can deposit to this contract.\n * @param destinationChainId Chain ID for where depositor wants to receive funds.\n * @param enabled True to enable deposits, False otherwise.\n */\n function setEnableRoute(\n address originToken,\n uint256 destinationChainId,\n bool enabled\n ) public override onlyAdmin nonReentrant {\n enabledDepositRoutes[originToken][destinationChainId] = enabled;\n emit EnabledDepositRoute(originToken, destinationChainId, enabled);\n }\n\n /**\n * @notice Change allowance for deposit quote time to differ from current block time. Callable by admin only.\n * @param newDepositQuoteTimeBuffer New quote time buffer.\n */\n function setDepositQuoteTimeBuffer(uint32 newDepositQuoteTimeBuffer) public override onlyAdmin nonReentrant {\n depositQuoteTimeBuffer = newDepositQuoteTimeBuffer;\n emit SetDepositQuoteTimeBuffer(newDepositQuoteTimeBuffer);\n }\n\n /**\n * @notice This method stores a new root bundle in this contract that can be executed to refund relayers, fulfill\n * slow relays, and send funds back to the HubPool on L1. This method can only be called by the admin and is\n * designed to be called as part of a cross-chain message from the HubPool's executeRootBundle method.\n * @param relayerRefundRoot Merkle root containing relayer refund leaves that can be individually executed via\n * executeRelayerRefundRoot().\n * @param slowRelayRoot Merkle root containing slow relay fulfillment leaves that can be individually executed via\n * executeSlowRelayRoot().\n */\n function relayRootBundle(bytes32 relayerRefundRoot, bytes32 slowRelayRoot) public override onlyAdmin nonReentrant {\n uint32 rootBundleId = uint32(rootBundles.length);\n RootBundle storage rootBundle = rootBundles.push();\n rootBundle.relayerRefundRoot = relayerRefundRoot;\n rootBundle.slowRelayRoot = slowRelayRoot;\n emit RelayedRootBundle(rootBundleId, relayerRefundRoot, slowRelayRoot);\n }\n\n /**\n * @notice This method is intended to only be used in emergencies where a bad root bundle has reached the\n * SpokePool.\n * @param rootBundleId Index of the root bundle that needs to be deleted. Note: this is intentionally a uint256\n * to ensure that a small input range doesn't limit which indices this method is able to reach.\n */\n function emergencyDeleteRootBundle(uint256 rootBundleId) public override onlyAdmin nonReentrant {\n delete rootBundles[rootBundleId];\n emit EmergencyDeleteRootBundle(rootBundleId);\n }\n\n /**************************************\n * DEPOSITOR FUNCTIONS *\n **************************************/\n\n /**\n * @notice Called by user to bridge funds from origin to destination chain. Depositor will effectively lock\n * tokens in this contract and receive a destination token on the destination chain. The origin => destination\n * token mapping is stored on the L1 HubPool.\n * @notice The caller must first approve this contract to spend amount of originToken.\n * @notice The originToken => destinationChainId must be enabled.\n * @notice This method is payable because the caller is able to deposit ETH if the originToken is WETH and this\n * function will handle wrapping ETH.\n * @param recipient Address to receive funds at on destination chain.\n * @param originToken Token to lock into this contract to initiate deposit.\n * @param amount Amount of tokens to deposit. Will be amount of tokens to receive less fees.\n * @param destinationChainId Denotes network where user will receive funds from SpokePool by a relayer.\n * @param relayerFeePct % of deposit amount taken out to incentivize a fast relayer.\n * @param quoteTimestamp Timestamp used by relayers to compute this deposit's realizedLPFeePct which is paid\n * to LP pool on HubPool.\n */\n function deposit(\n address recipient,\n address originToken,\n uint256 amount,\n uint256 destinationChainId,\n uint64 relayerFeePct,\n uint32 quoteTimestamp\n ) public payable override nonReentrant {\n // Check that deposit route is enabled.\n require(enabledDepositRoutes[originToken][destinationChainId], \"Disabled route\");\n\n // We limit the relay fees to prevent the user spending all their funds on fees.\n require(relayerFeePct < 0.5e18, \"invalid relayer fee\");\n // This function assumes that L2 timing cannot be compared accurately and consistently to L1 timing. Therefore,\n // block.timestamp is different from the L1 EVM's. Therefore, the quoteTimestamp must be within a configurable\n // buffer of this contract's block time to allow for this variance.\n // Note also that quoteTimestamp cannot be less than the buffer otherwise the following arithmetic can result\n // in underflow. This isn't a problem as the deposit will revert, but the error might be unexpected for clients.\n require(\n getCurrentTime() >= quoteTimestamp - depositQuoteTimeBuffer &&\n getCurrentTime() <= quoteTimestamp + depositQuoteTimeBuffer,\n \"invalid quote time\"\n );\n // If the address of the origin token is a WETH contract and there is a msg.value with the transaction\n // then the user is sending ETH. In this case, the ETH should be deposited to WETH.\n if (originToken == address(weth) && msg.value > 0) {\n require(msg.value == amount, \"msg.value must match amount\");\n weth.deposit{ value: msg.value }();\n // Else, it is a normal ERC20. In this case pull the token from the user's wallet as per normal.\n // Note: this includes the case where the L2 user has WETH (already wrapped ETH) and wants to bridge them.\n // In this case the msg.value will be set to 0, indicating a \"normal\" ERC20 bridging action.\n } else IERC20(originToken).safeTransferFrom(msg.sender, address(this), amount);\n\n _emitDeposit(\n amount,\n chainId(),\n destinationChainId,\n relayerFeePct,\n numberOfDeposits,\n quoteTimestamp,\n originToken,\n recipient,\n msg.sender\n );\n\n // Increment count of deposits so that deposit ID for this spoke pool is unique.\n numberOfDeposits += 1;\n }\n\n /**\n * @notice Convenience method that depositor can use to signal to relayer to use updated fee.\n * @notice Relayer should only use events emitted by this function to submit fills with updated fees, otherwise they\n * risk their fills getting disputed for being invalid, for example if the depositor never actually signed the\n * update fee message.\n * @notice This function will revert if the depositor did not sign a message containing the updated fee for the\n * deposit ID stored in this contract. If the deposit ID is for another contract, or the depositor address is\n * incorrect, or the updated fee is incorrect, then the signature will not match and this function will revert.\n * @param depositor Signer of the update fee message who originally submitted the deposit. If the deposit doesn't\n * exist, then the relayer will not be able to fill any relay, so the caller should validate that the depositor\n * did in fact submit a relay.\n * @param newRelayerFeePct New relayer fee that relayers can use.\n * @param depositId Deposit to update fee for that originated in this contract.\n * @param depositorSignature Signed message containing the depositor address, this contract chain ID, the updated\n * relayer fee %, and the deposit ID. This signature is produced by signing a hash of data according to the\n * EIP-191 standard. See more in the _verifyUpdateRelayerFeeMessage() comments.\n */\n function speedUpDeposit(\n address depositor,\n uint64 newRelayerFeePct,\n uint32 depositId,\n bytes memory depositorSignature\n ) public override nonReentrant {\n require(newRelayerFeePct < 0.5e18, \"invalid relayer fee\");\n\n _verifyUpdateRelayerFeeMessage(depositor, chainId(), newRelayerFeePct, depositId, depositorSignature);\n\n // Assuming the above checks passed, a relayer can take the signature and the updated relayer fee information\n // from the following event to submit a fill with an updated fee %.\n emit RequestedSpeedUpDeposit(newRelayerFeePct, depositId, depositor, depositorSignature);\n }\n\n /**************************************\n * RELAYER FUNCTIONS *\n **************************************/\n\n /**\n * @notice Called by relayer to fulfill part of a deposit by sending destination tokens to the recipient.\n * Relayer is expected to pass in unique identifying information for deposit that they want to fulfill, and this\n * relay submission will be validated by off-chain data workers who can dispute this relay if any part is invalid.\n * If the relay is valid, then the relayer will be refunded on their desired repayment chain. If relay is invalid,\n * then relayer will not receive any refund.\n * @notice All of the deposit data can be found via on-chain events from the origin SpokePool, except for the\n * realizedLpFeePct which is a function of the HubPool's utilization at the deposit quote time. This fee %\n * is deterministic based on the quote time, so the relayer should just compute it using the canonical algorithm\n * as described in a UMIP linked to the HubPool's identifier.\n * @param depositor Depositor on origin chain who set this chain as the destination chain.\n * @param recipient Specified recipient on this chain.\n * @param destinationToken Token to send to recipient. Should be mapped to the origin token, origin chain ID\n * and this chain ID via a mapping on the HubPool.\n * @param amount Full size of the deposit.\n * @param maxTokensToSend Max amount of tokens to send recipient. If higher than amount, then caller will\n * send recipient the full relay amount.\n * @param repaymentChainId Chain of SpokePool where relayer wants to be refunded after the challenge window has\n * passed.\n * @param originChainId Chain of SpokePool where deposit originated.\n * @param realizedLpFeePct Fee % based on L1 HubPool utilization at deposit quote time. Deterministic based on\n * quote time.\n * @param relayerFeePct Fee % to keep as relayer, specified by depositor.\n * @param depositId Unique deposit ID on origin spoke pool.\n */\n function fillRelay(\n address depositor,\n address recipient,\n address destinationToken,\n uint256 amount,\n uint256 maxTokensToSend,\n uint256 repaymentChainId,\n uint256 originChainId,\n uint64 realizedLpFeePct,\n uint64 relayerFeePct,\n uint32 depositId\n ) public nonReentrant {\n // Each relay attempt is mapped to the hash of data uniquely identifying it, which includes the deposit data\n // such as the origin chain ID and the deposit ID, and the data in a relay attempt such as who the recipient\n // is, which chain and currency the recipient wants to receive funds on, and the relay fees.\n SpokePoolInterface.RelayData memory relayData = SpokePoolInterface.RelayData({\n depositor: depositor,\n recipient: recipient,\n destinationToken: destinationToken,\n amount: amount,\n realizedLpFeePct: realizedLpFeePct,\n relayerFeePct: relayerFeePct,\n depositId: depositId,\n originChainId: originChainId,\n destinationChainId: chainId()\n });\n bytes32 relayHash = _getRelayHash(relayData);\n\n uint256 fillAmountPreFees = _fillRelay(relayHash, relayData, maxTokensToSend, relayerFeePct, false);\n\n _emitFillRelay(relayHash, fillAmountPreFees, repaymentChainId, relayerFeePct, relayData, false);\n }\n\n /**\n * @notice Called by relayer to execute same logic as calling fillRelay except that relayer is using an updated\n * relayer fee %. The fee % must have been emitted in a message cryptographically signed by the depositor.\n * @notice By design, the depositor probably emitted the message with the updated fee by calling speedUpRelay().\n * @param depositor Depositor on origin chain who set this chain as the destination chain.\n * @param recipient Specified recipient on this chain.\n * @param destinationToken Token to send to recipient. Should be mapped to the origin token, origin chain ID\n * and this chain ID via a mapping on the HubPool.\n * @param amount Full size of the deposit.\n * @param maxTokensToSend Max amount of tokens to send recipient. If higher than amount, then caller will\n * send recipient the full relay amount.\n * @param repaymentChainId Chain of SpokePool where relayer wants to be refunded after the challenge window has\n * passed.\n * @param originChainId Chain of SpokePool where deposit originated.\n * @param realizedLpFeePct Fee % based on L1 HubPool utilization at deposit quote time. Deterministic based on\n * quote time.\n * @param relayerFeePct Original fee % to keep as relayer set by depositor.\n * @param newRelayerFeePct New fee % to keep as relayer also specified by depositor.\n * @param depositId Unique deposit ID on origin spoke pool.\n * @param depositorSignature Depositor-signed message containing updated fee %.\n */\n function fillRelayWithUpdatedFee(\n address depositor,\n address recipient,\n address destinationToken,\n uint256 amount,\n uint256 maxTokensToSend,\n uint256 repaymentChainId,\n uint256 originChainId,\n uint64 realizedLpFeePct,\n uint64 relayerFeePct,\n uint64 newRelayerFeePct,\n uint32 depositId,\n bytes memory depositorSignature\n ) public override nonReentrant {\n _verifyUpdateRelayerFeeMessage(depositor, originChainId, newRelayerFeePct, depositId, depositorSignature);\n\n // Now follow the default fillRelay flow with the updated fee and the original relay hash.\n RelayData memory relayData = RelayData({\n depositor: depositor,\n recipient: recipient,\n destinationToken: destinationToken,\n amount: amount,\n realizedLpFeePct: realizedLpFeePct,\n relayerFeePct: relayerFeePct,\n depositId: depositId,\n originChainId: originChainId,\n destinationChainId: chainId()\n });\n bytes32 relayHash = _getRelayHash(relayData);\n uint256 fillAmountPreFees = _fillRelay(relayHash, relayData, maxTokensToSend, newRelayerFeePct, false);\n\n _emitFillRelay(relayHash, fillAmountPreFees, repaymentChainId, newRelayerFeePct, relayData, false);\n }\n\n /**************************************\n * DATA WORKER FUNCTIONS *\n **************************************/\n\n /**\n * @notice Executes a slow relay leaf stored as part of a root bundle. Will send the full amount remaining in the\n * relay to the recipient, less fees.\n * @dev This function assumes that the relay's destination chain ID is the current chain ID, which prevents\n * the caller from executing a slow relay intended for another chain on this chain.\n * @param depositor Depositor on origin chain who set this chain as the destination chain.\n * @param recipient Specified recipient on this chain.\n * @param destinationToken Token to send to recipient. Should be mapped to the origin token, origin chain ID\n * and this chain ID via a mapping on the HubPool.\n * @param amount Full size of the deposit.\n * @param originChainId Chain of SpokePool where deposit originated.\n * @param realizedLpFeePct Fee % based on L1 HubPool utilization at deposit quote time. Deterministic based on\n * quote time.\n * @param relayerFeePct Original fee % to keep as relayer set by depositor.\n * @param depositId Unique deposit ID on origin spoke pool.\n * @param rootBundleId Unique ID of root bundle containing slow relay root that this leaf is contained in.\n * @param proof Inclusion proof for this leaf in slow relay root in root bundle.\n */\n function executeSlowRelayRoot(\n address depositor,\n address recipient,\n address destinationToken,\n uint256 amount,\n uint256 originChainId,\n uint64 realizedLpFeePct,\n uint64 relayerFeePct,\n uint32 depositId,\n uint32 rootBundleId,\n bytes32[] memory proof\n ) public virtual override nonReentrant {\n _executeSlowRelayRoot(\n depositor,\n recipient,\n destinationToken,\n amount,\n originChainId,\n chainId(),\n realizedLpFeePct,\n relayerFeePct,\n depositId,\n rootBundleId,\n proof\n );\n }\n\n /**\n * @notice Executes a relayer refund leaf stored as part of a root bundle. Will send the relayer the amount they\n * sent to the recipient plus a relayer fee.\n * @param rootBundleId Unique ID of root bundle containing relayer refund root that this leaf is contained in.\n * @param relayerRefundLeaf Contains all data necessary to reconstruct leaf contained in root bundle and to\n * refund relayer. This data structure is explained in detail in the SpokePoolInterface.\n * @param proof Inclusion proof for this leaf in relayer refund root in root bundle.\n */\n function executeRelayerRefundRoot(\n uint32 rootBundleId,\n SpokePoolInterface.RelayerRefundLeaf memory relayerRefundLeaf,\n bytes32[] memory proof\n ) public virtual override nonReentrant {\n _executeRelayerRefundRoot(rootBundleId, relayerRefundLeaf, proof);\n }\n\n /**************************************\n * VIEW FUNCTIONS *\n **************************************/\n\n /**\n * @notice Returns chain ID for this network.\n * @dev Some L2s like ZKSync don't support the CHAIN_ID opcode so we allow the implementer to override this.\n */\n function chainId() public view virtual override returns (uint256) {\n return block.chainid;\n }\n\n /**************************************\n * INTERNAL FUNCTIONS *\n **************************************/\n\n // Verifies inclusion proof of leaf in root, sends relayer their refund, and sends to HubPool any rebalance\n // transfers.\n function _executeRelayerRefundRoot(\n uint32 rootBundleId,\n SpokePoolInterface.RelayerRefundLeaf memory relayerRefundLeaf,\n bytes32[] memory proof\n ) internal {\n // Check integrity of leaf structure:\n require(relayerRefundLeaf.chainId == chainId(), \"Invalid chainId\");\n require(relayerRefundLeaf.refundAddresses.length == relayerRefundLeaf.refundAmounts.length, \"invalid leaf\");\n\n RootBundle storage rootBundle = rootBundles[rootBundleId];\n\n // Check that inclusionProof proves that relayerRefundLeaf is contained within the relayer refund root.\n // Note: This should revert if the relayerRefundRoot is uninitialized.\n require(MerkleLib.verifyRelayerRefund(rootBundle.relayerRefundRoot, relayerRefundLeaf, proof), \"Bad Proof\");\n\n // Verify the leafId in the leaf has not yet been claimed.\n require(!MerkleLib.isClaimed(rootBundle.claimedBitmap, relayerRefundLeaf.leafId), \"Already claimed\");\n\n // Set leaf as claimed in bitmap. This is passed by reference to the storage rootBundle.\n MerkleLib.setClaimed(rootBundle.claimedBitmap, relayerRefundLeaf.leafId);\n\n // Send each relayer refund address the associated refundAmount for the L2 token address.\n // Note: Even if the L2 token is not enabled on this spoke pool, we should still refund relayers.\n for (uint32 i = 0; i < relayerRefundLeaf.refundAmounts.length; i++) {\n uint256 amount = relayerRefundLeaf.refundAmounts[i];\n if (amount > 0)\n IERC20(relayerRefundLeaf.l2TokenAddress).safeTransfer(relayerRefundLeaf.refundAddresses[i], amount);\n }\n\n // If leaf's amountToReturn is positive, then send L2 --> L1 message to bridge tokens back via\n // chain-specific bridging method.\n if (relayerRefundLeaf.amountToReturn > 0) {\n _bridgeTokensToHubPool(relayerRefundLeaf);\n\n emit TokensBridged(\n relayerRefundLeaf.amountToReturn,\n relayerRefundLeaf.chainId,\n relayerRefundLeaf.leafId,\n relayerRefundLeaf.l2TokenAddress,\n msg.sender\n );\n }\n\n emit ExecutedRelayerRefundRoot(\n relayerRefundLeaf.amountToReturn,\n relayerRefundLeaf.chainId,\n relayerRefundLeaf.refundAmounts,\n rootBundleId,\n relayerRefundLeaf.leafId,\n relayerRefundLeaf.l2TokenAddress,\n relayerRefundLeaf.refundAddresses,\n msg.sender\n );\n }\n\n // Verifies inclusion proof of leaf in root and sends recipient remainder of relay. Marks relay as filled.\n function _executeSlowRelayRoot(\n address depositor,\n address recipient,\n address destinationToken,\n uint256 amount,\n uint256 originChainId,\n uint256 destinationChainId,\n uint64 realizedLpFeePct,\n uint64 relayerFeePct,\n uint32 depositId,\n uint32 rootBundleId,\n bytes32[] memory proof\n ) internal {\n RelayData memory relayData = RelayData({\n depositor: depositor,\n recipient: recipient,\n destinationToken: destinationToken,\n amount: amount,\n originChainId: originChainId,\n destinationChainId: destinationChainId,\n realizedLpFeePct: realizedLpFeePct,\n relayerFeePct: relayerFeePct,\n depositId: depositId\n });\n\n require(\n MerkleLib.verifySlowRelayFulfillment(rootBundles[rootBundleId].slowRelayRoot, relayData, proof),\n \"Invalid proof\"\n );\n\n bytes32 relayHash = _getRelayHash(relayData);\n\n // Note: use relayAmount as the max amount to send, so the relay is always completely filled by the contract's\n // funds in all cases. As this is a slow relay we set the relayerFeePct to 0. This effectively refunds the\n // relayer component of the relayerFee thereby only charging the depositor the LpFee.\n uint256 fillAmountPreFees = _fillRelay(relayHash, relayData, relayData.amount, 0, true);\n\n // Note: Set repayment chain ID to 0 to indicate that there is no repayment to be made. The off-chain data\n // worker can use repaymentChainId=0 as a signal to ignore such relays for refunds. Also, set the relayerFeePct\n // to 0 as slow relays do not pay the caller of this method (depositor is refunded this fee).\n _emitFillRelay(relayHash, fillAmountPreFees, 0, 0, relayData, true);\n }\n\n function _setCrossDomainAdmin(address newCrossDomainAdmin) internal {\n require(newCrossDomainAdmin != address(0), \"Bad bridge router address\");\n crossDomainAdmin = newCrossDomainAdmin;\n emit SetXDomainAdmin(crossDomainAdmin);\n }\n\n function _setHubPool(address newHubPool) internal {\n require(newHubPool != address(0), \"Bad hub pool address\");\n hubPool = newHubPool;\n emit SetHubPool(hubPool);\n }\n\n // Should be overriden by implementing contract depending on how L2 handles sending tokens to L1.\n function _bridgeTokensToHubPool(SpokePoolInterface.RelayerRefundLeaf memory relayerRefundLeaf) internal virtual;\n\n function _verifyUpdateRelayerFeeMessage(\n address depositor,\n uint256 originChainId,\n uint64 newRelayerFeePct,\n uint32 depositId,\n bytes memory depositorSignature\n ) internal view {\n // A depositor can request to speed up an un-relayed deposit by signing a hash containing the relayer\n // fee % to update to and information uniquely identifying the deposit to relay. This information ensures\n // that this signature cannot be re-used for other deposits. The version string is included as a precaution\n // in case this contract is upgraded.\n // Note: we use encode instead of encodePacked because it is more secure, more in the \"warning\" section\n // here: https://docs.soliditylang.org/en/v0.8.11/abi-spec.html#non-standard-packed-mode\n bytes32 expectedDepositorMessageHash = keccak256(\n abi.encode(\"ACROSS-V2-FEE-1.0\", newRelayerFeePct, depositId, originChainId)\n );\n\n // Check the hash corresponding to the https://eth.wiki/json-rpc/API#eth_sign[eth_sign]\n // If the depositor signed a message with a different updated fee (or any other param included in the\n // above keccak156 hash), then this will revert.\n bytes32 ethSignedMessageHash = ECDSA.toEthSignedMessageHash(expectedDepositorMessageHash);\n\n _verifyDepositorUpdateFeeMessage(depositor, ethSignedMessageHash, depositorSignature);\n }\n\n // This function is isolated and made virtual to allow different L2's to implement chain specific recovery of\n // signers from signatures because some L2s might not support ecrecover. To be safe, consider always reverting\n // this function for L2s where ecrecover is different from how it works on Ethereum, otherwise there is the\n // potential to forge a signature from the depositor using a different private key than the original depositor's.\n function _verifyDepositorUpdateFeeMessage(\n address depositor,\n bytes32 ethSignedMessageHash,\n bytes memory depositorSignature\n ) internal view virtual {\n // Note: We purposefully do not support EIP-191 signatures (meaning that multisigs and smart contract wallets\n // like Argent are not supported) because of the possibility that a multisig that signed a message on the origin\n // chain does not have a parallel on this destination chain.\n require(depositor == ECDSA.recover(ethSignedMessageHash, depositorSignature), \"invalid signature\");\n }\n\n function _computeAmountPreFees(uint256 amount, uint64 feesPct) private pure returns (uint256) {\n return (1e18 * amount) / (1e18 - feesPct);\n }\n\n function _computeAmountPostFees(uint256 amount, uint64 feesPct) private pure returns (uint256) {\n return (amount * (1e18 - feesPct)) / 1e18;\n }\n\n function _getRelayHash(SpokePoolInterface.RelayData memory relayData) private pure returns (bytes32) {\n return keccak256(abi.encode(relayData));\n }\n\n // Unwraps ETH and does a transfer to a recipient address. If the recipient is a smart contract then sends WETH.\n function _unwrapWETHTo(address payable to, uint256 amount) internal {\n if (address(to).isContract()) {\n IERC20(address(weth)).safeTransfer(to, amount);\n } else {\n weth.withdraw(amount);\n to.transfer(amount);\n }\n }\n\n /**\n * @notice Caller specifies the max amount of tokens to send to user. Based on this amount and the amount of the\n * relay remaining (as stored in the relayFills mapping), pull the amount of tokens from the caller\n * and send to the recipient.\n * @dev relayFills keeps track of pre-fee fill amounts as a convenience to relayers who want to specify round\n * numbers for the maxTokensToSend parameter or convenient numbers like 100 (i.e. relayers who will fully\n * fill any relay up to 100 tokens, and partial fill with 100 tokens for larger relays).\n * @dev Caller must approve this contract to transfer up to maxTokensToSend of the relayData.destinationToken.\n * The amount to be sent might end up less if there is insufficient relay amount remaining to be sent.\n */\n function _fillRelay(\n bytes32 relayHash,\n RelayData memory relayData,\n uint256 maxTokensToSend,\n uint64 updatableRelayerFeePct,\n bool useContractFunds\n ) internal returns (uint256 fillAmountPreFees) {\n // We limit the relay fees to prevent the user spending all their funds on fees. Note that 0.5e18 (i.e. 50%)\n // fees are just magic numbers. The important point is to prevent the total fee from being 100%, otherwise\n // computing the amount pre fees runs into divide-by-0 issues.\n require(updatableRelayerFeePct < 0.5e18 && relayData.realizedLpFeePct < 0.5e18, \"invalid fees\");\n\n // Check that the relay has not already been completely filled. Note that the relays mapping will point to\n // the amount filled so far for a particular relayHash, so this will start at 0 and increment with each fill.\n require(relayFills[relayHash] < relayData.amount, \"relay filled\");\n\n // Stores the equivalent amount to be sent by the relayer before fees have been taken out.\n if (maxTokensToSend == 0) return 0;\n\n // Derive the amount of the relay filled if the caller wants to send exactly maxTokensToSend tokens to\n // the recipient. For example, if the user wants to send 10 tokens to the recipient, the full relay amount\n // is 100, and the fee %'s total 5%, then this computation would return ~10.5, meaning that to fill 10.5/100\n // of the full relay size, the caller would need to send 10 tokens to the user.\n fillAmountPreFees = _computeAmountPreFees(\n maxTokensToSend,\n (relayData.realizedLpFeePct + updatableRelayerFeePct)\n );\n // If user's specified max amount to send is greater than the amount of the relay remaining pre-fees,\n // we'll pull exactly enough tokens to complete the relay.\n uint256 amountToSend = maxTokensToSend;\n uint256 amountRemainingInRelay = relayData.amount - relayFills[relayHash];\n if (amountRemainingInRelay < fillAmountPreFees) {\n fillAmountPreFees = amountRemainingInRelay;\n\n // The user will fulfill the remainder of the relay, so we need to compute exactly how many tokens post-fees\n // that they need to send to the recipient. Note that if the relayer is filled using contract funds then\n // this is a slow relay.\n amountToSend = _computeAmountPostFees(\n fillAmountPreFees,\n relayData.realizedLpFeePct + updatableRelayerFeePct\n );\n }\n\n // relayFills keeps track of pre-fee fill amounts as a convenience to relayers who want to specify round\n // numbers for the maxTokensToSend parameter or convenient numbers like 100 (i.e. relayers who will fully\n // fill any relay up to 100 tokens, and partial fill with 100 tokens for larger relays).\n relayFills[relayHash] += fillAmountPreFees;\n\n // If relay token is weth then unwrap and send eth.\n if (relayData.destinationToken == address(weth)) {\n // Note: useContractFunds is True if we want to send funds to the recipient directly out of this contract,\n // otherwise we expect the caller to send funds to the recipient. If useContractFunds is True and the\n // recipient wants WETH, then we can assume that WETH is already in the contract, otherwise we'll need the\n // the user to send WETH to this contract. Regardless, we'll need to unwrap it before sending to the user.\n if (!useContractFunds)\n IERC20(relayData.destinationToken).safeTransferFrom(msg.sender, address(this), amountToSend);\n _unwrapWETHTo(payable(relayData.recipient), amountToSend);\n // Else, this is a normal ERC20 token. Send to recipient.\n } else {\n // Note: Similar to note above, send token directly from the contract to the user in the slow relay case.\n if (!useContractFunds)\n IERC20(relayData.destinationToken).safeTransferFrom(msg.sender, relayData.recipient, amountToSend);\n else IERC20(relayData.destinationToken).safeTransfer(relayData.recipient, amountToSend);\n }\n }\n\n // The following internal methods emit events with many params to overcome solidity stack too deep issues.\n function _emitFillRelay(\n bytes32 relayHash,\n uint256 fillAmount,\n uint256 repaymentChainId,\n uint64 relayerFeePct,\n RelayData memory relayData,\n bool isSlowRelay\n ) internal {\n emit FilledRelay(\n relayHash,\n relayData.amount,\n relayFills[relayHash],\n fillAmount,\n repaymentChainId,\n relayData.originChainId,\n relayData.destinationChainId,\n relayerFeePct,\n relayData.realizedLpFeePct,\n relayData.depositId,\n relayData.destinationToken,\n msg.sender,\n relayData.depositor,\n relayData.recipient,\n isSlowRelay\n );\n }\n\n function _emitDeposit(\n uint256 amount,\n uint256 originChainId,\n uint256 destinationChainId,\n uint64 relayerFeePct,\n uint32 depositId,\n uint32 quoteTimestamp,\n address originToken,\n address recipient,\n address depositor\n ) internal {\n emit FundsDeposited(\n amount,\n originChainId,\n destinationChainId,\n relayerFeePct,\n depositId,\n quoteTimestamp,\n originToken,\n recipient,\n depositor\n );\n }\n\n // Implementing contract needs to override this to ensure that only the appropriate cross chain admin can execute\n // certain admin functions. For L2 contracts, the cross chain admin refers to some L1 address or contract, and for\n // L1, this would just be the same admin of the HubPool.\n function _requireAdminSender() internal virtual;\n\n // Added to enable the this contract to receive ETH. Used when unwrapping Weth.\n receive() external payable {}\n}\n" + }, + "contracts/MerkleLib.sol": { + "content": "// SPDX-License-Identifier: GPL-3.0-only\npragma solidity ^0.8.0;\n\nimport \"./SpokePoolInterface.sol\";\nimport \"./HubPoolInterface.sol\";\n\nimport \"@openzeppelin/contracts/utils/cryptography/MerkleProof.sol\";\n\n/**\n * @notice Library to help with merkle roots, proofs, and claims.\n */\nlibrary MerkleLib {\n /**\n * @notice Verifies that a repayment is contained within a merkle root.\n * @param root the merkle root.\n * @param rebalance the rebalance struct.\n * @param proof the merkle proof.\n * @return bool to signal if the pool rebalance proof correctly shows inclusion of the rebalance within the tree.\n */\n function verifyPoolRebalance(\n bytes32 root,\n HubPoolInterface.PoolRebalanceLeaf memory rebalance,\n bytes32[] memory proof\n ) internal pure returns (bool) {\n return MerkleProof.verify(proof, root, keccak256(abi.encode(rebalance)));\n }\n\n /**\n * @notice Verifies that a relayer refund is contained within a merkle root.\n * @param root the merkle root.\n * @param refund the refund struct.\n * @param proof the merkle proof.\n * @return bool to signal if the relayer refund proof correctly shows inclusion of the refund within the tree.\n */\n function verifyRelayerRefund(\n bytes32 root,\n SpokePoolInterface.RelayerRefundLeaf memory refund,\n bytes32[] memory proof\n ) internal pure returns (bool) {\n return MerkleProof.verify(proof, root, keccak256(abi.encode(refund)));\n }\n\n /**\n * @notice Verifies that a distribution is contained within a merkle root.\n * @param root the merkle root.\n * @param slowRelayFulfillment the relayData fulfillment struct.\n * @param proof the merkle proof.\n * @return bool to signal if the slow relay's proof correctly shows inclusion of the slow relay within the tree.\n */\n function verifySlowRelayFulfillment(\n bytes32 root,\n SpokePoolInterface.RelayData memory slowRelayFulfillment,\n bytes32[] memory proof\n ) internal pure returns (bool) {\n return MerkleProof.verify(proof, root, keccak256(abi.encode(slowRelayFulfillment)));\n }\n\n // The following functions are primarily copied from\n // https://github.com/Uniswap/merkle-distributor/blob/master/contracts/MerkleDistributor.sol with minor changes.\n\n /**\n * @notice Tests whether a claim is contained within a claimedBitMap mapping.\n * @param claimedBitMap a simple uint256 mapping in storage used as a bitmap.\n * @param index the index to check in the bitmap.\n * @return bool indicating if the index within the claimedBitMap has been marked as claimed.\n */\n function isClaimed(mapping(uint256 => uint256) storage claimedBitMap, uint256 index) internal view returns (bool) {\n uint256 claimedWordIndex = index / 256;\n uint256 claimedBitIndex = index % 256;\n uint256 claimedWord = claimedBitMap[claimedWordIndex];\n uint256 mask = (1 << claimedBitIndex);\n return claimedWord & mask == mask;\n }\n\n /**\n * @notice Marks an index in a claimedBitMap as claimed.\n * @param claimedBitMap a simple uint256 mapping in storage used as a bitmap.\n * @param index the index to mark in the bitmap.\n */\n function setClaimed(mapping(uint256 => uint256) storage claimedBitMap, uint256 index) internal {\n uint256 claimedWordIndex = index / 256;\n uint256 claimedBitIndex = index % 256;\n claimedBitMap[claimedWordIndex] = claimedBitMap[claimedWordIndex] | (1 << claimedBitIndex);\n }\n\n /**\n * @notice Tests whether a claim is contained within a 1D claimedBitMap mapping.\n * @param claimedBitMap a simple uint256 value, encoding a 1D bitmap.\n * @param index the index to check in the bitmap. Uint8 type enforces that index can't be > 255.\n * @return bool indicating if the index within the claimedBitMap has been marked as claimed.\n */\n function isClaimed1D(uint256 claimedBitMap, uint8 index) internal pure returns (bool) {\n uint256 mask = (1 << index);\n return claimedBitMap & mask == mask;\n }\n\n /**\n * @notice Marks an index in a claimedBitMap as claimed.\n * @param claimedBitMap a simple uint256 mapping in storage used as a bitmap. Uint8 type enforces that index\n * can't be > 255.\n * @param index the index to mark in the bitmap.\n * @return uint256 representing the modified input claimedBitMap with the index set to true.\n */\n function setClaimed1D(uint256 claimedBitMap, uint8 index) internal pure returns (uint256) {\n return claimedBitMap | (1 << index % 256);\n }\n}\n" + }, + "contracts/interfaces/WETH9.sol": { + "content": "// SPDX-License-Identifier: GPL-3.0-only\npragma solidity ^0.8.0;\n\ninterface WETH9 {\n function withdraw(uint256 wad) external;\n\n function deposit() external payable;\n\n function balanceOf(address guy) external view returns (uint256 wad);\n\n function transfer(address guy, uint256 wad) external;\n}\n" + }, + "contracts/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 * @dev The reason why we use this local contract instead of importing from uma/contracts is because of the addition\n * of the internal method `functionCallStackOriginatesFromOutsideThisContract` which doesn't exist in the one exported\n * by uma/contracts.\n */\ncontract Lockable {\n bool internal _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 /**\n * @dev Returns true if the contract is currently in a non-entered state, meaning that the origination of the call\n * came from outside the contract. This is relevant with fallback/receive methods to see if the call came from ETH\n * being dropped onto the contract externally or due to ETH dropped on the the contract from within a method in this\n * contract, such as unwrapping WETH to ETH within the contract.\n */\n function functionCallStackOriginatesFromOutsideThisContract() internal view returns (bool) {\n return _notEntered;\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" + }, + "contracts/SpokePoolInterface.sol": { + "content": "// SPDX-License-Identifier: GPL-3.0-only\npragma solidity ^0.8.0;\n\n/**\n * @notice Contains common data structures and functions used by all SpokePool implementations.\n */\ninterface SpokePoolInterface {\n // This leaf is meant to be decoded in the SpokePool to pay out successful relayers.\n struct RelayerRefundLeaf {\n // This is the amount to return to the HubPool. This occurs when there is a PoolRebalanceLeaf netSendAmount that\n // is negative. This is just the negative of this value.\n uint256 amountToReturn;\n // Used to verify that this is being executed on the correct destination chainId.\n uint256 chainId;\n // This array designates how much each of those addresses should be refunded.\n uint256[] refundAmounts;\n // Used as the index in the bitmap to track whether this leaf has been executed or not.\n uint32 leafId;\n // The associated L2TokenAddress that these claims apply to.\n address l2TokenAddress;\n // Must be same length as refundAmounts and designates each address that must be refunded.\n address[] refundAddresses;\n }\n\n // This struct represents the data to fully specify a relay. If any portion of this data differs, the relay is\n // considered to be completely distinct. Only one relay for a particular depositId, chainId pair should be\n // considered valid and repaid. This data is hashed and inserted into the slow relay merkle root so that an off\n // chain validator can choose when to refund slow relayers.\n struct RelayData {\n // The address that made the deposit on the origin chain.\n address depositor;\n // The recipient address on the destination chain.\n address recipient;\n // The corresponding token address on the destination chain.\n address destinationToken;\n // The total relay amount before fees are taken out.\n uint256 amount;\n // Origin chain id.\n uint256 originChainId;\n // Destination chain id.\n uint256 destinationChainId;\n // The LP Fee percentage computed by the relayer based on the deposit's quote timestamp\n // and the HubPool's utilization.\n uint64 realizedLpFeePct;\n // The relayer fee percentage specified in the deposit.\n uint64 relayerFeePct;\n // The id uniquely identifying this deposit on the origin chain.\n uint32 depositId;\n }\n\n // Stores collection of merkle roots that can be published to this contract from the HubPool, which are referenced\n // by \"data workers\" via inclusion proofs to execute leaves in the roots.\n struct RootBundle {\n // Merkle root of slow relays that were not fully filled and whose recipient is still owed funds from the LP pool.\n bytes32 slowRelayRoot;\n // Merkle root of relayer refunds for successful relays.\n bytes32 relayerRefundRoot;\n // This is a 2D bitmap tracking which leaves in the relayer refund root have been claimed, with max size of\n // 256x256 leaves per root.\n mapping(uint256 => uint256) claimedBitmap;\n }\n\n function setCrossDomainAdmin(address newCrossDomainAdmin) external;\n\n function setHubPool(address newHubPool) external;\n\n function setEnableRoute(\n address originToken,\n uint256 destinationChainId,\n bool enable\n ) external;\n\n function setDepositQuoteTimeBuffer(uint32 buffer) external;\n\n function relayRootBundle(bytes32 relayerRefundRoot, bytes32 slowRelayRoot) external;\n\n function emergencyDeleteRootBundle(uint256 rootBundleId) external;\n\n function deposit(\n address recipient,\n address originToken,\n uint256 amount,\n uint256 destinationChainId,\n uint64 relayerFeePct,\n uint32 quoteTimestamp\n ) external payable;\n\n function speedUpDeposit(\n address depositor,\n uint64 newRelayerFeePct,\n uint32 depositId,\n bytes memory depositorSignature\n ) external;\n\n function fillRelay(\n address depositor,\n address recipient,\n address destinationToken,\n uint256 amount,\n uint256 maxTokensToSend,\n uint256 repaymentChainId,\n uint256 originChainId,\n uint64 realizedLpFeePct,\n uint64 relayerFeePct,\n uint32 depositId\n ) external;\n\n function fillRelayWithUpdatedFee(\n address depositor,\n address recipient,\n address destinationToken,\n uint256 amount,\n uint256 maxTokensToSend,\n uint256 repaymentChainId,\n uint256 originChainId,\n uint64 realizedLpFeePct,\n uint64 relayerFeePct,\n uint64 newRelayerFeePct,\n uint32 depositId,\n bytes memory depositorSignature\n ) external;\n\n function executeSlowRelayRoot(\n address depositor,\n address recipient,\n address destinationToken,\n uint256 amount,\n uint256 originChainId,\n uint64 realizedLpFeePct,\n uint64 relayerFeePct,\n uint32 depositId,\n uint32 rootBundleId,\n bytes32[] memory proof\n ) external;\n\n function executeRelayerRefundRoot(\n uint32 rootBundleId,\n SpokePoolInterface.RelayerRefundLeaf memory relayerRefundLeaf,\n bytes32[] memory proof\n ) external;\n\n function chainId() external view returns (uint256);\n}\n" + }, + "@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts v4.4.1 (token/ERC20/utils/SafeERC20.sol)\n\npragma solidity ^0.8.0;\n\nimport \"../IERC20.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 function safeTransfer(\n IERC20 token,\n address to,\n uint256 value\n ) internal {\n _callOptionalReturn(token, abi.encodeWithSelector(token.transfer.selector, to, value));\n }\n\n function safeTransferFrom(\n IERC20 token,\n address from,\n address to,\n uint256 value\n ) 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(\n IERC20 token,\n address spender,\n uint256 value\n ) 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 function safeIncreaseAllowance(\n IERC20 token,\n address spender,\n uint256 value\n ) internal {\n uint256 newAllowance = token.allowance(address(this), spender) + value;\n _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, newAllowance));\n }\n\n function safeDecreaseAllowance(\n IERC20 token,\n address spender,\n uint256 value\n ) internal {\n unchecked {\n uint256 oldAllowance = token.allowance(address(this), spender);\n require(oldAllowance >= value, \"SafeERC20: decreased allowance below zero\");\n uint256 newAllowance = oldAllowance - value;\n _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, newAllowance));\n }\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 if (returndata.length > 0) {\n // Return data is optional\n require(abi.decode(returndata, (bool)), \"SafeERC20: ERC20 operation did not succeed\");\n }\n }\n}\n" + }, + "@openzeppelin/contracts/token/ERC20/IERC20.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.5.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 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(\n address from,\n address to,\n uint256 amount\n ) external returns (bool);\n\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" + }, + "@openzeppelin/contracts/utils/Address.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.5.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 *\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://diligence.consensys.net/posts/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.5.11/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 functionCall(target, data, \"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(\n address target,\n bytes memory data,\n uint256 value\n ) 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 require(isContract(target), \"Address: call to non-contract\");\n\n (bool success, bytes memory returndata) = target.call{value: value}(data);\n return verifyCallResult(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 require(isContract(target), \"Address: static call to non-contract\");\n\n (bool success, bytes memory returndata) = target.staticcall(data);\n return verifyCallResult(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 require(isContract(target), \"Address: delegate call to non-contract\");\n\n (bool success, bytes memory returndata) = target.delegatecall(data);\n return verifyCallResult(success, returndata, errorMessage);\n }\n\n /**\n * @dev Tool to verifies that a low level call was successful, and revert if it wasn't, either by bubbling the\n * revert reason 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 // 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\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}\n" + }, + "@openzeppelin/contracts/utils/cryptography/ECDSA.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.5.0) (utils/cryptography/ECDSA.sol)\n\npragma solidity ^0.8.0;\n\nimport \"../Strings.sol\";\n\n/**\n * @dev Elliptic Curve Digital Signature Algorithm (ECDSA) operations.\n *\n * These functions can be used to verify that a message was signed by the holder\n * of the private keys of a given address.\n */\nlibrary ECDSA {\n enum RecoverError {\n NoError,\n InvalidSignature,\n InvalidSignatureLength,\n InvalidSignatureS,\n InvalidSignatureV\n }\n\n function _throwError(RecoverError error) private pure {\n if (error == RecoverError.NoError) {\n return; // no error: do nothing\n } else if (error == RecoverError.InvalidSignature) {\n revert(\"ECDSA: invalid signature\");\n } else if (error == RecoverError.InvalidSignatureLength) {\n revert(\"ECDSA: invalid signature length\");\n } else if (error == RecoverError.InvalidSignatureS) {\n revert(\"ECDSA: invalid signature 's' value\");\n } else if (error == RecoverError.InvalidSignatureV) {\n revert(\"ECDSA: invalid signature 'v' value\");\n }\n }\n\n /**\n * @dev Returns the address that signed a hashed message (`hash`) with\n * `signature` or error string. This address can then be used for verification purposes.\n *\n * The `ecrecover` EVM opcode allows for malleable (non-unique) signatures:\n * this function rejects them by requiring the `s` value to be in the lower\n * half order, and the `v` value to be either 27 or 28.\n *\n * IMPORTANT: `hash` _must_ be the result of a hash operation for the\n * verification to be secure: it is possible to craft signatures that\n * recover to arbitrary addresses for non-hashed data. A safe way to ensure\n * this is by receiving a hash of the original message (which may otherwise\n * be too long), and then calling {toEthSignedMessageHash} on it.\n *\n * Documentation for signature generation:\n * - with https://web3js.readthedocs.io/en/v1.3.4/web3-eth-accounts.html#sign[Web3.js]\n * - with https://docs.ethers.io/v5/api/signer/#Signer-signMessage[ethers]\n *\n * _Available since v4.3._\n */\n function tryRecover(bytes32 hash, bytes memory signature) internal pure returns (address, RecoverError) {\n // Check the signature length\n // - case 65: r,s,v signature (standard)\n // - case 64: r,vs signature (cf https://eips.ethereum.org/EIPS/eip-2098) _Available since v4.1._\n if (signature.length == 65) {\n bytes32 r;\n bytes32 s;\n uint8 v;\n // ecrecover takes the signature parameters, and the only way to get them\n // currently is to use assembly.\n assembly {\n r := mload(add(signature, 0x20))\n s := mload(add(signature, 0x40))\n v := byte(0, mload(add(signature, 0x60)))\n }\n return tryRecover(hash, v, r, s);\n } else if (signature.length == 64) {\n bytes32 r;\n bytes32 vs;\n // ecrecover takes the signature parameters, and the only way to get them\n // currently is to use assembly.\n assembly {\n r := mload(add(signature, 0x20))\n vs := mload(add(signature, 0x40))\n }\n return tryRecover(hash, r, vs);\n } else {\n return (address(0), RecoverError.InvalidSignatureLength);\n }\n }\n\n /**\n * @dev Returns the address that signed a hashed message (`hash`) with\n * `signature`. This address can then be used for verification purposes.\n *\n * The `ecrecover` EVM opcode allows for malleable (non-unique) signatures:\n * this function rejects them by requiring the `s` value to be in the lower\n * half order, and the `v` value to be either 27 or 28.\n *\n * IMPORTANT: `hash` _must_ be the result of a hash operation for the\n * verification to be secure: it is possible to craft signatures that\n * recover to arbitrary addresses for non-hashed data. A safe way to ensure\n * this is by receiving a hash of the original message (which may otherwise\n * be too long), and then calling {toEthSignedMessageHash} on it.\n */\n function recover(bytes32 hash, bytes memory signature) internal pure returns (address) {\n (address recovered, RecoverError error) = tryRecover(hash, signature);\n _throwError(error);\n return recovered;\n }\n\n /**\n * @dev Overload of {ECDSA-tryRecover} that receives the `r` and `vs` short-signature fields separately.\n *\n * See https://eips.ethereum.org/EIPS/eip-2098[EIP-2098 short signatures]\n *\n * _Available since v4.3._\n */\n function tryRecover(\n bytes32 hash,\n bytes32 r,\n bytes32 vs\n ) internal pure returns (address, RecoverError) {\n bytes32 s = vs & bytes32(0x7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff);\n uint8 v = uint8((uint256(vs) >> 255) + 27);\n return tryRecover(hash, v, r, s);\n }\n\n /**\n * @dev Overload of {ECDSA-recover} that receives the `r and `vs` short-signature fields separately.\n *\n * _Available since v4.2._\n */\n function recover(\n bytes32 hash,\n bytes32 r,\n bytes32 vs\n ) internal pure returns (address) {\n (address recovered, RecoverError error) = tryRecover(hash, r, vs);\n _throwError(error);\n return recovered;\n }\n\n /**\n * @dev Overload of {ECDSA-tryRecover} that receives the `v`,\n * `r` and `s` signature fields separately.\n *\n * _Available since v4.3._\n */\n function tryRecover(\n bytes32 hash,\n uint8 v,\n bytes32 r,\n bytes32 s\n ) internal pure returns (address, RecoverError) {\n // EIP-2 still allows signature malleability for ecrecover(). Remove this possibility and make the signature\n // unique. Appendix F in the Ethereum Yellow paper (https://ethereum.github.io/yellowpaper/paper.pdf), defines\n // the valid range for s in (301): 0 < s < secp256k1n ÷ 2 + 1, and for v in (302): v ∈ {27, 28}. Most\n // signatures from current libraries generate a unique signature with an s-value in the lower half order.\n //\n // If your library generates malleable signatures, such as s-values in the upper range, calculate a new s-value\n // with 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFEBAAEDCE6AF48A03BBFD25E8CD0364141 - s1 and flip v from 27 to 28 or\n // vice versa. If your library also generates signatures with 0/1 for v instead 27/28, add 27 to v to accept\n // these malleable signatures as well.\n if (uint256(s) > 0x7FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF5D576E7357A4501DDFE92F46681B20A0) {\n return (address(0), RecoverError.InvalidSignatureS);\n }\n if (v != 27 && v != 28) {\n return (address(0), RecoverError.InvalidSignatureV);\n }\n\n // If the signature is valid (and not malleable), return the signer address\n address signer = ecrecover(hash, v, r, s);\n if (signer == address(0)) {\n return (address(0), RecoverError.InvalidSignature);\n }\n\n return (signer, RecoverError.NoError);\n }\n\n /**\n * @dev Overload of {ECDSA-recover} that receives the `v`,\n * `r` and `s` signature fields separately.\n */\n function recover(\n bytes32 hash,\n uint8 v,\n bytes32 r,\n bytes32 s\n ) internal pure returns (address) {\n (address recovered, RecoverError error) = tryRecover(hash, v, r, s);\n _throwError(error);\n return recovered;\n }\n\n /**\n * @dev Returns an Ethereum Signed Message, created from a `hash`. This\n * produces hash corresponding to the one signed with the\n * https://eth.wiki/json-rpc/API#eth_sign[`eth_sign`]\n * JSON-RPC method as part of EIP-191.\n *\n * See {recover}.\n */\n function toEthSignedMessageHash(bytes32 hash) internal pure returns (bytes32) {\n // 32 is the length in bytes of hash,\n // enforced by the type signature above\n return keccak256(abi.encodePacked(\"\\x19Ethereum Signed Message:\\n32\", hash));\n }\n\n /**\n * @dev Returns an Ethereum Signed Message, created from `s`. This\n * produces hash corresponding to the one signed with the\n * https://eth.wiki/json-rpc/API#eth_sign[`eth_sign`]\n * JSON-RPC method as part of EIP-191.\n *\n * See {recover}.\n */\n function toEthSignedMessageHash(bytes memory s) internal pure returns (bytes32) {\n return keccak256(abi.encodePacked(\"\\x19Ethereum Signed Message:\\n\", Strings.toString(s.length), s));\n }\n\n /**\n * @dev Returns an Ethereum Signed Typed Data, created from a\n * `domainSeparator` and a `structHash`. This produces hash corresponding\n * to the one signed with the\n * https://eips.ethereum.org/EIPS/eip-712[`eth_signTypedData`]\n * JSON-RPC method as part of EIP-712.\n *\n * See {recover}.\n */\n function toTypedDataHash(bytes32 domainSeparator, bytes32 structHash) internal pure returns (bytes32) {\n return keccak256(abi.encodePacked(\"\\x19\\x01\", domainSeparator, structHash));\n }\n}\n" + }, + "@uma/core/contracts/common/implementation/Testable.sol": { + "content": "// SPDX-License-Identifier: AGPL-3.0-only\npragma solidity ^0.8.0;\n\nimport \"./Timer.sol\";\n\n/**\n * @title Base class that provides time overrides, but only if being run in test mode.\n */\nabstract contract Testable {\n // If the contract is being run in production, then `timerAddress` will be the 0x0 address.\n // Note: this variable should be set on construction and never modified.\n address public timerAddress;\n\n /**\n * @notice Constructs the Testable contract. Called by child contracts.\n * @param _timerAddress Contract that stores the current time in a testing environment.\n * Must be set to 0x0 for production environments that use live time.\n */\n constructor(address _timerAddress) {\n timerAddress = _timerAddress;\n }\n\n /**\n * @notice Reverts if not running in test mode.\n */\n modifier onlyIfTest {\n require(timerAddress != address(0x0));\n _;\n }\n\n /**\n * @notice Sets the current time.\n * @dev Will revert if not running in test mode.\n * @param time timestamp to set current Testable time to.\n */\n function setCurrentTime(uint256 time) external onlyIfTest {\n Timer(timerAddress).setCurrentTime(time);\n }\n\n /**\n * @notice Gets the current time. Will return the last time set in `setCurrentTime` if running in test mode.\n * Otherwise, it will return the block timestamp.\n * @return uint for the current Testable timestamp.\n */\n function getCurrentTime() public view virtual returns (uint256) {\n if (timerAddress != address(0x0)) {\n return Timer(timerAddress).getCurrentTime();\n } else {\n return block.timestamp; // solhint-disable-line not-rely-on-time\n }\n }\n}\n" + }, + "@uma/core/contracts/common/implementation/MultiCaller.sol": { + "content": "// This contract is taken from Uniswaps'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.\npragma solidity ^0.8.0;\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 payable returns (bytes[] memory results) {\n require(msg.value == 0, \"Only multicall with 0 value\");\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/HubPoolInterface.sol": { + "content": "// SPDX-License-Identifier: GPL-3.0-only\npragma solidity ^0.8.0;\n\nimport \"./interfaces/AdapterInterface.sol\";\n\nimport \"@openzeppelin/contracts/token/ERC20/IERC20.sol\";\n\n/**\n * @notice Concise list of functions in HubPool implementation.\n */\ninterface HubPoolInterface {\n // This leaf is meant to be decoded in the HubPool to rebalance tokens between HubPool and SpokePool.\n struct PoolRebalanceLeaf {\n // This is used to know which chain to send cross-chain transactions to (and which SpokePool to send to).\n uint256 chainId;\n // Total LP fee amount per token in this bundle, encompassing all associated bundled relays.\n uint256[] bundleLpFees;\n // This array is grouped with the two above, and it represents the amount to send or request back from the\n // SpokePool. If positive, the pool will pay the SpokePool. If negative the SpokePool will pay the HubPool.\n // There can be arbitrarily complex rebalancing rules defined offchain. This number is only nonzero when the\n // rules indicate that a rebalancing action should occur. When a rebalance does occur, runningBalances should be\n // set to zero for this token and the netSendAmounts should be set to the previous runningBalances + relays -\n // deposits in this bundle. If non-zero then it must be set on the SpokePool's RelayerRefundLeaf amountToReturn\n // as -1 * this value to indicate if funds are being sent from or to the SpokePool.\n int256[] netSendAmounts;\n // This is only here to be emitted in an event to track a running unpaid balance between the L2 pool and the L1\n // pool. A positive number indicates that the HubPool owes the SpokePool funds. A negative number indicates that\n // the SpokePool owes the HubPool funds. See the comment above for the dynamics of this and netSendAmounts.\n int256[] runningBalances;\n // Used by data worker to mark which leaves should relay roots to SpokePools, and to otherwise organize leaves.\n // For example, each leaf should contain all the rebalance information for a single chain, but in the case where\n // the list of l1Tokens is very large such that they all can't fit into a single leaf that can be executed under\n // the block gas limit, then the data worker can use this groupIndex to organize them. Any leaves with\n // a groupIndex equal to 0 will relay roots to the SpokePool, so the data worker should ensure that only one\n // leaf for a specific chainId should have a groupIndex equal to 0.\n uint256 groupIndex;\n // Used as the index in the bitmap to track whether this leaf has been executed or not.\n uint8 leafId;\n // The following arrays are required to be the same length. They are parallel arrays for the given chainId and\n // should be ordered by the l1Tokens field. All whitelisted tokens with nonzero relays on this chain in this\n // bundle in the order of whitelisting.\n address[] l1Tokens;\n }\n\n // A data worker can optimistically store several merkle roots on this contract by staking a bond and calling\n // proposeRootBundle. By staking a bond, the data worker is alleging that the merkle roots all contain valid leaves\n // that can be executed later to:\n // - Send funds from this contract to a SpokePool or vice versa\n // - Send funds from a SpokePool to Relayer as a refund for a relayed deposit\n // - Send funds from a SpokePool to a deposit recipient to fulfill a \"slow\" relay\n // Anyone can dispute this struct if the merkle roots contain invalid leaves before the\n // requestExpirationTimestamp. Once the expiration timestamp is passed, executeRootBundle to execute a leaf\n // from the poolRebalanceRoot on this contract and it will simultaneously publish the relayerRefundRoot and\n // slowRelayRoot to a SpokePool. The latter two roots, once published to the SpokePool, contain\n // leaves that can be executed on the SpokePool to pay relayers or recipients.\n struct RootBundle {\n // Contains leaves instructing this contract to send funds to SpokePools.\n bytes32 poolRebalanceRoot;\n // Relayer refund merkle root to be published to a SpokePool.\n bytes32 relayerRefundRoot;\n // Slow relay merkle root to be published to a SpokePool.\n bytes32 slowRelayRoot;\n // This is a 1D bitmap, with max size of 256 elements, limiting us to 256 chainsIds.\n uint256 claimedBitMap;\n // Proposer of this root bundle.\n address proposer;\n // Number of pool rebalance leaves to execute in the poolRebalanceRoot. After this number\n // of leaves are executed, a new root bundle can be proposed\n uint8 unclaimedPoolRebalanceLeafCount;\n // When root bundle challenge period passes and this root bundle becomes executable.\n uint32 requestExpirationTimestamp;\n }\n\n // Each whitelisted L1 token has an associated pooledToken struct that contains all information used to track the\n // cumulative LP positions and if this token is enabled for deposits.\n struct PooledToken {\n // LP token given to LPs of a specific L1 token.\n address lpToken;\n // True if accepting new LP's.\n bool isEnabled;\n // Timestamp of last LP fee update.\n uint32 lastLpFeeUpdate;\n // Number of LP funds sent via pool rebalances to SpokePools and are expected to be sent\n // back later.\n int256 utilizedReserves;\n // Number of LP funds held in contract less utilized reserves.\n uint256 liquidReserves;\n // Number of LP funds reserved to pay out to LPs as fees.\n uint256 undistributedLpFees;\n }\n\n // Helper contracts to facilitate cross chain actions between HubPool and SpokePool for a specific network.\n struct CrossChainContract {\n address adapter;\n address spokePool;\n }\n\n function setPaused(bool pause) external;\n\n function emergencyDeleteProposal() external;\n\n function relaySpokePoolAdminFunction(uint256 chainId, bytes memory functionData) external;\n\n function setProtocolFeeCapture(address newProtocolFeeCaptureAddress, uint256 newProtocolFeeCapturePct) external;\n\n function setBond(IERC20 newBondToken, uint256 newBondAmount) external;\n\n function setLiveness(uint32 newLiveness) external;\n\n function setIdentifier(bytes32 newIdentifier) external;\n\n function setCrossChainContracts(\n uint256 l2ChainId,\n address adapter,\n address spokePool\n ) external;\n\n function enableL1TokenForLiquidityProvision(address l1Token) external;\n\n function disableL1TokenForLiquidityProvision(address l1Token) external;\n\n function addLiquidity(address l1Token, uint256 l1TokenAmount) external payable;\n\n function removeLiquidity(\n address l1Token,\n uint256 lpTokenAmount,\n bool sendEth\n ) external;\n\n function exchangeRateCurrent(address l1Token) external returns (uint256);\n\n function liquidityUtilizationCurrent(address l1Token) external returns (uint256);\n\n function liquidityUtilizationPostRelay(address token, uint256 relayedAmount) external returns (uint256);\n\n function sync(address l1Token) external;\n\n function proposeRootBundle(\n uint256[] memory bundleEvaluationBlockNumbers,\n uint8 poolRebalanceLeafCount,\n bytes32 poolRebalanceRoot,\n bytes32 relayerRefundRoot,\n bytes32 slowRelayRoot\n ) external;\n\n function executeRootBundle(\n uint256 chainId,\n uint256 groupIndex,\n uint256[] memory bundleLpFees,\n int256[] memory netSendAmounts,\n int256[] memory runningBalances,\n uint8 leafId,\n address[] memory l1Tokens,\n bytes32[] memory proof\n ) external;\n\n function disputeRootBundle() external;\n\n function claimProtocolFeesCaptured(address l1Token) external;\n\n function setPoolRebalanceRoute(\n uint256 destinationChainId,\n address l1Token,\n address destinationToken\n ) external;\n\n function setDepositRoute(\n uint256 originChainId,\n uint256 destinationChainId,\n address originToken,\n bool depositsEnabled\n ) external;\n\n function poolRebalanceRoute(uint256 destinationChainId, address l1Token)\n external\n view\n returns (address destinationToken);\n\n function loadEthForL2Calls() external payable;\n}\n" + }, + "@openzeppelin/contracts/utils/cryptography/MerkleProof.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.5.0) (utils/cryptography/MerkleProof.sol)\n\npragma solidity ^0.8.0;\n\n/**\n * @dev These functions deal with verification of Merkle Trees proofs.\n *\n * The proofs can be generated using the JavaScript library\n * https://github.com/miguelmota/merkletreejs[merkletreejs].\n * Note: the hashing algorithm should be keccak256 and pair sorting should be enabled.\n *\n * See `test/utils/cryptography/MerkleProof.test.js` for some examples.\n */\nlibrary MerkleProof {\n /**\n * @dev Returns true if a `leaf` can be proved to be a part of a Merkle tree\n * defined by `root`. For this, a `proof` must be provided, containing\n * sibling hashes on the branch from the leaf to the root of the tree. Each\n * pair of leaves and each pair of pre-images are assumed to be sorted.\n */\n function verify(\n bytes32[] memory proof,\n bytes32 root,\n bytes32 leaf\n ) internal pure returns (bool) {\n return processProof(proof, leaf) == root;\n }\n\n /**\n * @dev Returns the rebuilt hash obtained by traversing a Merklee tree up\n * from `leaf` using `proof`. A `proof` is valid if and only if the rebuilt\n * hash matches the root of the tree. When processing the proof, the pairs\n * of leafs & pre-images are assumed to be sorted.\n *\n * _Available since v4.4._\n */\n function processProof(bytes32[] memory proof, bytes32 leaf) internal pure returns (bytes32) {\n bytes32 computedHash = leaf;\n for (uint256 i = 0; i < proof.length; i++) {\n bytes32 proofElement = proof[i];\n if (computedHash <= proofElement) {\n // Hash(current computed hash + current element of the proof)\n computedHash = _efficientHash(computedHash, proofElement);\n } else {\n // Hash(current element of the proof + current computed hash)\n computedHash = _efficientHash(proofElement, computedHash);\n }\n }\n return computedHash;\n }\n\n function _efficientHash(bytes32 a, bytes32 b) private pure returns (bytes32 value) {\n assembly {\n mstore(0x00, a)\n mstore(0x20, b)\n value := keccak256(0x00, 0x40)\n }\n }\n}\n" + }, + "contracts/interfaces/AdapterInterface.sol": { + "content": "// SPDX-License-Identifier: AGPL-3.0-only\npragma solidity ^0.8.0;\n\n/**\n * @notice Sends cross chain messages and tokens to contracts on a specific L2 network.\n */\n\ninterface AdapterInterface {\n event MessageRelayed(address target, bytes message);\n\n event TokensRelayed(address l1Token, address l2Token, uint256 amount, address to);\n\n function relayMessage(address target, bytes memory message) external payable;\n\n function relayTokens(\n address l1Token,\n address l2Token,\n uint256 amount,\n address to\n ) external payable;\n}\n" + }, + "@openzeppelin/contracts/utils/Strings.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts v4.4.1 (utils/Strings.sol)\n\npragma solidity ^0.8.0;\n\n/**\n * @dev String operations.\n */\nlibrary Strings {\n bytes16 private constant _HEX_SYMBOLS = \"0123456789abcdef\";\n\n /**\n * @dev Converts a `uint256` to its ASCII `string` decimal representation.\n */\n function toString(uint256 value) internal pure returns (string memory) {\n // Inspired by OraclizeAPI's implementation - MIT licence\n // https://github.com/oraclize/ethereum-api/blob/b42146b063c7d6ee1358846c198246239e9360e8/oraclizeAPI_0.4.25.sol\n\n if (value == 0) {\n return \"0\";\n }\n uint256 temp = value;\n uint256 digits;\n while (temp != 0) {\n digits++;\n temp /= 10;\n }\n bytes memory buffer = new bytes(digits);\n while (value != 0) {\n digits -= 1;\n buffer[digits] = bytes1(uint8(48 + uint256(value % 10)));\n value /= 10;\n }\n return string(buffer);\n }\n\n /**\n * @dev Converts a `uint256` to its ASCII `string` hexadecimal representation.\n */\n function toHexString(uint256 value) internal pure returns (string memory) {\n if (value == 0) {\n return \"0x00\";\n }\n uint256 temp = value;\n uint256 length = 0;\n while (temp != 0) {\n length++;\n temp >>= 8;\n }\n return toHexString(value, length);\n }\n\n /**\n * @dev Converts a `uint256` to its ASCII `string` hexadecimal representation with fixed length.\n */\n function toHexString(uint256 value, uint256 length) internal pure returns (string memory) {\n bytes memory buffer = new bytes(2 * length + 2);\n buffer[0] = \"0\";\n buffer[1] = \"x\";\n for (uint256 i = 2 * length + 1; i > 1; --i) {\n buffer[i] = _HEX_SYMBOLS[value & 0xf];\n value >>= 4;\n }\n require(value == 0, \"Strings: hex length insufficient\");\n return string(buffer);\n }\n}\n" + }, + "@uma/core/contracts/common/implementation/Timer.sol": { + "content": "// SPDX-License-Identifier: AGPL-3.0-only\npragma solidity ^0.8.0;\n\n/**\n * @title Universal store of current contract time for testing environments.\n */\ncontract Timer {\n uint256 private currentTime;\n\n constructor() {\n currentTime = block.timestamp; // solhint-disable-line not-rely-on-time\n }\n\n /**\n * @notice Sets the current time.\n * @dev Will revert if not running in test mode.\n * @param time timestamp to set `currentTime` to.\n */\n function setCurrentTime(uint256 time) external {\n currentTime = time;\n }\n\n /**\n * @notice Gets the currentTime variable set in the Timer.\n * @return uint256 for the current Testable timestamp.\n */\n function getCurrentTime() public view returns (uint256) {\n return currentTime;\n }\n}\n" + }, + "contracts/test/MockSpokePool.sol": { + "content": "//SPDX-License-Identifier: Unlicense\npragma solidity ^0.8.0;\n\nimport \"../SpokePool.sol\";\nimport \"../SpokePoolInterface.sol\";\n\n/**\n * @title MockSpokePool\n * @notice Implements abstract contract for testing.\n */\ncontract MockSpokePool is SpokePool {\n uint256 chainId_;\n\n constructor(\n address _crossDomainAdmin,\n address _hubPool,\n address _wethAddress,\n address timerAddress\n ) SpokePool(_crossDomainAdmin, _hubPool, _wethAddress, timerAddress) {}\n\n function _bridgeTokensToHubPool(RelayerRefundLeaf memory relayerRefundLeaf) internal override {}\n\n function _requireAdminSender() internal override {}\n\n function chainId() public view override(SpokePool) returns (uint256) {\n // If chainId_ is set then return it, else do nothing and return the parent chainId().\n return chainId_ == 0 ? super.chainId() : chainId_;\n }\n\n function setChainId(uint256 _chainId) public {\n chainId_ = _chainId;\n }\n}\n" + }, + "contracts/test/MerkleLibTest.sol": { + "content": "// SPDX-License-Identifier: GPL-3.0-only\npragma solidity ^0.8.0;\n\nimport \"../MerkleLib.sol\";\nimport \"../HubPoolInterface.sol\";\nimport \"../SpokePoolInterface.sol\";\n\n/**\n * @notice Contract to test the MerkleLib.\n */\ncontract MerkleLibTest {\n mapping(uint256 => uint256) public claimedBitMap;\n\n uint256 public claimedBitMap1D;\n\n function verifyPoolRebalance(\n bytes32 root,\n HubPoolInterface.PoolRebalanceLeaf memory rebalance,\n bytes32[] memory proof\n ) public pure returns (bool) {\n return MerkleLib.verifyPoolRebalance(root, rebalance, proof);\n }\n\n function verifyRelayerRefund(\n bytes32 root,\n SpokePoolInterface.RelayerRefundLeaf memory refund,\n bytes32[] memory proof\n ) public pure returns (bool) {\n return MerkleLib.verifyRelayerRefund(root, refund, proof);\n }\n\n function verifySlowRelayFulfillment(\n bytes32 root,\n SpokePoolInterface.RelayData memory slowRelayFulfillment,\n bytes32[] memory proof\n ) public pure returns (bool) {\n return MerkleLib.verifySlowRelayFulfillment(root, slowRelayFulfillment, proof);\n }\n\n function isClaimed(uint256 index) public view returns (bool) {\n return MerkleLib.isClaimed(claimedBitMap, index);\n }\n\n function setClaimed(uint256 index) public {\n MerkleLib.setClaimed(claimedBitMap, index);\n }\n\n function isClaimed1D(uint8 index) public view returns (bool) {\n return MerkleLib.isClaimed1D(claimedBitMap1D, index);\n }\n\n function setClaimed1D(uint8 index) public {\n claimedBitMap1D = MerkleLib.setClaimed1D(claimedBitMap1D, index);\n }\n}\n" + }, + "contracts/PolygonTokenBridger.sol": { + "content": "// SPDX-License-Identifier: AGPL-3.0-only\npragma solidity ^0.8.0;\n\nimport \"./Lockable.sol\";\nimport \"./interfaces/WETH9.sol\";\n\nimport \"@openzeppelin/contracts/token/ERC20/IERC20.sol\";\nimport \"@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol\";\n\n// ERC20s (on polygon) compatible with polygon's bridge have a withdraw method.\ninterface PolygonIERC20 is IERC20 {\n function withdraw(uint256 amount) external;\n}\n\ninterface MaticToken {\n function withdraw(uint256 amount) external payable;\n}\n\n/**\n * @notice Contract deployed on Ethereum and Polygon to facilitate token transfers from Polygon to the HubPool and back.\n * @dev Because Polygon only allows withdrawals from a particular address to go to that same address on mainnet, we need to\n * have some sort of contract that can guarantee identical addresses on Polygon and Ethereum. This contract is intended\n * to be completely immutable, so it's guaranteed that the contract on each side is configured identically as long as\n * it is created via create2. create2 is an alternative creation method that uses a different address determination\n * mechanism from normal create.\n * Normal create: address = hash(deployer_address, deployer_nonce)\n * create2: address = hash(0xFF, sender, salt, bytecode)\n * This ultimately allows create2 to generate deterministic addresses that don't depend on the transaction count of the\n * sender.\n */\ncontract PolygonTokenBridger is Lockable {\n using SafeERC20 for PolygonIERC20;\n using SafeERC20 for IERC20;\n\n // Gas token for Polygon.\n MaticToken public constant maticToken = MaticToken(0x0000000000000000000000000000000000001010);\n\n // Should be set to HubPool on Ethereum, or unused on Polygon.\n address public immutable destination;\n\n // WETH contract on Ethereum.\n WETH9 public immutable l1Weth;\n\n /**\n * @notice Constructs Token Bridger contract.\n * @param _destination Where to send tokens to for this network.\n * @param _l1Weth Ethereum WETH address.\n */\n constructor(address _destination, WETH9 _l1Weth) {\n destination = _destination;\n l1Weth = _l1Weth;\n }\n\n /**\n * @notice Called by Polygon SpokePool to send tokens over bridge to contract with the same address as this.\n * @notice The caller of this function must approve this contract to spend amount of token.\n * @param token Token to bridge.\n * @param amount Amount to bridge.\n * @param isWrappedMatic True if token is WMATIC.\n */\n function send(\n PolygonIERC20 token,\n uint256 amount,\n bool isWrappedMatic\n ) public nonReentrant {\n token.safeTransferFrom(msg.sender, address(this), amount);\n\n // In the wMatic case, this unwraps. For other ERC20s, this is the burn/send action.\n token.withdraw(amount);\n\n // This takes the token that was withdrawn and calls withdraw on the \"native\" ERC20.\n if (isWrappedMatic) maticToken.withdraw{ value: amount }(amount);\n }\n\n /**\n * @notice Called by someone to send tokens to the destination, which should be set to the HubPool.\n * @param token Token to send to destination.\n */\n function retrieve(IERC20 token) public nonReentrant {\n token.safeTransfer(destination, token.balanceOf(address(this)));\n }\n\n receive() external payable {\n // Note: this should only happen on the mainnet side where ETH is sent to the contract directly by the bridge.\n if (functionCallStackOriginatesFromOutsideThisContract()) l1Weth.deposit{ value: address(this).balance }();\n }\n}\n" + }, + "contracts/test/PolygonERC20Test.sol": { + "content": "// SPDX-License-Identifier: AGPL-3.0-only\npragma solidity ^0.8.0;\n\nimport \"@uma/core/contracts/common/implementation/ExpandedERC20.sol\";\nimport \"../PolygonTokenBridger.sol\";\n\n/**\n * @notice Simulated Polygon ERC20 for use in testing PolygonTokenBridger.\n */\ncontract PolygonERC20Test is ExpandedERC20, PolygonIERC20 {\n constructor() ExpandedERC20(\"Polygon Test\", \"POLY_TEST\", 18) {}\n\n function withdraw(uint256 amount) public {\n _burn(msg.sender, amount);\n }\n}\n" + }, + "@uma/core/contracts/common/implementation/ExpandedERC20.sol": { + "content": "// SPDX-License-Identifier: AGPL-3.0-only\npragma solidity ^0.8.0;\n\nimport \"@openzeppelin/contracts/token/ERC20/ERC20.sol\";\nimport \"./MultiRole.sol\";\nimport \"../interfaces/ExpandedIERC20.sol\";\n\n/**\n * @title An ERC20 with permissioned burning and minting. The contract deployer will initially\n * be the owner who is capable of adding new roles.\n */\ncontract ExpandedERC20 is ExpandedIERC20, ERC20, MultiRole {\n enum Roles {\n // Can set the minter and burner.\n Owner,\n // Addresses that can mint new tokens.\n Minter,\n // Addresses that can burn tokens that address owns.\n Burner\n }\n\n uint8 _decimals;\n\n /**\n * @notice Constructs the ExpandedERC20.\n * @param _tokenName The name which describes the new token.\n * @param _tokenSymbol The ticker abbreviation of the name. Ideally < 5 chars.\n * @param _tokenDecimals The number of decimals to define token precision.\n */\n constructor(\n string memory _tokenName,\n string memory _tokenSymbol,\n uint8 _tokenDecimals\n ) ERC20(_tokenName, _tokenSymbol) {\n _decimals = _tokenDecimals;\n _createExclusiveRole(uint256(Roles.Owner), uint256(Roles.Owner), msg.sender);\n _createSharedRole(uint256(Roles.Minter), uint256(Roles.Owner), new address[](0));\n _createSharedRole(uint256(Roles.Burner), uint256(Roles.Owner), new address[](0));\n }\n\n function decimals() public view virtual override(ERC20) returns (uint8) {\n return _decimals;\n }\n\n /**\n * @dev Mints `value` tokens to `recipient`, returning true on success.\n * @param recipient address to mint to.\n * @param value amount of tokens to mint.\n * @return True if the mint succeeded, or False.\n */\n function mint(address recipient, uint256 value)\n external\n override\n onlyRoleHolder(uint256(Roles.Minter))\n returns (bool)\n {\n _mint(recipient, value);\n return true;\n }\n\n /**\n * @dev Burns `value` tokens owned by `msg.sender`.\n * @param value amount of tokens to burn.\n */\n function burn(uint256 value) external override onlyRoleHolder(uint256(Roles.Burner)) {\n _burn(msg.sender, value);\n }\n\n /**\n * @dev Burns `value` tokens owned by `recipient`.\n * @param recipient address to burn tokens from.\n * @param value amount of tokens to burn.\n * @return True if the burn succeeded, or False.\n */\n function burnFrom(address recipient, uint256 value)\n external\n override\n onlyRoleHolder(uint256(Roles.Burner))\n returns (bool)\n {\n _burn(recipient, value);\n return true;\n }\n\n /**\n * @notice Add Minter role to account.\n * @dev The caller must have the Owner role.\n * @param account The address to which the Minter role is added.\n */\n function addMinter(address account) external virtual override {\n addMember(uint256(Roles.Minter), account);\n }\n\n /**\n * @notice Add Burner role to account.\n * @dev The caller must have the Owner role.\n * @param account The address to which the Burner role is added.\n */\n function addBurner(address account) external virtual override {\n addMember(uint256(Roles.Burner), account);\n }\n\n /**\n * @notice Reset Owner role to account.\n * @dev The caller must have the Owner role.\n * @param account The new holder of the Owner role.\n */\n function resetOwner(address account) external virtual override {\n resetMember(uint256(Roles.Owner), account);\n }\n}\n" + }, + "@openzeppelin/contracts/token/ERC20/ERC20.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.5.0) (token/ERC20/ERC20.sol)\n\npragma solidity ^0.8.0;\n\nimport \"./IERC20.sol\";\nimport \"./extensions/IERC20Metadata.sol\";\nimport \"../../utils/Context.sol\";\n\n/**\n * @dev Implementation of the {IERC20} interface.\n *\n * This implementation is agnostic to the way tokens are created. This means\n * that a supply mechanism has to be added in a derived contract using {_mint}.\n * For a generic mechanism see {ERC20PresetMinterPauser}.\n *\n * TIP: For a detailed writeup see our guide\n * https://forum.zeppelin.solutions/t/how-to-implement-erc20-supply-mechanisms/226[How\n * to implement supply mechanisms].\n *\n * We have followed general OpenZeppelin Contracts guidelines: functions revert\n * instead returning `false` on failure. This behavior is nonetheless\n * conventional and does not conflict with the expectations of ERC20\n * applications.\n *\n * Additionally, an {Approval} event is emitted on calls to {transferFrom}.\n * This allows applications to reconstruct the allowance for all accounts just\n * by listening to said events. Other implementations of the EIP may not emit\n * these events, as it isn't required by the specification.\n *\n * Finally, the non-standard {decreaseAllowance} and {increaseAllowance}\n * functions have been added to mitigate the well-known issues around setting\n * allowances. See {IERC20-approve}.\n */\ncontract ERC20 is Context, IERC20, IERC20Metadata {\n mapping(address => uint256) private _balances;\n\n mapping(address => mapping(address => uint256)) private _allowances;\n\n uint256 private _totalSupply;\n\n string private _name;\n string private _symbol;\n\n /**\n * @dev Sets the values for {name} and {symbol}.\n *\n * The default value of {decimals} is 18. To select a different value for\n * {decimals} you should overload it.\n *\n * All two of these values are immutable: they can only be set once during\n * construction.\n */\n constructor(string memory name_, string memory symbol_) {\n _name = name_;\n _symbol = symbol_;\n }\n\n /**\n * @dev Returns the name of the token.\n */\n function name() public view virtual override returns (string memory) {\n return _name;\n }\n\n /**\n * @dev Returns the symbol of the token, usually a shorter version of the\n * name.\n */\n function symbol() public view virtual override returns (string memory) {\n return _symbol;\n }\n\n /**\n * @dev Returns the number of decimals used to get its user representation.\n * For example, if `decimals` equals `2`, a balance of `505` tokens should\n * be displayed to a user as `5.05` (`505 / 10 ** 2`).\n *\n * Tokens usually opt for a value of 18, imitating the relationship between\n * Ether and Wei. This is the value {ERC20} uses, unless this function is\n * overridden;\n *\n * NOTE: This information is only used for _display_ purposes: it in\n * no way affects any of the arithmetic of the contract, including\n * {IERC20-balanceOf} and {IERC20-transfer}.\n */\n function decimals() public view virtual override returns (uint8) {\n return 18;\n }\n\n /**\n * @dev See {IERC20-totalSupply}.\n */\n function totalSupply() public view virtual override returns (uint256) {\n return _totalSupply;\n }\n\n /**\n * @dev See {IERC20-balanceOf}.\n */\n function balanceOf(address account) public view virtual override returns (uint256) {\n return _balances[account];\n }\n\n /**\n * @dev See {IERC20-transfer}.\n *\n * Requirements:\n *\n * - `to` cannot be the zero address.\n * - the caller must have a balance of at least `amount`.\n */\n function transfer(address to, uint256 amount) public virtual override returns (bool) {\n address owner = _msgSender();\n _transfer(owner, to, amount);\n return true;\n }\n\n /**\n * @dev See {IERC20-allowance}.\n */\n function allowance(address owner, address spender) public view virtual override returns (uint256) {\n return _allowances[owner][spender];\n }\n\n /**\n * @dev See {IERC20-approve}.\n *\n * NOTE: If `amount` is the maximum `uint256`, the allowance is not updated on\n * `transferFrom`. This is semantically equivalent to an infinite approval.\n *\n * Requirements:\n *\n * - `spender` cannot be the zero address.\n */\n function approve(address spender, uint256 amount) public virtual override returns (bool) {\n address owner = _msgSender();\n _approve(owner, spender, amount);\n return true;\n }\n\n /**\n * @dev See {IERC20-transferFrom}.\n *\n * Emits an {Approval} event indicating the updated allowance. This is not\n * required by the EIP. See the note at the beginning of {ERC20}.\n *\n * NOTE: Does not update the allowance if the current allowance\n * is the maximum `uint256`.\n *\n * Requirements:\n *\n * - `from` and `to` cannot be the zero address.\n * - `from` must have a balance of at least `amount`.\n * - the caller must have allowance for ``from``'s tokens of at least\n * `amount`.\n */\n function transferFrom(\n address from,\n address to,\n uint256 amount\n ) public virtual override returns (bool) {\n address spender = _msgSender();\n _spendAllowance(from, spender, amount);\n _transfer(from, to, amount);\n return true;\n }\n\n /**\n * @dev Atomically increases the allowance granted to `spender` by the caller.\n *\n * This is an alternative to {approve} that can be used as a mitigation for\n * problems described in {IERC20-approve}.\n *\n * Emits an {Approval} event indicating the updated allowance.\n *\n * Requirements:\n *\n * - `spender` cannot be the zero address.\n */\n function increaseAllowance(address spender, uint256 addedValue) public virtual returns (bool) {\n address owner = _msgSender();\n _approve(owner, spender, _allowances[owner][spender] + addedValue);\n return true;\n }\n\n /**\n * @dev Atomically decreases the allowance granted to `spender` by the caller.\n *\n * This is an alternative to {approve} that can be used as a mitigation for\n * problems described in {IERC20-approve}.\n *\n * Emits an {Approval} event indicating the updated allowance.\n *\n * Requirements:\n *\n * - `spender` cannot be the zero address.\n * - `spender` must have allowance for the caller of at least\n * `subtractedValue`.\n */\n function decreaseAllowance(address spender, uint256 subtractedValue) public virtual returns (bool) {\n address owner = _msgSender();\n uint256 currentAllowance = _allowances[owner][spender];\n require(currentAllowance >= subtractedValue, \"ERC20: decreased allowance below zero\");\n unchecked {\n _approve(owner, spender, currentAllowance - subtractedValue);\n }\n\n return true;\n }\n\n /**\n * @dev Moves `amount` of tokens from `sender` to `recipient`.\n *\n * This internal function is equivalent to {transfer}, and can be used to\n * e.g. implement automatic token fees, slashing mechanisms, etc.\n *\n * Emits a {Transfer} event.\n *\n * Requirements:\n *\n * - `from` cannot be the zero address.\n * - `to` cannot be the zero address.\n * - `from` must have a balance of at least `amount`.\n */\n function _transfer(\n address from,\n address to,\n uint256 amount\n ) internal virtual {\n require(from != address(0), \"ERC20: transfer from the zero address\");\n require(to != address(0), \"ERC20: transfer to the zero address\");\n\n _beforeTokenTransfer(from, to, amount);\n\n uint256 fromBalance = _balances[from];\n require(fromBalance >= amount, \"ERC20: transfer amount exceeds balance\");\n unchecked {\n _balances[from] = fromBalance - amount;\n }\n _balances[to] += amount;\n\n emit Transfer(from, to, amount);\n\n _afterTokenTransfer(from, to, amount);\n }\n\n /** @dev Creates `amount` tokens and assigns them to `account`, increasing\n * the total supply.\n *\n * Emits a {Transfer} event with `from` set to the zero address.\n *\n * Requirements:\n *\n * - `account` cannot be the zero address.\n */\n function _mint(address account, uint256 amount) internal virtual {\n require(account != address(0), \"ERC20: mint to the zero address\");\n\n _beforeTokenTransfer(address(0), account, amount);\n\n _totalSupply += amount;\n _balances[account] += amount;\n emit Transfer(address(0), account, amount);\n\n _afterTokenTransfer(address(0), account, amount);\n }\n\n /**\n * @dev Destroys `amount` tokens from `account`, reducing the\n * total supply.\n *\n * Emits a {Transfer} event with `to` set to the zero address.\n *\n * Requirements:\n *\n * - `account` cannot be the zero address.\n * - `account` must have at least `amount` tokens.\n */\n function _burn(address account, uint256 amount) internal virtual {\n require(account != address(0), \"ERC20: burn from the zero address\");\n\n _beforeTokenTransfer(account, address(0), amount);\n\n uint256 accountBalance = _balances[account];\n require(accountBalance >= amount, \"ERC20: burn amount exceeds balance\");\n unchecked {\n _balances[account] = accountBalance - amount;\n }\n _totalSupply -= amount;\n\n emit Transfer(account, address(0), amount);\n\n _afterTokenTransfer(account, address(0), amount);\n }\n\n /**\n * @dev Sets `amount` as the allowance of `spender` over the `owner` s tokens.\n *\n * This internal function is equivalent to `approve`, and can be used to\n * e.g. set automatic allowances for certain subsystems, etc.\n *\n * Emits an {Approval} event.\n *\n * Requirements:\n *\n * - `owner` cannot be the zero address.\n * - `spender` cannot be the zero address.\n */\n function _approve(\n address owner,\n address spender,\n uint256 amount\n ) internal virtual {\n require(owner != address(0), \"ERC20: approve from the zero address\");\n require(spender != address(0), \"ERC20: approve to the zero address\");\n\n _allowances[owner][spender] = amount;\n emit Approval(owner, spender, amount);\n }\n\n /**\n * @dev Spend `amount` form the allowance of `owner` toward `spender`.\n *\n * Does not update the allowance amount in case of infinite allowance.\n * Revert if not enough allowance is available.\n *\n * Might emit an {Approval} event.\n */\n function _spendAllowance(\n address owner,\n address spender,\n uint256 amount\n ) internal virtual {\n uint256 currentAllowance = allowance(owner, spender);\n if (currentAllowance != type(uint256).max) {\n require(currentAllowance >= amount, \"ERC20: insufficient allowance\");\n unchecked {\n _approve(owner, spender, currentAllowance - amount);\n }\n }\n }\n\n /**\n * @dev Hook that is called before any transfer of tokens. This includes\n * minting and burning.\n *\n * Calling conditions:\n *\n * - when `from` and `to` are both non-zero, `amount` of ``from``'s tokens\n * will be transferred to `to`.\n * - when `from` is zero, `amount` tokens will be minted for `to`.\n * - when `to` is zero, `amount` of ``from``'s tokens will be burned.\n * - `from` and `to` are never both zero.\n *\n * To learn more about hooks, head to xref:ROOT:extending-contracts.adoc#using-hooks[Using Hooks].\n */\n function _beforeTokenTransfer(\n address from,\n address to,\n uint256 amount\n ) internal virtual {}\n\n /**\n * @dev Hook that is called after any transfer of tokens. This includes\n * minting and burning.\n *\n * Calling conditions:\n *\n * - when `from` and `to` are both non-zero, `amount` of ``from``'s tokens\n * has been transferred to `to`.\n * - when `from` is zero, `amount` tokens have been minted for `to`.\n * - when `to` is zero, `amount` of ``from``'s tokens have been burned.\n * - `from` and `to` are never both zero.\n *\n * To learn more about hooks, head to xref:ROOT:extending-contracts.adoc#using-hooks[Using Hooks].\n */\n function _afterTokenTransfer(\n address from,\n address to,\n uint256 amount\n ) internal virtual {}\n}\n" + }, + "@uma/core/contracts/common/implementation/MultiRole.sol": { + "content": "// SPDX-License-Identifier: AGPL-3.0-only\npragma solidity ^0.8.0;\n\nlibrary Exclusive {\n struct RoleMembership {\n address member;\n }\n\n function isMember(RoleMembership storage roleMembership, address memberToCheck) internal view returns (bool) {\n return roleMembership.member == memberToCheck;\n }\n\n function resetMember(RoleMembership storage roleMembership, address newMember) internal {\n require(newMember != address(0x0), \"Cannot set an exclusive role to 0x0\");\n roleMembership.member = newMember;\n }\n\n function getMember(RoleMembership storage roleMembership) internal view returns (address) {\n return roleMembership.member;\n }\n\n function init(RoleMembership storage roleMembership, address initialMember) internal {\n resetMember(roleMembership, initialMember);\n }\n}\n\nlibrary Shared {\n struct RoleMembership {\n mapping(address => bool) members;\n }\n\n function isMember(RoleMembership storage roleMembership, address memberToCheck) internal view returns (bool) {\n return roleMembership.members[memberToCheck];\n }\n\n function addMember(RoleMembership storage roleMembership, address memberToAdd) internal {\n require(memberToAdd != address(0x0), \"Cannot add 0x0 to a shared role\");\n roleMembership.members[memberToAdd] = true;\n }\n\n function removeMember(RoleMembership storage roleMembership, address memberToRemove) internal {\n roleMembership.members[memberToRemove] = false;\n }\n\n function init(RoleMembership storage roleMembership, address[] memory initialMembers) internal {\n for (uint256 i = 0; i < initialMembers.length; i++) {\n addMember(roleMembership, initialMembers[i]);\n }\n }\n}\n\n/**\n * @title Base class to manage permissions for the derived class.\n */\nabstract contract MultiRole {\n using Exclusive for Exclusive.RoleMembership;\n using Shared for Shared.RoleMembership;\n\n enum RoleType { Invalid, Exclusive, Shared }\n\n struct Role {\n uint256 managingRole;\n RoleType roleType;\n Exclusive.RoleMembership exclusiveRoleMembership;\n Shared.RoleMembership sharedRoleMembership;\n }\n\n mapping(uint256 => Role) private roles;\n\n event ResetExclusiveMember(uint256 indexed roleId, address indexed newMember, address indexed manager);\n event AddedSharedMember(uint256 indexed roleId, address indexed newMember, address indexed manager);\n event RemovedSharedMember(uint256 indexed roleId, address indexed oldMember, address indexed manager);\n\n /**\n * @notice Reverts unless the caller is a member of the specified roleId.\n */\n modifier onlyRoleHolder(uint256 roleId) {\n require(holdsRole(roleId, msg.sender), \"Sender does not hold required role\");\n _;\n }\n\n /**\n * @notice Reverts unless the caller is a member of the manager role for the specified roleId.\n */\n modifier onlyRoleManager(uint256 roleId) {\n require(holdsRole(roles[roleId].managingRole, msg.sender), \"Can only be called by a role manager\");\n _;\n }\n\n /**\n * @notice Reverts unless the roleId represents an initialized, exclusive roleId.\n */\n modifier onlyExclusive(uint256 roleId) {\n require(roles[roleId].roleType == RoleType.Exclusive, \"Must be called on an initialized Exclusive role\");\n _;\n }\n\n /**\n * @notice Reverts unless the roleId represents an initialized, shared roleId.\n */\n modifier onlyShared(uint256 roleId) {\n require(roles[roleId].roleType == RoleType.Shared, \"Must be called on an initialized Shared role\");\n _;\n }\n\n /**\n * @notice Whether `memberToCheck` is a member of roleId.\n * @dev Reverts if roleId does not correspond to an initialized role.\n * @param roleId the Role to check.\n * @param memberToCheck the address to check.\n * @return True if `memberToCheck` is a member of `roleId`.\n */\n function holdsRole(uint256 roleId, address memberToCheck) public view returns (bool) {\n Role storage role = roles[roleId];\n if (role.roleType == RoleType.Exclusive) {\n return role.exclusiveRoleMembership.isMember(memberToCheck);\n } else if (role.roleType == RoleType.Shared) {\n return role.sharedRoleMembership.isMember(memberToCheck);\n }\n revert(\"Invalid roleId\");\n }\n\n /**\n * @notice Changes the exclusive role holder of `roleId` to `newMember`.\n * @dev Reverts if the caller is not a member of the managing role for `roleId` or if `roleId` is not an\n * initialized, ExclusiveRole.\n * @param roleId the ExclusiveRole membership to modify.\n * @param newMember the new ExclusiveRole member.\n */\n function resetMember(uint256 roleId, address newMember) public onlyExclusive(roleId) onlyRoleManager(roleId) {\n roles[roleId].exclusiveRoleMembership.resetMember(newMember);\n emit ResetExclusiveMember(roleId, newMember, msg.sender);\n }\n\n /**\n * @notice Gets the current holder of the exclusive role, `roleId`.\n * @dev Reverts if `roleId` does not represent an initialized, exclusive role.\n * @param roleId the ExclusiveRole membership to check.\n * @return the address of the current ExclusiveRole member.\n */\n function getMember(uint256 roleId) public view onlyExclusive(roleId) returns (address) {\n return roles[roleId].exclusiveRoleMembership.getMember();\n }\n\n /**\n * @notice Adds `newMember` to the shared role, `roleId`.\n * @dev Reverts if `roleId` does not represent an initialized, SharedRole or if the caller is not a member of the\n * managing role for `roleId`.\n * @param roleId the SharedRole membership to modify.\n * @param newMember the new SharedRole member.\n */\n function addMember(uint256 roleId, address newMember) public onlyShared(roleId) onlyRoleManager(roleId) {\n roles[roleId].sharedRoleMembership.addMember(newMember);\n emit AddedSharedMember(roleId, newMember, msg.sender);\n }\n\n /**\n * @notice Removes `memberToRemove` from the shared role, `roleId`.\n * @dev Reverts if `roleId` does not represent an initialized, SharedRole or if the caller is not a member of the\n * managing role for `roleId`.\n * @param roleId the SharedRole membership to modify.\n * @param memberToRemove the current SharedRole member to remove.\n */\n function removeMember(uint256 roleId, address memberToRemove) public onlyShared(roleId) onlyRoleManager(roleId) {\n roles[roleId].sharedRoleMembership.removeMember(memberToRemove);\n emit RemovedSharedMember(roleId, memberToRemove, msg.sender);\n }\n\n /**\n * @notice Removes caller from the role, `roleId`.\n * @dev Reverts if the caller is not a member of the role for `roleId` or if `roleId` is not an\n * initialized, SharedRole.\n * @param roleId the SharedRole membership to modify.\n */\n function renounceMembership(uint256 roleId) public onlyShared(roleId) onlyRoleHolder(roleId) {\n roles[roleId].sharedRoleMembership.removeMember(msg.sender);\n emit RemovedSharedMember(roleId, msg.sender, msg.sender);\n }\n\n /**\n * @notice Reverts if `roleId` is not initialized.\n */\n modifier onlyValidRole(uint256 roleId) {\n require(roles[roleId].roleType != RoleType.Invalid, \"Attempted to use an invalid roleId\");\n _;\n }\n\n /**\n * @notice Reverts if `roleId` is initialized.\n */\n modifier onlyInvalidRole(uint256 roleId) {\n require(roles[roleId].roleType == RoleType.Invalid, \"Cannot use a pre-existing role\");\n _;\n }\n\n /**\n * @notice Internal method to initialize a shared role, `roleId`, which will be managed by `managingRoleId`.\n * `initialMembers` will be immediately added to the role.\n * @dev Should be called by derived contracts, usually at construction time. Will revert if the role is already\n * initialized.\n */\n function _createSharedRole(\n uint256 roleId,\n uint256 managingRoleId,\n address[] memory initialMembers\n ) internal onlyInvalidRole(roleId) {\n Role storage role = roles[roleId];\n role.roleType = RoleType.Shared;\n role.managingRole = managingRoleId;\n role.sharedRoleMembership.init(initialMembers);\n require(\n roles[managingRoleId].roleType != RoleType.Invalid,\n \"Attempted to use an invalid role to manage a shared role\"\n );\n }\n\n /**\n * @notice Internal method to initialize an exclusive role, `roleId`, which will be managed by `managingRoleId`.\n * `initialMember` will be immediately added to the role.\n * @dev Should be called by derived contracts, usually at construction time. Will revert if the role is already\n * initialized.\n */\n function _createExclusiveRole(\n uint256 roleId,\n uint256 managingRoleId,\n address initialMember\n ) internal onlyInvalidRole(roleId) {\n Role storage role = roles[roleId];\n role.roleType = RoleType.Exclusive;\n role.managingRole = managingRoleId;\n role.exclusiveRoleMembership.init(initialMember);\n require(\n roles[managingRoleId].roleType != RoleType.Invalid,\n \"Attempted to use an invalid role to manage an exclusive role\"\n );\n }\n}\n" + }, + "@uma/core/contracts/common/interfaces/ExpandedIERC20.sol": { + "content": "// SPDX-License-Identifier: AGPL-3.0-only\npragma solidity ^0.8.0;\n\nimport \"@openzeppelin/contracts/token/ERC20/IERC20.sol\";\n\n/**\n * @title ERC20 interface that includes burn and mint methods.\n */\nabstract contract ExpandedIERC20 is IERC20 {\n /**\n * @notice Burns a specific amount of the caller's tokens.\n * @dev Only burns the caller's tokens, so it is safe to leave this method permissionless.\n */\n function burn(uint256 value) external virtual;\n\n /**\n * @dev Burns `value` tokens owned by `recipient`.\n * @param recipient address to burn tokens from.\n * @param value amount of tokens to burn.\n */\n function burnFrom(address recipient, uint256 value) external virtual returns (bool);\n\n /**\n * @notice Mints tokens and adds them to the balance of the `to` address.\n * @dev This method should be permissioned to only allow designated parties to mint tokens.\n */\n function mint(address to, uint256 value) external virtual returns (bool);\n\n function addMinter(address account) external virtual;\n\n function addBurner(address account) external virtual;\n\n function resetOwner(address account) external virtual;\n}\n" + }, + "@openzeppelin/contracts/token/ERC20/extensions/IERC20Metadata.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts v4.4.1 (token/ERC20/extensions/IERC20Metadata.sol)\n\npragma solidity ^0.8.0;\n\nimport \"../IERC20.sol\";\n\n/**\n * @dev Interface for the optional metadata functions from the ERC20 standard.\n *\n * _Available since v4.1._\n */\ninterface IERC20Metadata is IERC20 {\n /**\n * @dev Returns the name of the token.\n */\n function name() external view returns (string memory);\n\n /**\n * @dev Returns the symbol of the token.\n */\n function symbol() external view returns (string memory);\n\n /**\n * @dev Returns the decimals places of the token.\n */\n function decimals() external view returns (uint8);\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" + }, + "contracts/Polygon_SpokePool.sol": { + "content": "// SPDX-License-Identifier: GPL-3.0-only\npragma solidity ^0.8.0;\n\nimport \"./SpokePool.sol\";\nimport \"./PolygonTokenBridger.sol\";\nimport \"./interfaces/WETH9.sol\";\nimport \"./SpokePoolInterface.sol\";\n\nimport \"@openzeppelin/contracts/token/ERC20/IERC20.sol\";\nimport \"@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol\";\n\n// IFxMessageProcessor represents interface to process messages.\ninterface IFxMessageProcessor {\n function processMessageFromRoot(\n uint256 stateId,\n address rootMessageSender,\n bytes calldata data\n ) external;\n}\n\n/**\n * @notice Polygon specific SpokePool.\n */\ncontract Polygon_SpokePool is IFxMessageProcessor, SpokePool {\n using SafeERC20 for PolygonIERC20;\n\n // Address of FxChild which sends and receives messages to and from L1.\n address public fxChild;\n\n // Contract deployed on L1 and L2 processes all cross-chain transfers between this contract and the the HubPool.\n // Required because bridging tokens from Polygon to Ethereum has special constraints.\n PolygonTokenBridger public polygonTokenBridger;\n\n // Internal variable that only flips temporarily to true upon receiving messages from L1. Used to authenticate that\n // the caller is the fxChild AND that the fxChild called processMessageFromRoot\n bool private callValidated = false;\n\n event PolygonTokensBridged(address indexed token, address indexed receiver, uint256 amount);\n event SetFxChild(address indexed newFxChild);\n event SetPolygonTokenBridger(address indexed polygonTokenBridger);\n\n // Note: validating calls this way ensures that strange calls coming from the fxChild won't be misinterpreted.\n // Put differently, just checking that msg.sender == fxChild is not sufficient.\n // All calls that have admin privileges must be fired from within the processMessageFromRoot method that's gone\n // through validation where the sender is checked and the root (mainnet) sender is also validated.\n // This modifier sets the callValidated variable so this condition can be checked in _requireAdminSender().\n modifier validateInternalCalls() {\n // Make sure callValidated is set to True only once at beginning of processMessageFromRoot, which prevents\n // processMessageFromRoot from being re-entered.\n require(!callValidated, \"callValidated already set\");\n\n // This sets a variable indicating that we're now inside a validated call.\n // Note: this is used by other methods to ensure that this call has been validated by this method and is not\n // spoofed. See\n callValidated = true;\n\n _;\n\n // Reset callValidated to false to disallow admin calls after this method exits.\n callValidated = false;\n }\n\n /**\n * @notice Construct the Polygon SpokePool.\n * @param _polygonTokenBridger Token routing contract that sends tokens from here to HubPool. Changeable by Admin.\n * @param _crossDomainAdmin Cross domain admin to set. Can be changed by admin.\n * @param _hubPool Hub pool address to set. Can be changed by admin.\n * @param _wmaticAddress Replaces _wethAddress for this network since MATIC is the gas token and sent via msg.value\n * on Polygon.\n * @param _fxChild FxChild contract, changeable by Admin.\n * @param timerAddress Timer address to set.\n */\n constructor(\n PolygonTokenBridger _polygonTokenBridger,\n address _crossDomainAdmin,\n address _hubPool,\n address _wmaticAddress, // Note: wmatic is used here since it is the token sent via msg.value on polygon.\n address _fxChild,\n address timerAddress\n ) SpokePool(_crossDomainAdmin, _hubPool, _wmaticAddress, timerAddress) {\n polygonTokenBridger = _polygonTokenBridger;\n fxChild = _fxChild;\n }\n\n /********************************************************\n * ARBITRUM-SPECIFIC CROSS-CHAIN ADMIN FUNCTIONS *\n ********************************************************/\n\n /**\n * @notice Change FxChild address. Callable only by admin via processMessageFromRoot.\n * @param newFxChild New FxChild.\n */\n function setFxChild(address newFxChild) public onlyAdmin nonReentrant {\n fxChild = newFxChild;\n emit SetFxChild(fxChild);\n }\n\n /**\n * @notice Change polygonTokenBridger address. Callable only by admin via processMessageFromRoot.\n * @param newPolygonTokenBridger New Polygon Token Bridger contract.\n */\n function setPolygonTokenBridger(address payable newPolygonTokenBridger) public onlyAdmin nonReentrant {\n polygonTokenBridger = PolygonTokenBridger(newPolygonTokenBridger);\n emit SetPolygonTokenBridger(address(polygonTokenBridger));\n }\n\n /**\n * @notice Called by FxChild upon receiving L1 message that targets this contract. Performs an additional check\n * that the L1 caller was the expected cross domain admin, and then delegate calls.\n * @notice Polygon bridge only executes this external function on the target Polygon contract when relaying\n * messages from L1, so all functions on this SpokePool are expected to originate via this call.\n * @dev stateId value isn't used because it isn't relevant for this method. It doesn't care what state sync\n * triggered this call.\n * @param rootMessageSender Original L1 sender of data.\n * @param data ABI encoded function call to execute on this contract.\n */\n function processMessageFromRoot(\n uint256, /*stateId*/\n address rootMessageSender,\n bytes calldata data\n ) public validateInternalCalls {\n // Validation logic.\n require(msg.sender == fxChild, \"Not from fxChild\");\n require(rootMessageSender == crossDomainAdmin, \"Not from mainnet admin\");\n\n // This uses delegatecall to take the information in the message and process it as a function call on this contract.\n (bool success, ) = address(this).delegatecall(data);\n require(success, \"delegatecall failed\");\n }\n\n /**************************************\n * INTERNAL FUNCTIONS *\n **************************************/\n\n function _bridgeTokensToHubPool(RelayerRefundLeaf memory relayerRefundLeaf) internal override {\n PolygonIERC20(relayerRefundLeaf.l2TokenAddress).safeIncreaseAllowance(\n address(polygonTokenBridger),\n relayerRefundLeaf.amountToReturn\n );\n\n // Note: WETH is WMATIC on matic, so this tells the tokenbridger that this is an unwrappable native token.\n polygonTokenBridger.send(\n PolygonIERC20(relayerRefundLeaf.l2TokenAddress),\n relayerRefundLeaf.amountToReturn,\n address(weth) == relayerRefundLeaf.l2TokenAddress\n );\n\n emit PolygonTokensBridged(relayerRefundLeaf.l2TokenAddress, address(this), relayerRefundLeaf.amountToReturn);\n }\n\n // @dev: This contract will trigger admin functions internally via the `processMessageFromRoot`, which is why\n // the `callValidated` check is made below and why we use the `validateInternalCalls` modifier on\n // `processMessageFromRoot`. This prevents calling the admin functions from any other method besides\n // `processMessageFromRoot`.\n function _requireAdminSender() internal view override {\n require(callValidated, \"Must call processMessageFromRoot\");\n }\n}\n" + }, + "contracts/Optimism_SpokePool.sol": { + "content": "// SPDX-License-Identifier: GPL-3.0-only\npragma solidity ^0.8.0;\n\nimport \"./SpokePool.sol\";\nimport \"./interfaces/WETH9.sol\";\n\nimport \"@eth-optimism/contracts/libraries/bridge/CrossDomainEnabled.sol\";\nimport \"@eth-optimism/contracts/libraries/constants/Lib_PredeployAddresses.sol\";\nimport \"@eth-optimism/contracts/L2/messaging/IL2ERC20Bridge.sol\";\n\n/**\n * @notice OVM specific SpokePool. Uses OVM cross-domain-enabled logic to implement admin only access to functions.\n */\ncontract Optimism_SpokePool is CrossDomainEnabled, SpokePool {\n // \"l1Gas\" parameter used in call to bridge tokens from this contract back to L1 via IL2ERC20Bridge. Currently\n // unused by bridge but included for future compatibility.\n uint32 public l1Gas = 5_000_000;\n\n // ETH is an ERC20 on OVM.\n address public immutable l2Eth = address(Lib_PredeployAddresses.OVM_ETH);\n\n // Stores alternative token bridges to use for L2 tokens that don't go over the standard bridge. This is needed\n // to support non-standard ERC20 tokens on Optimism, such as DIA and SNX which both use custom bridges.\n mapping(address => address) public tokenBridges;\n\n event OptimismTokensBridged(address indexed l2Token, address target, uint256 numberOfTokensBridged, uint256 l1Gas);\n event SetL1Gas(uint32 indexed newL1Gas);\n event SetL2TokenBridge(address indexed l2Token, address indexed tokenBridge);\n\n /**\n * @notice Construct the OVM SpokePool.\n * @param _crossDomainAdmin Cross domain admin to set. Can be changed by admin.\n * @param _hubPool Hub pool address to set. Can be changed by admin.\n * @param timerAddress Timer address to set.\n */\n constructor(\n address _crossDomainAdmin,\n address _hubPool,\n address timerAddress\n )\n CrossDomainEnabled(Lib_PredeployAddresses.L2_CROSS_DOMAIN_MESSENGER)\n SpokePool(_crossDomainAdmin, _hubPool, 0x4200000000000000000000000000000000000006, timerAddress)\n {}\n\n /*******************************************\n * OPTIMISM-SPECIFIC ADMIN FUNCTIONS *\n *******************************************/\n\n /**\n * @notice Change L1 gas limit. Callable only by admin.\n * @param newl1Gas New L1 gas limit to set.\n */\n function setL1GasLimit(uint32 newl1Gas) public onlyAdmin nonReentrant {\n l1Gas = newl1Gas;\n emit SetL1Gas(newl1Gas);\n }\n\n /**\n * @notice Set bridge contract for L2 token used to withdraw back to L1.\n * @dev If this mapping isn't set for an L2 token, then the standard bridge will be used to bridge this token.\n * @param tokenBridge Address of token bridge\n */\n function setTokenBridge(address l2Token, address tokenBridge) public onlyAdmin nonReentrant {\n tokenBridges[l2Token] = tokenBridge;\n emit SetL2TokenBridge(l2Token, tokenBridge);\n }\n\n /**************************************\n * DATA WORKER FUNCTIONS *\n **************************************/\n\n /**\n * @notice Wraps any ETH into WETH before executing base function. This is necessary because SpokePool receives\n * ETH over the canonical token bridge instead of WETH.\n * @inheritdoc SpokePool\n */\n function executeSlowRelayRoot(\n address depositor,\n address recipient,\n address destinationToken,\n uint256 totalRelayAmount,\n uint256 originChainId,\n uint64 realizedLpFeePct,\n uint64 relayerFeePct,\n uint32 depositId,\n uint32 rootBundleId,\n bytes32[] memory proof\n ) public override(SpokePool) nonReentrant {\n if (destinationToken == address(weth)) _depositEthToWeth();\n\n _executeSlowRelayRoot(\n depositor,\n recipient,\n destinationToken,\n totalRelayAmount,\n originChainId,\n chainId(),\n realizedLpFeePct,\n relayerFeePct,\n depositId,\n rootBundleId,\n proof\n );\n }\n\n /**\n * @notice Wraps any ETH into WETH before executing base function. This is necessary because SpokePool receives\n * ETH over the canonical token bridge instead of WETH.\n * @inheritdoc SpokePool\n */\n function executeRelayerRefundRoot(\n uint32 rootBundleId,\n SpokePoolInterface.RelayerRefundLeaf memory relayerRefundLeaf,\n bytes32[] memory proof\n ) public override(SpokePool) nonReentrant {\n if (relayerRefundLeaf.l2TokenAddress == address(weth)) _depositEthToWeth();\n\n _executeRelayerRefundRoot(rootBundleId, relayerRefundLeaf, proof);\n }\n\n /**************************************\n * INTERNAL FUNCTIONS *\n **************************************/\n\n // Wrap any ETH owned by this contract so we can send expected L2 token to recipient. This is necessary because\n // this SpokePool will receive ETH from the canonical token bridge instead of WETH. Its not sufficient to execute\n // this logic inside a fallback method that executes when this contract receives ETH because ETH is an ERC20\n // on the OVM.\n function _depositEthToWeth() internal {\n if (address(this).balance > 0) weth.deposit{ value: address(this).balance }();\n }\n\n function _bridgeTokensToHubPool(RelayerRefundLeaf memory relayerRefundLeaf) internal override {\n // If the token being bridged is WETH then we need to first unwrap it to ETH and then send ETH over the\n // canonical bridge. On Optimism, this is address 0xDeadDeAddeAddEAddeadDEaDDEAdDeaDDeAD0000.\n if (relayerRefundLeaf.l2TokenAddress == address(weth)) {\n WETH9(relayerRefundLeaf.l2TokenAddress).withdraw(relayerRefundLeaf.amountToReturn); // Unwrap into ETH.\n relayerRefundLeaf.l2TokenAddress = l2Eth; // Set the l2TokenAddress to ETH.\n }\n IL2ERC20Bridge(\n tokenBridges[relayerRefundLeaf.l2TokenAddress] == address(0)\n ? Lib_PredeployAddresses.L2_STANDARD_BRIDGE\n : tokenBridges[relayerRefundLeaf.l2TokenAddress]\n ).withdrawTo(\n relayerRefundLeaf.l2TokenAddress, // _l2Token. Address of the L2 token to bridge over.\n hubPool, // _to. Withdraw, over the bridge, to the l1 pool contract.\n relayerRefundLeaf.amountToReturn, // _amount.\n l1Gas, // _l1Gas. Unused, but included for potential forward compatibility considerations\n \"\" // _data. We don't need to send any data for the bridging action.\n );\n\n emit OptimismTokensBridged(relayerRefundLeaf.l2TokenAddress, hubPool, relayerRefundLeaf.amountToReturn, l1Gas);\n }\n\n // Apply OVM-specific transformation to cross domain admin address on L1.\n function _requireAdminSender() internal override onlyFromCrossDomainAccount(crossDomainAdmin) {}\n}\n" + }, + "@eth-optimism/contracts/libraries/bridge/CrossDomainEnabled.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity >0.5.0 <0.9.0;\n\n/* Interface Imports */\nimport { ICrossDomainMessenger } from \"./ICrossDomainMessenger.sol\";\n\n/**\n * @title CrossDomainEnabled\n * @dev Helper contract for contracts performing cross-domain communications\n *\n * Compiler used: defined by inheriting contract\n */\ncontract CrossDomainEnabled {\n /*************\n * Variables *\n *************/\n\n // Messenger contract used to send and recieve messages from the other domain.\n address public messenger;\n\n /***************\n * Constructor *\n ***************/\n\n /**\n * @param _messenger Address of the CrossDomainMessenger on the current layer.\n */\n constructor(address _messenger) {\n messenger = _messenger;\n }\n\n /**********************\n * Function Modifiers *\n **********************/\n\n /**\n * Enforces that the modified function is only callable by a specific cross-domain account.\n * @param _sourceDomainAccount The only account on the originating domain which is\n * authenticated to call this function.\n */\n modifier onlyFromCrossDomainAccount(address _sourceDomainAccount) {\n require(\n msg.sender == address(getCrossDomainMessenger()),\n \"OVM_XCHAIN: messenger contract unauthenticated\"\n );\n\n require(\n getCrossDomainMessenger().xDomainMessageSender() == _sourceDomainAccount,\n \"OVM_XCHAIN: wrong sender of cross-domain message\"\n );\n\n _;\n }\n\n /**********************\n * Internal Functions *\n **********************/\n\n /**\n * Gets the messenger, usually from storage. This function is exposed in case a child contract\n * needs to override.\n * @return The address of the cross-domain messenger contract which should be used.\n */\n function getCrossDomainMessenger() internal virtual returns (ICrossDomainMessenger) {\n return ICrossDomainMessenger(messenger);\n }\n\n /**q\n * Sends a message to an account on another domain\n * @param _crossDomainTarget The intended recipient on the destination domain\n * @param _message The data to send to the target (usually calldata to a function with\n * `onlyFromCrossDomainAccount()`)\n * @param _gasLimit The gasLimit for the receipt of the message on the target domain.\n */\n function sendCrossDomainMessage(\n address _crossDomainTarget,\n uint32 _gasLimit,\n bytes memory _message\n ) internal {\n // slither-disable-next-line reentrancy-events, reentrancy-benign\n getCrossDomainMessenger().sendMessage(_crossDomainTarget, _message, _gasLimit);\n }\n}\n" + }, + "@eth-optimism/contracts/libraries/constants/Lib_PredeployAddresses.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.9;\n\n/**\n * @title Lib_PredeployAddresses\n */\nlibrary Lib_PredeployAddresses {\n address internal constant L2_TO_L1_MESSAGE_PASSER = 0x4200000000000000000000000000000000000000;\n address internal constant L1_MESSAGE_SENDER = 0x4200000000000000000000000000000000000001;\n address internal constant DEPLOYER_WHITELIST = 0x4200000000000000000000000000000000000002;\n address payable internal constant OVM_ETH = payable(0xDeadDeAddeAddEAddeadDEaDDEAdDeaDDeAD0000);\n address internal constant L2_CROSS_DOMAIN_MESSENGER =\n 0x4200000000000000000000000000000000000007;\n address internal constant LIB_ADDRESS_MANAGER = 0x4200000000000000000000000000000000000008;\n address internal constant PROXY_EOA = 0x4200000000000000000000000000000000000009;\n address internal constant L2_STANDARD_BRIDGE = 0x4200000000000000000000000000000000000010;\n address internal constant SEQUENCER_FEE_WALLET = 0x4200000000000000000000000000000000000011;\n address internal constant L2_STANDARD_TOKEN_FACTORY =\n 0x4200000000000000000000000000000000000012;\n address internal constant L1_BLOCK_NUMBER = 0x4200000000000000000000000000000000000013;\n}\n" + }, + "@eth-optimism/contracts/L2/messaging/IL2ERC20Bridge.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.9;\n\n/**\n * @title IL2ERC20Bridge\n */\ninterface IL2ERC20Bridge {\n /**********\n * Events *\n **********/\n\n event WithdrawalInitiated(\n address indexed _l1Token,\n address indexed _l2Token,\n address indexed _from,\n address _to,\n uint256 _amount,\n bytes _data\n );\n\n event DepositFinalized(\n address indexed _l1Token,\n address indexed _l2Token,\n address indexed _from,\n address _to,\n uint256 _amount,\n bytes _data\n );\n\n event DepositFailed(\n address indexed _l1Token,\n address indexed _l2Token,\n address indexed _from,\n address _to,\n uint256 _amount,\n bytes _data\n );\n\n /********************\n * Public Functions *\n ********************/\n\n /**\n * @dev get the address of the corresponding L1 bridge contract.\n * @return Address of the corresponding L1 bridge contract.\n */\n function l1TokenBridge() external returns (address);\n\n /**\n * @dev initiate a withdraw of some tokens to the caller's account on L1\n * @param _l2Token Address of L2 token where withdrawal was initiated.\n * @param _amount Amount of the token to withdraw.\n * param _l1Gas Unused, but included for potential forward compatibility considerations.\n * @param _data Optional data to forward to L1. This data is provided\n * solely as a convenience for external contracts. Aside from enforcing a maximum\n * length, these contracts provide no guarantees about its content.\n */\n function withdraw(\n address _l2Token,\n uint256 _amount,\n uint32 _l1Gas,\n bytes calldata _data\n ) external;\n\n /**\n * @dev initiate a withdraw of some token to a recipient's account on L1.\n * @param _l2Token Address of L2 token where withdrawal is initiated.\n * @param _to L1 adress to credit the withdrawal to.\n * @param _amount Amount of the token to withdraw.\n * param _l1Gas Unused, but included for potential forward compatibility considerations.\n * @param _data Optional data to forward to L1. This data is provided\n * solely as a convenience for external contracts. Aside from enforcing a maximum\n * length, these contracts provide no guarantees about its content.\n */\n function withdrawTo(\n address _l2Token,\n address _to,\n uint256 _amount,\n uint32 _l1Gas,\n bytes calldata _data\n ) external;\n\n /*************************\n * Cross-chain Functions *\n *************************/\n\n /**\n * @dev Complete a deposit from L1 to L2, and credits funds to the recipient's balance of this\n * L2 token. This call will fail if it did not originate from a corresponding deposit in\n * L1StandardTokenBridge.\n * @param _l1Token Address for the l1 token this is called with\n * @param _l2Token Address for the l2 token this is called with\n * @param _from Account to pull the deposit from on L2.\n * @param _to Address to receive the withdrawal at\n * @param _amount Amount of the token to withdraw\n * @param _data Data provider by the sender on L1. This data is provided\n * solely as a convenience for external contracts. Aside from enforcing a maximum\n * length, these contracts provide no guarantees about its content.\n */\n function finalizeDeposit(\n address _l1Token,\n address _l2Token,\n address _from,\n address _to,\n uint256 _amount,\n bytes calldata _data\n ) external;\n}\n" + }, + "@eth-optimism/contracts/libraries/bridge/ICrossDomainMessenger.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity >0.5.0 <0.9.0;\n\n/**\n * @title ICrossDomainMessenger\n */\ninterface ICrossDomainMessenger {\n /**********\n * Events *\n **********/\n\n event SentMessage(\n address indexed target,\n address sender,\n bytes message,\n uint256 messageNonce,\n uint256 gasLimit\n );\n event RelayedMessage(bytes32 indexed msgHash);\n event FailedRelayedMessage(bytes32 indexed msgHash);\n\n /*************\n * Variables *\n *************/\n\n function xDomainMessageSender() external view returns (address);\n\n /********************\n * Public Functions *\n ********************/\n\n /**\n * Sends a cross domain message to the target messenger.\n * @param _target Target contract address.\n * @param _message Message to send to the target.\n * @param _gasLimit Gas limit for the provided message.\n */\n function sendMessage(\n address _target,\n bytes calldata _message,\n uint32 _gasLimit\n ) external;\n}\n" + }, + "contracts/chain-adapters/CrossDomainEnabled.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity >0.5.0 <0.9.0;\n\n/* Interface Imports */\nimport { ICrossDomainMessenger } from \"@eth-optimism/contracts/libraries/bridge/ICrossDomainMessenger.sol\";\n\n/**\n * @title CrossDomainEnabled\n * @dev Helper contract for contracts performing cross-domain communications between L1 and Optimism.\n * @dev This modifies the eth-optimism/CrossDomainEnabled contract only by changing state variables to be\n * immutable for use in contracts like the Optimism_Adapter which use delegateCall().\n */\ncontract CrossDomainEnabled {\n // Messenger contract used to send and recieve messages from the other domain.\n address public immutable messenger;\n\n /**\n * @param _messenger Address of the CrossDomainMessenger on the current layer.\n */\n constructor(address _messenger) {\n messenger = _messenger;\n }\n\n /**\n * Enforces that the modified function is only callable by a specific cross-domain account.\n * @param _sourceDomainAccount The only account on the originating domain which is\n * authenticated to call this function.\n */\n modifier onlyFromCrossDomainAccount(address _sourceDomainAccount) {\n require(msg.sender == address(getCrossDomainMessenger()), \"OVM_XCHAIN: messenger contract unauthenticated\");\n\n require(\n getCrossDomainMessenger().xDomainMessageSender() == _sourceDomainAccount,\n \"OVM_XCHAIN: wrong sender of cross-domain message\"\n );\n\n _;\n }\n\n /**\n * Gets the messenger, usually from storage. This function is exposed in case a child contract\n * needs to override.\n * @return The address of the cross-domain messenger contract which should be used.\n */\n function getCrossDomainMessenger() internal virtual returns (ICrossDomainMessenger) {\n return ICrossDomainMessenger(messenger);\n }\n\n /**\n * Sends a message to an account on another domain\n * @param _crossDomainTarget The intended recipient on the destination domain\n * @param _message The data to send to the target (usually calldata to a function with\n * onlyFromCrossDomainAccount())\n * @param _gasLimit The gasLimit for the receipt of the message on the target domain.\n */\n function sendCrossDomainMessage(\n address _crossDomainTarget,\n uint32 _gasLimit,\n bytes memory _message\n ) internal {\n // slither-disable-next-line reentrancy-events, reentrancy-benign\n getCrossDomainMessenger().sendMessage(_crossDomainTarget, _message, _gasLimit);\n }\n}\n" + }, + "contracts/chain-adapters/Optimism_Adapter.sol": { + "content": "// SPDX-License-Identifier: AGPL-3.0-only\npragma solidity ^0.8.0;\n\nimport \"../interfaces/AdapterInterface.sol\";\nimport \"../interfaces/WETH9.sol\";\n\n// @dev Use local modified CrossDomainEnabled contract instead of one exported by eth-optimism because we need\n// this contract's state variables to be `immutable` because of the delegateCall call.\nimport \"./CrossDomainEnabled.sol\";\nimport \"@eth-optimism/contracts/L1/messaging/IL1StandardBridge.sol\";\n\nimport \"@openzeppelin/contracts/token/ERC20/IERC20.sol\";\nimport \"@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol\";\n\n/**\n * @notice Contract containing logic to send messages from L1 to Optimism.\n * @dev Public functions calling external contracts do not guard against reentrancy because they are expected to be\n * called via delegatecall, which will execute this contract's logic within the context of the originating contract.\n * For example, the HubPool will delegatecall these functions, therefore its only necessary that the HubPool's methods\n * that call this contract's logic guard against reentrancy.\n */\ncontract Optimism_Adapter is CrossDomainEnabled, AdapterInterface {\n using SafeERC20 for IERC20;\n uint32 public immutable l2GasLimit = 5_000_000;\n\n WETH9 public immutable l1Weth;\n\n IL1StandardBridge public immutable l1StandardBridge;\n\n // Optimism has the ability to support \"custom\" bridges. These bridges are not supported by the canonical bridge\n // and so we need to store the address of the custom token and the associated bridge. In the event we want to\n // support a new token that is not supported by Optimism, we can add a new custom bridge for it and re-deploy the\n // adapter. A full list of custom optimism tokens and their associated bridges can be found here:\n // https://github.com/ethereum-optimism/ethereum-optimism.github.io/blob/master/optimism.tokenlist.json\n address public immutable dai = 0x6B175474E89094C44Da98b954EedeAC495271d0F;\n address public immutable daiOptimismBridge = 0x10E6593CDda8c58a1d0f14C5164B376352a55f2F;\n address public immutable snx = 0xC011a73ee8576Fb46F5E1c5751cA3B9Fe0af2a6F;\n address public immutable snxOptimismBridge = 0xCd9D4988C0AE61887B075bA77f08cbFAd2b65068;\n\n /**\n * @notice Constructs new Adapter.\n * @param _l1Weth WETH address on L1.\n * @param _crossDomainMessenger XDomainMessenger Optimism system contract.\n * @param _l1StandardBridge Standard bridge contract.\n */\n constructor(\n WETH9 _l1Weth,\n address _crossDomainMessenger,\n IL1StandardBridge _l1StandardBridge\n ) CrossDomainEnabled(_crossDomainMessenger) {\n l1Weth = _l1Weth;\n l1StandardBridge = _l1StandardBridge;\n }\n\n /**\n * @notice Send cross-chain message to target on Optimism.\n * @param target Contract on Optimism that will receive message.\n * @param message Data to send to target.\n */\n function relayMessage(address target, bytes memory message) external payable override {\n sendCrossDomainMessage(target, uint32(l2GasLimit), message);\n emit MessageRelayed(target, message);\n }\n\n /**\n * @notice Bridge tokens to Optimism.\n * @param l1Token L1 token to deposit.\n * @param l2Token L2 token to receive.\n * @param amount Amount of L1 tokens to deposit and L2 tokens to receive.\n * @param to Bridge recipient.\n */\n function relayTokens(\n address l1Token,\n address l2Token,\n uint256 amount,\n address to\n ) external payable override {\n // If the l1Token is weth then unwrap it to ETH then send the ETH to the standard bridge.\n if (l1Token == address(l1Weth)) {\n l1Weth.withdraw(amount);\n l1StandardBridge.depositETHTo{ value: amount }(to, l2GasLimit, \"\");\n } else {\n IL1StandardBridge _l1StandardBridge = l1StandardBridge;\n\n // Check if the L1 token requires a custom bridge. If so, use that bridge over the standard bridge.\n if (l1Token == dai) _l1StandardBridge = IL1StandardBridge(daiOptimismBridge); // 1. DAI\n if (l1Token == snx) _l1StandardBridge = IL1StandardBridge(snxOptimismBridge); // 2. SNX\n\n IERC20(l1Token).safeIncreaseAllowance(address(_l1StandardBridge), amount);\n _l1StandardBridge.depositERC20To(l1Token, l2Token, to, amount, l2GasLimit, \"\");\n }\n emit TokensRelayed(l1Token, l2Token, amount, to);\n }\n}\n" + }, + "@eth-optimism/contracts/L1/messaging/IL1StandardBridge.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity >0.5.0 <0.9.0;\n\nimport \"./IL1ERC20Bridge.sol\";\n\n/**\n * @title IL1StandardBridge\n */\ninterface IL1StandardBridge is IL1ERC20Bridge {\n /**********\n * Events *\n **********/\n event ETHDepositInitiated(\n address indexed _from,\n address indexed _to,\n uint256 _amount,\n bytes _data\n );\n\n event ETHWithdrawalFinalized(\n address indexed _from,\n address indexed _to,\n uint256 _amount,\n bytes _data\n );\n\n /********************\n * Public Functions *\n ********************/\n\n /**\n * @dev Deposit an amount of the ETH to the caller's balance on L2.\n * @param _l2Gas Gas limit required to complete the deposit on L2.\n * @param _data Optional data to forward to L2. This data is provided\n * solely as a convenience for external contracts. Aside from enforcing a maximum\n * length, these contracts provide no guarantees about its content.\n */\n function depositETH(uint32 _l2Gas, bytes calldata _data) external payable;\n\n /**\n * @dev Deposit an amount of ETH to a recipient's balance on L2.\n * @param _to L2 address to credit the withdrawal to.\n * @param _l2Gas Gas limit required to complete the deposit on L2.\n * @param _data Optional data to forward to L2. This data is provided\n * solely as a convenience for external contracts. Aside from enforcing a maximum\n * length, these contracts provide no guarantees about its content.\n */\n function depositETHTo(\n address _to,\n uint32 _l2Gas,\n bytes calldata _data\n ) external payable;\n\n /*************************\n * Cross-chain Functions *\n *************************/\n\n /**\n * @dev Complete a withdrawal from L2 to L1, and credit funds to the recipient's balance of the\n * L1 ETH token. Since only the xDomainMessenger can call this function, it will never be called\n * before the withdrawal is finalized.\n * @param _from L2 address initiating the transfer.\n * @param _to L1 address to credit the withdrawal to.\n * @param _amount Amount of the ERC20 to deposit.\n * @param _data Optional data to forward to L2. This data is provided\n * solely as a convenience for external contracts. Aside from enforcing a maximum\n * length, these contracts provide no guarantees about its content.\n */\n function finalizeETHWithdrawal(\n address _from,\n address _to,\n uint256 _amount,\n bytes calldata _data\n ) external;\n}\n" + }, + "@eth-optimism/contracts/L1/messaging/IL1ERC20Bridge.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity >0.5.0 <0.9.0;\n\n/**\n * @title IL1ERC20Bridge\n */\ninterface IL1ERC20Bridge {\n /**********\n * Events *\n **********/\n\n event ERC20DepositInitiated(\n address indexed _l1Token,\n address indexed _l2Token,\n address indexed _from,\n address _to,\n uint256 _amount,\n bytes _data\n );\n\n event ERC20WithdrawalFinalized(\n address indexed _l1Token,\n address indexed _l2Token,\n address indexed _from,\n address _to,\n uint256 _amount,\n bytes _data\n );\n\n /********************\n * Public Functions *\n ********************/\n\n /**\n * @dev get the address of the corresponding L2 bridge contract.\n * @return Address of the corresponding L2 bridge contract.\n */\n function l2TokenBridge() external returns (address);\n\n /**\n * @dev deposit an amount of the ERC20 to the caller's balance on L2.\n * @param _l1Token Address of the L1 ERC20 we are depositing\n * @param _l2Token Address of the L1 respective L2 ERC20\n * @param _amount Amount of the ERC20 to deposit\n * @param _l2Gas Gas limit required to complete the deposit on L2.\n * @param _data Optional data to forward to L2. This data is provided\n * solely as a convenience for external contracts. Aside from enforcing a maximum\n * length, these contracts provide no guarantees about its content.\n */\n function depositERC20(\n address _l1Token,\n address _l2Token,\n uint256 _amount,\n uint32 _l2Gas,\n bytes calldata _data\n ) external;\n\n /**\n * @dev deposit an amount of ERC20 to a recipient's balance on L2.\n * @param _l1Token Address of the L1 ERC20 we are depositing\n * @param _l2Token Address of the L1 respective L2 ERC20\n * @param _to L2 address to credit the withdrawal to.\n * @param _amount Amount of the ERC20 to deposit.\n * @param _l2Gas Gas limit required to complete the deposit on L2.\n * @param _data Optional data to forward to L2. This data is provided\n * solely as a convenience for external contracts. Aside from enforcing a maximum\n * length, these contracts provide no guarantees about its content.\n */\n function depositERC20To(\n address _l1Token,\n address _l2Token,\n address _to,\n uint256 _amount,\n uint32 _l2Gas,\n bytes calldata _data\n ) external;\n\n /*************************\n * Cross-chain Functions *\n *************************/\n\n /**\n * @dev Complete a withdrawal from L2 to L1, and credit funds to the recipient's balance of the\n * L1 ERC20 token.\n * This call will fail if the initialized withdrawal from L2 has not been finalized.\n *\n * @param _l1Token Address of L1 token to finalizeWithdrawal for.\n * @param _l2Token Address of L2 token where withdrawal was initiated.\n * @param _from L2 address initiating the transfer.\n * @param _to L1 address to credit the withdrawal to.\n * @param _amount Amount of the ERC20 to deposit.\n * @param _data Data provided by the sender on L2. This data is provided\n * solely as a convenience for external contracts. Aside from enforcing a maximum\n * length, these contracts provide no guarantees about its content.\n */\n function finalizeERC20Withdrawal(\n address _l1Token,\n address _l2Token,\n address _from,\n address _to,\n uint256 _amount,\n bytes calldata _data\n ) external;\n}\n" + }, + "contracts/chain-adapters/Polygon_Adapter.sol": { + "content": "// SPDX-License-Identifier: AGPL-3.0-only\npragma solidity ^0.8.0;\n\nimport \"../interfaces/AdapterInterface.sol\";\nimport \"../interfaces/WETH9.sol\";\n\nimport \"@openzeppelin/contracts/token/ERC20/IERC20.sol\";\nimport \"@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol\";\n\ninterface IRootChainManager {\n function depositEtherFor(address user) external payable;\n\n function depositFor(\n address user,\n address rootToken,\n bytes calldata depositData\n ) external;\n}\n\ninterface IFxStateSender {\n function sendMessageToChild(address _receiver, bytes calldata _data) external;\n}\n\n/**\n * @notice Sends cross chain messages Polygon L2 network.\n * @dev Public functions calling external contracts do not guard against reentrancy because they are expected to be\n * called via delegatecall, which will execute this contract's logic within the context of the originating contract.\n * For example, the HubPool will delegatecall these functions, therefore its only necessary that the HubPool's methods\n * that call this contract's logic guard against reentrancy.\n */\ncontract Polygon_Adapter is AdapterInterface {\n using SafeERC20 for IERC20;\n IRootChainManager public immutable rootChainManager;\n IFxStateSender public immutable fxStateSender;\n WETH9 public immutable l1Weth;\n\n /**\n * @notice Constructs new Adapter.\n * @param _rootChainManager RootChainManager Polygon system helper contract.\n * @param _fxStateSender FxStateSender Polygon system helper contract.\n * @param _l1Weth WETH address on L1.\n */\n constructor(\n IRootChainManager _rootChainManager,\n IFxStateSender _fxStateSender,\n WETH9 _l1Weth\n ) {\n rootChainManager = _rootChainManager;\n fxStateSender = _fxStateSender;\n l1Weth = _l1Weth;\n }\n\n /**\n * @notice Send cross-chain message to target on Polygon.\n * @param target Contract on Polygon that will receive message.\n * @param message Data to send to target.\n */\n\n function relayMessage(address target, bytes memory message) external payable override {\n fxStateSender.sendMessageToChild(target, message);\n emit MessageRelayed(target, message);\n }\n\n /**\n * @notice Bridge tokens to Polygon.\n * @param l1Token L1 token to deposit.\n * @param l2Token L2 token to receive.\n * @param amount Amount of L1 tokens to deposit and L2 tokens to receive.\n * @param to Bridge recipient.\n */\n function relayTokens(\n address l1Token,\n address l2Token,\n uint256 amount,\n address to\n ) external payable override {\n // If the l1Token is weth then unwrap it to ETH then send the ETH to the standard bridge.\n if (l1Token == address(l1Weth)) {\n l1Weth.withdraw(amount);\n rootChainManager.depositEtherFor{ value: amount }(to);\n } else {\n IERC20(l1Token).safeIncreaseAllowance(address(rootChainManager), amount);\n rootChainManager.depositFor(to, l1Token, abi.encode(amount));\n }\n emit TokensRelayed(l1Token, l2Token, amount, to);\n }\n}\n" + }, + "contracts/chain-adapters/Mock_Adapter.sol": { + "content": "// SPDX-License-Identifier: AGPL-3.0-only\npragma solidity ^0.8.0;\n\nimport \"../interfaces/AdapterInterface.sol\";\nimport \"@openzeppelin/contracts/token/ERC20/IERC20.sol\";\n\n/**\n * @notice Contract used for testing communication between HubPool and Adapter.\n */\ncontract Mock_Adapter is AdapterInterface {\n event RelayMessageCalled(address target, bytes message, address caller);\n\n event RelayTokensCalled(address l1Token, address l2Token, uint256 amount, address to, address caller);\n\n Mock_Bridge public immutable bridge;\n\n constructor() {\n bridge = new Mock_Bridge();\n }\n\n function relayMessage(address target, bytes memory message) external payable override {\n bridge.bridgeMessage(target, message);\n emit RelayMessageCalled(target, message, msg.sender);\n }\n\n function relayTokens(\n address l1Token,\n address l2Token,\n uint256 amount,\n address to\n ) external payable override {\n IERC20(l1Token).approve(address(bridge), amount);\n bridge.bridgeTokens(l1Token, amount);\n emit RelayTokensCalled(l1Token, l2Token, amount, to, msg.sender);\n }\n}\n\n// This contract is intended to \"act like\" a simple version of an L2 bridge.\n// It's primarily meant to better reflect how a true L2 bridge interaction might work to give better gas estimates.\ncontract Mock_Bridge {\n event BridgedTokens(address token, uint256 amount);\n event BridgedMessage(address target, bytes message);\n\n mapping(address => uint256) deposits;\n\n function bridgeTokens(address token, uint256 amount) public {\n IERC20(token).transferFrom(msg.sender, address(this), amount);\n deposits[token] += amount;\n emit BridgedTokens(token, amount);\n }\n\n function bridgeMessage(address target, bytes memory message) public {\n emit BridgedMessage(target, message);\n }\n}\n" + }, + "contracts/chain-adapters/Ethereum_Adapter.sol": { + "content": "// SPDX-License-Identifier: AGPL-3.0-only\npragma solidity ^0.8.0;\n\nimport \"../interfaces/AdapterInterface.sol\";\n\nimport \"@openzeppelin/contracts/token/ERC20/IERC20.sol\";\nimport \"@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol\";\n\n/**\n * @notice Contract containing logic to send messages from L1 to Ethereum SpokePool.\n * @notice This contract should always be deployed on the same chain as the HubPool, as it acts as a pass-through\n * contract between HubPool and SpokePool on the same chain. Its named \"Ethereum_Adapter\" because a core assumption\n * is that the HubPool will be deployed on Ethereum, so this adapter will be used to communicate between HubPool\n * and the Ethereum_SpokePool.\n * @dev Public functions calling external contracts do not guard against reentrancy because they are expected to be\n * called via delegatecall, which will execute this contract's logic within the context of the originating contract.\n * For example, the HubPool will delegatecall these functions, therefore its only necessary that the HubPool's methods\n * that call this contract's logic guard against reentrancy.\n */\ncontract Ethereum_Adapter is AdapterInterface {\n using SafeERC20 for IERC20;\n\n /**\n * @notice Send message to target on Ethereum.\n * @notice This function, and contract overall, is not useful in practice except that the HubPool\n * expects to interact with the SpokePool via an Adapter, so when communicating to the Ethereum_SpokePool, it must\n * send messages via this pass-through contract.\n * @param target Contract that will receive message.\n * @param message Data to send to target.\n */\n function relayMessage(address target, bytes memory message) external payable override {\n _executeCall(target, message);\n emit MessageRelayed(target, message);\n }\n\n /**\n * @notice Send tokens to target.\n * @param l1Token L1 token to send.\n * @param l2Token Unused parameter in this contract.\n * @param amount Amount of L1 tokens to send.\n * @param to recipient.\n */\n function relayTokens(\n address l1Token,\n address l2Token, // l2Token is unused for ethereum since we are assuming that the HubPool is only deployed\n // on this network.\n uint256 amount,\n address to\n ) external payable override {\n IERC20(l1Token).safeTransfer(to, amount);\n emit TokensRelayed(l1Token, l2Token, amount, to);\n }\n\n // Note: this snippet of code is copied from Governor.sol. Source: https://github.com/UMAprotocol/protocol/blob/5b37ea818a28479c01e458389a83c3e736306b17/packages/core/contracts/oracle/implementation/Governor.sol#L190-L207\n function _executeCall(address to, bytes memory data) private {\n // Note: this snippet of code is copied from Governor.sol and modified to not include any \"value\" field.\n // solhint-disable-next-line no-inline-assembly\n\n bool success;\n assembly {\n let inputData := add(data, 0x20)\n let inputDataSize := mload(data)\n // Hardcode value to be 0 for relayed governance calls in order to avoid addressing complexity of bridging\n // value cross-chain.\n success := call(gas(), to, 0, inputData, inputDataSize, 0, 0)\n }\n require(success, \"execute call failed\");\n }\n}\n" + }, + "contracts/chain-adapters/Arbitrum_Adapter.sol": { + "content": "// SPDX-License-Identifier: AGPL-3.0-only\npragma solidity ^0.8.0;\n\nimport \"../interfaces/AdapterInterface.sol\";\n\ninterface ArbitrumL1InboxLike {\n function createRetryableTicket(\n address destAddr,\n uint256 arbTxCallValue,\n uint256 maxSubmissionCost,\n address submissionRefundAddress,\n address valueRefundAddress,\n uint256 maxGas,\n uint256 gasPriceBid,\n bytes calldata data\n ) external payable returns (uint256);\n}\n\ninterface ArbitrumL1ERC20GatewayLike {\n function outboundTransfer(\n address _token,\n address _to,\n uint256 _amount,\n uint256 _maxGas,\n uint256 _gasPriceBid,\n bytes calldata _data\n ) external payable returns (bytes memory);\n}\n\n/**\n * @notice Contract containing logic to send messages from L1 to Arbitrum.\n * @dev Public functions calling external contracts do not guard against reentrancy because they are expected to be\n * called via delegatecall, which will execute this contract's logic within the context of the originating contract.\n * For example, the HubPool will delegatecall these functions, therefore its only necessary that the HubPool's methods\n * that call this contract's logic guard against reentrancy.\n */\ncontract Arbitrum_Adapter is AdapterInterface {\n // Gas limit for immediate L2 execution attempt (can be estimated via NodeInterface.estimateRetryableTicket).\n // NodeInterface precompile interface exists at L2 address 0x00000000000000000000000000000000000000C8\n uint32 public immutable l2GasLimit = 5_000_000;\n\n // Amount of ETH allocated to pay for the base submission fee. The base submission fee is a parameter unique to\n // retryable transactions; the user is charged the base submission fee to cover the storage costs of keeping their\n // ticket’s calldata in the retry buffer. (current base submission fee is queryable via\n // ArbRetryableTx.getSubmissionPrice). ArbRetryableTicket precompile interface exists at L2 address\n // 0x000000000000000000000000000000000000006E.\n uint256 public immutable l2MaxSubmissionCost = 0.1e18;\n\n // L2 Gas price bid for immediate L2 execution attempt (queryable via standard eth*gasPrice RPC)\n uint256 public immutable l2GasPrice = 10e9; // 10 gWei\n\n // This address on L2 receives extra ETH that is left over after relaying a message via the inbox.\n address public immutable l2RefundL2Address;\n\n ArbitrumL1InboxLike public immutable l1Inbox;\n\n ArbitrumL1ERC20GatewayLike public immutable l1ERC20Gateway;\n\n /**\n * @notice Constructs new Adapter.\n * @param _l1ArbitrumInbox Inbox helper contract to send messages to Arbitrum.\n * @param _l1ERC20Gateway ERC20 gateway contract to send tokens to Arbitrum.\n */\n constructor(ArbitrumL1InboxLike _l1ArbitrumInbox, ArbitrumL1ERC20GatewayLike _l1ERC20Gateway) {\n l1Inbox = _l1ArbitrumInbox;\n l1ERC20Gateway = _l1ERC20Gateway;\n\n l2RefundL2Address = msg.sender;\n }\n\n /**\n * @notice Send cross-chain message to target on Arbitrum.\n * @notice This contract must hold at least getL1CallValue() amount of ETH to send a message via the Inbox\n * successfully, or the message will get stuck.\n * @param target Contract on Arbitrum that will receive message.\n * @param message Data to send to target.\n */\n function relayMessage(address target, bytes memory message) external payable override {\n uint256 requiredL1CallValue = getL1CallValue();\n require(address(this).balance >= requiredL1CallValue, \"Insufficient ETH balance\");\n\n l1Inbox.createRetryableTicket{ value: requiredL1CallValue }(\n target, // destAddr destination L2 contract address\n 0, // l2CallValue call value for retryable L2 message\n l2MaxSubmissionCost, // maxSubmissionCost Max gas deducted from user's L2 balance to cover base fee\n l2RefundL2Address, // excessFeeRefundAddress maxgas * gasprice - execution cost gets credited here on L2\n l2RefundL2Address, // callValueRefundAddress l2Callvalue gets credited here on L2 if retryable txn times out or gets cancelled\n l2GasLimit, // maxGas Max gas deducted from user's L2 balance to cover L2 execution\n l2GasPrice, // gasPriceBid price bid for L2 execution\n message // data ABI encoded data of L2 message\n );\n\n emit MessageRelayed(target, message);\n }\n\n /**\n * @notice Bridge tokens to Arbitrum.\n * @param l1Token L1 token to deposit.\n * @param l2Token L2 token to receive.\n * @param amount Amount of L1 tokens to deposit and L2 tokens to receive.\n * @param to Bridge recipient.\n */\n function relayTokens(\n address l1Token,\n address l2Token, // l2Token is unused for Arbitrum.\n uint256 amount,\n address to\n ) external payable override {\n l1ERC20Gateway.outboundTransfer(l1Token, to, amount, l2GasLimit, l2GasPrice, \"\");\n emit TokensRelayed(l1Token, l2Token, amount, to);\n }\n\n /**\n * @notice Returns required amount of ETH to send a message via the Inbox.\n * @return amount of ETH that this contract needs to hold in order for relayMessage to succeed.\n */\n function getL1CallValue() public pure returns (uint256) {\n return l2MaxSubmissionCost + l2GasPrice * l2GasLimit;\n }\n}\n" + }, + "@openzeppelin/contracts/access/Ownable.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts v4.4.1 (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 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 called by any account other than the owner.\n */\n modifier onlyOwner() {\n require(owner() == _msgSender(), \"Ownable: caller is not the owner\");\n _;\n }\n\n /**\n * @dev Leaves the contract without owner. It will not be possible to call\n * `onlyOwner` functions anymore. Can only be called by the current owner.\n *\n * NOTE: Renouncing ownership will leave the contract without an owner,\n * thereby removing 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" + }, + "contracts/Ethereum_SpokePool.sol": { + "content": "// SPDX-License-Identifier: GPL-3.0-only\npragma solidity ^0.8.0;\n\nimport \"./SpokePool.sol\";\nimport \"@openzeppelin/contracts/access/Ownable.sol\";\n\n/**\n * @notice Ethereum L1 specific SpokePool. Used on Ethereum L1 to facilitate L2->L1 transfers.\n */\ncontract Ethereum_SpokePool is SpokePool, Ownable {\n /**\n * @notice Construct the Ethereum SpokePool.\n * @param _hubPool Hub pool address to set. Can be changed by admin.\n * @param _wethAddress Weth address for this network to set.\n * @param timerAddress Timer address to set.\n */\n constructor(\n address _hubPool,\n address _wethAddress,\n address timerAddress\n ) SpokePool(msg.sender, _hubPool, _wethAddress, timerAddress) {}\n\n /**************************************\n * INTERNAL FUNCTIONS *\n **************************************/\n\n function _bridgeTokensToHubPool(RelayerRefundLeaf memory relayerRefundLeaf) internal override {\n IERC20(relayerRefundLeaf.l2TokenAddress).transfer(hubPool, relayerRefundLeaf.amountToReturn);\n }\n\n // Admin is simply owner which should be same account that owns the HubPool deployed on this network. A core\n // assumption of this contract system is that the HubPool is deployed on Ethereum.\n function _requireAdminSender() internal override onlyOwner {}\n}\n" + }, + "@uma/core/contracts/oracle/interfaces/OptimisticOracleInterface.sol": { + "content": "// SPDX-License-Identifier: AGPL-3.0-only\npragma solidity ^0.8.0;\n\nimport \"@openzeppelin/contracts/token/ERC20/IERC20.sol\";\n\n/**\n * @title Financial contract facing Oracle interface.\n * @dev Interface used by financial contracts to interact with the Oracle. Voters will use a different interface.\n */\nabstract contract OptimisticOracleInterface {\n // Struct representing the state of a price request.\n enum State {\n Invalid, // Never requested.\n Requested, // Requested, no other actions taken.\n Proposed, // Proposed, but not expired or disputed yet.\n Expired, // Proposed, not disputed, past liveness.\n Disputed, // Disputed, but no DVM price returned yet.\n Resolved, // Disputed and DVM price is available.\n Settled // Final price has been set in the contract (can get here from Expired or Resolved).\n }\n\n // Struct representing a price request.\n struct Request {\n address proposer; // Address of the proposer.\n address disputer; // Address of the disputer.\n IERC20 currency; // ERC20 token used to pay rewards and fees.\n bool settled; // True if the request is settled.\n bool refundOnDispute; // True if the requester should be refunded their reward on dispute.\n int256 proposedPrice; // Price that the proposer submitted.\n int256 resolvedPrice; // Price resolved once the request is settled.\n uint256 expirationTime; // Time at which the request auto-settles without a dispute.\n uint256 reward; // Amount of the currency to pay to the proposer on settlement.\n uint256 finalFee; // Final fee to pay to the Store upon request to the DVM.\n uint256 bond; // Bond that the proposer and disputer must pay on top of the final fee.\n uint256 customLiveness; // Custom liveness value set by the requester.\n }\n\n // This value must be <= the Voting contract's `ancillaryBytesLimit` value otherwise it is possible\n // that a price can be requested to this contract successfully, but cannot be disputed because the DVM refuses\n // to accept a price request made with ancillary data length over a certain size.\n uint256 public constant ancillaryBytesLimit = 8192;\n\n /**\n * @notice Requests a new price.\n * @param identifier price identifier being requested.\n * @param timestamp timestamp of the price being requested.\n * @param ancillaryData ancillary data representing additional args being passed with the price request.\n * @param currency ERC20 token used for payment of rewards and fees. Must be approved for use with the DVM.\n * @param reward reward offered to a successful proposer. Will be pulled from the caller. Note: this can be 0,\n * which could make sense if the contract requests and proposes the value in the same call or\n * provides its own reward system.\n * @return totalBond default bond (final fee) + final fee that the proposer and disputer will be required to pay.\n * This can be changed with a subsequent call to setBond().\n */\n function requestPrice(\n bytes32 identifier,\n uint256 timestamp,\n bytes memory ancillaryData,\n IERC20 currency,\n uint256 reward\n ) external virtual returns (uint256 totalBond);\n\n /**\n * @notice Set the proposal bond associated with a price request.\n * @param identifier price identifier to identify the existing request.\n * @param timestamp timestamp to identify the existing request.\n * @param ancillaryData ancillary data of the price being requested.\n * @param bond custom bond amount to set.\n * @return totalBond new bond + final fee that the proposer and disputer will be required to pay. This can be\n * changed again with a subsequent call to setBond().\n */\n function setBond(\n bytes32 identifier,\n uint256 timestamp,\n bytes memory ancillaryData,\n uint256 bond\n ) external virtual returns (uint256 totalBond);\n\n /**\n * @notice Sets the request to refund the reward if the proposal is disputed. This can help to \"hedge\" the caller\n * in the event of a dispute-caused delay. Note: in the event of a dispute, the winner still receives the other's\n * bond, so there is still profit to be made even if the reward is refunded.\n * @param identifier price identifier to identify the existing request.\n * @param timestamp timestamp to identify the existing request.\n * @param ancillaryData ancillary data of the price being requested.\n */\n function setRefundOnDispute(\n bytes32 identifier,\n uint256 timestamp,\n bytes memory ancillaryData\n ) external virtual;\n\n /**\n * @notice Sets a custom liveness value for the request. Liveness is the amount of time a proposal must wait before\n * being auto-resolved.\n * @param identifier price identifier to identify the existing request.\n * @param timestamp timestamp to identify the existing request.\n * @param ancillaryData ancillary data of the price being requested.\n * @param customLiveness new custom liveness.\n */\n function setCustomLiveness(\n bytes32 identifier,\n uint256 timestamp,\n bytes memory ancillaryData,\n uint256 customLiveness\n ) external virtual;\n\n /**\n * @notice Proposes a price value on another address' behalf. Note: this address will receive any rewards that come\n * from this proposal. However, any bonds are pulled from the caller.\n * @param proposer address to set as the proposer.\n * @param requester sender of the initial price request.\n * @param identifier price identifier to identify the existing request.\n * @param timestamp timestamp to identify the existing request.\n * @param ancillaryData ancillary data of the price being requested.\n * @param proposedPrice price being proposed.\n * @return totalBond the amount that's pulled from the caller's wallet as a bond. The bond will be returned to\n * the proposer once settled if the proposal is correct.\n */\n function proposePriceFor(\n address proposer,\n address requester,\n bytes32 identifier,\n uint256 timestamp,\n bytes memory ancillaryData,\n int256 proposedPrice\n ) public virtual returns (uint256 totalBond);\n\n /**\n * @notice Proposes a price value for an existing price request.\n * @param requester sender of the initial price request.\n * @param identifier price identifier to identify the existing request.\n * @param timestamp timestamp to identify the existing request.\n * @param ancillaryData ancillary data of the price being requested.\n * @param proposedPrice price being proposed.\n * @return totalBond the amount that's pulled from the proposer's wallet as a bond. The bond will be returned to\n * the proposer once settled if the proposal is correct.\n */\n function proposePrice(\n address requester,\n bytes32 identifier,\n uint256 timestamp,\n bytes memory ancillaryData,\n int256 proposedPrice\n ) external virtual returns (uint256 totalBond);\n\n /**\n * @notice Disputes a price request with an active proposal on another address' behalf. Note: this address will\n * receive any rewards that come from this dispute. However, any bonds are pulled from the caller.\n * @param disputer address to set as the disputer.\n * @param requester sender of the initial price request.\n * @param identifier price identifier to identify the existing request.\n * @param timestamp timestamp to identify the existing request.\n * @param ancillaryData ancillary data of the price being requested.\n * @return totalBond the amount that's pulled from the caller's wallet as a bond. The bond will be returned to\n * the disputer once settled if the dispute was value (the proposal was incorrect).\n */\n function disputePriceFor(\n address disputer,\n address requester,\n bytes32 identifier,\n uint256 timestamp,\n bytes memory ancillaryData\n ) public virtual returns (uint256 totalBond);\n\n /**\n * @notice Disputes a price value for an existing price request with an active proposal.\n * @param requester sender of the initial price request.\n * @param identifier price identifier to identify the existing request.\n * @param timestamp timestamp to identify the existing request.\n * @param ancillaryData ancillary data of the price being requested.\n * @return totalBond the amount that's pulled from the disputer's wallet as a bond. The bond will be returned to\n * the disputer once settled if the dispute was valid (the proposal was incorrect).\n */\n function disputePrice(\n address requester,\n bytes32 identifier,\n uint256 timestamp,\n bytes memory ancillaryData\n ) external virtual returns (uint256 totalBond);\n\n /**\n * @notice Retrieves a price that was previously requested by a caller. Reverts if the request is not settled\n * or settleable. Note: this method is not view so that this call may actually settle the price request if it\n * hasn't been settled.\n * @param identifier price identifier to identify the existing request.\n * @param timestamp timestamp to identify the existing request.\n * @param ancillaryData ancillary data of the price being requested.\n * @return resolved price.\n */\n function settleAndGetPrice(\n bytes32 identifier,\n uint256 timestamp,\n bytes memory ancillaryData\n ) external virtual returns (int256);\n\n /**\n * @notice Attempts to settle an outstanding price request. Will revert if it isn't settleable.\n * @param requester sender of the initial price request.\n * @param identifier price identifier to identify the existing request.\n * @param timestamp timestamp to identify the existing request.\n * @param ancillaryData ancillary data of the price being requested.\n * @return payout the amount that the \"winner\" (proposer or disputer) receives on settlement. This amount includes\n * the returned bonds as well as additional rewards.\n */\n function settle(\n address requester,\n bytes32 identifier,\n uint256 timestamp,\n bytes memory ancillaryData\n ) external virtual returns (uint256 payout);\n\n /**\n * @notice Gets the current data structure containing all information about a price request.\n * @param requester sender of the initial price request.\n * @param identifier price identifier to identify the existing request.\n * @param timestamp timestamp to identify the existing request.\n * @param ancillaryData ancillary data of the price being requested.\n * @return the Request data structure.\n */\n function getRequest(\n address requester,\n bytes32 identifier,\n uint256 timestamp,\n bytes memory ancillaryData\n ) public view virtual returns (Request memory);\n\n /**\n * @notice Returns the state of a price request.\n * @param requester sender of the initial price request.\n * @param identifier price identifier to identify the existing request.\n * @param timestamp timestamp to identify the existing request.\n * @param ancillaryData ancillary data of the price being requested.\n * @return the State enum value.\n */\n function getState(\n address requester,\n bytes32 identifier,\n uint256 timestamp,\n bytes memory ancillaryData\n ) public view virtual returns (State);\n\n /**\n * @notice Checks if a given request has resolved or been settled (i.e the optimistic oracle has a price).\n * @param requester sender of the initial price request.\n * @param identifier price identifier to identify the existing request.\n * @param timestamp timestamp to identify the existing request.\n * @param ancillaryData ancillary data of the price being requested.\n * @return true if price has resolved or settled, false otherwise.\n */\n function hasPrice(\n address requester,\n bytes32 identifier,\n uint256 timestamp,\n bytes memory ancillaryData\n ) public view virtual returns (bool);\n\n function stampAncillaryData(bytes memory ancillaryData, address requester)\n public\n view\n virtual\n returns (bytes memory);\n}\n" + }, + "@uma/core/contracts/oracle/interfaces/SkinnyOptimisticOracleInterface.sol": { + "content": "// SPDX-License-Identifier: AGPL-3.0-only\npragma solidity ^0.8.0;\n\nimport \"@openzeppelin/contracts/token/ERC20/IERC20.sol\";\nimport \"../interfaces/OptimisticOracleInterface.sol\";\n\n/**\n * @title Interface for the gas-cost-reduced version of the OptimisticOracle.\n * @notice Differences from normal OptimisticOracle:\n * - refundOnDispute: flag is removed, by default there are no refunds on disputes.\n * - customizing request parameters: In the OptimisticOracle, parameters like `bond` and `customLiveness` can be reset\n * after a request is already made via `requestPrice`. In the SkinnyOptimisticOracle, these parameters can only be\n * set in `requestPrice`, which has an expanded input set.\n * - settleAndGetPrice: Replaced by `settle`, which can only be called once per settleable request. The resolved price\n * can be fetched via the `Settle` event or the return value of `settle`.\n * - general changes to interface: Functions that interact with existing requests all require the parameters of the\n * request to modify to be passed as input. These parameters must match with the existing request parameters or the\n * function will revert. This change reflects the internal refactor to store hashed request parameters instead of the\n * full request struct.\n * @dev Interface used by financial contracts to interact with the Oracle. Voters will use a different interface.\n */\nabstract contract SkinnyOptimisticOracleInterface {\n // Struct representing a price request. Note that this differs from the OptimisticOracleInterface's Request struct\n // in that refundOnDispute is removed.\n struct Request {\n address proposer; // Address of the proposer.\n address disputer; // Address of the disputer.\n IERC20 currency; // ERC20 token used to pay rewards and fees.\n bool settled; // True if the request is settled.\n int256 proposedPrice; // Price that the proposer submitted.\n int256 resolvedPrice; // Price resolved once the request is settled.\n uint256 expirationTime; // Time at which the request auto-settles without a dispute.\n uint256 reward; // Amount of the currency to pay to the proposer on settlement.\n uint256 finalFee; // Final fee to pay to the Store upon request to the DVM.\n uint256 bond; // Bond that the proposer and disputer must pay on top of the final fee.\n uint256 customLiveness; // Custom liveness value set by the requester.\n }\n\n // This value must be <= the Voting contract's `ancillaryBytesLimit` value otherwise it is possible\n // that a price can be requested to this contract successfully, but cannot be disputed because the DVM refuses\n // to accept a price request made with ancillary data length over a certain size.\n uint256 public constant ancillaryBytesLimit = 8192;\n\n /**\n * @notice Requests a new price.\n * @param identifier price identifier being requested.\n * @param timestamp timestamp of the price being requested.\n * @param ancillaryData ancillary data representing additional args being passed with the price request.\n * @param currency ERC20 token used for payment of rewards and fees. Must be approved for use with the DVM.\n * @param reward reward offered to a successful proposer. Will be pulled from the caller. Note: this can be 0,\n * which could make sense if the contract requests and proposes the value in the same call or\n * provides its own reward system.\n * @param bond custom proposal bond to set for request. If set to 0, defaults to the final fee.\n * @param customLiveness custom proposal liveness to set for request.\n * @return totalBond default bond + final fee that the proposer and disputer will be required to pay.\n */\n function requestPrice(\n bytes32 identifier,\n uint32 timestamp,\n bytes memory ancillaryData,\n IERC20 currency,\n uint256 reward,\n uint256 bond,\n uint256 customLiveness\n ) external virtual returns (uint256 totalBond);\n\n /**\n * @notice Proposes a price value on another address' behalf. Note: this address will receive any rewards that come\n * from this proposal. However, any bonds are pulled from the caller.\n * @param requester sender of the initial price request.\n * @param identifier price identifier to identify the existing request.\n * @param timestamp timestamp to identify the existing request.\n * @param ancillaryData ancillary data of the price being requested.\n * @param request price request parameters whose hash must match the request that the caller wants to\n * propose a price for.\n * @param proposer address to set as the proposer.\n * @param proposedPrice price being proposed.\n * @return totalBond the amount that's pulled from the caller's wallet as a bond. The bond will be returned to\n * the proposer once settled if the proposal is correct.\n */\n function proposePriceFor(\n address requester,\n bytes32 identifier,\n uint32 timestamp,\n bytes memory ancillaryData,\n Request memory request,\n address proposer,\n int256 proposedPrice\n ) public virtual returns (uint256 totalBond);\n\n /**\n * @notice Proposes a price value where caller is the proposer.\n * @param requester sender of the initial price request.\n * @param identifier price identifier to identify the existing request.\n * @param timestamp timestamp to identify the existing request.\n * @param ancillaryData ancillary data of the price being requested.\n * @param request price request parameters whose hash must match the request that the caller wants to\n * propose a price for.\n * @param proposedPrice price being proposed.\n * @return totalBond the amount that's pulled from the caller's wallet as a bond. The bond will be returned to\n * the proposer once settled if the proposal is correct.\n */\n function proposePrice(\n address requester,\n bytes32 identifier,\n uint32 timestamp,\n bytes memory ancillaryData,\n Request memory request,\n int256 proposedPrice\n ) external virtual returns (uint256 totalBond);\n\n /**\n * @notice Combines logic of requestPrice and proposePrice while taking advantage of gas savings from not having to\n * overwrite Request params that a normal requestPrice() => proposePrice() flow would entail. Note: The proposer\n * will receive any rewards that come from this proposal. However, any bonds are pulled from the caller.\n * @dev The caller is the requester, but the proposer can be customized.\n * @param identifier price identifier to identify the existing request.\n * @param timestamp timestamp to identify the existing request.\n * @param ancillaryData ancillary data of the price being requested.\n * @param currency ERC20 token used for payment of rewards and fees. Must be approved for use with the DVM.\n * @param reward reward offered to a successful proposer. Will be pulled from the caller. Note: this can be 0,\n * which could make sense if the contract requests and proposes the value in the same call or\n * provides its own reward system.\n * @param bond custom proposal bond to set for request. If set to 0, defaults to the final fee.\n * @param customLiveness custom proposal liveness to set for request.\n * @param proposer address to set as the proposer.\n * @param proposedPrice price being proposed.\n * @return totalBond the amount that's pulled from the caller's wallet as a bond. The bond will be returned to\n * the proposer once settled if the proposal is correct.\n */\n function requestAndProposePriceFor(\n bytes32 identifier,\n uint32 timestamp,\n bytes memory ancillaryData,\n IERC20 currency,\n uint256 reward,\n uint256 bond,\n uint256 customLiveness,\n address proposer,\n int256 proposedPrice\n ) external virtual returns (uint256 totalBond);\n\n /**\n * @notice Disputes a price request with an active proposal on another address' behalf. Note: this address will\n * receive any rewards that come from this dispute. However, any bonds are pulled from the caller.\n * @param identifier price identifier to identify the existing request.\n * @param timestamp timestamp to identify the existing request.\n * @param ancillaryData ancillary data of the price being requested.\n * @param request price request parameters whose hash must match the request that the caller wants to\n * dispute.\n * @param disputer address to set as the disputer.\n * @param requester sender of the initial price request.\n * @return totalBond the amount that's pulled from the caller's wallet as a bond. The bond will be returned to\n * the disputer once settled if the dispute was valid (the proposal was incorrect).\n */\n function disputePriceFor(\n bytes32 identifier,\n uint32 timestamp,\n bytes memory ancillaryData,\n Request memory request,\n address disputer,\n address requester\n ) public virtual returns (uint256 totalBond);\n\n /**\n * @notice Disputes a price request with an active proposal where caller is the disputer.\n * @param requester sender of the initial price request.\n * @param identifier price identifier to identify the existing request.\n * @param timestamp timestamp to identify the existing request.\n * @param ancillaryData ancillary data of the price being requested.\n * @param request price request parameters whose hash must match the request that the caller wants to\n * dispute.\n * @return totalBond the amount that's pulled from the caller's wallet as a bond. The bond will be returned to\n * the disputer once settled if the dispute was valid (the proposal was incorrect).\n */\n function disputePrice(\n address requester,\n bytes32 identifier,\n uint32 timestamp,\n bytes memory ancillaryData,\n Request memory request\n ) external virtual returns (uint256 totalBond);\n\n /**\n * @notice Attempts to settle an outstanding price request. Will revert if it isn't settleable.\n * @param requester sender of the initial price request.\n * @param identifier price identifier to identify the existing request.\n * @param timestamp timestamp to identify the existing request.\n * @param ancillaryData ancillary data of the price being requested.\n * @param request price request parameters whose hash must match the request that the caller wants to\n * settle.\n * @return payout the amount that the \"winner\" (proposer or disputer) receives on settlement. This amount includes\n * the returned bonds as well as additional rewards.\n * @return resolvedPrice the price that the request settled to.\n */\n function settle(\n address requester,\n bytes32 identifier,\n uint32 timestamp,\n bytes memory ancillaryData,\n Request memory request\n ) external virtual returns (uint256 payout, int256 resolvedPrice);\n\n /**\n * @notice Computes the current state of a price request. See the State enum for more details.\n * @param requester sender of the initial price request.\n * @param identifier price identifier to identify the existing request.\n * @param timestamp timestamp to identify the existing request.\n * @param ancillaryData ancillary data of the price being requested.\n * @param request price request parameters.\n * @return the State.\n */\n function getState(\n address requester,\n bytes32 identifier,\n uint32 timestamp,\n bytes memory ancillaryData,\n Request memory request\n ) external virtual returns (OptimisticOracleInterface.State);\n\n /**\n * @notice Checks if a given request has resolved, expired or been settled (i.e the optimistic oracle has a price).\n * @param requester sender of the initial price request.\n * @param identifier price identifier to identify the existing request.\n * @param timestamp timestamp to identify the existing request.\n * @param ancillaryData ancillary data of the price being requested.\n * @param request price request parameters. The hash of these parameters must match with the request hash that is\n * associated with the price request unique ID {requester, identifier, timestamp, ancillaryData}, or this method\n * will revert.\n * @return boolean indicating true if price exists and false if not.\n */\n function hasPrice(\n address requester,\n bytes32 identifier,\n uint32 timestamp,\n bytes memory ancillaryData,\n Request memory request\n ) public virtual returns (bool);\n\n /**\n * @notice Generates stamped ancillary data in the format that it would be used in the case of a price dispute.\n * @param ancillaryData ancillary data of the price being requested.\n * @param requester sender of the initial price request.\n * @return the stamped ancillary bytes.\n */\n function stampAncillaryData(bytes memory ancillaryData, address requester)\n public\n pure\n virtual\n returns (bytes memory);\n}\n" + }, + "@uma/core/contracts/oracle/interfaces/StoreInterface.sol": { + "content": "// SPDX-License-Identifier: AGPL-3.0-only\npragma solidity ^0.8.0;\n\nimport \"@openzeppelin/contracts/token/ERC20/IERC20.sol\";\nimport \"../../common/implementation/FixedPoint.sol\";\n\n/**\n * @title Interface that allows financial contracts to pay oracle fees for their use of the system.\n */\ninterface StoreInterface {\n /**\n * @notice Pays Oracle fees in ETH to the store.\n * @dev To be used by contracts whose margin currency is ETH.\n */\n function payOracleFees() external payable;\n\n /**\n * @notice Pays oracle fees in the margin currency, erc20Address, to the store.\n * @dev To be used if the margin currency is an ERC20 token rather than ETH.\n * @param erc20Address address of the ERC20 token used to pay the fee.\n * @param amount number of tokens to transfer. An approval for at least this amount must exist.\n */\n function payOracleFeesErc20(address erc20Address, FixedPoint.Unsigned calldata amount) external;\n\n /**\n * @notice Computes the regular oracle fees that a contract should pay for a period.\n * @param startTime defines the beginning time from which the fee is paid.\n * @param endTime end time until which the fee is paid.\n * @param pfc \"profit from corruption\", or the maximum amount of margin currency that a\n * token sponsor could extract from the contract through corrupting the price feed in their favor.\n * @return regularFee amount owed for the duration from start to end time for the given pfc.\n * @return latePenalty for paying the fee after the deadline.\n */\n function computeRegularFee(\n uint256 startTime,\n uint256 endTime,\n FixedPoint.Unsigned calldata pfc\n ) external view returns (FixedPoint.Unsigned memory regularFee, FixedPoint.Unsigned memory latePenalty);\n\n /**\n * @notice Computes the final oracle fees that a contract should pay at settlement.\n * @param currency token used to pay the final fee.\n * @return finalFee amount due.\n */\n function computeFinalFee(address currency) external view returns (FixedPoint.Unsigned memory);\n}\n" + }, + "@uma/core/contracts/common/implementation/FixedPoint.sol": { + "content": "// SPDX-License-Identifier: AGPL-3.0-only\npragma solidity ^0.8.0;\n\nimport \"@openzeppelin/contracts/utils/math/SafeMath.sol\";\nimport \"@openzeppelin/contracts/utils/math/SignedSafeMath.sol\";\n\n/**\n * @title Library for fixed point arithmetic on uints\n */\nlibrary FixedPoint {\n using SafeMath for uint256;\n using SignedSafeMath for int256;\n\n // Supports 18 decimals. E.g., 1e18 represents \"1\", 5e17 represents \"0.5\".\n // For unsigned values:\n // This can represent a value up to (2^256 - 1)/10^18 = ~10^59. 10^59 will be stored internally as uint256 10^77.\n uint256 private constant FP_SCALING_FACTOR = 10**18;\n\n // --------------------------------------- UNSIGNED -----------------------------------------------------------------------------\n struct Unsigned {\n uint256 rawValue;\n }\n\n /**\n * @notice Constructs an `Unsigned` from an unscaled uint, e.g., `b=5` gets stored internally as `5*(10**18)`.\n * @param a uint to convert into a FixedPoint.\n * @return the converted FixedPoint.\n */\n function fromUnscaledUint(uint256 a) internal pure returns (Unsigned memory) {\n return Unsigned(a.mul(FP_SCALING_FACTOR));\n }\n\n /**\n * @notice Whether `a` is equal to `b`.\n * @param a a FixedPoint.\n * @param b a uint256.\n * @return True if equal, or False.\n */\n function isEqual(Unsigned memory a, uint256 b) internal pure returns (bool) {\n return a.rawValue == fromUnscaledUint(b).rawValue;\n }\n\n /**\n * @notice Whether `a` is equal to `b`.\n * @param a a FixedPoint.\n * @param b a FixedPoint.\n * @return True if equal, or False.\n */\n function isEqual(Unsigned memory a, Unsigned memory b) internal pure returns (bool) {\n return a.rawValue == b.rawValue;\n }\n\n /**\n * @notice Whether `a` is greater than `b`.\n * @param a a FixedPoint.\n * @param b a FixedPoint.\n * @return True if `a > b`, or False.\n */\n function isGreaterThan(Unsigned memory a, Unsigned memory b) internal pure returns (bool) {\n return a.rawValue > b.rawValue;\n }\n\n /**\n * @notice Whether `a` is greater than `b`.\n * @param a a FixedPoint.\n * @param b a uint256.\n * @return True if `a > b`, or False.\n */\n function isGreaterThan(Unsigned memory a, uint256 b) internal pure returns (bool) {\n return a.rawValue > fromUnscaledUint(b).rawValue;\n }\n\n /**\n * @notice Whether `a` is greater than `b`.\n * @param a a uint256.\n * @param b a FixedPoint.\n * @return True if `a > b`, or False.\n */\n function isGreaterThan(uint256 a, Unsigned memory b) internal pure returns (bool) {\n return fromUnscaledUint(a).rawValue > b.rawValue;\n }\n\n /**\n * @notice Whether `a` is greater than or equal to `b`.\n * @param a a FixedPoint.\n * @param b a FixedPoint.\n * @return True if `a >= b`, or False.\n */\n function isGreaterThanOrEqual(Unsigned memory a, Unsigned memory b) internal pure returns (bool) {\n return a.rawValue >= b.rawValue;\n }\n\n /**\n * @notice Whether `a` is greater than or equal to `b`.\n * @param a a FixedPoint.\n * @param b a uint256.\n * @return True if `a >= b`, or False.\n */\n function isGreaterThanOrEqual(Unsigned memory a, uint256 b) internal pure returns (bool) {\n return a.rawValue >= fromUnscaledUint(b).rawValue;\n }\n\n /**\n * @notice Whether `a` is greater than or equal to `b`.\n * @param a a uint256.\n * @param b a FixedPoint.\n * @return True if `a >= b`, or False.\n */\n function isGreaterThanOrEqual(uint256 a, Unsigned memory b) internal pure returns (bool) {\n return fromUnscaledUint(a).rawValue >= b.rawValue;\n }\n\n /**\n * @notice Whether `a` is less than `b`.\n * @param a a FixedPoint.\n * @param b a FixedPoint.\n * @return True if `a < b`, or False.\n */\n function isLessThan(Unsigned memory a, Unsigned memory b) internal pure returns (bool) {\n return a.rawValue < b.rawValue;\n }\n\n /**\n * @notice Whether `a` is less than `b`.\n * @param a a FixedPoint.\n * @param b a uint256.\n * @return True if `a < b`, or False.\n */\n function isLessThan(Unsigned memory a, uint256 b) internal pure returns (bool) {\n return a.rawValue < fromUnscaledUint(b).rawValue;\n }\n\n /**\n * @notice Whether `a` is less than `b`.\n * @param a a uint256.\n * @param b a FixedPoint.\n * @return True if `a < b`, or False.\n */\n function isLessThan(uint256 a, Unsigned memory b) internal pure returns (bool) {\n return fromUnscaledUint(a).rawValue < b.rawValue;\n }\n\n /**\n * @notice Whether `a` is less than or equal to `b`.\n * @param a a FixedPoint.\n * @param b a FixedPoint.\n * @return True if `a <= b`, or False.\n */\n function isLessThanOrEqual(Unsigned memory a, Unsigned memory b) internal pure returns (bool) {\n return a.rawValue <= b.rawValue;\n }\n\n /**\n * @notice Whether `a` is less than or equal to `b`.\n * @param a a FixedPoint.\n * @param b a uint256.\n * @return True if `a <= b`, or False.\n */\n function isLessThanOrEqual(Unsigned memory a, uint256 b) internal pure returns (bool) {\n return a.rawValue <= fromUnscaledUint(b).rawValue;\n }\n\n /**\n * @notice Whether `a` is less than or equal to `b`.\n * @param a a uint256.\n * @param b a FixedPoint.\n * @return True if `a <= b`, or False.\n */\n function isLessThanOrEqual(uint256 a, Unsigned memory b) internal pure returns (bool) {\n return fromUnscaledUint(a).rawValue <= b.rawValue;\n }\n\n /**\n * @notice The minimum of `a` and `b`.\n * @param a a FixedPoint.\n * @param b a FixedPoint.\n * @return the minimum of `a` and `b`.\n */\n function min(Unsigned memory a, Unsigned memory b) internal pure returns (Unsigned memory) {\n return a.rawValue < b.rawValue ? a : b;\n }\n\n /**\n * @notice The maximum of `a` and `b`.\n * @param a a FixedPoint.\n * @param b a FixedPoint.\n * @return the maximum of `a` and `b`.\n */\n function max(Unsigned memory a, Unsigned memory b) internal pure returns (Unsigned memory) {\n return a.rawValue > b.rawValue ? a : b;\n }\n\n /**\n * @notice Adds two `Unsigned`s, reverting on overflow.\n * @param a a FixedPoint.\n * @param b a FixedPoint.\n * @return the sum of `a` and `b`.\n */\n function add(Unsigned memory a, Unsigned memory b) internal pure returns (Unsigned memory) {\n return Unsigned(a.rawValue.add(b.rawValue));\n }\n\n /**\n * @notice Adds an `Unsigned` to an unscaled uint, reverting on overflow.\n * @param a a FixedPoint.\n * @param b a uint256.\n * @return the sum of `a` and `b`.\n */\n function add(Unsigned memory a, uint256 b) internal pure returns (Unsigned memory) {\n return add(a, fromUnscaledUint(b));\n }\n\n /**\n * @notice Subtracts two `Unsigned`s, reverting on overflow.\n * @param a a FixedPoint.\n * @param b a FixedPoint.\n * @return the difference of `a` and `b`.\n */\n function sub(Unsigned memory a, Unsigned memory b) internal pure returns (Unsigned memory) {\n return Unsigned(a.rawValue.sub(b.rawValue));\n }\n\n /**\n * @notice Subtracts an unscaled uint256 from an `Unsigned`, reverting on overflow.\n * @param a a FixedPoint.\n * @param b a uint256.\n * @return the difference of `a` and `b`.\n */\n function sub(Unsigned memory a, uint256 b) internal pure returns (Unsigned memory) {\n return sub(a, fromUnscaledUint(b));\n }\n\n /**\n * @notice Subtracts an `Unsigned` from an unscaled uint256, reverting on overflow.\n * @param a a uint256.\n * @param b a FixedPoint.\n * @return the difference of `a` and `b`.\n */\n function sub(uint256 a, Unsigned memory b) internal pure returns (Unsigned memory) {\n return sub(fromUnscaledUint(a), b);\n }\n\n /**\n * @notice Multiplies two `Unsigned`s, reverting on overflow.\n * @dev This will \"floor\" the product.\n * @param a a FixedPoint.\n * @param b a FixedPoint.\n * @return the product of `a` and `b`.\n */\n function mul(Unsigned memory a, Unsigned memory b) internal pure returns (Unsigned memory) {\n // There are two caveats with this computation:\n // 1. Max output for the represented number is ~10^41, otherwise an intermediate value overflows. 10^41 is\n // stored internally as a uint256 ~10^59.\n // 2. Results that can't be represented exactly are truncated not rounded. E.g., 1.4 * 2e-18 = 2.8e-18, which\n // would round to 3, but this computation produces the result 2.\n // No need to use SafeMath because FP_SCALING_FACTOR != 0.\n return Unsigned(a.rawValue.mul(b.rawValue) / FP_SCALING_FACTOR);\n }\n\n /**\n * @notice Multiplies an `Unsigned` and an unscaled uint256, reverting on overflow.\n * @dev This will \"floor\" the product.\n * @param a a FixedPoint.\n * @param b a uint256.\n * @return the product of `a` and `b`.\n */\n function mul(Unsigned memory a, uint256 b) internal pure returns (Unsigned memory) {\n return Unsigned(a.rawValue.mul(b));\n }\n\n /**\n * @notice Multiplies two `Unsigned`s and \"ceil's\" the product, reverting on overflow.\n * @param a a FixedPoint.\n * @param b a FixedPoint.\n * @return the product of `a` and `b`.\n */\n function mulCeil(Unsigned memory a, Unsigned memory b) internal pure returns (Unsigned memory) {\n uint256 mulRaw = a.rawValue.mul(b.rawValue);\n uint256 mulFloor = mulRaw / FP_SCALING_FACTOR;\n uint256 mod = mulRaw.mod(FP_SCALING_FACTOR);\n if (mod != 0) {\n return Unsigned(mulFloor.add(1));\n } else {\n return Unsigned(mulFloor);\n }\n }\n\n /**\n * @notice Multiplies an `Unsigned` and an unscaled uint256 and \"ceil's\" the product, reverting on overflow.\n * @param a a FixedPoint.\n * @param b a FixedPoint.\n * @return the product of `a` and `b`.\n */\n function mulCeil(Unsigned memory a, uint256 b) internal pure returns (Unsigned memory) {\n // Since b is an uint, there is no risk of truncation and we can just mul it normally\n return Unsigned(a.rawValue.mul(b));\n }\n\n /**\n * @notice Divides one `Unsigned` by an `Unsigned`, reverting on overflow or division by 0.\n * @dev This will \"floor\" the quotient.\n * @param a a FixedPoint numerator.\n * @param b a FixedPoint denominator.\n * @return the quotient of `a` divided by `b`.\n */\n function div(Unsigned memory a, Unsigned memory b) internal pure returns (Unsigned memory) {\n // There are two caveats with this computation:\n // 1. Max value for the number dividend `a` represents is ~10^41, otherwise an intermediate value overflows.\n // 10^41 is stored internally as a uint256 10^59.\n // 2. Results that can't be represented exactly are truncated not rounded. E.g., 2 / 3 = 0.6 repeating, which\n // would round to 0.666666666666666667, but this computation produces the result 0.666666666666666666.\n return Unsigned(a.rawValue.mul(FP_SCALING_FACTOR).div(b.rawValue));\n }\n\n /**\n * @notice Divides one `Unsigned` by an unscaled uint256, reverting on overflow or division by 0.\n * @dev This will \"floor\" the quotient.\n * @param a a FixedPoint numerator.\n * @param b a uint256 denominator.\n * @return the quotient of `a` divided by `b`.\n */\n function div(Unsigned memory a, uint256 b) internal pure returns (Unsigned memory) {\n return Unsigned(a.rawValue.div(b));\n }\n\n /**\n * @notice Divides one unscaled uint256 by an `Unsigned`, reverting on overflow or division by 0.\n * @dev This will \"floor\" the quotient.\n * @param a a uint256 numerator.\n * @param b a FixedPoint denominator.\n * @return the quotient of `a` divided by `b`.\n */\n function div(uint256 a, Unsigned memory b) internal pure returns (Unsigned memory) {\n return div(fromUnscaledUint(a), b);\n }\n\n /**\n * @notice Divides one `Unsigned` by an `Unsigned` and \"ceil's\" the quotient, reverting on overflow or division by 0.\n * @param a a FixedPoint numerator.\n * @param b a FixedPoint denominator.\n * @return the quotient of `a` divided by `b`.\n */\n function divCeil(Unsigned memory a, Unsigned memory b) internal pure returns (Unsigned memory) {\n uint256 aScaled = a.rawValue.mul(FP_SCALING_FACTOR);\n uint256 divFloor = aScaled.div(b.rawValue);\n uint256 mod = aScaled.mod(b.rawValue);\n if (mod != 0) {\n return Unsigned(divFloor.add(1));\n } else {\n return Unsigned(divFloor);\n }\n }\n\n /**\n * @notice Divides one `Unsigned` by an unscaled uint256 and \"ceil's\" the quotient, reverting on overflow or division by 0.\n * @param a a FixedPoint numerator.\n * @param b a uint256 denominator.\n * @return the quotient of `a` divided by `b`.\n */\n function divCeil(Unsigned memory a, uint256 b) internal pure returns (Unsigned memory) {\n // Because it is possible that a quotient gets truncated, we can't just call \"Unsigned(a.rawValue.div(b))\"\n // similarly to mulCeil with a uint256 as the second parameter. Therefore we need to convert b into an Unsigned.\n // This creates the possibility of overflow if b is very large.\n return divCeil(a, fromUnscaledUint(b));\n }\n\n /**\n * @notice Raises an `Unsigned` to the power of an unscaled uint256, reverting on overflow. E.g., `b=2` squares `a`.\n * @dev This will \"floor\" the result.\n * @param a a FixedPoint numerator.\n * @param b a uint256 denominator.\n * @return output is `a` to the power of `b`.\n */\n function pow(Unsigned memory a, uint256 b) internal pure returns (Unsigned memory output) {\n output = fromUnscaledUint(1);\n for (uint256 i = 0; i < b; i = i.add(1)) {\n output = mul(output, a);\n }\n }\n\n // ------------------------------------------------- SIGNED -------------------------------------------------------------\n // Supports 18 decimals. E.g., 1e18 represents \"1\", 5e17 represents \"0.5\".\n // For signed values:\n // This can represent a value up (or down) to +-(2^255 - 1)/10^18 = ~10^58. 10^58 will be stored internally as int256 10^76.\n int256 private constant SFP_SCALING_FACTOR = 10**18;\n\n struct Signed {\n int256 rawValue;\n }\n\n function fromSigned(Signed memory a) internal pure returns (Unsigned memory) {\n require(a.rawValue >= 0, \"Negative value provided\");\n return Unsigned(uint256(a.rawValue));\n }\n\n function fromUnsigned(Unsigned memory a) internal pure returns (Signed memory) {\n require(a.rawValue <= uint256(type(int256).max), \"Unsigned too large\");\n return Signed(int256(a.rawValue));\n }\n\n /**\n * @notice Constructs a `Signed` from an unscaled int, e.g., `b=5` gets stored internally as `5*(10**18)`.\n * @param a int to convert into a FixedPoint.Signed.\n * @return the converted FixedPoint.Signed.\n */\n function fromUnscaledInt(int256 a) internal pure returns (Signed memory) {\n return Signed(a.mul(SFP_SCALING_FACTOR));\n }\n\n /**\n * @notice Whether `a` is equal to `b`.\n * @param a a FixedPoint.Signed.\n * @param b a int256.\n * @return True if equal, or False.\n */\n function isEqual(Signed memory a, int256 b) internal pure returns (bool) {\n return a.rawValue == fromUnscaledInt(b).rawValue;\n }\n\n /**\n * @notice Whether `a` is equal to `b`.\n * @param a a FixedPoint.Signed.\n * @param b a FixedPoint.Signed.\n * @return True if equal, or False.\n */\n function isEqual(Signed memory a, Signed memory b) internal pure returns (bool) {\n return a.rawValue == b.rawValue;\n }\n\n /**\n * @notice Whether `a` is greater than `b`.\n * @param a a FixedPoint.Signed.\n * @param b a FixedPoint.Signed.\n * @return True if `a > b`, or False.\n */\n function isGreaterThan(Signed memory a, Signed memory b) internal pure returns (bool) {\n return a.rawValue > b.rawValue;\n }\n\n /**\n * @notice Whether `a` is greater than `b`.\n * @param a a FixedPoint.Signed.\n * @param b an int256.\n * @return True if `a > b`, or False.\n */\n function isGreaterThan(Signed memory a, int256 b) internal pure returns (bool) {\n return a.rawValue > fromUnscaledInt(b).rawValue;\n }\n\n /**\n * @notice Whether `a` is greater than `b`.\n * @param a an int256.\n * @param b a FixedPoint.Signed.\n * @return True if `a > b`, or False.\n */\n function isGreaterThan(int256 a, Signed memory b) internal pure returns (bool) {\n return fromUnscaledInt(a).rawValue > b.rawValue;\n }\n\n /**\n * @notice Whether `a` is greater than or equal to `b`.\n * @param a a FixedPoint.Signed.\n * @param b a FixedPoint.Signed.\n * @return True if `a >= b`, or False.\n */\n function isGreaterThanOrEqual(Signed memory a, Signed memory b) internal pure returns (bool) {\n return a.rawValue >= b.rawValue;\n }\n\n /**\n * @notice Whether `a` is greater than or equal to `b`.\n * @param a a FixedPoint.Signed.\n * @param b an int256.\n * @return True if `a >= b`, or False.\n */\n function isGreaterThanOrEqual(Signed memory a, int256 b) internal pure returns (bool) {\n return a.rawValue >= fromUnscaledInt(b).rawValue;\n }\n\n /**\n * @notice Whether `a` is greater than or equal to `b`.\n * @param a an int256.\n * @param b a FixedPoint.Signed.\n * @return True if `a >= b`, or False.\n */\n function isGreaterThanOrEqual(int256 a, Signed memory b) internal pure returns (bool) {\n return fromUnscaledInt(a).rawValue >= b.rawValue;\n }\n\n /**\n * @notice Whether `a` is less than `b`.\n * @param a a FixedPoint.Signed.\n * @param b a FixedPoint.Signed.\n * @return True if `a < b`, or False.\n */\n function isLessThan(Signed memory a, Signed memory b) internal pure returns (bool) {\n return a.rawValue < b.rawValue;\n }\n\n /**\n * @notice Whether `a` is less than `b`.\n * @param a a FixedPoint.Signed.\n * @param b an int256.\n * @return True if `a < b`, or False.\n */\n function isLessThan(Signed memory a, int256 b) internal pure returns (bool) {\n return a.rawValue < fromUnscaledInt(b).rawValue;\n }\n\n /**\n * @notice Whether `a` is less than `b`.\n * @param a an int256.\n * @param b a FixedPoint.Signed.\n * @return True if `a < b`, or False.\n */\n function isLessThan(int256 a, Signed memory b) internal pure returns (bool) {\n return fromUnscaledInt(a).rawValue < b.rawValue;\n }\n\n /**\n * @notice Whether `a` is less than or equal to `b`.\n * @param a a FixedPoint.Signed.\n * @param b a FixedPoint.Signed.\n * @return True if `a <= b`, or False.\n */\n function isLessThanOrEqual(Signed memory a, Signed memory b) internal pure returns (bool) {\n return a.rawValue <= b.rawValue;\n }\n\n /**\n * @notice Whether `a` is less than or equal to `b`.\n * @param a a FixedPoint.Signed.\n * @param b an int256.\n * @return True if `a <= b`, or False.\n */\n function isLessThanOrEqual(Signed memory a, int256 b) internal pure returns (bool) {\n return a.rawValue <= fromUnscaledInt(b).rawValue;\n }\n\n /**\n * @notice Whether `a` is less than or equal to `b`.\n * @param a an int256.\n * @param b a FixedPoint.Signed.\n * @return True if `a <= b`, or False.\n */\n function isLessThanOrEqual(int256 a, Signed memory b) internal pure returns (bool) {\n return fromUnscaledInt(a).rawValue <= b.rawValue;\n }\n\n /**\n * @notice The minimum of `a` and `b`.\n * @param a a FixedPoint.Signed.\n * @param b a FixedPoint.Signed.\n * @return the minimum of `a` and `b`.\n */\n function min(Signed memory a, Signed memory b) internal pure returns (Signed memory) {\n return a.rawValue < b.rawValue ? a : b;\n }\n\n /**\n * @notice The maximum of `a` and `b`.\n * @param a a FixedPoint.Signed.\n * @param b a FixedPoint.Signed.\n * @return the maximum of `a` and `b`.\n */\n function max(Signed memory a, Signed memory b) internal pure returns (Signed memory) {\n return a.rawValue > b.rawValue ? a : b;\n }\n\n /**\n * @notice Adds two `Signed`s, reverting on overflow.\n * @param a a FixedPoint.Signed.\n * @param b a FixedPoint.Signed.\n * @return the sum of `a` and `b`.\n */\n function add(Signed memory a, Signed memory b) internal pure returns (Signed memory) {\n return Signed(a.rawValue.add(b.rawValue));\n }\n\n /**\n * @notice Adds an `Signed` to an unscaled int, reverting on overflow.\n * @param a a FixedPoint.Signed.\n * @param b an int256.\n * @return the sum of `a` and `b`.\n */\n function add(Signed memory a, int256 b) internal pure returns (Signed memory) {\n return add(a, fromUnscaledInt(b));\n }\n\n /**\n * @notice Subtracts two `Signed`s, reverting on overflow.\n * @param a a FixedPoint.Signed.\n * @param b a FixedPoint.Signed.\n * @return the difference of `a` and `b`.\n */\n function sub(Signed memory a, Signed memory b) internal pure returns (Signed memory) {\n return Signed(a.rawValue.sub(b.rawValue));\n }\n\n /**\n * @notice Subtracts an unscaled int256 from an `Signed`, reverting on overflow.\n * @param a a FixedPoint.Signed.\n * @param b an int256.\n * @return the difference of `a` and `b`.\n */\n function sub(Signed memory a, int256 b) internal pure returns (Signed memory) {\n return sub(a, fromUnscaledInt(b));\n }\n\n /**\n * @notice Subtracts an `Signed` from an unscaled int256, reverting on overflow.\n * @param a an int256.\n * @param b a FixedPoint.Signed.\n * @return the difference of `a` and `b`.\n */\n function sub(int256 a, Signed memory b) internal pure returns (Signed memory) {\n return sub(fromUnscaledInt(a), b);\n }\n\n /**\n * @notice Multiplies two `Signed`s, reverting on overflow.\n * @dev This will \"floor\" the product.\n * @param a a FixedPoint.Signed.\n * @param b a FixedPoint.Signed.\n * @return the product of `a` and `b`.\n */\n function mul(Signed memory a, Signed memory b) internal pure returns (Signed memory) {\n // There are two caveats with this computation:\n // 1. Max output for the represented number is ~10^41, otherwise an intermediate value overflows. 10^41 is\n // stored internally as an int256 ~10^59.\n // 2. Results that can't be represented exactly are truncated not rounded. E.g., 1.4 * 2e-18 = 2.8e-18, which\n // would round to 3, but this computation produces the result 2.\n // No need to use SafeMath because SFP_SCALING_FACTOR != 0.\n return Signed(a.rawValue.mul(b.rawValue) / SFP_SCALING_FACTOR);\n }\n\n /**\n * @notice Multiplies an `Signed` and an unscaled int256, reverting on overflow.\n * @dev This will \"floor\" the product.\n * @param a a FixedPoint.Signed.\n * @param b an int256.\n * @return the product of `a` and `b`.\n */\n function mul(Signed memory a, int256 b) internal pure returns (Signed memory) {\n return Signed(a.rawValue.mul(b));\n }\n\n /**\n * @notice Multiplies two `Signed`s and \"ceil's\" the product, reverting on overflow.\n * @param a a FixedPoint.Signed.\n * @param b a FixedPoint.Signed.\n * @return the product of `a` and `b`.\n */\n function mulAwayFromZero(Signed memory a, Signed memory b) internal pure returns (Signed memory) {\n int256 mulRaw = a.rawValue.mul(b.rawValue);\n int256 mulTowardsZero = mulRaw / SFP_SCALING_FACTOR;\n // Manual mod because SignedSafeMath doesn't support it.\n int256 mod = mulRaw % SFP_SCALING_FACTOR;\n if (mod != 0) {\n bool isResultPositive = isLessThan(a, 0) == isLessThan(b, 0);\n int256 valueToAdd = isResultPositive ? int256(1) : int256(-1);\n return Signed(mulTowardsZero.add(valueToAdd));\n } else {\n return Signed(mulTowardsZero);\n }\n }\n\n /**\n * @notice Multiplies an `Signed` and an unscaled int256 and \"ceil's\" the product, reverting on overflow.\n * @param a a FixedPoint.Signed.\n * @param b a FixedPoint.Signed.\n * @return the product of `a` and `b`.\n */\n function mulAwayFromZero(Signed memory a, int256 b) internal pure returns (Signed memory) {\n // Since b is an int, there is no risk of truncation and we can just mul it normally\n return Signed(a.rawValue.mul(b));\n }\n\n /**\n * @notice Divides one `Signed` by an `Signed`, reverting on overflow or division by 0.\n * @dev This will \"floor\" the quotient.\n * @param a a FixedPoint numerator.\n * @param b a FixedPoint denominator.\n * @return the quotient of `a` divided by `b`.\n */\n function div(Signed memory a, Signed memory b) internal pure returns (Signed memory) {\n // There are two caveats with this computation:\n // 1. Max value for the number dividend `a` represents is ~10^41, otherwise an intermediate value overflows.\n // 10^41 is stored internally as an int256 10^59.\n // 2. Results that can't be represented exactly are truncated not rounded. E.g., 2 / 3 = 0.6 repeating, which\n // would round to 0.666666666666666667, but this computation produces the result 0.666666666666666666.\n return Signed(a.rawValue.mul(SFP_SCALING_FACTOR).div(b.rawValue));\n }\n\n /**\n * @notice Divides one `Signed` by an unscaled int256, reverting on overflow or division by 0.\n * @dev This will \"floor\" the quotient.\n * @param a a FixedPoint numerator.\n * @param b an int256 denominator.\n * @return the quotient of `a` divided by `b`.\n */\n function div(Signed memory a, int256 b) internal pure returns (Signed memory) {\n return Signed(a.rawValue.div(b));\n }\n\n /**\n * @notice Divides one unscaled int256 by an `Signed`, reverting on overflow or division by 0.\n * @dev This will \"floor\" the quotient.\n * @param a an int256 numerator.\n * @param b a FixedPoint denominator.\n * @return the quotient of `a` divided by `b`.\n */\n function div(int256 a, Signed memory b) internal pure returns (Signed memory) {\n return div(fromUnscaledInt(a), b);\n }\n\n /**\n * @notice Divides one `Signed` by an `Signed` and \"ceil's\" the quotient, reverting on overflow or division by 0.\n * @param a a FixedPoint numerator.\n * @param b a FixedPoint denominator.\n * @return the quotient of `a` divided by `b`.\n */\n function divAwayFromZero(Signed memory a, Signed memory b) internal pure returns (Signed memory) {\n int256 aScaled = a.rawValue.mul(SFP_SCALING_FACTOR);\n int256 divTowardsZero = aScaled.div(b.rawValue);\n // Manual mod because SignedSafeMath doesn't support it.\n int256 mod = aScaled % b.rawValue;\n if (mod != 0) {\n bool isResultPositive = isLessThan(a, 0) == isLessThan(b, 0);\n int256 valueToAdd = isResultPositive ? int256(1) : int256(-1);\n return Signed(divTowardsZero.add(valueToAdd));\n } else {\n return Signed(divTowardsZero);\n }\n }\n\n /**\n * @notice Divides one `Signed` by an unscaled int256 and \"ceil's\" the quotient, reverting on overflow or division by 0.\n * @param a a FixedPoint numerator.\n * @param b an int256 denominator.\n * @return the quotient of `a` divided by `b`.\n */\n function divAwayFromZero(Signed memory a, int256 b) internal pure returns (Signed memory) {\n // Because it is possible that a quotient gets truncated, we can't just call \"Signed(a.rawValue.div(b))\"\n // similarly to mulCeil with an int256 as the second parameter. Therefore we need to convert b into an Signed.\n // This creates the possibility of overflow if b is very large.\n return divAwayFromZero(a, fromUnscaledInt(b));\n }\n\n /**\n * @notice Raises an `Signed` to the power of an unscaled uint256, reverting on overflow. E.g., `b=2` squares `a`.\n * @dev This will \"floor\" the result.\n * @param a a FixedPoint.Signed.\n * @param b a uint256 (negative exponents are not allowed).\n * @return output is `a` to the power of `b`.\n */\n function pow(Signed memory a, uint256 b) internal pure returns (Signed memory output) {\n output = fromUnscaledInt(1);\n for (uint256 i = 0; i < b; i = i.add(1)) {\n output = mul(output, a);\n }\n }\n}\n" + }, + "@openzeppelin/contracts/utils/math/SafeMath.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts v4.4.1 (utils/math/SafeMath.sol)\n\npragma solidity ^0.8.0;\n\n// CAUTION\n// This version of SafeMath should only be used with Solidity 0.8 or later,\n// because it relies on the compiler's built in overflow checks.\n\n/**\n * @dev Wrappers over Solidity's arithmetic operations.\n *\n * NOTE: `SafeMath` is generally not needed starting with Solidity 0.8, since the compiler\n * now has built in overflow checking.\n */\nlibrary SafeMath {\n /**\n * @dev Returns the addition of two unsigned integers, with an overflow flag.\n *\n * _Available since v3.4._\n */\n function tryAdd(uint256 a, uint256 b) internal pure returns (bool, uint256) {\n unchecked {\n uint256 c = a + b;\n if (c < a) return (false, 0);\n return (true, c);\n }\n }\n\n /**\n * @dev Returns the substraction of two unsigned integers, with an overflow flag.\n *\n * _Available since v3.4._\n */\n function trySub(uint256 a, uint256 b) internal pure returns (bool, uint256) {\n unchecked {\n if (b > a) return (false, 0);\n return (true, a - b);\n }\n }\n\n /**\n * @dev Returns the multiplication of two unsigned integers, with an overflow flag.\n *\n * _Available since v3.4._\n */\n function tryMul(uint256 a, uint256 b) internal pure returns (bool, uint256) {\n unchecked {\n // Gas optimization: this is cheaper than requiring 'a' not being zero, but the\n // benefit is lost if 'b' is also tested.\n // See: https://github.com/OpenZeppelin/openzeppelin-contracts/pull/522\n if (a == 0) return (true, 0);\n uint256 c = a * b;\n if (c / a != b) return (false, 0);\n return (true, c);\n }\n }\n\n /**\n * @dev Returns the division of two unsigned integers, with a division by zero flag.\n *\n * _Available since v3.4._\n */\n function tryDiv(uint256 a, uint256 b) internal pure returns (bool, uint256) {\n unchecked {\n if (b == 0) return (false, 0);\n return (true, a / b);\n }\n }\n\n /**\n * @dev Returns the remainder of dividing two unsigned integers, with a division by zero flag.\n *\n * _Available since v3.4._\n */\n function tryMod(uint256 a, uint256 b) internal pure returns (bool, uint256) {\n unchecked {\n if (b == 0) return (false, 0);\n return (true, a % b);\n }\n }\n\n /**\n * @dev Returns the addition of two unsigned integers, reverting on\n * overflow.\n *\n * Counterpart to Solidity's `+` operator.\n *\n * Requirements:\n *\n * - Addition cannot overflow.\n */\n function add(uint256 a, uint256 b) internal pure returns (uint256) {\n return a + b;\n }\n\n /**\n * @dev Returns the subtraction of two unsigned integers, reverting on\n * overflow (when the result is negative).\n *\n * Counterpart to Solidity's `-` operator.\n *\n * Requirements:\n *\n * - Subtraction cannot overflow.\n */\n function sub(uint256 a, uint256 b) internal pure returns (uint256) {\n return a - b;\n }\n\n /**\n * @dev Returns the multiplication of two unsigned integers, reverting on\n * overflow.\n *\n * Counterpart to Solidity's `*` operator.\n *\n * Requirements:\n *\n * - Multiplication cannot overflow.\n */\n function mul(uint256 a, uint256 b) internal pure returns (uint256) {\n return a * b;\n }\n\n /**\n * @dev Returns the integer division of two unsigned integers, reverting on\n * division by zero. The result is rounded towards zero.\n *\n * Counterpart to Solidity's `/` operator.\n *\n * Requirements:\n *\n * - The divisor cannot be zero.\n */\n function div(uint256 a, uint256 b) internal pure returns (uint256) {\n return a / b;\n }\n\n /**\n * @dev Returns the remainder of dividing two unsigned integers. (unsigned integer modulo),\n * reverting when dividing by zero.\n *\n * Counterpart to Solidity's `%` operator. This function uses a `revert`\n * opcode (which leaves remaining gas untouched) while Solidity uses an\n * invalid opcode to revert (consuming all remaining gas).\n *\n * Requirements:\n *\n * - The divisor cannot be zero.\n */\n function mod(uint256 a, uint256 b) internal pure returns (uint256) {\n return a % b;\n }\n\n /**\n * @dev Returns the subtraction of two unsigned integers, reverting with custom message on\n * overflow (when the result is negative).\n *\n * CAUTION: This function is deprecated because it requires allocating memory for the error\n * message unnecessarily. For custom revert reasons use {trySub}.\n *\n * Counterpart to Solidity's `-` operator.\n *\n * Requirements:\n *\n * - Subtraction cannot overflow.\n */\n function sub(\n uint256 a,\n uint256 b,\n string memory errorMessage\n ) internal pure returns (uint256) {\n unchecked {\n require(b <= a, errorMessage);\n return a - b;\n }\n }\n\n /**\n * @dev Returns the integer division of two unsigned integers, reverting with custom message on\n * division by zero. The result is rounded towards zero.\n *\n * Counterpart to Solidity's `/` operator. Note: this function uses a\n * `revert` opcode (which leaves remaining gas untouched) while Solidity\n * uses an invalid opcode to revert (consuming all remaining gas).\n *\n * Requirements:\n *\n * - The divisor cannot be zero.\n */\n function div(\n uint256 a,\n uint256 b,\n string memory errorMessage\n ) internal pure returns (uint256) {\n unchecked {\n require(b > 0, errorMessage);\n return a / b;\n }\n }\n\n /**\n * @dev Returns the remainder of dividing two unsigned integers. (unsigned integer modulo),\n * reverting with custom message when dividing by zero.\n *\n * CAUTION: This function is deprecated because it requires allocating memory for the error\n * message unnecessarily. For custom revert reasons use {tryMod}.\n *\n * Counterpart to Solidity's `%` operator. This function uses a `revert`\n * opcode (which leaves remaining gas untouched) while Solidity uses an\n * invalid opcode to revert (consuming all remaining gas).\n *\n * Requirements:\n *\n * - The divisor cannot be zero.\n */\n function mod(\n uint256 a,\n uint256 b,\n string memory errorMessage\n ) internal pure returns (uint256) {\n unchecked {\n require(b > 0, errorMessage);\n return a % b;\n }\n }\n}\n" + }, + "@openzeppelin/contracts/utils/math/SignedSafeMath.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts v4.4.1 (utils/math/SignedSafeMath.sol)\n\npragma solidity ^0.8.0;\n\n/**\n * @dev Wrappers over Solidity's arithmetic operations.\n *\n * NOTE: `SignedSafeMath` is no longer needed starting with Solidity 0.8. The compiler\n * now has built in overflow checking.\n */\nlibrary SignedSafeMath {\n /**\n * @dev Returns the multiplication of two signed integers, reverting on\n * overflow.\n *\n * Counterpart to Solidity's `*` operator.\n *\n * Requirements:\n *\n * - Multiplication cannot overflow.\n */\n function mul(int256 a, int256 b) internal pure returns (int256) {\n return a * b;\n }\n\n /**\n * @dev Returns the integer division of two signed integers. Reverts on\n * division by zero. The result is rounded towards zero.\n *\n * Counterpart to Solidity's `/` operator.\n *\n * Requirements:\n *\n * - The divisor cannot be zero.\n */\n function div(int256 a, int256 b) internal pure returns (int256) {\n return a / b;\n }\n\n /**\n * @dev Returns the subtraction of two signed integers, reverting on\n * overflow.\n *\n * Counterpart to Solidity's `-` operator.\n *\n * Requirements:\n *\n * - Subtraction cannot overflow.\n */\n function sub(int256 a, int256 b) internal pure returns (int256) {\n return a - b;\n }\n\n /**\n * @dev Returns the addition of two signed integers, reverting on\n * overflow.\n *\n * Counterpart to Solidity's `+` operator.\n *\n * Requirements:\n *\n * - Addition cannot overflow.\n */\n function add(int256 a, int256 b) internal pure returns (int256) {\n return a + b;\n }\n}\n" + }, + "contracts/LpTokenFactory.sol": { + "content": "// SPDX-License-Identifier: GPL-3.0-only\npragma solidity ^0.8.0;\n\nimport \"./interfaces/LpTokenFactoryInterface.sol\";\n\nimport \"@uma/core/contracts/common/implementation/ExpandedERC20.sol\";\n\n/**\n * @notice Factory to create new LP ERC20 tokens that represent a liquidity provider's position. HubPool is the\n * intended client of this contract.\n */\ncontract LpTokenFactory is LpTokenFactoryInterface {\n /**\n * @notice Deploys new LP token for L1 token. Sets caller as minter and burner of token.\n * @param l1Token L1 token to name in LP token name.\n * @return address of new LP token.\n */\n function createLpToken(address l1Token) public returns (address) {\n ExpandedERC20 lpToken = new ExpandedERC20(\n _append(\"Across V2 \", IERC20Metadata(l1Token).name(), \" LP Token\"), // LP Token Name\n _append(\"Av2-\", IERC20Metadata(l1Token).symbol(), \"-LP\"), // LP Token Symbol\n IERC20Metadata(l1Token).decimals() // LP Token Decimals\n );\n lpToken.addMinter(msg.sender); // Set the caller as the LP Token's minter.\n lpToken.addBurner(msg.sender); // Set the caller as the LP Token's burner.\n lpToken.resetOwner(msg.sender); // Set the caller as the LP Token's owner.\n\n return address(lpToken);\n }\n\n function _append(\n string memory a,\n string memory b,\n string memory c\n ) internal pure returns (string memory) {\n return string(abi.encodePacked(a, b, c));\n }\n}\n" + }, + "contracts/interfaces/LpTokenFactoryInterface.sol": { + "content": "// SPDX-License-Identifier: AGPL-3.0-only\npragma solidity ^0.8.0;\n\ninterface LpTokenFactoryInterface {\n function createLpToken(address l1Token) external returns (address);\n}\n" + }, + "@uma/core/contracts/oracle/interfaces/FinderInterface.sol": { + "content": "// SPDX-License-Identifier: AGPL-3.0-only\npragma solidity ^0.8.0;\n\n/**\n * @title Provides addresses of the live contracts implementing certain interfaces.\n * @dev Examples are the Oracle or Store interfaces.\n */\ninterface FinderInterface {\n /**\n * @notice Updates the address of the contract that implements `interfaceName`.\n * @param interfaceName bytes32 encoding of the interface name that is either changed or registered.\n * @param implementationAddress address of the deployed contract that implements the interface.\n */\n function changeImplementationAddress(bytes32 interfaceName, address implementationAddress) external;\n\n /**\n * @notice Gets the address of the contract that implements the given `interfaceName`.\n * @param interfaceName queried interface.\n * @return implementationAddress address of the deployed contract that implements the interface.\n */\n function getImplementationAddress(bytes32 interfaceName) external view returns (address);\n}\n" + }, + "@uma/core/contracts/oracle/interfaces/IdentifierWhitelistInterface.sol": { + "content": "// SPDX-License-Identifier: AGPL-3.0-only\npragma solidity ^0.8.0;\n\n/**\n * @title Interface for whitelists of supported identifiers that the oracle can provide prices for.\n */\ninterface IdentifierWhitelistInterface {\n /**\n * @notice Adds the provided identifier as a supported identifier.\n * @dev Price requests using this identifier will succeed after this call.\n * @param identifier bytes32 encoding of the string identifier. Eg: BTC/USD.\n */\n function addSupportedIdentifier(bytes32 identifier) external;\n\n /**\n * @notice Removes the identifier from the whitelist.\n * @dev Price requests using this identifier will no longer succeed after this call.\n * @param identifier bytes32 encoding of the string identifier. Eg: BTC/USD.\n */\n function removeSupportedIdentifier(bytes32 identifier) external;\n\n /**\n * @notice Checks whether an identifier is on the whitelist.\n * @param identifier bytes32 encoding of the string identifier. Eg: BTC/USD.\n * @return bool if the identifier is supported (or not).\n */\n function isIdentifierSupported(bytes32 identifier) external view returns (bool);\n}\n" + }, + "@uma/core/contracts/common/interfaces/AddressWhitelistInterface.sol": { + "content": "// SPDX-License-Identifier: AGPL-3.0-only\npragma solidity ^0.8.0;\n\ninterface AddressWhitelistInterface {\n function addToWhitelist(address newElement) external;\n\n function removeFromWhitelist(address newElement) external;\n\n function isOnWhitelist(address newElement) external view returns (bool);\n\n function getWhitelist() external view returns (address[] memory);\n}\n" + }, + "@uma/core/contracts/common/implementation/AncillaryData.sol": { + "content": "// SPDX-License-Identifier: AGPL-3.0-only\npragma solidity ^0.8.0;\n\n/**\n * @title Library for encoding and decoding ancillary data for DVM price requests.\n * @notice We assume that on-chain ancillary data can be formatted directly from bytes to utf8 encoding via\n * web3.utils.hexToUtf8, and that clients will parse the utf8-encoded ancillary data as a comma-delimitted key-value\n * dictionary. Therefore, this library provides internal methods that aid appending to ancillary data from Solidity\n * smart contracts. More details on UMA's ancillary data guidelines below:\n * https://docs.google.com/document/d/1zhKKjgY1BupBGPPrY_WOJvui0B6DMcd-xDR8-9-SPDw/edit\n */\nlibrary AncillaryData {\n // This converts the bottom half of a bytes32 input to hex in a highly gas-optimized way.\n // Source: the brilliant implementation at https://gitter.im/ethereum/solidity?at=5840d23416207f7b0ed08c9b.\n function toUtf8Bytes32Bottom(bytes32 bytesIn) private pure returns (bytes32) {\n unchecked {\n uint256 x = uint256(bytesIn);\n\n // Nibble interleave\n x = x & 0x00000000000000000000000000000000ffffffffffffffffffffffffffffffff;\n x = (x | (x * 2**64)) & 0x0000000000000000ffffffffffffffff0000000000000000ffffffffffffffff;\n x = (x | (x * 2**32)) & 0x00000000ffffffff00000000ffffffff00000000ffffffff00000000ffffffff;\n x = (x | (x * 2**16)) & 0x0000ffff0000ffff0000ffff0000ffff0000ffff0000ffff0000ffff0000ffff;\n x = (x | (x * 2**8)) & 0x00ff00ff00ff00ff00ff00ff00ff00ff00ff00ff00ff00ff00ff00ff00ff00ff;\n x = (x | (x * 2**4)) & 0x0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f;\n\n // Hex encode\n uint256 h = (x & 0x0808080808080808080808080808080808080808080808080808080808080808) / 8;\n uint256 i = (x & 0x0404040404040404040404040404040404040404040404040404040404040404) / 4;\n uint256 j = (x & 0x0202020202020202020202020202020202020202020202020202020202020202) / 2;\n x = x + (h & (i | j)) * 0x27 + 0x3030303030303030303030303030303030303030303030303030303030303030;\n\n // Return the result.\n return bytes32(x);\n }\n }\n\n /**\n * @notice Returns utf8-encoded bytes32 string that can be read via web3.utils.hexToUtf8.\n * @dev Will return bytes32 in all lower case hex characters and without the leading 0x.\n * This has minor changes from the toUtf8BytesAddress to control for the size of the input.\n * @param bytesIn bytes32 to encode.\n * @return utf8 encoded bytes32.\n */\n function toUtf8Bytes(bytes32 bytesIn) internal pure returns (bytes memory) {\n return abi.encodePacked(toUtf8Bytes32Bottom(bytesIn >> 128), toUtf8Bytes32Bottom(bytesIn));\n }\n\n /**\n * @notice Returns utf8-encoded address that can be read via web3.utils.hexToUtf8.\n * Source: https://ethereum.stackexchange.com/questions/8346/convert-address-to-string/8447#8447\n * @dev Will return address in all lower case characters and without the leading 0x.\n * @param x address to encode.\n * @return utf8 encoded address bytes.\n */\n function toUtf8BytesAddress(address x) internal pure returns (bytes memory) {\n return\n abi.encodePacked(toUtf8Bytes32Bottom(bytes32(bytes20(x)) >> 128), bytes8(toUtf8Bytes32Bottom(bytes20(x))));\n }\n\n /**\n * @notice Converts a uint into a base-10, UTF-8 representation stored in a `string` type.\n * @dev This method is based off of this code: https://stackoverflow.com/a/65707309.\n */\n function toUtf8BytesUint(uint256 x) internal pure returns (bytes memory) {\n if (x == 0) {\n return \"0\";\n }\n uint256 j = x;\n uint256 len;\n while (j != 0) {\n len++;\n j /= 10;\n }\n bytes memory bstr = new bytes(len);\n uint256 k = len;\n while (x != 0) {\n k = k - 1;\n uint8 temp = (48 + uint8(x - (x / 10) * 10));\n bytes1 b1 = bytes1(temp);\n bstr[k] = b1;\n x /= 10;\n }\n return bstr;\n }\n\n function appendKeyValueBytes32(\n bytes memory currentAncillaryData,\n bytes memory key,\n bytes32 value\n ) internal pure returns (bytes memory) {\n bytes memory prefix = constructPrefix(currentAncillaryData, key);\n return abi.encodePacked(currentAncillaryData, prefix, toUtf8Bytes(value));\n }\n\n /**\n * @notice Adds \"key:value\" to `currentAncillaryData` where `value` is an address that first needs to be converted\n * to utf8 bytes. For example, if `utf8(currentAncillaryData)=\"k1:v1\"`, then this function will return\n * `utf8(k1:v1,key:value)`, and if `currentAncillaryData` is blank, then this will return `utf8(key:value)`.\n * @param currentAncillaryData This bytes data should ideally be able to be utf8-decoded, but its OK if not.\n * @param key Again, this bytes data should ideally be able to be utf8-decoded, but its OK if not.\n * @param value An address to set as the value in the key:value pair to append to `currentAncillaryData`.\n * @return Newly appended ancillary data.\n */\n function appendKeyValueAddress(\n bytes memory currentAncillaryData,\n bytes memory key,\n address value\n ) internal pure returns (bytes memory) {\n bytes memory prefix = constructPrefix(currentAncillaryData, key);\n return abi.encodePacked(currentAncillaryData, prefix, toUtf8BytesAddress(value));\n }\n\n /**\n * @notice Adds \"key:value\" to `currentAncillaryData` where `value` is a uint that first needs to be converted\n * to utf8 bytes. For example, if `utf8(currentAncillaryData)=\"k1:v1\"`, then this function will return\n * `utf8(k1:v1,key:value)`, and if `currentAncillaryData` is blank, then this will return `utf8(key:value)`.\n * @param currentAncillaryData This bytes data should ideally be able to be utf8-decoded, but its OK if not.\n * @param key Again, this bytes data should ideally be able to be utf8-decoded, but its OK if not.\n * @param value A uint to set as the value in the key:value pair to append to `currentAncillaryData`.\n * @return Newly appended ancillary data.\n */\n function appendKeyValueUint(\n bytes memory currentAncillaryData,\n bytes memory key,\n uint256 value\n ) internal pure returns (bytes memory) {\n bytes memory prefix = constructPrefix(currentAncillaryData, key);\n return abi.encodePacked(currentAncillaryData, prefix, toUtf8BytesUint(value));\n }\n\n /**\n * @notice Helper method that returns the left hand side of a \"key:value\" pair plus the colon \":\" and a leading\n * comma \",\" if the `currentAncillaryData` is not empty. The return value is intended to be prepended as a prefix to\n * some utf8 value that is ultimately added to a comma-delimited, key-value dictionary.\n */\n function constructPrefix(bytes memory currentAncillaryData, bytes memory key) internal pure returns (bytes memory) {\n if (currentAncillaryData.length > 0) {\n return abi.encodePacked(\",\", key, \":\");\n } else {\n return abi.encodePacked(key, \":\");\n }\n }\n}\n" + }, + "@uma/core/contracts/oracle/implementation/Constants.sol": { + "content": "// SPDX-License-Identifier: AGPL-3.0-only\npragma solidity ^0.8.0;\n\n/**\n * @title Stores common interface names used throughout the DVM by registration in the Finder.\n */\nlibrary OracleInterfaces {\n bytes32 public constant Oracle = \"Oracle\";\n bytes32 public constant IdentifierWhitelist = \"IdentifierWhitelist\";\n bytes32 public constant Store = \"Store\";\n bytes32 public constant FinancialContractsAdmin = \"FinancialContractsAdmin\";\n bytes32 public constant Registry = \"Registry\";\n bytes32 public constant CollateralWhitelist = \"CollateralWhitelist\";\n bytes32 public constant OptimisticOracle = \"OptimisticOracle\";\n bytes32 public constant Bridge = \"Bridge\";\n bytes32 public constant GenericHandler = \"GenericHandler\";\n bytes32 public constant SkinnyOptimisticOracle = \"SkinnyOptimisticOracle\";\n bytes32 public constant ChildMessenger = \"ChildMessenger\";\n bytes32 public constant OracleHub = \"OracleHub\";\n bytes32 public constant OracleSpoke = \"OracleSpoke\";\n}\n\n/**\n * @title Commonly re-used values for contracts associated with the OptimisticOracle.\n */\nlibrary OptimisticOracleConstraints {\n // Any price request submitted to the OptimisticOracle must contain ancillary data no larger than this value.\n // This value must be <= the Voting contract's `ancillaryBytesLimit` constant value otherwise it is possible\n // that a price can be requested to the OptimisticOracle successfully, but cannot be resolved by the DVM which\n // refuses to accept a price request made with ancillary data length over a certain size.\n uint256 public constant ancillaryBytesLimit = 8192;\n}\n" + } + }, + "settings": { + "optimizer": { + "enabled": true, + "runs": 1000000 + }, + "outputSelection": { + "*": { + "*": [ + "abi", + "evm.bytecode", + "evm.deployedBytecode", + "evm.methodIdentifiers", + "metadata", + "devdoc", + "userdoc", + "storageLayout", + "evm.gasEstimates" + ], + "": ["ast"] + } + }, + "metadata": { + "useLiteralContent": true + } + } +} diff --git a/deployments/arbitrum-rinkeby/solcInputs/cee77d8f3a5225b985a9cf3439956316.json b/deployments/arbitrum-rinkeby/solcInputs/cee77d8f3a5225b985a9cf3439956316.json deleted file mode 100644 index 33c087308..000000000 --- a/deployments/arbitrum-rinkeby/solcInputs/cee77d8f3a5225b985a9cf3439956316.json +++ /dev/null @@ -1,195 +0,0 @@ -{ - "language": "Solidity", - "sources": { - "contracts/Arbitrum_SpokePool.sol": { - "content": "//SPDX-License-Identifier: Unlicense\r\npragma solidity ^0.8.0;\r\n\r\nimport \"./SpokePool.sol\";\r\nimport \"./SpokePoolInterface.sol\";\r\n\r\ninterface StandardBridgeLike {\r\n function outboundTransfer(\r\n address _l1Token,\r\n address _to,\r\n uint256 _amount,\r\n bytes calldata _data\r\n ) external payable returns (bytes memory);\r\n}\r\n\r\n/**\r\n * @notice AVM specific SpokePool.\r\n * @dev Uses AVM cross-domain-enabled logic for access control.\r\n */\r\n\r\ncontract Arbitrum_SpokePool is SpokePoolInterface, SpokePool {\r\n // Address of the Arbitrum L2 token gateway.\r\n address public l2GatewayRouter;\r\n\r\n // Admin controlled mapping of arbitrum tokens to L1 counterpart. L1 counterpart addresses\r\n // are neccessary to bridge tokens to L1.\r\n mapping(address => address) public whitelistedTokens;\r\n\r\n event ArbitrumTokensBridged(address indexed l1Token, address target, uint256 numberOfTokensBridged);\r\n event SetL2GatewayRouter(address indexed newL2GatewayRouter);\r\n event WhitelistedTokens(address indexed l2Token, address indexed l1Token);\r\n\r\n constructor(\r\n address _l2GatewayRouter,\r\n address _crossDomainAdmin,\r\n address _hubPool,\r\n address _wethAddress,\r\n address timerAddress\r\n ) SpokePool(_crossDomainAdmin, _hubPool, _wethAddress, timerAddress) {\r\n _setL2GatewayRouter(_l2GatewayRouter);\r\n }\r\n\r\n modifier onlyFromCrossDomainAdmin() {\r\n require(msg.sender == _applyL1ToL2Alias(crossDomainAdmin), \"ONLY_COUNTERPART_GATEWAY\");\r\n _;\r\n }\r\n\r\n /**************************************\r\n * CROSS-CHAIN ADMIN FUNCTIONS *\r\n **************************************/\r\n\r\n function setL2GatewayRouter(address newL2GatewayRouter) public onlyFromCrossDomainAdmin nonReentrant {\r\n _setL2GatewayRouter(newL2GatewayRouter);\r\n }\r\n\r\n function whitelistToken(address l2Token, address l1Token) public onlyFromCrossDomainAdmin nonReentrant {\r\n _whitelistToken(l2Token, l1Token);\r\n }\r\n\r\n function setCrossDomainAdmin(address newCrossDomainAdmin) public override onlyFromCrossDomainAdmin nonReentrant {\r\n _setCrossDomainAdmin(newCrossDomainAdmin);\r\n }\r\n\r\n function setHubPool(address newHubPool) public override onlyFromCrossDomainAdmin nonReentrant {\r\n _setHubPool(newHubPool);\r\n }\r\n\r\n function setEnableRoute(\r\n address originToken,\r\n uint256 destinationChainId,\r\n bool enable\r\n ) public override onlyFromCrossDomainAdmin nonReentrant {\r\n _setEnableRoute(originToken, destinationChainId, enable);\r\n }\r\n\r\n function setDepositQuoteTimeBuffer(uint32 buffer) public override onlyFromCrossDomainAdmin nonReentrant {\r\n _setDepositQuoteTimeBuffer(buffer);\r\n }\r\n\r\n function relayRootBundle(bytes32 relayerRefundRoot, bytes32 slowRelayFulfillmentRoot)\r\n public\r\n override\r\n onlyFromCrossDomainAdmin\r\n nonReentrant\r\n {\r\n _relayRootBundle(relayerRefundRoot, slowRelayFulfillmentRoot);\r\n }\r\n\r\n /**************************************\r\n * INTERNAL FUNCTIONS *\r\n **************************************/\r\n\r\n function _bridgeTokensToHubPool(RelayerRefundLeaf memory relayerRefundLeaf) internal override {\r\n StandardBridgeLike(l2GatewayRouter).outboundTransfer(\r\n whitelistedTokens[relayerRefundLeaf.l2TokenAddress], // _l1Token. Address of the L1 token to bridge over.\r\n hubPool, // _to. Withdraw, over the bridge, to the l1 hub pool contract.\r\n relayerRefundLeaf.amountToReturn, // _amount.\r\n \"\" // _data. We don't need to send any data for the bridging action.\r\n );\r\n emit ArbitrumTokensBridged(address(0), hubPool, relayerRefundLeaf.amountToReturn);\r\n }\r\n\r\n function _setL2GatewayRouter(address _l2GatewayRouter) internal {\r\n l2GatewayRouter = _l2GatewayRouter;\r\n emit SetL2GatewayRouter(l2GatewayRouter);\r\n }\r\n\r\n function _whitelistToken(address _l2Token, address _l1Token) internal {\r\n whitelistedTokens[_l2Token] = _l1Token;\r\n emit WhitelistedTokens(_l2Token, _l1Token);\r\n }\r\n\r\n // l1 addresses are transformed during l1->l2 calls. See https://developer.offchainlabs.com/docs/l1_l2_messages#address-aliasing for more information.\r\n function _applyL1ToL2Alias(address l1Address) internal pure returns (address l2Address) {\r\n unchecked {\r\n l2Address = address(uint160(l1Address) + uint160(0x1111000000000000000000000000000000001111));\r\n }\r\n }\r\n}\r\n" - }, - "contracts/SpokePool.sol": { - "content": "// SPDX-License-Identifier: GPL-3.0-only\r\npragma solidity ^0.8.0;\r\n\r\nimport \"./MerkleLib.sol\";\r\nimport \"./interfaces/WETH9.sol\";\r\n\r\nimport \"@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol\";\r\nimport \"@openzeppelin/contracts/token/ERC20/IERC20.sol\";\r\nimport \"@openzeppelin/contracts/utils/Address.sol\";\r\n\r\nimport \"@openzeppelin/contracts/utils/cryptography/SignatureChecker.sol\";\r\nimport \"@openzeppelin/contracts/utils/cryptography/ECDSA.sol\";\r\n\r\nimport \"@uma/core/contracts/common/implementation/Testable.sol\";\r\nimport \"@uma/core/contracts/common/implementation/Lockable.sol\";\r\nimport \"@uma/core/contracts/common/implementation/MultiCaller.sol\";\r\nimport \"./MerkleLib.sol\";\r\nimport \"./SpokePoolInterface.sol\";\r\n\r\n/**\r\n * @title SpokePool\r\n * @notice Contract deployed on source and destination chains enabling depositors to transfer assets from source to\r\n * destination. Deposit orders are fulfilled by off-chain relayers who also interact with this contract. Deposited\r\n * tokens are locked on the source chain and relayers send the recipient the desired token currency and amount\r\n * on the destination chain. Locked source chain tokens are later sent over the canonical token bridge to L1.\r\n * @dev This contract is designed to be deployed to L2's, not mainnet.\r\n */\r\nabstract contract SpokePool is SpokePoolInterface, Testable, Lockable, MultiCaller {\r\n using SafeERC20 for IERC20;\r\n using Address for address;\r\n\r\n // Address of the L1 contract that acts as the owner of this SpokePool.\r\n address public crossDomainAdmin;\r\n\r\n // Address of the L1 contract that will send tokens to and receive tokens from this contract.\r\n address public hubPool;\r\n\r\n // Address of WETH contract for this network. If an origin token matches this, then the caller can optionally\r\n // instruct this contract to wrap ETH when depositing.\r\n WETH9 public weth;\r\n\r\n // Timestamp when contract was constructed. Relays cannot have a quote time before this.\r\n uint32 public deploymentTime;\r\n\r\n // Any deposit quote times greater than or less than this value to the current contract time is blocked. Forces\r\n // caller to use an up to date realized fee. Defaults to 10 minutes.\r\n uint32 public depositQuoteTimeBuffer = 600;\r\n\r\n // Use count of deposits as unique deposit identifier.\r\n uint32 public numberOfDeposits;\r\n\r\n // Origin token to destination token routings can be turned on or off.\r\n mapping(address => mapping(uint256 => bool)) public enabledDepositRoutes;\r\n\r\n struct RootBundle {\r\n // Merkle root of slow relays that were not fully filled and whose recipient is still owed funds from the LP pool.\r\n bytes32 slowRelayFulfillmentRoot;\r\n // Merkle root of relayer refunds.\r\n bytes32 relayerRefundRoot;\r\n // This is a 2D bitmap tracking which leafs in the relayer refund root have been claimed, with max size of\r\n // 256x256 leaves per root.\r\n mapping(uint256 => uint256) claimedBitmap;\r\n }\r\n RootBundle[] public rootBundles;\r\n\r\n // Each relay is associated with the hash of parameters that uniquely identify the original deposit and a relay\r\n // attempt for that deposit. The relay itself is just represented as the amount filled so far. The total amount to\r\n // relay, the fees, and the agents are all parameters included in the hash key.\r\n mapping(bytes32 => uint256) public relayFills;\r\n\r\n /****************************************\r\n * EVENTS *\r\n ****************************************/\r\n event SetXDomainAdmin(address indexed newAdmin);\r\n event SetHubPool(address indexed newHubPool);\r\n event EnabledDepositRoute(address indexed originToken, uint256 indexed destinationChainId, bool enabled);\r\n event SetDepositQuoteTimeBuffer(uint32 newBuffer);\r\n event FundsDeposited(\r\n uint256 amount,\r\n uint256 destinationChainId,\r\n uint64 relayerFeePct,\r\n uint32 indexed depositId,\r\n uint32 quoteTimestamp,\r\n address indexed originToken,\r\n address recipient,\r\n address indexed depositor\r\n );\r\n event FilledRelay(\r\n bytes32 indexed relayHash,\r\n uint256 totalRelayAmount,\r\n uint256 totalFilledAmount,\r\n uint256 fillAmount,\r\n uint256 indexed repaymentChain,\r\n uint256 originChainId,\r\n uint64 relayerFeePct,\r\n uint64 realizedLpFeePct,\r\n uint32 depositId,\r\n address destinationToken,\r\n address indexed relayer,\r\n address depositor,\r\n address recipient\r\n );\r\n event ExecutedSlowRelayFulfillmentRoot(\r\n bytes32 indexed relayHash,\r\n uint256 totalRelayAmount,\r\n uint256 totalFilledAmount,\r\n uint256 fillAmount,\r\n uint256 originChainId,\r\n uint64 relayerFeePct,\r\n uint64 realizedLpFeePct,\r\n uint32 depositId,\r\n address destinationToken,\r\n address indexed caller,\r\n address depositor,\r\n address recipient\r\n );\r\n event RelayedRootBundle(uint32 indexed rootBundleId, bytes32 relayerRefundRoot, bytes32 slowRelayFulfillmentRoot);\r\n event ExecutedRelayerRefundRoot(\r\n uint256 amountToReturn,\r\n uint256 chainId,\r\n uint256[] refundAmounts,\r\n uint32 indexed rootBundleId,\r\n uint32 indexed leafId,\r\n address l2TokenAddress,\r\n address[] refundAddresses,\r\n address indexed caller\r\n );\r\n event TokensBridged(\r\n uint256 amountToReturn,\r\n uint256 indexed chainId,\r\n uint32 indexed leafId,\r\n address indexed l2TokenAddress,\r\n address caller\r\n );\r\n\r\n constructor(\r\n address _crossDomainAdmin,\r\n address _hubPool,\r\n address _wethAddress,\r\n address timerAddress\r\n ) Testable(timerAddress) {\r\n _setCrossDomainAdmin(_crossDomainAdmin);\r\n _setHubPool(_hubPool);\r\n deploymentTime = uint32(getCurrentTime());\r\n weth = WETH9(_wethAddress);\r\n }\r\n\r\n /****************************************\r\n * MODIFIERS *\r\n ****************************************/\r\n\r\n modifier onlyEnabledRoute(address originToken, uint256 destinationId) {\r\n require(enabledDepositRoutes[originToken][destinationId], \"Disabled route\");\r\n _;\r\n }\r\n\r\n /**************************************\r\n * ADMIN FUNCTIONS *\r\n **************************************/\r\n\r\n function _setCrossDomainAdmin(address newCrossDomainAdmin) internal {\r\n require(newCrossDomainAdmin != address(0), \"Bad bridge router address\");\r\n crossDomainAdmin = newCrossDomainAdmin;\r\n emit SetXDomainAdmin(crossDomainAdmin);\r\n }\r\n\r\n function _setHubPool(address newHubPool) internal {\r\n require(newHubPool != address(0), \"Bad hub pool address\");\r\n hubPool = newHubPool;\r\n emit SetHubPool(hubPool);\r\n }\r\n\r\n function _setEnableRoute(\r\n address originToken,\r\n uint256 destinationChainId,\r\n bool enabled\r\n ) internal {\r\n enabledDepositRoutes[originToken][destinationChainId] = enabled;\r\n emit EnabledDepositRoute(originToken, destinationChainId, enabled);\r\n }\r\n\r\n function _setDepositQuoteTimeBuffer(uint32 _depositQuoteTimeBuffer) internal {\r\n depositQuoteTimeBuffer = _depositQuoteTimeBuffer;\r\n emit SetDepositQuoteTimeBuffer(_depositQuoteTimeBuffer);\r\n }\r\n\r\n /**************************************\r\n * DEPOSITOR FUNCTIONS *\r\n **************************************/\r\n\r\n /**\r\n * @notice Called by user to bridge funds from origin to destination chain.\r\n * @dev The caller must first approve this contract to spend `amount` of `originToken`.\r\n */\r\n function deposit(\r\n address recipient,\r\n address originToken,\r\n uint256 amount,\r\n uint256 destinationChainId,\r\n uint64 relayerFeePct,\r\n uint32 quoteTimestamp\r\n ) public payable onlyEnabledRoute(originToken, destinationChainId) nonReentrant {\r\n // We limit the relay fees to prevent the user spending all their funds on fees.\r\n require(relayerFeePct <= 0.5e18, \"invalid relayer fee\");\r\n // Note We assume that L2 timing cannot be compared accurately and consistently to L1 timing. Therefore,\r\n // `block.timestamp` is different from the L1 EVM's. Therefore, the quoteTimestamp must be within a configurable\r\n // buffer to allow for this variance.\r\n // Note also that `quoteTimestamp` cannot be less than the buffer otherwise the following arithmetic can result\r\n // in underflow. This isn't a problem as the deposit will revert, but the error might be unexpected for clients.\r\n require(\r\n getCurrentTime() >= quoteTimestamp - depositQuoteTimeBuffer &&\r\n getCurrentTime() <= quoteTimestamp + depositQuoteTimeBuffer,\r\n \"invalid quote time\"\r\n );\r\n // If the address of the origin token is a WETH contract and there is a msg.value with the transaction\r\n // then the user is sending ETH. In this case, the ETH should be deposited to WETH.\r\n if (originToken == address(weth) && msg.value > 0) {\r\n require(msg.value == amount, \"msg.value must match amount\");\r\n weth.deposit{ value: msg.value }();\r\n } else {\r\n // Else, it is a normal ERC20. In this case pull the token from the users wallet as per normal.\r\n // Note: this includes the case where the L2 user has WETH (already wrapped ETH) and wants to bridge them. In\r\n // this case the msg.value will be set to 0, indicating a \"normal\" ERC20 bridging action.\r\n IERC20(originToken).safeTransferFrom(msg.sender, address(this), amount);\r\n }\r\n\r\n emit FundsDeposited(\r\n amount,\r\n destinationChainId,\r\n relayerFeePct,\r\n numberOfDeposits,\r\n quoteTimestamp,\r\n originToken,\r\n recipient,\r\n msg.sender\r\n );\r\n\r\n numberOfDeposits += 1;\r\n }\r\n\r\n /**************************************\r\n * RELAYER FUNCTIONS *\r\n **************************************/\r\n\r\n function fillRelay(\r\n address depositor,\r\n address recipient,\r\n address destinationToken,\r\n uint256 totalRelayAmount,\r\n uint256 maxTokensToSend,\r\n uint256 repaymentChain,\r\n uint256 originChainId,\r\n uint64 realizedLpFeePct,\r\n uint64 relayerFeePct,\r\n uint32 depositId\r\n ) public nonReentrant {\r\n // Each relay attempt is mapped to the hash of data uniquely identifying it, which includes the deposit data\r\n // such as the origin chain ID and the deposit ID, and the data in a relay attempt such as who the recipient\r\n // is, which chain and currency the recipient wants to receive funds on, and the relay fees.\r\n SpokePoolInterface.RelayData memory relayData = SpokePoolInterface.RelayData({\r\n depositor: depositor,\r\n recipient: recipient,\r\n destinationToken: destinationToken,\r\n relayAmount: totalRelayAmount,\r\n realizedLpFeePct: realizedLpFeePct,\r\n relayerFeePct: relayerFeePct,\r\n depositId: depositId,\r\n originChainId: originChainId\r\n });\r\n bytes32 relayHash = _getRelayHash(relayData);\r\n\r\n uint256 fillAmountPreFees = _fillRelay(relayHash, relayData, maxTokensToSend, relayerFeePct, false);\r\n\r\n _emitFillRelay(relayHash, fillAmountPreFees, repaymentChain, relayerFeePct, relayData);\r\n }\r\n\r\n function fillRelayWithUpdatedFee(\r\n address depositor,\r\n address recipient,\r\n address destinationToken,\r\n uint256 totalRelayAmount,\r\n uint256 maxTokensToSend,\r\n uint256 repaymentChain,\r\n uint256 originChainId,\r\n uint64 realizedLpFeePct,\r\n uint64 relayerFeePct,\r\n uint64 newRelayerFeePct,\r\n uint32 depositId,\r\n bytes memory depositorSignature\r\n ) public nonReentrant {\r\n // Grouping the signature validation logic into brackets to address stack too deep error.\r\n {\r\n // Depositor should have signed a hash of the relayer fee % to update to and information uniquely identifying\r\n // the deposit to relay. This ensures that this signature cannot be re-used for other deposits. The version\r\n // string is included as a precaution in case this contract is upgraded.\r\n // Note: we use encode instead of encodePacked because it is more secure, more in the \"warning\" section\r\n // here: https://docs.soliditylang.org/en/v0.8.11/abi-spec.html#non-standard-packed-mode\r\n bytes32 expectedDepositorMessageHash = keccak256(\r\n abi.encode(\"ACROSS-V2-FEE-1.0\", newRelayerFeePct, depositId, originChainId)\r\n );\r\n\r\n // Check the hash corresponding to the https://eth.wiki/json-rpc/API#eth_sign[`eth_sign`]\r\n // JSON-RPC method as part of EIP-191. We use OZ's signature checker library with adds support for\r\n // EIP-1271 which can verify messages signed by smart contract wallets like Argent and Gnosis safes.\r\n // If the depositor signed a message with a different updated fee (or any other param included in the\r\n // above keccak156 hash), then this will revert.\r\n bytes32 ethSignedMessageHash = ECDSA.toEthSignedMessageHash(expectedDepositorMessageHash);\r\n\r\n _verifyDepositorUpdateFeeMessage(depositor, ethSignedMessageHash, depositorSignature);\r\n }\r\n\r\n // Now follow the default `fillRelay` flow with the updated fee and the original relay hash.\r\n RelayData memory relayData = RelayData({\r\n depositor: depositor,\r\n recipient: recipient,\r\n destinationToken: destinationToken,\r\n relayAmount: totalRelayAmount,\r\n realizedLpFeePct: realizedLpFeePct,\r\n relayerFeePct: relayerFeePct,\r\n depositId: depositId,\r\n originChainId: originChainId\r\n });\r\n bytes32 relayHash = _getRelayHash(relayData);\r\n uint256 fillAmountPreFees = _fillRelay(relayHash, relayData, maxTokensToSend, newRelayerFeePct, false);\r\n\r\n _emitFillRelay(relayHash, fillAmountPreFees, repaymentChain, newRelayerFeePct, relayData);\r\n }\r\n\r\n /**************************************\r\n * DATA WORKER FUNCTIONS *\r\n **************************************/\r\n function executeSlowRelayFulfillmentRoot(\r\n address depositor,\r\n address recipient,\r\n address destinationToken,\r\n uint256 totalRelayAmount,\r\n uint256 originChainId,\r\n uint64 realizedLpFeePct,\r\n uint64 relayerFeePct,\r\n uint32 depositId,\r\n uint32 rootBundleId,\r\n bytes32[] memory proof\r\n ) public nonReentrant {\r\n RelayData memory relayData = RelayData({\r\n depositor: depositor,\r\n recipient: recipient,\r\n destinationToken: destinationToken,\r\n relayAmount: totalRelayAmount,\r\n originChainId: originChainId,\r\n realizedLpFeePct: realizedLpFeePct,\r\n relayerFeePct: relayerFeePct,\r\n depositId: depositId\r\n });\r\n\r\n require(\r\n MerkleLib.verifySlowRelayFulfillment(rootBundles[rootBundleId].slowRelayFulfillmentRoot, relayData, proof),\r\n \"Invalid proof\"\r\n );\r\n\r\n bytes32 relayHash = _getRelayHash(relayData);\r\n\r\n // Wrap any ETH owned by this contract so we can send expected L2 token to recipient. This is neccessary because\r\n // some SpokePools will receive ETH from the canonical token bridge instead of WETH so this contract\r\n // might have built up an ETH balance.\r\n if (address(this).balance > 0) weth.deposit{ value: address(this).balance }();\r\n\r\n // Note: use relayAmount as the max amount to send, so the relay is always completely filled by the contract's\r\n // funds in all cases.\r\n uint256 fillAmountPreFees = _fillRelay(relayHash, relayData, relayData.relayAmount, relayerFeePct, true);\r\n\r\n _emitExecutedSlowRelayFulfillmentRoot(relayHash, fillAmountPreFees, relayData);\r\n }\r\n\r\n function executeRelayerRefundRoot(\r\n uint32 rootBundleId,\r\n SpokePoolInterface.RelayerRefundLeaf memory relayerRefundLeaf,\r\n bytes32[] memory proof\r\n ) public nonReentrant {\r\n // Check integrity of leaf structure:\r\n require(relayerRefundLeaf.chainId == chainId(), \"Invalid chainId\");\r\n require(relayerRefundLeaf.refundAddresses.length == relayerRefundLeaf.refundAmounts.length, \"invalid leaf\");\r\n\r\n RootBundle storage rootBundle = rootBundles[rootBundleId];\r\n\r\n // Check that `inclusionProof` proves that `relayerRefundLeaf` is contained within the relayer refund root.\r\n // Note: This should revert if the `relayerRefundRoot` is uninitialized.\r\n require(MerkleLib.verifyRelayerRefund(rootBundle.relayerRefundRoot, relayerRefundLeaf, proof), \"Bad Proof\");\r\n\r\n // Verify the leafId in the leaf has not yet been claimed.\r\n require(!MerkleLib.isClaimed(rootBundle.claimedBitmap, relayerRefundLeaf.leafId), \"Already claimed\");\r\n\r\n // Set leaf as claimed in bitmap.\r\n MerkleLib.setClaimed(rootBundle.claimedBitmap, relayerRefundLeaf.leafId);\r\n\r\n // Wrap any ETH owned by this contract so we can send expected L2 token to recipient. This is neccessary because\r\n // some SpokePools will receive ETH from the canonical token bridge instead of WETH.\r\n if (address(this).balance > 0) weth.deposit{ value: address(this).balance }();\r\n\r\n // Send each relayer refund address the associated refundAmount for the L2 token address.\r\n // Note: Even if the L2 token is not enabled on this spoke pool, we should still refund relayers.\r\n for (uint32 i = 0; i < relayerRefundLeaf.refundAmounts.length; i++) {\r\n uint256 amount = relayerRefundLeaf.refundAmounts[i];\r\n if (amount > 0)\r\n IERC20(relayerRefundLeaf.l2TokenAddress).safeTransfer(relayerRefundLeaf.refundAddresses[i], amount);\r\n }\r\n\r\n // If leaf's `amountToReturn` is positive, then send L2 --> L1 message to bridge tokens back via\r\n // chain-specific bridging method.\r\n if (relayerRefundLeaf.amountToReturn > 0) {\r\n _bridgeTokensToHubPool(relayerRefundLeaf);\r\n\r\n emit TokensBridged(\r\n relayerRefundLeaf.amountToReturn,\r\n relayerRefundLeaf.chainId,\r\n relayerRefundLeaf.leafId,\r\n relayerRefundLeaf.l2TokenAddress,\r\n msg.sender\r\n );\r\n }\r\n\r\n emit ExecutedRelayerRefundRoot(\r\n relayerRefundLeaf.amountToReturn,\r\n relayerRefundLeaf.chainId,\r\n relayerRefundLeaf.refundAmounts,\r\n rootBundleId,\r\n relayerRefundLeaf.leafId,\r\n relayerRefundLeaf.l2TokenAddress,\r\n relayerRefundLeaf.refundAddresses,\r\n msg.sender\r\n );\r\n }\r\n\r\n /**************************************\r\n * VIEW FUNCTIONS *\r\n **************************************/\r\n\r\n // Some L2s like ZKSync don't support the CHAIN_ID opcode so we allow the caller to manually set this.\r\n function chainId() public view virtual returns (uint256) {\r\n return block.chainid;\r\n }\r\n\r\n /**************************************\r\n * INTERNAL FUNCTIONS *\r\n **************************************/\r\n\r\n function _bridgeTokensToHubPool(SpokePoolInterface.RelayerRefundLeaf memory relayerRefundLeaf) internal virtual;\r\n\r\n // Allow L2 to implement chain specific recovering of signers from signatures because some L2s might not support\r\n // ecrecover, such as those with account abstraction like ZKSync.\r\n function _verifyDepositorUpdateFeeMessage(\r\n address depositor,\r\n bytes32 ethSignedMessageHash,\r\n bytes memory depositorSignature\r\n ) internal view virtual {\r\n // Note: no need to worry about reentrancy from contract deployed at `depositor` address since\r\n // `SignatureChecker.isValidSignatureNow` is a non state-modifying STATICCALL:\r\n // - https://github.com/OpenZeppelin/openzeppelin-contracts/blob/63b466901fb015538913f811c5112a2775042177/contracts/utils/cryptography/SignatureChecker.sol#L35\r\n // - https://github.com/ethereum/EIPs/pull/214\r\n require(\r\n SignatureChecker.isValidSignatureNow(depositor, ethSignedMessageHash, depositorSignature),\r\n \"invalid signature\"\r\n );\r\n }\r\n\r\n function _computeAmountPreFees(uint256 amount, uint64 feesPct) private pure returns (uint256) {\r\n return (1e18 * amount) / (1e18 - feesPct);\r\n }\r\n\r\n function _computeAmountPostFees(uint256 amount, uint64 feesPct) private pure returns (uint256) {\r\n return (amount * (1e18 - feesPct)) / 1e18;\r\n }\r\n\r\n // Should we make this public for the relayer's convenience?\r\n function _getRelayHash(SpokePoolInterface.RelayData memory relayData) private pure returns (bytes32) {\r\n return keccak256(abi.encode(relayData));\r\n }\r\n\r\n // Unwraps ETH and does a transfer to a recipient address. If the recipient is a smart contract then sends WETH.\r\n function _unwrapWETHTo(address payable to, uint256 amount) internal {\r\n if (address(to).isContract()) {\r\n IERC20(address(weth)).safeTransfer(to, amount);\r\n } else {\r\n weth.withdraw(amount);\r\n to.transfer(amount);\r\n }\r\n }\r\n\r\n // This internal method should be called by an external \"relayRootBundle\" function that validates the\r\n // cross domain sender is the HubPool. This validation step differs for each L2, which is why the implementation\r\n // specifics are left to the implementor of this abstract contract.\r\n // Once this method is executed and a distribution root is stored in this contract, then `distributeRootBundle`\r\n // can be called to execute each leaf in the root.\r\n function _relayRootBundle(bytes32 relayerRefundRoot, bytes32 slowRelayFulfillmentRoot) internal {\r\n uint32 rootBundleId = uint32(rootBundles.length);\r\n RootBundle storage rootBundle = rootBundles.push();\r\n rootBundle.relayerRefundRoot = relayerRefundRoot;\r\n rootBundle.slowRelayFulfillmentRoot = slowRelayFulfillmentRoot;\r\n emit RelayedRootBundle(rootBundleId, relayerRefundRoot, slowRelayFulfillmentRoot);\r\n }\r\n\r\n function _fillRelay(\r\n bytes32 relayHash,\r\n RelayData memory relayData,\r\n uint256 maxTokensToSend,\r\n uint64 updatableRelayerFeePct,\r\n bool isSlowRelay\r\n ) internal returns (uint256 fillAmountPreFees) {\r\n // We limit the relay fees to prevent the user spending all their funds on fees. Note that 0.5e18 (i.e. 50%)\r\n // fees are just magic numbers. The important point is to prevent the total fee from being 100%, otherwise\r\n // computing the amount pre fees runs into divide-by-0 issues.\r\n require(updatableRelayerFeePct < 0.5e18 && relayData.realizedLpFeePct < 0.5e18, \"invalid fees\");\r\n\r\n // Check that the relay has not already been completely filled. Note that the `relays` mapping will point to\r\n // the amount filled so far for a particular `relayHash`, so this will start at 0 and increment with each fill.\r\n require(relayFills[relayHash] < relayData.relayAmount, \"relay filled\");\r\n\r\n // Stores the equivalent amount to be sent by the relayer before fees have been taken out.\r\n fillAmountPreFees = 0;\r\n\r\n // Adding brackets \"stack too deep\" solidity error.\r\n if (maxTokensToSend > 0) {\r\n fillAmountPreFees = _computeAmountPreFees(\r\n maxTokensToSend,\r\n (relayData.realizedLpFeePct + updatableRelayerFeePct)\r\n );\r\n // If user's specified max amount to send is greater than the amount of the relay remaining pre-fees,\r\n // we'll pull exactly enough tokens to complete the relay.\r\n uint256 amountToSend = maxTokensToSend;\r\n if (relayData.relayAmount - relayFills[relayHash] < fillAmountPreFees) {\r\n fillAmountPreFees = relayData.relayAmount - relayFills[relayHash];\r\n amountToSend = _computeAmountPostFees(\r\n fillAmountPreFees,\r\n relayData.realizedLpFeePct + updatableRelayerFeePct\r\n );\r\n }\r\n relayFills[relayHash] += fillAmountPreFees;\r\n // If relay token is weth then unwrap and send eth.\r\n if (relayData.destinationToken == address(weth)) {\r\n // Note: WETH is already in the contract in the slow relay case.\r\n if (!isSlowRelay)\r\n IERC20(relayData.destinationToken).safeTransferFrom(msg.sender, address(this), amountToSend);\r\n _unwrapWETHTo(payable(relayData.recipient), amountToSend);\r\n // Else, this is a normal ERC20 token. Send to recipient.\r\n } else {\r\n // Note: send token directly from the contract to the user in the slow relay case.\r\n if (!isSlowRelay)\r\n IERC20(relayData.destinationToken).safeTransferFrom(msg.sender, relayData.recipient, amountToSend);\r\n else IERC20(relayData.destinationToken).safeTransfer(relayData.recipient, amountToSend);\r\n }\r\n }\r\n }\r\n\r\n function _emitFillRelay(\r\n bytes32 relayHash,\r\n uint256 fillAmount,\r\n uint256 repaymentChain,\r\n uint64 relayerFeePct,\r\n RelayData memory relayData\r\n ) internal {\r\n emit FilledRelay(\r\n relayHash,\r\n relayData.relayAmount,\r\n relayFills[relayHash],\r\n fillAmount,\r\n repaymentChain,\r\n relayData.originChainId,\r\n relayerFeePct,\r\n relayData.realizedLpFeePct,\r\n relayData.depositId,\r\n relayData.destinationToken,\r\n msg.sender,\r\n relayData.depositor,\r\n relayData.recipient\r\n );\r\n }\r\n\r\n function _emitExecutedSlowRelayFulfillmentRoot(\r\n bytes32 relayHash,\r\n uint256 fillAmount,\r\n RelayData memory relayData\r\n ) internal {\r\n emit ExecutedSlowRelayFulfillmentRoot(\r\n relayHash,\r\n relayData.relayAmount,\r\n relayFills[relayHash],\r\n fillAmount,\r\n relayData.originChainId,\r\n relayData.relayerFeePct,\r\n relayData.realizedLpFeePct,\r\n relayData.depositId,\r\n relayData.destinationToken,\r\n msg.sender,\r\n relayData.depositor,\r\n relayData.recipient\r\n );\r\n }\r\n\r\n // Added to enable the this contract to receive ETH. Used when unwrapping Weth.\r\n receive() external payable {}\r\n}\r\n" - }, - "contracts/SpokePoolInterface.sol": { - "content": "//SPDX-License-Identifier: Unlicense\r\npragma solidity ^0.8.0;\r\n\r\ninterface SpokePoolInterface {\r\n // This leaf is meant to be decoded in the SpokePool in order to pay out individual relayers for this bundle.\r\n struct RelayerRefundLeaf {\r\n // This is the amount to return to the HubPool. This occurs when there is a PoolRebalanceLeaf netSendAmount that is\r\n // negative. This is just that value inverted.\r\n uint256 amountToReturn;\r\n // Used to verify that this is being decoded on the correct chainId.\r\n uint256 chainId;\r\n // This array designates how much each of those addresses should be refunded.\r\n uint256[] refundAmounts;\r\n // Used as the index in the bitmap to track whether this leaf has been executed or not.\r\n uint32 leafId;\r\n // The associated L2TokenAddress that these claims apply to.\r\n address l2TokenAddress;\r\n // These two arrays must be the same length and are parallel arrays. They should be order by refundAddresses.\r\n // This array designates each address that must be refunded.\r\n address[] refundAddresses;\r\n }\r\n\r\n // This struct represents the data to fully-specify a relay. If any portion of this data differs, the relay is\r\n // considered to be completely distinct. Only one relay for a particular depositId, chainId pair should be\r\n // considered valid and repaid.\r\n struct RelayData {\r\n // The address that made the deposit on the origin chain.\r\n address depositor;\r\n // The recipient address on the destination chain.\r\n address recipient;\r\n // The corresponding token address on the destination chain.\r\n address destinationToken;\r\n // The total relay amount before fees are taken out.\r\n uint256 relayAmount;\r\n // Origin chain id.\r\n uint256 originChainId;\r\n // The LP Fee percentage computed by the relayer based on the deposit's quote timestamp\r\n // and the HubPool's utilization.\r\n uint64 realizedLpFeePct;\r\n // The relayer fee percentage specified in the deposit.\r\n uint64 relayerFeePct;\r\n // The id uniquely identifying this deposit on the origin chain.\r\n uint32 depositId;\r\n }\r\n\r\n function setCrossDomainAdmin(address newCrossDomainAdmin) external;\r\n\r\n function setHubPool(address newHubPool) external;\r\n\r\n function setEnableRoute(\r\n address originToken,\r\n uint256 destinationChainId,\r\n bool enable\r\n ) external;\r\n\r\n function setDepositQuoteTimeBuffer(uint32 buffer) external;\r\n\r\n function relayRootBundle(bytes32 relayerRefundRoot, bytes32 slowRelayRoot) external;\r\n}\r\n" - }, - "contracts/MerkleLib.sol": { - "content": "// SPDX-License-Identifier: GPL-3.0-only\r\npragma solidity ^0.8.0;\r\n\r\nimport \"@openzeppelin/contracts/utils/cryptography/MerkleProof.sol\";\r\nimport \"./SpokePoolInterface.sol\";\r\nimport \"./HubPoolInterface.sol\";\r\n\r\n/**\r\n * @notice Library to help with merkle roots, proofs, and claims.\r\n */\r\nlibrary MerkleLib {\r\n /**\r\n * @notice Verifies that a repayment is contained within a merkle root.\r\n * @param root the merkle root.\r\n * @param rebalance the rebalance struct.\r\n * @param proof the merkle proof.\r\n */\r\n function verifyPoolRebalance(\r\n bytes32 root,\r\n HubPoolInterface.PoolRebalanceLeaf memory rebalance,\r\n bytes32[] memory proof\r\n ) internal pure returns (bool) {\r\n return MerkleProof.verify(proof, root, keccak256(abi.encode(rebalance)));\r\n }\r\n\r\n /**\r\n * @notice Verifies that a relayer refund is contained within a merkle root.\r\n * @param root the merkle root.\r\n * @param refund the refund struct.\r\n * @param proof the merkle proof.\r\n */\r\n function verifyRelayerRefund(\r\n bytes32 root,\r\n SpokePoolInterface.RelayerRefundLeaf memory refund,\r\n bytes32[] memory proof\r\n ) internal pure returns (bool) {\r\n return MerkleProof.verify(proof, root, keccak256(abi.encode(refund)));\r\n }\r\n\r\n /**\r\n * @notice Verifies that a distribution is contained within a merkle root.\r\n * @param root the merkle root.\r\n * @param slowRelayFulfillment the relayData fulfullment struct.\r\n * @param proof the merkle proof.\r\n */\r\n function verifySlowRelayFulfillment(\r\n bytes32 root,\r\n SpokePoolInterface.RelayData memory slowRelayFulfillment,\r\n bytes32[] memory proof\r\n ) internal pure returns (bool) {\r\n return MerkleProof.verify(proof, root, keccak256(abi.encode(slowRelayFulfillment)));\r\n }\r\n\r\n // The following functions are primarily copied from\r\n // https://github.com/Uniswap/merkle-distributor/blob/master/contracts/MerkleDistributor.sol with minor changes.\r\n\r\n /**\r\n * @notice Tests whether a claim is contained within a claimedBitMap mapping.\r\n * @param claimedBitMap a simple uint256 mapping in storage used as a bitmap.\r\n * @param index the index to check in the bitmap.\r\n * @return bool indicating if the index within the claimedBitMap has been marked as claimed.\r\n */\r\n function isClaimed(mapping(uint256 => uint256) storage claimedBitMap, uint256 index) internal view returns (bool) {\r\n uint256 claimedWordIndex = index / 256;\r\n uint256 claimedBitIndex = index % 256;\r\n uint256 claimedWord = claimedBitMap[claimedWordIndex];\r\n uint256 mask = (1 << claimedBitIndex);\r\n return claimedWord & mask == mask;\r\n }\r\n\r\n /**\r\n * @notice Marks an index in a claimedBitMap as claimed.\r\n * @param claimedBitMap a simple uint256 mapping in storage used as a bitmap.\r\n * @param index the index to mark in the bitmap.\r\n */\r\n function setClaimed(mapping(uint256 => uint256) storage claimedBitMap, uint256 index) internal {\r\n uint256 claimedWordIndex = index / 256;\r\n uint256 claimedBitIndex = index % 256;\r\n claimedBitMap[claimedWordIndex] = claimedBitMap[claimedWordIndex] | (1 << claimedBitIndex);\r\n }\r\n\r\n /**\r\n * @notice Tests whether a claim is contained within a 1D claimedBitMap mapping.\r\n * @param claimedBitMap a simple uint256 value, encoding a 1D bitmap.\r\n * @param index the index to check in the bitmap.\r\n \\* @return bool indicating if the index within the claimedBitMap has been marked as claimed.\r\n */\r\n function isClaimed1D(uint256 claimedBitMap, uint256 index) internal pure returns (bool) {\r\n uint256 mask = (1 << index);\r\n return claimedBitMap & mask == mask;\r\n }\r\n\r\n /**\r\n * @notice Marks an index in a claimedBitMap as claimed.\r\n * @param claimedBitMap a simple uint256 mapping in storage used as a bitmap.\r\n * @param index the index to mark in the bitmap.\r\n */\r\n function setClaimed1D(uint256 claimedBitMap, uint256 index) internal pure returns (uint256) {\r\n require(index <= 255, \"Index out of bounds\");\r\n return claimedBitMap | (1 << index % 256);\r\n }\r\n}\r\n" - }, - "contracts/interfaces/WETH9.sol": { - "content": "// SPDX-License-Identifier: GPL-3.0-only\r\npragma solidity ^0.8.0;\r\n\r\ninterface WETH9 {\r\n function withdraw(uint256 wad) external;\r\n\r\n function deposit() external payable;\r\n\r\n function balanceOf(address guy) external view returns (uint256 wad);\r\n\r\n function transfer(address guy, uint256 wad) external;\r\n}\r\n" - }, - "@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol": { - "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts v4.4.1 (token/ERC20/utils/SafeERC20.sol)\n\npragma solidity ^0.8.0;\n\nimport \"../IERC20.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 function safeTransfer(\n IERC20 token,\n address to,\n uint256 value\n ) internal {\n _callOptionalReturn(token, abi.encodeWithSelector(token.transfer.selector, to, value));\n }\n\n function safeTransferFrom(\n IERC20 token,\n address from,\n address to,\n uint256 value\n ) 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(\n IERC20 token,\n address spender,\n uint256 value\n ) 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 function safeIncreaseAllowance(\n IERC20 token,\n address spender,\n uint256 value\n ) internal {\n uint256 newAllowance = token.allowance(address(this), spender) + value;\n _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, newAllowance));\n }\n\n function safeDecreaseAllowance(\n IERC20 token,\n address spender,\n uint256 value\n ) internal {\n unchecked {\n uint256 oldAllowance = token.allowance(address(this), spender);\n require(oldAllowance >= value, \"SafeERC20: decreased allowance below zero\");\n uint256 newAllowance = oldAllowance - value;\n _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, newAllowance));\n }\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 if (returndata.length > 0) {\n // Return data is optional\n require(abi.decode(returndata, (bool)), \"SafeERC20: ERC20 operation did not succeed\");\n }\n }\n}\n" - }, - "@openzeppelin/contracts/token/ERC20/IERC20.sol": { - "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts v4.4.1 (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 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 `recipient`.\n *\n * Returns a boolean value indicating whether the operation succeeded.\n *\n * Emits a {Transfer} event.\n */\n function transfer(address recipient, 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 `sender` to `recipient` 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(\n address sender,\n address recipient,\n uint256 amount\n ) external returns (bool);\n\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" - }, - "@openzeppelin/contracts/utils/Address.sol": { - "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts v4.4.1 (utils/Address.sol)\n\npragma solidity ^0.8.0;\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 */\n function isContract(address account) internal view returns (bool) {\n // This method relies on extcodesize, which returns 0 for contracts in\n // construction, since the code is only stored at the end of the\n // constructor execution.\n\n uint256 size;\n assembly {\n size := extcodesize(account)\n }\n return size > 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://diligence.consensys.net/posts/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.5.11/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 functionCall(target, data, \"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(\n address target,\n bytes memory data,\n uint256 value\n ) 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 require(isContract(target), \"Address: call to non-contract\");\n\n (bool success, bytes memory returndata) = target.call{value: value}(data);\n return verifyCallResult(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 require(isContract(target), \"Address: static call to non-contract\");\n\n (bool success, bytes memory returndata) = target.staticcall(data);\n return verifyCallResult(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 require(isContract(target), \"Address: delegate call to non-contract\");\n\n (bool success, bytes memory returndata) = target.delegatecall(data);\n return verifyCallResult(success, returndata, errorMessage);\n }\n\n /**\n * @dev Tool to verifies that a low level call was successful, and revert if it wasn't, either by bubbling the\n * revert reason 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 // 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\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}\n" - }, - "@openzeppelin/contracts/utils/cryptography/SignatureChecker.sol": { - "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts v4.4.1 (utils/cryptography/SignatureChecker.sol)\n\npragma solidity ^0.8.0;\n\nimport \"./ECDSA.sol\";\nimport \"../Address.sol\";\nimport \"../../interfaces/IERC1271.sol\";\n\n/**\n * @dev Signature verification helper: Provide a single mechanism to verify both private-key (EOA) ECDSA signature and\n * ERC1271 contract signatures. Using this instead of ECDSA.recover in your contract will make them compatible with\n * smart contract wallets such as Argent and Gnosis.\n *\n * Note: unlike ECDSA signatures, contract signature's are revocable, and the outcome of this function can thus change\n * through time. It could return true at block N and false at block N+1 (or the opposite).\n *\n * _Available since v4.1._\n */\nlibrary SignatureChecker {\n function isValidSignatureNow(\n address signer,\n bytes32 hash,\n bytes memory signature\n ) internal view returns (bool) {\n (address recovered, ECDSA.RecoverError error) = ECDSA.tryRecover(hash, signature);\n if (error == ECDSA.RecoverError.NoError && recovered == signer) {\n return true;\n }\n\n (bool success, bytes memory result) = signer.staticcall(\n abi.encodeWithSelector(IERC1271.isValidSignature.selector, hash, signature)\n );\n return (success && result.length == 32 && abi.decode(result, (bytes4)) == IERC1271.isValidSignature.selector);\n }\n}\n" - }, - "@openzeppelin/contracts/utils/cryptography/ECDSA.sol": { - "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts v4.4.1 (utils/cryptography/ECDSA.sol)\n\npragma solidity ^0.8.0;\n\nimport \"../Strings.sol\";\n\n/**\n * @dev Elliptic Curve Digital Signature Algorithm (ECDSA) operations.\n *\n * These functions can be used to verify that a message was signed by the holder\n * of the private keys of a given address.\n */\nlibrary ECDSA {\n enum RecoverError {\n NoError,\n InvalidSignature,\n InvalidSignatureLength,\n InvalidSignatureS,\n InvalidSignatureV\n }\n\n function _throwError(RecoverError error) private pure {\n if (error == RecoverError.NoError) {\n return; // no error: do nothing\n } else if (error == RecoverError.InvalidSignature) {\n revert(\"ECDSA: invalid signature\");\n } else if (error == RecoverError.InvalidSignatureLength) {\n revert(\"ECDSA: invalid signature length\");\n } else if (error == RecoverError.InvalidSignatureS) {\n revert(\"ECDSA: invalid signature 's' value\");\n } else if (error == RecoverError.InvalidSignatureV) {\n revert(\"ECDSA: invalid signature 'v' value\");\n }\n }\n\n /**\n * @dev Returns the address that signed a hashed message (`hash`) with\n * `signature` or error string. This address can then be used for verification purposes.\n *\n * The `ecrecover` EVM opcode allows for malleable (non-unique) signatures:\n * this function rejects them by requiring the `s` value to be in the lower\n * half order, and the `v` value to be either 27 or 28.\n *\n * IMPORTANT: `hash` _must_ be the result of a hash operation for the\n * verification to be secure: it is possible to craft signatures that\n * recover to arbitrary addresses for non-hashed data. A safe way to ensure\n * this is by receiving a hash of the original message (which may otherwise\n * be too long), and then calling {toEthSignedMessageHash} on it.\n *\n * Documentation for signature generation:\n * - with https://web3js.readthedocs.io/en/v1.3.4/web3-eth-accounts.html#sign[Web3.js]\n * - with https://docs.ethers.io/v5/api/signer/#Signer-signMessage[ethers]\n *\n * _Available since v4.3._\n */\n function tryRecover(bytes32 hash, bytes memory signature) internal pure returns (address, RecoverError) {\n // Check the signature length\n // - case 65: r,s,v signature (standard)\n // - case 64: r,vs signature (cf https://eips.ethereum.org/EIPS/eip-2098) _Available since v4.1._\n if (signature.length == 65) {\n bytes32 r;\n bytes32 s;\n uint8 v;\n // ecrecover takes the signature parameters, and the only way to get them\n // currently is to use assembly.\n assembly {\n r := mload(add(signature, 0x20))\n s := mload(add(signature, 0x40))\n v := byte(0, mload(add(signature, 0x60)))\n }\n return tryRecover(hash, v, r, s);\n } else if (signature.length == 64) {\n bytes32 r;\n bytes32 vs;\n // ecrecover takes the signature parameters, and the only way to get them\n // currently is to use assembly.\n assembly {\n r := mload(add(signature, 0x20))\n vs := mload(add(signature, 0x40))\n }\n return tryRecover(hash, r, vs);\n } else {\n return (address(0), RecoverError.InvalidSignatureLength);\n }\n }\n\n /**\n * @dev Returns the address that signed a hashed message (`hash`) with\n * `signature`. This address can then be used for verification purposes.\n *\n * The `ecrecover` EVM opcode allows for malleable (non-unique) signatures:\n * this function rejects them by requiring the `s` value to be in the lower\n * half order, and the `v` value to be either 27 or 28.\n *\n * IMPORTANT: `hash` _must_ be the result of a hash operation for the\n * verification to be secure: it is possible to craft signatures that\n * recover to arbitrary addresses for non-hashed data. A safe way to ensure\n * this is by receiving a hash of the original message (which may otherwise\n * be too long), and then calling {toEthSignedMessageHash} on it.\n */\n function recover(bytes32 hash, bytes memory signature) internal pure returns (address) {\n (address recovered, RecoverError error) = tryRecover(hash, signature);\n _throwError(error);\n return recovered;\n }\n\n /**\n * @dev Overload of {ECDSA-tryRecover} that receives the `r` and `vs` short-signature fields separately.\n *\n * See https://eips.ethereum.org/EIPS/eip-2098[EIP-2098 short signatures]\n *\n * _Available since v4.3._\n */\n function tryRecover(\n bytes32 hash,\n bytes32 r,\n bytes32 vs\n ) internal pure returns (address, RecoverError) {\n bytes32 s;\n uint8 v;\n assembly {\n s := and(vs, 0x7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff)\n v := add(shr(255, vs), 27)\n }\n return tryRecover(hash, v, r, s);\n }\n\n /**\n * @dev Overload of {ECDSA-recover} that receives the `r and `vs` short-signature fields separately.\n *\n * _Available since v4.2._\n */\n function recover(\n bytes32 hash,\n bytes32 r,\n bytes32 vs\n ) internal pure returns (address) {\n (address recovered, RecoverError error) = tryRecover(hash, r, vs);\n _throwError(error);\n return recovered;\n }\n\n /**\n * @dev Overload of {ECDSA-tryRecover} that receives the `v`,\n * `r` and `s` signature fields separately.\n *\n * _Available since v4.3._\n */\n function tryRecover(\n bytes32 hash,\n uint8 v,\n bytes32 r,\n bytes32 s\n ) internal pure returns (address, RecoverError) {\n // EIP-2 still allows signature malleability for ecrecover(). Remove this possibility and make the signature\n // unique. Appendix F in the Ethereum Yellow paper (https://ethereum.github.io/yellowpaper/paper.pdf), defines\n // the valid range for s in (301): 0 < s < secp256k1n ÷ 2 + 1, and for v in (302): v ∈ {27, 28}. Most\n // signatures from current libraries generate a unique signature with an s-value in the lower half order.\n //\n // If your library generates malleable signatures, such as s-values in the upper range, calculate a new s-value\n // with 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFEBAAEDCE6AF48A03BBFD25E8CD0364141 - s1 and flip v from 27 to 28 or\n // vice versa. If your library also generates signatures with 0/1 for v instead 27/28, add 27 to v to accept\n // these malleable signatures as well.\n if (uint256(s) > 0x7FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF5D576E7357A4501DDFE92F46681B20A0) {\n return (address(0), RecoverError.InvalidSignatureS);\n }\n if (v != 27 && v != 28) {\n return (address(0), RecoverError.InvalidSignatureV);\n }\n\n // If the signature is valid (and not malleable), return the signer address\n address signer = ecrecover(hash, v, r, s);\n if (signer == address(0)) {\n return (address(0), RecoverError.InvalidSignature);\n }\n\n return (signer, RecoverError.NoError);\n }\n\n /**\n * @dev Overload of {ECDSA-recover} that receives the `v`,\n * `r` and `s` signature fields separately.\n */\n function recover(\n bytes32 hash,\n uint8 v,\n bytes32 r,\n bytes32 s\n ) internal pure returns (address) {\n (address recovered, RecoverError error) = tryRecover(hash, v, r, s);\n _throwError(error);\n return recovered;\n }\n\n /**\n * @dev Returns an Ethereum Signed Message, created from a `hash`. This\n * produces hash corresponding to the one signed with the\n * https://eth.wiki/json-rpc/API#eth_sign[`eth_sign`]\n * JSON-RPC method as part of EIP-191.\n *\n * See {recover}.\n */\n function toEthSignedMessageHash(bytes32 hash) internal pure returns (bytes32) {\n // 32 is the length in bytes of hash,\n // enforced by the type signature above\n return keccak256(abi.encodePacked(\"\\x19Ethereum Signed Message:\\n32\", hash));\n }\n\n /**\n * @dev Returns an Ethereum Signed Message, created from `s`. This\n * produces hash corresponding to the one signed with the\n * https://eth.wiki/json-rpc/API#eth_sign[`eth_sign`]\n * JSON-RPC method as part of EIP-191.\n *\n * See {recover}.\n */\n function toEthSignedMessageHash(bytes memory s) internal pure returns (bytes32) {\n return keccak256(abi.encodePacked(\"\\x19Ethereum Signed Message:\\n\", Strings.toString(s.length), s));\n }\n\n /**\n * @dev Returns an Ethereum Signed Typed Data, created from a\n * `domainSeparator` and a `structHash`. This produces hash corresponding\n * to the one signed with the\n * https://eips.ethereum.org/EIPS/eip-712[`eth_signTypedData`]\n * JSON-RPC method as part of EIP-712.\n *\n * See {recover}.\n */\n function toTypedDataHash(bytes32 domainSeparator, bytes32 structHash) internal pure returns (bytes32) {\n return keccak256(abi.encodePacked(\"\\x19\\x01\", domainSeparator, structHash));\n }\n}\n" - }, - "@uma/core/contracts/common/implementation/Testable.sol": { - "content": "// SPDX-License-Identifier: AGPL-3.0-only\npragma solidity ^0.8.0;\n\nimport \"./Timer.sol\";\n\n/**\n * @title Base class that provides time overrides, but only if being run in test mode.\n */\nabstract contract Testable {\n // If the contract is being run in production, then `timerAddress` will be the 0x0 address.\n // Note: this variable should be set on construction and never modified.\n address public timerAddress;\n\n /**\n * @notice Constructs the Testable contract. Called by child contracts.\n * @param _timerAddress Contract that stores the current time in a testing environment.\n * Must be set to 0x0 for production environments that use live time.\n */\n constructor(address _timerAddress) {\n timerAddress = _timerAddress;\n }\n\n /**\n * @notice Reverts if not running in test mode.\n */\n modifier onlyIfTest {\n require(timerAddress != address(0x0));\n _;\n }\n\n /**\n * @notice Sets the current time.\n * @dev Will revert if not running in test mode.\n * @param time timestamp to set current Testable time to.\n */\n function setCurrentTime(uint256 time) external onlyIfTest {\n Timer(timerAddress).setCurrentTime(time);\n }\n\n /**\n * @notice Gets the current time. Will return the last time set in `setCurrentTime` if running in test mode.\n * Otherwise, it will return the block timestamp.\n * @return uint for the current Testable timestamp.\n */\n function getCurrentTime() public view virtual returns (uint256) {\n if (timerAddress != address(0x0)) {\n return Timer(timerAddress).getCurrentTime();\n } else {\n return block.timestamp; // solhint-disable-line not-rely-on-time\n }\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" - }, - "@uma/core/contracts/common/implementation/MultiCaller.sol": { - "content": "// This contract is taken from Uniswaps'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.\npragma solidity ^0.8.0;\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 payable returns (bytes[] memory results) {\n require(msg.value == 0, \"Only multicall with 0 value\");\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" - }, - "@openzeppelin/contracts/utils/cryptography/MerkleProof.sol": { - "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts v4.4.1 (utils/cryptography/MerkleProof.sol)\n\npragma solidity ^0.8.0;\n\n/**\n * @dev These functions deal with verification of Merkle Trees proofs.\n *\n * The proofs can be generated using the JavaScript library\n * https://github.com/miguelmota/merkletreejs[merkletreejs].\n * Note: the hashing algorithm should be keccak256 and pair sorting should be enabled.\n *\n * See `test/utils/cryptography/MerkleProof.test.js` for some examples.\n */\nlibrary MerkleProof {\n /**\n * @dev Returns true if a `leaf` can be proved to be a part of a Merkle tree\n * defined by `root`. For this, a `proof` must be provided, containing\n * sibling hashes on the branch from the leaf to the root of the tree. Each\n * pair of leaves and each pair of pre-images are assumed to be sorted.\n */\n function verify(\n bytes32[] memory proof,\n bytes32 root,\n bytes32 leaf\n ) internal pure returns (bool) {\n return processProof(proof, leaf) == root;\n }\n\n /**\n * @dev Returns the rebuilt hash obtained by traversing a Merklee tree up\n * from `leaf` using `proof`. A `proof` is valid if and only if the rebuilt\n * hash matches the root of the tree. When processing the proof, the pairs\n * of leafs & pre-images are assumed to be sorted.\n *\n * _Available since v4.4._\n */\n function processProof(bytes32[] memory proof, bytes32 leaf) internal pure returns (bytes32) {\n bytes32 computedHash = leaf;\n for (uint256 i = 0; i < proof.length; i++) {\n bytes32 proofElement = proof[i];\n if (computedHash <= proofElement) {\n // Hash(current computed hash + current element of the proof)\n computedHash = keccak256(abi.encodePacked(computedHash, proofElement));\n } else {\n // Hash(current element of the proof + current computed hash)\n computedHash = keccak256(abi.encodePacked(proofElement, computedHash));\n }\n }\n return computedHash;\n }\n}\n" - }, - "contracts/HubPoolInterface.sol": { - "content": "// SPDX-License-Identifier: GPL-3.0-only\r\npragma solidity ^0.8.0;\r\n\r\nimport \"@openzeppelin/contracts/token/ERC20/IERC20.sol\";\r\nimport \"./interfaces/AdapterInterface.sol\";\r\n\r\ninterface HubPoolInterface {\r\n struct PoolRebalanceLeaf {\r\n // This is used to know which chain to send cross-chain transactions to (and which SpokePool to sent to).\r\n uint256 chainId;\r\n uint256[] bundleLpFees; // Total LP fee amount per token in this bundle, encompassing all associated bundled relays.\r\n // This array is grouped with the two above, and it represents the amount to send or request back from the\r\n // SpokePool. If positive, the pool will pay the SpokePool. If negative the SpokePool will pay the HubPool.\r\n // There can be arbitrarily complex rebalancing rules defined offchain. This number is only nonzero\r\n // when the rules indicate that a rebalancing action should occur. When a rebalance does not occur,\r\n // runningBalances for this token should change by the total relays - deposits in this bundle. When a rebalance\r\n // does occur, runningBalances should be set to zero for this token and the netSendAmounts should be set to the\r\n // previous runningBalances + relays - deposits in this bundle.\r\n int256[] netSendAmounts;\r\n // This is only here to be emitted in an event to track a running unpaid balance between the L2 pool and the L1 pool.\r\n // A positive number indicates that the HubPool owes the SpokePool funds. A negative number indicates that the\r\n // SpokePool owes the HubPool funds. See the comment above for the dynamics of this and netSendAmounts\r\n int256[] runningBalances;\r\n // Used as the index in the bitmap to track whether this leaf has been executed or not.\r\n uint8 leafId;\r\n // The following arrays are required to be the same length. They are parallel arrays for the given chainId and should be ordered by the `l1Tokens` field.\r\n // All whitelisted tokens with nonzero relays on this chain in this bundle in the order of whitelisting.\r\n address[] l1Tokens;\r\n }\r\n\r\n function setBond(IERC20 newBondToken, uint256 newBondAmount) external;\r\n\r\n function setCrossChainContracts(\r\n uint256 l2ChainId,\r\n address adapter,\r\n address spokePool\r\n ) external;\r\n\r\n function whitelistRoute(\r\n uint256 originChainId,\r\n uint256 destinationChainId,\r\n address originToken,\r\n address destinationToken\r\n ) external;\r\n\r\n function enableL1TokenForLiquidityProvision(address l1Token) external;\r\n\r\n function disableL1TokenForLiquidityProvision(address l1Token) external;\r\n\r\n function addLiquidity(address l1Token, uint256 l1TokenAmount) external payable;\r\n\r\n function removeLiquidity(\r\n address l1Token,\r\n uint256 lpTokenAmount,\r\n bool sendEth\r\n ) external;\r\n\r\n function exchangeRateCurrent(address l1Token) external returns (uint256);\r\n\r\n function liquidityUtilizationPostRelay(address token, uint256 relayedAmount) external returns (uint256);\r\n\r\n function proposeRootBundle(\r\n uint256[] memory bundleEvaluationBlockNumbers,\r\n uint8 poolRebalanceLeafCount,\r\n bytes32 poolRebalanceRoot,\r\n bytes32 relayerRefundRoot,\r\n bytes32 slowRelayFulfillmentRoot\r\n ) external;\r\n\r\n function executeRootBundle(PoolRebalanceLeaf memory poolRebalanceLeaf, bytes32[] memory proof) external;\r\n\r\n function disputeRootBundle() external;\r\n}\r\n" - }, - "contracts/interfaces/AdapterInterface.sol": { - "content": "// SPDX-License-Identifier: AGPL-3.0-only\npragma solidity ^0.8.0;\n\n/**\n * @notice Sends cross chain messages and tokens to contracts on a specific L2 network.\n */\n\ninterface AdapterInterface {\n event HubPoolChanged(address newHubPool);\n\n event MessageRelayed(address target, bytes message);\n\n event TokensRelayed(address l1Token, address l2Token, uint256 amount, address to);\n\n function relayMessage(address target, bytes memory message) external payable;\n\n function relayTokens(\n address l1Token,\n address l2Token,\n uint256 amount,\n address to\n ) external payable;\n}\n" - }, - "@openzeppelin/contracts/interfaces/IERC1271.sol": { - "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts v4.4.1 (interfaces/IERC1271.sol)\n\npragma solidity ^0.8.0;\n\n/**\n * @dev Interface of the ERC1271 standard signature validation method for\n * contracts as defined in https://eips.ethereum.org/EIPS/eip-1271[ERC-1271].\n *\n * _Available since v4.1._\n */\ninterface IERC1271 {\n /**\n * @dev Should return whether the signature provided is valid for the provided data\n * @param hash Hash of the data to be signed\n * @param signature Signature byte array associated with _data\n */\n function isValidSignature(bytes32 hash, bytes memory signature) external view returns (bytes4 magicValue);\n}\n" - }, - "@openzeppelin/contracts/utils/Strings.sol": { - "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts v4.4.1 (utils/Strings.sol)\n\npragma solidity ^0.8.0;\n\n/**\n * @dev String operations.\n */\nlibrary Strings {\n bytes16 private constant _HEX_SYMBOLS = \"0123456789abcdef\";\n\n /**\n * @dev Converts a `uint256` to its ASCII `string` decimal representation.\n */\n function toString(uint256 value) internal pure returns (string memory) {\n // Inspired by OraclizeAPI's implementation - MIT licence\n // https://github.com/oraclize/ethereum-api/blob/b42146b063c7d6ee1358846c198246239e9360e8/oraclizeAPI_0.4.25.sol\n\n if (value == 0) {\n return \"0\";\n }\n uint256 temp = value;\n uint256 digits;\n while (temp != 0) {\n digits++;\n temp /= 10;\n }\n bytes memory buffer = new bytes(digits);\n while (value != 0) {\n digits -= 1;\n buffer[digits] = bytes1(uint8(48 + uint256(value % 10)));\n value /= 10;\n }\n return string(buffer);\n }\n\n /**\n * @dev Converts a `uint256` to its ASCII `string` hexadecimal representation.\n */\n function toHexString(uint256 value) internal pure returns (string memory) {\n if (value == 0) {\n return \"0x00\";\n }\n uint256 temp = value;\n uint256 length = 0;\n while (temp != 0) {\n length++;\n temp >>= 8;\n }\n return toHexString(value, length);\n }\n\n /**\n * @dev Converts a `uint256` to its ASCII `string` hexadecimal representation with fixed length.\n */\n function toHexString(uint256 value, uint256 length) internal pure returns (string memory) {\n bytes memory buffer = new bytes(2 * length + 2);\n buffer[0] = \"0\";\n buffer[1] = \"x\";\n for (uint256 i = 2 * length + 1; i > 1; --i) {\n buffer[i] = _HEX_SYMBOLS[value & 0xf];\n value >>= 4;\n }\n require(value == 0, \"Strings: hex length insufficient\");\n return string(buffer);\n }\n}\n" - }, - "@uma/core/contracts/common/implementation/Timer.sol": { - "content": "// SPDX-License-Identifier: AGPL-3.0-only\npragma solidity ^0.8.0;\n\n/**\n * @title Universal store of current contract time for testing environments.\n */\ncontract Timer {\n uint256 private currentTime;\n\n constructor() {\n currentTime = block.timestamp; // solhint-disable-line not-rely-on-time\n }\n\n /**\n * @notice Sets the current time.\n * @dev Will revert if not running in test mode.\n * @param time timestamp to set `currentTime` to.\n */\n function setCurrentTime(uint256 time) external {\n currentTime = time;\n }\n\n /**\n * @notice Gets the currentTime variable set in the Timer.\n * @return uint256 for the current Testable timestamp.\n */\n function getCurrentTime() public view returns (uint256) {\n return currentTime;\n }\n}\n" - }, - "contracts/test/MockSpokePool.sol": { - "content": "//SPDX-License-Identifier: Unlicense\r\npragma solidity ^0.8.0;\r\n\r\nimport \"../SpokePool.sol\";\r\nimport \"../SpokePoolInterface.sol\";\r\n\r\n/**\r\n * @title MockSpokePool\r\n * @notice Implements admin internal methods to test internal logic.\r\n */\r\ncontract MockSpokePool is SpokePoolInterface, SpokePool {\r\n constructor(\r\n address _crossDomainAdmin,\r\n address _hubPool,\r\n address _wethAddress,\r\n address timerAddress\r\n ) SpokePool(_crossDomainAdmin, _hubPool, _wethAddress, timerAddress) {}\r\n\r\n function setCrossDomainAdmin(address newCrossDomainAdmin) public override {\r\n _setCrossDomainAdmin(newCrossDomainAdmin);\r\n }\r\n\r\n function setHubPool(address newHubPool) public override {\r\n _setHubPool(newHubPool);\r\n }\r\n\r\n function setEnableRoute(\r\n address originToken,\r\n uint256 destinationChainId,\r\n bool enable\r\n ) public override {\r\n _setEnableRoute(originToken, destinationChainId, enable);\r\n }\r\n\r\n function setDepositQuoteTimeBuffer(uint32 buffer) public override {\r\n _setDepositQuoteTimeBuffer(buffer);\r\n }\r\n\r\n function relayRootBundle(bytes32 relayerRefundRoot, bytes32 slowRelayFulfillmentRoot) public override {\r\n _relayRootBundle(relayerRefundRoot, slowRelayFulfillmentRoot);\r\n }\r\n\r\n function _bridgeTokensToHubPool(RelayerRefundLeaf memory relayerRefundLeaf) internal override {}\r\n}\r\n" - }, - "contracts/Optimism_SpokePool.sol": { - "content": "//SPDX-License-Identifier: Unlicense\r\npragma solidity ^0.8.0;\r\n\r\nimport \"./interfaces/WETH9.sol\";\r\n\r\nimport \"@eth-optimism/contracts/libraries/bridge/CrossDomainEnabled.sol\";\r\nimport \"@eth-optimism/contracts/libraries/constants/Lib_PredeployAddresses.sol\";\r\nimport \"@eth-optimism/contracts/L2/messaging/IL2ERC20Bridge.sol\";\r\nimport \"./SpokePool.sol\";\r\nimport \"./SpokePoolInterface.sol\";\r\n\r\n/**\r\n * @notice OVM specific SpokePool.\r\n * @dev Uses OVM cross-domain-enabled logic for access control.\r\n */\r\n\r\ncontract Optimism_SpokePool is CrossDomainEnabled, SpokePoolInterface, SpokePool {\r\n // \"l1Gas\" parameter used in call to bridge tokens from this contract back to L1 via `IL2ERC20Bridge`.\r\n uint32 public l1Gas = 5_000_000;\r\n\r\n address public l2Eth = address(Lib_PredeployAddresses.OVM_ETH);\r\n\r\n event OptimismTokensBridged(address indexed l2Token, address target, uint256 numberOfTokensBridged, uint256 l1Gas);\r\n event SetL1Gas(uint32 indexed newL1Gas);\r\n\r\n constructor(\r\n address _crossDomainAdmin,\r\n address _hubPool,\r\n address timerAddress\r\n )\r\n CrossDomainEnabled(Lib_PredeployAddresses.L2_CROSS_DOMAIN_MESSENGER)\r\n SpokePool(_crossDomainAdmin, _hubPool, 0x4200000000000000000000000000000000000006, timerAddress)\r\n {}\r\n\r\n /**************************************\r\n * CROSS-CHAIN ADMIN FUNCTIONS *\r\n **************************************/\r\n\r\n function setL1GasLimit(uint32 newl1Gas) public onlyFromCrossDomainAccount(crossDomainAdmin) {\r\n _setL1GasLimit(newl1Gas);\r\n }\r\n\r\n function setCrossDomainAdmin(address newCrossDomainAdmin)\r\n public\r\n override\r\n onlyFromCrossDomainAccount(crossDomainAdmin)\r\n nonReentrant\r\n {\r\n _setCrossDomainAdmin(newCrossDomainAdmin);\r\n }\r\n\r\n function setHubPool(address newHubPool) public override onlyFromCrossDomainAccount(crossDomainAdmin) nonReentrant {\r\n _setHubPool(newHubPool);\r\n }\r\n\r\n function setEnableRoute(\r\n address originToken,\r\n uint256 destinationChainId,\r\n bool enable\r\n ) public override onlyFromCrossDomainAccount(crossDomainAdmin) nonReentrant {\r\n _setEnableRoute(originToken, destinationChainId, enable);\r\n }\r\n\r\n function setDepositQuoteTimeBuffer(uint32 buffer)\r\n public\r\n override\r\n onlyFromCrossDomainAccount(crossDomainAdmin)\r\n nonReentrant\r\n {\r\n _setDepositQuoteTimeBuffer(buffer);\r\n }\r\n\r\n function relayRootBundle(bytes32 relayerRefundRoot, bytes32 slowRelayFulfillmentRoot)\r\n public\r\n override\r\n onlyFromCrossDomainAccount(crossDomainAdmin)\r\n nonReentrant\r\n {\r\n _relayRootBundle(relayerRefundRoot, slowRelayFulfillmentRoot);\r\n }\r\n\r\n /**************************************\r\n * INTERNAL FUNCTIONS *\r\n **************************************/\r\n\r\n function _setL1GasLimit(uint32 _l1Gas) internal {\r\n l1Gas = _l1Gas;\r\n emit SetL1Gas(l1Gas);\r\n }\r\n\r\n function _bridgeTokensToHubPool(RelayerRefundLeaf memory relayerRefundLeaf) internal override {\r\n // If the token being bridged is WETH then we need to first unwrap it to ETH and then send ETH over the\r\n // canonical bridge. On Optimism, this is address 0xDeadDeAddeAddEAddeadDEaDDEAdDeaDDeAD0000.\r\n if (relayerRefundLeaf.l2TokenAddress == address(weth)) {\r\n WETH9(relayerRefundLeaf.l2TokenAddress).withdraw(relayerRefundLeaf.amountToReturn); // Unwrap ETH.\r\n relayerRefundLeaf.l2TokenAddress = l2Eth; // Set the l2TokenAddress to ETH.\r\n }\r\n IL2ERC20Bridge(Lib_PredeployAddresses.L2_STANDARD_BRIDGE).withdrawTo(\r\n relayerRefundLeaf.l2TokenAddress, // _l2Token. Address of the L2 token to bridge over.\r\n hubPool, // _to. Withdraw, over the bridge, to the l1 pool contract.\r\n relayerRefundLeaf.amountToReturn, // _amount.\r\n l1Gas, // _l1Gas. Unused, but included for potential forward compatibility considerations\r\n \"\" // _data. We don't need to send any data for the bridging action.\r\n );\r\n\r\n emit OptimismTokensBridged(relayerRefundLeaf.l2TokenAddress, hubPool, relayerRefundLeaf.amountToReturn, l1Gas);\r\n }\r\n}\r\n" - }, - "@eth-optimism/contracts/libraries/bridge/CrossDomainEnabled.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma solidity >0.5.0 <0.9.0;\n\n/* Interface Imports */\nimport { ICrossDomainMessenger } from \"./ICrossDomainMessenger.sol\";\n\n/**\n * @title CrossDomainEnabled\n * @dev Helper contract for contracts performing cross-domain communications\n *\n * Compiler used: defined by inheriting contract\n */\ncontract CrossDomainEnabled {\n /*************\n * Variables *\n *************/\n\n // Messenger contract used to send and recieve messages from the other domain.\n address public messenger;\n\n /***************\n * Constructor *\n ***************/\n\n /**\n * @param _messenger Address of the CrossDomainMessenger on the current layer.\n */\n constructor(address _messenger) {\n messenger = _messenger;\n }\n\n /**********************\n * Function Modifiers *\n **********************/\n\n /**\n * Enforces that the modified function is only callable by a specific cross-domain account.\n * @param _sourceDomainAccount The only account on the originating domain which is\n * authenticated to call this function.\n */\n modifier onlyFromCrossDomainAccount(address _sourceDomainAccount) {\n require(\n msg.sender == address(getCrossDomainMessenger()),\n \"OVM_XCHAIN: messenger contract unauthenticated\"\n );\n\n require(\n getCrossDomainMessenger().xDomainMessageSender() == _sourceDomainAccount,\n \"OVM_XCHAIN: wrong sender of cross-domain message\"\n );\n\n _;\n }\n\n /**********************\n * Internal Functions *\n **********************/\n\n /**\n * Gets the messenger, usually from storage. This function is exposed in case a child contract\n * needs to override.\n * @return The address of the cross-domain messenger contract which should be used.\n */\n function getCrossDomainMessenger() internal virtual returns (ICrossDomainMessenger) {\n return ICrossDomainMessenger(messenger);\n }\n\n /**q\n * Sends a message to an account on another domain\n * @param _crossDomainTarget The intended recipient on the destination domain\n * @param _message The data to send to the target (usually calldata to a function with\n * `onlyFromCrossDomainAccount()`)\n * @param _gasLimit The gasLimit for the receipt of the message on the target domain.\n */\n function sendCrossDomainMessage(\n address _crossDomainTarget,\n uint32 _gasLimit,\n bytes memory _message\n ) internal {\n // slither-disable-next-line reentrancy-events, reentrancy-benign\n getCrossDomainMessenger().sendMessage(_crossDomainTarget, _message, _gasLimit);\n }\n}\n" - }, - "@eth-optimism/contracts/libraries/constants/Lib_PredeployAddresses.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.9;\n\n/**\n * @title Lib_PredeployAddresses\n */\nlibrary Lib_PredeployAddresses {\n address internal constant L2_TO_L1_MESSAGE_PASSER = 0x4200000000000000000000000000000000000000;\n address internal constant L1_MESSAGE_SENDER = 0x4200000000000000000000000000000000000001;\n address internal constant DEPLOYER_WHITELIST = 0x4200000000000000000000000000000000000002;\n address payable internal constant OVM_ETH = payable(0xDeadDeAddeAddEAddeadDEaDDEAdDeaDDeAD0000);\n address internal constant L2_CROSS_DOMAIN_MESSENGER =\n 0x4200000000000000000000000000000000000007;\n address internal constant LIB_ADDRESS_MANAGER = 0x4200000000000000000000000000000000000008;\n address internal constant PROXY_EOA = 0x4200000000000000000000000000000000000009;\n address internal constant L2_STANDARD_BRIDGE = 0x4200000000000000000000000000000000000010;\n address internal constant SEQUENCER_FEE_WALLET = 0x4200000000000000000000000000000000000011;\n address internal constant L2_STANDARD_TOKEN_FACTORY =\n 0x4200000000000000000000000000000000000012;\n address internal constant L1_BLOCK_NUMBER = 0x4200000000000000000000000000000000000013;\n}\n" - }, - "@eth-optimism/contracts/L2/messaging/IL2ERC20Bridge.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.9;\n\n/**\n * @title IL2ERC20Bridge\n */\ninterface IL2ERC20Bridge {\n /**********\n * Events *\n **********/\n\n event WithdrawalInitiated(\n address indexed _l1Token,\n address indexed _l2Token,\n address indexed _from,\n address _to,\n uint256 _amount,\n bytes _data\n );\n\n event DepositFinalized(\n address indexed _l1Token,\n address indexed _l2Token,\n address indexed _from,\n address _to,\n uint256 _amount,\n bytes _data\n );\n\n event DepositFailed(\n address indexed _l1Token,\n address indexed _l2Token,\n address indexed _from,\n address _to,\n uint256 _amount,\n bytes _data\n );\n\n /********************\n * Public Functions *\n ********************/\n\n /**\n * @dev get the address of the corresponding L1 bridge contract.\n * @return Address of the corresponding L1 bridge contract.\n */\n function l1TokenBridge() external returns (address);\n\n /**\n * @dev initiate a withdraw of some tokens to the caller's account on L1\n * @param _l2Token Address of L2 token where withdrawal was initiated.\n * @param _amount Amount of the token to withdraw.\n * param _l1Gas Unused, but included for potential forward compatibility considerations.\n * @param _data Optional data to forward to L1. This data is provided\n * solely as a convenience for external contracts. Aside from enforcing a maximum\n * length, these contracts provide no guarantees about its content.\n */\n function withdraw(\n address _l2Token,\n uint256 _amount,\n uint32 _l1Gas,\n bytes calldata _data\n ) external;\n\n /**\n * @dev initiate a withdraw of some token to a recipient's account on L1.\n * @param _l2Token Address of L2 token where withdrawal is initiated.\n * @param _to L1 adress to credit the withdrawal to.\n * @param _amount Amount of the token to withdraw.\n * param _l1Gas Unused, but included for potential forward compatibility considerations.\n * @param _data Optional data to forward to L1. This data is provided\n * solely as a convenience for external contracts. Aside from enforcing a maximum\n * length, these contracts provide no guarantees about its content.\n */\n function withdrawTo(\n address _l2Token,\n address _to,\n uint256 _amount,\n uint32 _l1Gas,\n bytes calldata _data\n ) external;\n\n /*************************\n * Cross-chain Functions *\n *************************/\n\n /**\n * @dev Complete a deposit from L1 to L2, and credits funds to the recipient's balance of this\n * L2 token. This call will fail if it did not originate from a corresponding deposit in\n * L1StandardTokenBridge.\n * @param _l1Token Address for the l1 token this is called with\n * @param _l2Token Address for the l2 token this is called with\n * @param _from Account to pull the deposit from on L2.\n * @param _to Address to receive the withdrawal at\n * @param _amount Amount of the token to withdraw\n * @param _data Data provider by the sender on L1. This data is provided\n * solely as a convenience for external contracts. Aside from enforcing a maximum\n * length, these contracts provide no guarantees about its content.\n */\n function finalizeDeposit(\n address _l1Token,\n address _l2Token,\n address _from,\n address _to,\n uint256 _amount,\n bytes calldata _data\n ) external;\n}\n" - }, - "@eth-optimism/contracts/libraries/bridge/ICrossDomainMessenger.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma solidity >0.5.0 <0.9.0;\n\n/**\n * @title ICrossDomainMessenger\n */\ninterface ICrossDomainMessenger {\n /**********\n * Events *\n **********/\n\n event SentMessage(\n address indexed target,\n address sender,\n bytes message,\n uint256 messageNonce,\n uint256 gasLimit\n );\n event RelayedMessage(bytes32 indexed msgHash);\n event FailedRelayedMessage(bytes32 indexed msgHash);\n\n /*************\n * Variables *\n *************/\n\n function xDomainMessageSender() external view returns (address);\n\n /********************\n * Public Functions *\n ********************/\n\n /**\n * Sends a cross domain message to the target messenger.\n * @param _target Target contract address.\n * @param _message Message to send to the target.\n * @param _gasLimit Gas limit for the provided message.\n */\n function sendMessage(\n address _target,\n bytes calldata _message,\n uint32 _gasLimit\n ) external;\n}\n" - }, - "contracts/chain-adapters/Optimism_Adapter.sol": { - "content": "// SPDX-License-Identifier: AGPL-3.0-only\r\npragma solidity ^0.8.0;\r\n\r\nimport \"./Base_Adapter.sol\";\r\nimport \"../interfaces/AdapterInterface.sol\";\r\nimport \"../interfaces/WETH9.sol\";\r\n\r\nimport \"@eth-optimism/contracts/libraries/bridge/CrossDomainEnabled.sol\";\r\nimport \"@eth-optimism/contracts/L1/messaging/IL1StandardBridge.sol\";\r\n\r\nimport \"@uma/core/contracts/common/implementation/Lockable.sol\";\r\n\r\nimport \"@openzeppelin/contracts/token/ERC20/IERC20.sol\";\r\n\r\n/**\r\n * @notice Sends cross chain messages Optimism L2 network.\r\n * @dev This contract's owner should be set to the some multisig or admin contract. The Owner can simply set the L2 gas\r\n * and the HubPool. The HubPool is the only contract that can relay tokens and messages over the bridge.\r\n */\r\ncontract Optimism_Adapter is Base_Adapter, CrossDomainEnabled, Lockable {\r\n uint32 public l2GasLimit = 5_000_000;\r\n\r\n WETH9 public l1Weth;\r\n\r\n IL1StandardBridge public l1StandardBridge;\r\n\r\n event L2GasLimitSet(uint32 newGasLimit);\r\n\r\n constructor(\r\n WETH9 _l1Weth,\r\n address _hubPool,\r\n address _crossDomainMessenger,\r\n IL1StandardBridge _l1StandardBridge\r\n ) CrossDomainEnabled(_crossDomainMessenger) Base_Adapter(_hubPool) {\r\n l1Weth = _l1Weth;\r\n l1StandardBridge = _l1StandardBridge;\r\n }\r\n\r\n function setL2GasLimit(uint32 _l2GasLimit) public onlyOwner {\r\n l2GasLimit = _l2GasLimit;\r\n emit L2GasLimitSet(l2GasLimit);\r\n }\r\n\r\n function relayMessage(address target, bytes memory message) external payable override nonReentrant onlyHubPool {\r\n sendCrossDomainMessage(target, uint32(l2GasLimit), message);\r\n emit MessageRelayed(target, message);\r\n }\r\n\r\n function relayTokens(\r\n address l1Token,\r\n address l2Token,\r\n uint256 amount,\r\n address to\r\n ) external payable override nonReentrant onlyHubPool {\r\n // If the l1Token is weth then unwrap it to ETH then send the ETH to the standard bridge.\r\n if (l1Token == address(l1Weth)) {\r\n l1Weth.withdraw(amount);\r\n l1StandardBridge.depositETHTo{ value: amount }(to, l2GasLimit, \"\");\r\n } else {\r\n IERC20(l1Token).approve(address(l1StandardBridge), amount);\r\n l1StandardBridge.depositERC20To(l1Token, l2Token, to, amount, l2GasLimit, \"\");\r\n }\r\n emit TokensRelayed(l1Token, l2Token, amount, to);\r\n }\r\n\r\n // Added to enable the Optimism_Adapter to receive ETH. used when unwrapping WETH.\r\n receive() external payable {}\r\n}\r\n" - }, - "contracts/chain-adapters/Base_Adapter.sol": { - "content": "// SPDX-License-Identifier: AGPL-3.0-only\npragma solidity ^0.8.0;\nimport \"../interfaces/AdapterInterface.sol\";\n\nimport \"@openzeppelin/contracts/access/Ownable.sol\";\n\nabstract contract Base_Adapter is Ownable, AdapterInterface {\n address public hubPool;\n\n modifier onlyHubPool() {\n require(msg.sender == hubPool, \"Can only be called by hubPool\");\n _;\n }\n\n constructor(address _hubPool) {\n hubPool = _hubPool;\n }\n\n function setHubPool(address _hubPool) public onlyOwner {\n hubPool = _hubPool;\n emit HubPoolChanged(_hubPool);\n }\n}\n" - }, - "@eth-optimism/contracts/L1/messaging/IL1StandardBridge.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma solidity >0.5.0 <0.9.0;\n\nimport \"./IL1ERC20Bridge.sol\";\n\n/**\n * @title IL1StandardBridge\n */\ninterface IL1StandardBridge is IL1ERC20Bridge {\n /**********\n * Events *\n **********/\n event ETHDepositInitiated(\n address indexed _from,\n address indexed _to,\n uint256 _amount,\n bytes _data\n );\n\n event ETHWithdrawalFinalized(\n address indexed _from,\n address indexed _to,\n uint256 _amount,\n bytes _data\n );\n\n /********************\n * Public Functions *\n ********************/\n\n /**\n * @dev Deposit an amount of the ETH to the caller's balance on L2.\n * @param _l2Gas Gas limit required to complete the deposit on L2.\n * @param _data Optional data to forward to L2. This data is provided\n * solely as a convenience for external contracts. Aside from enforcing a maximum\n * length, these contracts provide no guarantees about its content.\n */\n function depositETH(uint32 _l2Gas, bytes calldata _data) external payable;\n\n /**\n * @dev Deposit an amount of ETH to a recipient's balance on L2.\n * @param _to L2 address to credit the withdrawal to.\n * @param _l2Gas Gas limit required to complete the deposit on L2.\n * @param _data Optional data to forward to L2. This data is provided\n * solely as a convenience for external contracts. Aside from enforcing a maximum\n * length, these contracts provide no guarantees about its content.\n */\n function depositETHTo(\n address _to,\n uint32 _l2Gas,\n bytes calldata _data\n ) external payable;\n\n /*************************\n * Cross-chain Functions *\n *************************/\n\n /**\n * @dev Complete a withdrawal from L2 to L1, and credit funds to the recipient's balance of the\n * L1 ETH token. Since only the xDomainMessenger can call this function, it will never be called\n * before the withdrawal is finalized.\n * @param _from L2 address initiating the transfer.\n * @param _to L1 address to credit the withdrawal to.\n * @param _amount Amount of the ERC20 to deposit.\n * @param _data Optional data to forward to L2. This data is provided\n * solely as a convenience for external contracts. Aside from enforcing a maximum\n * length, these contracts provide no guarantees about its content.\n */\n function finalizeETHWithdrawal(\n address _from,\n address _to,\n uint256 _amount,\n bytes calldata _data\n ) external;\n}\n" - }, - "@openzeppelin/contracts/access/Ownable.sol": { - "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts v4.4.1 (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 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 called by any account other than the owner.\n */\n modifier onlyOwner() {\n require(owner() == _msgSender(), \"Ownable: caller is not the owner\");\n _;\n }\n\n /**\n * @dev Leaves the contract without owner. It will not be possible to call\n * `onlyOwner` functions anymore. Can only be called by the current owner.\n *\n * NOTE: Renouncing ownership will leave the contract without an owner,\n * thereby removing 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/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" - }, - "@eth-optimism/contracts/L1/messaging/IL1ERC20Bridge.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma solidity >0.5.0 <0.9.0;\n\n/**\n * @title IL1ERC20Bridge\n */\ninterface IL1ERC20Bridge {\n /**********\n * Events *\n **********/\n\n event ERC20DepositInitiated(\n address indexed _l1Token,\n address indexed _l2Token,\n address indexed _from,\n address _to,\n uint256 _amount,\n bytes _data\n );\n\n event ERC20WithdrawalFinalized(\n address indexed _l1Token,\n address indexed _l2Token,\n address indexed _from,\n address _to,\n uint256 _amount,\n bytes _data\n );\n\n /********************\n * Public Functions *\n ********************/\n\n /**\n * @dev get the address of the corresponding L2 bridge contract.\n * @return Address of the corresponding L2 bridge contract.\n */\n function l2TokenBridge() external returns (address);\n\n /**\n * @dev deposit an amount of the ERC20 to the caller's balance on L2.\n * @param _l1Token Address of the L1 ERC20 we are depositing\n * @param _l2Token Address of the L1 respective L2 ERC20\n * @param _amount Amount of the ERC20 to deposit\n * @param _l2Gas Gas limit required to complete the deposit on L2.\n * @param _data Optional data to forward to L2. This data is provided\n * solely as a convenience for external contracts. Aside from enforcing a maximum\n * length, these contracts provide no guarantees about its content.\n */\n function depositERC20(\n address _l1Token,\n address _l2Token,\n uint256 _amount,\n uint32 _l2Gas,\n bytes calldata _data\n ) external;\n\n /**\n * @dev deposit an amount of ERC20 to a recipient's balance on L2.\n * @param _l1Token Address of the L1 ERC20 we are depositing\n * @param _l2Token Address of the L1 respective L2 ERC20\n * @param _to L2 address to credit the withdrawal to.\n * @param _amount Amount of the ERC20 to deposit.\n * @param _l2Gas Gas limit required to complete the deposit on L2.\n * @param _data Optional data to forward to L2. This data is provided\n * solely as a convenience for external contracts. Aside from enforcing a maximum\n * length, these contracts provide no guarantees about its content.\n */\n function depositERC20To(\n address _l1Token,\n address _l2Token,\n address _to,\n uint256 _amount,\n uint32 _l2Gas,\n bytes calldata _data\n ) external;\n\n /*************************\n * Cross-chain Functions *\n *************************/\n\n /**\n * @dev Complete a withdrawal from L2 to L1, and credit funds to the recipient's balance of the\n * L1 ERC20 token.\n * This call will fail if the initialized withdrawal from L2 has not been finalized.\n *\n * @param _l1Token Address of L1 token to finalizeWithdrawal for.\n * @param _l2Token Address of L2 token where withdrawal was initiated.\n * @param _from L2 address initiating the transfer.\n * @param _to L1 address to credit the withdrawal to.\n * @param _amount Amount of the ERC20 to deposit.\n * @param _data Data provided by the sender on L2. This data is provided\n * solely as a convenience for external contracts. Aside from enforcing a maximum\n * length, these contracts provide no guarantees about its content.\n */\n function finalizeERC20Withdrawal(\n address _l1Token,\n address _l2Token,\n address _from,\n address _to,\n uint256 _amount,\n bytes calldata _data\n ) external;\n}\n" - }, - "@openzeppelin/contracts/token/ERC20/extensions/IERC20Metadata.sol": { - "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts v4.4.1 (token/ERC20/extensions/IERC20Metadata.sol)\n\npragma solidity ^0.8.0;\n\nimport \"../IERC20.sol\";\n\n/**\n * @dev Interface for the optional metadata functions from the ERC20 standard.\n *\n * _Available since v4.1._\n */\ninterface IERC20Metadata is IERC20 {\n /**\n * @dev Returns the name of the token.\n */\n function name() external view returns (string memory);\n\n /**\n * @dev Returns the symbol of the token.\n */\n function symbol() external view returns (string memory);\n\n /**\n * @dev Returns the decimals places of the token.\n */\n function decimals() external view returns (uint8);\n}\n" - }, - "@openzeppelin/contracts/token/ERC20/ERC20.sol": { - "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts v4.4.1 (token/ERC20/ERC20.sol)\n\npragma solidity ^0.8.0;\n\nimport \"./IERC20.sol\";\nimport \"./extensions/IERC20Metadata.sol\";\nimport \"../../utils/Context.sol\";\n\n/**\n * @dev Implementation of the {IERC20} interface.\n *\n * This implementation is agnostic to the way tokens are created. This means\n * that a supply mechanism has to be added in a derived contract using {_mint}.\n * For a generic mechanism see {ERC20PresetMinterPauser}.\n *\n * TIP: For a detailed writeup see our guide\n * https://forum.zeppelin.solutions/t/how-to-implement-erc20-supply-mechanisms/226[How\n * to implement supply mechanisms].\n *\n * We have followed general OpenZeppelin Contracts guidelines: functions revert\n * instead returning `false` on failure. This behavior is nonetheless\n * conventional and does not conflict with the expectations of ERC20\n * applications.\n *\n * Additionally, an {Approval} event is emitted on calls to {transferFrom}.\n * This allows applications to reconstruct the allowance for all accounts just\n * by listening to said events. Other implementations of the EIP may not emit\n * these events, as it isn't required by the specification.\n *\n * Finally, the non-standard {decreaseAllowance} and {increaseAllowance}\n * functions have been added to mitigate the well-known issues around setting\n * allowances. See {IERC20-approve}.\n */\ncontract ERC20 is Context, IERC20, IERC20Metadata {\n mapping(address => uint256) private _balances;\n\n mapping(address => mapping(address => uint256)) private _allowances;\n\n uint256 private _totalSupply;\n\n string private _name;\n string private _symbol;\n\n /**\n * @dev Sets the values for {name} and {symbol}.\n *\n * The default value of {decimals} is 18. To select a different value for\n * {decimals} you should overload it.\n *\n * All two of these values are immutable: they can only be set once during\n * construction.\n */\n constructor(string memory name_, string memory symbol_) {\n _name = name_;\n _symbol = symbol_;\n }\n\n /**\n * @dev Returns the name of the token.\n */\n function name() public view virtual override returns (string memory) {\n return _name;\n }\n\n /**\n * @dev Returns the symbol of the token, usually a shorter version of the\n * name.\n */\n function symbol() public view virtual override returns (string memory) {\n return _symbol;\n }\n\n /**\n * @dev Returns the number of decimals used to get its user representation.\n * For example, if `decimals` equals `2`, a balance of `505` tokens should\n * be displayed to a user as `5.05` (`505 / 10 ** 2`).\n *\n * Tokens usually opt for a value of 18, imitating the relationship between\n * Ether and Wei. This is the value {ERC20} uses, unless this function is\n * overridden;\n *\n * NOTE: This information is only used for _display_ purposes: it in\n * no way affects any of the arithmetic of the contract, including\n * {IERC20-balanceOf} and {IERC20-transfer}.\n */\n function decimals() public view virtual override returns (uint8) {\n return 18;\n }\n\n /**\n * @dev See {IERC20-totalSupply}.\n */\n function totalSupply() public view virtual override returns (uint256) {\n return _totalSupply;\n }\n\n /**\n * @dev See {IERC20-balanceOf}.\n */\n function balanceOf(address account) public view virtual override returns (uint256) {\n return _balances[account];\n }\n\n /**\n * @dev See {IERC20-transfer}.\n *\n * Requirements:\n *\n * - `recipient` cannot be the zero address.\n * - the caller must have a balance of at least `amount`.\n */\n function transfer(address recipient, uint256 amount) public virtual override returns (bool) {\n _transfer(_msgSender(), recipient, amount);\n return true;\n }\n\n /**\n * @dev See {IERC20-allowance}.\n */\n function allowance(address owner, address spender) public view virtual override returns (uint256) {\n return _allowances[owner][spender];\n }\n\n /**\n * @dev See {IERC20-approve}.\n *\n * Requirements:\n *\n * - `spender` cannot be the zero address.\n */\n function approve(address spender, uint256 amount) public virtual override returns (bool) {\n _approve(_msgSender(), spender, amount);\n return true;\n }\n\n /**\n * @dev See {IERC20-transferFrom}.\n *\n * Emits an {Approval} event indicating the updated allowance. This is not\n * required by the EIP. See the note at the beginning of {ERC20}.\n *\n * Requirements:\n *\n * - `sender` and `recipient` cannot be the zero address.\n * - `sender` must have a balance of at least `amount`.\n * - the caller must have allowance for ``sender``'s tokens of at least\n * `amount`.\n */\n function transferFrom(\n address sender,\n address recipient,\n uint256 amount\n ) public virtual override returns (bool) {\n _transfer(sender, recipient, amount);\n\n uint256 currentAllowance = _allowances[sender][_msgSender()];\n require(currentAllowance >= amount, \"ERC20: transfer amount exceeds allowance\");\n unchecked {\n _approve(sender, _msgSender(), currentAllowance - amount);\n }\n\n return true;\n }\n\n /**\n * @dev Atomically increases the allowance granted to `spender` by the caller.\n *\n * This is an alternative to {approve} that can be used as a mitigation for\n * problems described in {IERC20-approve}.\n *\n * Emits an {Approval} event indicating the updated allowance.\n *\n * Requirements:\n *\n * - `spender` cannot be the zero address.\n */\n function increaseAllowance(address spender, uint256 addedValue) public virtual returns (bool) {\n _approve(_msgSender(), spender, _allowances[_msgSender()][spender] + addedValue);\n return true;\n }\n\n /**\n * @dev Atomically decreases the allowance granted to `spender` by the caller.\n *\n * This is an alternative to {approve} that can be used as a mitigation for\n * problems described in {IERC20-approve}.\n *\n * Emits an {Approval} event indicating the updated allowance.\n *\n * Requirements:\n *\n * - `spender` cannot be the zero address.\n * - `spender` must have allowance for the caller of at least\n * `subtractedValue`.\n */\n function decreaseAllowance(address spender, uint256 subtractedValue) public virtual returns (bool) {\n uint256 currentAllowance = _allowances[_msgSender()][spender];\n require(currentAllowance >= subtractedValue, \"ERC20: decreased allowance below zero\");\n unchecked {\n _approve(_msgSender(), spender, currentAllowance - subtractedValue);\n }\n\n return true;\n }\n\n /**\n * @dev Moves `amount` of tokens from `sender` to `recipient`.\n *\n * This internal function is equivalent to {transfer}, and can be used to\n * e.g. implement automatic token fees, slashing mechanisms, etc.\n *\n * Emits a {Transfer} event.\n *\n * Requirements:\n *\n * - `sender` cannot be the zero address.\n * - `recipient` cannot be the zero address.\n * - `sender` must have a balance of at least `amount`.\n */\n function _transfer(\n address sender,\n address recipient,\n uint256 amount\n ) internal virtual {\n require(sender != address(0), \"ERC20: transfer from the zero address\");\n require(recipient != address(0), \"ERC20: transfer to the zero address\");\n\n _beforeTokenTransfer(sender, recipient, amount);\n\n uint256 senderBalance = _balances[sender];\n require(senderBalance >= amount, \"ERC20: transfer amount exceeds balance\");\n unchecked {\n _balances[sender] = senderBalance - amount;\n }\n _balances[recipient] += amount;\n\n emit Transfer(sender, recipient, amount);\n\n _afterTokenTransfer(sender, recipient, amount);\n }\n\n /** @dev Creates `amount` tokens and assigns them to `account`, increasing\n * the total supply.\n *\n * Emits a {Transfer} event with `from` set to the zero address.\n *\n * Requirements:\n *\n * - `account` cannot be the zero address.\n */\n function _mint(address account, uint256 amount) internal virtual {\n require(account != address(0), \"ERC20: mint to the zero address\");\n\n _beforeTokenTransfer(address(0), account, amount);\n\n _totalSupply += amount;\n _balances[account] += amount;\n emit Transfer(address(0), account, amount);\n\n _afterTokenTransfer(address(0), account, amount);\n }\n\n /**\n * @dev Destroys `amount` tokens from `account`, reducing the\n * total supply.\n *\n * Emits a {Transfer} event with `to` set to the zero address.\n *\n * Requirements:\n *\n * - `account` cannot be the zero address.\n * - `account` must have at least `amount` tokens.\n */\n function _burn(address account, uint256 amount) internal virtual {\n require(account != address(0), \"ERC20: burn from the zero address\");\n\n _beforeTokenTransfer(account, address(0), amount);\n\n uint256 accountBalance = _balances[account];\n require(accountBalance >= amount, \"ERC20: burn amount exceeds balance\");\n unchecked {\n _balances[account] = accountBalance - amount;\n }\n _totalSupply -= amount;\n\n emit Transfer(account, address(0), amount);\n\n _afterTokenTransfer(account, address(0), amount);\n }\n\n /**\n * @dev Sets `amount` as the allowance of `spender` over the `owner` s tokens.\n *\n * This internal function is equivalent to `approve`, and can be used to\n * e.g. set automatic allowances for certain subsystems, etc.\n *\n * Emits an {Approval} event.\n *\n * Requirements:\n *\n * - `owner` cannot be the zero address.\n * - `spender` cannot be the zero address.\n */\n function _approve(\n address owner,\n address spender,\n uint256 amount\n ) internal virtual {\n require(owner != address(0), \"ERC20: approve from the zero address\");\n require(spender != address(0), \"ERC20: approve to the zero address\");\n\n _allowances[owner][spender] = amount;\n emit Approval(owner, spender, amount);\n }\n\n /**\n * @dev Hook that is called before any transfer of tokens. This includes\n * minting and burning.\n *\n * Calling conditions:\n *\n * - when `from` and `to` are both non-zero, `amount` of ``from``'s tokens\n * will be transferred to `to`.\n * - when `from` is zero, `amount` tokens will be minted for `to`.\n * - when `to` is zero, `amount` of ``from``'s tokens will be burned.\n * - `from` and `to` are never both zero.\n *\n * To learn more about hooks, head to xref:ROOT:extending-contracts.adoc#using-hooks[Using Hooks].\n */\n function _beforeTokenTransfer(\n address from,\n address to,\n uint256 amount\n ) internal virtual {}\n\n /**\n * @dev Hook that is called after any transfer of tokens. This includes\n * minting and burning.\n *\n * Calling conditions:\n *\n * - when `from` and `to` are both non-zero, `amount` of ``from``'s tokens\n * has been transferred to `to`.\n * - when `from` is zero, `amount` tokens have been minted for `to`.\n * - when `to` is zero, `amount` of ``from``'s tokens have been burned.\n * - `from` and `to` are never both zero.\n *\n * To learn more about hooks, head to xref:ROOT:extending-contracts.adoc#using-hooks[Using Hooks].\n */\n function _afterTokenTransfer(\n address from,\n address to,\n uint256 amount\n ) internal virtual {}\n}\n" - }, - "contracts/chain-adapters/L1_Adapter.sol": { - "content": "// SPDX-License-Identifier: AGPL-3.0-only\r\npragma solidity ^0.8.0;\r\n\r\nimport \"./Base_Adapter.sol\";\r\nimport \"../interfaces/AdapterInterface.sol\";\r\nimport \"../interfaces/WETH9.sol\";\r\n\r\nimport \"@uma/core/contracts/common/implementation/Lockable.sol\";\r\n\r\nimport \"@openzeppelin/contracts/token/ERC20/IERC20.sol\";\r\nimport \"@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol\";\r\n\r\ncontract L1_Adapter is Base_Adapter, Lockable {\r\n using SafeERC20 for IERC20;\r\n\r\n constructor(address _hubPool) Base_Adapter(_hubPool) {}\r\n\r\n function relayMessage(address target, bytes memory message) external payable override nonReentrant onlyHubPool {\r\n _executeCall(target, message);\r\n emit MessageRelayed(target, message);\r\n }\r\n\r\n function relayTokens(\r\n address l1Token,\r\n address l2Token, // l2Token is unused for L1.\r\n uint256 amount,\r\n address to\r\n ) external payable override nonReentrant onlyHubPool {\r\n IERC20(l1Token).safeTransfer(to, amount);\r\n emit TokensRelayed(l1Token, l2Token, amount, to);\r\n }\r\n\r\n // Note: this snippet of code is copied from Governor.sol.\r\n function _executeCall(address to, bytes memory data) private {\r\n // Note: this snippet of code is copied from Governor.sol and modified to not include any \"value\" field.\r\n // solhint-disable-next-line no-inline-assembly\r\n\r\n bool success;\r\n assembly {\r\n let inputData := add(data, 0x20)\r\n let inputDataSize := mload(data)\r\n // Hardcode value to be 0 for relayed governance calls in order to avoid addressing complexity of bridging\r\n // value cross-chain.\r\n success := call(gas(), to, 0, inputData, inputDataSize, 0, 0)\r\n }\r\n require(success, \"execute call failed\");\r\n }\r\n\r\n receive() external payable {}\r\n}\r\n" - }, - "contracts/chain-adapters/Arbitrum_Adapter.sol": { - "content": "// SPDX-License-Identifier: AGPL-3.0-only\r\npragma solidity ^0.8.0;\r\n\r\nimport \"./Base_Adapter.sol\";\r\nimport \"../interfaces/AdapterInterface.sol\";\r\nimport \"../interfaces/WETH9.sol\";\r\n\r\nimport \"@uma/core/contracts/common/implementation/Lockable.sol\";\r\n\r\nimport \"@openzeppelin/contracts/token/ERC20/IERC20.sol\";\r\n\r\ninterface ArbitrumL1InboxLike {\r\n function createRetryableTicket(\r\n address destAddr,\r\n uint256 arbTxCallValue,\r\n uint256 maxSubmissionCost,\r\n address submissionRefundAddress,\r\n address valueRefundAddress,\r\n uint256 maxGas,\r\n uint256 gasPriceBid,\r\n bytes calldata data\r\n ) external payable returns (uint256);\r\n}\r\n\r\ninterface ArbitrumL1ERC20GatewayLike {\r\n function outboundTransfer(\r\n address _token,\r\n address _to,\r\n uint256 _amount,\r\n uint256 _maxGas,\r\n uint256 _gasPriceBid,\r\n bytes calldata _data\r\n ) external payable returns (bytes memory);\r\n}\r\n\r\ncontract Arbitrum_Adapter is Base_Adapter, Lockable {\r\n // Gas limit for immediate L2 execution attempt (can be estimated via NodeInterface.estimateRetryableTicket).\r\n // NodeInterface precompile interface exists at L2 address 0x00000000000000000000000000000000000000C8\r\n uint32 public l2GasLimit = 5_000_000;\r\n\r\n // Amount of ETH allocated to pay for the base submission fee. The base submission fee is a parameter unique to\r\n // retryable transactions; the user is charged the base submission fee to cover the storage costs of keeping their\r\n // ticket’s calldata in the retry buffer. (current base submission fee is queryable via\r\n // ArbRetryableTx.getSubmissionPrice). ArbRetryableTicket precompile interface exists at L2 address\r\n // 0x000000000000000000000000000000000000006E.\r\n uint256 public l2MaxSubmissionCost = 0.1e18;\r\n\r\n // L2 Gas price bid for immediate L2 execution attempt (queryable via standard eth*gasPrice RPC)\r\n uint256 public l2GasPrice = 10e9; // 10 gWei\r\n\r\n // This address on L2 receives extra ETH that is left over after relaying a message via the inbox.\r\n address public l2RefundL2Address;\r\n\r\n ArbitrumL1InboxLike public l1Inbox;\r\n\r\n ArbitrumL1ERC20GatewayLike public l1ERC20Gateway;\r\n\r\n event L2GasLimitSet(uint32 newL2GasLimit);\r\n\r\n event L2MaxSubmissionCostSet(uint256 newL2MaxSubmissionCost);\r\n\r\n event L2GasPriceSet(uint256 newL2GasPrice);\r\n\r\n event L2RefundL2AddressSet(address newL2RefundL2Address);\r\n\r\n constructor(\r\n address _hubPool,\r\n ArbitrumL1InboxLike _l1ArbitrumInbox,\r\n ArbitrumL1ERC20GatewayLike _l1ERC20Gateway\r\n ) Base_Adapter(_hubPool) {\r\n l1Inbox = _l1ArbitrumInbox;\r\n l1ERC20Gateway = _l1ERC20Gateway;\r\n\r\n l2RefundL2Address = owner();\r\n }\r\n\r\n function setL2GasLimit(uint32 _l2GasLimit) public onlyOwner {\r\n l2GasLimit = _l2GasLimit;\r\n emit L2GasLimitSet(l2GasLimit);\r\n }\r\n\r\n function setL2MaxSubmissionCost(uint256 _l2MaxSubmissionCost) public onlyOwner {\r\n l2MaxSubmissionCost = _l2MaxSubmissionCost;\r\n emit L2MaxSubmissionCostSet(l2MaxSubmissionCost);\r\n }\r\n\r\n function setL2GasPrice(uint256 _l2GasPrice) public onlyOwner {\r\n l2GasPrice = _l2GasPrice;\r\n emit L2GasPriceSet(l2GasPrice);\r\n }\r\n\r\n function setL2RefundL2Address(address _l2RefundL2Address) public onlyOwner {\r\n l2RefundL2Address = _l2RefundL2Address;\r\n emit L2RefundL2AddressSet(l2RefundL2Address);\r\n }\r\n\r\n function relayMessage(address target, bytes memory message) external payable override nonReentrant onlyHubPool {\r\n uint256 requiredL1CallValue = getL1CallValue();\r\n require(address(this).balance >= requiredL1CallValue, \"Insufficient ETH balance\");\r\n\r\n l1Inbox.createRetryableTicket{ value: requiredL1CallValue }(\r\n target, // destAddr destination L2 contract address\r\n 0, // l2CallValue call value for retryable L2 message\r\n l2MaxSubmissionCost, // maxSubmissionCost Max gas deducted from user's L2 balance to cover base submission fee\r\n l2RefundL2Address, // excessFeeRefundAddress maxgas x gasprice - execution cost gets credited here on L2 balance\r\n l2RefundL2Address, // callValueRefundAddress l2Callvalue gets credited here on L2 if retryable txn times out or gets cancelled\r\n l2GasLimit, // maxGas Max gas deducted from user's L2 balance to cover L2 execution\r\n l2GasPrice, // gasPriceBid price bid for L2 execution\r\n message // data ABI encoded data of L2 message\r\n );\r\n\r\n emit MessageRelayed(target, message);\r\n }\r\n\r\n function relayTokens(\r\n address l1Token,\r\n address l2Token, // l2Token is unused for Arbitrum.\r\n uint256 amount,\r\n address to\r\n ) external payable override nonReentrant onlyHubPool {\r\n l1ERC20Gateway.outboundTransfer(l1Token, to, amount, l2GasLimit, l2GasPrice, \"\");\r\n emit TokensRelayed(l1Token, l2Token, amount, to);\r\n }\r\n\r\n function getL1CallValue() public view returns (uint256) {\r\n return l2MaxSubmissionCost + l2GasPrice * l2GasLimit;\r\n }\r\n\r\n receive() external payable {}\r\n}\r\n" - }, - "contracts/Ethereum_SpokePool.sol": { - "content": "//SPDX-License-Identifier: Unlicense\r\npragma solidity ^0.8.0;\r\n\r\nimport \"./interfaces/WETH9.sol\";\r\n\r\nimport \"@openzeppelin/contracts/access/Ownable.sol\";\r\nimport \"@openzeppelin/contracts/token/ERC20/IERC20.sol\";\r\n\r\nimport \"./SpokePool.sol\";\r\nimport \"./SpokePoolInterface.sol\";\r\n\r\n/**\r\n * @notice Ethereum L1 specific SpokePool.\r\n * @dev Used on Ethereum L1 to facilitate L2->L1 transfers.\r\n */\r\n\r\ncontract Ethereum_SpokePool is SpokePoolInterface, SpokePool, Ownable {\r\n constructor(\r\n address _l1EthWrapper,\r\n address _l2Eth,\r\n address _crossDomainAdmin,\r\n address _hubPool,\r\n address _wethAddress,\r\n address timerAddress\r\n ) SpokePool(_crossDomainAdmin, _hubPool, _wethAddress, timerAddress) {}\r\n\r\n /**************************************\r\n * ADMIN FUNCTIONS *\r\n **************************************/\r\n\r\n function setCrossDomainAdmin(address newCrossDomainAdmin) public override onlyOwner nonReentrant {\r\n _setCrossDomainAdmin(newCrossDomainAdmin);\r\n }\r\n\r\n function setHubPool(address newHubPool) public override onlyOwner nonReentrant {\r\n _setHubPool(newHubPool);\r\n }\r\n\r\n function setEnableRoute(\r\n address originToken,\r\n uint256 destinationChainId,\r\n bool enable\r\n ) public override onlyOwner nonReentrant {\r\n _setEnableRoute(originToken, destinationChainId, enable);\r\n }\r\n\r\n function setDepositQuoteTimeBuffer(uint32 buffer) public override onlyOwner nonReentrant {\r\n _setDepositQuoteTimeBuffer(buffer);\r\n }\r\n\r\n function relayRootBundle(bytes32 relayerRefundRoot, bytes32 slowRelayFulfillmentRoot)\r\n public\r\n override\r\n onlyOwner\r\n nonReentrant\r\n {\r\n _relayRootBundle(relayerRefundRoot, slowRelayFulfillmentRoot);\r\n }\r\n\r\n function _bridgeTokensToHubPool(RelayerRefundLeaf memory relayerRefundLeaf) internal override {\r\n IERC20(relayerRefundLeaf.l2TokenAddress).transfer(hubPool, relayerRefundLeaf.amountToReturn);\r\n }\r\n}\r\n" - }, - "contracts/chain-adapters/Mock_Adapter.sol": { - "content": "// SPDX-License-Identifier: AGPL-3.0-only\npragma solidity ^0.8.0;\n\nimport \"./Base_Adapter.sol\";\nimport \"@openzeppelin/contracts/token/ERC20/IERC20.sol\";\n\n/**\n * @notice Sends cross chain messages Optimism L2 network.\n * @dev This contract's owner should be set to the BridgeAdmin deployed on the same L1 network so that only the\n * BridgeAdmin can call cross-chain administrative functions on the L2 SpokePool via this messenger.\n */\ncontract Mock_Adapter is Base_Adapter {\n event RelayMessageCalled(address target, bytes message, address caller);\n\n event RelayTokensCalled(address l1Token, address l2Token, uint256 amount, address to, address caller);\n\n function relayMessage(address target, bytes memory message) external payable override onlyHubPool {\n emit RelayMessageCalled(target, message, msg.sender);\n }\n\n constructor(address _hubPool) Base_Adapter(_hubPool) {}\n\n function relayTokens(\n address l1Token,\n address l2Token,\n uint256 amount,\n address to\n ) external payable override onlyHubPool {\n emit RelayTokensCalled(l1Token, l2Token, amount, to, msg.sender);\n }\n}\n" - }, - "contracts/test/MerkleLibTest.sol": { - "content": "// SPDX-License-Identifier: GPL-3.0-only\r\npragma solidity ^0.8.0;\r\n\r\nimport \"../MerkleLib.sol\";\r\nimport \"../HubPoolInterface.sol\";\r\nimport \"../SpokePoolInterface.sol\";\r\n\r\n/**\r\n * @notice Contract to test the MerkleLib.\r\n */\r\ncontract MerkleLibTest {\r\n mapping(uint256 => uint256) public claimedBitMap;\r\n\r\n uint256 public claimedBitMap1D;\r\n\r\n function verifyPoolRebalance(\r\n bytes32 root,\r\n HubPoolInterface.PoolRebalanceLeaf memory rebalance,\r\n bytes32[] memory proof\r\n ) public pure returns (bool) {\r\n return MerkleLib.verifyPoolRebalance(root, rebalance, proof);\r\n }\r\n\r\n function verifyRelayerRefund(\r\n bytes32 root,\r\n SpokePoolInterface.RelayerRefundLeaf memory refund,\r\n bytes32[] memory proof\r\n ) public pure returns (bool) {\r\n return MerkleLib.verifyRelayerRefund(root, refund, proof);\r\n }\r\n\r\n function verifySlowRelayFulfillment(\r\n bytes32 root,\r\n SpokePoolInterface.RelayData memory slowRelayFulfillment,\r\n bytes32[] memory proof\r\n ) public pure returns (bool) {\r\n return MerkleLib.verifySlowRelayFulfillment(root, slowRelayFulfillment, proof);\r\n }\r\n\r\n function isClaimed(uint256 index) public view returns (bool) {\r\n return MerkleLib.isClaimed(claimedBitMap, index);\r\n }\r\n\r\n function setClaimed(uint256 index) public {\r\n MerkleLib.setClaimed(claimedBitMap, index);\r\n }\r\n\r\n function isClaimed1D(uint256 index) public view returns (bool) {\r\n return MerkleLib.isClaimed1D(claimedBitMap1D, index);\r\n }\r\n\r\n function setClaimed1D(uint256 index) public {\r\n claimedBitMap1D = MerkleLib.setClaimed1D(claimedBitMap1D, index);\r\n }\r\n}\r\n" - }, - "@uma/core/contracts/common/interfaces/ExpandedIERC20.sol": { - "content": "// SPDX-License-Identifier: AGPL-3.0-only\npragma solidity ^0.8.0;\n\nimport \"@openzeppelin/contracts/token/ERC20/IERC20.sol\";\n\n/**\n * @title ERC20 interface that includes burn and mint methods.\n */\nabstract contract ExpandedIERC20 is IERC20 {\n /**\n * @notice Burns a specific amount of the caller's tokens.\n * @dev Only burns the caller's tokens, so it is safe to leave this method permissionless.\n */\n function burn(uint256 value) external virtual;\n\n /**\n * @dev Burns `value` tokens owned by `recipient`.\n * @param recipient address to burn tokens from.\n * @param value amount of tokens to burn.\n */\n function burnFrom(address recipient, uint256 value) external virtual returns (bool);\n\n /**\n * @notice Mints tokens and adds them to the balance of the `to` address.\n * @dev This method should be permissioned to only allow designated parties to mint tokens.\n */\n function mint(address to, uint256 value) external virtual returns (bool);\n\n function addMinter(address account) external virtual;\n\n function addBurner(address account) external virtual;\n\n function resetOwner(address account) external virtual;\n}\n" - }, - "@uma/core/contracts/common/implementation/ExpandedERC20.sol": { - "content": "// SPDX-License-Identifier: AGPL-3.0-only\npragma solidity ^0.8.0;\n\nimport \"@openzeppelin/contracts/token/ERC20/ERC20.sol\";\nimport \"./MultiRole.sol\";\nimport \"../interfaces/ExpandedIERC20.sol\";\n\n/**\n * @title An ERC20 with permissioned burning and minting. The contract deployer will initially\n * be the owner who is capable of adding new roles.\n */\ncontract ExpandedERC20 is ExpandedIERC20, ERC20, MultiRole {\n enum Roles {\n // Can set the minter and burner.\n Owner,\n // Addresses that can mint new tokens.\n Minter,\n // Addresses that can burn tokens that address owns.\n Burner\n }\n\n uint8 _decimals;\n\n /**\n * @notice Constructs the ExpandedERC20.\n * @param _tokenName The name which describes the new token.\n * @param _tokenSymbol The ticker abbreviation of the name. Ideally < 5 chars.\n * @param _tokenDecimals The number of decimals to define token precision.\n */\n constructor(\n string memory _tokenName,\n string memory _tokenSymbol,\n uint8 _tokenDecimals\n ) ERC20(_tokenName, _tokenSymbol) {\n _decimals = _tokenDecimals;\n _createExclusiveRole(uint256(Roles.Owner), uint256(Roles.Owner), msg.sender);\n _createSharedRole(uint256(Roles.Minter), uint256(Roles.Owner), new address[](0));\n _createSharedRole(uint256(Roles.Burner), uint256(Roles.Owner), new address[](0));\n }\n\n function decimals() public view virtual override(ERC20) returns (uint8) {\n return _decimals;\n }\n\n /**\n * @dev Mints `value` tokens to `recipient`, returning true on success.\n * @param recipient address to mint to.\n * @param value amount of tokens to mint.\n * @return True if the mint succeeded, or False.\n */\n function mint(address recipient, uint256 value)\n external\n override\n onlyRoleHolder(uint256(Roles.Minter))\n returns (bool)\n {\n _mint(recipient, value);\n return true;\n }\n\n /**\n * @dev Burns `value` tokens owned by `msg.sender`.\n * @param value amount of tokens to burn.\n */\n function burn(uint256 value) external override onlyRoleHolder(uint256(Roles.Burner)) {\n _burn(msg.sender, value);\n }\n\n /**\n * @dev Burns `value` tokens owned by `recipient`.\n * @param recipient address to burn tokens from.\n * @param value amount of tokens to burn.\n * @return True if the burn succeeded, or False.\n */\n function burnFrom(address recipient, uint256 value)\n external\n override\n onlyRoleHolder(uint256(Roles.Burner))\n returns (bool)\n {\n _burn(recipient, value);\n return true;\n }\n\n /**\n * @notice Add Minter role to account.\n * @dev The caller must have the Owner role.\n * @param account The address to which the Minter role is added.\n */\n function addMinter(address account) external virtual override {\n addMember(uint256(Roles.Minter), account);\n }\n\n /**\n * @notice Add Burner role to account.\n * @dev The caller must have the Owner role.\n * @param account The address to which the Burner role is added.\n */\n function addBurner(address account) external virtual override {\n addMember(uint256(Roles.Burner), account);\n }\n\n /**\n * @notice Reset Owner role to account.\n * @dev The caller must have the Owner role.\n * @param account The new holder of the Owner role.\n */\n function resetOwner(address account) external virtual override {\n resetMember(uint256(Roles.Owner), account);\n }\n}\n" - }, - "@uma/core/contracts/common/implementation/MultiRole.sol": { - "content": "// SPDX-License-Identifier: AGPL-3.0-only\npragma solidity ^0.8.0;\n\nlibrary Exclusive {\n struct RoleMembership {\n address member;\n }\n\n function isMember(RoleMembership storage roleMembership, address memberToCheck) internal view returns (bool) {\n return roleMembership.member == memberToCheck;\n }\n\n function resetMember(RoleMembership storage roleMembership, address newMember) internal {\n require(newMember != address(0x0), \"Cannot set an exclusive role to 0x0\");\n roleMembership.member = newMember;\n }\n\n function getMember(RoleMembership storage roleMembership) internal view returns (address) {\n return roleMembership.member;\n }\n\n function init(RoleMembership storage roleMembership, address initialMember) internal {\n resetMember(roleMembership, initialMember);\n }\n}\n\nlibrary Shared {\n struct RoleMembership {\n mapping(address => bool) members;\n }\n\n function isMember(RoleMembership storage roleMembership, address memberToCheck) internal view returns (bool) {\n return roleMembership.members[memberToCheck];\n }\n\n function addMember(RoleMembership storage roleMembership, address memberToAdd) internal {\n require(memberToAdd != address(0x0), \"Cannot add 0x0 to a shared role\");\n roleMembership.members[memberToAdd] = true;\n }\n\n function removeMember(RoleMembership storage roleMembership, address memberToRemove) internal {\n roleMembership.members[memberToRemove] = false;\n }\n\n function init(RoleMembership storage roleMembership, address[] memory initialMembers) internal {\n for (uint256 i = 0; i < initialMembers.length; i++) {\n addMember(roleMembership, initialMembers[i]);\n }\n }\n}\n\n/**\n * @title Base class to manage permissions for the derived class.\n */\nabstract contract MultiRole {\n using Exclusive for Exclusive.RoleMembership;\n using Shared for Shared.RoleMembership;\n\n enum RoleType { Invalid, Exclusive, Shared }\n\n struct Role {\n uint256 managingRole;\n RoleType roleType;\n Exclusive.RoleMembership exclusiveRoleMembership;\n Shared.RoleMembership sharedRoleMembership;\n }\n\n mapping(uint256 => Role) private roles;\n\n event ResetExclusiveMember(uint256 indexed roleId, address indexed newMember, address indexed manager);\n event AddedSharedMember(uint256 indexed roleId, address indexed newMember, address indexed manager);\n event RemovedSharedMember(uint256 indexed roleId, address indexed oldMember, address indexed manager);\n\n /**\n * @notice Reverts unless the caller is a member of the specified roleId.\n */\n modifier onlyRoleHolder(uint256 roleId) {\n require(holdsRole(roleId, msg.sender), \"Sender does not hold required role\");\n _;\n }\n\n /**\n * @notice Reverts unless the caller is a member of the manager role for the specified roleId.\n */\n modifier onlyRoleManager(uint256 roleId) {\n require(holdsRole(roles[roleId].managingRole, msg.sender), \"Can only be called by a role manager\");\n _;\n }\n\n /**\n * @notice Reverts unless the roleId represents an initialized, exclusive roleId.\n */\n modifier onlyExclusive(uint256 roleId) {\n require(roles[roleId].roleType == RoleType.Exclusive, \"Must be called on an initialized Exclusive role\");\n _;\n }\n\n /**\n * @notice Reverts unless the roleId represents an initialized, shared roleId.\n */\n modifier onlyShared(uint256 roleId) {\n require(roles[roleId].roleType == RoleType.Shared, \"Must be called on an initialized Shared role\");\n _;\n }\n\n /**\n * @notice Whether `memberToCheck` is a member of roleId.\n * @dev Reverts if roleId does not correspond to an initialized role.\n * @param roleId the Role to check.\n * @param memberToCheck the address to check.\n * @return True if `memberToCheck` is a member of `roleId`.\n */\n function holdsRole(uint256 roleId, address memberToCheck) public view returns (bool) {\n Role storage role = roles[roleId];\n if (role.roleType == RoleType.Exclusive) {\n return role.exclusiveRoleMembership.isMember(memberToCheck);\n } else if (role.roleType == RoleType.Shared) {\n return role.sharedRoleMembership.isMember(memberToCheck);\n }\n revert(\"Invalid roleId\");\n }\n\n /**\n * @notice Changes the exclusive role holder of `roleId` to `newMember`.\n * @dev Reverts if the caller is not a member of the managing role for `roleId` or if `roleId` is not an\n * initialized, ExclusiveRole.\n * @param roleId the ExclusiveRole membership to modify.\n * @param newMember the new ExclusiveRole member.\n */\n function resetMember(uint256 roleId, address newMember) public onlyExclusive(roleId) onlyRoleManager(roleId) {\n roles[roleId].exclusiveRoleMembership.resetMember(newMember);\n emit ResetExclusiveMember(roleId, newMember, msg.sender);\n }\n\n /**\n * @notice Gets the current holder of the exclusive role, `roleId`.\n * @dev Reverts if `roleId` does not represent an initialized, exclusive role.\n * @param roleId the ExclusiveRole membership to check.\n * @return the address of the current ExclusiveRole member.\n */\n function getMember(uint256 roleId) public view onlyExclusive(roleId) returns (address) {\n return roles[roleId].exclusiveRoleMembership.getMember();\n }\n\n /**\n * @notice Adds `newMember` to the shared role, `roleId`.\n * @dev Reverts if `roleId` does not represent an initialized, SharedRole or if the caller is not a member of the\n * managing role for `roleId`.\n * @param roleId the SharedRole membership to modify.\n * @param newMember the new SharedRole member.\n */\n function addMember(uint256 roleId, address newMember) public onlyShared(roleId) onlyRoleManager(roleId) {\n roles[roleId].sharedRoleMembership.addMember(newMember);\n emit AddedSharedMember(roleId, newMember, msg.sender);\n }\n\n /**\n * @notice Removes `memberToRemove` from the shared role, `roleId`.\n * @dev Reverts if `roleId` does not represent an initialized, SharedRole or if the caller is not a member of the\n * managing role for `roleId`.\n * @param roleId the SharedRole membership to modify.\n * @param memberToRemove the current SharedRole member to remove.\n */\n function removeMember(uint256 roleId, address memberToRemove) public onlyShared(roleId) onlyRoleManager(roleId) {\n roles[roleId].sharedRoleMembership.removeMember(memberToRemove);\n emit RemovedSharedMember(roleId, memberToRemove, msg.sender);\n }\n\n /**\n * @notice Removes caller from the role, `roleId`.\n * @dev Reverts if the caller is not a member of the role for `roleId` or if `roleId` is not an\n * initialized, SharedRole.\n * @param roleId the SharedRole membership to modify.\n */\n function renounceMembership(uint256 roleId) public onlyShared(roleId) onlyRoleHolder(roleId) {\n roles[roleId].sharedRoleMembership.removeMember(msg.sender);\n emit RemovedSharedMember(roleId, msg.sender, msg.sender);\n }\n\n /**\n * @notice Reverts if `roleId` is not initialized.\n */\n modifier onlyValidRole(uint256 roleId) {\n require(roles[roleId].roleType != RoleType.Invalid, \"Attempted to use an invalid roleId\");\n _;\n }\n\n /**\n * @notice Reverts if `roleId` is initialized.\n */\n modifier onlyInvalidRole(uint256 roleId) {\n require(roles[roleId].roleType == RoleType.Invalid, \"Cannot use a pre-existing role\");\n _;\n }\n\n /**\n * @notice Internal method to initialize a shared role, `roleId`, which will be managed by `managingRoleId`.\n * `initialMembers` will be immediately added to the role.\n * @dev Should be called by derived contracts, usually at construction time. Will revert if the role is already\n * initialized.\n */\n function _createSharedRole(\n uint256 roleId,\n uint256 managingRoleId,\n address[] memory initialMembers\n ) internal onlyInvalidRole(roleId) {\n Role storage role = roles[roleId];\n role.roleType = RoleType.Shared;\n role.managingRole = managingRoleId;\n role.sharedRoleMembership.init(initialMembers);\n require(\n roles[managingRoleId].roleType != RoleType.Invalid,\n \"Attempted to use an invalid role to manage a shared role\"\n );\n }\n\n /**\n * @notice Internal method to initialize an exclusive role, `roleId`, which will be managed by `managingRoleId`.\n * `initialMember` will be immediately added to the role.\n * @dev Should be called by derived contracts, usually at construction time. Will revert if the role is already\n * initialized.\n */\n function _createExclusiveRole(\n uint256 roleId,\n uint256 managingRoleId,\n address initialMember\n ) internal onlyInvalidRole(roleId) {\n Role storage role = roles[roleId];\n role.roleType = RoleType.Exclusive;\n role.managingRole = managingRoleId;\n role.exclusiveRoleMembership.init(initialMember);\n require(\n roles[managingRoleId].roleType != RoleType.Invalid,\n \"Attempted to use an invalid role to manage an exclusive role\"\n );\n }\n}\n" - }, - "contracts/LpTokenFactory.sol": { - "content": "// SPDX-License-Identifier: GPL-3.0-only\npragma solidity ^0.8.0;\n\nimport \"./interfaces/LpTokenFactoryInterface.sol\";\n\nimport \"@uma/core/contracts/common/implementation/ExpandedERC20.sol\";\n\ncontract LpTokenFactory is LpTokenFactoryInterface {\n function createLpToken(address l1Token) public returns (address) {\n ExpandedERC20 lpToken = new ExpandedERC20(\n _append(\"Across \", IERC20Metadata(l1Token).name(), \" LP Token\"), // LP Token Name\n _append(\"Av2-\", IERC20Metadata(l1Token).symbol(), \"-LP\"), // LP Token Symbol\n IERC20Metadata(l1Token).decimals() // LP Token Decimals\n );\n lpToken.addMember(1, msg.sender); // Set this contract as the LP Token's minter.\n lpToken.addMember(2, msg.sender); // Set this contract as the LP Token's burner.\n\n return address(lpToken);\n }\n\n function _append(\n string memory a,\n string memory b,\n string memory c\n ) internal pure returns (string memory) {\n return string(abi.encodePacked(a, b, c));\n }\n}\n" - }, - "contracts/interfaces/LpTokenFactoryInterface.sol": { - "content": "// SPDX-License-Identifier: AGPL-3.0-only\npragma solidity ^0.8.0;\n\nimport \"@openzeppelin/contracts/token/ERC20/IERC20.sol\";\n\ninterface LpTokenFactoryInterface {\n function createLpToken(address l1Token) external returns (address);\n}\n" - }, - "@uma/core/contracts/oracle/interfaces/SkinnyOptimisticOracleInterface.sol": { - "content": "// SPDX-License-Identifier: AGPL-3.0-only\npragma solidity ^0.8.0;\n\nimport \"@openzeppelin/contracts/token/ERC20/IERC20.sol\";\nimport \"../interfaces/OptimisticOracleInterface.sol\";\n\n/**\n * @title Interface for the gas-cost-reduced version of the OptimisticOracle.\n * @notice Differences from normal OptimisticOracle:\n * - refundOnDispute: flag is removed, by default there are no refunds on disputes.\n * - customizing request parameters: In the OptimisticOracle, parameters like `bond` and `customLiveness` can be reset\n * after a request is already made via `requestPrice`. In the SkinnyOptimisticOracle, these parameters can only be\n * set in `requestPrice`, which has an expanded input set.\n * - settleAndGetPrice: Replaced by `settle`, which can only be called once per settleable request. The resolved price\n * can be fetched via the `Settle` event or the return value of `settle`.\n * - general changes to interface: Functions that interact with existing requests all require the parameters of the\n * request to modify to be passed as input. These parameters must match with the existing request parameters or the\n * function will revert. This change reflects the internal refactor to store hashed request parameters instead of the\n * full request struct.\n * @dev Interface used by financial contracts to interact with the Oracle. Voters will use a different interface.\n */\nabstract contract SkinnyOptimisticOracleInterface {\n // Struct representing a price request. Note that this differs from the OptimisticOracleInterface's Request struct\n // in that refundOnDispute is removed.\n struct Request {\n address proposer; // Address of the proposer.\n address disputer; // Address of the disputer.\n IERC20 currency; // ERC20 token used to pay rewards and fees.\n bool settled; // True if the request is settled.\n int256 proposedPrice; // Price that the proposer submitted.\n int256 resolvedPrice; // Price resolved once the request is settled.\n uint256 expirationTime; // Time at which the request auto-settles without a dispute.\n uint256 reward; // Amount of the currency to pay to the proposer on settlement.\n uint256 finalFee; // Final fee to pay to the Store upon request to the DVM.\n uint256 bond; // Bond that the proposer and disputer must pay on top of the final fee.\n uint256 customLiveness; // Custom liveness value set by the requester.\n }\n\n // This value must be <= the Voting contract's `ancillaryBytesLimit` value otherwise it is possible\n // that a price can be requested to this contract successfully, but cannot be disputed because the DVM refuses\n // to accept a price request made with ancillary data length over a certain size.\n uint256 public constant ancillaryBytesLimit = 8192;\n\n /**\n * @notice Requests a new price.\n * @param identifier price identifier being requested.\n * @param timestamp timestamp of the price being requested.\n * @param ancillaryData ancillary data representing additional args being passed with the price request.\n * @param currency ERC20 token used for payment of rewards and fees. Must be approved for use with the DVM.\n * @param reward reward offered to a successful proposer. Will be pulled from the caller. Note: this can be 0,\n * which could make sense if the contract requests and proposes the value in the same call or\n * provides its own reward system.\n * @param bond custom proposal bond to set for request. If set to 0, defaults to the final fee.\n * @param customLiveness custom proposal liveness to set for request.\n * @return totalBond default bond + final fee that the proposer and disputer will be required to pay.\n */\n function requestPrice(\n bytes32 identifier,\n uint32 timestamp,\n bytes memory ancillaryData,\n IERC20 currency,\n uint256 reward,\n uint256 bond,\n uint256 customLiveness\n ) external virtual returns (uint256 totalBond);\n\n /**\n * @notice Proposes a price value on another address' behalf. Note: this address will receive any rewards that come\n * from this proposal. However, any bonds are pulled from the caller.\n * @param requester sender of the initial price request.\n * @param identifier price identifier to identify the existing request.\n * @param timestamp timestamp to identify the existing request.\n * @param ancillaryData ancillary data of the price being requested.\n * @param request price request parameters whose hash must match the request that the caller wants to\n * propose a price for.\n * @param proposer address to set as the proposer.\n * @param proposedPrice price being proposed.\n * @return totalBond the amount that's pulled from the caller's wallet as a bond. The bond will be returned to\n * the proposer once settled if the proposal is correct.\n */\n function proposePriceFor(\n address requester,\n bytes32 identifier,\n uint32 timestamp,\n bytes memory ancillaryData,\n Request memory request,\n address proposer,\n int256 proposedPrice\n ) public virtual returns (uint256 totalBond);\n\n /**\n * @notice Proposes a price value where caller is the proposer.\n * @param requester sender of the initial price request.\n * @param identifier price identifier to identify the existing request.\n * @param timestamp timestamp to identify the existing request.\n * @param ancillaryData ancillary data of the price being requested.\n * @param request price request parameters whose hash must match the request that the caller wants to\n * propose a price for.\n * @param proposedPrice price being proposed.\n * @return totalBond the amount that's pulled from the caller's wallet as a bond. The bond will be returned to\n * the proposer once settled if the proposal is correct.\n */\n function proposePrice(\n address requester,\n bytes32 identifier,\n uint32 timestamp,\n bytes memory ancillaryData,\n Request memory request,\n int256 proposedPrice\n ) external virtual returns (uint256 totalBond);\n\n /**\n * @notice Combines logic of requestPrice and proposePrice while taking advantage of gas savings from not having to\n * overwrite Request params that a normal requestPrice() => proposePrice() flow would entail. Note: The proposer\n * will receive any rewards that come from this proposal. However, any bonds are pulled from the caller.\n * @dev The caller is the requester, but the proposer can be customized.\n * @param identifier price identifier to identify the existing request.\n * @param timestamp timestamp to identify the existing request.\n * @param ancillaryData ancillary data of the price being requested.\n * @param currency ERC20 token used for payment of rewards and fees. Must be approved for use with the DVM.\n * @param reward reward offered to a successful proposer. Will be pulled from the caller. Note: this can be 0,\n * which could make sense if the contract requests and proposes the value in the same call or\n * provides its own reward system.\n * @param bond custom proposal bond to set for request. If set to 0, defaults to the final fee.\n * @param customLiveness custom proposal liveness to set for request.\n * @param proposer address to set as the proposer.\n * @param proposedPrice price being proposed.\n * @return totalBond the amount that's pulled from the caller's wallet as a bond. The bond will be returned to\n * the proposer once settled if the proposal is correct.\n */\n function requestAndProposePriceFor(\n bytes32 identifier,\n uint32 timestamp,\n bytes memory ancillaryData,\n IERC20 currency,\n uint256 reward,\n uint256 bond,\n uint256 customLiveness,\n address proposer,\n int256 proposedPrice\n ) external virtual returns (uint256 totalBond);\n\n /**\n * @notice Disputes a price request with an active proposal on another address' behalf. Note: this address will\n * receive any rewards that come from this dispute. However, any bonds are pulled from the caller.\n * @param identifier price identifier to identify the existing request.\n * @param timestamp timestamp to identify the existing request.\n * @param ancillaryData ancillary data of the price being requested.\n * @param request price request parameters whose hash must match the request that the caller wants to\n * dispute.\n * @param disputer address to set as the disputer.\n * @param requester sender of the initial price request.\n * @return totalBond the amount that's pulled from the caller's wallet as a bond. The bond will be returned to\n * the disputer once settled if the dispute was valid (the proposal was incorrect).\n */\n function disputePriceFor(\n bytes32 identifier,\n uint32 timestamp,\n bytes memory ancillaryData,\n Request memory request,\n address disputer,\n address requester\n ) public virtual returns (uint256 totalBond);\n\n /**\n * @notice Disputes a price request with an active proposal where caller is the disputer.\n * @param requester sender of the initial price request.\n * @param identifier price identifier to identify the existing request.\n * @param timestamp timestamp to identify the existing request.\n * @param ancillaryData ancillary data of the price being requested.\n * @param request price request parameters whose hash must match the request that the caller wants to\n * dispute.\n * @return totalBond the amount that's pulled from the caller's wallet as a bond. The bond will be returned to\n * the disputer once settled if the dispute was valid (the proposal was incorrect).\n */\n function disputePrice(\n address requester,\n bytes32 identifier,\n uint32 timestamp,\n bytes memory ancillaryData,\n Request memory request\n ) external virtual returns (uint256 totalBond);\n\n /**\n * @notice Attempts to settle an outstanding price request. Will revert if it isn't settleable.\n * @param requester sender of the initial price request.\n * @param identifier price identifier to identify the existing request.\n * @param timestamp timestamp to identify the existing request.\n * @param ancillaryData ancillary data of the price being requested.\n * @param request price request parameters whose hash must match the request that the caller wants to\n * settle.\n * @return payout the amount that the \"winner\" (proposer or disputer) receives on settlement. This amount includes\n * the returned bonds as well as additional rewards.\n * @return resolvedPrice the price that the request settled to.\n */\n function settle(\n address requester,\n bytes32 identifier,\n uint32 timestamp,\n bytes memory ancillaryData,\n Request memory request\n ) external virtual returns (uint256 payout, int256 resolvedPrice);\n\n /**\n * @notice Computes the current state of a price request. See the State enum for more details.\n * @param requester sender of the initial price request.\n * @param identifier price identifier to identify the existing request.\n * @param timestamp timestamp to identify the existing request.\n * @param ancillaryData ancillary data of the price being requested.\n * @param request price request parameters.\n * @return the State.\n */\n function getState(\n address requester,\n bytes32 identifier,\n uint32 timestamp,\n bytes memory ancillaryData,\n Request memory request\n ) external virtual returns (OptimisticOracleInterface.State);\n\n /**\n * @notice Checks if a given request has resolved, expired or been settled (i.e the optimistic oracle has a price).\n * @param requester sender of the initial price request.\n * @param identifier price identifier to identify the existing request.\n * @param timestamp timestamp to identify the existing request.\n * @param ancillaryData ancillary data of the price being requested.\n * @param request price request parameters. The hash of these parameters must match with the request hash that is\n * associated with the price request unique ID {requester, identifier, timestamp, ancillaryData}, or this method\n * will revert.\n * @return boolean indicating true if price exists and false if not.\n */\n function hasPrice(\n address requester,\n bytes32 identifier,\n uint32 timestamp,\n bytes memory ancillaryData,\n Request memory request\n ) public virtual returns (bool);\n\n /**\n * @notice Generates stamped ancillary data in the format that it would be used in the case of a price dispute.\n * @param ancillaryData ancillary data of the price being requested.\n * @param requester sender of the initial price request.\n * @return the stamped ancillary bytes.\n */\n function stampAncillaryData(bytes memory ancillaryData, address requester)\n public\n pure\n virtual\n returns (bytes memory);\n}\n" - }, - "@uma/core/contracts/oracle/interfaces/OptimisticOracleInterface.sol": { - "content": "// SPDX-License-Identifier: AGPL-3.0-only\npragma solidity ^0.8.0;\n\nimport \"@openzeppelin/contracts/token/ERC20/IERC20.sol\";\n\n/**\n * @title Financial contract facing Oracle interface.\n * @dev Interface used by financial contracts to interact with the Oracle. Voters will use a different interface.\n */\nabstract contract OptimisticOracleInterface {\n // Struct representing the state of a price request.\n enum State {\n Invalid, // Never requested.\n Requested, // Requested, no other actions taken.\n Proposed, // Proposed, but not expired or disputed yet.\n Expired, // Proposed, not disputed, past liveness.\n Disputed, // Disputed, but no DVM price returned yet.\n Resolved, // Disputed and DVM price is available.\n Settled // Final price has been set in the contract (can get here from Expired or Resolved).\n }\n\n // Struct representing a price request.\n struct Request {\n address proposer; // Address of the proposer.\n address disputer; // Address of the disputer.\n IERC20 currency; // ERC20 token used to pay rewards and fees.\n bool settled; // True if the request is settled.\n bool refundOnDispute; // True if the requester should be refunded their reward on dispute.\n int256 proposedPrice; // Price that the proposer submitted.\n int256 resolvedPrice; // Price resolved once the request is settled.\n uint256 expirationTime; // Time at which the request auto-settles without a dispute.\n uint256 reward; // Amount of the currency to pay to the proposer on settlement.\n uint256 finalFee; // Final fee to pay to the Store upon request to the DVM.\n uint256 bond; // Bond that the proposer and disputer must pay on top of the final fee.\n uint256 customLiveness; // Custom liveness value set by the requester.\n }\n\n // This value must be <= the Voting contract's `ancillaryBytesLimit` value otherwise it is possible\n // that a price can be requested to this contract successfully, but cannot be disputed because the DVM refuses\n // to accept a price request made with ancillary data length over a certain size.\n uint256 public constant ancillaryBytesLimit = 8192;\n\n /**\n * @notice Requests a new price.\n * @param identifier price identifier being requested.\n * @param timestamp timestamp of the price being requested.\n * @param ancillaryData ancillary data representing additional args being passed with the price request.\n * @param currency ERC20 token used for payment of rewards and fees. Must be approved for use with the DVM.\n * @param reward reward offered to a successful proposer. Will be pulled from the caller. Note: this can be 0,\n * which could make sense if the contract requests and proposes the value in the same call or\n * provides its own reward system.\n * @return totalBond default bond (final fee) + final fee that the proposer and disputer will be required to pay.\n * This can be changed with a subsequent call to setBond().\n */\n function requestPrice(\n bytes32 identifier,\n uint256 timestamp,\n bytes memory ancillaryData,\n IERC20 currency,\n uint256 reward\n ) external virtual returns (uint256 totalBond);\n\n /**\n * @notice Set the proposal bond associated with a price request.\n * @param identifier price identifier to identify the existing request.\n * @param timestamp timestamp to identify the existing request.\n * @param ancillaryData ancillary data of the price being requested.\n * @param bond custom bond amount to set.\n * @return totalBond new bond + final fee that the proposer and disputer will be required to pay. This can be\n * changed again with a subsequent call to setBond().\n */\n function setBond(\n bytes32 identifier,\n uint256 timestamp,\n bytes memory ancillaryData,\n uint256 bond\n ) external virtual returns (uint256 totalBond);\n\n /**\n * @notice Sets the request to refund the reward if the proposal is disputed. This can help to \"hedge\" the caller\n * in the event of a dispute-caused delay. Note: in the event of a dispute, the winner still receives the other's\n * bond, so there is still profit to be made even if the reward is refunded.\n * @param identifier price identifier to identify the existing request.\n * @param timestamp timestamp to identify the existing request.\n * @param ancillaryData ancillary data of the price being requested.\n */\n function setRefundOnDispute(\n bytes32 identifier,\n uint256 timestamp,\n bytes memory ancillaryData\n ) external virtual;\n\n /**\n * @notice Sets a custom liveness value for the request. Liveness is the amount of time a proposal must wait before\n * being auto-resolved.\n * @param identifier price identifier to identify the existing request.\n * @param timestamp timestamp to identify the existing request.\n * @param ancillaryData ancillary data of the price being requested.\n * @param customLiveness new custom liveness.\n */\n function setCustomLiveness(\n bytes32 identifier,\n uint256 timestamp,\n bytes memory ancillaryData,\n uint256 customLiveness\n ) external virtual;\n\n /**\n * @notice Proposes a price value on another address' behalf. Note: this address will receive any rewards that come\n * from this proposal. However, any bonds are pulled from the caller.\n * @param proposer address to set as the proposer.\n * @param requester sender of the initial price request.\n * @param identifier price identifier to identify the existing request.\n * @param timestamp timestamp to identify the existing request.\n * @param ancillaryData ancillary data of the price being requested.\n * @param proposedPrice price being proposed.\n * @return totalBond the amount that's pulled from the caller's wallet as a bond. The bond will be returned to\n * the proposer once settled if the proposal is correct.\n */\n function proposePriceFor(\n address proposer,\n address requester,\n bytes32 identifier,\n uint256 timestamp,\n bytes memory ancillaryData,\n int256 proposedPrice\n ) public virtual returns (uint256 totalBond);\n\n /**\n * @notice Proposes a price value for an existing price request.\n * @param requester sender of the initial price request.\n * @param identifier price identifier to identify the existing request.\n * @param timestamp timestamp to identify the existing request.\n * @param ancillaryData ancillary data of the price being requested.\n * @param proposedPrice price being proposed.\n * @return totalBond the amount that's pulled from the proposer's wallet as a bond. The bond will be returned to\n * the proposer once settled if the proposal is correct.\n */\n function proposePrice(\n address requester,\n bytes32 identifier,\n uint256 timestamp,\n bytes memory ancillaryData,\n int256 proposedPrice\n ) external virtual returns (uint256 totalBond);\n\n /**\n * @notice Disputes a price request with an active proposal on another address' behalf. Note: this address will\n * receive any rewards that come from this dispute. However, any bonds are pulled from the caller.\n * @param disputer address to set as the disputer.\n * @param requester sender of the initial price request.\n * @param identifier price identifier to identify the existing request.\n * @param timestamp timestamp to identify the existing request.\n * @param ancillaryData ancillary data of the price being requested.\n * @return totalBond the amount that's pulled from the caller's wallet as a bond. The bond will be returned to\n * the disputer once settled if the dispute was value (the proposal was incorrect).\n */\n function disputePriceFor(\n address disputer,\n address requester,\n bytes32 identifier,\n uint256 timestamp,\n bytes memory ancillaryData\n ) public virtual returns (uint256 totalBond);\n\n /**\n * @notice Disputes a price value for an existing price request with an active proposal.\n * @param requester sender of the initial price request.\n * @param identifier price identifier to identify the existing request.\n * @param timestamp timestamp to identify the existing request.\n * @param ancillaryData ancillary data of the price being requested.\n * @return totalBond the amount that's pulled from the disputer's wallet as a bond. The bond will be returned to\n * the disputer once settled if the dispute was valid (the proposal was incorrect).\n */\n function disputePrice(\n address requester,\n bytes32 identifier,\n uint256 timestamp,\n bytes memory ancillaryData\n ) external virtual returns (uint256 totalBond);\n\n /**\n * @notice Retrieves a price that was previously requested by a caller. Reverts if the request is not settled\n * or settleable. Note: this method is not view so that this call may actually settle the price request if it\n * hasn't been settled.\n * @param identifier price identifier to identify the existing request.\n * @param timestamp timestamp to identify the existing request.\n * @param ancillaryData ancillary data of the price being requested.\n * @return resolved price.\n */\n function settleAndGetPrice(\n bytes32 identifier,\n uint256 timestamp,\n bytes memory ancillaryData\n ) external virtual returns (int256);\n\n /**\n * @notice Attempts to settle an outstanding price request. Will revert if it isn't settleable.\n * @param requester sender of the initial price request.\n * @param identifier price identifier to identify the existing request.\n * @param timestamp timestamp to identify the existing request.\n * @param ancillaryData ancillary data of the price being requested.\n * @return payout the amount that the \"winner\" (proposer or disputer) receives on settlement. This amount includes\n * the returned bonds as well as additional rewards.\n */\n function settle(\n address requester,\n bytes32 identifier,\n uint256 timestamp,\n bytes memory ancillaryData\n ) external virtual returns (uint256 payout);\n\n /**\n * @notice Gets the current data structure containing all information about a price request.\n * @param requester sender of the initial price request.\n * @param identifier price identifier to identify the existing request.\n * @param timestamp timestamp to identify the existing request.\n * @param ancillaryData ancillary data of the price being requested.\n * @return the Request data structure.\n */\n function getRequest(\n address requester,\n bytes32 identifier,\n uint256 timestamp,\n bytes memory ancillaryData\n ) public view virtual returns (Request memory);\n\n /**\n * @notice Returns the state of a price request.\n * @param requester sender of the initial price request.\n * @param identifier price identifier to identify the existing request.\n * @param timestamp timestamp to identify the existing request.\n * @param ancillaryData ancillary data of the price being requested.\n * @return the State enum value.\n */\n function getState(\n address requester,\n bytes32 identifier,\n uint256 timestamp,\n bytes memory ancillaryData\n ) public view virtual returns (State);\n\n /**\n * @notice Checks if a given request has resolved or been settled (i.e the optimistic oracle has a price).\n * @param requester sender of the initial price request.\n * @param identifier price identifier to identify the existing request.\n * @param timestamp timestamp to identify the existing request.\n * @param ancillaryData ancillary data of the price being requested.\n * @return true if price has resolved or settled, false otherwise.\n */\n function hasPrice(\n address requester,\n bytes32 identifier,\n uint256 timestamp,\n bytes memory ancillaryData\n ) public view virtual returns (bool);\n\n function stampAncillaryData(bytes memory ancillaryData, address requester)\n public\n view\n virtual\n returns (bytes memory);\n}\n" - }, - "@uma/core/contracts/oracle/interfaces/StoreInterface.sol": { - "content": "// SPDX-License-Identifier: AGPL-3.0-only\npragma solidity ^0.8.0;\n\nimport \"@openzeppelin/contracts/token/ERC20/IERC20.sol\";\nimport \"../../common/implementation/FixedPoint.sol\";\n\n/**\n * @title Interface that allows financial contracts to pay oracle fees for their use of the system.\n */\ninterface StoreInterface {\n /**\n * @notice Pays Oracle fees in ETH to the store.\n * @dev To be used by contracts whose margin currency is ETH.\n */\n function payOracleFees() external payable;\n\n /**\n * @notice Pays oracle fees in the margin currency, erc20Address, to the store.\n * @dev To be used if the margin currency is an ERC20 token rather than ETH.\n * @param erc20Address address of the ERC20 token used to pay the fee.\n * @param amount number of tokens to transfer. An approval for at least this amount must exist.\n */\n function payOracleFeesErc20(address erc20Address, FixedPoint.Unsigned calldata amount) external;\n\n /**\n * @notice Computes the regular oracle fees that a contract should pay for a period.\n * @param startTime defines the beginning time from which the fee is paid.\n * @param endTime end time until which the fee is paid.\n * @param pfc \"profit from corruption\", or the maximum amount of margin currency that a\n * token sponsor could extract from the contract through corrupting the price feed in their favor.\n * @return regularFee amount owed for the duration from start to end time for the given pfc.\n * @return latePenalty for paying the fee after the deadline.\n */\n function computeRegularFee(\n uint256 startTime,\n uint256 endTime,\n FixedPoint.Unsigned calldata pfc\n ) external view returns (FixedPoint.Unsigned memory regularFee, FixedPoint.Unsigned memory latePenalty);\n\n /**\n * @notice Computes the final oracle fees that a contract should pay at settlement.\n * @param currency token used to pay the final fee.\n * @return finalFee amount due.\n */\n function computeFinalFee(address currency) external view returns (FixedPoint.Unsigned memory);\n}\n" - }, - "@uma/core/contracts/common/implementation/FixedPoint.sol": { - "content": "// SPDX-License-Identifier: AGPL-3.0-only\npragma solidity ^0.8.0;\n\nimport \"@openzeppelin/contracts/utils/math/SafeMath.sol\";\nimport \"@openzeppelin/contracts/utils/math/SignedSafeMath.sol\";\n\n/**\n * @title Library for fixed point arithmetic on uints\n */\nlibrary FixedPoint {\n using SafeMath for uint256;\n using SignedSafeMath for int256;\n\n // Supports 18 decimals. E.g., 1e18 represents \"1\", 5e17 represents \"0.5\".\n // For unsigned values:\n // This can represent a value up to (2^256 - 1)/10^18 = ~10^59. 10^59 will be stored internally as uint256 10^77.\n uint256 private constant FP_SCALING_FACTOR = 10**18;\n\n // --------------------------------------- UNSIGNED -----------------------------------------------------------------------------\n struct Unsigned {\n uint256 rawValue;\n }\n\n /**\n * @notice Constructs an `Unsigned` from an unscaled uint, e.g., `b=5` gets stored internally as `5*(10**18)`.\n * @param a uint to convert into a FixedPoint.\n * @return the converted FixedPoint.\n */\n function fromUnscaledUint(uint256 a) internal pure returns (Unsigned memory) {\n return Unsigned(a.mul(FP_SCALING_FACTOR));\n }\n\n /**\n * @notice Whether `a` is equal to `b`.\n * @param a a FixedPoint.\n * @param b a uint256.\n * @return True if equal, or False.\n */\n function isEqual(Unsigned memory a, uint256 b) internal pure returns (bool) {\n return a.rawValue == fromUnscaledUint(b).rawValue;\n }\n\n /**\n * @notice Whether `a` is equal to `b`.\n * @param a a FixedPoint.\n * @param b a FixedPoint.\n * @return True if equal, or False.\n */\n function isEqual(Unsigned memory a, Unsigned memory b) internal pure returns (bool) {\n return a.rawValue == b.rawValue;\n }\n\n /**\n * @notice Whether `a` is greater than `b`.\n * @param a a FixedPoint.\n * @param b a FixedPoint.\n * @return True if `a > b`, or False.\n */\n function isGreaterThan(Unsigned memory a, Unsigned memory b) internal pure returns (bool) {\n return a.rawValue > b.rawValue;\n }\n\n /**\n * @notice Whether `a` is greater than `b`.\n * @param a a FixedPoint.\n * @param b a uint256.\n * @return True if `a > b`, or False.\n */\n function isGreaterThan(Unsigned memory a, uint256 b) internal pure returns (bool) {\n return a.rawValue > fromUnscaledUint(b).rawValue;\n }\n\n /**\n * @notice Whether `a` is greater than `b`.\n * @param a a uint256.\n * @param b a FixedPoint.\n * @return True if `a > b`, or False.\n */\n function isGreaterThan(uint256 a, Unsigned memory b) internal pure returns (bool) {\n return fromUnscaledUint(a).rawValue > b.rawValue;\n }\n\n /**\n * @notice Whether `a` is greater than or equal to `b`.\n * @param a a FixedPoint.\n * @param b a FixedPoint.\n * @return True if `a >= b`, or False.\n */\n function isGreaterThanOrEqual(Unsigned memory a, Unsigned memory b) internal pure returns (bool) {\n return a.rawValue >= b.rawValue;\n }\n\n /**\n * @notice Whether `a` is greater than or equal to `b`.\n * @param a a FixedPoint.\n * @param b a uint256.\n * @return True if `a >= b`, or False.\n */\n function isGreaterThanOrEqual(Unsigned memory a, uint256 b) internal pure returns (bool) {\n return a.rawValue >= fromUnscaledUint(b).rawValue;\n }\n\n /**\n * @notice Whether `a` is greater than or equal to `b`.\n * @param a a uint256.\n * @param b a FixedPoint.\n * @return True if `a >= b`, or False.\n */\n function isGreaterThanOrEqual(uint256 a, Unsigned memory b) internal pure returns (bool) {\n return fromUnscaledUint(a).rawValue >= b.rawValue;\n }\n\n /**\n * @notice Whether `a` is less than `b`.\n * @param a a FixedPoint.\n * @param b a FixedPoint.\n * @return True if `a < b`, or False.\n */\n function isLessThan(Unsigned memory a, Unsigned memory b) internal pure returns (bool) {\n return a.rawValue < b.rawValue;\n }\n\n /**\n * @notice Whether `a` is less than `b`.\n * @param a a FixedPoint.\n * @param b a uint256.\n * @return True if `a < b`, or False.\n */\n function isLessThan(Unsigned memory a, uint256 b) internal pure returns (bool) {\n return a.rawValue < fromUnscaledUint(b).rawValue;\n }\n\n /**\n * @notice Whether `a` is less than `b`.\n * @param a a uint256.\n * @param b a FixedPoint.\n * @return True if `a < b`, or False.\n */\n function isLessThan(uint256 a, Unsigned memory b) internal pure returns (bool) {\n return fromUnscaledUint(a).rawValue < b.rawValue;\n }\n\n /**\n * @notice Whether `a` is less than or equal to `b`.\n * @param a a FixedPoint.\n * @param b a FixedPoint.\n * @return True if `a <= b`, or False.\n */\n function isLessThanOrEqual(Unsigned memory a, Unsigned memory b) internal pure returns (bool) {\n return a.rawValue <= b.rawValue;\n }\n\n /**\n * @notice Whether `a` is less than or equal to `b`.\n * @param a a FixedPoint.\n * @param b a uint256.\n * @return True if `a <= b`, or False.\n */\n function isLessThanOrEqual(Unsigned memory a, uint256 b) internal pure returns (bool) {\n return a.rawValue <= fromUnscaledUint(b).rawValue;\n }\n\n /**\n * @notice Whether `a` is less than or equal to `b`.\n * @param a a uint256.\n * @param b a FixedPoint.\n * @return True if `a <= b`, or False.\n */\n function isLessThanOrEqual(uint256 a, Unsigned memory b) internal pure returns (bool) {\n return fromUnscaledUint(a).rawValue <= b.rawValue;\n }\n\n /**\n * @notice The minimum of `a` and `b`.\n * @param a a FixedPoint.\n * @param b a FixedPoint.\n * @return the minimum of `a` and `b`.\n */\n function min(Unsigned memory a, Unsigned memory b) internal pure returns (Unsigned memory) {\n return a.rawValue < b.rawValue ? a : b;\n }\n\n /**\n * @notice The maximum of `a` and `b`.\n * @param a a FixedPoint.\n * @param b a FixedPoint.\n * @return the maximum of `a` and `b`.\n */\n function max(Unsigned memory a, Unsigned memory b) internal pure returns (Unsigned memory) {\n return a.rawValue > b.rawValue ? a : b;\n }\n\n /**\n * @notice Adds two `Unsigned`s, reverting on overflow.\n * @param a a FixedPoint.\n * @param b a FixedPoint.\n * @return the sum of `a` and `b`.\n */\n function add(Unsigned memory a, Unsigned memory b) internal pure returns (Unsigned memory) {\n return Unsigned(a.rawValue.add(b.rawValue));\n }\n\n /**\n * @notice Adds an `Unsigned` to an unscaled uint, reverting on overflow.\n * @param a a FixedPoint.\n * @param b a uint256.\n * @return the sum of `a` and `b`.\n */\n function add(Unsigned memory a, uint256 b) internal pure returns (Unsigned memory) {\n return add(a, fromUnscaledUint(b));\n }\n\n /**\n * @notice Subtracts two `Unsigned`s, reverting on overflow.\n * @param a a FixedPoint.\n * @param b a FixedPoint.\n * @return the difference of `a` and `b`.\n */\n function sub(Unsigned memory a, Unsigned memory b) internal pure returns (Unsigned memory) {\n return Unsigned(a.rawValue.sub(b.rawValue));\n }\n\n /**\n * @notice Subtracts an unscaled uint256 from an `Unsigned`, reverting on overflow.\n * @param a a FixedPoint.\n * @param b a uint256.\n * @return the difference of `a` and `b`.\n */\n function sub(Unsigned memory a, uint256 b) internal pure returns (Unsigned memory) {\n return sub(a, fromUnscaledUint(b));\n }\n\n /**\n * @notice Subtracts an `Unsigned` from an unscaled uint256, reverting on overflow.\n * @param a a uint256.\n * @param b a FixedPoint.\n * @return the difference of `a` and `b`.\n */\n function sub(uint256 a, Unsigned memory b) internal pure returns (Unsigned memory) {\n return sub(fromUnscaledUint(a), b);\n }\n\n /**\n * @notice Multiplies two `Unsigned`s, reverting on overflow.\n * @dev This will \"floor\" the product.\n * @param a a FixedPoint.\n * @param b a FixedPoint.\n * @return the product of `a` and `b`.\n */\n function mul(Unsigned memory a, Unsigned memory b) internal pure returns (Unsigned memory) {\n // There are two caveats with this computation:\n // 1. Max output for the represented number is ~10^41, otherwise an intermediate value overflows. 10^41 is\n // stored internally as a uint256 ~10^59.\n // 2. Results that can't be represented exactly are truncated not rounded. E.g., 1.4 * 2e-18 = 2.8e-18, which\n // would round to 3, but this computation produces the result 2.\n // No need to use SafeMath because FP_SCALING_FACTOR != 0.\n return Unsigned(a.rawValue.mul(b.rawValue) / FP_SCALING_FACTOR);\n }\n\n /**\n * @notice Multiplies an `Unsigned` and an unscaled uint256, reverting on overflow.\n * @dev This will \"floor\" the product.\n * @param a a FixedPoint.\n * @param b a uint256.\n * @return the product of `a` and `b`.\n */\n function mul(Unsigned memory a, uint256 b) internal pure returns (Unsigned memory) {\n return Unsigned(a.rawValue.mul(b));\n }\n\n /**\n * @notice Multiplies two `Unsigned`s and \"ceil's\" the product, reverting on overflow.\n * @param a a FixedPoint.\n * @param b a FixedPoint.\n * @return the product of `a` and `b`.\n */\n function mulCeil(Unsigned memory a, Unsigned memory b) internal pure returns (Unsigned memory) {\n uint256 mulRaw = a.rawValue.mul(b.rawValue);\n uint256 mulFloor = mulRaw / FP_SCALING_FACTOR;\n uint256 mod = mulRaw.mod(FP_SCALING_FACTOR);\n if (mod != 0) {\n return Unsigned(mulFloor.add(1));\n } else {\n return Unsigned(mulFloor);\n }\n }\n\n /**\n * @notice Multiplies an `Unsigned` and an unscaled uint256 and \"ceil's\" the product, reverting on overflow.\n * @param a a FixedPoint.\n * @param b a FixedPoint.\n * @return the product of `a` and `b`.\n */\n function mulCeil(Unsigned memory a, uint256 b) internal pure returns (Unsigned memory) {\n // Since b is an uint, there is no risk of truncation and we can just mul it normally\n return Unsigned(a.rawValue.mul(b));\n }\n\n /**\n * @notice Divides one `Unsigned` by an `Unsigned`, reverting on overflow or division by 0.\n * @dev This will \"floor\" the quotient.\n * @param a a FixedPoint numerator.\n * @param b a FixedPoint denominator.\n * @return the quotient of `a` divided by `b`.\n */\n function div(Unsigned memory a, Unsigned memory b) internal pure returns (Unsigned memory) {\n // There are two caveats with this computation:\n // 1. Max value for the number dividend `a` represents is ~10^41, otherwise an intermediate value overflows.\n // 10^41 is stored internally as a uint256 10^59.\n // 2. Results that can't be represented exactly are truncated not rounded. E.g., 2 / 3 = 0.6 repeating, which\n // would round to 0.666666666666666667, but this computation produces the result 0.666666666666666666.\n return Unsigned(a.rawValue.mul(FP_SCALING_FACTOR).div(b.rawValue));\n }\n\n /**\n * @notice Divides one `Unsigned` by an unscaled uint256, reverting on overflow or division by 0.\n * @dev This will \"floor\" the quotient.\n * @param a a FixedPoint numerator.\n * @param b a uint256 denominator.\n * @return the quotient of `a` divided by `b`.\n */\n function div(Unsigned memory a, uint256 b) internal pure returns (Unsigned memory) {\n return Unsigned(a.rawValue.div(b));\n }\n\n /**\n * @notice Divides one unscaled uint256 by an `Unsigned`, reverting on overflow or division by 0.\n * @dev This will \"floor\" the quotient.\n * @param a a uint256 numerator.\n * @param b a FixedPoint denominator.\n * @return the quotient of `a` divided by `b`.\n */\n function div(uint256 a, Unsigned memory b) internal pure returns (Unsigned memory) {\n return div(fromUnscaledUint(a), b);\n }\n\n /**\n * @notice Divides one `Unsigned` by an `Unsigned` and \"ceil's\" the quotient, reverting on overflow or division by 0.\n * @param a a FixedPoint numerator.\n * @param b a FixedPoint denominator.\n * @return the quotient of `a` divided by `b`.\n */\n function divCeil(Unsigned memory a, Unsigned memory b) internal pure returns (Unsigned memory) {\n uint256 aScaled = a.rawValue.mul(FP_SCALING_FACTOR);\n uint256 divFloor = aScaled.div(b.rawValue);\n uint256 mod = aScaled.mod(b.rawValue);\n if (mod != 0) {\n return Unsigned(divFloor.add(1));\n } else {\n return Unsigned(divFloor);\n }\n }\n\n /**\n * @notice Divides one `Unsigned` by an unscaled uint256 and \"ceil's\" the quotient, reverting on overflow or division by 0.\n * @param a a FixedPoint numerator.\n * @param b a uint256 denominator.\n * @return the quotient of `a` divided by `b`.\n */\n function divCeil(Unsigned memory a, uint256 b) internal pure returns (Unsigned memory) {\n // Because it is possible that a quotient gets truncated, we can't just call \"Unsigned(a.rawValue.div(b))\"\n // similarly to mulCeil with a uint256 as the second parameter. Therefore we need to convert b into an Unsigned.\n // This creates the possibility of overflow if b is very large.\n return divCeil(a, fromUnscaledUint(b));\n }\n\n /**\n * @notice Raises an `Unsigned` to the power of an unscaled uint256, reverting on overflow. E.g., `b=2` squares `a`.\n * @dev This will \"floor\" the result.\n * @param a a FixedPoint numerator.\n * @param b a uint256 denominator.\n * @return output is `a` to the power of `b`.\n */\n function pow(Unsigned memory a, uint256 b) internal pure returns (Unsigned memory output) {\n output = fromUnscaledUint(1);\n for (uint256 i = 0; i < b; i = i.add(1)) {\n output = mul(output, a);\n }\n }\n\n // ------------------------------------------------- SIGNED -------------------------------------------------------------\n // Supports 18 decimals. E.g., 1e18 represents \"1\", 5e17 represents \"0.5\".\n // For signed values:\n // This can represent a value up (or down) to +-(2^255 - 1)/10^18 = ~10^58. 10^58 will be stored internally as int256 10^76.\n int256 private constant SFP_SCALING_FACTOR = 10**18;\n\n struct Signed {\n int256 rawValue;\n }\n\n function fromSigned(Signed memory a) internal pure returns (Unsigned memory) {\n require(a.rawValue >= 0, \"Negative value provided\");\n return Unsigned(uint256(a.rawValue));\n }\n\n function fromUnsigned(Unsigned memory a) internal pure returns (Signed memory) {\n require(a.rawValue <= uint256(type(int256).max), \"Unsigned too large\");\n return Signed(int256(a.rawValue));\n }\n\n /**\n * @notice Constructs a `Signed` from an unscaled int, e.g., `b=5` gets stored internally as `5*(10**18)`.\n * @param a int to convert into a FixedPoint.Signed.\n * @return the converted FixedPoint.Signed.\n */\n function fromUnscaledInt(int256 a) internal pure returns (Signed memory) {\n return Signed(a.mul(SFP_SCALING_FACTOR));\n }\n\n /**\n * @notice Whether `a` is equal to `b`.\n * @param a a FixedPoint.Signed.\n * @param b a int256.\n * @return True if equal, or False.\n */\n function isEqual(Signed memory a, int256 b) internal pure returns (bool) {\n return a.rawValue == fromUnscaledInt(b).rawValue;\n }\n\n /**\n * @notice Whether `a` is equal to `b`.\n * @param a a FixedPoint.Signed.\n * @param b a FixedPoint.Signed.\n * @return True if equal, or False.\n */\n function isEqual(Signed memory a, Signed memory b) internal pure returns (bool) {\n return a.rawValue == b.rawValue;\n }\n\n /**\n * @notice Whether `a` is greater than `b`.\n * @param a a FixedPoint.Signed.\n * @param b a FixedPoint.Signed.\n * @return True if `a > b`, or False.\n */\n function isGreaterThan(Signed memory a, Signed memory b) internal pure returns (bool) {\n return a.rawValue > b.rawValue;\n }\n\n /**\n * @notice Whether `a` is greater than `b`.\n * @param a a FixedPoint.Signed.\n * @param b an int256.\n * @return True if `a > b`, or False.\n */\n function isGreaterThan(Signed memory a, int256 b) internal pure returns (bool) {\n return a.rawValue > fromUnscaledInt(b).rawValue;\n }\n\n /**\n * @notice Whether `a` is greater than `b`.\n * @param a an int256.\n * @param b a FixedPoint.Signed.\n * @return True if `a > b`, or False.\n */\n function isGreaterThan(int256 a, Signed memory b) internal pure returns (bool) {\n return fromUnscaledInt(a).rawValue > b.rawValue;\n }\n\n /**\n * @notice Whether `a` is greater than or equal to `b`.\n * @param a a FixedPoint.Signed.\n * @param b a FixedPoint.Signed.\n * @return True if `a >= b`, or False.\n */\n function isGreaterThanOrEqual(Signed memory a, Signed memory b) internal pure returns (bool) {\n return a.rawValue >= b.rawValue;\n }\n\n /**\n * @notice Whether `a` is greater than or equal to `b`.\n * @param a a FixedPoint.Signed.\n * @param b an int256.\n * @return True if `a >= b`, or False.\n */\n function isGreaterThanOrEqual(Signed memory a, int256 b) internal pure returns (bool) {\n return a.rawValue >= fromUnscaledInt(b).rawValue;\n }\n\n /**\n * @notice Whether `a` is greater than or equal to `b`.\n * @param a an int256.\n * @param b a FixedPoint.Signed.\n * @return True if `a >= b`, or False.\n */\n function isGreaterThanOrEqual(int256 a, Signed memory b) internal pure returns (bool) {\n return fromUnscaledInt(a).rawValue >= b.rawValue;\n }\n\n /**\n * @notice Whether `a` is less than `b`.\n * @param a a FixedPoint.Signed.\n * @param b a FixedPoint.Signed.\n * @return True if `a < b`, or False.\n */\n function isLessThan(Signed memory a, Signed memory b) internal pure returns (bool) {\n return a.rawValue < b.rawValue;\n }\n\n /**\n * @notice Whether `a` is less than `b`.\n * @param a a FixedPoint.Signed.\n * @param b an int256.\n * @return True if `a < b`, or False.\n */\n function isLessThan(Signed memory a, int256 b) internal pure returns (bool) {\n return a.rawValue < fromUnscaledInt(b).rawValue;\n }\n\n /**\n * @notice Whether `a` is less than `b`.\n * @param a an int256.\n * @param b a FixedPoint.Signed.\n * @return True if `a < b`, or False.\n */\n function isLessThan(int256 a, Signed memory b) internal pure returns (bool) {\n return fromUnscaledInt(a).rawValue < b.rawValue;\n }\n\n /**\n * @notice Whether `a` is less than or equal to `b`.\n * @param a a FixedPoint.Signed.\n * @param b a FixedPoint.Signed.\n * @return True if `a <= b`, or False.\n */\n function isLessThanOrEqual(Signed memory a, Signed memory b) internal pure returns (bool) {\n return a.rawValue <= b.rawValue;\n }\n\n /**\n * @notice Whether `a` is less than or equal to `b`.\n * @param a a FixedPoint.Signed.\n * @param b an int256.\n * @return True if `a <= b`, or False.\n */\n function isLessThanOrEqual(Signed memory a, int256 b) internal pure returns (bool) {\n return a.rawValue <= fromUnscaledInt(b).rawValue;\n }\n\n /**\n * @notice Whether `a` is less than or equal to `b`.\n * @param a an int256.\n * @param b a FixedPoint.Signed.\n * @return True if `a <= b`, or False.\n */\n function isLessThanOrEqual(int256 a, Signed memory b) internal pure returns (bool) {\n return fromUnscaledInt(a).rawValue <= b.rawValue;\n }\n\n /**\n * @notice The minimum of `a` and `b`.\n * @param a a FixedPoint.Signed.\n * @param b a FixedPoint.Signed.\n * @return the minimum of `a` and `b`.\n */\n function min(Signed memory a, Signed memory b) internal pure returns (Signed memory) {\n return a.rawValue < b.rawValue ? a : b;\n }\n\n /**\n * @notice The maximum of `a` and `b`.\n * @param a a FixedPoint.Signed.\n * @param b a FixedPoint.Signed.\n * @return the maximum of `a` and `b`.\n */\n function max(Signed memory a, Signed memory b) internal pure returns (Signed memory) {\n return a.rawValue > b.rawValue ? a : b;\n }\n\n /**\n * @notice Adds two `Signed`s, reverting on overflow.\n * @param a a FixedPoint.Signed.\n * @param b a FixedPoint.Signed.\n * @return the sum of `a` and `b`.\n */\n function add(Signed memory a, Signed memory b) internal pure returns (Signed memory) {\n return Signed(a.rawValue.add(b.rawValue));\n }\n\n /**\n * @notice Adds an `Signed` to an unscaled int, reverting on overflow.\n * @param a a FixedPoint.Signed.\n * @param b an int256.\n * @return the sum of `a` and `b`.\n */\n function add(Signed memory a, int256 b) internal pure returns (Signed memory) {\n return add(a, fromUnscaledInt(b));\n }\n\n /**\n * @notice Subtracts two `Signed`s, reverting on overflow.\n * @param a a FixedPoint.Signed.\n * @param b a FixedPoint.Signed.\n * @return the difference of `a` and `b`.\n */\n function sub(Signed memory a, Signed memory b) internal pure returns (Signed memory) {\n return Signed(a.rawValue.sub(b.rawValue));\n }\n\n /**\n * @notice Subtracts an unscaled int256 from an `Signed`, reverting on overflow.\n * @param a a FixedPoint.Signed.\n * @param b an int256.\n * @return the difference of `a` and `b`.\n */\n function sub(Signed memory a, int256 b) internal pure returns (Signed memory) {\n return sub(a, fromUnscaledInt(b));\n }\n\n /**\n * @notice Subtracts an `Signed` from an unscaled int256, reverting on overflow.\n * @param a an int256.\n * @param b a FixedPoint.Signed.\n * @return the difference of `a` and `b`.\n */\n function sub(int256 a, Signed memory b) internal pure returns (Signed memory) {\n return sub(fromUnscaledInt(a), b);\n }\n\n /**\n * @notice Multiplies two `Signed`s, reverting on overflow.\n * @dev This will \"floor\" the product.\n * @param a a FixedPoint.Signed.\n * @param b a FixedPoint.Signed.\n * @return the product of `a` and `b`.\n */\n function mul(Signed memory a, Signed memory b) internal pure returns (Signed memory) {\n // There are two caveats with this computation:\n // 1. Max output for the represented number is ~10^41, otherwise an intermediate value overflows. 10^41 is\n // stored internally as an int256 ~10^59.\n // 2. Results that can't be represented exactly are truncated not rounded. E.g., 1.4 * 2e-18 = 2.8e-18, which\n // would round to 3, but this computation produces the result 2.\n // No need to use SafeMath because SFP_SCALING_FACTOR != 0.\n return Signed(a.rawValue.mul(b.rawValue) / SFP_SCALING_FACTOR);\n }\n\n /**\n * @notice Multiplies an `Signed` and an unscaled int256, reverting on overflow.\n * @dev This will \"floor\" the product.\n * @param a a FixedPoint.Signed.\n * @param b an int256.\n * @return the product of `a` and `b`.\n */\n function mul(Signed memory a, int256 b) internal pure returns (Signed memory) {\n return Signed(a.rawValue.mul(b));\n }\n\n /**\n * @notice Multiplies two `Signed`s and \"ceil's\" the product, reverting on overflow.\n * @param a a FixedPoint.Signed.\n * @param b a FixedPoint.Signed.\n * @return the product of `a` and `b`.\n */\n function mulAwayFromZero(Signed memory a, Signed memory b) internal pure returns (Signed memory) {\n int256 mulRaw = a.rawValue.mul(b.rawValue);\n int256 mulTowardsZero = mulRaw / SFP_SCALING_FACTOR;\n // Manual mod because SignedSafeMath doesn't support it.\n int256 mod = mulRaw % SFP_SCALING_FACTOR;\n if (mod != 0) {\n bool isResultPositive = isLessThan(a, 0) == isLessThan(b, 0);\n int256 valueToAdd = isResultPositive ? int256(1) : int256(-1);\n return Signed(mulTowardsZero.add(valueToAdd));\n } else {\n return Signed(mulTowardsZero);\n }\n }\n\n /**\n * @notice Multiplies an `Signed` and an unscaled int256 and \"ceil's\" the product, reverting on overflow.\n * @param a a FixedPoint.Signed.\n * @param b a FixedPoint.Signed.\n * @return the product of `a` and `b`.\n */\n function mulAwayFromZero(Signed memory a, int256 b) internal pure returns (Signed memory) {\n // Since b is an int, there is no risk of truncation and we can just mul it normally\n return Signed(a.rawValue.mul(b));\n }\n\n /**\n * @notice Divides one `Signed` by an `Signed`, reverting on overflow or division by 0.\n * @dev This will \"floor\" the quotient.\n * @param a a FixedPoint numerator.\n * @param b a FixedPoint denominator.\n * @return the quotient of `a` divided by `b`.\n */\n function div(Signed memory a, Signed memory b) internal pure returns (Signed memory) {\n // There are two caveats with this computation:\n // 1. Max value for the number dividend `a` represents is ~10^41, otherwise an intermediate value overflows.\n // 10^41 is stored internally as an int256 10^59.\n // 2. Results that can't be represented exactly are truncated not rounded. E.g., 2 / 3 = 0.6 repeating, which\n // would round to 0.666666666666666667, but this computation produces the result 0.666666666666666666.\n return Signed(a.rawValue.mul(SFP_SCALING_FACTOR).div(b.rawValue));\n }\n\n /**\n * @notice Divides one `Signed` by an unscaled int256, reverting on overflow or division by 0.\n * @dev This will \"floor\" the quotient.\n * @param a a FixedPoint numerator.\n * @param b an int256 denominator.\n * @return the quotient of `a` divided by `b`.\n */\n function div(Signed memory a, int256 b) internal pure returns (Signed memory) {\n return Signed(a.rawValue.div(b));\n }\n\n /**\n * @notice Divides one unscaled int256 by an `Signed`, reverting on overflow or division by 0.\n * @dev This will \"floor\" the quotient.\n * @param a an int256 numerator.\n * @param b a FixedPoint denominator.\n * @return the quotient of `a` divided by `b`.\n */\n function div(int256 a, Signed memory b) internal pure returns (Signed memory) {\n return div(fromUnscaledInt(a), b);\n }\n\n /**\n * @notice Divides one `Signed` by an `Signed` and \"ceil's\" the quotient, reverting on overflow or division by 0.\n * @param a a FixedPoint numerator.\n * @param b a FixedPoint denominator.\n * @return the quotient of `a` divided by `b`.\n */\n function divAwayFromZero(Signed memory a, Signed memory b) internal pure returns (Signed memory) {\n int256 aScaled = a.rawValue.mul(SFP_SCALING_FACTOR);\n int256 divTowardsZero = aScaled.div(b.rawValue);\n // Manual mod because SignedSafeMath doesn't support it.\n int256 mod = aScaled % b.rawValue;\n if (mod != 0) {\n bool isResultPositive = isLessThan(a, 0) == isLessThan(b, 0);\n int256 valueToAdd = isResultPositive ? int256(1) : int256(-1);\n return Signed(divTowardsZero.add(valueToAdd));\n } else {\n return Signed(divTowardsZero);\n }\n }\n\n /**\n * @notice Divides one `Signed` by an unscaled int256 and \"ceil's\" the quotient, reverting on overflow or division by 0.\n * @param a a FixedPoint numerator.\n * @param b an int256 denominator.\n * @return the quotient of `a` divided by `b`.\n */\n function divAwayFromZero(Signed memory a, int256 b) internal pure returns (Signed memory) {\n // Because it is possible that a quotient gets truncated, we can't just call \"Signed(a.rawValue.div(b))\"\n // similarly to mulCeil with an int256 as the second parameter. Therefore we need to convert b into an Signed.\n // This creates the possibility of overflow if b is very large.\n return divAwayFromZero(a, fromUnscaledInt(b));\n }\n\n /**\n * @notice Raises an `Signed` to the power of an unscaled uint256, reverting on overflow. E.g., `b=2` squares `a`.\n * @dev This will \"floor\" the result.\n * @param a a FixedPoint.Signed.\n * @param b a uint256 (negative exponents are not allowed).\n * @return output is `a` to the power of `b`.\n */\n function pow(Signed memory a, uint256 b) internal pure returns (Signed memory output) {\n output = fromUnscaledInt(1);\n for (uint256 i = 0; i < b; i = i.add(1)) {\n output = mul(output, a);\n }\n }\n}\n" - }, - "@openzeppelin/contracts/utils/math/SafeMath.sol": { - "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts v4.4.1 (utils/math/SafeMath.sol)\n\npragma solidity ^0.8.0;\n\n// CAUTION\n// This version of SafeMath should only be used with Solidity 0.8 or later,\n// because it relies on the compiler's built in overflow checks.\n\n/**\n * @dev Wrappers over Solidity's arithmetic operations.\n *\n * NOTE: `SafeMath` is generally not needed starting with Solidity 0.8, since the compiler\n * now has built in overflow checking.\n */\nlibrary SafeMath {\n /**\n * @dev Returns the addition of two unsigned integers, with an overflow flag.\n *\n * _Available since v3.4._\n */\n function tryAdd(uint256 a, uint256 b) internal pure returns (bool, uint256) {\n unchecked {\n uint256 c = a + b;\n if (c < a) return (false, 0);\n return (true, c);\n }\n }\n\n /**\n * @dev Returns the substraction of two unsigned integers, with an overflow flag.\n *\n * _Available since v3.4._\n */\n function trySub(uint256 a, uint256 b) internal pure returns (bool, uint256) {\n unchecked {\n if (b > a) return (false, 0);\n return (true, a - b);\n }\n }\n\n /**\n * @dev Returns the multiplication of two unsigned integers, with an overflow flag.\n *\n * _Available since v3.4._\n */\n function tryMul(uint256 a, uint256 b) internal pure returns (bool, uint256) {\n unchecked {\n // Gas optimization: this is cheaper than requiring 'a' not being zero, but the\n // benefit is lost if 'b' is also tested.\n // See: https://github.com/OpenZeppelin/openzeppelin-contracts/pull/522\n if (a == 0) return (true, 0);\n uint256 c = a * b;\n if (c / a != b) return (false, 0);\n return (true, c);\n }\n }\n\n /**\n * @dev Returns the division of two unsigned integers, with a division by zero flag.\n *\n * _Available since v3.4._\n */\n function tryDiv(uint256 a, uint256 b) internal pure returns (bool, uint256) {\n unchecked {\n if (b == 0) return (false, 0);\n return (true, a / b);\n }\n }\n\n /**\n * @dev Returns the remainder of dividing two unsigned integers, with a division by zero flag.\n *\n * _Available since v3.4._\n */\n function tryMod(uint256 a, uint256 b) internal pure returns (bool, uint256) {\n unchecked {\n if (b == 0) return (false, 0);\n return (true, a % b);\n }\n }\n\n /**\n * @dev Returns the addition of two unsigned integers, reverting on\n * overflow.\n *\n * Counterpart to Solidity's `+` operator.\n *\n * Requirements:\n *\n * - Addition cannot overflow.\n */\n function add(uint256 a, uint256 b) internal pure returns (uint256) {\n return a + b;\n }\n\n /**\n * @dev Returns the subtraction of two unsigned integers, reverting on\n * overflow (when the result is negative).\n *\n * Counterpart to Solidity's `-` operator.\n *\n * Requirements:\n *\n * - Subtraction cannot overflow.\n */\n function sub(uint256 a, uint256 b) internal pure returns (uint256) {\n return a - b;\n }\n\n /**\n * @dev Returns the multiplication of two unsigned integers, reverting on\n * overflow.\n *\n * Counterpart to Solidity's `*` operator.\n *\n * Requirements:\n *\n * - Multiplication cannot overflow.\n */\n function mul(uint256 a, uint256 b) internal pure returns (uint256) {\n return a * b;\n }\n\n /**\n * @dev Returns the integer division of two unsigned integers, reverting on\n * division by zero. The result is rounded towards zero.\n *\n * Counterpart to Solidity's `/` operator.\n *\n * Requirements:\n *\n * - The divisor cannot be zero.\n */\n function div(uint256 a, uint256 b) internal pure returns (uint256) {\n return a / b;\n }\n\n /**\n * @dev Returns the remainder of dividing two unsigned integers. (unsigned integer modulo),\n * reverting when dividing by zero.\n *\n * Counterpart to Solidity's `%` operator. This function uses a `revert`\n * opcode (which leaves remaining gas untouched) while Solidity uses an\n * invalid opcode to revert (consuming all remaining gas).\n *\n * Requirements:\n *\n * - The divisor cannot be zero.\n */\n function mod(uint256 a, uint256 b) internal pure returns (uint256) {\n return a % b;\n }\n\n /**\n * @dev Returns the subtraction of two unsigned integers, reverting with custom message on\n * overflow (when the result is negative).\n *\n * CAUTION: This function is deprecated because it requires allocating memory for the error\n * message unnecessarily. For custom revert reasons use {trySub}.\n *\n * Counterpart to Solidity's `-` operator.\n *\n * Requirements:\n *\n * - Subtraction cannot overflow.\n */\n function sub(\n uint256 a,\n uint256 b,\n string memory errorMessage\n ) internal pure returns (uint256) {\n unchecked {\n require(b <= a, errorMessage);\n return a - b;\n }\n }\n\n /**\n * @dev Returns the integer division of two unsigned integers, reverting with custom message on\n * division by zero. The result is rounded towards zero.\n *\n * Counterpart to Solidity's `/` operator. Note: this function uses a\n * `revert` opcode (which leaves remaining gas untouched) while Solidity\n * uses an invalid opcode to revert (consuming all remaining gas).\n *\n * Requirements:\n *\n * - The divisor cannot be zero.\n */\n function div(\n uint256 a,\n uint256 b,\n string memory errorMessage\n ) internal pure returns (uint256) {\n unchecked {\n require(b > 0, errorMessage);\n return a / b;\n }\n }\n\n /**\n * @dev Returns the remainder of dividing two unsigned integers. (unsigned integer modulo),\n * reverting with custom message when dividing by zero.\n *\n * CAUTION: This function is deprecated because it requires allocating memory for the error\n * message unnecessarily. For custom revert reasons use {tryMod}.\n *\n * Counterpart to Solidity's `%` operator. This function uses a `revert`\n * opcode (which leaves remaining gas untouched) while Solidity uses an\n * invalid opcode to revert (consuming all remaining gas).\n *\n * Requirements:\n *\n * - The divisor cannot be zero.\n */\n function mod(\n uint256 a,\n uint256 b,\n string memory errorMessage\n ) internal pure returns (uint256) {\n unchecked {\n require(b > 0, errorMessage);\n return a % b;\n }\n }\n}\n" - }, - "@openzeppelin/contracts/utils/math/SignedSafeMath.sol": { - "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts v4.4.1 (utils/math/SignedSafeMath.sol)\n\npragma solidity ^0.8.0;\n\n/**\n * @dev Wrappers over Solidity's arithmetic operations.\n *\n * NOTE: `SignedSafeMath` is no longer needed starting with Solidity 0.8. The compiler\n * now has built in overflow checking.\n */\nlibrary SignedSafeMath {\n /**\n * @dev Returns the multiplication of two signed integers, reverting on\n * overflow.\n *\n * Counterpart to Solidity's `*` operator.\n *\n * Requirements:\n *\n * - Multiplication cannot overflow.\n */\n function mul(int256 a, int256 b) internal pure returns (int256) {\n return a * b;\n }\n\n /**\n * @dev Returns the integer division of two signed integers. Reverts on\n * division by zero. The result is rounded towards zero.\n *\n * Counterpart to Solidity's `/` operator.\n *\n * Requirements:\n *\n * - The divisor cannot be zero.\n */\n function div(int256 a, int256 b) internal pure returns (int256) {\n return a / b;\n }\n\n /**\n * @dev Returns the subtraction of two signed integers, reverting on\n * overflow.\n *\n * Counterpart to Solidity's `-` operator.\n *\n * Requirements:\n *\n * - Subtraction cannot overflow.\n */\n function sub(int256 a, int256 b) internal pure returns (int256) {\n return a - b;\n }\n\n /**\n * @dev Returns the addition of two signed integers, reverting on\n * overflow.\n *\n * Counterpart to Solidity's `+` operator.\n *\n * Requirements:\n *\n * - Addition cannot overflow.\n */\n function add(int256 a, int256 b) internal pure returns (int256) {\n return a + b;\n }\n}\n" - }, - "@uma/core/contracts/oracle/interfaces/FinderInterface.sol": { - "content": "// SPDX-License-Identifier: AGPL-3.0-only\npragma solidity ^0.8.0;\n\n/**\n * @title Provides addresses of the live contracts implementing certain interfaces.\n * @dev Examples are the Oracle or Store interfaces.\n */\ninterface FinderInterface {\n /**\n * @notice Updates the address of the contract that implements `interfaceName`.\n * @param interfaceName bytes32 encoding of the interface name that is either changed or registered.\n * @param implementationAddress address of the deployed contract that implements the interface.\n */\n function changeImplementationAddress(bytes32 interfaceName, address implementationAddress) external;\n\n /**\n * @notice Gets the address of the contract that implements the given `interfaceName`.\n * @param interfaceName queried interface.\n * @return implementationAddress address of the deployed contract that implements the interface.\n */\n function getImplementationAddress(bytes32 interfaceName) external view returns (address);\n}\n" - }, - "@uma/core/contracts/oracle/interfaces/IdentifierWhitelistInterface.sol": { - "content": "// SPDX-License-Identifier: AGPL-3.0-only\npragma solidity ^0.8.0;\n\n/**\n * @title Interface for whitelists of supported identifiers that the oracle can provide prices for.\n */\ninterface IdentifierWhitelistInterface {\n /**\n * @notice Adds the provided identifier as a supported identifier.\n * @dev Price requests using this identifier will succeed after this call.\n * @param identifier bytes32 encoding of the string identifier. Eg: BTC/USD.\n */\n function addSupportedIdentifier(bytes32 identifier) external;\n\n /**\n * @notice Removes the identifier from the whitelist.\n * @dev Price requests using this identifier will no longer succeed after this call.\n * @param identifier bytes32 encoding of the string identifier. Eg: BTC/USD.\n */\n function removeSupportedIdentifier(bytes32 identifier) external;\n\n /**\n * @notice Checks whether an identifier is on the whitelist.\n * @param identifier bytes32 encoding of the string identifier. Eg: BTC/USD.\n * @return bool if the identifier is supported (or not).\n */\n function isIdentifierSupported(bytes32 identifier) external view returns (bool);\n}\n" - }, - "@uma/core/contracts/common/interfaces/AddressWhitelistInterface.sol": { - "content": "// SPDX-License-Identifier: AGPL-3.0-only\npragma solidity ^0.8.0;\n\ninterface AddressWhitelistInterface {\n function addToWhitelist(address newElement) external;\n\n function removeFromWhitelist(address newElement) external;\n\n function isOnWhitelist(address newElement) external view returns (bool);\n\n function getWhitelist() external view returns (address[] memory);\n}\n" - }, - "@uma/core/contracts/common/implementation/AncillaryData.sol": { - "content": "// SPDX-License-Identifier: AGPL-3.0-only\npragma solidity ^0.8.0;\n\n/**\n * @title Library for encoding and decoding ancillary data for DVM price requests.\n * @notice We assume that on-chain ancillary data can be formatted directly from bytes to utf8 encoding via\n * web3.utils.hexToUtf8, and that clients will parse the utf8-encoded ancillary data as a comma-delimitted key-value\n * dictionary. Therefore, this library provides internal methods that aid appending to ancillary data from Solidity\n * smart contracts. More details on UMA's ancillary data guidelines below:\n * https://docs.google.com/document/d/1zhKKjgY1BupBGPPrY_WOJvui0B6DMcd-xDR8-9-SPDw/edit\n */\nlibrary AncillaryData {\n // This converts the bottom half of a bytes32 input to hex in a highly gas-optimized way.\n // Source: the brilliant implementation at https://gitter.im/ethereum/solidity?at=5840d23416207f7b0ed08c9b.\n function toUtf8Bytes32Bottom(bytes32 bytesIn) private pure returns (bytes32) {\n unchecked {\n uint256 x = uint256(bytesIn);\n\n // Nibble interleave\n x = x & 0x00000000000000000000000000000000ffffffffffffffffffffffffffffffff;\n x = (x | (x * 2**64)) & 0x0000000000000000ffffffffffffffff0000000000000000ffffffffffffffff;\n x = (x | (x * 2**32)) & 0x00000000ffffffff00000000ffffffff00000000ffffffff00000000ffffffff;\n x = (x | (x * 2**16)) & 0x0000ffff0000ffff0000ffff0000ffff0000ffff0000ffff0000ffff0000ffff;\n x = (x | (x * 2**8)) & 0x00ff00ff00ff00ff00ff00ff00ff00ff00ff00ff00ff00ff00ff00ff00ff00ff;\n x = (x | (x * 2**4)) & 0x0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f;\n\n // Hex encode\n uint256 h = (x & 0x0808080808080808080808080808080808080808080808080808080808080808) / 8;\n uint256 i = (x & 0x0404040404040404040404040404040404040404040404040404040404040404) / 4;\n uint256 j = (x & 0x0202020202020202020202020202020202020202020202020202020202020202) / 2;\n x = x + (h & (i | j)) * 0x27 + 0x3030303030303030303030303030303030303030303030303030303030303030;\n\n // Return the result.\n return bytes32(x);\n }\n }\n\n /**\n * @notice Returns utf8-encoded bytes32 string that can be read via web3.utils.hexToUtf8.\n * @dev Will return bytes32 in all lower case hex characters and without the leading 0x.\n * This has minor changes from the toUtf8BytesAddress to control for the size of the input.\n * @param bytesIn bytes32 to encode.\n * @return utf8 encoded bytes32.\n */\n function toUtf8Bytes(bytes32 bytesIn) internal pure returns (bytes memory) {\n return abi.encodePacked(toUtf8Bytes32Bottom(bytesIn >> 128), toUtf8Bytes32Bottom(bytesIn));\n }\n\n /**\n * @notice Returns utf8-encoded address that can be read via web3.utils.hexToUtf8.\n * Source: https://ethereum.stackexchange.com/questions/8346/convert-address-to-string/8447#8447\n * @dev Will return address in all lower case characters and without the leading 0x.\n * @param x address to encode.\n * @return utf8 encoded address bytes.\n */\n function toUtf8BytesAddress(address x) internal pure returns (bytes memory) {\n return\n abi.encodePacked(toUtf8Bytes32Bottom(bytes32(bytes20(x)) >> 128), bytes8(toUtf8Bytes32Bottom(bytes20(x))));\n }\n\n /**\n * @notice Converts a uint into a base-10, UTF-8 representation stored in a `string` type.\n * @dev This method is based off of this code: https://stackoverflow.com/a/65707309.\n */\n function toUtf8BytesUint(uint256 x) internal pure returns (bytes memory) {\n if (x == 0) {\n return \"0\";\n }\n uint256 j = x;\n uint256 len;\n while (j != 0) {\n len++;\n j /= 10;\n }\n bytes memory bstr = new bytes(len);\n uint256 k = len;\n while (x != 0) {\n k = k - 1;\n uint8 temp = (48 + uint8(x - (x / 10) * 10));\n bytes1 b1 = bytes1(temp);\n bstr[k] = b1;\n x /= 10;\n }\n return bstr;\n }\n\n function appendKeyValueBytes32(\n bytes memory currentAncillaryData,\n bytes memory key,\n bytes32 value\n ) internal pure returns (bytes memory) {\n bytes memory prefix = constructPrefix(currentAncillaryData, key);\n return abi.encodePacked(currentAncillaryData, prefix, toUtf8Bytes(value));\n }\n\n /**\n * @notice Adds \"key:value\" to `currentAncillaryData` where `value` is an address that first needs to be converted\n * to utf8 bytes. For example, if `utf8(currentAncillaryData)=\"k1:v1\"`, then this function will return\n * `utf8(k1:v1,key:value)`, and if `currentAncillaryData` is blank, then this will return `utf8(key:value)`.\n * @param currentAncillaryData This bytes data should ideally be able to be utf8-decoded, but its OK if not.\n * @param key Again, this bytes data should ideally be able to be utf8-decoded, but its OK if not.\n * @param value An address to set as the value in the key:value pair to append to `currentAncillaryData`.\n * @return Newly appended ancillary data.\n */\n function appendKeyValueAddress(\n bytes memory currentAncillaryData,\n bytes memory key,\n address value\n ) internal pure returns (bytes memory) {\n bytes memory prefix = constructPrefix(currentAncillaryData, key);\n return abi.encodePacked(currentAncillaryData, prefix, toUtf8BytesAddress(value));\n }\n\n /**\n * @notice Adds \"key:value\" to `currentAncillaryData` where `value` is a uint that first needs to be converted\n * to utf8 bytes. For example, if `utf8(currentAncillaryData)=\"k1:v1\"`, then this function will return\n * `utf8(k1:v1,key:value)`, and if `currentAncillaryData` is blank, then this will return `utf8(key:value)`.\n * @param currentAncillaryData This bytes data should ideally be able to be utf8-decoded, but its OK if not.\n * @param key Again, this bytes data should ideally be able to be utf8-decoded, but its OK if not.\n * @param value A uint to set as the value in the key:value pair to append to `currentAncillaryData`.\n * @return Newly appended ancillary data.\n */\n function appendKeyValueUint(\n bytes memory currentAncillaryData,\n bytes memory key,\n uint256 value\n ) internal pure returns (bytes memory) {\n bytes memory prefix = constructPrefix(currentAncillaryData, key);\n return abi.encodePacked(currentAncillaryData, prefix, toUtf8BytesUint(value));\n }\n\n /**\n * @notice Helper method that returns the left hand side of a \"key:value\" pair plus the colon \":\" and a leading\n * comma \",\" if the `currentAncillaryData` is not empty. The return value is intended to be prepended as a prefix to\n * some utf8 value that is ultimately added to a comma-delimited, key-value dictionary.\n */\n function constructPrefix(bytes memory currentAncillaryData, bytes memory key) internal pure returns (bytes memory) {\n if (currentAncillaryData.length > 0) {\n return abi.encodePacked(\",\", key, \":\");\n } else {\n return abi.encodePacked(key, \":\");\n }\n }\n}\n" - }, - "@uma/core/contracts/oracle/implementation/Constants.sol": { - "content": "// SPDX-License-Identifier: AGPL-3.0-only\npragma solidity ^0.8.0;\n\n/**\n * @title Stores common interface names used throughout the DVM by registration in the Finder.\n */\nlibrary OracleInterfaces {\n bytes32 public constant Oracle = \"Oracle\";\n bytes32 public constant IdentifierWhitelist = \"IdentifierWhitelist\";\n bytes32 public constant Store = \"Store\";\n bytes32 public constant FinancialContractsAdmin = \"FinancialContractsAdmin\";\n bytes32 public constant Registry = \"Registry\";\n bytes32 public constant CollateralWhitelist = \"CollateralWhitelist\";\n bytes32 public constant OptimisticOracle = \"OptimisticOracle\";\n bytes32 public constant Bridge = \"Bridge\";\n bytes32 public constant GenericHandler = \"GenericHandler\";\n bytes32 public constant SkinnyOptimisticOracle = \"SkinnyOptimisticOracle\";\n bytes32 public constant ChildMessenger = \"ChildMessenger\";\n bytes32 public constant OracleHub = \"OracleHub\";\n bytes32 public constant OracleSpoke = \"OracleSpoke\";\n}\n\n/**\n * @title Commonly re-used values for contracts associated with the OptimisticOracle.\n */\nlibrary OptimisticOracleConstraints {\n // Any price request submitted to the OptimisticOracle must contain ancillary data no larger than this value.\n // This value must be <= the Voting contract's `ancillaryBytesLimit` constant value otherwise it is possible\n // that a price can be requested to the OptimisticOracle successfully, but cannot be resolved by the DVM which\n // refuses to accept a price request made with ancillary data length over a certain size.\n uint256 public constant ancillaryBytesLimit = 8192;\n}\n" - }, - "contracts/Lockable.sol": { - "content": "// SPDX-License-Identifier: AGPL-3.0-only\r\npragma solidity ^0.8.0;\r\n\r\n/**\r\n * @title A contract that provides modifiers to prevent reentrancy to state-changing and view-only methods. This contract\r\n * is inspired by https://github.com/OpenZeppelin/openzeppelin-contracts/blob/master/contracts/utils/ReentrancyGuard.sol\r\n * and https://github.com/balancer-labs/balancer-core/blob/master/contracts/BPool.sol.\r\n */\r\ncontract Lockable {\r\n bool internal _notEntered;\r\n\r\n constructor() {\r\n // Storing an initial non-zero value makes deployment a bit more expensive, but in exchange the refund on every\r\n // call to nonReentrant will be lower in amount. Since refunds are capped to a percentage of the total\r\n // transaction's gas, it is best to keep them low in cases like this one, to increase the likelihood of the full\r\n // refund coming into effect.\r\n _notEntered = true;\r\n }\r\n\r\n /**\r\n * @dev Prevents a contract from calling itself, directly or indirectly.\r\n * Calling a `nonReentrant` function from another `nonReentrant` function is not supported. It is possible to\r\n * prevent this from happening by making the `nonReentrant` function external, and making it call a `private`\r\n * function that does the actual state modification.\r\n */\r\n modifier nonReentrant() {\r\n _preEntranceCheck();\r\n _preEntranceSet();\r\n _;\r\n _postEntranceReset();\r\n }\r\n\r\n /**\r\n * @dev Designed to prevent a view-only method from being re-entered during a call to a `nonReentrant()` state-changing method.\r\n */\r\n modifier nonReentrantView() {\r\n _preEntranceCheck();\r\n _;\r\n }\r\n\r\n /**\r\n * @dev Returns true if the contract is currently in a non-entered state, meaning that the origination of the call\r\n * came from outside the contract. This is relevant with fallback/receive methods to see if the call came from ETH\r\n * being dropped onto the contract externally or due to ETH dropped on the the contract from within a method in this\r\n * contract, such as unwrapping WETH to ETH within the contract.\r\n */\r\n function functionCallStackOriginatesFromOutsideThisContract() internal view returns (bool) {\r\n return _notEntered;\r\n }\r\n\r\n // Internal methods are used to avoid copying the require statement's bytecode to every `nonReentrant()` method.\r\n // On entry into a function, `_preEntranceCheck()` should always be called to check if the function is being\r\n // re-entered. Then, if the function modifies state, it should call `_postEntranceSet()`, perform its logic, and\r\n // then call `_postEntranceReset()`.\r\n // View-only methods can simply call `_preEntranceCheck()` to make sure that it is not being re-entered.\r\n function _preEntranceCheck() internal view {\r\n // On the first call to nonReentrant, _notEntered will be true\r\n require(_notEntered, \"ReentrancyGuard: reentrant call\");\r\n }\r\n\r\n function _preEntranceSet() internal {\r\n // Any calls to nonReentrant after this point will fail\r\n _notEntered = false;\r\n }\r\n\r\n function _postEntranceReset() internal {\r\n // By storing the original value once again, a refund is triggered (see\r\n // https://eips.ethereum.org/EIPS/eip-2200)\r\n _notEntered = true;\r\n }\r\n}\r\n" - } - }, - "settings": { - "optimizer": { - "enabled": true, - "runs": 1000000 - }, - "outputSelection": { - "*": { - "*": [ - "abi", - "evm.bytecode", - "evm.deployedBytecode", - "evm.methodIdentifiers", - "metadata", - "devdoc", - "userdoc", - "storageLayout", - "evm.gasEstimates" - ], - "": ["ast"] - } - }, - "metadata": { - "useLiteralContent": true - } - } -} diff --git a/deployments/rinkeby/Arbitrum_Adapter.json b/deployments/rinkeby/Arbitrum_Adapter.json index 7d7b5943d..b213a1d7a 100644 --- a/deployments/rinkeby/Arbitrum_Adapter.json +++ b/deployments/rinkeby/Arbitrum_Adapter.json @@ -1,13 +1,8 @@ { - "address": "0xf116afc252687B487AceDcf3038790252D43fB83", + "address": "0x1f3774939f477D54962EC0961545E782D5475B32", "abi": [ { "inputs": [ - { - "internalType": "address", - "name": "_hubPool", - "type": "address" - }, { "internalType": "contract ArbitrumL1InboxLike", "name": "_l1ArbitrumInbox", @@ -22,71 +17,6 @@ "stateMutability": "nonpayable", "type": "constructor" }, - { - "anonymous": false, - "inputs": [ - { - "indexed": false, - "internalType": "address", - "name": "newHubPool", - "type": "address" - } - ], - "name": "HubPoolChanged", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": false, - "internalType": "uint32", - "name": "newL2GasLimit", - "type": "uint32" - } - ], - "name": "L2GasLimitSet", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": false, - "internalType": "uint256", - "name": "newL2GasPrice", - "type": "uint256" - } - ], - "name": "L2GasPriceSet", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": false, - "internalType": "uint256", - "name": "newL2MaxSubmissionCost", - "type": "uint256" - } - ], - "name": "L2MaxSubmissionCostSet", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": false, - "internalType": "address", - "name": "newL2RefundL2Address", - "type": "address" - } - ], - "name": "L2RefundL2AddressSet", - "type": "event" - }, { "anonymous": false, "inputs": [ @@ -106,25 +36,6 @@ "name": "MessageRelayed", "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" - }, { "anonymous": false, "inputs": [ @@ -166,20 +77,7 @@ "type": "uint256" } ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "hubPool", - "outputs": [ - { - "internalType": "address", - "name": "", - "type": "address" - } - ], - "stateMutability": "view", + "stateMutability": "pure", "type": "function" }, { @@ -260,19 +158,6 @@ "stateMutability": "view", "type": "function" }, - { - "inputs": [], - "name": "owner", - "outputs": [ - { - "internalType": "address", - "name": "", - "type": "address" - } - ], - "stateMutability": "view", - "type": "function" - }, { "inputs": [ { @@ -318,264 +203,83 @@ "outputs": [], "stateMutability": "payable", "type": "function" - }, - { - "inputs": [], - "name": "renounceOwnership", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "_hubPool", - "type": "address" - } - ], - "name": "setHubPool", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "uint32", - "name": "_l2GasLimit", - "type": "uint32" - } - ], - "name": "setL2GasLimit", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "uint256", - "name": "_l2GasPrice", - "type": "uint256" - } - ], - "name": "setL2GasPrice", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "uint256", - "name": "_l2MaxSubmissionCost", - "type": "uint256" - } - ], - "name": "setL2MaxSubmissionCost", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "_l2RefundL2Address", - "type": "address" - } - ], - "name": "setL2RefundL2Address", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "newOwner", - "type": "address" - } - ], - "name": "transferOwnership", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "stateMutability": "payable", - "type": "receive" } ], - "transactionHash": "0x07ffdd06e6b55db041e0d1be3aa25e138ac366fe6072b38cc574ee45cd4fed30", + "transactionHash": "0x778817240ebd86869141f3196957b4c3d0505dd5247a4108e5fcd1e64a0a2792", "receipt": { "to": null, "from": "0x9A8f92a830A5cB89a3816e3D267CB7791c16b04D", - "contractAddress": "0xf116afc252687B487AceDcf3038790252D43fB83", - "transactionIndex": 11, - "gasUsed": "1353527", - "logsBloom": "0x00000000000000000000000000000000000000000000000000800000000000000000000000000010000000000000000000000000000000000000000000000000000000000000000000000000000000000001000000000008000000000000000000000000020000000000000000000800000000000000000000000000040000400000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000200000000000000000000000000000800000000000000000000000000000000000000000000020000001000000000000000000000000000000000000000000000000000000000000", - "blockHash": "0xdf91a8dd7c7d79daafd4607be1123171ed6a8e1d621f4aa56679436bd24ea0b9", - "transactionHash": "0x07ffdd06e6b55db041e0d1be3aa25e138ac366fe6072b38cc574ee45cd4fed30", - "logs": [ - { - "transactionIndex": 11, - "blockNumber": 10226933, - "transactionHash": "0x07ffdd06e6b55db041e0d1be3aa25e138ac366fe6072b38cc574ee45cd4fed30", - "address": "0xf116afc252687B487AceDcf3038790252D43fB83", - "topics": [ - "0x8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0", - "0x0000000000000000000000000000000000000000000000000000000000000000", - "0x0000000000000000000000009a8f92a830a5cb89a3816e3d267cb7791c16b04d" - ], - "data": "0x", - "logIndex": 23, - "blockHash": "0xdf91a8dd7c7d79daafd4607be1123171ed6a8e1d621f4aa56679436bd24ea0b9" - } - ], - "blockNumber": 10226933, - "cumulativeGasUsed": "2951798", + "contractAddress": "0x1f3774939f477D54962EC0961545E782D5475B32", + "transactionIndex": 72, + "gasUsed": "644324", + "logsBloom": "0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", + "blockHash": "0xa43b341ea15163300bc2048b621c47b8ef1fb5802353336fb7314d33d5ad98b2", + "transactionHash": "0x778817240ebd86869141f3196957b4c3d0505dd5247a4108e5fcd1e64a0a2792", + "logs": [], + "blockNumber": 10365601, + "cumulativeGasUsed": "7380891", "status": 1, "byzantium": true }, - "args": [ - "0xFA6326FdF1f149B63d116576fCfbc7e15cc0355A", - "0x578BAde599406A8fE3d24Fd7f7211c0911F5B29e", - "0x91169Dbb45e6804743F94609De50D511C437572E" - ], + "args": ["0x578BAde599406A8fE3d24Fd7f7211c0911F5B29e", "0x91169Dbb45e6804743F94609De50D511C437572E"], "numDeployments": 1, - "solcInputHash": "cee77d8f3a5225b985a9cf3439956316", - "metadata": "{\"compiler\":{\"version\":\"0.8.11+commit.d7f03943\"},\"language\":\"Solidity\",\"output\":{\"abi\":[{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_hubPool\",\"type\":\"address\"},{\"internalType\":\"contract ArbitrumL1InboxLike\",\"name\":\"_l1ArbitrumInbox\",\"type\":\"address\"},{\"internalType\":\"contract ArbitrumL1ERC20GatewayLike\",\"name\":\"_l1ERC20Gateway\",\"type\":\"address\"}],\"stateMutability\":\"nonpayable\",\"type\":\"constructor\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"address\",\"name\":\"newHubPool\",\"type\":\"address\"}],\"name\":\"HubPoolChanged\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"uint32\",\"name\":\"newL2GasLimit\",\"type\":\"uint32\"}],\"name\":\"L2GasLimitSet\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"newL2GasPrice\",\"type\":\"uint256\"}],\"name\":\"L2GasPriceSet\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"newL2MaxSubmissionCost\",\"type\":\"uint256\"}],\"name\":\"L2MaxSubmissionCostSet\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"address\",\"name\":\"newL2RefundL2Address\",\"type\":\"address\"}],\"name\":\"L2RefundL2AddressSet\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"address\",\"name\":\"target\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"bytes\",\"name\":\"message\",\"type\":\"bytes\"}],\"name\":\"MessageRelayed\",\"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\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"address\",\"name\":\"l1Token\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"address\",\"name\":\"l2Token\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"address\",\"name\":\"to\",\"type\":\"address\"}],\"name\":\"TokensRelayed\",\"type\":\"event\"},{\"inputs\":[],\"name\":\"getL1CallValue\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"hubPool\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"l1ERC20Gateway\",\"outputs\":[{\"internalType\":\"contract ArbitrumL1ERC20GatewayLike\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"l1Inbox\",\"outputs\":[{\"internalType\":\"contract ArbitrumL1InboxLike\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"l2GasLimit\",\"outputs\":[{\"internalType\":\"uint32\",\"name\":\"\",\"type\":\"uint32\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"l2GasPrice\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"l2MaxSubmissionCost\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"l2RefundL2Address\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"owner\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"target\",\"type\":\"address\"},{\"internalType\":\"bytes\",\"name\":\"message\",\"type\":\"bytes\"}],\"name\":\"relayMessage\",\"outputs\":[],\"stateMutability\":\"payable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"l1Token\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"l2Token\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"},{\"internalType\":\"address\",\"name\":\"to\",\"type\":\"address\"}],\"name\":\"relayTokens\",\"outputs\":[],\"stateMutability\":\"payable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"renounceOwnership\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_hubPool\",\"type\":\"address\"}],\"name\":\"setHubPool\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint32\",\"name\":\"_l2GasLimit\",\"type\":\"uint32\"}],\"name\":\"setL2GasLimit\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"_l2GasPrice\",\"type\":\"uint256\"}],\"name\":\"setL2GasPrice\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"_l2MaxSubmissionCost\",\"type\":\"uint256\"}],\"name\":\"setL2MaxSubmissionCost\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_l2RefundL2Address\",\"type\":\"address\"}],\"name\":\"setL2RefundL2Address\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"newOwner\",\"type\":\"address\"}],\"name\":\"transferOwnership\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"stateMutability\":\"payable\",\"type\":\"receive\"}],\"devdoc\":{\"kind\":\"dev\",\"methods\":{\"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 anymore. Can only be called by the current owner. NOTE: Renouncing ownership will leave the contract without an owner, thereby removing 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.\"}},\"version\":1},\"userdoc\":{\"kind\":\"user\",\"methods\":{},\"version\":1}},\"settings\":{\"compilationTarget\":{\"contracts/chain-adapters/Arbitrum_Adapter.sol\":\"Arbitrum_Adapter\"},\"evmVersion\":\"london\",\"libraries\":{},\"metadata\":{\"bytecodeHash\":\"ipfs\",\"useLiteralContent\":true},\"optimizer\":{\"enabled\":true,\"runs\":1000000},\"remappings\":[]},\"sources\":{\"@openzeppelin/contracts/access/Ownable.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts v4.4.1 (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 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 called by any account other than the owner.\\n */\\n modifier onlyOwner() {\\n require(owner() == _msgSender(), \\\"Ownable: caller is not the owner\\\");\\n _;\\n }\\n\\n /**\\n * @dev Leaves the contract without owner. It will not be possible to call\\n * `onlyOwner` functions anymore. Can only be called by the current owner.\\n *\\n * NOTE: Renouncing ownership will leave the contract without an owner,\\n * thereby removing 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\",\"keccak256\":\"0x24e0364e503a9bbde94c715d26573a76f14cd2a202d45f96f52134ab806b67b9\",\"license\":\"MIT\"},\"@openzeppelin/contracts/token/ERC20/IERC20.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts v4.4.1 (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 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 `recipient`.\\n *\\n * Returns a boolean value indicating whether the operation succeeded.\\n *\\n * Emits a {Transfer} event.\\n */\\n function transfer(address recipient, 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 `sender` to `recipient` 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(\\n address sender,\\n address recipient,\\n uint256 amount\\n ) external returns (bool);\\n\\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\",\"keccak256\":\"0x61437cb513a887a1bbad006e7b1c8b414478427d33de47c5600af3c748f108da\",\"license\":\"MIT\"},\"@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\",\"keccak256\":\"0xe2e337e6dde9ef6b680e07338c493ebea1b5fd09b43424112868e9cc1706bca7\",\"license\":\"MIT\"},\"@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\",\"keccak256\":\"0xcd34b3f83b61a096b53020749f327096d5cacd89c2393d947595afb934496ad4\",\"license\":\"AGPL-3.0-only\"},\"contracts/chain-adapters/Arbitrum_Adapter.sol\":{\"content\":\"// SPDX-License-Identifier: AGPL-3.0-only\\r\\npragma solidity ^0.8.0;\\r\\n\\r\\nimport \\\"./Base_Adapter.sol\\\";\\r\\nimport \\\"../interfaces/AdapterInterface.sol\\\";\\r\\nimport \\\"../interfaces/WETH9.sol\\\";\\r\\n\\r\\nimport \\\"@uma/core/contracts/common/implementation/Lockable.sol\\\";\\r\\n\\r\\nimport \\\"@openzeppelin/contracts/token/ERC20/IERC20.sol\\\";\\r\\n\\r\\ninterface ArbitrumL1InboxLike {\\r\\n function createRetryableTicket(\\r\\n address destAddr,\\r\\n uint256 arbTxCallValue,\\r\\n uint256 maxSubmissionCost,\\r\\n address submissionRefundAddress,\\r\\n address valueRefundAddress,\\r\\n uint256 maxGas,\\r\\n uint256 gasPriceBid,\\r\\n bytes calldata data\\r\\n ) external payable returns (uint256);\\r\\n}\\r\\n\\r\\ninterface ArbitrumL1ERC20GatewayLike {\\r\\n function outboundTransfer(\\r\\n address _token,\\r\\n address _to,\\r\\n uint256 _amount,\\r\\n uint256 _maxGas,\\r\\n uint256 _gasPriceBid,\\r\\n bytes calldata _data\\r\\n ) external payable returns (bytes memory);\\r\\n}\\r\\n\\r\\ncontract Arbitrum_Adapter is Base_Adapter, Lockable {\\r\\n // Gas limit for immediate L2 execution attempt (can be estimated via NodeInterface.estimateRetryableTicket).\\r\\n // NodeInterface precompile interface exists at L2 address 0x00000000000000000000000000000000000000C8\\r\\n uint32 public l2GasLimit = 5_000_000;\\r\\n\\r\\n // Amount of ETH allocated to pay for the base submission fee. The base submission fee is a parameter unique to\\r\\n // retryable transactions; the user is charged the base submission fee to cover the storage costs of keeping their\\r\\n // ticket\\u2019s calldata in the retry buffer. (current base submission fee is queryable via\\r\\n // ArbRetryableTx.getSubmissionPrice). ArbRetryableTicket precompile interface exists at L2 address\\r\\n // 0x000000000000000000000000000000000000006E.\\r\\n uint256 public l2MaxSubmissionCost = 0.1e18;\\r\\n\\r\\n // L2 Gas price bid for immediate L2 execution attempt (queryable via standard eth*gasPrice RPC)\\r\\n uint256 public l2GasPrice = 10e9; // 10 gWei\\r\\n\\r\\n // This address on L2 receives extra ETH that is left over after relaying a message via the inbox.\\r\\n address public l2RefundL2Address;\\r\\n\\r\\n ArbitrumL1InboxLike public l1Inbox;\\r\\n\\r\\n ArbitrumL1ERC20GatewayLike public l1ERC20Gateway;\\r\\n\\r\\n event L2GasLimitSet(uint32 newL2GasLimit);\\r\\n\\r\\n event L2MaxSubmissionCostSet(uint256 newL2MaxSubmissionCost);\\r\\n\\r\\n event L2GasPriceSet(uint256 newL2GasPrice);\\r\\n\\r\\n event L2RefundL2AddressSet(address newL2RefundL2Address);\\r\\n\\r\\n constructor(\\r\\n address _hubPool,\\r\\n ArbitrumL1InboxLike _l1ArbitrumInbox,\\r\\n ArbitrumL1ERC20GatewayLike _l1ERC20Gateway\\r\\n ) Base_Adapter(_hubPool) {\\r\\n l1Inbox = _l1ArbitrumInbox;\\r\\n l1ERC20Gateway = _l1ERC20Gateway;\\r\\n\\r\\n l2RefundL2Address = owner();\\r\\n }\\r\\n\\r\\n function setL2GasLimit(uint32 _l2GasLimit) public onlyOwner {\\r\\n l2GasLimit = _l2GasLimit;\\r\\n emit L2GasLimitSet(l2GasLimit);\\r\\n }\\r\\n\\r\\n function setL2MaxSubmissionCost(uint256 _l2MaxSubmissionCost) public onlyOwner {\\r\\n l2MaxSubmissionCost = _l2MaxSubmissionCost;\\r\\n emit L2MaxSubmissionCostSet(l2MaxSubmissionCost);\\r\\n }\\r\\n\\r\\n function setL2GasPrice(uint256 _l2GasPrice) public onlyOwner {\\r\\n l2GasPrice = _l2GasPrice;\\r\\n emit L2GasPriceSet(l2GasPrice);\\r\\n }\\r\\n\\r\\n function setL2RefundL2Address(address _l2RefundL2Address) public onlyOwner {\\r\\n l2RefundL2Address = _l2RefundL2Address;\\r\\n emit L2RefundL2AddressSet(l2RefundL2Address);\\r\\n }\\r\\n\\r\\n function relayMessage(address target, bytes memory message) external payable override nonReentrant onlyHubPool {\\r\\n uint256 requiredL1CallValue = getL1CallValue();\\r\\n require(address(this).balance >= requiredL1CallValue, \\\"Insufficient ETH balance\\\");\\r\\n\\r\\n l1Inbox.createRetryableTicket{ value: requiredL1CallValue }(\\r\\n target, // destAddr destination L2 contract address\\r\\n 0, // l2CallValue call value for retryable L2 message\\r\\n l2MaxSubmissionCost, // maxSubmissionCost Max gas deducted from user's L2 balance to cover base submission fee\\r\\n l2RefundL2Address, // excessFeeRefundAddress maxgas x gasprice - execution cost gets credited here on L2 balance\\r\\n l2RefundL2Address, // callValueRefundAddress l2Callvalue gets credited here on L2 if retryable txn times out or gets cancelled\\r\\n l2GasLimit, // maxGas Max gas deducted from user's L2 balance to cover L2 execution\\r\\n l2GasPrice, // gasPriceBid price bid for L2 execution\\r\\n message // data ABI encoded data of L2 message\\r\\n );\\r\\n\\r\\n emit MessageRelayed(target, message);\\r\\n }\\r\\n\\r\\n function relayTokens(\\r\\n address l1Token,\\r\\n address l2Token, // l2Token is unused for Arbitrum.\\r\\n uint256 amount,\\r\\n address to\\r\\n ) external payable override nonReentrant onlyHubPool {\\r\\n l1ERC20Gateway.outboundTransfer(l1Token, to, amount, l2GasLimit, l2GasPrice, \\\"\\\");\\r\\n emit TokensRelayed(l1Token, l2Token, amount, to);\\r\\n }\\r\\n\\r\\n function getL1CallValue() public view returns (uint256) {\\r\\n return l2MaxSubmissionCost + l2GasPrice * l2GasLimit;\\r\\n }\\r\\n\\r\\n receive() external payable {}\\r\\n}\\r\\n\",\"keccak256\":\"0x4d830e78208ff7bcdbb2038747a9352d7788461a0d9a83dfe0c32300e8f78569\",\"license\":\"AGPL-3.0-only\"},\"contracts/chain-adapters/Base_Adapter.sol\":{\"content\":\"// SPDX-License-Identifier: AGPL-3.0-only\\npragma solidity ^0.8.0;\\nimport \\\"../interfaces/AdapterInterface.sol\\\";\\n\\nimport \\\"@openzeppelin/contracts/access/Ownable.sol\\\";\\n\\nabstract contract Base_Adapter is Ownable, AdapterInterface {\\n address public hubPool;\\n\\n modifier onlyHubPool() {\\n require(msg.sender == hubPool, \\\"Can only be called by hubPool\\\");\\n _;\\n }\\n\\n constructor(address _hubPool) {\\n hubPool = _hubPool;\\n }\\n\\n function setHubPool(address _hubPool) public onlyOwner {\\n hubPool = _hubPool;\\n emit HubPoolChanged(_hubPool);\\n }\\n}\\n\",\"keccak256\":\"0xfe795ada9a48a1dbbfe7d8e002ba8b78bae9f839206d37a471449a99895ce7ae\",\"license\":\"AGPL-3.0-only\"},\"contracts/interfaces/AdapterInterface.sol\":{\"content\":\"// SPDX-License-Identifier: AGPL-3.0-only\\npragma solidity ^0.8.0;\\n\\n/**\\n * @notice Sends cross chain messages and tokens to contracts on a specific L2 network.\\n */\\n\\ninterface AdapterInterface {\\n event HubPoolChanged(address newHubPool);\\n\\n event MessageRelayed(address target, bytes message);\\n\\n event TokensRelayed(address l1Token, address l2Token, uint256 amount, address to);\\n\\n function relayMessage(address target, bytes memory message) external payable;\\n\\n function relayTokens(\\n address l1Token,\\n address l2Token,\\n uint256 amount,\\n address to\\n ) external payable;\\n}\\n\",\"keccak256\":\"0x60e1ed2205f90655fe4152a90709be15bc9550fb3faeaf9835fee22c095bab11\",\"license\":\"AGPL-3.0-only\"},\"contracts/interfaces/WETH9.sol\":{\"content\":\"// SPDX-License-Identifier: GPL-3.0-only\\r\\npragma solidity ^0.8.0;\\r\\n\\r\\ninterface WETH9 {\\r\\n function withdraw(uint256 wad) external;\\r\\n\\r\\n function deposit() external payable;\\r\\n\\r\\n function balanceOf(address guy) external view returns (uint256 wad);\\r\\n\\r\\n function transfer(address guy, uint256 wad) external;\\r\\n}\\r\\n\",\"keccak256\":\"0x08755a7e4fc4ed75895c9b803f19552c4f0a455947dca04d86db4355114253b3\",\"license\":\"GPL-3.0-only\"}},\"version\":1}", - "bytecode": "0x60806040526001805463ffffffff60a81b19166201312d60ae1b17905567016345785d8a00006002556402540be4006003553480156200003e57600080fd5b506040516200165038038062001650833981016040819052620000619162000139565b826200006d33620000d0565b600180546001600160a81b0319166001600160a01b0392831617600160a01b179055600580549382166001600160a01b0319948516179055600680549282169284169290921790915560005460048054919092169216919091179055506200018d565b600080546001600160a01b038381166001600160a01b0319831681178455604051919092169283917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a35050565b6001600160a01b03811681146200013657600080fd5b50565b6000806000606084860312156200014f57600080fd5b83516200015c8162000120565b60208501519093506200016f8162000120565b6040850151909250620001828162000120565b809150509250925092565b6114b3806200019d6000396000f3fe60806040526004361061012d5760003560e01c8063b9d37d42116100a5578063da0323ce11610074578063e599477e11610059578063e599477e14610390578063e6eb8ade146103a6578063f2fde38b146103b957600080fd5b8063da0323ce14610343578063e19044021461036357600080fd5b8063b9d37d4214610298578063cc69534c146102b8578063cf6e65b7146102d8578063d921878d1461032357600080fd5b8063715018a6116100fc5780638da5cb5b116100e15780638da5cb5b1461022a5780639ae36685146102555780639c3ba2001461026b57600080fd5b8063715018a6146101e85780638134f385146101fd57600080fd5b806308f1ed15146101395780630e283a6a146101615780631dfb2d02146101b357806352c8c75c146101d557600080fd5b3661013457005b600080fd5b34801561014557600080fd5b5061014e6103d9565b6040519081526020015b60405180910390f35b34801561016d57600080fd5b5060065461018e9073ffffffffffffffffffffffffffffffffffffffff1681565b60405173ffffffffffffffffffffffffffffffffffffffff9091168152602001610158565b3480156101bf57600080fd5b506101d36101ce36600461104a565b61041e565b005b6101d36101e336600461106c565b61051e565b3480156101f457600080fd5b506101d3610785565b34801561020957600080fd5b5060055461018e9073ffffffffffffffffffffffffffffffffffffffff1681565b34801561023657600080fd5b5060005473ffffffffffffffffffffffffffffffffffffffff1661018e565b34801561026157600080fd5b5061014e60035481565b34801561027757600080fd5b5060045461018e9073ffffffffffffffffffffffffffffffffffffffff1681565b3480156102a457600080fd5b506101d36102b33660046110b9565b610812565b3480156102c457600080fd5b506101d36102d33660046110b9565b6108c8565b3480156102e457600080fd5b5060015461030e907501000000000000000000000000000000000000000000900463ffffffff1681565b60405163ffffffff9091168152602001610158565b34801561032f57600080fd5b506101d361033e3660046110d2565b61097e565b34801561034f57600080fd5b506101d361035e36600461104a565b610a80565b34801561036f57600080fd5b5060015461018e9073ffffffffffffffffffffffffffffffffffffffff1681565b34801561039c57600080fd5b5061014e60025481565b6101d36103b43660046111bc565b610b74565b3480156103c557600080fd5b506101d36103d436600461104a565b610df8565b60015460035460009161040c91750100000000000000000000000000000000000000000090910463ffffffff169061127c565b60025461041991906112b9565b905090565b60005473ffffffffffffffffffffffffffffffffffffffff1633146104a4576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657260448201526064015b60405180910390fd5b600180547fffffffffffffffffffffffff00000000000000000000000000000000000000001673ffffffffffffffffffffffffffffffffffffffff83169081179091556040519081527fb5f5d393a77ca9332951514b7bbfed2186d8fecdfafa02a2a676b05e67716963906020015b60405180910390a150565b610526610f28565b610553600180547fffffffffffffffffffffff00ffffffffffffffffffffffffffffffffffffffff169055565b60015473ffffffffffffffffffffffffffffffffffffffff1633146105d4576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601d60248201527f43616e206f6e6c792062652063616c6c656420627920687562506f6f6c000000604482015260640161049b565b6006546001546003546040517fd2ce7d6500000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff8881166004830152858116602483015260448201879052750100000000000000000000000000000000000000000090930463ffffffff166064820152608481019190915260c060a4820152600060c482015291169063d2ce7d659060e4016000604051808303816000875af1158015610695573d6000803e3d6000fd5b505050506040513d6000823e601f3d9081017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe01682016040526106db91908101906112fd565b506040805173ffffffffffffffffffffffffffffffffffffffff868116825285811660208301528183018590528316606082015290517fd7e09655439c3932e55857df3220186e5a7f0980825f20691c2b35d941dee75b9181900360800190a161077f600180547fffffffffffffffffffffff00ffffffffffffffffffffffffffffffffffffffff1674010000000000000000000000000000000000000000179055565b50505050565b60005473ffffffffffffffffffffffffffffffffffffffff163314610806576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604482015260640161049b565b6108106000610fac565b565b60005473ffffffffffffffffffffffffffffffffffffffff163314610893576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604482015260640161049b565b60038190556040518181527f11b37f476a8e54576728852320de360efcd9aa85196d533f0bcee62199c1c7a890602001610513565b60005473ffffffffffffffffffffffffffffffffffffffff163314610949576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604482015260640161049b565b60028190556040518181527f0f2c592d7af44ef2fd6f17f67ea8bcecbc73b6d26745fd69234149c377ee4fb690602001610513565b60005473ffffffffffffffffffffffffffffffffffffffff1633146109ff576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604482015260640161049b565b600180547fffffffffffffff00000000ffffffffffffffffffffffffffffffffffffffffff16750100000000000000000000000000000000000000000063ffffffff8481168202929092179283905560405192041681527f69f42c68da3e328d797524adf92a3bbe202f1ee08416cfed0823b7c70dfcdc1890602001610513565b60005473ffffffffffffffffffffffffffffffffffffffff163314610b01576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604482015260640161049b565b600480547fffffffffffffffffffffffff00000000000000000000000000000000000000001673ffffffffffffffffffffffffffffffffffffffff83169081179091556040519081527ffa92d17b08fbc5336e463f747e5efb7ab824785604b92201e7f06e998726bec990602001610513565b610b7c610f28565b610ba9600180547fffffffffffffffffffffff00ffffffffffffffffffffffffffffffffffffffff169055565b60015473ffffffffffffffffffffffffffffffffffffffff163314610c2a576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601d60248201527f43616e206f6e6c792062652063616c6c656420627920687562506f6f6c000000604482015260640161049b565b6000610c346103d9565b905080471015610ca0576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601860248201527f496e73756666696369656e74204554482062616c616e63650000000000000000604482015260640161049b565b600554600254600480546001546003546040517f679b6ded00000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff9687169663679b6ded968996610d32968d96600096939594909116938493750100000000000000000000000000000000000000000090920463ffffffff16928e91016113be565b60206040518083038185885af1158015610d50573d6000803e3d6000fd5b50505050506040513d601f19601f82011682018060405250810190610d75919061142d565b507f9e6c52944e331ba6270e7fe4cea2a4086bae8f7a27e1cdba07f416806f5d0ac48383604051610da7929190611446565b60405180910390a150610df4600180547fffffffffffffffffffffff00ffffffffffffffffffffffffffffffffffffffff1674010000000000000000000000000000000000000000179055565b5050565b60005473ffffffffffffffffffffffffffffffffffffffff163314610e79576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604482015260640161049b565b73ffffffffffffffffffffffffffffffffffffffff8116610f1c576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201527f6464726573730000000000000000000000000000000000000000000000000000606482015260840161049b565b610f2581610fac565b50565b60015474010000000000000000000000000000000000000000900460ff16610810576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601f60248201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c00604482015260640161049b565b6000805473ffffffffffffffffffffffffffffffffffffffff8381167fffffffffffffffffffffffff0000000000000000000000000000000000000000831681178455604051919092169283917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a35050565b803573ffffffffffffffffffffffffffffffffffffffff8116811461104557600080fd5b919050565b60006020828403121561105c57600080fd5b61106582611021565b9392505050565b6000806000806080858703121561108257600080fd5b61108b85611021565b935061109960208601611021565b9250604085013591506110ae60608601611021565b905092959194509250565b6000602082840312156110cb57600080fd5b5035919050565b6000602082840312156110e457600080fd5b813563ffffffff8116811461106557600080fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b604051601f82017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe016810167ffffffffffffffff8111828210171561116e5761116e6110f8565b604052919050565b600067ffffffffffffffff821115611190576111906110f8565b50601f017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe01660200190565b600080604083850312156111cf57600080fd5b6111d883611021565b9150602083013567ffffffffffffffff8111156111f457600080fd5b8301601f8101851361120557600080fd5b803561121861121382611176565b611127565b81815286602083850101111561122d57600080fd5b816020840160208301376000602083830101528093505050509250929050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b6000817fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff04831182151516156112b4576112b461124d565b500290565b600082198211156112cc576112cc61124d565b500190565b60005b838110156112ec5781810151838201526020016112d4565b8381111561077f5750506000910152565b60006020828403121561130f57600080fd5b815167ffffffffffffffff81111561132657600080fd5b8201601f8101841361133757600080fd5b805161134561121382611176565b81815285602083850101111561135a57600080fd5b61136b8260208301602086016112d1565b95945050505050565b6000815180845261138c8160208601602086016112d1565b601f017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0169290920160200192915050565b600061010073ffffffffffffffffffffffffffffffffffffffff808c1684528a6020850152896040850152808916606085015280881660808501525063ffffffff861660a08401528460c08401528060e084015261141e81840185611374565b9b9a5050505050505050505050565b60006020828403121561143f57600080fd5b5051919050565b73ffffffffffffffffffffffffffffffffffffffff831681526040602082015260006114756040830184611374565b94935050505056fea264697066735822122081fe1198bec4c1ed2aacca4db1891a3306f3e229551542605f21c5d71820808e64736f6c634300080b0033", - "deployedBytecode": "0x60806040526004361061012d5760003560e01c8063b9d37d42116100a5578063da0323ce11610074578063e599477e11610059578063e599477e14610390578063e6eb8ade146103a6578063f2fde38b146103b957600080fd5b8063da0323ce14610343578063e19044021461036357600080fd5b8063b9d37d4214610298578063cc69534c146102b8578063cf6e65b7146102d8578063d921878d1461032357600080fd5b8063715018a6116100fc5780638da5cb5b116100e15780638da5cb5b1461022a5780639ae36685146102555780639c3ba2001461026b57600080fd5b8063715018a6146101e85780638134f385146101fd57600080fd5b806308f1ed15146101395780630e283a6a146101615780631dfb2d02146101b357806352c8c75c146101d557600080fd5b3661013457005b600080fd5b34801561014557600080fd5b5061014e6103d9565b6040519081526020015b60405180910390f35b34801561016d57600080fd5b5060065461018e9073ffffffffffffffffffffffffffffffffffffffff1681565b60405173ffffffffffffffffffffffffffffffffffffffff9091168152602001610158565b3480156101bf57600080fd5b506101d36101ce36600461104a565b61041e565b005b6101d36101e336600461106c565b61051e565b3480156101f457600080fd5b506101d3610785565b34801561020957600080fd5b5060055461018e9073ffffffffffffffffffffffffffffffffffffffff1681565b34801561023657600080fd5b5060005473ffffffffffffffffffffffffffffffffffffffff1661018e565b34801561026157600080fd5b5061014e60035481565b34801561027757600080fd5b5060045461018e9073ffffffffffffffffffffffffffffffffffffffff1681565b3480156102a457600080fd5b506101d36102b33660046110b9565b610812565b3480156102c457600080fd5b506101d36102d33660046110b9565b6108c8565b3480156102e457600080fd5b5060015461030e907501000000000000000000000000000000000000000000900463ffffffff1681565b60405163ffffffff9091168152602001610158565b34801561032f57600080fd5b506101d361033e3660046110d2565b61097e565b34801561034f57600080fd5b506101d361035e36600461104a565b610a80565b34801561036f57600080fd5b5060015461018e9073ffffffffffffffffffffffffffffffffffffffff1681565b34801561039c57600080fd5b5061014e60025481565b6101d36103b43660046111bc565b610b74565b3480156103c557600080fd5b506101d36103d436600461104a565b610df8565b60015460035460009161040c91750100000000000000000000000000000000000000000090910463ffffffff169061127c565b60025461041991906112b9565b905090565b60005473ffffffffffffffffffffffffffffffffffffffff1633146104a4576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657260448201526064015b60405180910390fd5b600180547fffffffffffffffffffffffff00000000000000000000000000000000000000001673ffffffffffffffffffffffffffffffffffffffff83169081179091556040519081527fb5f5d393a77ca9332951514b7bbfed2186d8fecdfafa02a2a676b05e67716963906020015b60405180910390a150565b610526610f28565b610553600180547fffffffffffffffffffffff00ffffffffffffffffffffffffffffffffffffffff169055565b60015473ffffffffffffffffffffffffffffffffffffffff1633146105d4576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601d60248201527f43616e206f6e6c792062652063616c6c656420627920687562506f6f6c000000604482015260640161049b565b6006546001546003546040517fd2ce7d6500000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff8881166004830152858116602483015260448201879052750100000000000000000000000000000000000000000090930463ffffffff166064820152608481019190915260c060a4820152600060c482015291169063d2ce7d659060e4016000604051808303816000875af1158015610695573d6000803e3d6000fd5b505050506040513d6000823e601f3d9081017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe01682016040526106db91908101906112fd565b506040805173ffffffffffffffffffffffffffffffffffffffff868116825285811660208301528183018590528316606082015290517fd7e09655439c3932e55857df3220186e5a7f0980825f20691c2b35d941dee75b9181900360800190a161077f600180547fffffffffffffffffffffff00ffffffffffffffffffffffffffffffffffffffff1674010000000000000000000000000000000000000000179055565b50505050565b60005473ffffffffffffffffffffffffffffffffffffffff163314610806576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604482015260640161049b565b6108106000610fac565b565b60005473ffffffffffffffffffffffffffffffffffffffff163314610893576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604482015260640161049b565b60038190556040518181527f11b37f476a8e54576728852320de360efcd9aa85196d533f0bcee62199c1c7a890602001610513565b60005473ffffffffffffffffffffffffffffffffffffffff163314610949576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604482015260640161049b565b60028190556040518181527f0f2c592d7af44ef2fd6f17f67ea8bcecbc73b6d26745fd69234149c377ee4fb690602001610513565b60005473ffffffffffffffffffffffffffffffffffffffff1633146109ff576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604482015260640161049b565b600180547fffffffffffffff00000000ffffffffffffffffffffffffffffffffffffffffff16750100000000000000000000000000000000000000000063ffffffff8481168202929092179283905560405192041681527f69f42c68da3e328d797524adf92a3bbe202f1ee08416cfed0823b7c70dfcdc1890602001610513565b60005473ffffffffffffffffffffffffffffffffffffffff163314610b01576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604482015260640161049b565b600480547fffffffffffffffffffffffff00000000000000000000000000000000000000001673ffffffffffffffffffffffffffffffffffffffff83169081179091556040519081527ffa92d17b08fbc5336e463f747e5efb7ab824785604b92201e7f06e998726bec990602001610513565b610b7c610f28565b610ba9600180547fffffffffffffffffffffff00ffffffffffffffffffffffffffffffffffffffff169055565b60015473ffffffffffffffffffffffffffffffffffffffff163314610c2a576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601d60248201527f43616e206f6e6c792062652063616c6c656420627920687562506f6f6c000000604482015260640161049b565b6000610c346103d9565b905080471015610ca0576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601860248201527f496e73756666696369656e74204554482062616c616e63650000000000000000604482015260640161049b565b600554600254600480546001546003546040517f679b6ded00000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff9687169663679b6ded968996610d32968d96600096939594909116938493750100000000000000000000000000000000000000000090920463ffffffff16928e91016113be565b60206040518083038185885af1158015610d50573d6000803e3d6000fd5b50505050506040513d601f19601f82011682018060405250810190610d75919061142d565b507f9e6c52944e331ba6270e7fe4cea2a4086bae8f7a27e1cdba07f416806f5d0ac48383604051610da7929190611446565b60405180910390a150610df4600180547fffffffffffffffffffffff00ffffffffffffffffffffffffffffffffffffffff1674010000000000000000000000000000000000000000179055565b5050565b60005473ffffffffffffffffffffffffffffffffffffffff163314610e79576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604482015260640161049b565b73ffffffffffffffffffffffffffffffffffffffff8116610f1c576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201527f6464726573730000000000000000000000000000000000000000000000000000606482015260840161049b565b610f2581610fac565b50565b60015474010000000000000000000000000000000000000000900460ff16610810576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601f60248201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c00604482015260640161049b565b6000805473ffffffffffffffffffffffffffffffffffffffff8381167fffffffffffffffffffffffff0000000000000000000000000000000000000000831681178455604051919092169283917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a35050565b803573ffffffffffffffffffffffffffffffffffffffff8116811461104557600080fd5b919050565b60006020828403121561105c57600080fd5b61106582611021565b9392505050565b6000806000806080858703121561108257600080fd5b61108b85611021565b935061109960208601611021565b9250604085013591506110ae60608601611021565b905092959194509250565b6000602082840312156110cb57600080fd5b5035919050565b6000602082840312156110e457600080fd5b813563ffffffff8116811461106557600080fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b604051601f82017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe016810167ffffffffffffffff8111828210171561116e5761116e6110f8565b604052919050565b600067ffffffffffffffff821115611190576111906110f8565b50601f017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe01660200190565b600080604083850312156111cf57600080fd5b6111d883611021565b9150602083013567ffffffffffffffff8111156111f457600080fd5b8301601f8101851361120557600080fd5b803561121861121382611176565b611127565b81815286602083850101111561122d57600080fd5b816020840160208301376000602083830101528093505050509250929050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b6000817fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff04831182151516156112b4576112b461124d565b500290565b600082198211156112cc576112cc61124d565b500190565b60005b838110156112ec5781810151838201526020016112d4565b8381111561077f5750506000910152565b60006020828403121561130f57600080fd5b815167ffffffffffffffff81111561132657600080fd5b8201601f8101841361133757600080fd5b805161134561121382611176565b81815285602083850101111561135a57600080fd5b61136b8260208301602086016112d1565b95945050505050565b6000815180845261138c8160208601602086016112d1565b601f017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0169290920160200192915050565b600061010073ffffffffffffffffffffffffffffffffffffffff808c1684528a6020850152896040850152808916606085015280881660808501525063ffffffff861660a08401528460c08401528060e084015261141e81840185611374565b9b9a5050505050505050505050565b60006020828403121561143f57600080fd5b5051919050565b73ffffffffffffffffffffffffffffffffffffffff831681526040602082015260006114756040830184611374565b94935050505056fea264697066735822122081fe1198bec4c1ed2aacca4db1891a3306f3e229551542605f21c5d71820808e64736f6c634300080b0033", + "solcInputHash": "c8b9349311d8b5049b613ac98eb998d0", + "metadata": "{\"compiler\":{\"version\":\"0.8.13+commit.abaa5c0e\"},\"language\":\"Solidity\",\"output\":{\"abi\":[{\"inputs\":[{\"internalType\":\"contract ArbitrumL1InboxLike\",\"name\":\"_l1ArbitrumInbox\",\"type\":\"address\"},{\"internalType\":\"contract ArbitrumL1ERC20GatewayLike\",\"name\":\"_l1ERC20Gateway\",\"type\":\"address\"}],\"stateMutability\":\"nonpayable\",\"type\":\"constructor\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"address\",\"name\":\"target\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"bytes\",\"name\":\"message\",\"type\":\"bytes\"}],\"name\":\"MessageRelayed\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"address\",\"name\":\"l1Token\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"address\",\"name\":\"l2Token\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"address\",\"name\":\"to\",\"type\":\"address\"}],\"name\":\"TokensRelayed\",\"type\":\"event\"},{\"inputs\":[],\"name\":\"getL1CallValue\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"pure\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"l1ERC20Gateway\",\"outputs\":[{\"internalType\":\"contract ArbitrumL1ERC20GatewayLike\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"l1Inbox\",\"outputs\":[{\"internalType\":\"contract ArbitrumL1InboxLike\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"l2GasLimit\",\"outputs\":[{\"internalType\":\"uint32\",\"name\":\"\",\"type\":\"uint32\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"l2GasPrice\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"l2MaxSubmissionCost\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"l2RefundL2Address\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"target\",\"type\":\"address\"},{\"internalType\":\"bytes\",\"name\":\"message\",\"type\":\"bytes\"}],\"name\":\"relayMessage\",\"outputs\":[],\"stateMutability\":\"payable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"l1Token\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"l2Token\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"},{\"internalType\":\"address\",\"name\":\"to\",\"type\":\"address\"}],\"name\":\"relayTokens\",\"outputs\":[],\"stateMutability\":\"payable\",\"type\":\"function\"}],\"devdoc\":{\"details\":\"Public functions calling external contracts do not guard against reentrancy because they are expected to be called via delegatecall, which will execute this contract's logic within the context of the originating contract. For example, the HubPool will delegatecall these functions, therefore its only necessary that the HubPool's methods that call this contract's logic guard against reentrancy.\",\"kind\":\"dev\",\"methods\":{\"constructor\":{\"params\":{\"_l1ArbitrumInbox\":\"Inbox helper contract to send messages to Arbitrum.\",\"_l1ERC20Gateway\":\"ERC20 gateway contract to send tokens to Arbitrum.\"}},\"getL1CallValue()\":{\"returns\":{\"_0\":\"amount of ETH that this contract needs to hold in order for relayMessage to succeed.\"}},\"relayMessage(address,bytes)\":{\"params\":{\"message\":\"Data to send to target.\",\"target\":\"Contract on Arbitrum that will receive message.\"}},\"relayTokens(address,address,uint256,address)\":{\"params\":{\"amount\":\"Amount of L1 tokens to deposit and L2 tokens to receive.\",\"l1Token\":\"L1 token to deposit.\",\"l2Token\":\"L2 token to receive.\",\"to\":\"Bridge recipient.\"}}},\"version\":1},\"userdoc\":{\"kind\":\"user\",\"methods\":{\"constructor\":{\"notice\":\"Constructs new Adapter.\"},\"getL1CallValue()\":{\"notice\":\"Returns required amount of ETH to send a message via the Inbox.\"},\"relayMessage(address,bytes)\":{\"notice\":\"Send cross-chain message to target on Arbitrum.This contract must hold at least getL1CallValue() amount of ETH to send a message via the Inbox successfully, or the message will get stuck.\"},\"relayTokens(address,address,uint256,address)\":{\"notice\":\"Bridge tokens to Arbitrum.\"}},\"notice\":\"Contract containing logic to send messages from L1 to Arbitrum.\",\"version\":1}},\"settings\":{\"compilationTarget\":{\"contracts/chain-adapters/Arbitrum_Adapter.sol\":\"Arbitrum_Adapter\"},\"evmVersion\":\"london\",\"libraries\":{},\"metadata\":{\"bytecodeHash\":\"ipfs\",\"useLiteralContent\":true},\"optimizer\":{\"enabled\":true,\"runs\":1000000},\"remappings\":[]},\"sources\":{\"contracts/chain-adapters/Arbitrum_Adapter.sol\":{\"content\":\"// SPDX-License-Identifier: AGPL-3.0-only\\npragma solidity ^0.8.0;\\n\\nimport \\\"../interfaces/AdapterInterface.sol\\\";\\n\\ninterface ArbitrumL1InboxLike {\\n function createRetryableTicket(\\n address destAddr,\\n uint256 arbTxCallValue,\\n uint256 maxSubmissionCost,\\n address submissionRefundAddress,\\n address valueRefundAddress,\\n uint256 maxGas,\\n uint256 gasPriceBid,\\n bytes calldata data\\n ) external payable returns (uint256);\\n}\\n\\ninterface ArbitrumL1ERC20GatewayLike {\\n function outboundTransfer(\\n address _token,\\n address _to,\\n uint256 _amount,\\n uint256 _maxGas,\\n uint256 _gasPriceBid,\\n bytes calldata _data\\n ) external payable returns (bytes memory);\\n}\\n\\n/**\\n * @notice Contract containing logic to send messages from L1 to Arbitrum.\\n * @dev Public functions calling external contracts do not guard against reentrancy because they are expected to be\\n * called via delegatecall, which will execute this contract's logic within the context of the originating contract.\\n * For example, the HubPool will delegatecall these functions, therefore its only necessary that the HubPool's methods\\n * that call this contract's logic guard against reentrancy.\\n */\\ncontract Arbitrum_Adapter is AdapterInterface {\\n // Gas limit for immediate L2 execution attempt (can be estimated via NodeInterface.estimateRetryableTicket).\\n // NodeInterface precompile interface exists at L2 address 0x00000000000000000000000000000000000000C8\\n uint32 public immutable l2GasLimit = 5_000_000;\\n\\n // Amount of ETH allocated to pay for the base submission fee. The base submission fee is a parameter unique to\\n // retryable transactions; the user is charged the base submission fee to cover the storage costs of keeping their\\n // ticket\\u2019s calldata in the retry buffer. (current base submission fee is queryable via\\n // ArbRetryableTx.getSubmissionPrice). ArbRetryableTicket precompile interface exists at L2 address\\n // 0x000000000000000000000000000000000000006E.\\n uint256 public immutable l2MaxSubmissionCost = 0.1e18;\\n\\n // L2 Gas price bid for immediate L2 execution attempt (queryable via standard eth*gasPrice RPC)\\n uint256 public immutable l2GasPrice = 10e9; // 10 gWei\\n\\n // This address on L2 receives extra ETH that is left over after relaying a message via the inbox.\\n address public immutable l2RefundL2Address;\\n\\n ArbitrumL1InboxLike public immutable l1Inbox;\\n\\n ArbitrumL1ERC20GatewayLike public immutable l1ERC20Gateway;\\n\\n /**\\n * @notice Constructs new Adapter.\\n * @param _l1ArbitrumInbox Inbox helper contract to send messages to Arbitrum.\\n * @param _l1ERC20Gateway ERC20 gateway contract to send tokens to Arbitrum.\\n */\\n constructor(ArbitrumL1InboxLike _l1ArbitrumInbox, ArbitrumL1ERC20GatewayLike _l1ERC20Gateway) {\\n l1Inbox = _l1ArbitrumInbox;\\n l1ERC20Gateway = _l1ERC20Gateway;\\n\\n l2RefundL2Address = msg.sender;\\n }\\n\\n /**\\n * @notice Send cross-chain message to target on Arbitrum.\\n * @notice This contract must hold at least getL1CallValue() amount of ETH to send a message via the Inbox\\n * successfully, or the message will get stuck.\\n * @param target Contract on Arbitrum that will receive message.\\n * @param message Data to send to target.\\n */\\n function relayMessage(address target, bytes memory message) external payable override {\\n uint256 requiredL1CallValue = getL1CallValue();\\n require(address(this).balance >= requiredL1CallValue, \\\"Insufficient ETH balance\\\");\\n\\n l1Inbox.createRetryableTicket{ value: requiredL1CallValue }(\\n target, // destAddr destination L2 contract address\\n 0, // l2CallValue call value for retryable L2 message\\n l2MaxSubmissionCost, // maxSubmissionCost Max gas deducted from user's L2 balance to cover base fee\\n l2RefundL2Address, // excessFeeRefundAddress maxgas * gasprice - execution cost gets credited here on L2\\n l2RefundL2Address, // callValueRefundAddress l2Callvalue gets credited here on L2 if retryable txn times out or gets cancelled\\n l2GasLimit, // maxGas Max gas deducted from user's L2 balance to cover L2 execution\\n l2GasPrice, // gasPriceBid price bid for L2 execution\\n message // data ABI encoded data of L2 message\\n );\\n\\n emit MessageRelayed(target, message);\\n }\\n\\n /**\\n * @notice Bridge tokens to Arbitrum.\\n * @param l1Token L1 token to deposit.\\n * @param l2Token L2 token to receive.\\n * @param amount Amount of L1 tokens to deposit and L2 tokens to receive.\\n * @param to Bridge recipient.\\n */\\n function relayTokens(\\n address l1Token,\\n address l2Token, // l2Token is unused for Arbitrum.\\n uint256 amount,\\n address to\\n ) external payable override {\\n l1ERC20Gateway.outboundTransfer(l1Token, to, amount, l2GasLimit, l2GasPrice, \\\"\\\");\\n emit TokensRelayed(l1Token, l2Token, amount, to);\\n }\\n\\n /**\\n * @notice Returns required amount of ETH to send a message via the Inbox.\\n * @return amount of ETH that this contract needs to hold in order for relayMessage to succeed.\\n */\\n function getL1CallValue() public pure returns (uint256) {\\n return l2MaxSubmissionCost + l2GasPrice * l2GasLimit;\\n }\\n}\\n\",\"keccak256\":\"0xd81b9aa219cd11f97cae6bc1ab5ca6b013a7021be5baac97cd25be637bda69bb\",\"license\":\"AGPL-3.0-only\"},\"contracts/interfaces/AdapterInterface.sol\":{\"content\":\"// SPDX-License-Identifier: AGPL-3.0-only\\npragma solidity ^0.8.0;\\n\\n/**\\n * @notice Sends cross chain messages and tokens to contracts on a specific L2 network.\\n */\\n\\ninterface AdapterInterface {\\n event MessageRelayed(address target, bytes message);\\n\\n event TokensRelayed(address l1Token, address l2Token, uint256 amount, address to);\\n\\n function relayMessage(address target, bytes memory message) external payable;\\n\\n function relayTokens(\\n address l1Token,\\n address l2Token,\\n uint256 amount,\\n address to\\n ) external payable;\\n}\\n\",\"keccak256\":\"0xbd7091006acbdfe72b21ce985f964f0682a2316d9d3b38967beeb55f4ae5118c\",\"license\":\"AGPL-3.0-only\"}},\"version\":1}", + "bytecode": "0x610140604052624c4b4060805267016345785d8a000060a0526402540be40060c05234801561002d57600080fd5b50604051610c11380380610c1183398101604081905261004c91610081565b6001600160a01b039182166101005216610120523360e0526100bb565b6001600160a01b038116811461007e57600080fd5b50565b6000806040838503121561009457600080fd5b825161009f81610069565b60208401519092506100b081610069565b809150509250929050565b60805160a05160c05160e0516101005161012051610abb6101566000396000818160d50152610392015260008181610143015261053e0152600081816101ab01526105940152600081816101770152818161028b0152818161035e01526105da015260008181610228015281816102b501526105720152600081816101df015281816102690152818161033701526105b80152610abb6000f3fe6080604052600436106100965760003560e01c80639ae3668511610069578063cf6e65b71161004e578063cf6e65b7146101cd578063e599477e14610216578063e6eb8ade1461024a57600080fd5b80639ae36685146101655780639c3ba2001461019957600080fd5b806308f1ed151461009b5780630e283a6a146100c357806352c8c75c1461011c5780638134f38514610131575b600080fd5b3480156100a757600080fd5b506100b061025d565b6040519081526020015b60405180910390f35b3480156100cf57600080fd5b506100f77f000000000000000000000000000000000000000000000000000000000000000081565b60405173ffffffffffffffffffffffffffffffffffffffff90911681526020016100ba565b61012f61012a3660046106af565b6102de565b005b34801561013d57600080fd5b506100f77f000000000000000000000000000000000000000000000000000000000000000081565b34801561017157600080fd5b506100b07f000000000000000000000000000000000000000000000000000000000000000081565b3480156101a557600080fd5b506100f77f000000000000000000000000000000000000000000000000000000000000000081565b3480156101d957600080fd5b506102017f000000000000000000000000000000000000000000000000000000000000000081565b60405163ffffffff90911681526020016100ba565b34801561022257600080fd5b506100b07f000000000000000000000000000000000000000000000000000000000000000081565b61012f6102583660046107c0565b610487565b60006102af63ffffffff7f0000000000000000000000000000000000000000000000000000000000000000167f0000000000000000000000000000000000000000000000000000000000000000610880565b6102d9907f00000000000000000000000000000000000000000000000000000000000000006108bd565b905090565b6040517fd2ce7d6500000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff858116600483015282811660248301526044820184905263ffffffff7f00000000000000000000000000000000000000000000000000000000000000001660648301527f0000000000000000000000000000000000000000000000000000000000000000608483015260c060a4830152600060c48301527f0000000000000000000000000000000000000000000000000000000000000000169063d2ce7d659060e4016000604051808303816000875af11580156103db573d6000803e3d6000fd5b505050506040513d6000823e601f3d9081017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe01682016040526104219190810190610905565b506040805173ffffffffffffffffffffffffffffffffffffffff868116825285811660208301528183018590528316606082015290517fd7e09655439c3932e55857df3220186e5a7f0980825f20691c2b35d941dee75b9181900360800190a150505050565b600061049161025d565b905080471015610501576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601860248201527f496e73756666696369656e74204554482062616c616e63650000000000000000604482015260640160405180910390fd5b6040517f679b6ded00000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff7f0000000000000000000000000000000000000000000000000000000000000000169063679b6ded9083906106049087906000907f0000000000000000000000000000000000000000000000000000000000000000907f00000000000000000000000000000000000000000000000000000000000000009081907f0000000000000000000000000000000000000000000000000000000000000000907f0000000000000000000000000000000000000000000000000000000000000000908d906004016109c6565b60206040518083038185885af1158015610622573d6000803e3d6000fd5b50505050506040513d601f19601f820116820180604052508101906106479190610a35565b507f9e6c52944e331ba6270e7fe4cea2a4086bae8f7a27e1cdba07f416806f5d0ac48383604051610679929190610a4e565b60405180910390a1505050565b803573ffffffffffffffffffffffffffffffffffffffff811681146106aa57600080fd5b919050565b600080600080608085870312156106c557600080fd5b6106ce85610686565b93506106dc60208601610686565b9250604085013591506106f160608601610686565b905092959194509250565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b604051601f82017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe016810167ffffffffffffffff81118282101715610772576107726106fc565b604052919050565b600067ffffffffffffffff821115610794576107946106fc565b50601f017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe01660200190565b600080604083850312156107d357600080fd5b6107dc83610686565b9150602083013567ffffffffffffffff8111156107f857600080fd5b8301601f8101851361080957600080fd5b803561081c6108178261077a565b61072b565b81815286602083850101111561083157600080fd5b816020840160208301376000602083830101528093505050509250929050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b6000817fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff04831182151516156108b8576108b8610851565b500290565b600082198211156108d0576108d0610851565b500190565b60005b838110156108f05781810151838201526020016108d8565b838111156108ff576000848401525b50505050565b60006020828403121561091757600080fd5b815167ffffffffffffffff81111561092e57600080fd5b8201601f8101841361093f57600080fd5b805161094d6108178261077a565b81815285602083850101111561096257600080fd5b6109738260208301602086016108d5565b95945050505050565b600081518084526109948160208601602086016108d5565b601f017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0169290920160200192915050565b600061010073ffffffffffffffffffffffffffffffffffffffff808c1684528a6020850152896040850152808916606085015280881660808501525063ffffffff861660a08401528460c08401528060e0840152610a268184018561097c565b9b9a5050505050505050505050565b600060208284031215610a4757600080fd5b5051919050565b73ffffffffffffffffffffffffffffffffffffffff83168152604060208201526000610a7d604083018461097c565b94935050505056fea26469706673582212201138a6fca9cde9a32c1accbbb9cfaeced745b08b0ff836da36e0cc9731508d6364736f6c634300080d0033", + "deployedBytecode": "0x6080604052600436106100965760003560e01c80639ae3668511610069578063cf6e65b71161004e578063cf6e65b7146101cd578063e599477e14610216578063e6eb8ade1461024a57600080fd5b80639ae36685146101655780639c3ba2001461019957600080fd5b806308f1ed151461009b5780630e283a6a146100c357806352c8c75c1461011c5780638134f38514610131575b600080fd5b3480156100a757600080fd5b506100b061025d565b6040519081526020015b60405180910390f35b3480156100cf57600080fd5b506100f77f000000000000000000000000000000000000000000000000000000000000000081565b60405173ffffffffffffffffffffffffffffffffffffffff90911681526020016100ba565b61012f61012a3660046106af565b6102de565b005b34801561013d57600080fd5b506100f77f000000000000000000000000000000000000000000000000000000000000000081565b34801561017157600080fd5b506100b07f000000000000000000000000000000000000000000000000000000000000000081565b3480156101a557600080fd5b506100f77f000000000000000000000000000000000000000000000000000000000000000081565b3480156101d957600080fd5b506102017f000000000000000000000000000000000000000000000000000000000000000081565b60405163ffffffff90911681526020016100ba565b34801561022257600080fd5b506100b07f000000000000000000000000000000000000000000000000000000000000000081565b61012f6102583660046107c0565b610487565b60006102af63ffffffff7f0000000000000000000000000000000000000000000000000000000000000000167f0000000000000000000000000000000000000000000000000000000000000000610880565b6102d9907f00000000000000000000000000000000000000000000000000000000000000006108bd565b905090565b6040517fd2ce7d6500000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff858116600483015282811660248301526044820184905263ffffffff7f00000000000000000000000000000000000000000000000000000000000000001660648301527f0000000000000000000000000000000000000000000000000000000000000000608483015260c060a4830152600060c48301527f0000000000000000000000000000000000000000000000000000000000000000169063d2ce7d659060e4016000604051808303816000875af11580156103db573d6000803e3d6000fd5b505050506040513d6000823e601f3d9081017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe01682016040526104219190810190610905565b506040805173ffffffffffffffffffffffffffffffffffffffff868116825285811660208301528183018590528316606082015290517fd7e09655439c3932e55857df3220186e5a7f0980825f20691c2b35d941dee75b9181900360800190a150505050565b600061049161025d565b905080471015610501576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601860248201527f496e73756666696369656e74204554482062616c616e63650000000000000000604482015260640160405180910390fd5b6040517f679b6ded00000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff7f0000000000000000000000000000000000000000000000000000000000000000169063679b6ded9083906106049087906000907f0000000000000000000000000000000000000000000000000000000000000000907f00000000000000000000000000000000000000000000000000000000000000009081907f0000000000000000000000000000000000000000000000000000000000000000907f0000000000000000000000000000000000000000000000000000000000000000908d906004016109c6565b60206040518083038185885af1158015610622573d6000803e3d6000fd5b50505050506040513d601f19601f820116820180604052508101906106479190610a35565b507f9e6c52944e331ba6270e7fe4cea2a4086bae8f7a27e1cdba07f416806f5d0ac48383604051610679929190610a4e565b60405180910390a1505050565b803573ffffffffffffffffffffffffffffffffffffffff811681146106aa57600080fd5b919050565b600080600080608085870312156106c557600080fd5b6106ce85610686565b93506106dc60208601610686565b9250604085013591506106f160608601610686565b905092959194509250565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b604051601f82017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe016810167ffffffffffffffff81118282101715610772576107726106fc565b604052919050565b600067ffffffffffffffff821115610794576107946106fc565b50601f017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe01660200190565b600080604083850312156107d357600080fd5b6107dc83610686565b9150602083013567ffffffffffffffff8111156107f857600080fd5b8301601f8101851361080957600080fd5b803561081c6108178261077a565b61072b565b81815286602083850101111561083157600080fd5b816020840160208301376000602083830101528093505050509250929050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b6000817fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff04831182151516156108b8576108b8610851565b500290565b600082198211156108d0576108d0610851565b500190565b60005b838110156108f05781810151838201526020016108d8565b838111156108ff576000848401525b50505050565b60006020828403121561091757600080fd5b815167ffffffffffffffff81111561092e57600080fd5b8201601f8101841361093f57600080fd5b805161094d6108178261077a565b81815285602083850101111561096257600080fd5b6109738260208301602086016108d5565b95945050505050565b600081518084526109948160208601602086016108d5565b601f017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0169290920160200192915050565b600061010073ffffffffffffffffffffffffffffffffffffffff808c1684528a6020850152896040850152808916606085015280881660808501525063ffffffff861660a08401528460c08401528060e0840152610a268184018561097c565b9b9a5050505050505050505050565b600060208284031215610a4757600080fd5b5051919050565b73ffffffffffffffffffffffffffffffffffffffff83168152604060208201526000610a7d604083018461097c565b94935050505056fea26469706673582212201138a6fca9cde9a32c1accbbb9cfaeced745b08b0ff836da36e0cc9731508d6364736f6c634300080d0033", "devdoc": { + "details": "Public functions calling external contracts do not guard against reentrancy because they are expected to be called via delegatecall, which will execute this contract's logic within the context of the originating contract. For example, the HubPool will delegatecall these functions, therefore its only necessary that the HubPool's methods that call this contract's logic guard against reentrancy.", "kind": "dev", "methods": { - "owner()": { - "details": "Returns the address of the current owner." + "constructor": { + "params": { + "_l1ArbitrumInbox": "Inbox helper contract to send messages to Arbitrum.", + "_l1ERC20Gateway": "ERC20 gateway contract to send tokens to Arbitrum." + } + }, + "getL1CallValue()": { + "returns": { + "_0": "amount of ETH that this contract needs to hold in order for relayMessage to succeed." + } }, - "renounceOwnership()": { - "details": "Leaves the contract without owner. It will not be possible to call `onlyOwner` functions anymore. Can only be called by the current owner. NOTE: Renouncing ownership will leave the contract without an owner, thereby removing any functionality that is only available to the owner." + "relayMessage(address,bytes)": { + "params": { + "message": "Data to send to target.", + "target": "Contract on Arbitrum that will receive message." + } }, - "transferOwnership(address)": { - "details": "Transfers ownership of the contract to a new account (`newOwner`). Can only be called by the current owner." + "relayTokens(address,address,uint256,address)": { + "params": { + "amount": "Amount of L1 tokens to deposit and L2 tokens to receive.", + "l1Token": "L1 token to deposit.", + "l2Token": "L2 token to receive.", + "to": "Bridge recipient." + } } }, "version": 1 }, "userdoc": { "kind": "user", - "methods": {}, - "version": 1 - }, - "storageLayout": { - "storage": [ - { - "astId": 400, - "contract": "contracts/chain-adapters/Arbitrum_Adapter.sol:Arbitrum_Adapter", - "label": "_owner", - "offset": 0, - "slot": "0", - "type": "t_address" - }, - { - "astId": 9447, - "contract": "contracts/chain-adapters/Arbitrum_Adapter.sol:Arbitrum_Adapter", - "label": "hubPool", - "offset": 0, - "slot": "1", - "type": "t_address" - }, - { - "astId": 5108, - "contract": "contracts/chain-adapters/Arbitrum_Adapter.sol:Arbitrum_Adapter", - "label": "_notEntered", - "offset": 20, - "slot": "1", - "type": "t_bool" - }, - { - "astId": 9214, - "contract": "contracts/chain-adapters/Arbitrum_Adapter.sol:Arbitrum_Adapter", - "label": "l2GasLimit", - "offset": 21, - "slot": "1", - "type": "t_uint32" - }, - { - "astId": 9217, - "contract": "contracts/chain-adapters/Arbitrum_Adapter.sol:Arbitrum_Adapter", - "label": "l2MaxSubmissionCost", - "offset": 0, - "slot": "2", - "type": "t_uint256" - }, - { - "astId": 9220, - "contract": "contracts/chain-adapters/Arbitrum_Adapter.sol:Arbitrum_Adapter", - "label": "l2GasPrice", - "offset": 0, - "slot": "3", - "type": "t_uint256" - }, - { - "astId": 9222, - "contract": "contracts/chain-adapters/Arbitrum_Adapter.sol:Arbitrum_Adapter", - "label": "l2RefundL2Address", - "offset": 0, - "slot": "4", - "type": "t_address" - }, - { - "astId": 9225, - "contract": "contracts/chain-adapters/Arbitrum_Adapter.sol:Arbitrum_Adapter", - "label": "l1Inbox", - "offset": 0, - "slot": "5", - "type": "t_contract(ArbitrumL1InboxLike)9189" - }, - { - "astId": 9228, - "contract": "contracts/chain-adapters/Arbitrum_Adapter.sol:Arbitrum_Adapter", - "label": "l1ERC20Gateway", - "offset": 0, - "slot": "6", - "type": "t_contract(ArbitrumL1ERC20GatewayLike)9207" - } - ], - "types": { - "t_address": { - "encoding": "inplace", - "label": "address", - "numberOfBytes": "20" - }, - "t_bool": { - "encoding": "inplace", - "label": "bool", - "numberOfBytes": "1" - }, - "t_contract(ArbitrumL1ERC20GatewayLike)9207": { - "encoding": "inplace", - "label": "contract ArbitrumL1ERC20GatewayLike", - "numberOfBytes": "20" + "methods": { + "constructor": { + "notice": "Constructs new Adapter." }, - "t_contract(ArbitrumL1InboxLike)9189": { - "encoding": "inplace", - "label": "contract ArbitrumL1InboxLike", - "numberOfBytes": "20" + "getL1CallValue()": { + "notice": "Returns required amount of ETH to send a message via the Inbox." }, - "t_uint256": { - "encoding": "inplace", - "label": "uint256", - "numberOfBytes": "32" + "relayMessage(address,bytes)": { + "notice": "Send cross-chain message to target on Arbitrum.This contract must hold at least getL1CallValue() amount of ETH to send a message via the Inbox successfully, or the message will get stuck." }, - "t_uint32": { - "encoding": "inplace", - "label": "uint32", - "numberOfBytes": "4" + "relayTokens(address,address,uint256,address)": { + "notice": "Bridge tokens to Arbitrum." } - } + }, + "notice": "Contract containing logic to send messages from L1 to Arbitrum.", + "version": 1 + }, + "storageLayout": { + "storage": [], + "types": null } } diff --git a/deployments/rinkeby/Ethereum_Adapter.json b/deployments/rinkeby/Ethereum_Adapter.json index b93c3be4d..1c3eab162 100644 --- a/deployments/rinkeby/Ethereum_Adapter.json +++ b/deployments/rinkeby/Ethereum_Adapter.json @@ -1,30 +1,6 @@ { - "address": "0xE7e46605D378Efb9564ED4Ddd488300b91ddf828", + "address": "0x682DEa71e7246910A4dec2396a53B24291EB0AD8", "abi": [ - { - "inputs": [ - { - "internalType": "address", - "name": "_hubPool", - "type": "address" - } - ], - "stateMutability": "nonpayable", - "type": "constructor" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": false, - "internalType": "address", - "name": "newHubPool", - "type": "address" - } - ], - "name": "HubPoolChanged", - "type": "event" - }, { "anonymous": false, "inputs": [ @@ -44,25 +20,6 @@ "name": "MessageRelayed", "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" - }, { "anonymous": false, "inputs": [ @@ -94,32 +51,6 @@ "name": "TokensRelayed", "type": "event" }, - { - "inputs": [], - "name": "hubPool", - "outputs": [ - { - "internalType": "address", - "name": "", - "type": "address" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "owner", - "outputs": [ - { - "internalType": "address", - "name": "", - "type": "address" - } - ], - "stateMutability": "view", - "type": "function" - }, { "inputs": [ { @@ -165,140 +96,66 @@ "outputs": [], "stateMutability": "payable", "type": "function" - }, - { - "inputs": [], - "name": "renounceOwnership", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "_hubPool", - "type": "address" - } - ], - "name": "setHubPool", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "newOwner", - "type": "address" - } - ], - "name": "transferOwnership", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "stateMutability": "payable", - "type": "receive" } ], - "transactionHash": "0x8e3e911a109be0e4edf645059ad0dd826a6639459e23c8e922f3628ab1eec108", + "transactionHash": "0x6bb6b45f197f0e233858192626bd7a2fcdca4a136f59981247a286629535f8a1", "receipt": { "to": null, "from": "0x9A8f92a830A5cB89a3816e3D267CB7791c16b04D", - "contractAddress": "0xE7e46605D378Efb9564ED4Ddd488300b91ddf828", - "transactionIndex": 4, - "gasUsed": "912256", - "logsBloom": "0x00000000000000000000000000000000000000000000000000800000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001000000000000000000000000000000000000020000000000000000000800000000000000000000000000040000400000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000080000000000000000000000002000000000000000000000800000000000000000000000000000000000000000000020400001000000000000000000000000000000000000000000000000000000000000", - "blockHash": "0x9f563824be19ef87417afb6fd78268d6441ee2416ccf9ccdab21eac622cd039f", - "transactionHash": "0x8e3e911a109be0e4edf645059ad0dd826a6639459e23c8e922f3628ab1eec108", - "logs": [ - { - "transactionIndex": 4, - "blockNumber": 10232258, - "transactionHash": "0x8e3e911a109be0e4edf645059ad0dd826a6639459e23c8e922f3628ab1eec108", - "address": "0xE7e46605D378Efb9564ED4Ddd488300b91ddf828", - "topics": [ - "0x8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0", - "0x0000000000000000000000000000000000000000000000000000000000000000", - "0x0000000000000000000000009a8f92a830a5cb89a3816e3d267cb7791c16b04d" - ], - "data": "0x", - "logIndex": 2, - "blockHash": "0x9f563824be19ef87417afb6fd78268d6441ee2416ccf9ccdab21eac622cd039f" - } - ], - "blockNumber": 10232258, - "cumulativeGasUsed": "1042189", + "contractAddress": "0x682DEa71e7246910A4dec2396a53B24291EB0AD8", + "transactionIndex": 19, + "gasUsed": "491295", + "logsBloom": "0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", + "blockHash": "0xae0c1e71a859a9a86012d0b6c54ec1bc841d082942bf27049427a5bbcd8bb2d1", + "transactionHash": "0x6bb6b45f197f0e233858192626bd7a2fcdca4a136f59981247a286629535f8a1", + "logs": [], + "blockNumber": 10365602, + "cumulativeGasUsed": "1803538", "status": 1, "byzantium": true }, - "args": ["0xFA6326FdF1f149B63d116576fCfbc7e15cc0355A"], + "args": [], "numDeployments": 1, - "solcInputHash": "a1881af3726e467ac35772874a89bba0", - "metadata": "{\"compiler\":{\"version\":\"0.8.11+commit.d7f03943\"},\"language\":\"Solidity\",\"output\":{\"abi\":[{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_hubPool\",\"type\":\"address\"}],\"stateMutability\":\"nonpayable\",\"type\":\"constructor\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"address\",\"name\":\"newHubPool\",\"type\":\"address\"}],\"name\":\"HubPoolChanged\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"address\",\"name\":\"target\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"bytes\",\"name\":\"message\",\"type\":\"bytes\"}],\"name\":\"MessageRelayed\",\"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\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"address\",\"name\":\"l1Token\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"address\",\"name\":\"l2Token\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"address\",\"name\":\"to\",\"type\":\"address\"}],\"name\":\"TokensRelayed\",\"type\":\"event\"},{\"inputs\":[],\"name\":\"hubPool\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"owner\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"target\",\"type\":\"address\"},{\"internalType\":\"bytes\",\"name\":\"message\",\"type\":\"bytes\"}],\"name\":\"relayMessage\",\"outputs\":[],\"stateMutability\":\"payable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"l1Token\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"l2Token\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"},{\"internalType\":\"address\",\"name\":\"to\",\"type\":\"address\"}],\"name\":\"relayTokens\",\"outputs\":[],\"stateMutability\":\"payable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"renounceOwnership\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_hubPool\",\"type\":\"address\"}],\"name\":\"setHubPool\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"newOwner\",\"type\":\"address\"}],\"name\":\"transferOwnership\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"stateMutability\":\"payable\",\"type\":\"receive\"}],\"devdoc\":{\"kind\":\"dev\",\"methods\":{\"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 anymore. Can only be called by the current owner. NOTE: Renouncing ownership will leave the contract without an owner, thereby removing 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.\"}},\"version\":1},\"userdoc\":{\"kind\":\"user\",\"methods\":{},\"version\":1}},\"settings\":{\"compilationTarget\":{\"contracts/chain-adapters/Ethereum_Adapter.sol\":\"Ethereum_Adapter\"},\"evmVersion\":\"london\",\"libraries\":{},\"metadata\":{\"bytecodeHash\":\"ipfs\",\"useLiteralContent\":true},\"optimizer\":{\"enabled\":true,\"runs\":1000000},\"remappings\":[]},\"sources\":{\"@openzeppelin/contracts/access/Ownable.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts v4.4.1 (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 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 called by any account other than the owner.\\n */\\n modifier onlyOwner() {\\n require(owner() == _msgSender(), \\\"Ownable: caller is not the owner\\\");\\n _;\\n }\\n\\n /**\\n * @dev Leaves the contract without owner. It will not be possible to call\\n * `onlyOwner` functions anymore. Can only be called by the current owner.\\n *\\n * NOTE: Renouncing ownership will leave the contract without an owner,\\n * thereby removing 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\",\"keccak256\":\"0x24e0364e503a9bbde94c715d26573a76f14cd2a202d45f96f52134ab806b67b9\",\"license\":\"MIT\"},\"@openzeppelin/contracts/token/ERC20/IERC20.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts v4.4.1 (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 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 `recipient`.\\n *\\n * Returns a boolean value indicating whether the operation succeeded.\\n *\\n * Emits a {Transfer} event.\\n */\\n function transfer(address recipient, 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 `sender` to `recipient` 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(\\n address sender,\\n address recipient,\\n uint256 amount\\n ) external returns (bool);\\n\\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\",\"keccak256\":\"0x61437cb513a887a1bbad006e7b1c8b414478427d33de47c5600af3c748f108da\",\"license\":\"MIT\"},\"@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts v4.4.1 (token/ERC20/utils/SafeERC20.sol)\\n\\npragma solidity ^0.8.0;\\n\\nimport \\\"../IERC20.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 function safeTransfer(\\n IERC20 token,\\n address to,\\n uint256 value\\n ) internal {\\n _callOptionalReturn(token, abi.encodeWithSelector(token.transfer.selector, to, value));\\n }\\n\\n function safeTransferFrom(\\n IERC20 token,\\n address from,\\n address to,\\n uint256 value\\n ) 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(\\n IERC20 token,\\n address spender,\\n uint256 value\\n ) 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 function safeIncreaseAllowance(\\n IERC20 token,\\n address spender,\\n uint256 value\\n ) internal {\\n uint256 newAllowance = token.allowance(address(this), spender) + value;\\n _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, newAllowance));\\n }\\n\\n function safeDecreaseAllowance(\\n IERC20 token,\\n address spender,\\n uint256 value\\n ) internal {\\n unchecked {\\n uint256 oldAllowance = token.allowance(address(this), spender);\\n require(oldAllowance >= value, \\\"SafeERC20: decreased allowance below zero\\\");\\n uint256 newAllowance = oldAllowance - value;\\n _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, newAllowance));\\n }\\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 if (returndata.length > 0) {\\n // Return data is optional\\n require(abi.decode(returndata, (bool)), \\\"SafeERC20: ERC20 operation did not succeed\\\");\\n }\\n }\\n}\\n\",\"keccak256\":\"0xc3d946432c0ddbb1f846a0d3985be71299df331b91d06732152117f62f0be2b5\",\"license\":\"MIT\"},\"@openzeppelin/contracts/utils/Address.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts v4.4.1 (utils/Address.sol)\\n\\npragma solidity ^0.8.0;\\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 */\\n function isContract(address account) internal view returns (bool) {\\n // This method relies on extcodesize, which returns 0 for contracts in\\n // construction, since the code is only stored at the end of the\\n // constructor execution.\\n\\n uint256 size;\\n assembly {\\n size := extcodesize(account)\\n }\\n return size > 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://diligence.consensys.net/posts/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.5.11/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 functionCall(target, data, \\\"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(\\n address target,\\n bytes memory data,\\n uint256 value\\n ) 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 require(isContract(target), \\\"Address: call to non-contract\\\");\\n\\n (bool success, bytes memory returndata) = target.call{value: value}(data);\\n return verifyCallResult(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 require(isContract(target), \\\"Address: static call to non-contract\\\");\\n\\n (bool success, bytes memory returndata) = target.staticcall(data);\\n return verifyCallResult(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 require(isContract(target), \\\"Address: delegate call to non-contract\\\");\\n\\n (bool success, bytes memory returndata) = target.delegatecall(data);\\n return verifyCallResult(success, returndata, errorMessage);\\n }\\n\\n /**\\n * @dev Tool to verifies that a low level call was successful, and revert if it wasn't, either by bubbling the\\n * revert reason 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 // 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\\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}\\n\",\"keccak256\":\"0x51b758a8815ecc9596c66c37d56b1d33883a444631a3f916b9fe65cb863ef7c4\",\"license\":\"MIT\"},\"@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\",\"keccak256\":\"0xe2e337e6dde9ef6b680e07338c493ebea1b5fd09b43424112868e9cc1706bca7\",\"license\":\"MIT\"},\"@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\",\"keccak256\":\"0xcd34b3f83b61a096b53020749f327096d5cacd89c2393d947595afb934496ad4\",\"license\":\"AGPL-3.0-only\"},\"contracts/chain-adapters/Base_Adapter.sol\":{\"content\":\"// SPDX-License-Identifier: AGPL-3.0-only\\npragma solidity ^0.8.0;\\nimport \\\"../interfaces/AdapterInterface.sol\\\";\\n\\nimport \\\"@openzeppelin/contracts/access/Ownable.sol\\\";\\n\\nabstract contract Base_Adapter is Ownable, AdapterInterface {\\n address public hubPool;\\n\\n modifier onlyHubPool() {\\n require(msg.sender == hubPool, \\\"Can only be called by hubPool\\\");\\n _;\\n }\\n\\n constructor(address _hubPool) {\\n hubPool = _hubPool;\\n }\\n\\n function setHubPool(address _hubPool) public onlyOwner {\\n hubPool = _hubPool;\\n emit HubPoolChanged(_hubPool);\\n }\\n}\\n\",\"keccak256\":\"0xfe795ada9a48a1dbbfe7d8e002ba8b78bae9f839206d37a471449a99895ce7ae\",\"license\":\"AGPL-3.0-only\"},\"contracts/chain-adapters/Ethereum_Adapter.sol\":{\"content\":\"// SPDX-License-Identifier: AGPL-3.0-only\\r\\npragma solidity ^0.8.0;\\r\\n\\r\\nimport \\\"./Base_Adapter.sol\\\";\\r\\nimport \\\"../interfaces/AdapterInterface.sol\\\";\\r\\nimport \\\"../interfaces/WETH9.sol\\\";\\r\\n\\r\\nimport \\\"@uma/core/contracts/common/implementation/Lockable.sol\\\";\\r\\n\\r\\nimport \\\"@openzeppelin/contracts/token/ERC20/IERC20.sol\\\";\\r\\nimport \\\"@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol\\\";\\r\\n\\r\\ncontract Ethereum_Adapter is Base_Adapter, Lockable {\\r\\n using SafeERC20 for IERC20;\\r\\n\\r\\n constructor(address _hubPool) Base_Adapter(_hubPool) {}\\r\\n\\r\\n function relayMessage(address target, bytes memory message) external payable override nonReentrant onlyHubPool {\\r\\n _executeCall(target, message);\\r\\n emit MessageRelayed(target, message);\\r\\n }\\r\\n\\r\\n function relayTokens(\\r\\n address l1Token,\\r\\n address l2Token, // l2Token is unused for L1.\\r\\n uint256 amount,\\r\\n address to\\r\\n ) external payable override nonReentrant onlyHubPool {\\r\\n IERC20(l1Token).safeTransfer(to, amount);\\r\\n emit TokensRelayed(l1Token, l2Token, amount, to);\\r\\n }\\r\\n\\r\\n // Note: this snippet of code is copied from Governor.sol.\\r\\n function _executeCall(address to, bytes memory data) private {\\r\\n // Note: this snippet of code is copied from Governor.sol and modified to not include any \\\"value\\\" field.\\r\\n // solhint-disable-next-line no-inline-assembly\\r\\n\\r\\n bool success;\\r\\n assembly {\\r\\n let inputData := add(data, 0x20)\\r\\n let inputDataSize := mload(data)\\r\\n // Hardcode value to be 0 for relayed governance calls in order to avoid addressing complexity of bridging\\r\\n // value cross-chain.\\r\\n success := call(gas(), to, 0, inputData, inputDataSize, 0, 0)\\r\\n }\\r\\n require(success, \\\"execute call failed\\\");\\r\\n }\\r\\n\\r\\n receive() external payable {}\\r\\n}\\r\\n\",\"keccak256\":\"0x3b4a0fa46e70c0bc8223e8db672dcfe8bddafb3d7987102b0302a3b53b03cb84\",\"license\":\"AGPL-3.0-only\"},\"contracts/interfaces/AdapterInterface.sol\":{\"content\":\"// SPDX-License-Identifier: AGPL-3.0-only\\npragma solidity ^0.8.0;\\n\\n/**\\n * @notice Sends cross chain messages and tokens to contracts on a specific L2 network.\\n */\\n\\ninterface AdapterInterface {\\n event HubPoolChanged(address newHubPool);\\n\\n event MessageRelayed(address target, bytes message);\\n\\n event TokensRelayed(address l1Token, address l2Token, uint256 amount, address to);\\n\\n function relayMessage(address target, bytes memory message) external payable;\\n\\n function relayTokens(\\n address l1Token,\\n address l2Token,\\n uint256 amount,\\n address to\\n ) external payable;\\n}\\n\",\"keccak256\":\"0x60e1ed2205f90655fe4152a90709be15bc9550fb3faeaf9835fee22c095bab11\",\"license\":\"AGPL-3.0-only\"},\"contracts/interfaces/WETH9.sol\":{\"content\":\"// SPDX-License-Identifier: GPL-3.0-only\\r\\npragma solidity ^0.8.0;\\r\\n\\r\\ninterface WETH9 {\\r\\n function withdraw(uint256 wad) external;\\r\\n\\r\\n function deposit() external payable;\\r\\n\\r\\n function balanceOf(address guy) external view returns (uint256 wad);\\r\\n\\r\\n function transfer(address guy, uint256 wad) external;\\r\\n}\\r\\n\",\"keccak256\":\"0x08755a7e4fc4ed75895c9b803f19552c4f0a455947dca04d86db4355114253b3\",\"license\":\"GPL-3.0-only\"}},\"version\":1}", - "bytecode": "0x608060405234801561001057600080fd5b50604051610fb6380380610fb683398101604081905261002f916100b4565b8061003933610064565b600180546001600160a81b0319166001600160a01b0390921691909117600160a01b179055506100e4565b600080546001600160a01b038381166001600160a01b0319831681178455604051919092169283917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a35050565b6000602082840312156100c657600080fd5b81516001600160a01b03811681146100dd57600080fd5b9392505050565b610ec3806100f36000396000f3fe6080604052600436106100745760003560e01c80638da5cb5b1161004e5780638da5cb5b146100ca578063e19044021461011a578063e6eb8ade14610147578063f2fde38b1461015a57600080fd5b80631dfb2d021461008057806352c8c75c146100a2578063715018a6146100b557600080fd5b3661007b57005b600080fd5b34801561008c57600080fd5b506100a061009b366004610c20565b61017a565b005b6100a06100b0366004610c3b565b610279565b3480156100c157600080fd5b506100a06103f9565b3480156100d657600080fd5b5060005473ffffffffffffffffffffffffffffffffffffffff165b60405173ffffffffffffffffffffffffffffffffffffffff909116815260200160405180910390f35b34801561012657600080fd5b506001546100f19073ffffffffffffffffffffffffffffffffffffffff1681565b6100a0610155366004610cb7565b610486565b34801561016657600080fd5b506100a0610175366004610c20565b6105c7565b60005473ffffffffffffffffffffffffffffffffffffffff163314610200576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657260448201526064015b60405180910390fd5b600180547fffffffffffffffffffffffff00000000000000000000000000000000000000001673ffffffffffffffffffffffffffffffffffffffff83169081179091556040519081527fb5f5d393a77ca9332951514b7bbfed2186d8fecdfafa02a2a676b05e677169639060200160405180910390a150565b6102816106f7565b6102ae600180547fffffffffffffffffffffff00ffffffffffffffffffffffffffffffffffffffff169055565b60015473ffffffffffffffffffffffffffffffffffffffff16331461032f576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601d60248201527f43616e206f6e6c792062652063616c6c656420627920687562506f6f6c00000060448201526064016101f7565b61035073ffffffffffffffffffffffffffffffffffffffff8516828461077b565b6040805173ffffffffffffffffffffffffffffffffffffffff868116825285811660208301528183018590528316606082015290517fd7e09655439c3932e55857df3220186e5a7f0980825f20691c2b35d941dee75b9181900360800190a16103f3600180547fffffffffffffffffffffff00ffffffffffffffffffffffffffffffffffffffff1674010000000000000000000000000000000000000000179055565b50505050565b60005473ffffffffffffffffffffffffffffffffffffffff16331461047a576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657260448201526064016101f7565b610484600061080d565b565b61048e6106f7565b6104bb600180547fffffffffffffffffffffff00ffffffffffffffffffffffffffffffffffffffff169055565b60015473ffffffffffffffffffffffffffffffffffffffff16331461053c576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601d60248201527f43616e206f6e6c792062652063616c6c656420627920687562506f6f6c00000060448201526064016101f7565b6105468282610882565b7f9e6c52944e331ba6270e7fe4cea2a4086bae8f7a27e1cdba07f416806f5d0ac48282604051610577929190610e0d565b60405180910390a16105c3600180547fffffffffffffffffffffff00ffffffffffffffffffffffffffffffffffffffff1674010000000000000000000000000000000000000000179055565b5050565b60005473ffffffffffffffffffffffffffffffffffffffff163314610648576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657260448201526064016101f7565b73ffffffffffffffffffffffffffffffffffffffff81166106eb576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201527f646472657373000000000000000000000000000000000000000000000000000060648201526084016101f7565b6106f48161080d565b50565b60015474010000000000000000000000000000000000000000900460ff16610484576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601f60248201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c0060448201526064016101f7565b6040805173ffffffffffffffffffffffffffffffffffffffff8416602482015260448082018490528251808303909101815260649091019091526020810180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff167fa9059cbb000000000000000000000000000000000000000000000000000000001790526108089084906108ff565b505050565b6000805473ffffffffffffffffffffffffffffffffffffffff8381167fffffffffffffffffffffffff0000000000000000000000000000000000000000831681178455604051919092169283917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a35050565b600060208201825160008082846000895af19250505080610808576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601360248201527f657865637574652063616c6c206661696c65640000000000000000000000000060448201526064016101f7565b6000610961826040518060400160405280602081526020017f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c65648152508573ffffffffffffffffffffffffffffffffffffffff16610a0b9092919063ffffffff16565b805190915015610808578080602001905181019061097f9190610e3c565b610808576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602a60248201527f5361666545524332303a204552433230206f7065726174696f6e20646964206e60448201527f6f7420737563636565640000000000000000000000000000000000000000000060648201526084016101f7565b6060610a1a8484600085610a24565b90505b9392505050565b606082471015610ab6576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602660248201527f416464726573733a20696e73756666696369656e742062616c616e636520666f60448201527f722063616c6c000000000000000000000000000000000000000000000000000060648201526084016101f7565b843b610b1e576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e747261637400000060448201526064016101f7565b6000808673ffffffffffffffffffffffffffffffffffffffff168587604051610b479190610e5e565b60006040518083038185875af1925050503d8060008114610b84576040519150601f19603f3d011682016040523d82523d6000602084013e610b89565b606091505b5091509150610b99828286610ba4565b979650505050505050565b60608315610bb3575081610a1d565b825115610bc35782518084602001fd5b816040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016101f79190610e7a565b803573ffffffffffffffffffffffffffffffffffffffff81168114610c1b57600080fd5b919050565b600060208284031215610c3257600080fd5b610a1d82610bf7565b60008060008060808587031215610c5157600080fd5b610c5a85610bf7565b9350610c6860208601610bf7565b925060408501359150610c7d60608601610bf7565b905092959194509250565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b60008060408385031215610cca57600080fd5b610cd383610bf7565b9150602083013567ffffffffffffffff80821115610cf057600080fd5b818501915085601f830112610d0457600080fd5b813581811115610d1657610d16610c88565b604051601f82017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0908116603f01168101908382118183101715610d5c57610d5c610c88565b81604052828152886020848701011115610d7557600080fd5b8260208601602083013760006020848301015280955050505050509250929050565b60005b83811015610db2578181015183820152602001610d9a565b838111156103f35750506000910152565b60008151808452610ddb816020860160208601610d97565b601f017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0169290920160200192915050565b73ffffffffffffffffffffffffffffffffffffffff83168152604060208201526000610a1a6040830184610dc3565b600060208284031215610e4e57600080fd5b81518015158114610a1d57600080fd5b60008251610e70818460208701610d97565b9190910192915050565b602081526000610a1d6020830184610dc356fea2646970667358221220e1e7531790c8d248f7bd9f2c1c257a40ec20e00a3eaec67b9651cc3fa745851a64736f6c634300080b0033", - "deployedBytecode": "0x6080604052600436106100745760003560e01c80638da5cb5b1161004e5780638da5cb5b146100ca578063e19044021461011a578063e6eb8ade14610147578063f2fde38b1461015a57600080fd5b80631dfb2d021461008057806352c8c75c146100a2578063715018a6146100b557600080fd5b3661007b57005b600080fd5b34801561008c57600080fd5b506100a061009b366004610c20565b61017a565b005b6100a06100b0366004610c3b565b610279565b3480156100c157600080fd5b506100a06103f9565b3480156100d657600080fd5b5060005473ffffffffffffffffffffffffffffffffffffffff165b60405173ffffffffffffffffffffffffffffffffffffffff909116815260200160405180910390f35b34801561012657600080fd5b506001546100f19073ffffffffffffffffffffffffffffffffffffffff1681565b6100a0610155366004610cb7565b610486565b34801561016657600080fd5b506100a0610175366004610c20565b6105c7565b60005473ffffffffffffffffffffffffffffffffffffffff163314610200576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657260448201526064015b60405180910390fd5b600180547fffffffffffffffffffffffff00000000000000000000000000000000000000001673ffffffffffffffffffffffffffffffffffffffff83169081179091556040519081527fb5f5d393a77ca9332951514b7bbfed2186d8fecdfafa02a2a676b05e677169639060200160405180910390a150565b6102816106f7565b6102ae600180547fffffffffffffffffffffff00ffffffffffffffffffffffffffffffffffffffff169055565b60015473ffffffffffffffffffffffffffffffffffffffff16331461032f576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601d60248201527f43616e206f6e6c792062652063616c6c656420627920687562506f6f6c00000060448201526064016101f7565b61035073ffffffffffffffffffffffffffffffffffffffff8516828461077b565b6040805173ffffffffffffffffffffffffffffffffffffffff868116825285811660208301528183018590528316606082015290517fd7e09655439c3932e55857df3220186e5a7f0980825f20691c2b35d941dee75b9181900360800190a16103f3600180547fffffffffffffffffffffff00ffffffffffffffffffffffffffffffffffffffff1674010000000000000000000000000000000000000000179055565b50505050565b60005473ffffffffffffffffffffffffffffffffffffffff16331461047a576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657260448201526064016101f7565b610484600061080d565b565b61048e6106f7565b6104bb600180547fffffffffffffffffffffff00ffffffffffffffffffffffffffffffffffffffff169055565b60015473ffffffffffffffffffffffffffffffffffffffff16331461053c576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601d60248201527f43616e206f6e6c792062652063616c6c656420627920687562506f6f6c00000060448201526064016101f7565b6105468282610882565b7f9e6c52944e331ba6270e7fe4cea2a4086bae8f7a27e1cdba07f416806f5d0ac48282604051610577929190610e0d565b60405180910390a16105c3600180547fffffffffffffffffffffff00ffffffffffffffffffffffffffffffffffffffff1674010000000000000000000000000000000000000000179055565b5050565b60005473ffffffffffffffffffffffffffffffffffffffff163314610648576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657260448201526064016101f7565b73ffffffffffffffffffffffffffffffffffffffff81166106eb576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201527f646472657373000000000000000000000000000000000000000000000000000060648201526084016101f7565b6106f48161080d565b50565b60015474010000000000000000000000000000000000000000900460ff16610484576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601f60248201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c0060448201526064016101f7565b6040805173ffffffffffffffffffffffffffffffffffffffff8416602482015260448082018490528251808303909101815260649091019091526020810180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff167fa9059cbb000000000000000000000000000000000000000000000000000000001790526108089084906108ff565b505050565b6000805473ffffffffffffffffffffffffffffffffffffffff8381167fffffffffffffffffffffffff0000000000000000000000000000000000000000831681178455604051919092169283917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a35050565b600060208201825160008082846000895af19250505080610808576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601360248201527f657865637574652063616c6c206661696c65640000000000000000000000000060448201526064016101f7565b6000610961826040518060400160405280602081526020017f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c65648152508573ffffffffffffffffffffffffffffffffffffffff16610a0b9092919063ffffffff16565b805190915015610808578080602001905181019061097f9190610e3c565b610808576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602a60248201527f5361666545524332303a204552433230206f7065726174696f6e20646964206e60448201527f6f7420737563636565640000000000000000000000000000000000000000000060648201526084016101f7565b6060610a1a8484600085610a24565b90505b9392505050565b606082471015610ab6576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602660248201527f416464726573733a20696e73756666696369656e742062616c616e636520666f60448201527f722063616c6c000000000000000000000000000000000000000000000000000060648201526084016101f7565b843b610b1e576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e747261637400000060448201526064016101f7565b6000808673ffffffffffffffffffffffffffffffffffffffff168587604051610b479190610e5e565b60006040518083038185875af1925050503d8060008114610b84576040519150601f19603f3d011682016040523d82523d6000602084013e610b89565b606091505b5091509150610b99828286610ba4565b979650505050505050565b60608315610bb3575081610a1d565b825115610bc35782518084602001fd5b816040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016101f79190610e7a565b803573ffffffffffffffffffffffffffffffffffffffff81168114610c1b57600080fd5b919050565b600060208284031215610c3257600080fd5b610a1d82610bf7565b60008060008060808587031215610c5157600080fd5b610c5a85610bf7565b9350610c6860208601610bf7565b925060408501359150610c7d60608601610bf7565b905092959194509250565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b60008060408385031215610cca57600080fd5b610cd383610bf7565b9150602083013567ffffffffffffffff80821115610cf057600080fd5b818501915085601f830112610d0457600080fd5b813581811115610d1657610d16610c88565b604051601f82017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0908116603f01168101908382118183101715610d5c57610d5c610c88565b81604052828152886020848701011115610d7557600080fd5b8260208601602083013760006020848301015280955050505050509250929050565b60005b83811015610db2578181015183820152602001610d9a565b838111156103f35750506000910152565b60008151808452610ddb816020860160208601610d97565b601f017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0169290920160200192915050565b73ffffffffffffffffffffffffffffffffffffffff83168152604060208201526000610a1a6040830184610dc3565b600060208284031215610e4e57600080fd5b81518015158114610a1d57600080fd5b60008251610e70818460208701610d97565b9190910192915050565b602081526000610a1d6020830184610dc356fea2646970667358221220e1e7531790c8d248f7bd9f2c1c257a40ec20e00a3eaec67b9651cc3fa745851a64736f6c634300080b0033", + "solcInputHash": "c8b9349311d8b5049b613ac98eb998d0", + "metadata": "{\"compiler\":{\"version\":\"0.8.13+commit.abaa5c0e\"},\"language\":\"Solidity\",\"output\":{\"abi\":[{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"address\",\"name\":\"target\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"bytes\",\"name\":\"message\",\"type\":\"bytes\"}],\"name\":\"MessageRelayed\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"address\",\"name\":\"l1Token\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"address\",\"name\":\"l2Token\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"address\",\"name\":\"to\",\"type\":\"address\"}],\"name\":\"TokensRelayed\",\"type\":\"event\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"target\",\"type\":\"address\"},{\"internalType\":\"bytes\",\"name\":\"message\",\"type\":\"bytes\"}],\"name\":\"relayMessage\",\"outputs\":[],\"stateMutability\":\"payable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"l1Token\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"l2Token\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"},{\"internalType\":\"address\",\"name\":\"to\",\"type\":\"address\"}],\"name\":\"relayTokens\",\"outputs\":[],\"stateMutability\":\"payable\",\"type\":\"function\"}],\"devdoc\":{\"details\":\"Public functions calling external contracts do not guard against reentrancy because they are expected to be called via delegatecall, which will execute this contract's logic within the context of the originating contract. For example, the HubPool will delegatecall these functions, therefore its only necessary that the HubPool's methods that call this contract's logic guard against reentrancy.\",\"kind\":\"dev\",\"methods\":{\"relayMessage(address,bytes)\":{\"params\":{\"message\":\"Data to send to target.\",\"target\":\"Contract that will receive message.\"}},\"relayTokens(address,address,uint256,address)\":{\"params\":{\"amount\":\"Amount of L1 tokens to send.\",\"l1Token\":\"L1 token to send.\",\"l2Token\":\"Unused parameter in this contract.\",\"to\":\"recipient.\"}}},\"version\":1},\"userdoc\":{\"kind\":\"user\",\"methods\":{\"relayMessage(address,bytes)\":{\"notice\":\"Send message to target on Ethereum.This function, and contract overall, is not useful in practice except that the HubPool expects to interact with the SpokePool via an Adapter, so when communicating to the Ethereum_SpokePool, it must send messages via this pass-through contract.\"},\"relayTokens(address,address,uint256,address)\":{\"notice\":\"Send tokens to target.\"}},\"notice\":\"Contract containing logic to send messages from L1 to Ethereum SpokePool.This contract should always be deployed on the same chain as the HubPool, as it acts as a pass-through contract between HubPool and SpokePool on the same chain. Its named \\\"Ethereum_Adapter\\\" because a core assumption is that the HubPool will be deployed on Ethereum, so this adapter will be used to communicate between HubPool and the Ethereum_SpokePool.\",\"version\":1}},\"settings\":{\"compilationTarget\":{\"contracts/chain-adapters/Ethereum_Adapter.sol\":\"Ethereum_Adapter\"},\"evmVersion\":\"london\",\"libraries\":{},\"metadata\":{\"bytecodeHash\":\"ipfs\",\"useLiteralContent\":true},\"optimizer\":{\"enabled\":true,\"runs\":1000000},\"remappings\":[]},\"sources\":{\"@openzeppelin/contracts/token/ERC20/IERC20.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.5.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 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(\\n address from,\\n address to,\\n uint256 amount\\n ) external returns (bool);\\n\\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\",\"keccak256\":\"0xbbc8ac883ac3c0078ce5ad3e288fbb3ffcc8a30c3a98c0fda0114d64fc44fca2\",\"license\":\"MIT\"},\"@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts v4.4.1 (token/ERC20/utils/SafeERC20.sol)\\n\\npragma solidity ^0.8.0;\\n\\nimport \\\"../IERC20.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 function safeTransfer(\\n IERC20 token,\\n address to,\\n uint256 value\\n ) internal {\\n _callOptionalReturn(token, abi.encodeWithSelector(token.transfer.selector, to, value));\\n }\\n\\n function safeTransferFrom(\\n IERC20 token,\\n address from,\\n address to,\\n uint256 value\\n ) 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(\\n IERC20 token,\\n address spender,\\n uint256 value\\n ) 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 function safeIncreaseAllowance(\\n IERC20 token,\\n address spender,\\n uint256 value\\n ) internal {\\n uint256 newAllowance = token.allowance(address(this), spender) + value;\\n _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, newAllowance));\\n }\\n\\n function safeDecreaseAllowance(\\n IERC20 token,\\n address spender,\\n uint256 value\\n ) internal {\\n unchecked {\\n uint256 oldAllowance = token.allowance(address(this), spender);\\n require(oldAllowance >= value, \\\"SafeERC20: decreased allowance below zero\\\");\\n uint256 newAllowance = oldAllowance - value;\\n _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, newAllowance));\\n }\\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 if (returndata.length > 0) {\\n // Return data is optional\\n require(abi.decode(returndata, (bool)), \\\"SafeERC20: ERC20 operation did not succeed\\\");\\n }\\n }\\n}\\n\",\"keccak256\":\"0xc3d946432c0ddbb1f846a0d3985be71299df331b91d06732152117f62f0be2b5\",\"license\":\"MIT\"},\"@openzeppelin/contracts/utils/Address.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.5.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 *\\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://diligence.consensys.net/posts/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.5.11/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 functionCall(target, data, \\\"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(\\n address target,\\n bytes memory data,\\n uint256 value\\n ) 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 require(isContract(target), \\\"Address: call to non-contract\\\");\\n\\n (bool success, bytes memory returndata) = target.call{value: value}(data);\\n return verifyCallResult(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 require(isContract(target), \\\"Address: static call to non-contract\\\");\\n\\n (bool success, bytes memory returndata) = target.staticcall(data);\\n return verifyCallResult(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 require(isContract(target), \\\"Address: delegate call to non-contract\\\");\\n\\n (bool success, bytes memory returndata) = target.delegatecall(data);\\n return verifyCallResult(success, returndata, errorMessage);\\n }\\n\\n /**\\n * @dev Tool to verifies that a low level call was successful, and revert if it wasn't, either by bubbling the\\n * revert reason 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 // 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\\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}\\n\",\"keccak256\":\"0x2ccf9d2313a313d41a791505f2b5abfdc62191b5d4334f7f7a82691c088a1c87\",\"license\":\"MIT\"},\"contracts/chain-adapters/Ethereum_Adapter.sol\":{\"content\":\"// SPDX-License-Identifier: AGPL-3.0-only\\npragma solidity ^0.8.0;\\n\\nimport \\\"../interfaces/AdapterInterface.sol\\\";\\n\\nimport \\\"@openzeppelin/contracts/token/ERC20/IERC20.sol\\\";\\nimport \\\"@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol\\\";\\n\\n/**\\n * @notice Contract containing logic to send messages from L1 to Ethereum SpokePool.\\n * @notice This contract should always be deployed on the same chain as the HubPool, as it acts as a pass-through\\n * contract between HubPool and SpokePool on the same chain. Its named \\\"Ethereum_Adapter\\\" because a core assumption\\n * is that the HubPool will be deployed on Ethereum, so this adapter will be used to communicate between HubPool\\n * and the Ethereum_SpokePool.\\n * @dev Public functions calling external contracts do not guard against reentrancy because they are expected to be\\n * called via delegatecall, which will execute this contract's logic within the context of the originating contract.\\n * For example, the HubPool will delegatecall these functions, therefore its only necessary that the HubPool's methods\\n * that call this contract's logic guard against reentrancy.\\n */\\ncontract Ethereum_Adapter is AdapterInterface {\\n using SafeERC20 for IERC20;\\n\\n /**\\n * @notice Send message to target on Ethereum.\\n * @notice This function, and contract overall, is not useful in practice except that the HubPool\\n * expects to interact with the SpokePool via an Adapter, so when communicating to the Ethereum_SpokePool, it must\\n * send messages via this pass-through contract.\\n * @param target Contract that will receive message.\\n * @param message Data to send to target.\\n */\\n function relayMessage(address target, bytes memory message) external payable override {\\n _executeCall(target, message);\\n emit MessageRelayed(target, message);\\n }\\n\\n /**\\n * @notice Send tokens to target.\\n * @param l1Token L1 token to send.\\n * @param l2Token Unused parameter in this contract.\\n * @param amount Amount of L1 tokens to send.\\n * @param to recipient.\\n */\\n function relayTokens(\\n address l1Token,\\n address l2Token, // l2Token is unused for ethereum since we are assuming that the HubPool is only deployed\\n // on this network.\\n uint256 amount,\\n address to\\n ) external payable override {\\n IERC20(l1Token).safeTransfer(to, amount);\\n emit TokensRelayed(l1Token, l2Token, amount, to);\\n }\\n\\n // Note: this snippet of code is copied from Governor.sol. Source: https://github.com/UMAprotocol/protocol/blob/5b37ea818a28479c01e458389a83c3e736306b17/packages/core/contracts/oracle/implementation/Governor.sol#L190-L207\\n function _executeCall(address to, bytes memory data) private {\\n // Note: this snippet of code is copied from Governor.sol and modified to not include any \\\"value\\\" field.\\n // solhint-disable-next-line no-inline-assembly\\n\\n bool success;\\n assembly {\\n let inputData := add(data, 0x20)\\n let inputDataSize := mload(data)\\n // Hardcode value to be 0 for relayed governance calls in order to avoid addressing complexity of bridging\\n // value cross-chain.\\n success := call(gas(), to, 0, inputData, inputDataSize, 0, 0)\\n }\\n require(success, \\\"execute call failed\\\");\\n }\\n}\\n\",\"keccak256\":\"0xd553b891966b6d01d77af8eccc394b7554c3fce1275e6470feecb72cbe173ae4\",\"license\":\"AGPL-3.0-only\"},\"contracts/interfaces/AdapterInterface.sol\":{\"content\":\"// SPDX-License-Identifier: AGPL-3.0-only\\npragma solidity ^0.8.0;\\n\\n/**\\n * @notice Sends cross chain messages and tokens to contracts on a specific L2 network.\\n */\\n\\ninterface AdapterInterface {\\n event MessageRelayed(address target, bytes message);\\n\\n event TokensRelayed(address l1Token, address l2Token, uint256 amount, address to);\\n\\n function relayMessage(address target, bytes memory message) external payable;\\n\\n function relayTokens(\\n address l1Token,\\n address l2Token,\\n uint256 amount,\\n address to\\n ) external payable;\\n}\\n\",\"keccak256\":\"0xbd7091006acbdfe72b21ce985f964f0682a2316d9d3b38967beeb55f4ae5118c\",\"license\":\"AGPL-3.0-only\"}},\"version\":1}", + "bytecode": "0x608060405234801561001057600080fd5b506107fa806100206000396000f3fe6080604052600436106100295760003560e01c806352c8c75c1461002e578063e6eb8ade14610043575b600080fd5b61004161003c36600461056e565b610056565b005b6100416100513660046105ea565b6100dc565b61007773ffffffffffffffffffffffffffffffffffffffff85168284610123565b6040805173ffffffffffffffffffffffffffffffffffffffff868116825285811660208301528183018590528316606082015290517fd7e09655439c3932e55857df3220186e5a7f0980825f20691c2b35d941dee75b9181900360800190a150505050565b6100e682826101b5565b7f9e6c52944e331ba6270e7fe4cea2a4086bae8f7a27e1cdba07f416806f5d0ac48282604051610117929190610744565b60405180910390a15050565b6040805173ffffffffffffffffffffffffffffffffffffffff8416602482015260448082018490528251808303909101815260649091019091526020810180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff167fa9059cbb000000000000000000000000000000000000000000000000000000001790526101b0908490610237565b505050565b600060208201825160008082846000895af192505050806101b0576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601360248201527f657865637574652063616c6c206661696c65640000000000000000000000000060448201526064015b60405180910390fd5b6000610299826040518060400160405280602081526020017f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c65648152508573ffffffffffffffffffffffffffffffffffffffff166103439092919063ffffffff16565b8051909150156101b057808060200190518101906102b79190610773565b6101b0576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602a60248201527f5361666545524332303a204552433230206f7065726174696f6e20646964206e60448201527f6f74207375636365656400000000000000000000000000000000000000000000606482015260840161022e565b6060610352848460008561035c565b90505b9392505050565b6060824710156103ee576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602660248201527f416464726573733a20696e73756666696369656e742062616c616e636520666f60448201527f722063616c6c0000000000000000000000000000000000000000000000000000606482015260840161022e565b73ffffffffffffffffffffffffffffffffffffffff85163b61046c576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e7472616374000000604482015260640161022e565b6000808673ffffffffffffffffffffffffffffffffffffffff1685876040516104959190610795565b60006040518083038185875af1925050503d80600081146104d2576040519150601f19603f3d011682016040523d82523d6000602084013e6104d7565b606091505b50915091506104e78282866104f2565b979650505050505050565b60608315610501575081610355565b8251156105115782518084602001fd5b816040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161022e91906107b1565b803573ffffffffffffffffffffffffffffffffffffffff8116811461056957600080fd5b919050565b6000806000806080858703121561058457600080fd5b61058d85610545565b935061059b60208601610545565b9250604085013591506105b060608601610545565b905092959194509250565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b600080604083850312156105fd57600080fd5b61060683610545565b9150602083013567ffffffffffffffff8082111561062357600080fd5b818501915085601f83011261063757600080fd5b813581811115610649576106496105bb565b604051601f82017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0908116603f0116810190838211818310171561068f5761068f6105bb565b816040528281528860208487010111156106a857600080fd5b8260208601602083013760006020848301015280955050505050509250929050565b60005b838110156106e55781810151838201526020016106cd565b838111156106f4576000848401525b50505050565b600081518084526107128160208601602086016106ca565b601f017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0169290920160200192915050565b73ffffffffffffffffffffffffffffffffffffffff8316815260406020820152600061035260408301846106fa565b60006020828403121561078557600080fd5b8151801515811461035557600080fd5b600082516107a78184602087016106ca565b9190910192915050565b60208152600061035560208301846106fa56fea2646970667358221220c375741f9f8699c2539c58570c2a4ba4c1e9099e507ad943cb7b7cfe570455d264736f6c634300080d0033", + "deployedBytecode": "0x6080604052600436106100295760003560e01c806352c8c75c1461002e578063e6eb8ade14610043575b600080fd5b61004161003c36600461056e565b610056565b005b6100416100513660046105ea565b6100dc565b61007773ffffffffffffffffffffffffffffffffffffffff85168284610123565b6040805173ffffffffffffffffffffffffffffffffffffffff868116825285811660208301528183018590528316606082015290517fd7e09655439c3932e55857df3220186e5a7f0980825f20691c2b35d941dee75b9181900360800190a150505050565b6100e682826101b5565b7f9e6c52944e331ba6270e7fe4cea2a4086bae8f7a27e1cdba07f416806f5d0ac48282604051610117929190610744565b60405180910390a15050565b6040805173ffffffffffffffffffffffffffffffffffffffff8416602482015260448082018490528251808303909101815260649091019091526020810180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff167fa9059cbb000000000000000000000000000000000000000000000000000000001790526101b0908490610237565b505050565b600060208201825160008082846000895af192505050806101b0576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601360248201527f657865637574652063616c6c206661696c65640000000000000000000000000060448201526064015b60405180910390fd5b6000610299826040518060400160405280602081526020017f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c65648152508573ffffffffffffffffffffffffffffffffffffffff166103439092919063ffffffff16565b8051909150156101b057808060200190518101906102b79190610773565b6101b0576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602a60248201527f5361666545524332303a204552433230206f7065726174696f6e20646964206e60448201527f6f74207375636365656400000000000000000000000000000000000000000000606482015260840161022e565b6060610352848460008561035c565b90505b9392505050565b6060824710156103ee576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602660248201527f416464726573733a20696e73756666696369656e742062616c616e636520666f60448201527f722063616c6c0000000000000000000000000000000000000000000000000000606482015260840161022e565b73ffffffffffffffffffffffffffffffffffffffff85163b61046c576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e7472616374000000604482015260640161022e565b6000808673ffffffffffffffffffffffffffffffffffffffff1685876040516104959190610795565b60006040518083038185875af1925050503d80600081146104d2576040519150601f19603f3d011682016040523d82523d6000602084013e6104d7565b606091505b50915091506104e78282866104f2565b979650505050505050565b60608315610501575081610355565b8251156105115782518084602001fd5b816040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161022e91906107b1565b803573ffffffffffffffffffffffffffffffffffffffff8116811461056957600080fd5b919050565b6000806000806080858703121561058457600080fd5b61058d85610545565b935061059b60208601610545565b9250604085013591506105b060608601610545565b905092959194509250565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b600080604083850312156105fd57600080fd5b61060683610545565b9150602083013567ffffffffffffffff8082111561062357600080fd5b818501915085601f83011261063757600080fd5b813581811115610649576106496105bb565b604051601f82017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0908116603f0116810190838211818310171561068f5761068f6105bb565b816040528281528860208487010111156106a857600080fd5b8260208601602083013760006020848301015280955050505050509250929050565b60005b838110156106e55781810151838201526020016106cd565b838111156106f4576000848401525b50505050565b600081518084526107128160208601602086016106ca565b601f017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0169290920160200192915050565b73ffffffffffffffffffffffffffffffffffffffff8316815260406020820152600061035260408301846106fa565b60006020828403121561078557600080fd5b8151801515811461035557600080fd5b600082516107a78184602087016106ca565b9190910192915050565b60208152600061035560208301846106fa56fea2646970667358221220c375741f9f8699c2539c58570c2a4ba4c1e9099e507ad943cb7b7cfe570455d264736f6c634300080d0033", "devdoc": { + "details": "Public functions calling external contracts do not guard against reentrancy because they are expected to be called via delegatecall, which will execute this contract's logic within the context of the originating contract. For example, the HubPool will delegatecall these functions, therefore its only necessary that the HubPool's methods that call this contract's logic guard against reentrancy.", "kind": "dev", "methods": { - "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 anymore. Can only be called by the current owner. NOTE: Renouncing ownership will leave the contract without an owner, thereby removing any functionality that is only available to the owner." + "relayMessage(address,bytes)": { + "params": { + "message": "Data to send to target.", + "target": "Contract that will receive message." + } }, - "transferOwnership(address)": { - "details": "Transfers ownership of the contract to a new account (`newOwner`). Can only be called by the current owner." + "relayTokens(address,address,uint256,address)": { + "params": { + "amount": "Amount of L1 tokens to send.", + "l1Token": "L1 token to send.", + "l2Token": "Unused parameter in this contract.", + "to": "recipient." + } } }, "version": 1 }, "userdoc": { "kind": "user", - "methods": {}, + "methods": { + "relayMessage(address,bytes)": { + "notice": "Send message to target on Ethereum.This function, and contract overall, is not useful in practice except that the HubPool expects to interact with the SpokePool via an Adapter, so when communicating to the Ethereum_SpokePool, it must send messages via this pass-through contract." + }, + "relayTokens(address,address,uint256,address)": { + "notice": "Send tokens to target." + } + }, + "notice": "Contract containing logic to send messages from L1 to Ethereum SpokePool.This contract should always be deployed on the same chain as the HubPool, as it acts as a pass-through contract between HubPool and SpokePool on the same chain. Its named \"Ethereum_Adapter\" because a core assumption is that the HubPool will be deployed on Ethereum, so this adapter will be used to communicate between HubPool and the Ethereum_SpokePool.", "version": 1 }, "storageLayout": { - "storage": [ - { - "astId": 400, - "contract": "contracts/chain-adapters/Ethereum_Adapter.sol:Ethereum_Adapter", - "label": "_owner", - "offset": 0, - "slot": "0", - "type": "t_address" - }, - { - "astId": 9443, - "contract": "contracts/chain-adapters/Ethereum_Adapter.sol:Ethereum_Adapter", - "label": "hubPool", - "offset": 0, - "slot": "1", - "type": "t_address" - }, - { - "astId": 5108, - "contract": "contracts/chain-adapters/Ethereum_Adapter.sol:Ethereum_Adapter", - "label": "_notEntered", - "offset": 20, - "slot": "1", - "type": "t_bool" - } - ], - "types": { - "t_address": { - "encoding": "inplace", - "label": "address", - "numberOfBytes": "20" - }, - "t_bool": { - "encoding": "inplace", - "label": "bool", - "numberOfBytes": "1" - } - } + "storage": [], + "types": null } } diff --git a/deployments/rinkeby/Ethereum_SpokePool.json b/deployments/rinkeby/Ethereum_SpokePool.json index 28a72c5e4..419ea42fb 100644 --- a/deployments/rinkeby/Ethereum_SpokePool.json +++ b/deployments/rinkeby/Ethereum_SpokePool.json @@ -1,5 +1,5 @@ { - "address": "0xf0f9089a48ABCf9b01eEF70ADA87b7815026A929", + "address": "0x90743806D7A66b37F31FAfd7b3447210aB55640f", "abi": [ { "inputs": [ @@ -22,6 +22,19 @@ "stateMutability": "nonpayable", "type": "constructor" }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "uint256", + "name": "rootBundleId", + "type": "uint256" + } + ], + "name": "EmergencyDeleteRootBundle", + "type": "event" + }, { "anonymous": false, "inputs": [ @@ -57,7 +70,7 @@ "type": "uint256" }, { - "indexed": false, + "indexed": true, "internalType": "uint256", "name": "chainId", "type": "uint256" @@ -93,7 +106,7 @@ "type": "address[]" }, { - "indexed": true, + "indexed": false, "internalType": "address", "name": "caller", "type": "address" @@ -114,7 +127,7 @@ { "indexed": false, "internalType": "uint256", - "name": "totalRelayAmount", + "name": "amount", "type": "uint256" }, { @@ -132,92 +145,19 @@ { "indexed": false, "internalType": "uint256", - "name": "originChainId", - "type": "uint256" - }, - { - "indexed": false, - "internalType": "uint64", - "name": "relayerFeePct", - "type": "uint64" - }, - { - "indexed": false, - "internalType": "uint64", - "name": "realizedLpFeePct", - "type": "uint64" - }, - { - "indexed": false, - "internalType": "uint32", - "name": "depositId", - "type": "uint32" - }, - { - "indexed": false, - "internalType": "address", - "name": "destinationToken", - "type": "address" - }, - { - "indexed": true, - "internalType": "address", - "name": "caller", - "type": "address" - }, - { - "indexed": false, - "internalType": "address", - "name": "depositor", - "type": "address" - }, - { - "indexed": false, - "internalType": "address", - "name": "recipient", - "type": "address" - } - ], - "name": "ExecutedSlowRelayFulfillmentRoot", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": true, - "internalType": "bytes32", - "name": "relayHash", - "type": "bytes32" - }, - { - "indexed": false, - "internalType": "uint256", - "name": "totalRelayAmount", - "type": "uint256" - }, - { - "indexed": false, - "internalType": "uint256", - "name": "totalFilledAmount", + "name": "repaymentChainId", "type": "uint256" }, { "indexed": false, "internalType": "uint256", - "name": "fillAmount", - "type": "uint256" - }, - { - "indexed": true, - "internalType": "uint256", - "name": "repaymentChain", + "name": "originChainId", "type": "uint256" }, { "indexed": false, "internalType": "uint256", - "name": "originChainId", + "name": "destinationChainId", "type": "uint256" }, { @@ -251,7 +191,7 @@ "type": "address" }, { - "indexed": false, + "indexed": true, "internalType": "address", "name": "depositor", "type": "address" @@ -261,6 +201,12 @@ "internalType": "address", "name": "recipient", "type": "address" + }, + { + "indexed": false, + "internalType": "bool", + "name": "isSlowRelay", + "type": "bool" } ], "name": "FilledRelay", @@ -275,6 +221,12 @@ "name": "amount", "type": "uint256" }, + { + "indexed": false, + "internalType": "uint256", + "name": "originChainId", + "type": "uint256" + }, { "indexed": false, "internalType": "uint256", @@ -358,13 +310,44 @@ { "indexed": false, "internalType": "bytes32", - "name": "slowRelayFulfillmentRoot", + "name": "slowRelayRoot", "type": "bytes32" } ], "name": "RelayedRootBundle", "type": "event" }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "uint64", + "name": "newRelayerFeePct", + "type": "uint64" + }, + { + "indexed": true, + "internalType": "uint32", + "name": "depositId", + "type": "uint32" + }, + { + "indexed": true, + "internalType": "address", + "name": "depositor", + "type": "address" + }, + { + "indexed": false, + "internalType": "bytes", + "name": "depositorSignature", + "type": "bytes" + } + ], + "name": "RequestedSpeedUpDeposit", + "type": "event" + }, { "anonymous": false, "inputs": [ @@ -467,19 +450,6 @@ "stateMutability": "view", "type": "function" }, - { - "inputs": [], - "name": "deploymentTime", - "outputs": [ - { - "internalType": "uint32", - "name": "", - "type": "uint32" - } - ], - "stateMutability": "view", - "type": "function" - }, { "inputs": [ { @@ -531,6 +501,19 @@ "stateMutability": "view", "type": "function" }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "rootBundleId", + "type": "uint256" + } + ], + "name": "emergencyDeleteRootBundle", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, { "inputs": [ { @@ -629,7 +612,7 @@ }, { "internalType": "uint256", - "name": "totalRelayAmount", + "name": "amount", "type": "uint256" }, { @@ -663,7 +646,7 @@ "type": "bytes32[]" } ], - "name": "executeSlowRelayFulfillmentRoot", + "name": "executeSlowRelayRoot", "outputs": [], "stateMutability": "nonpayable", "type": "function" @@ -687,7 +670,7 @@ }, { "internalType": "uint256", - "name": "totalRelayAmount", + "name": "amount", "type": "uint256" }, { @@ -697,7 +680,7 @@ }, { "internalType": "uint256", - "name": "repaymentChain", + "name": "repaymentChainId", "type": "uint256" }, { @@ -745,7 +728,7 @@ }, { "internalType": "uint256", - "name": "totalRelayAmount", + "name": "amount", "type": "uint256" }, { @@ -755,7 +738,7 @@ }, { "internalType": "uint256", - "name": "repaymentChain", + "name": "repaymentChainId", "type": "uint256" }, { @@ -921,7 +904,7 @@ "outputs": [ { "internalType": "bytes32", - "name": "slowRelayFulfillmentRoot", + "name": "slowRelayRoot", "type": "bytes32" }, { @@ -963,7 +946,7 @@ "inputs": [ { "internalType": "uint32", - "name": "buffer", + "name": "newDepositQuoteTimeBuffer", "type": "uint32" } ], @@ -986,7 +969,7 @@ }, { "internalType": "bool", - "name": "enable", + "name": "enabled", "type": "bool" } ], @@ -1008,6 +991,34 @@ "stateMutability": "nonpayable", "type": "function" }, + { + "inputs": [ + { + "internalType": "address", + "name": "depositor", + "type": "address" + }, + { + "internalType": "uint64", + "name": "newRelayerFeePct", + "type": "uint64" + }, + { + "internalType": "uint32", + "name": "depositId", + "type": "uint32" + }, + { + "internalType": "bytes", + "name": "depositorSignature", + "type": "bytes" + } + ], + "name": "speedUpDeposit", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, { "inputs": [], "name": "timerAddress", @@ -1052,79 +1063,152 @@ "type": "receive" } ], - "transactionHash": "0xa0e1264640a527c905f3837fa4ba047caebcf2d488b43446ea35e3450862366c", + "transactionHash": "0x45f71b1ed3e976c5dc4a4e2483376dba07d8767c4703abbd15a4e39ebf7e8303", "receipt": { "to": null, "from": "0x9A8f92a830A5cB89a3816e3D267CB7791c16b04D", - "contractAddress": "0xf0f9089a48ABCf9b01eEF70ADA87b7815026A929", - "transactionIndex": 17, - "gasUsed": "3854874", - "logsBloom": "0x00000000000000000000000000000000000000000000010000800000000000000000000000000000000000000800000000200000000000000000000000000000000000000000000000000000200000000001000000000000000000000000000000000000020000000000000000000800000800000000000000000000040000400000000000000000000000000000000040000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000100000000800000000001000080000080000000000000000000000020000001200000000000000000000000000000000400000000000000000000000000", - "blockHash": "0x93f5a32f8eee4245f44b48da47e94c9761d3633732582ce38b495c8ea6e7b382", - "transactionHash": "0xa0e1264640a527c905f3837fa4ba047caebcf2d488b43446ea35e3450862366c", + "contractAddress": "0x90743806D7A66b37F31FAfd7b3447210aB55640f", + "transactionIndex": 28, + "gasUsed": "3867944", + "logsBloom": "0x00000000000000000000000000000002000000000000000000800000000000000000000000000000000000000800000000200000000000000000000000000000000000000000000000000000000000000001000000000000000000000000000000000000020000000000000000000800000800000000000000000000040000400000000000000000000000000000000040000000000000000000200000000000000000000000000000000000000000000000000000000000000000000000080000000000000040800000000000008000000080000000000000000000000020000001000000080000000000000000000000000400000000000000000000000000", + "blockHash": "0x7a1afc1635b9f9749e1ce23e77eada59fd9ba10c42aa82b2e6421d1ddee0d9fe", + "transactionHash": "0x45f71b1ed3e976c5dc4a4e2483376dba07d8767c4703abbd15a4e39ebf7e8303", "logs": [ { - "transactionIndex": 17, - "blockNumber": 10232308, - "transactionHash": "0xa0e1264640a527c905f3837fa4ba047caebcf2d488b43446ea35e3450862366c", - "address": "0xf0f9089a48ABCf9b01eEF70ADA87b7815026A929", + "transactionIndex": 28, + "blockNumber": 10365603, + "transactionHash": "0x45f71b1ed3e976c5dc4a4e2483376dba07d8767c4703abbd15a4e39ebf7e8303", + "address": "0x90743806D7A66b37F31FAfd7b3447210aB55640f", "topics": [ "0xa9e8c42c9e7fca7f62755189a16b2f5314d43d8fb24e91ba54e6d65f9314e849", "0x0000000000000000000000009a8f92a830a5cb89a3816e3d267cb7791c16b04d" ], "data": "0x", - "logIndex": 23, - "blockHash": "0x93f5a32f8eee4245f44b48da47e94c9761d3633732582ce38b495c8ea6e7b382" + "logIndex": 30, + "blockHash": "0x7a1afc1635b9f9749e1ce23e77eada59fd9ba10c42aa82b2e6421d1ddee0d9fe" }, { - "transactionIndex": 17, - "blockNumber": 10232308, - "transactionHash": "0xa0e1264640a527c905f3837fa4ba047caebcf2d488b43446ea35e3450862366c", - "address": "0xf0f9089a48ABCf9b01eEF70ADA87b7815026A929", + "transactionIndex": 28, + "blockNumber": 10365603, + "transactionHash": "0x45f71b1ed3e976c5dc4a4e2483376dba07d8767c4703abbd15a4e39ebf7e8303", + "address": "0x90743806D7A66b37F31FAfd7b3447210aB55640f", "topics": [ "0x1f17a88f67b0f49060a34bec1a4723a563620e6aa265eb640b5046dcee0759a0", - "0x000000000000000000000000fa6326fdf1f149b63d116576fcfbc7e15cc0355a" + "0x000000000000000000000000a1b6da4aae90fa16f3a3338c8d1dc70b4926fca7" ], "data": "0x", - "logIndex": 24, - "blockHash": "0x93f5a32f8eee4245f44b48da47e94c9761d3633732582ce38b495c8ea6e7b382" + "logIndex": 31, + "blockHash": "0x7a1afc1635b9f9749e1ce23e77eada59fd9ba10c42aa82b2e6421d1ddee0d9fe" }, { - "transactionIndex": 17, - "blockNumber": 10232308, - "transactionHash": "0xa0e1264640a527c905f3837fa4ba047caebcf2d488b43446ea35e3450862366c", - "address": "0xf0f9089a48ABCf9b01eEF70ADA87b7815026A929", + "transactionIndex": 28, + "blockNumber": 10365603, + "transactionHash": "0x45f71b1ed3e976c5dc4a4e2483376dba07d8767c4703abbd15a4e39ebf7e8303", + "address": "0x90743806D7A66b37F31FAfd7b3447210aB55640f", "topics": [ "0x8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0", "0x0000000000000000000000000000000000000000000000000000000000000000", "0x0000000000000000000000009a8f92a830a5cb89a3816e3d267cb7791c16b04d" ], "data": "0x", - "logIndex": 25, - "blockHash": "0x93f5a32f8eee4245f44b48da47e94c9761d3633732582ce38b495c8ea6e7b382" + "logIndex": 32, + "blockHash": "0x7a1afc1635b9f9749e1ce23e77eada59fd9ba10c42aa82b2e6421d1ddee0d9fe" } ], - "blockNumber": 10232308, - "cumulativeGasUsed": "11831447", + "blockNumber": 10365603, + "cumulativeGasUsed": "6516835", "status": 1, "byzantium": true }, "args": [ - "0xFA6326FdF1f149B63d116576fCfbc7e15cc0355A", + "0xa1b6DA4AaE90fA16F3A3338c8d1Dc70B4926FCa7", "0xc778417E063141139Fce010982780140Aa0cD5Ab", "0x0000000000000000000000000000000000000000" ], "numDeployments": 1, - "solcInputHash": "a5765a49a3d11723dab4e70ab648f8a6", - "metadata": "{\"compiler\":{\"version\":\"0.8.11+commit.d7f03943\"},\"language\":\"Solidity\",\"output\":{\"abi\":[{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_hubPool\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"_wethAddress\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"timerAddress\",\"type\":\"address\"}],\"stateMutability\":\"nonpayable\",\"type\":\"constructor\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"originToken\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"uint256\",\"name\":\"destinationChainId\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"bool\",\"name\":\"enabled\",\"type\":\"bool\"}],\"name\":\"EnabledDepositRoute\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"amountToReturn\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"chainId\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"uint256[]\",\"name\":\"refundAmounts\",\"type\":\"uint256[]\"},{\"indexed\":true,\"internalType\":\"uint32\",\"name\":\"rootBundleId\",\"type\":\"uint32\"},{\"indexed\":true,\"internalType\":\"uint32\",\"name\":\"leafId\",\"type\":\"uint32\"},{\"indexed\":false,\"internalType\":\"address\",\"name\":\"l2TokenAddress\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"address[]\",\"name\":\"refundAddresses\",\"type\":\"address[]\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"caller\",\"type\":\"address\"}],\"name\":\"ExecutedRelayerRefundRoot\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"bytes32\",\"name\":\"relayHash\",\"type\":\"bytes32\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"totalRelayAmount\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"totalFilledAmount\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"fillAmount\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"originChainId\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"uint64\",\"name\":\"relayerFeePct\",\"type\":\"uint64\"},{\"indexed\":false,\"internalType\":\"uint64\",\"name\":\"realizedLpFeePct\",\"type\":\"uint64\"},{\"indexed\":false,\"internalType\":\"uint32\",\"name\":\"depositId\",\"type\":\"uint32\"},{\"indexed\":false,\"internalType\":\"address\",\"name\":\"destinationToken\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"caller\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"address\",\"name\":\"depositor\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"address\",\"name\":\"recipient\",\"type\":\"address\"}],\"name\":\"ExecutedSlowRelayFulfillmentRoot\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"bytes32\",\"name\":\"relayHash\",\"type\":\"bytes32\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"totalRelayAmount\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"totalFilledAmount\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"fillAmount\",\"type\":\"uint256\"},{\"indexed\":true,\"internalType\":\"uint256\",\"name\":\"repaymentChain\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"originChainId\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"uint64\",\"name\":\"relayerFeePct\",\"type\":\"uint64\"},{\"indexed\":false,\"internalType\":\"uint64\",\"name\":\"realizedLpFeePct\",\"type\":\"uint64\"},{\"indexed\":false,\"internalType\":\"uint32\",\"name\":\"depositId\",\"type\":\"uint32\"},{\"indexed\":false,\"internalType\":\"address\",\"name\":\"destinationToken\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"relayer\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"address\",\"name\":\"depositor\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"address\",\"name\":\"recipient\",\"type\":\"address\"}],\"name\":\"FilledRelay\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"destinationChainId\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"uint64\",\"name\":\"relayerFeePct\",\"type\":\"uint64\"},{\"indexed\":true,\"internalType\":\"uint32\",\"name\":\"depositId\",\"type\":\"uint32\"},{\"indexed\":false,\"internalType\":\"uint32\",\"name\":\"quoteTimestamp\",\"type\":\"uint32\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"originToken\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"address\",\"name\":\"recipient\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"depositor\",\"type\":\"address\"}],\"name\":\"FundsDeposited\",\"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\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"uint32\",\"name\":\"rootBundleId\",\"type\":\"uint32\"},{\"indexed\":false,\"internalType\":\"bytes32\",\"name\":\"relayerRefundRoot\",\"type\":\"bytes32\"},{\"indexed\":false,\"internalType\":\"bytes32\",\"name\":\"slowRelayFulfillmentRoot\",\"type\":\"bytes32\"}],\"name\":\"RelayedRootBundle\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"uint32\",\"name\":\"newBuffer\",\"type\":\"uint32\"}],\"name\":\"SetDepositQuoteTimeBuffer\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"newHubPool\",\"type\":\"address\"}],\"name\":\"SetHubPool\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"newAdmin\",\"type\":\"address\"}],\"name\":\"SetXDomainAdmin\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"amountToReturn\",\"type\":\"uint256\"},{\"indexed\":true,\"internalType\":\"uint256\",\"name\":\"chainId\",\"type\":\"uint256\"},{\"indexed\":true,\"internalType\":\"uint32\",\"name\":\"leafId\",\"type\":\"uint32\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"l2TokenAddress\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"address\",\"name\":\"caller\",\"type\":\"address\"}],\"name\":\"TokensBridged\",\"type\":\"event\"},{\"inputs\":[],\"name\":\"chainId\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"crossDomainAdmin\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"deploymentTime\",\"outputs\":[{\"internalType\":\"uint32\",\"name\":\"\",\"type\":\"uint32\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"recipient\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"originToken\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"destinationChainId\",\"type\":\"uint256\"},{\"internalType\":\"uint64\",\"name\":\"relayerFeePct\",\"type\":\"uint64\"},{\"internalType\":\"uint32\",\"name\":\"quoteTimestamp\",\"type\":\"uint32\"}],\"name\":\"deposit\",\"outputs\":[],\"stateMutability\":\"payable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"depositQuoteTimeBuffer\",\"outputs\":[{\"internalType\":\"uint32\",\"name\":\"\",\"type\":\"uint32\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"name\":\"enabledDepositRoutes\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint32\",\"name\":\"rootBundleId\",\"type\":\"uint32\"},{\"components\":[{\"internalType\":\"uint256\",\"name\":\"amountToReturn\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"chainId\",\"type\":\"uint256\"},{\"internalType\":\"uint256[]\",\"name\":\"refundAmounts\",\"type\":\"uint256[]\"},{\"internalType\":\"uint32\",\"name\":\"leafId\",\"type\":\"uint32\"},{\"internalType\":\"address\",\"name\":\"l2TokenAddress\",\"type\":\"address\"},{\"internalType\":\"address[]\",\"name\":\"refundAddresses\",\"type\":\"address[]\"}],\"internalType\":\"struct SpokePoolInterface.RelayerRefundLeaf\",\"name\":\"relayerRefundLeaf\",\"type\":\"tuple\"},{\"internalType\":\"bytes32[]\",\"name\":\"proof\",\"type\":\"bytes32[]\"}],\"name\":\"executeRelayerRefundRoot\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"depositor\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"recipient\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"destinationToken\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"totalRelayAmount\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"originChainId\",\"type\":\"uint256\"},{\"internalType\":\"uint64\",\"name\":\"realizedLpFeePct\",\"type\":\"uint64\"},{\"internalType\":\"uint64\",\"name\":\"relayerFeePct\",\"type\":\"uint64\"},{\"internalType\":\"uint32\",\"name\":\"depositId\",\"type\":\"uint32\"},{\"internalType\":\"uint32\",\"name\":\"rootBundleId\",\"type\":\"uint32\"},{\"internalType\":\"bytes32[]\",\"name\":\"proof\",\"type\":\"bytes32[]\"}],\"name\":\"executeSlowRelayFulfillmentRoot\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"depositor\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"recipient\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"destinationToken\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"totalRelayAmount\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"maxTokensToSend\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"repaymentChain\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"originChainId\",\"type\":\"uint256\"},{\"internalType\":\"uint64\",\"name\":\"realizedLpFeePct\",\"type\":\"uint64\"},{\"internalType\":\"uint64\",\"name\":\"relayerFeePct\",\"type\":\"uint64\"},{\"internalType\":\"uint32\",\"name\":\"depositId\",\"type\":\"uint32\"}],\"name\":\"fillRelay\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"depositor\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"recipient\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"destinationToken\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"totalRelayAmount\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"maxTokensToSend\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"repaymentChain\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"originChainId\",\"type\":\"uint256\"},{\"internalType\":\"uint64\",\"name\":\"realizedLpFeePct\",\"type\":\"uint64\"},{\"internalType\":\"uint64\",\"name\":\"relayerFeePct\",\"type\":\"uint64\"},{\"internalType\":\"uint64\",\"name\":\"newRelayerFeePct\",\"type\":\"uint64\"},{\"internalType\":\"uint32\",\"name\":\"depositId\",\"type\":\"uint32\"},{\"internalType\":\"bytes\",\"name\":\"depositorSignature\",\"type\":\"bytes\"}],\"name\":\"fillRelayWithUpdatedFee\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"getCurrentTime\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"hubPool\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes[]\",\"name\":\"data\",\"type\":\"bytes[]\"}],\"name\":\"multicall\",\"outputs\":[{\"internalType\":\"bytes[]\",\"name\":\"results\",\"type\":\"bytes[]\"}],\"stateMutability\":\"payable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"numberOfDeposits\",\"outputs\":[{\"internalType\":\"uint32\",\"name\":\"\",\"type\":\"uint32\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"owner\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"\",\"type\":\"bytes32\"}],\"name\":\"relayFills\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"relayerRefundRoot\",\"type\":\"bytes32\"},{\"internalType\":\"bytes32\",\"name\":\"slowRelayRoot\",\"type\":\"bytes32\"}],\"name\":\"relayRootBundle\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"renounceOwnership\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"name\":\"rootBundles\",\"outputs\":[{\"internalType\":\"bytes32\",\"name\":\"slowRelayFulfillmentRoot\",\"type\":\"bytes32\"},{\"internalType\":\"bytes32\",\"name\":\"relayerRefundRoot\",\"type\":\"bytes32\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"newCrossDomainAdmin\",\"type\":\"address\"}],\"name\":\"setCrossDomainAdmin\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"time\",\"type\":\"uint256\"}],\"name\":\"setCurrentTime\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint32\",\"name\":\"buffer\",\"type\":\"uint32\"}],\"name\":\"setDepositQuoteTimeBuffer\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"originToken\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"destinationChainId\",\"type\":\"uint256\"},{\"internalType\":\"bool\",\"name\":\"enable\",\"type\":\"bool\"}],\"name\":\"setEnableRoute\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"newHubPool\",\"type\":\"address\"}],\"name\":\"setHubPool\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"timerAddress\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"newOwner\",\"type\":\"address\"}],\"name\":\"transferOwnership\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"weth\",\"outputs\":[{\"internalType\":\"contract WETH9\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"stateMutability\":\"payable\",\"type\":\"receive\"}],\"devdoc\":{\"details\":\"Used on Ethereum L1 to facilitate L2->L1 transfers.\",\"kind\":\"dev\",\"methods\":{\"deposit(address,address,uint256,uint256,uint64,uint32)\":{\"details\":\"The caller must first approve this contract to spend `amount` of `originToken`.\"},\"getCurrentTime()\":{\"returns\":{\"_0\":\"uint for the current Testable timestamp.\"}},\"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 anymore. Can only be called by the current owner. NOTE: Renouncing ownership will leave the contract without an owner, thereby removing any functionality that is only available to the owner.\"},\"setCurrentTime(uint256)\":{\"details\":\"Will revert if not running in test mode.\",\"params\":{\"time\":\"timestamp to set current Testable time to.\"}},\"transferOwnership(address)\":{\"details\":\"Transfers ownership of the contract to a new account (`newOwner`). Can only be called by the current owner.\"}},\"version\":1},\"userdoc\":{\"kind\":\"user\",\"methods\":{\"deposit(address,address,uint256,uint256,uint64,uint32)\":{\"notice\":\"Called by user to bridge funds from origin to destination chain.\"},\"getCurrentTime()\":{\"notice\":\"Gets the current time. Will return the last time set in `setCurrentTime` if running in test mode. Otherwise, it will return the block timestamp.\"},\"setCurrentTime(uint256)\":{\"notice\":\"Sets the current time.\"}},\"notice\":\"Ethereum L1 specific SpokePool.\",\"version\":1}},\"settings\":{\"compilationTarget\":{\"contracts/Ethereum_SpokePool.sol\":\"Ethereum_SpokePool\"},\"evmVersion\":\"london\",\"libraries\":{},\"metadata\":{\"bytecodeHash\":\"ipfs\",\"useLiteralContent\":true},\"optimizer\":{\"enabled\":true,\"runs\":1000000},\"remappings\":[]},\"sources\":{\"@openzeppelin/contracts/access/Ownable.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts v4.4.1 (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 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 called by any account other than the owner.\\n */\\n modifier onlyOwner() {\\n require(owner() == _msgSender(), \\\"Ownable: caller is not the owner\\\");\\n _;\\n }\\n\\n /**\\n * @dev Leaves the contract without owner. It will not be possible to call\\n * `onlyOwner` functions anymore. Can only be called by the current owner.\\n *\\n * NOTE: Renouncing ownership will leave the contract without an owner,\\n * thereby removing 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\",\"keccak256\":\"0x24e0364e503a9bbde94c715d26573a76f14cd2a202d45f96f52134ab806b67b9\",\"license\":\"MIT\"},\"@openzeppelin/contracts/interfaces/IERC1271.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts v4.4.1 (interfaces/IERC1271.sol)\\n\\npragma solidity ^0.8.0;\\n\\n/**\\n * @dev Interface of the ERC1271 standard signature validation method for\\n * contracts as defined in https://eips.ethereum.org/EIPS/eip-1271[ERC-1271].\\n *\\n * _Available since v4.1._\\n */\\ninterface IERC1271 {\\n /**\\n * @dev Should return whether the signature provided is valid for the provided data\\n * @param hash Hash of the data to be signed\\n * @param signature Signature byte array associated with _data\\n */\\n function isValidSignature(bytes32 hash, bytes memory signature) external view returns (bytes4 magicValue);\\n}\\n\",\"keccak256\":\"0x0705a4b1b86d7b0bd8432118f226ba139c44b9dcaba0a6eafba2dd7d0639c544\",\"license\":\"MIT\"},\"@openzeppelin/contracts/token/ERC20/IERC20.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts v4.4.1 (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 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 `recipient`.\\n *\\n * Returns a boolean value indicating whether the operation succeeded.\\n *\\n * Emits a {Transfer} event.\\n */\\n function transfer(address recipient, 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 `sender` to `recipient` 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(\\n address sender,\\n address recipient,\\n uint256 amount\\n ) external returns (bool);\\n\\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\",\"keccak256\":\"0x61437cb513a887a1bbad006e7b1c8b414478427d33de47c5600af3c748f108da\",\"license\":\"MIT\"},\"@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts v4.4.1 (token/ERC20/utils/SafeERC20.sol)\\n\\npragma solidity ^0.8.0;\\n\\nimport \\\"../IERC20.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 function safeTransfer(\\n IERC20 token,\\n address to,\\n uint256 value\\n ) internal {\\n _callOptionalReturn(token, abi.encodeWithSelector(token.transfer.selector, to, value));\\n }\\n\\n function safeTransferFrom(\\n IERC20 token,\\n address from,\\n address to,\\n uint256 value\\n ) 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(\\n IERC20 token,\\n address spender,\\n uint256 value\\n ) 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 function safeIncreaseAllowance(\\n IERC20 token,\\n address spender,\\n uint256 value\\n ) internal {\\n uint256 newAllowance = token.allowance(address(this), spender) + value;\\n _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, newAllowance));\\n }\\n\\n function safeDecreaseAllowance(\\n IERC20 token,\\n address spender,\\n uint256 value\\n ) internal {\\n unchecked {\\n uint256 oldAllowance = token.allowance(address(this), spender);\\n require(oldAllowance >= value, \\\"SafeERC20: decreased allowance below zero\\\");\\n uint256 newAllowance = oldAllowance - value;\\n _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, newAllowance));\\n }\\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 if (returndata.length > 0) {\\n // Return data is optional\\n require(abi.decode(returndata, (bool)), \\\"SafeERC20: ERC20 operation did not succeed\\\");\\n }\\n }\\n}\\n\",\"keccak256\":\"0xc3d946432c0ddbb1f846a0d3985be71299df331b91d06732152117f62f0be2b5\",\"license\":\"MIT\"},\"@openzeppelin/contracts/utils/Address.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts v4.4.1 (utils/Address.sol)\\n\\npragma solidity ^0.8.0;\\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 */\\n function isContract(address account) internal view returns (bool) {\\n // This method relies on extcodesize, which returns 0 for contracts in\\n // construction, since the code is only stored at the end of the\\n // constructor execution.\\n\\n uint256 size;\\n assembly {\\n size := extcodesize(account)\\n }\\n return size > 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://diligence.consensys.net/posts/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.5.11/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 functionCall(target, data, \\\"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(\\n address target,\\n bytes memory data,\\n uint256 value\\n ) 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 require(isContract(target), \\\"Address: call to non-contract\\\");\\n\\n (bool success, bytes memory returndata) = target.call{value: value}(data);\\n return verifyCallResult(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 require(isContract(target), \\\"Address: static call to non-contract\\\");\\n\\n (bool success, bytes memory returndata) = target.staticcall(data);\\n return verifyCallResult(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 require(isContract(target), \\\"Address: delegate call to non-contract\\\");\\n\\n (bool success, bytes memory returndata) = target.delegatecall(data);\\n return verifyCallResult(success, returndata, errorMessage);\\n }\\n\\n /**\\n * @dev Tool to verifies that a low level call was successful, and revert if it wasn't, either by bubbling the\\n * revert reason 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 // 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\\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}\\n\",\"keccak256\":\"0x51b758a8815ecc9596c66c37d56b1d33883a444631a3f916b9fe65cb863ef7c4\",\"license\":\"MIT\"},\"@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\",\"keccak256\":\"0xe2e337e6dde9ef6b680e07338c493ebea1b5fd09b43424112868e9cc1706bca7\",\"license\":\"MIT\"},\"@openzeppelin/contracts/utils/Strings.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts v4.4.1 (utils/Strings.sol)\\n\\npragma solidity ^0.8.0;\\n\\n/**\\n * @dev String operations.\\n */\\nlibrary Strings {\\n bytes16 private constant _HEX_SYMBOLS = \\\"0123456789abcdef\\\";\\n\\n /**\\n * @dev Converts a `uint256` to its ASCII `string` decimal representation.\\n */\\n function toString(uint256 value) internal pure returns (string memory) {\\n // Inspired by OraclizeAPI's implementation - MIT licence\\n // https://github.com/oraclize/ethereum-api/blob/b42146b063c7d6ee1358846c198246239e9360e8/oraclizeAPI_0.4.25.sol\\n\\n if (value == 0) {\\n return \\\"0\\\";\\n }\\n uint256 temp = value;\\n uint256 digits;\\n while (temp != 0) {\\n digits++;\\n temp /= 10;\\n }\\n bytes memory buffer = new bytes(digits);\\n while (value != 0) {\\n digits -= 1;\\n buffer[digits] = bytes1(uint8(48 + uint256(value % 10)));\\n value /= 10;\\n }\\n return string(buffer);\\n }\\n\\n /**\\n * @dev Converts a `uint256` to its ASCII `string` hexadecimal representation.\\n */\\n function toHexString(uint256 value) internal pure returns (string memory) {\\n if (value == 0) {\\n return \\\"0x00\\\";\\n }\\n uint256 temp = value;\\n uint256 length = 0;\\n while (temp != 0) {\\n length++;\\n temp >>= 8;\\n }\\n return toHexString(value, length);\\n }\\n\\n /**\\n * @dev Converts a `uint256` to its ASCII `string` hexadecimal representation with fixed length.\\n */\\n function toHexString(uint256 value, uint256 length) internal pure returns (string memory) {\\n bytes memory buffer = new bytes(2 * length + 2);\\n buffer[0] = \\\"0\\\";\\n buffer[1] = \\\"x\\\";\\n for (uint256 i = 2 * length + 1; i > 1; --i) {\\n buffer[i] = _HEX_SYMBOLS[value & 0xf];\\n value >>= 4;\\n }\\n require(value == 0, \\\"Strings: hex length insufficient\\\");\\n return string(buffer);\\n }\\n}\\n\",\"keccak256\":\"0x32c202bd28995dd20c4347b7c6467a6d3241c74c8ad3edcbb610cd9205916c45\",\"license\":\"MIT\"},\"@openzeppelin/contracts/utils/cryptography/ECDSA.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts v4.4.1 (utils/cryptography/ECDSA.sol)\\n\\npragma solidity ^0.8.0;\\n\\nimport \\\"../Strings.sol\\\";\\n\\n/**\\n * @dev Elliptic Curve Digital Signature Algorithm (ECDSA) operations.\\n *\\n * These functions can be used to verify that a message was signed by the holder\\n * of the private keys of a given address.\\n */\\nlibrary ECDSA {\\n enum RecoverError {\\n NoError,\\n InvalidSignature,\\n InvalidSignatureLength,\\n InvalidSignatureS,\\n InvalidSignatureV\\n }\\n\\n function _throwError(RecoverError error) private pure {\\n if (error == RecoverError.NoError) {\\n return; // no error: do nothing\\n } else if (error == RecoverError.InvalidSignature) {\\n revert(\\\"ECDSA: invalid signature\\\");\\n } else if (error == RecoverError.InvalidSignatureLength) {\\n revert(\\\"ECDSA: invalid signature length\\\");\\n } else if (error == RecoverError.InvalidSignatureS) {\\n revert(\\\"ECDSA: invalid signature 's' value\\\");\\n } else if (error == RecoverError.InvalidSignatureV) {\\n revert(\\\"ECDSA: invalid signature 'v' value\\\");\\n }\\n }\\n\\n /**\\n * @dev Returns the address that signed a hashed message (`hash`) with\\n * `signature` or error string. This address can then be used for verification purposes.\\n *\\n * The `ecrecover` EVM opcode allows for malleable (non-unique) signatures:\\n * this function rejects them by requiring the `s` value to be in the lower\\n * half order, and the `v` value to be either 27 or 28.\\n *\\n * IMPORTANT: `hash` _must_ be the result of a hash operation for the\\n * verification to be secure: it is possible to craft signatures that\\n * recover to arbitrary addresses for non-hashed data. A safe way to ensure\\n * this is by receiving a hash of the original message (which may otherwise\\n * be too long), and then calling {toEthSignedMessageHash} on it.\\n *\\n * Documentation for signature generation:\\n * - with https://web3js.readthedocs.io/en/v1.3.4/web3-eth-accounts.html#sign[Web3.js]\\n * - with https://docs.ethers.io/v5/api/signer/#Signer-signMessage[ethers]\\n *\\n * _Available since v4.3._\\n */\\n function tryRecover(bytes32 hash, bytes memory signature) internal pure returns (address, RecoverError) {\\n // Check the signature length\\n // - case 65: r,s,v signature (standard)\\n // - case 64: r,vs signature (cf https://eips.ethereum.org/EIPS/eip-2098) _Available since v4.1._\\n if (signature.length == 65) {\\n bytes32 r;\\n bytes32 s;\\n uint8 v;\\n // ecrecover takes the signature parameters, and the only way to get them\\n // currently is to use assembly.\\n assembly {\\n r := mload(add(signature, 0x20))\\n s := mload(add(signature, 0x40))\\n v := byte(0, mload(add(signature, 0x60)))\\n }\\n return tryRecover(hash, v, r, s);\\n } else if (signature.length == 64) {\\n bytes32 r;\\n bytes32 vs;\\n // ecrecover takes the signature parameters, and the only way to get them\\n // currently is to use assembly.\\n assembly {\\n r := mload(add(signature, 0x20))\\n vs := mload(add(signature, 0x40))\\n }\\n return tryRecover(hash, r, vs);\\n } else {\\n return (address(0), RecoverError.InvalidSignatureLength);\\n }\\n }\\n\\n /**\\n * @dev Returns the address that signed a hashed message (`hash`) with\\n * `signature`. This address can then be used for verification purposes.\\n *\\n * The `ecrecover` EVM opcode allows for malleable (non-unique) signatures:\\n * this function rejects them by requiring the `s` value to be in the lower\\n * half order, and the `v` value to be either 27 or 28.\\n *\\n * IMPORTANT: `hash` _must_ be the result of a hash operation for the\\n * verification to be secure: it is possible to craft signatures that\\n * recover to arbitrary addresses for non-hashed data. A safe way to ensure\\n * this is by receiving a hash of the original message (which may otherwise\\n * be too long), and then calling {toEthSignedMessageHash} on it.\\n */\\n function recover(bytes32 hash, bytes memory signature) internal pure returns (address) {\\n (address recovered, RecoverError error) = tryRecover(hash, signature);\\n _throwError(error);\\n return recovered;\\n }\\n\\n /**\\n * @dev Overload of {ECDSA-tryRecover} that receives the `r` and `vs` short-signature fields separately.\\n *\\n * See https://eips.ethereum.org/EIPS/eip-2098[EIP-2098 short signatures]\\n *\\n * _Available since v4.3._\\n */\\n function tryRecover(\\n bytes32 hash,\\n bytes32 r,\\n bytes32 vs\\n ) internal pure returns (address, RecoverError) {\\n bytes32 s;\\n uint8 v;\\n assembly {\\n s := and(vs, 0x7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff)\\n v := add(shr(255, vs), 27)\\n }\\n return tryRecover(hash, v, r, s);\\n }\\n\\n /**\\n * @dev Overload of {ECDSA-recover} that receives the `r and `vs` short-signature fields separately.\\n *\\n * _Available since v4.2._\\n */\\n function recover(\\n bytes32 hash,\\n bytes32 r,\\n bytes32 vs\\n ) internal pure returns (address) {\\n (address recovered, RecoverError error) = tryRecover(hash, r, vs);\\n _throwError(error);\\n return recovered;\\n }\\n\\n /**\\n * @dev Overload of {ECDSA-tryRecover} that receives the `v`,\\n * `r` and `s` signature fields separately.\\n *\\n * _Available since v4.3._\\n */\\n function tryRecover(\\n bytes32 hash,\\n uint8 v,\\n bytes32 r,\\n bytes32 s\\n ) internal pure returns (address, RecoverError) {\\n // EIP-2 still allows signature malleability for ecrecover(). Remove this possibility and make the signature\\n // unique. Appendix F in the Ethereum Yellow paper (https://ethereum.github.io/yellowpaper/paper.pdf), defines\\n // the valid range for s in (301): 0 < s < secp256k1n \\u00f7 2 + 1, and for v in (302): v \\u2208 {27, 28}. Most\\n // signatures from current libraries generate a unique signature with an s-value in the lower half order.\\n //\\n // If your library generates malleable signatures, such as s-values in the upper range, calculate a new s-value\\n // with 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFEBAAEDCE6AF48A03BBFD25E8CD0364141 - s1 and flip v from 27 to 28 or\\n // vice versa. If your library also generates signatures with 0/1 for v instead 27/28, add 27 to v to accept\\n // these malleable signatures as well.\\n if (uint256(s) > 0x7FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF5D576E7357A4501DDFE92F46681B20A0) {\\n return (address(0), RecoverError.InvalidSignatureS);\\n }\\n if (v != 27 && v != 28) {\\n return (address(0), RecoverError.InvalidSignatureV);\\n }\\n\\n // If the signature is valid (and not malleable), return the signer address\\n address signer = ecrecover(hash, v, r, s);\\n if (signer == address(0)) {\\n return (address(0), RecoverError.InvalidSignature);\\n }\\n\\n return (signer, RecoverError.NoError);\\n }\\n\\n /**\\n * @dev Overload of {ECDSA-recover} that receives the `v`,\\n * `r` and `s` signature fields separately.\\n */\\n function recover(\\n bytes32 hash,\\n uint8 v,\\n bytes32 r,\\n bytes32 s\\n ) internal pure returns (address) {\\n (address recovered, RecoverError error) = tryRecover(hash, v, r, s);\\n _throwError(error);\\n return recovered;\\n }\\n\\n /**\\n * @dev Returns an Ethereum Signed Message, created from a `hash`. This\\n * produces hash corresponding to the one signed with the\\n * https://eth.wiki/json-rpc/API#eth_sign[`eth_sign`]\\n * JSON-RPC method as part of EIP-191.\\n *\\n * See {recover}.\\n */\\n function toEthSignedMessageHash(bytes32 hash) internal pure returns (bytes32) {\\n // 32 is the length in bytes of hash,\\n // enforced by the type signature above\\n return keccak256(abi.encodePacked(\\\"\\\\x19Ethereum Signed Message:\\\\n32\\\", hash));\\n }\\n\\n /**\\n * @dev Returns an Ethereum Signed Message, created from `s`. This\\n * produces hash corresponding to the one signed with the\\n * https://eth.wiki/json-rpc/API#eth_sign[`eth_sign`]\\n * JSON-RPC method as part of EIP-191.\\n *\\n * See {recover}.\\n */\\n function toEthSignedMessageHash(bytes memory s) internal pure returns (bytes32) {\\n return keccak256(abi.encodePacked(\\\"\\\\x19Ethereum Signed Message:\\\\n\\\", Strings.toString(s.length), s));\\n }\\n\\n /**\\n * @dev Returns an Ethereum Signed Typed Data, created from a\\n * `domainSeparator` and a `structHash`. This produces hash corresponding\\n * to the one signed with the\\n * https://eips.ethereum.org/EIPS/eip-712[`eth_signTypedData`]\\n * JSON-RPC method as part of EIP-712.\\n *\\n * See {recover}.\\n */\\n function toTypedDataHash(bytes32 domainSeparator, bytes32 structHash) internal pure returns (bytes32) {\\n return keccak256(abi.encodePacked(\\\"\\\\x19\\\\x01\\\", domainSeparator, structHash));\\n }\\n}\\n\",\"keccak256\":\"0xe9e291de7ffe06e66503c6700b1bb84ff6e0989cbb974653628d8994e7c97f03\",\"license\":\"MIT\"},\"@openzeppelin/contracts/utils/cryptography/MerkleProof.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts v4.4.1 (utils/cryptography/MerkleProof.sol)\\n\\npragma solidity ^0.8.0;\\n\\n/**\\n * @dev These functions deal with verification of Merkle Trees proofs.\\n *\\n * The proofs can be generated using the JavaScript library\\n * https://github.com/miguelmota/merkletreejs[merkletreejs].\\n * Note: the hashing algorithm should be keccak256 and pair sorting should be enabled.\\n *\\n * See `test/utils/cryptography/MerkleProof.test.js` for some examples.\\n */\\nlibrary MerkleProof {\\n /**\\n * @dev Returns true if a `leaf` can be proved to be a part of a Merkle tree\\n * defined by `root`. For this, a `proof` must be provided, containing\\n * sibling hashes on the branch from the leaf to the root of the tree. Each\\n * pair of leaves and each pair of pre-images are assumed to be sorted.\\n */\\n function verify(\\n bytes32[] memory proof,\\n bytes32 root,\\n bytes32 leaf\\n ) internal pure returns (bool) {\\n return processProof(proof, leaf) == root;\\n }\\n\\n /**\\n * @dev Returns the rebuilt hash obtained by traversing a Merklee tree up\\n * from `leaf` using `proof`. A `proof` is valid if and only if the rebuilt\\n * hash matches the root of the tree. When processing the proof, the pairs\\n * of leafs & pre-images are assumed to be sorted.\\n *\\n * _Available since v4.4._\\n */\\n function processProof(bytes32[] memory proof, bytes32 leaf) internal pure returns (bytes32) {\\n bytes32 computedHash = leaf;\\n for (uint256 i = 0; i < proof.length; i++) {\\n bytes32 proofElement = proof[i];\\n if (computedHash <= proofElement) {\\n // Hash(current computed hash + current element of the proof)\\n computedHash = keccak256(abi.encodePacked(computedHash, proofElement));\\n } else {\\n // Hash(current element of the proof + current computed hash)\\n computedHash = keccak256(abi.encodePacked(proofElement, computedHash));\\n }\\n }\\n return computedHash;\\n }\\n}\\n\",\"keccak256\":\"0x9c35727c74a6ffd8d02237b414e7bfb532c0323b1088709def98ea5c628157de\",\"license\":\"MIT\"},\"@openzeppelin/contracts/utils/cryptography/SignatureChecker.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts v4.4.1 (utils/cryptography/SignatureChecker.sol)\\n\\npragma solidity ^0.8.0;\\n\\nimport \\\"./ECDSA.sol\\\";\\nimport \\\"../Address.sol\\\";\\nimport \\\"../../interfaces/IERC1271.sol\\\";\\n\\n/**\\n * @dev Signature verification helper: Provide a single mechanism to verify both private-key (EOA) ECDSA signature and\\n * ERC1271 contract signatures. Using this instead of ECDSA.recover in your contract will make them compatible with\\n * smart contract wallets such as Argent and Gnosis.\\n *\\n * Note: unlike ECDSA signatures, contract signature's are revocable, and the outcome of this function can thus change\\n * through time. It could return true at block N and false at block N+1 (or the opposite).\\n *\\n * _Available since v4.1._\\n */\\nlibrary SignatureChecker {\\n function isValidSignatureNow(\\n address signer,\\n bytes32 hash,\\n bytes memory signature\\n ) internal view returns (bool) {\\n (address recovered, ECDSA.RecoverError error) = ECDSA.tryRecover(hash, signature);\\n if (error == ECDSA.RecoverError.NoError && recovered == signer) {\\n return true;\\n }\\n\\n (bool success, bytes memory result) = signer.staticcall(\\n abi.encodeWithSelector(IERC1271.isValidSignature.selector, hash, signature)\\n );\\n return (success && result.length == 32 && abi.decode(result, (bytes4)) == IERC1271.isValidSignature.selector);\\n }\\n}\\n\",\"keccak256\":\"0x448837ee3c81795bb58732fd56e8ec9b5194ab6a05a415e960da852fbaa23d01\",\"license\":\"MIT\"},\"@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\",\"keccak256\":\"0xcd34b3f83b61a096b53020749f327096d5cacd89c2393d947595afb934496ad4\",\"license\":\"AGPL-3.0-only\"},\"@uma/core/contracts/common/implementation/MultiCaller.sol\":{\"content\":\"// This contract is taken from Uniswaps'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.\\npragma solidity ^0.8.0;\\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 payable returns (bytes[] memory results) {\\n require(msg.value == 0, \\\"Only multicall with 0 value\\\");\\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\",\"keccak256\":\"0x31f18055b14fd9eeb459c6d6a88d1a60921bf3755031f6db4b709c3e01d078f7\"},\"@uma/core/contracts/common/implementation/Testable.sol\":{\"content\":\"// SPDX-License-Identifier: AGPL-3.0-only\\npragma solidity ^0.8.0;\\n\\nimport \\\"./Timer.sol\\\";\\n\\n/**\\n * @title Base class that provides time overrides, but only if being run in test mode.\\n */\\nabstract contract Testable {\\n // If the contract is being run in production, then `timerAddress` will be the 0x0 address.\\n // Note: this variable should be set on construction and never modified.\\n address public timerAddress;\\n\\n /**\\n * @notice Constructs the Testable contract. Called by child contracts.\\n * @param _timerAddress Contract that stores the current time in a testing environment.\\n * Must be set to 0x0 for production environments that use live time.\\n */\\n constructor(address _timerAddress) {\\n timerAddress = _timerAddress;\\n }\\n\\n /**\\n * @notice Reverts if not running in test mode.\\n */\\n modifier onlyIfTest {\\n require(timerAddress != address(0x0));\\n _;\\n }\\n\\n /**\\n * @notice Sets the current time.\\n * @dev Will revert if not running in test mode.\\n * @param time timestamp to set current Testable time to.\\n */\\n function setCurrentTime(uint256 time) external onlyIfTest {\\n Timer(timerAddress).setCurrentTime(time);\\n }\\n\\n /**\\n * @notice Gets the current time. Will return the last time set in `setCurrentTime` if running in test mode.\\n * Otherwise, it will return the block timestamp.\\n * @return uint for the current Testable timestamp.\\n */\\n function getCurrentTime() public view virtual returns (uint256) {\\n if (timerAddress != address(0x0)) {\\n return Timer(timerAddress).getCurrentTime();\\n } else {\\n return block.timestamp; // solhint-disable-line not-rely-on-time\\n }\\n }\\n}\\n\",\"keccak256\":\"0x0254b45747293bb800373a58d123969adec0428f7be79dc941cab10fcad09918\",\"license\":\"AGPL-3.0-only\"},\"@uma/core/contracts/common/implementation/Timer.sol\":{\"content\":\"// SPDX-License-Identifier: AGPL-3.0-only\\npragma solidity ^0.8.0;\\n\\n/**\\n * @title Universal store of current contract time for testing environments.\\n */\\ncontract Timer {\\n uint256 private currentTime;\\n\\n constructor() {\\n currentTime = block.timestamp; // solhint-disable-line not-rely-on-time\\n }\\n\\n /**\\n * @notice Sets the current time.\\n * @dev Will revert if not running in test mode.\\n * @param time timestamp to set `currentTime` to.\\n */\\n function setCurrentTime(uint256 time) external {\\n currentTime = time;\\n }\\n\\n /**\\n * @notice Gets the currentTime variable set in the Timer.\\n * @return uint256 for the current Testable timestamp.\\n */\\n function getCurrentTime() public view returns (uint256) {\\n return currentTime;\\n }\\n}\\n\",\"keccak256\":\"0x9e0dd7389718bd5d1da910273a6f4cee98ee22bfc0c92bde0f0955c0e23adb5e\",\"license\":\"AGPL-3.0-only\"},\"contracts/Ethereum_SpokePool.sol\":{\"content\":\"//SPDX-License-Identifier: Unlicense\\r\\npragma solidity ^0.8.0;\\r\\n\\r\\nimport \\\"./interfaces/WETH9.sol\\\";\\r\\n\\r\\nimport \\\"@openzeppelin/contracts/access/Ownable.sol\\\";\\r\\nimport \\\"@openzeppelin/contracts/token/ERC20/IERC20.sol\\\";\\r\\n\\r\\nimport \\\"./SpokePool.sol\\\";\\r\\nimport \\\"./SpokePoolInterface.sol\\\";\\r\\n\\r\\n/**\\r\\n * @notice Ethereum L1 specific SpokePool.\\r\\n * @dev Used on Ethereum L1 to facilitate L2->L1 transfers.\\r\\n */\\r\\n\\r\\ncontract Ethereum_SpokePool is SpokePoolInterface, SpokePool, Ownable {\\r\\n constructor(\\r\\n address _hubPool,\\r\\n address _wethAddress,\\r\\n address timerAddress\\r\\n ) SpokePool(msg.sender, _hubPool, _wethAddress, timerAddress) {}\\r\\n\\r\\n /**************************************\\r\\n * ADMIN FUNCTIONS *\\r\\n **************************************/\\r\\n\\r\\n function setCrossDomainAdmin(address newCrossDomainAdmin) public override onlyOwner nonReentrant {\\r\\n _setCrossDomainAdmin(newCrossDomainAdmin);\\r\\n }\\r\\n\\r\\n function setHubPool(address newHubPool) public override onlyOwner nonReentrant {\\r\\n _setHubPool(newHubPool);\\r\\n }\\r\\n\\r\\n function setEnableRoute(\\r\\n address originToken,\\r\\n uint256 destinationChainId,\\r\\n bool enable\\r\\n ) public override onlyOwner nonReentrant {\\r\\n _setEnableRoute(originToken, destinationChainId, enable);\\r\\n }\\r\\n\\r\\n function setDepositQuoteTimeBuffer(uint32 buffer) public override onlyOwner nonReentrant {\\r\\n _setDepositQuoteTimeBuffer(buffer);\\r\\n }\\r\\n\\r\\n function relayRootBundle(bytes32 relayerRefundRoot, bytes32 slowRelayRoot) public override onlyOwner nonReentrant {\\r\\n _relayRootBundle(relayerRefundRoot, slowRelayRoot);\\r\\n }\\r\\n\\r\\n function _bridgeTokensToHubPool(RelayerRefundLeaf memory relayerRefundLeaf) internal override {\\r\\n IERC20(relayerRefundLeaf.l2TokenAddress).transfer(hubPool, relayerRefundLeaf.amountToReturn);\\r\\n }\\r\\n}\",\"keccak256\":\"0xf2ce48cedd751c78bfb4b2189946da38e7f7aa261aa71a9a4eb6dd007bfcc4ff\",\"license\":\"Unlicense\"},\"contracts/HubPoolInterface.sol\":{\"content\":\"// SPDX-License-Identifier: GPL-3.0-only\\r\\npragma solidity ^0.8.0;\\r\\n\\r\\nimport \\\"@openzeppelin/contracts/token/ERC20/IERC20.sol\\\";\\r\\nimport \\\"./interfaces/AdapterInterface.sol\\\";\\r\\n\\r\\ninterface HubPoolInterface {\\r\\n struct PoolRebalanceLeaf {\\r\\n // This is used to know which chain to send cross-chain transactions to (and which SpokePool to sent to).\\r\\n uint256 chainId;\\r\\n uint256[] bundleLpFees; // Total LP fee amount per token in this bundle, encompassing all associated bundled relays.\\r\\n // This array is grouped with the two above, and it represents the amount to send or request back from the\\r\\n // SpokePool. If positive, the pool will pay the SpokePool. If negative the SpokePool will pay the HubPool.\\r\\n // There can be arbitrarily complex rebalancing rules defined offchain. This number is only nonzero\\r\\n // when the rules indicate that a rebalancing action should occur. When a rebalance does not occur,\\r\\n // runningBalances for this token should change by the total relays - deposits in this bundle. When a rebalance\\r\\n // does occur, runningBalances should be set to zero for this token and the netSendAmounts should be set to the\\r\\n // previous runningBalances + relays - deposits in this bundle.\\r\\n int256[] netSendAmounts;\\r\\n // This is only here to be emitted in an event to track a running unpaid balance between the L2 pool and the L1 pool.\\r\\n // A positive number indicates that the HubPool owes the SpokePool funds. A negative number indicates that the\\r\\n // SpokePool owes the HubPool funds. See the comment above for the dynamics of this and netSendAmounts\\r\\n int256[] runningBalances;\\r\\n // Used as the index in the bitmap to track whether this leaf has been executed or not.\\r\\n uint8 leafId;\\r\\n // The following arrays are required to be the same length. They are parallel arrays for the given chainId and should be ordered by the `l1Tokens` field.\\r\\n // All whitelisted tokens with nonzero relays on this chain in this bundle in the order of whitelisting.\\r\\n address[] l1Tokens;\\r\\n }\\r\\n\\r\\n function setBond(IERC20 newBondToken, uint256 newBondAmount) external;\\r\\n\\r\\n function setCrossChainContracts(\\r\\n uint256 l2ChainId,\\r\\n address adapter,\\r\\n address spokePool\\r\\n ) external;\\r\\n\\r\\n function whitelistRoute(\\r\\n uint256 originChainId,\\r\\n uint256 destinationChainId,\\r\\n address originToken,\\r\\n address destinationToken\\r\\n ) external;\\r\\n\\r\\n function enableL1TokenForLiquidityProvision(address l1Token) external;\\r\\n\\r\\n function disableL1TokenForLiquidityProvision(address l1Token) external;\\r\\n\\r\\n function addLiquidity(address l1Token, uint256 l1TokenAmount) external payable;\\r\\n\\r\\n function removeLiquidity(\\r\\n address l1Token,\\r\\n uint256 lpTokenAmount,\\r\\n bool sendEth\\r\\n ) external;\\r\\n\\r\\n function exchangeRateCurrent(address l1Token) external returns (uint256);\\r\\n\\r\\n function liquidityUtilizationPostRelay(address token, uint256 relayedAmount) external returns (uint256);\\r\\n\\r\\n function proposeRootBundle(\\r\\n uint256[] memory bundleEvaluationBlockNumbers,\\r\\n uint8 poolRebalanceLeafCount,\\r\\n bytes32 poolRebalanceRoot,\\r\\n bytes32 relayerRefundRoot,\\r\\n bytes32 slowRelayFulfillmentRoot\\r\\n ) external;\\r\\n\\r\\n function executeRootBundle(PoolRebalanceLeaf memory poolRebalanceLeaf, bytes32[] memory proof) external;\\r\\n\\r\\n function disputeRootBundle() external;\\r\\n}\\r\\n\",\"keccak256\":\"0x493f6803156dc7129c3af9b7d5b99172ffbd9e93a98d4a44604dc0b984502777\",\"license\":\"GPL-3.0-only\"},\"contracts/MerkleLib.sol\":{\"content\":\"// SPDX-License-Identifier: GPL-3.0-only\\r\\npragma solidity ^0.8.0;\\r\\n\\r\\nimport \\\"@openzeppelin/contracts/utils/cryptography/MerkleProof.sol\\\";\\r\\nimport \\\"./SpokePoolInterface.sol\\\";\\r\\nimport \\\"./HubPoolInterface.sol\\\";\\r\\n\\r\\n/**\\r\\n * @notice Library to help with merkle roots, proofs, and claims.\\r\\n */\\r\\nlibrary MerkleLib {\\r\\n /**\\r\\n * @notice Verifies that a repayment is contained within a merkle root.\\r\\n * @param root the merkle root.\\r\\n * @param rebalance the rebalance struct.\\r\\n * @param proof the merkle proof.\\r\\n */\\r\\n function verifyPoolRebalance(\\r\\n bytes32 root,\\r\\n HubPoolInterface.PoolRebalanceLeaf memory rebalance,\\r\\n bytes32[] memory proof\\r\\n ) internal pure returns (bool) {\\r\\n return MerkleProof.verify(proof, root, keccak256(abi.encode(rebalance)));\\r\\n }\\r\\n\\r\\n /**\\r\\n * @notice Verifies that a relayer refund is contained within a merkle root.\\r\\n * @param root the merkle root.\\r\\n * @param refund the refund struct.\\r\\n * @param proof the merkle proof.\\r\\n */\\r\\n function verifyRelayerRefund(\\r\\n bytes32 root,\\r\\n SpokePoolInterface.RelayerRefundLeaf memory refund,\\r\\n bytes32[] memory proof\\r\\n ) internal pure returns (bool) {\\r\\n return MerkleProof.verify(proof, root, keccak256(abi.encode(refund)));\\r\\n }\\r\\n\\r\\n /**\\r\\n * @notice Verifies that a distribution is contained within a merkle root.\\r\\n * @param root the merkle root.\\r\\n * @param slowRelayFulfillment the relayData fulfullment struct.\\r\\n * @param proof the merkle proof.\\r\\n */\\r\\n function verifySlowRelayFulfillment(\\r\\n bytes32 root,\\r\\n SpokePoolInterface.RelayData memory slowRelayFulfillment,\\r\\n bytes32[] memory proof\\r\\n ) internal pure returns (bool) {\\r\\n return MerkleProof.verify(proof, root, keccak256(abi.encode(slowRelayFulfillment)));\\r\\n }\\r\\n\\r\\n // The following functions are primarily copied from\\r\\n // https://github.com/Uniswap/merkle-distributor/blob/master/contracts/MerkleDistributor.sol with minor changes.\\r\\n\\r\\n /**\\r\\n * @notice Tests whether a claim is contained within a claimedBitMap mapping.\\r\\n * @param claimedBitMap a simple uint256 mapping in storage used as a bitmap.\\r\\n * @param index the index to check in the bitmap.\\r\\n * @return bool indicating if the index within the claimedBitMap has been marked as claimed.\\r\\n */\\r\\n function isClaimed(mapping(uint256 => uint256) storage claimedBitMap, uint256 index) internal view returns (bool) {\\r\\n uint256 claimedWordIndex = index / 256;\\r\\n uint256 claimedBitIndex = index % 256;\\r\\n uint256 claimedWord = claimedBitMap[claimedWordIndex];\\r\\n uint256 mask = (1 << claimedBitIndex);\\r\\n return claimedWord & mask == mask;\\r\\n }\\r\\n\\r\\n /**\\r\\n * @notice Marks an index in a claimedBitMap as claimed.\\r\\n * @param claimedBitMap a simple uint256 mapping in storage used as a bitmap.\\r\\n * @param index the index to mark in the bitmap.\\r\\n */\\r\\n function setClaimed(mapping(uint256 => uint256) storage claimedBitMap, uint256 index) internal {\\r\\n uint256 claimedWordIndex = index / 256;\\r\\n uint256 claimedBitIndex = index % 256;\\r\\n claimedBitMap[claimedWordIndex] = claimedBitMap[claimedWordIndex] | (1 << claimedBitIndex);\\r\\n }\\r\\n\\r\\n /**\\r\\n * @notice Tests whether a claim is contained within a 1D claimedBitMap mapping.\\r\\n * @param claimedBitMap a simple uint256 value, encoding a 1D bitmap.\\r\\n * @param index the index to check in the bitmap.\\r\\n \\\\* @return bool indicating if the index within the claimedBitMap has been marked as claimed.\\r\\n */\\r\\n function isClaimed1D(uint256 claimedBitMap, uint256 index) internal pure returns (bool) {\\r\\n uint256 mask = (1 << index);\\r\\n return claimedBitMap & mask == mask;\\r\\n }\\r\\n\\r\\n /**\\r\\n * @notice Marks an index in a claimedBitMap as claimed.\\r\\n * @param claimedBitMap a simple uint256 mapping in storage used as a bitmap.\\r\\n * @param index the index to mark in the bitmap.\\r\\n */\\r\\n function setClaimed1D(uint256 claimedBitMap, uint256 index) internal pure returns (uint256) {\\r\\n require(index <= 255, \\\"Index out of bounds\\\");\\r\\n return claimedBitMap | (1 << index % 256);\\r\\n }\\r\\n}\\r\\n\",\"keccak256\":\"0x50079aae972160054e34f9acbad1724dc3111491c8b712b6ab1eb49ff4d9869d\",\"license\":\"GPL-3.0-only\"},\"contracts/SpokePool.sol\":{\"content\":\"// SPDX-License-Identifier: GPL-3.0-only\\r\\npragma solidity ^0.8.0;\\r\\n\\r\\nimport \\\"./MerkleLib.sol\\\";\\r\\nimport \\\"./interfaces/WETH9.sol\\\";\\r\\n\\r\\nimport \\\"@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol\\\";\\r\\nimport \\\"@openzeppelin/contracts/token/ERC20/IERC20.sol\\\";\\r\\nimport \\\"@openzeppelin/contracts/utils/Address.sol\\\";\\r\\n\\r\\nimport \\\"@openzeppelin/contracts/utils/cryptography/SignatureChecker.sol\\\";\\r\\nimport \\\"@openzeppelin/contracts/utils/cryptography/ECDSA.sol\\\";\\r\\n\\r\\nimport \\\"@uma/core/contracts/common/implementation/Testable.sol\\\";\\r\\nimport \\\"@uma/core/contracts/common/implementation/Lockable.sol\\\";\\r\\nimport \\\"@uma/core/contracts/common/implementation/MultiCaller.sol\\\";\\r\\nimport \\\"./MerkleLib.sol\\\";\\r\\nimport \\\"./SpokePoolInterface.sol\\\";\\r\\n\\r\\n/**\\r\\n * @title SpokePool\\r\\n * @notice Contract deployed on source and destination chains enabling depositors to transfer assets from source to\\r\\n * destination. Deposit orders are fulfilled by off-chain relayers who also interact with this contract. Deposited\\r\\n * tokens are locked on the source chain and relayers send the recipient the desired token currency and amount\\r\\n * on the destination chain. Locked source chain tokens are later sent over the canonical token bridge to L1.\\r\\n * @dev This contract is designed to be deployed to L2's, not mainnet.\\r\\n */\\r\\nabstract contract SpokePool is SpokePoolInterface, Testable, Lockable, MultiCaller {\\r\\n using SafeERC20 for IERC20;\\r\\n using Address for address;\\r\\n\\r\\n // Address of the L1 contract that acts as the owner of this SpokePool.\\r\\n address public crossDomainAdmin;\\r\\n\\r\\n // Address of the L1 contract that will send tokens to and receive tokens from this contract.\\r\\n address public hubPool;\\r\\n\\r\\n // Address of WETH contract for this network. If an origin token matches this, then the caller can optionally\\r\\n // instruct this contract to wrap ETH when depositing.\\r\\n WETH9 public weth;\\r\\n\\r\\n // Timestamp when contract was constructed. Relays cannot have a quote time before this.\\r\\n uint32 public deploymentTime;\\r\\n\\r\\n // Any deposit quote times greater than or less than this value to the current contract time is blocked. Forces\\r\\n // caller to use an up to date realized fee. Defaults to 10 minutes.\\r\\n uint32 public depositQuoteTimeBuffer = 600;\\r\\n\\r\\n // Use count of deposits as unique deposit identifier.\\r\\n uint32 public numberOfDeposits;\\r\\n\\r\\n // Origin token to destination token routings can be turned on or off.\\r\\n mapping(address => mapping(uint256 => bool)) public enabledDepositRoutes;\\r\\n\\r\\n struct RootBundle {\\r\\n // Merkle root of slow relays that were not fully filled and whose recipient is still owed funds from the LP pool.\\r\\n bytes32 slowRelayFulfillmentRoot;\\r\\n // Merkle root of relayer refunds.\\r\\n bytes32 relayerRefundRoot;\\r\\n // This is a 2D bitmap tracking which leafs in the relayer refund root have been claimed, with max size of\\r\\n // 256x256 leaves per root.\\r\\n mapping(uint256 => uint256) claimedBitmap;\\r\\n }\\r\\n RootBundle[] public rootBundles;\\r\\n\\r\\n // Each relay is associated with the hash of parameters that uniquely identify the original deposit and a relay\\r\\n // attempt for that deposit. The relay itself is just represented as the amount filled so far. The total amount to\\r\\n // relay, the fees, and the agents are all parameters included in the hash key.\\r\\n mapping(bytes32 => uint256) public relayFills;\\r\\n\\r\\n /****************************************\\r\\n * EVENTS *\\r\\n ****************************************/\\r\\n event SetXDomainAdmin(address indexed newAdmin);\\r\\n event SetHubPool(address indexed newHubPool);\\r\\n event EnabledDepositRoute(address indexed originToken, uint256 indexed destinationChainId, bool enabled);\\r\\n event SetDepositQuoteTimeBuffer(uint32 newBuffer);\\r\\n event FundsDeposited(\\r\\n uint256 amount,\\r\\n uint256 destinationChainId,\\r\\n uint64 relayerFeePct,\\r\\n uint32 indexed depositId,\\r\\n uint32 quoteTimestamp,\\r\\n address indexed originToken,\\r\\n address recipient,\\r\\n address indexed depositor\\r\\n );\\r\\n event FilledRelay(\\r\\n bytes32 indexed relayHash,\\r\\n uint256 totalRelayAmount,\\r\\n uint256 totalFilledAmount,\\r\\n uint256 fillAmount,\\r\\n uint256 indexed repaymentChain,\\r\\n uint256 originChainId,\\r\\n uint64 relayerFeePct,\\r\\n uint64 realizedLpFeePct,\\r\\n uint32 depositId,\\r\\n address destinationToken,\\r\\n address indexed relayer,\\r\\n address depositor,\\r\\n address recipient\\r\\n );\\r\\n event ExecutedSlowRelayFulfillmentRoot(\\r\\n bytes32 indexed relayHash,\\r\\n uint256 totalRelayAmount,\\r\\n uint256 totalFilledAmount,\\r\\n uint256 fillAmount,\\r\\n uint256 originChainId,\\r\\n uint64 relayerFeePct,\\r\\n uint64 realizedLpFeePct,\\r\\n uint32 depositId,\\r\\n address destinationToken,\\r\\n address indexed caller,\\r\\n address depositor,\\r\\n address recipient\\r\\n );\\r\\n event RelayedRootBundle(uint32 indexed rootBundleId, bytes32 relayerRefundRoot, bytes32 slowRelayFulfillmentRoot);\\r\\n event ExecutedRelayerRefundRoot(\\r\\n uint256 amountToReturn,\\r\\n uint256 chainId,\\r\\n uint256[] refundAmounts,\\r\\n uint32 indexed rootBundleId,\\r\\n uint32 indexed leafId,\\r\\n address l2TokenAddress,\\r\\n address[] refundAddresses,\\r\\n address indexed caller\\r\\n );\\r\\n event TokensBridged(\\r\\n uint256 amountToReturn,\\r\\n uint256 indexed chainId,\\r\\n uint32 indexed leafId,\\r\\n address indexed l2TokenAddress,\\r\\n address caller\\r\\n );\\r\\n\\r\\n constructor(\\r\\n address _crossDomainAdmin,\\r\\n address _hubPool,\\r\\n address _wethAddress,\\r\\n address timerAddress\\r\\n ) Testable(timerAddress) {\\r\\n _setCrossDomainAdmin(_crossDomainAdmin);\\r\\n _setHubPool(_hubPool);\\r\\n deploymentTime = uint32(getCurrentTime());\\r\\n weth = WETH9(_wethAddress);\\r\\n }\\r\\n\\r\\n /****************************************\\r\\n * MODIFIERS *\\r\\n ****************************************/\\r\\n\\r\\n modifier onlyEnabledRoute(address originToken, uint256 destinationId) {\\r\\n require(enabledDepositRoutes[originToken][destinationId], \\\"Disabled route\\\");\\r\\n _;\\r\\n }\\r\\n\\r\\n /**************************************\\r\\n * ADMIN FUNCTIONS *\\r\\n **************************************/\\r\\n\\r\\n function _setCrossDomainAdmin(address newCrossDomainAdmin) internal {\\r\\n require(newCrossDomainAdmin != address(0), \\\"Bad bridge router address\\\");\\r\\n crossDomainAdmin = newCrossDomainAdmin;\\r\\n emit SetXDomainAdmin(crossDomainAdmin);\\r\\n }\\r\\n\\r\\n function _setHubPool(address newHubPool) internal {\\r\\n require(newHubPool != address(0), \\\"Bad hub pool address\\\");\\r\\n hubPool = newHubPool;\\r\\n emit SetHubPool(hubPool);\\r\\n }\\r\\n\\r\\n function _setEnableRoute(\\r\\n address originToken,\\r\\n uint256 destinationChainId,\\r\\n bool enabled\\r\\n ) internal {\\r\\n enabledDepositRoutes[originToken][destinationChainId] = enabled;\\r\\n emit EnabledDepositRoute(originToken, destinationChainId, enabled);\\r\\n }\\r\\n\\r\\n function _setDepositQuoteTimeBuffer(uint32 _depositQuoteTimeBuffer) internal {\\r\\n depositQuoteTimeBuffer = _depositQuoteTimeBuffer;\\r\\n emit SetDepositQuoteTimeBuffer(_depositQuoteTimeBuffer);\\r\\n }\\r\\n\\r\\n /**************************************\\r\\n * DEPOSITOR FUNCTIONS *\\r\\n **************************************/\\r\\n\\r\\n /**\\r\\n * @notice Called by user to bridge funds from origin to destination chain.\\r\\n * @dev The caller must first approve this contract to spend `amount` of `originToken`.\\r\\n */\\r\\n function deposit(\\r\\n address recipient,\\r\\n address originToken,\\r\\n uint256 amount,\\r\\n uint256 destinationChainId,\\r\\n uint64 relayerFeePct,\\r\\n uint32 quoteTimestamp\\r\\n ) public payable onlyEnabledRoute(originToken, destinationChainId) nonReentrant {\\r\\n // We limit the relay fees to prevent the user spending all their funds on fees.\\r\\n require(relayerFeePct <= 0.5e18, \\\"invalid relayer fee\\\");\\r\\n // Note We assume that L2 timing cannot be compared accurately and consistently to L1 timing. Therefore,\\r\\n // `block.timestamp` is different from the L1 EVM's. Therefore, the quoteTimestamp must be within a configurable\\r\\n // buffer to allow for this variance.\\r\\n // Note also that `quoteTimestamp` cannot be less than the buffer otherwise the following arithmetic can result\\r\\n // in underflow. This isn't a problem as the deposit will revert, but the error might be unexpected for clients.\\r\\n require(\\r\\n getCurrentTime() >= quoteTimestamp - depositQuoteTimeBuffer &&\\r\\n getCurrentTime() <= quoteTimestamp + depositQuoteTimeBuffer,\\r\\n \\\"invalid quote time\\\"\\r\\n );\\r\\n // If the address of the origin token is a WETH contract and there is a msg.value with the transaction\\r\\n // then the user is sending ETH. In this case, the ETH should be deposited to WETH.\\r\\n if (originToken == address(weth) && msg.value > 0) {\\r\\n require(msg.value == amount, \\\"msg.value must match amount\\\");\\r\\n weth.deposit{ value: msg.value }();\\r\\n } else {\\r\\n // Else, it is a normal ERC20. In this case pull the token from the users wallet as per normal.\\r\\n // Note: this includes the case where the L2 user has WETH (already wrapped ETH) and wants to bridge them. In\\r\\n // this case the msg.value will be set to 0, indicating a \\\"normal\\\" ERC20 bridging action.\\r\\n IERC20(originToken).safeTransferFrom(msg.sender, address(this), amount);\\r\\n }\\r\\n\\r\\n emit FundsDeposited(\\r\\n amount,\\r\\n destinationChainId,\\r\\n relayerFeePct,\\r\\n numberOfDeposits,\\r\\n quoteTimestamp,\\r\\n originToken,\\r\\n recipient,\\r\\n msg.sender\\r\\n );\\r\\n\\r\\n numberOfDeposits += 1;\\r\\n }\\r\\n\\r\\n /**************************************\\r\\n * RELAYER FUNCTIONS *\\r\\n **************************************/\\r\\n\\r\\n function fillRelay(\\r\\n address depositor,\\r\\n address recipient,\\r\\n address destinationToken,\\r\\n uint256 totalRelayAmount,\\r\\n uint256 maxTokensToSend,\\r\\n uint256 repaymentChain,\\r\\n uint256 originChainId,\\r\\n uint64 realizedLpFeePct,\\r\\n uint64 relayerFeePct,\\r\\n uint32 depositId\\r\\n ) public nonReentrant {\\r\\n // Each relay attempt is mapped to the hash of data uniquely identifying it, which includes the deposit data\\r\\n // such as the origin chain ID and the deposit ID, and the data in a relay attempt such as who the recipient\\r\\n // is, which chain and currency the recipient wants to receive funds on, and the relay fees.\\r\\n SpokePoolInterface.RelayData memory relayData = SpokePoolInterface.RelayData({\\r\\n depositor: depositor,\\r\\n recipient: recipient,\\r\\n destinationToken: destinationToken,\\r\\n relayAmount: totalRelayAmount,\\r\\n realizedLpFeePct: realizedLpFeePct,\\r\\n relayerFeePct: relayerFeePct,\\r\\n depositId: depositId,\\r\\n originChainId: originChainId\\r\\n });\\r\\n bytes32 relayHash = _getRelayHash(relayData);\\r\\n\\r\\n uint256 fillAmountPreFees = _fillRelay(relayHash, relayData, maxTokensToSend, relayerFeePct, false);\\r\\n\\r\\n _emitFillRelay(relayHash, fillAmountPreFees, repaymentChain, relayerFeePct, relayData);\\r\\n }\\r\\n\\r\\n function fillRelayWithUpdatedFee(\\r\\n address depositor,\\r\\n address recipient,\\r\\n address destinationToken,\\r\\n uint256 totalRelayAmount,\\r\\n uint256 maxTokensToSend,\\r\\n uint256 repaymentChain,\\r\\n uint256 originChainId,\\r\\n uint64 realizedLpFeePct,\\r\\n uint64 relayerFeePct,\\r\\n uint64 newRelayerFeePct,\\r\\n uint32 depositId,\\r\\n bytes memory depositorSignature\\r\\n ) public nonReentrant {\\r\\n // Grouping the signature validation logic into brackets to address stack too deep error.\\r\\n {\\r\\n // Depositor should have signed a hash of the relayer fee % to update to and information uniquely identifying\\r\\n // the deposit to relay. This ensures that this signature cannot be re-used for other deposits. The version\\r\\n // string is included as a precaution in case this contract is upgraded.\\r\\n // Note: we use encode instead of encodePacked because it is more secure, more in the \\\"warning\\\" section\\r\\n // here: https://docs.soliditylang.org/en/v0.8.11/abi-spec.html#non-standard-packed-mode\\r\\n bytes32 expectedDepositorMessageHash = keccak256(\\r\\n abi.encode(\\\"ACROSS-V2-FEE-1.0\\\", newRelayerFeePct, depositId, originChainId)\\r\\n );\\r\\n\\r\\n // Check the hash corresponding to the https://eth.wiki/json-rpc/API#eth_sign[`eth_sign`]\\r\\n // JSON-RPC method as part of EIP-191. We use OZ's signature checker library with adds support for\\r\\n // EIP-1271 which can verify messages signed by smart contract wallets like Argent and Gnosis safes.\\r\\n // If the depositor signed a message with a different updated fee (or any other param included in the\\r\\n // above keccak156 hash), then this will revert.\\r\\n bytes32 ethSignedMessageHash = ECDSA.toEthSignedMessageHash(expectedDepositorMessageHash);\\r\\n\\r\\n _verifyDepositorUpdateFeeMessage(depositor, ethSignedMessageHash, depositorSignature);\\r\\n }\\r\\n\\r\\n // Now follow the default `fillRelay` flow with the updated fee and the original relay hash.\\r\\n RelayData memory relayData = RelayData({\\r\\n depositor: depositor,\\r\\n recipient: recipient,\\r\\n destinationToken: destinationToken,\\r\\n relayAmount: totalRelayAmount,\\r\\n realizedLpFeePct: realizedLpFeePct,\\r\\n relayerFeePct: relayerFeePct,\\r\\n depositId: depositId,\\r\\n originChainId: originChainId\\r\\n });\\r\\n bytes32 relayHash = _getRelayHash(relayData);\\r\\n uint256 fillAmountPreFees = _fillRelay(relayHash, relayData, maxTokensToSend, newRelayerFeePct, false);\\r\\n\\r\\n _emitFillRelay(relayHash, fillAmountPreFees, repaymentChain, newRelayerFeePct, relayData);\\r\\n }\\r\\n\\r\\n /**************************************\\r\\n * DATA WORKER FUNCTIONS *\\r\\n **************************************/\\r\\n function executeSlowRelayFulfillmentRoot(\\r\\n address depositor,\\r\\n address recipient,\\r\\n address destinationToken,\\r\\n uint256 totalRelayAmount,\\r\\n uint256 originChainId,\\r\\n uint64 realizedLpFeePct,\\r\\n uint64 relayerFeePct,\\r\\n uint32 depositId,\\r\\n uint32 rootBundleId,\\r\\n bytes32[] memory proof\\r\\n ) public nonReentrant {\\r\\n RelayData memory relayData = RelayData({\\r\\n depositor: depositor,\\r\\n recipient: recipient,\\r\\n destinationToken: destinationToken,\\r\\n relayAmount: totalRelayAmount,\\r\\n originChainId: originChainId,\\r\\n realizedLpFeePct: realizedLpFeePct,\\r\\n relayerFeePct: relayerFeePct,\\r\\n depositId: depositId\\r\\n });\\r\\n\\r\\n require(\\r\\n MerkleLib.verifySlowRelayFulfillment(rootBundles[rootBundleId].slowRelayFulfillmentRoot, relayData, proof),\\r\\n \\\"Invalid proof\\\"\\r\\n );\\r\\n\\r\\n bytes32 relayHash = _getRelayHash(relayData);\\r\\n\\r\\n // Wrap any ETH owned by this contract so we can send expected L2 token to recipient. This is neccessary because\\r\\n // some SpokePools will receive ETH from the canonical token bridge instead of WETH so this contract\\r\\n // might have built up an ETH balance.\\r\\n if (address(this).balance > 0) weth.deposit{ value: address(this).balance }();\\r\\n\\r\\n // Note: use relayAmount as the max amount to send, so the relay is always completely filled by the contract's\\r\\n // funds in all cases.\\r\\n uint256 fillAmountPreFees = _fillRelay(relayHash, relayData, relayData.relayAmount, relayerFeePct, true);\\r\\n\\r\\n _emitExecutedSlowRelayFulfillmentRoot(relayHash, fillAmountPreFees, relayData);\\r\\n }\\r\\n\\r\\n function executeRelayerRefundRoot(\\r\\n uint32 rootBundleId,\\r\\n SpokePoolInterface.RelayerRefundLeaf memory relayerRefundLeaf,\\r\\n bytes32[] memory proof\\r\\n ) public nonReentrant {\\r\\n // Check integrity of leaf structure:\\r\\n require(relayerRefundLeaf.chainId == chainId(), \\\"Invalid chainId\\\");\\r\\n require(relayerRefundLeaf.refundAddresses.length == relayerRefundLeaf.refundAmounts.length, \\\"invalid leaf\\\");\\r\\n\\r\\n RootBundle storage rootBundle = rootBundles[rootBundleId];\\r\\n\\r\\n // Check that `inclusionProof` proves that `relayerRefundLeaf` is contained within the relayer refund root.\\r\\n // Note: This should revert if the `relayerRefundRoot` is uninitialized.\\r\\n require(MerkleLib.verifyRelayerRefund(rootBundle.relayerRefundRoot, relayerRefundLeaf, proof), \\\"Bad Proof\\\");\\r\\n\\r\\n // Verify the leafId in the leaf has not yet been claimed.\\r\\n require(!MerkleLib.isClaimed(rootBundle.claimedBitmap, relayerRefundLeaf.leafId), \\\"Already claimed\\\");\\r\\n\\r\\n // Set leaf as claimed in bitmap.\\r\\n MerkleLib.setClaimed(rootBundle.claimedBitmap, relayerRefundLeaf.leafId);\\r\\n\\r\\n // Wrap any ETH owned by this contract so we can send expected L2 token to recipient. This is neccessary because\\r\\n // some SpokePools will receive ETH from the canonical token bridge instead of WETH.\\r\\n if (address(this).balance > 0) weth.deposit{ value: address(this).balance }();\\r\\n\\r\\n // Send each relayer refund address the associated refundAmount for the L2 token address.\\r\\n // Note: Even if the L2 token is not enabled on this spoke pool, we should still refund relayers.\\r\\n for (uint32 i = 0; i < relayerRefundLeaf.refundAmounts.length; i++) {\\r\\n uint256 amount = relayerRefundLeaf.refundAmounts[i];\\r\\n if (amount > 0)\\r\\n IERC20(relayerRefundLeaf.l2TokenAddress).safeTransfer(relayerRefundLeaf.refundAddresses[i], amount);\\r\\n }\\r\\n\\r\\n // If leaf's `amountToReturn` is positive, then send L2 --> L1 message to bridge tokens back via\\r\\n // chain-specific bridging method.\\r\\n if (relayerRefundLeaf.amountToReturn > 0) {\\r\\n _bridgeTokensToHubPool(relayerRefundLeaf);\\r\\n\\r\\n emit TokensBridged(\\r\\n relayerRefundLeaf.amountToReturn,\\r\\n relayerRefundLeaf.chainId,\\r\\n relayerRefundLeaf.leafId,\\r\\n relayerRefundLeaf.l2TokenAddress,\\r\\n msg.sender\\r\\n );\\r\\n }\\r\\n\\r\\n emit ExecutedRelayerRefundRoot(\\r\\n relayerRefundLeaf.amountToReturn,\\r\\n relayerRefundLeaf.chainId,\\r\\n relayerRefundLeaf.refundAmounts,\\r\\n rootBundleId,\\r\\n relayerRefundLeaf.leafId,\\r\\n relayerRefundLeaf.l2TokenAddress,\\r\\n relayerRefundLeaf.refundAddresses,\\r\\n msg.sender\\r\\n );\\r\\n }\\r\\n\\r\\n /**************************************\\r\\n * VIEW FUNCTIONS *\\r\\n **************************************/\\r\\n\\r\\n // Some L2s like ZKSync don't support the CHAIN_ID opcode so we allow the caller to manually set this.\\r\\n function chainId() public view virtual returns (uint256) {\\r\\n return block.chainid;\\r\\n }\\r\\n\\r\\n /**************************************\\r\\n * INTERNAL FUNCTIONS *\\r\\n **************************************/\\r\\n\\r\\n function _bridgeTokensToHubPool(SpokePoolInterface.RelayerRefundLeaf memory relayerRefundLeaf) internal virtual;\\r\\n\\r\\n // Allow L2 to implement chain specific recovering of signers from signatures because some L2s might not support\\r\\n // ecrecover, such as those with account abstraction like ZKSync.\\r\\n function _verifyDepositorUpdateFeeMessage(\\r\\n address depositor,\\r\\n bytes32 ethSignedMessageHash,\\r\\n bytes memory depositorSignature\\r\\n ) internal view virtual {\\r\\n // Note: no need to worry about reentrancy from contract deployed at `depositor` address since\\r\\n // `SignatureChecker.isValidSignatureNow` is a non state-modifying STATICCALL:\\r\\n // - https://github.com/OpenZeppelin/openzeppelin-contracts/blob/63b466901fb015538913f811c5112a2775042177/contracts/utils/cryptography/SignatureChecker.sol#L35\\r\\n // - https://github.com/ethereum/EIPs/pull/214\\r\\n require(\\r\\n SignatureChecker.isValidSignatureNow(depositor, ethSignedMessageHash, depositorSignature),\\r\\n \\\"invalid signature\\\"\\r\\n );\\r\\n }\\r\\n\\r\\n function _computeAmountPreFees(uint256 amount, uint64 feesPct) private pure returns (uint256) {\\r\\n return (1e18 * amount) / (1e18 - feesPct);\\r\\n }\\r\\n\\r\\n function _computeAmountPostFees(uint256 amount, uint64 feesPct) private pure returns (uint256) {\\r\\n return (amount * (1e18 - feesPct)) / 1e18;\\r\\n }\\r\\n\\r\\n // Should we make this public for the relayer's convenience?\\r\\n function _getRelayHash(SpokePoolInterface.RelayData memory relayData) private pure returns (bytes32) {\\r\\n return keccak256(abi.encode(relayData));\\r\\n }\\r\\n\\r\\n // Unwraps ETH and does a transfer to a recipient address. If the recipient is a smart contract then sends WETH.\\r\\n function _unwrapWETHTo(address payable to, uint256 amount) internal {\\r\\n if (address(to).isContract()) {\\r\\n IERC20(address(weth)).safeTransfer(to, amount);\\r\\n } else {\\r\\n weth.withdraw(amount);\\r\\n to.transfer(amount);\\r\\n }\\r\\n }\\r\\n\\r\\n // This internal method should be called by an external \\\"relayRootBundle\\\" function that validates the\\r\\n // cross domain sender is the HubPool. This validation step differs for each L2, which is why the implementation\\r\\n // specifics are left to the implementor of this abstract contract.\\r\\n // Once this method is executed and a distribution root is stored in this contract, then `distributeRootBundle`\\r\\n // can be called to execute each leaf in the root.\\r\\n function _relayRootBundle(bytes32 relayerRefundRoot, bytes32 slowRelayFulfillmentRoot) internal {\\r\\n uint32 rootBundleId = uint32(rootBundles.length);\\r\\n RootBundle storage rootBundle = rootBundles.push();\\r\\n rootBundle.relayerRefundRoot = relayerRefundRoot;\\r\\n rootBundle.slowRelayFulfillmentRoot = slowRelayFulfillmentRoot;\\r\\n emit RelayedRootBundle(rootBundleId, relayerRefundRoot, slowRelayFulfillmentRoot);\\r\\n }\\r\\n\\r\\n function _fillRelay(\\r\\n bytes32 relayHash,\\r\\n RelayData memory relayData,\\r\\n uint256 maxTokensToSend,\\r\\n uint64 updatableRelayerFeePct,\\r\\n bool isSlowRelay\\r\\n ) internal returns (uint256 fillAmountPreFees) {\\r\\n // We limit the relay fees to prevent the user spending all their funds on fees. Note that 0.5e18 (i.e. 50%)\\r\\n // fees are just magic numbers. The important point is to prevent the total fee from being 100%, otherwise\\r\\n // computing the amount pre fees runs into divide-by-0 issues.\\r\\n require(updatableRelayerFeePct < 0.5e18 && relayData.realizedLpFeePct < 0.5e18, \\\"invalid fees\\\");\\r\\n\\r\\n // Check that the relay has not already been completely filled. Note that the `relays` mapping will point to\\r\\n // the amount filled so far for a particular `relayHash`, so this will start at 0 and increment with each fill.\\r\\n require(relayFills[relayHash] < relayData.relayAmount, \\\"relay filled\\\");\\r\\n\\r\\n // Stores the equivalent amount to be sent by the relayer before fees have been taken out.\\r\\n fillAmountPreFees = 0;\\r\\n\\r\\n // Adding brackets \\\"stack too deep\\\" solidity error.\\r\\n if (maxTokensToSend > 0) {\\r\\n fillAmountPreFees = _computeAmountPreFees(\\r\\n maxTokensToSend,\\r\\n (relayData.realizedLpFeePct + updatableRelayerFeePct)\\r\\n );\\r\\n // If user's specified max amount to send is greater than the amount of the relay remaining pre-fees,\\r\\n // we'll pull exactly enough tokens to complete the relay.\\r\\n uint256 amountToSend = maxTokensToSend;\\r\\n if (relayData.relayAmount - relayFills[relayHash] < fillAmountPreFees) {\\r\\n fillAmountPreFees = relayData.relayAmount - relayFills[relayHash];\\r\\n amountToSend = _computeAmountPostFees(\\r\\n fillAmountPreFees,\\r\\n relayData.realizedLpFeePct + updatableRelayerFeePct\\r\\n );\\r\\n }\\r\\n relayFills[relayHash] += fillAmountPreFees;\\r\\n // If relay token is weth then unwrap and send eth.\\r\\n if (relayData.destinationToken == address(weth)) {\\r\\n // Note: WETH is already in the contract in the slow relay case.\\r\\n if (!isSlowRelay)\\r\\n IERC20(relayData.destinationToken).safeTransferFrom(msg.sender, address(this), amountToSend);\\r\\n _unwrapWETHTo(payable(relayData.recipient), amountToSend);\\r\\n // Else, this is a normal ERC20 token. Send to recipient.\\r\\n } else {\\r\\n // Note: send token directly from the contract to the user in the slow relay case.\\r\\n if (!isSlowRelay)\\r\\n IERC20(relayData.destinationToken).safeTransferFrom(msg.sender, relayData.recipient, amountToSend);\\r\\n else IERC20(relayData.destinationToken).safeTransfer(relayData.recipient, amountToSend);\\r\\n }\\r\\n }\\r\\n }\\r\\n\\r\\n function _emitFillRelay(\\r\\n bytes32 relayHash,\\r\\n uint256 fillAmount,\\r\\n uint256 repaymentChain,\\r\\n uint64 relayerFeePct,\\r\\n RelayData memory relayData\\r\\n ) internal {\\r\\n emit FilledRelay(\\r\\n relayHash,\\r\\n relayData.relayAmount,\\r\\n relayFills[relayHash],\\r\\n fillAmount,\\r\\n repaymentChain,\\r\\n relayData.originChainId,\\r\\n relayerFeePct,\\r\\n relayData.realizedLpFeePct,\\r\\n relayData.depositId,\\r\\n relayData.destinationToken,\\r\\n msg.sender,\\r\\n relayData.depositor,\\r\\n relayData.recipient\\r\\n );\\r\\n }\\r\\n\\r\\n function _emitExecutedSlowRelayFulfillmentRoot(\\r\\n bytes32 relayHash,\\r\\n uint256 fillAmount,\\r\\n RelayData memory relayData\\r\\n ) internal {\\r\\n emit ExecutedSlowRelayFulfillmentRoot(\\r\\n relayHash,\\r\\n relayData.relayAmount,\\r\\n relayFills[relayHash],\\r\\n fillAmount,\\r\\n relayData.originChainId,\\r\\n relayData.relayerFeePct,\\r\\n relayData.realizedLpFeePct,\\r\\n relayData.depositId,\\r\\n relayData.destinationToken,\\r\\n msg.sender,\\r\\n relayData.depositor,\\r\\n relayData.recipient\\r\\n );\\r\\n }\\r\\n\\r\\n // Added to enable the this contract to receive ETH. Used when unwrapping Weth.\\r\\n receive() external payable {}\\r\\n}\\r\\n\",\"keccak256\":\"0x43a82c41c699f74aafaff2f7a8ad3e32e06ffcd78c38e179c503aa4eaa40d53a\",\"license\":\"GPL-3.0-only\"},\"contracts/SpokePoolInterface.sol\":{\"content\":\"//SPDX-License-Identifier: Unlicense\\r\\npragma solidity ^0.8.0;\\r\\n\\r\\ninterface SpokePoolInterface {\\r\\n // This leaf is meant to be decoded in the SpokePool in order to pay out individual relayers for this bundle.\\r\\n struct RelayerRefundLeaf {\\r\\n // This is the amount to return to the HubPool. This occurs when there is a PoolRebalanceLeaf netSendAmount that is\\r\\n // negative. This is just that value inverted.\\r\\n uint256 amountToReturn;\\r\\n // Used to verify that this is being decoded on the correct chainId.\\r\\n uint256 chainId;\\r\\n // This array designates how much each of those addresses should be refunded.\\r\\n uint256[] refundAmounts;\\r\\n // Used as the index in the bitmap to track whether this leaf has been executed or not.\\r\\n uint32 leafId;\\r\\n // The associated L2TokenAddress that these claims apply to.\\r\\n address l2TokenAddress;\\r\\n // These two arrays must be the same length and are parallel arrays. They should be order by refundAddresses.\\r\\n // This array designates each address that must be refunded.\\r\\n address[] refundAddresses;\\r\\n }\\r\\n\\r\\n // This struct represents the data to fully-specify a relay. If any portion of this data differs, the relay is\\r\\n // considered to be completely distinct. Only one relay for a particular depositId, chainId pair should be\\r\\n // considered valid and repaid.\\r\\n struct RelayData {\\r\\n // The address that made the deposit on the origin chain.\\r\\n address depositor;\\r\\n // The recipient address on the destination chain.\\r\\n address recipient;\\r\\n // The corresponding token address on the destination chain.\\r\\n address destinationToken;\\r\\n // The total relay amount before fees are taken out.\\r\\n uint256 relayAmount;\\r\\n // Origin chain id.\\r\\n uint256 originChainId;\\r\\n // The LP Fee percentage computed by the relayer based on the deposit's quote timestamp\\r\\n // and the HubPool's utilization.\\r\\n uint64 realizedLpFeePct;\\r\\n // The relayer fee percentage specified in the deposit.\\r\\n uint64 relayerFeePct;\\r\\n // The id uniquely identifying this deposit on the origin chain.\\r\\n uint32 depositId;\\r\\n }\\r\\n\\r\\n function setCrossDomainAdmin(address newCrossDomainAdmin) external;\\r\\n\\r\\n function setHubPool(address newHubPool) external;\\r\\n\\r\\n function setEnableRoute(\\r\\n address originToken,\\r\\n uint256 destinationChainId,\\r\\n bool enable\\r\\n ) external;\\r\\n\\r\\n function setDepositQuoteTimeBuffer(uint32 buffer) external;\\r\\n\\r\\n function relayRootBundle(bytes32 relayerRefundRoot, bytes32 slowRelayRoot) external;\\r\\n}\\r\\n\",\"keccak256\":\"0xa420a9b5431195ecead66166fe4b316a0a1e86ad26514cdc6ace529e8941cf4d\",\"license\":\"Unlicense\"},\"contracts/interfaces/AdapterInterface.sol\":{\"content\":\"// SPDX-License-Identifier: AGPL-3.0-only\\npragma solidity ^0.8.0;\\n\\n/**\\n * @notice Sends cross chain messages and tokens to contracts on a specific L2 network.\\n */\\n\\ninterface AdapterInterface {\\n event HubPoolChanged(address newHubPool);\\n\\n event MessageRelayed(address target, bytes message);\\n\\n event TokensRelayed(address l1Token, address l2Token, uint256 amount, address to);\\n\\n function relayMessage(address target, bytes memory message) external payable;\\n\\n function relayTokens(\\n address l1Token,\\n address l2Token,\\n uint256 amount,\\n address to\\n ) external payable;\\n}\\n\",\"keccak256\":\"0x60e1ed2205f90655fe4152a90709be15bc9550fb3faeaf9835fee22c095bab11\",\"license\":\"AGPL-3.0-only\"},\"contracts/interfaces/WETH9.sol\":{\"content\":\"// SPDX-License-Identifier: GPL-3.0-only\\r\\npragma solidity ^0.8.0;\\r\\n\\r\\ninterface WETH9 {\\r\\n function withdraw(uint256 wad) external;\\r\\n\\r\\n function deposit() external payable;\\r\\n\\r\\n function balanceOf(address guy) external view returns (uint256 wad);\\r\\n\\r\\n function transfer(address guy, uint256 wad) external;\\r\\n}\\r\\n\",\"keccak256\":\"0x08755a7e4fc4ed75895c9b803f19552c4f0a455947dca04d86db4355114253b3\",\"license\":\"GPL-3.0-only\"}},\"version\":1}", - "bytecode": "0x60806040526003805463ffffffff60c01b1916604b60c31b1790553480156200002757600080fd5b5060405162004681380380620046818339810160408190526200004a916200033a565b600080546001600160a81b0319166001600160a01b03831617600160a01b179055338383836200007a84620000ee565b620000858362000194565b6200008f62000236565b600380546001600160a01b039094166001600160a01b031963ffffffff93909316600160a01b02929092166001600160c01b0319909416939093171790915550620000e59150620000df90503390565b620002cb565b5050506200039e565b6001600160a01b0381166200014a5760405162461bcd60e51b815260206004820152601960248201527f4261642062726964676520726f7574657220616464726573730000000000000060448201526064015b60405180910390fd5b600180546001600160a01b0319166001600160a01b0383169081179091556040517fa9e8c42c9e7fca7f62755189a16b2f5314d43d8fb24e91ba54e6d65f9314e84990600090a250565b6001600160a01b038116620001ec5760405162461bcd60e51b815260206004820152601460248201527f4261642068756220706f6f6c2061646472657373000000000000000000000000604482015260640162000141565b600280546001600160a01b0319166001600160a01b0383169081179091556040517f1f17a88f67b0f49060a34bec1a4723a563620e6aa265eb640b5046dcee0759a090600090a250565b600080546001600160a01b031615620002c65760008054906101000a90046001600160a01b03166001600160a01b03166329cb924d6040518163ffffffff1660e01b8152600401602060405180830381865afa1580156200029b573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190620002c1919062000384565b905090565b504290565b600780546001600160a01b038381166001600160a01b0319831681179093556040519116919082907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e090600090a35050565b80516001600160a01b03811681146200033557600080fd5b919050565b6000806000606084860312156200035057600080fd5b6200035b846200031d565b92506200036b602085016200031d565b91506200037b604085016200031d565b90509250925092565b6000602082840312156200039757600080fd5b5051919050565b6142d380620003ae6000396000f3fe6080604052600436106101b05760003560e01c806389a153cc116100ec578063e19044021161008a578063f06850f611610064578063f06850f614610585578063f2fde38b146105b2578063fe45399c146105d2578063ffc351a3146105f257600080fd5b8063e1904402146104ee578063ecda10f51461051b578063ee2a53f81461055057600080fd5b8063a1244c67116100c6578063a1244c6714610451578063ac9650d81461048e578063c894c0ca146104ae578063de7eba78146104ce57600080fd5b806389a153cc146103f35780638da5cb5b146104135780639a8a05921461043e57600080fd5b80633fc8cef3116101595780635249fef1116101335780635249fef1146103185780635285e0581461036357806357f6dcb814610390578063715018a6146103de57600080fd5b80633fc8cef3146102b857806349228978146102e5578063493a4f84146102f857600080fd5b8063272751c71161018a578063272751c7146102555780632752042e1461027557806329cb924d1461029557600080fd5b80631c39c38d146101bc5780631dfb2d021461021357806322f8e5661461023557600080fd5b366101b757005b600080fd5b3480156101c857600080fd5b506000546101e99073ffffffffffffffffffffffffffffffffffffffff1681565b60405173ffffffffffffffffffffffffffffffffffffffff90911681526020015b60405180910390f35b34801561021f57600080fd5b5061023361022e366004613473565b610612565b005b34801561024157600080fd5b5061023361025036600461348e565b61071d565b34801561026157600080fd5b506102336102703660046134b5565b6107c6565b34801561028157600080fd5b50610233610290366004613509565b6108d0565b3480156102a157600080fd5b506102aa61098f565b60405190815260200161020a565b3480156102c457600080fd5b506003546101e99073ffffffffffffffffffffffffffffffffffffffff1681565b6102336102f336600461353c565b610a47565b34801561030457600080fd5b506102336103133660046135a2565b610ef3565b34801561032457600080fd5b506103536103333660046135c4565b600460209081526000928352604080842090915290825290205460ff1681565b604051901515815260200161020a565b34801561036f57600080fd5b506001546101e99073ffffffffffffffffffffffffffffffffffffffff1681565b34801561039c57600080fd5b506003546103c9907801000000000000000000000000000000000000000000000000900463ffffffff1681565b60405163ffffffff909116815260200161020a565b3480156103ea57600080fd5b50610233610ffb565b3480156103ff57600080fd5b5061023361040e3660046135ee565b611088565b34801561041f57600080fd5b5060075473ffffffffffffffffffffffffffffffffffffffff166101e9565b34801561044a57600080fd5b50466102aa565b34801561045d57600080fd5b506003546103c9907c0100000000000000000000000000000000000000000000000000000000900463ffffffff1681565b6104a161049c36600461368c565b6111d6565b60405161020a9190613777565b3480156104ba57600080fd5b506102336104c936600461398f565b6113b0565b3480156104da57600080fd5b506102336104e9366004613473565b61188a565b3480156104fa57600080fd5b506002546101e99073ffffffffffffffffffffffffffffffffffffffff1681565b34801561052757600080fd5b506003546103c99074010000000000000000000000000000000000000000900463ffffffff1681565b34801561055c57600080fd5b5061057061056b36600461348e565b611949565b6040805192835260208301919091520161020a565b34801561059157600080fd5b506102aa6105a036600461348e565b60066020526000908152604090205481565b3480156105be57600080fd5b506102336105cd366004613473565b611977565b3480156105de57600080fd5b506102336105ed366004613a8b565b611aa4565b3480156105fe57600080fd5b5061023361060d366004613be9565b611cc6565b60075473ffffffffffffffffffffffffffffffffffffffff163314610698576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657260448201526064015b60405180910390fd5b6106a0611eac565b6106cd600080547fffffffffffffffffffffff00ffffffffffffffffffffffffffffffffffffffff169055565b6106d681611f30565b61071a600080547fffffffffffffffffffffff00ffffffffffffffffffffffffffffffffffffffff1674010000000000000000000000000000000000000000179055565b50565b60005473ffffffffffffffffffffffffffffffffffffffff1661073f57600080fd5b6000546040517f22f8e5660000000000000000000000000000000000000000000000000000000081526004810183905273ffffffffffffffffffffffffffffffffffffffff909116906322f8e56690602401600060405180830381600087803b1580156107ab57600080fd5b505af11580156107bf573d6000803e3d6000fd5b5050505050565b60075473ffffffffffffffffffffffffffffffffffffffff163314610847576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604482015260640161068f565b61084f611eac565b61087c600080547fffffffffffffffffffffff00ffffffffffffffffffffffffffffffffffffffff169055565b61088783838361201c565b6108cb600080547fffffffffffffffffffffff00ffffffffffffffffffffffffffffffffffffffff1674010000000000000000000000000000000000000000179055565b505050565b60075473ffffffffffffffffffffffffffffffffffffffff163314610951576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604482015260640161068f565b610959611eac565b610986600080547fffffffffffffffffffffff00ffffffffffffffffffffffffffffffffffffffff169055565b6106d6816120b3565b6000805473ffffffffffffffffffffffffffffffffffffffff1615610a425760008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166329cb924d6040518163ffffffff1660e01b8152600401602060405180830381865afa158015610a19573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610a3d9190613cc7565b905090565b504290565b73ffffffffffffffffffffffffffffffffffffffff851660009081526004602090815260408083208684529091529020548590849060ff16610ae5576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152600e60248201527f44697361626c656420726f757465000000000000000000000000000000000000604482015260640161068f565b610aed611eac565b610b1a600080547fffffffffffffffffffffff00ffffffffffffffffffffffffffffffffffffffff169055565b6706f05b59d3b200008467ffffffffffffffff161115610b96576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601360248201527f696e76616c69642072656c617965722066656500000000000000000000000000604482015260640161068f565b600354610bc5907801000000000000000000000000000000000000000000000000900463ffffffff1684613d0f565b63ffffffff16610bd361098f565b10158015610c1c5750600354610c0b907801000000000000000000000000000000000000000000000000900463ffffffff1684613d34565b63ffffffff16610c1961098f565b11155b610c82576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601260248201527f696e76616c69642071756f74652074696d650000000000000000000000000000604482015260640161068f565b60035473ffffffffffffffffffffffffffffffffffffffff8881169116148015610cac5750600034115b15610da257853414610d1a576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601b60248201527f6d73672e76616c7565206d757374206d6174636820616d6f756e740000000000604482015260640161068f565b600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663d0e30db0346040518263ffffffff1660e01b81526004016000604051808303818588803b158015610d8457600080fd5b505af1158015610d98573d6000803e3d6000fd5b5050505050610dc4565b610dc473ffffffffffffffffffffffffffffffffffffffff881633308961213a565b600354604080518881526020810188905267ffffffffffffffff87168183015263ffffffff868116606083015273ffffffffffffffffffffffffffffffffffffffff8c8116608084015292513394938c16937c01000000000000000000000000000000000000000000000000000000009004909116917ffc53c5b967d467d4136291c639720626f3d6dda97b4364da813e6858ad48a721919081900360a00190a460016003601c8282829054906101000a900463ffffffff16610e879190613d34565b92506101000a81548163ffffffff021916908363ffffffff160217905550610ee9600080547fffffffffffffffffffffff00ffffffffffffffffffffffffffffffffffffffff1674010000000000000000000000000000000000000000179055565b5050505050505050565b60075473ffffffffffffffffffffffffffffffffffffffff163314610f74576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604482015260640161068f565b610f7c611eac565b610fa9600080547fffffffffffffffffffffff00ffffffffffffffffffffffffffffffffffffffff169055565b610fb3828261221c565b610ff7600080547fffffffffffffffffffffff00ffffffffffffffffffffffffffffffffffffffff1674010000000000000000000000000000000000000000179055565b5050565b60075473ffffffffffffffffffffffffffffffffffffffff16331461107c576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604482015260640161068f565b61108660006122c2565b565b611090611eac565b6110bd600080547fffffffffffffffffffffff00ffffffffffffffffffffffffffffffffffffffff169055565b60006040518061010001604052808c73ffffffffffffffffffffffffffffffffffffffff1681526020018b73ffffffffffffffffffffffffffffffffffffffff1681526020018a73ffffffffffffffffffffffffffffffffffffffff1681526020018981526020018681526020018567ffffffffffffffff1681526020018467ffffffffffffffff1681526020018363ffffffff168152509050600061116282612339565b9050600061117482848b886000612369565b905061118382828a888761260c565b5050506111ca600080547fffffffffffffffffffffff00ffffffffffffffffffffffffffffffffffffffff1674010000000000000000000000000000000000000000179055565b50505050505050505050565b60603415611240576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601b60248201527f4f6e6c79206d756c746963616c6c207769746820302076616c75650000000000604482015260640161068f565b8167ffffffffffffffff811115611259576112596137f7565b60405190808252806020026020018201604052801561128c57816020015b60608152602001906001900390816112775790505b50905060005b828110156113a957600080308686858181106112b0576112b0613d5c565b90506020028101906112c29190613d8b565b6040516112d0929190613df0565b600060405180830381855af49150503d806000811461130b576040519150601f19603f3d011682016040523d82523d6000602084013e611310565b606091505b5091509150816113765760448151101561132957600080fd5b600481019050808060200190518101906113439190613e00565b6040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161068f9190613e6e565b8084848151811061138957611389613d5c565b6020026020010181905250505080806113a190613e81565b915050611292565b5092915050565b6113b8611eac565b6113e5600080547fffffffffffffffffffffff00ffffffffffffffffffffffffffffffffffffffff169055565b46826020015114611452576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152600f60248201527f496e76616c696420636861696e49640000000000000000000000000000000000604482015260640161068f565b8160400151518260a0015151146114c5576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152600c60248201527f696e76616c6964206c6561660000000000000000000000000000000000000000604482015260640161068f565b600060058463ffffffff16815481106114e0576114e0613d5c565b906000526020600020906003020190506114ff81600101548484612711565b611565576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152600960248201527f4261642050726f6f660000000000000000000000000000000000000000000000604482015260640161068f565b61157c81600201846060015163ffffffff1661274e565b156115e3576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152600f60248201527f416c726561647920636c61696d65640000000000000000000000000000000000604482015260640161068f565b6115fa81600201846060015163ffffffff1661278f565b471561168457600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663d0e30db0476040518263ffffffff1660e01b81526004016000604051808303818588803b15801561166a57600080fd5b505af115801561167e573d6000803e3d6000fd5b50505050505b60005b8360400151518163ffffffff16101561173057600084604001518263ffffffff16815181106116b8576116b8613d5c565b60200260200101519050600081111561171d5761171d8560a001518363ffffffff16815181106116ea576116ea613d5c565b602002602001015182876080015173ffffffffffffffffffffffffffffffffffffffff166127cd9092919063ffffffff16565b508061172881613eba565b915050611687565b508251156117c95761174183612823565b826080015173ffffffffffffffffffffffffffffffffffffffff16836060015163ffffffff1684602001517f828fc203220356df8f072a91681caee7d5c75095e2a95e80ed5a14b384697f718660000151336040516117c092919091825273ffffffffffffffffffffffffffffffffffffffff16602082015260400190565b60405180910390a45b3373ffffffffffffffffffffffffffffffffffffffff16836060015163ffffffff168563ffffffff167ff8bd640004bcec1b89657020f561d0b070cbdf662d0b158db9dccb0a8301bfab86600001518760200151886040015189608001518a60a0015160405161183d959493929190613f5f565b60405180910390a4506108cb600080547fffffffffffffffffffffff00ffffffffffffffffffffffffffffffffffffffff1674010000000000000000000000000000000000000000179055565b60075473ffffffffffffffffffffffffffffffffffffffff16331461190b576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604482015260640161068f565b611913611eac565b611940600080547fffffffffffffffffffffff00ffffffffffffffffffffffffffffffffffffffff169055565b6106d6816128c7565b6005818154811061195957600080fd5b60009182526020909120600390910201805460019091015490915082565b60075473ffffffffffffffffffffffffffffffffffffffff1633146119f8576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604482015260640161068f565b73ffffffffffffffffffffffffffffffffffffffff8116611a9b576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201527f6464726573730000000000000000000000000000000000000000000000000000606482015260840161068f565b61071a816122c2565b611aac611eac565b611ad9600080547fffffffffffffffffffffff00ffffffffffffffffffffffffffffffffffffffff169055565b60006040518061010001604052808c73ffffffffffffffffffffffffffffffffffffffff1681526020018b73ffffffffffffffffffffffffffffffffffffffff1681526020018a73ffffffffffffffffffffffffffffffffffffffff1681526020018981526020018881526020018767ffffffffffffffff1681526020018667ffffffffffffffff1681526020018563ffffffff168152509050611ba860058463ffffffff1681548110611b8f57611b8f613d5c565b90600052602060002090600302016000015482846129b3565b611c0e576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152600d60248201527f496e76616c69642070726f6f6600000000000000000000000000000000000000604482015260640161068f565b6000611c1982612339565b90504715611ca557600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663d0e30db0476040518263ffffffff1660e01b81526004016000604051808303818588803b158015611c8b57600080fd5b505af1158015611c9f573d6000803e3d6000fd5b50505050505b6000611cb9828485606001518a6001612369565b90506111838282856129cb565b611cce611eac565b611cfb600080547fffffffffffffffffffffff00ffffffffffffffffffffffffffffffffffffffff169055565b60408051608060208201819052601160a08301527f4143524f53532d56322d4645452d312e3000000000000000000000000000000060c083015267ffffffffffffffff86169282019290925263ffffffff8416606082015290810187905260009060e0016040516020818303038152906040528051906020012090506000611d8282612ac4565b9050611d8f8e8285612aff565b505060006040518061010001604052808e73ffffffffffffffffffffffffffffffffffffffff1681526020018d73ffffffffffffffffffffffffffffffffffffffff1681526020018c73ffffffffffffffffffffffffffffffffffffffff1681526020018b81526020018881526020018767ffffffffffffffff1681526020018667ffffffffffffffff1681526020018463ffffffff1681525090506000611e3682612339565b90506000611e4882848d896000612369565b9050611e5782828c898761260c565b505050611e9e600080547fffffffffffffffffffffff00ffffffffffffffffffffffffffffffffffffffff1674010000000000000000000000000000000000000000179055565b505050505050505050505050565b60005474010000000000000000000000000000000000000000900460ff16611086576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601f60248201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c00604482015260640161068f565b73ffffffffffffffffffffffffffffffffffffffff8116611fad576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601460248201527f4261642068756220706f6f6c2061646472657373000000000000000000000000604482015260640161068f565b600280547fffffffffffffffffffffffff00000000000000000000000000000000000000001673ffffffffffffffffffffffffffffffffffffffff83169081179091556040517f1f17a88f67b0f49060a34bec1a4723a563620e6aa265eb640b5046dcee0759a090600090a250565b73ffffffffffffffffffffffffffffffffffffffff8316600081815260046020908152604080832086845282529182902080547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff001685151590811790915591519182528492917f0a21fdd43d0ad0c62689ee7230a47309a050755bcc52eba00310add65297692a91015b60405180910390a3505050565b600380547fffffffff00000000ffffffffffffffffffffffffffffffffffffffffffffffff16780100000000000000000000000000000000000000000000000063ffffffff8416908102919091179091556040519081527f0e55dd180fa793d9036c804d0a116e6a7617a48e72cee1f83d92793a793fcc039060200160405180910390a150565b60405173ffffffffffffffffffffffffffffffffffffffff808516602483015283166044820152606481018290526122169085907f23b872dd00000000000000000000000000000000000000000000000000000000906084015b604080517fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe08184030181529190526020810180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff167fffffffff0000000000000000000000000000000000000000000000000000000090931692909217909152612b70565b50505050565b60058054600181018255600091909152600381027f036b6384b5eca791c62761152d0c79bb0604c104a5fb6f4eb0703f3154bb3db181018490557f036b6384b5eca791c62761152d0c79bb0604c104a5fb6f4eb0703f3154bb3db001828155604080518581526020810185905263ffffffff8416917fc86ba04c55bc5eb2f2876b91c438849a296dbec7b08751c3074d92e04f0a77af910160405180910390a250505050565b6007805473ffffffffffffffffffffffffffffffffffffffff8381167fffffffffffffffffffffffff0000000000000000000000000000000000000000831681179093556040519116919082907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e090600090a35050565b60008160405160200161234c9190613fac565b604051602081830303815290604052805190602001209050919050565b60006706f05b59d3b200008367ffffffffffffffff161080156123a157506706f05b59d3b200008560a0015167ffffffffffffffff16105b612407576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152600c60248201527f696e76616c696420666565730000000000000000000000000000000000000000604482015260640161068f565b606085015160008781526006602052604090205410612482576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152600c60248201527f72656c61792066696c6c65640000000000000000000000000000000000000000604482015260640161068f565b5060008315612603576124a484848760a0015161249f9190614038565b612c7c565b6000878152600660205260409020546060870151919250859183916124c89161405b565b101561250a5760008781526006602052604090205460608701516124ec919061405b565b915061250782858860a001516125029190614038565b612cb6565b90505b60008781526006602052604081208054849290612528908490614072565b9091555050600354604087015173ffffffffffffffffffffffffffffffffffffffff9081169116141561259457826125815760408601516125819073ffffffffffffffffffffffffffffffffffffffff1633308461213a565b61258f866020015182612cdf565b612601565b826125ce5761258f33876020015183896040015173ffffffffffffffffffffffffffffffffffffffff1661213a909392919063ffffffff16565b612601866020015182886040015173ffffffffffffffffffffffffffffffffffffffff166127cd9092919063ffffffff16565b505b95945050505050565b3373ffffffffffffffffffffffffffffffffffffffff1683867f393f1765f382b5310a9186fa707a84040f8241b280a30b74112689a92a156f698460600151600660008b815260200190815260200160002054898760800151898960a001518a60e001518b604001518c600001518d602001516040516127029a99989796959493929190998a5260208a01989098526040890196909652606088019490945267ffffffffffffffff9283166080880152911660a086015263ffffffff1660c085015273ffffffffffffffffffffffffffffffffffffffff90811660e0850152908116610100840152166101208201526101400190565b60405180910390a45050505050565b6000612744828585604051602001612729919061408a565b60405160208183030381529060405280519060200120612de7565b90505b9392505050565b60008061275d61010084614154565b9050600061276d61010085614168565b6000928352602095909552506040902054600190931b92831690921492915050565b600061279d61010083614154565b905060006127ad61010084614168565b600092835260209490945250604090208054600190931b90921790915550565b60405173ffffffffffffffffffffffffffffffffffffffff83166024820152604481018290526108cb9084907fa9059cbb0000000000000000000000000000000000000000000000000000000090606401612194565b608081015160025482516040517fa9059cbb00000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff9283166004820152602481019190915291169063a9059cbb906044016020604051808303816000875af11580156128a3573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610ff7919061417c565b73ffffffffffffffffffffffffffffffffffffffff8116612944576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601960248201527f4261642062726964676520726f75746572206164647265737300000000000000604482015260640161068f565b600180547fffffffffffffffffffffffff00000000000000000000000000000000000000001673ffffffffffffffffffffffffffffffffffffffff83169081179091556040517fa9e8c42c9e7fca7f62755189a16b2f5314d43d8fb24e91ba54e6d65f9314e84990600090a250565b60006127448285856040516020016127299190613fac565b3373ffffffffffffffffffffffffffffffffffffffff16837fc1c02fe71abee2530563583daac3d7b681ef4c00db95adc3847b886da8098bc1836060015160066000888152602001908152602001600020548686608001518760c001518860a001518960e001518a604001518b600001518c602001516040516120a69a99989796959493929190998a5260208a01989098526040890196909652606088019490945267ffffffffffffffff9283166080880152911660a086015263ffffffff1660c085015273ffffffffffffffffffffffffffffffffffffffff90811660e0850152908116610100840152166101208201526101400190565b6040517f19457468657265756d205369676e6564204d6573736167653a0a3332000000006020820152603c8101829052600090605c0161234c565b612b0a838383612dfd565b6108cb576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601160248201527f696e76616c6964207369676e6174757265000000000000000000000000000000604482015260640161068f565b6000612bd2826040518060400160405280602081526020017f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c65648152508573ffffffffffffffffffffffffffffffffffffffff16612fec9092919063ffffffff16565b8051909150156108cb5780806020019051810190612bf0919061417c565b6108cb576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602a60248201527f5361666545524332303a204552433230206f7065726174696f6e20646964206e60448201527f6f74207375636365656400000000000000000000000000000000000000000000606482015260840161068f565b6000612c9082670de0b6b3a7640000614199565b67ffffffffffffffff16612cac84670de0b6b3a76400006141ba565b6127479190614154565b6000670de0b6b3a7640000612ccb8382614199565b612cac9067ffffffffffffffff16856141ba565b73ffffffffffffffffffffffffffffffffffffffff82163b15612d2057600354610ff79073ffffffffffffffffffffffffffffffffffffffff1683836127cd565b6003546040517f2e1a7d4d0000000000000000000000000000000000000000000000000000000081526004810183905273ffffffffffffffffffffffffffffffffffffffff90911690632e1a7d4d90602401600060405180830381600087803b158015612d8c57600080fd5b505af1158015612da0573d6000803e3d6000fd5b505060405173ffffffffffffffffffffffffffffffffffffffff8516925083156108fc02915083906000818181858888f193505050501580156108cb573d6000803e3d6000fd5b600082612df48584612ffb565b14949350505050565b6000806000612e0c85856130a7565b90925090506000816004811115612e2557612e256141f7565b148015612e5d57508573ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff16145b15612e6d57600192505050612747565b6000808773ffffffffffffffffffffffffffffffffffffffff16631626ba7e60e01b8888604051602401612ea2929190614226565b604080517fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe08184030181529181526020820180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff167fffffffff00000000000000000000000000000000000000000000000000000000909416939093179092529051612f2b919061423f565b600060405180830381855afa9150503d8060008114612f66576040519150601f19603f3d011682016040523d82523d6000602084013e612f6b565b606091505b5091509150818015612f7e575080516020145b8015612fe0575080517f1626ba7e0000000000000000000000000000000000000000000000000000000090612fbc908301602090810190840161425b565b7fffffffff0000000000000000000000000000000000000000000000000000000016145b98975050505050505050565b60606127448484600085613117565b600081815b845181101561309f57600085828151811061301d5761301d613d5c565b6020026020010151905080831161305f57604080516020810185905290810182905260600160405160208183030381529060405280519060200120925061308c565b60408051602081018390529081018490526060016040516020818303038152906040528051906020012092505b508061309781613e81565b915050613000565b509392505050565b6000808251604114156130de5760208301516040840151606085015160001a6130d287828585613297565b94509450505050613110565b82516040141561310857602083015160408401516130fd8683836133af565b935093505050613110565b506000905060025b9250929050565b6060824710156131a9576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602660248201527f416464726573733a20696e73756666696369656e742062616c616e636520666f60448201527f722063616c6c0000000000000000000000000000000000000000000000000000606482015260840161068f565b843b613211576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e7472616374000000604482015260640161068f565b6000808673ffffffffffffffffffffffffffffffffffffffff16858760405161323a919061423f565b60006040518083038185875af1925050503d8060008114613277576040519150601f19603f3d011682016040523d82523d6000602084013e61327c565b606091505b509150915061328c8282866133f7565b979650505050505050565b6000807f7fffffffffffffffffffffffffffffff5d576e7357a4501ddfe92f46681b20a08311156132ce57506000905060036133a6565b8460ff16601b141580156132e657508460ff16601c14155b156132f757506000905060046133a6565b6040805160008082526020820180845289905260ff881692820192909252606081018690526080810185905260019060a0016020604051602081039080840390855afa15801561334b573d6000803e3d6000fd5b50506040517fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0015191505073ffffffffffffffffffffffffffffffffffffffff811661339f576000600192509250506133a6565b9150600090505b94509492505050565b6000807f7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff831660ff84901c601b016133e987828885613297565b935093505050935093915050565b60608315613406575081612747565b8251156134165782518084602001fd5b816040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161068f9190613e6e565b803573ffffffffffffffffffffffffffffffffffffffff8116811461346e57600080fd5b919050565b60006020828403121561348557600080fd5b6127478261344a565b6000602082840312156134a057600080fd5b5035919050565b801515811461071a57600080fd5b6000806000606084860312156134ca57600080fd5b6134d38461344a565b92506020840135915060408401356134ea816134a7565b809150509250925092565b803563ffffffff8116811461346e57600080fd5b60006020828403121561351b57600080fd5b612747826134f5565b803567ffffffffffffffff8116811461346e57600080fd5b60008060008060008060c0878903121561355557600080fd5b61355e8761344a565b955061356c6020880161344a565b9450604087013593506060870135925061358860808801613524565b915061359660a088016134f5565b90509295509295509295565b600080604083850312156135b557600080fd5b50508035926020909101359150565b600080604083850312156135d757600080fd5b6135e08361344a565b946020939093013593505050565b6000806000806000806000806000806101408b8d03121561360e57600080fd5b6136178b61344a565b995061362560208c0161344a565b985061363360408c0161344a565b975060608b0135965060808b0135955060a08b0135945060c08b0135935061365d60e08c01613524565b925061366c6101008c01613524565b915061367b6101208c016134f5565b90509295989b9194979a5092959850565b6000806020838503121561369f57600080fd5b823567ffffffffffffffff808211156136b757600080fd5b818501915085601f8301126136cb57600080fd5b8135818111156136da57600080fd5b8660208260051b85010111156136ef57600080fd5b60209290920196919550909350505050565b60005b8381101561371c578181015183820152602001613704565b838111156122165750506000910152565b60008151808452613745816020860160208601613701565b601f017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0169290920160200192915050565b6000602080830181845280855180835260408601915060408160051b870101925083870160005b828110156137ea577fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc08886030184526137d885835161372d565b9450928501929085019060010161379e565b5092979650505050505050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b60405160c0810167ffffffffffffffff81118282101715613849576138496137f7565b60405290565b604051601f82017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe016810167ffffffffffffffff81118282101715613896576138966137f7565b604052919050565b600067ffffffffffffffff8211156138b8576138b86137f7565b5060051b60200190565b600082601f8301126138d357600080fd5b813560206138e86138e38361389e565b61384f565b82815260059290921b8401810191818101908684111561390757600080fd5b8286015b84811015613922578035835291830191830161390b565b509695505050505050565b600082601f83011261393e57600080fd5b8135602061394e6138e38361389e565b82815260059290921b8401810191818101908684111561396d57600080fd5b8286015b84811015613922576139828161344a565b8352918301918301613971565b6000806000606084860312156139a457600080fd5b6139ad846134f5565b9250602084013567ffffffffffffffff808211156139ca57600080fd5b9085019060c082880312156139de57600080fd5b6139e6613826565b8235815260208301356020820152604083013582811115613a0657600080fd5b613a12898286016138c2565b604083015250613a24606084016134f5565b6060820152613a356080840161344a565b608082015260a083013582811115613a4c57600080fd5b613a588982860161392d565b60a08301525093506040860135915080821115613a7457600080fd5b50613a81868287016138c2565b9150509250925092565b6000806000806000806000806000806101408b8d031215613aab57600080fd5b613ab48b61344a565b9950613ac260208c0161344a565b9850613ad060408c0161344a565b975060608b0135965060808b01359550613aec60a08c01613524565b9450613afa60c08c01613524565b9350613b0860e08c016134f5565b9250613b176101008c016134f5565b91506101208b013567ffffffffffffffff811115613b3457600080fd5b613b408d828e016138c2565b9150509295989b9194979a5092959850565b600067ffffffffffffffff821115613b6c57613b6c6137f7565b50601f017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe01660200190565b600082601f830112613ba957600080fd5b8135613bb76138e382613b52565b818152846020838601011115613bcc57600080fd5b816020850160208301376000918101602001919091529392505050565b6000806000806000806000806000806000806101808d8f031215613c0c57600080fd5b613c158d61344a565b9b50613c2360208e0161344a565b9a50613c3160408e0161344a565b995060608d0135985060808d0135975060a08d0135965060c08d01359550613c5b60e08e01613524565b9450613c6a6101008e01613524565b9350613c796101208e01613524565b9250613c886101408e016134f5565b915067ffffffffffffffff6101608e01351115613ca457600080fd5b613cb58e6101608f01358f01613b98565b90509295989b509295989b509295989b565b600060208284031215613cd957600080fd5b5051919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b600063ffffffff83811690831681811015613d2c57613d2c613ce0565b039392505050565b600063ffffffff808316818516808303821115613d5357613d53613ce0565b01949350505050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b60008083357fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe1843603018112613dc057600080fd5b83018035915067ffffffffffffffff821115613ddb57600080fd5b60200191503681900382131561311057600080fd5b8183823760009101908152919050565b600060208284031215613e1257600080fd5b815167ffffffffffffffff811115613e2957600080fd5b8201601f81018413613e3a57600080fd5b8051613e486138e382613b52565b818152856020838501011115613e5d57600080fd5b612603826020830160208601613701565b602081526000612747602083018461372d565b60007fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff821415613eb357613eb3613ce0565b5060010190565b600063ffffffff80831681811415613ed457613ed4613ce0565b6001019392505050565b600081518084526020808501945080840160005b83811015613f0e57815187529582019590820190600101613ef2565b509495945050505050565b600081518084526020808501945080840160005b83811015613f0e57815173ffffffffffffffffffffffffffffffffffffffff1687529582019590820190600101613f2d565b85815284602082015260a060408201526000613f7e60a0830186613ede565b73ffffffffffffffffffffffffffffffffffffffff851660608401528281036080840152612fe08185613f19565b60006101008201905073ffffffffffffffffffffffffffffffffffffffff80845116835280602085015116602084015280604085015116604084015250606083015160608301526080830151608083015260a083015167ffffffffffffffff80821660a08501528060c08601511660c0850152505060e08301516113a960e084018263ffffffff169052565b600067ffffffffffffffff808316818516808303821115613d5357613d53613ce0565b60008282101561406d5761406d613ce0565b500390565b6000821982111561408557614085613ce0565b500190565b6020815281516020820152602082015160408201526000604083015160c060608401526140ba60e0840182613ede565b905063ffffffff606085015116608084015273ffffffffffffffffffffffffffffffffffffffff60808501511660a084015260a08401517fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe08483030160c08501526126038282613f19565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601260045260246000fd5b60008261416357614163614125565b500490565b60008261417757614177614125565b500690565b60006020828403121561418e57600080fd5b8151612747816134a7565b600067ffffffffffffffff83811690831681811015613d2c57613d2c613ce0565b6000817fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff04831182151516156141f2576141f2613ce0565b500290565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052602160045260246000fd5b828152604060208201526000612744604083018461372d565b60008251614251818460208701613701565b9190910192915050565b60006020828403121561426d57600080fd5b81517fffffffff000000000000000000000000000000000000000000000000000000008116811461274757600080fdfea264697066735822122034e62a2d7a0c316af494fc65ff7a902b6f838e6440b399cb3e9b88ee19ec45a964736f6c634300080b0033", - "deployedBytecode": "0x6080604052600436106101b05760003560e01c806389a153cc116100ec578063e19044021161008a578063f06850f611610064578063f06850f614610585578063f2fde38b146105b2578063fe45399c146105d2578063ffc351a3146105f257600080fd5b8063e1904402146104ee578063ecda10f51461051b578063ee2a53f81461055057600080fd5b8063a1244c67116100c6578063a1244c6714610451578063ac9650d81461048e578063c894c0ca146104ae578063de7eba78146104ce57600080fd5b806389a153cc146103f35780638da5cb5b146104135780639a8a05921461043e57600080fd5b80633fc8cef3116101595780635249fef1116101335780635249fef1146103185780635285e0581461036357806357f6dcb814610390578063715018a6146103de57600080fd5b80633fc8cef3146102b857806349228978146102e5578063493a4f84146102f857600080fd5b8063272751c71161018a578063272751c7146102555780632752042e1461027557806329cb924d1461029557600080fd5b80631c39c38d146101bc5780631dfb2d021461021357806322f8e5661461023557600080fd5b366101b757005b600080fd5b3480156101c857600080fd5b506000546101e99073ffffffffffffffffffffffffffffffffffffffff1681565b60405173ffffffffffffffffffffffffffffffffffffffff90911681526020015b60405180910390f35b34801561021f57600080fd5b5061023361022e366004613473565b610612565b005b34801561024157600080fd5b5061023361025036600461348e565b61071d565b34801561026157600080fd5b506102336102703660046134b5565b6107c6565b34801561028157600080fd5b50610233610290366004613509565b6108d0565b3480156102a157600080fd5b506102aa61098f565b60405190815260200161020a565b3480156102c457600080fd5b506003546101e99073ffffffffffffffffffffffffffffffffffffffff1681565b6102336102f336600461353c565b610a47565b34801561030457600080fd5b506102336103133660046135a2565b610ef3565b34801561032457600080fd5b506103536103333660046135c4565b600460209081526000928352604080842090915290825290205460ff1681565b604051901515815260200161020a565b34801561036f57600080fd5b506001546101e99073ffffffffffffffffffffffffffffffffffffffff1681565b34801561039c57600080fd5b506003546103c9907801000000000000000000000000000000000000000000000000900463ffffffff1681565b60405163ffffffff909116815260200161020a565b3480156103ea57600080fd5b50610233610ffb565b3480156103ff57600080fd5b5061023361040e3660046135ee565b611088565b34801561041f57600080fd5b5060075473ffffffffffffffffffffffffffffffffffffffff166101e9565b34801561044a57600080fd5b50466102aa565b34801561045d57600080fd5b506003546103c9907c0100000000000000000000000000000000000000000000000000000000900463ffffffff1681565b6104a161049c36600461368c565b6111d6565b60405161020a9190613777565b3480156104ba57600080fd5b506102336104c936600461398f565b6113b0565b3480156104da57600080fd5b506102336104e9366004613473565b61188a565b3480156104fa57600080fd5b506002546101e99073ffffffffffffffffffffffffffffffffffffffff1681565b34801561052757600080fd5b506003546103c99074010000000000000000000000000000000000000000900463ffffffff1681565b34801561055c57600080fd5b5061057061056b36600461348e565b611949565b6040805192835260208301919091520161020a565b34801561059157600080fd5b506102aa6105a036600461348e565b60066020526000908152604090205481565b3480156105be57600080fd5b506102336105cd366004613473565b611977565b3480156105de57600080fd5b506102336105ed366004613a8b565b611aa4565b3480156105fe57600080fd5b5061023361060d366004613be9565b611cc6565b60075473ffffffffffffffffffffffffffffffffffffffff163314610698576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657260448201526064015b60405180910390fd5b6106a0611eac565b6106cd600080547fffffffffffffffffffffff00ffffffffffffffffffffffffffffffffffffffff169055565b6106d681611f30565b61071a600080547fffffffffffffffffffffff00ffffffffffffffffffffffffffffffffffffffff1674010000000000000000000000000000000000000000179055565b50565b60005473ffffffffffffffffffffffffffffffffffffffff1661073f57600080fd5b6000546040517f22f8e5660000000000000000000000000000000000000000000000000000000081526004810183905273ffffffffffffffffffffffffffffffffffffffff909116906322f8e56690602401600060405180830381600087803b1580156107ab57600080fd5b505af11580156107bf573d6000803e3d6000fd5b5050505050565b60075473ffffffffffffffffffffffffffffffffffffffff163314610847576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604482015260640161068f565b61084f611eac565b61087c600080547fffffffffffffffffffffff00ffffffffffffffffffffffffffffffffffffffff169055565b61088783838361201c565b6108cb600080547fffffffffffffffffffffff00ffffffffffffffffffffffffffffffffffffffff1674010000000000000000000000000000000000000000179055565b505050565b60075473ffffffffffffffffffffffffffffffffffffffff163314610951576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604482015260640161068f565b610959611eac565b610986600080547fffffffffffffffffffffff00ffffffffffffffffffffffffffffffffffffffff169055565b6106d6816120b3565b6000805473ffffffffffffffffffffffffffffffffffffffff1615610a425760008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166329cb924d6040518163ffffffff1660e01b8152600401602060405180830381865afa158015610a19573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610a3d9190613cc7565b905090565b504290565b73ffffffffffffffffffffffffffffffffffffffff851660009081526004602090815260408083208684529091529020548590849060ff16610ae5576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152600e60248201527f44697361626c656420726f757465000000000000000000000000000000000000604482015260640161068f565b610aed611eac565b610b1a600080547fffffffffffffffffffffff00ffffffffffffffffffffffffffffffffffffffff169055565b6706f05b59d3b200008467ffffffffffffffff161115610b96576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601360248201527f696e76616c69642072656c617965722066656500000000000000000000000000604482015260640161068f565b600354610bc5907801000000000000000000000000000000000000000000000000900463ffffffff1684613d0f565b63ffffffff16610bd361098f565b10158015610c1c5750600354610c0b907801000000000000000000000000000000000000000000000000900463ffffffff1684613d34565b63ffffffff16610c1961098f565b11155b610c82576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601260248201527f696e76616c69642071756f74652074696d650000000000000000000000000000604482015260640161068f565b60035473ffffffffffffffffffffffffffffffffffffffff8881169116148015610cac5750600034115b15610da257853414610d1a576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601b60248201527f6d73672e76616c7565206d757374206d6174636820616d6f756e740000000000604482015260640161068f565b600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663d0e30db0346040518263ffffffff1660e01b81526004016000604051808303818588803b158015610d8457600080fd5b505af1158015610d98573d6000803e3d6000fd5b5050505050610dc4565b610dc473ffffffffffffffffffffffffffffffffffffffff881633308961213a565b600354604080518881526020810188905267ffffffffffffffff87168183015263ffffffff868116606083015273ffffffffffffffffffffffffffffffffffffffff8c8116608084015292513394938c16937c01000000000000000000000000000000000000000000000000000000009004909116917ffc53c5b967d467d4136291c639720626f3d6dda97b4364da813e6858ad48a721919081900360a00190a460016003601c8282829054906101000a900463ffffffff16610e879190613d34565b92506101000a81548163ffffffff021916908363ffffffff160217905550610ee9600080547fffffffffffffffffffffff00ffffffffffffffffffffffffffffffffffffffff1674010000000000000000000000000000000000000000179055565b5050505050505050565b60075473ffffffffffffffffffffffffffffffffffffffff163314610f74576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604482015260640161068f565b610f7c611eac565b610fa9600080547fffffffffffffffffffffff00ffffffffffffffffffffffffffffffffffffffff169055565b610fb3828261221c565b610ff7600080547fffffffffffffffffffffff00ffffffffffffffffffffffffffffffffffffffff1674010000000000000000000000000000000000000000179055565b5050565b60075473ffffffffffffffffffffffffffffffffffffffff16331461107c576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604482015260640161068f565b61108660006122c2565b565b611090611eac565b6110bd600080547fffffffffffffffffffffff00ffffffffffffffffffffffffffffffffffffffff169055565b60006040518061010001604052808c73ffffffffffffffffffffffffffffffffffffffff1681526020018b73ffffffffffffffffffffffffffffffffffffffff1681526020018a73ffffffffffffffffffffffffffffffffffffffff1681526020018981526020018681526020018567ffffffffffffffff1681526020018467ffffffffffffffff1681526020018363ffffffff168152509050600061116282612339565b9050600061117482848b886000612369565b905061118382828a888761260c565b5050506111ca600080547fffffffffffffffffffffff00ffffffffffffffffffffffffffffffffffffffff1674010000000000000000000000000000000000000000179055565b50505050505050505050565b60603415611240576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601b60248201527f4f6e6c79206d756c746963616c6c207769746820302076616c75650000000000604482015260640161068f565b8167ffffffffffffffff811115611259576112596137f7565b60405190808252806020026020018201604052801561128c57816020015b60608152602001906001900390816112775790505b50905060005b828110156113a957600080308686858181106112b0576112b0613d5c565b90506020028101906112c29190613d8b565b6040516112d0929190613df0565b600060405180830381855af49150503d806000811461130b576040519150601f19603f3d011682016040523d82523d6000602084013e611310565b606091505b5091509150816113765760448151101561132957600080fd5b600481019050808060200190518101906113439190613e00565b6040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161068f9190613e6e565b8084848151811061138957611389613d5c565b6020026020010181905250505080806113a190613e81565b915050611292565b5092915050565b6113b8611eac565b6113e5600080547fffffffffffffffffffffff00ffffffffffffffffffffffffffffffffffffffff169055565b46826020015114611452576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152600f60248201527f496e76616c696420636861696e49640000000000000000000000000000000000604482015260640161068f565b8160400151518260a0015151146114c5576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152600c60248201527f696e76616c6964206c6561660000000000000000000000000000000000000000604482015260640161068f565b600060058463ffffffff16815481106114e0576114e0613d5c565b906000526020600020906003020190506114ff81600101548484612711565b611565576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152600960248201527f4261642050726f6f660000000000000000000000000000000000000000000000604482015260640161068f565b61157c81600201846060015163ffffffff1661274e565b156115e3576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152600f60248201527f416c726561647920636c61696d65640000000000000000000000000000000000604482015260640161068f565b6115fa81600201846060015163ffffffff1661278f565b471561168457600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663d0e30db0476040518263ffffffff1660e01b81526004016000604051808303818588803b15801561166a57600080fd5b505af115801561167e573d6000803e3d6000fd5b50505050505b60005b8360400151518163ffffffff16101561173057600084604001518263ffffffff16815181106116b8576116b8613d5c565b60200260200101519050600081111561171d5761171d8560a001518363ffffffff16815181106116ea576116ea613d5c565b602002602001015182876080015173ffffffffffffffffffffffffffffffffffffffff166127cd9092919063ffffffff16565b508061172881613eba565b915050611687565b508251156117c95761174183612823565b826080015173ffffffffffffffffffffffffffffffffffffffff16836060015163ffffffff1684602001517f828fc203220356df8f072a91681caee7d5c75095e2a95e80ed5a14b384697f718660000151336040516117c092919091825273ffffffffffffffffffffffffffffffffffffffff16602082015260400190565b60405180910390a45b3373ffffffffffffffffffffffffffffffffffffffff16836060015163ffffffff168563ffffffff167ff8bd640004bcec1b89657020f561d0b070cbdf662d0b158db9dccb0a8301bfab86600001518760200151886040015189608001518a60a0015160405161183d959493929190613f5f565b60405180910390a4506108cb600080547fffffffffffffffffffffff00ffffffffffffffffffffffffffffffffffffffff1674010000000000000000000000000000000000000000179055565b60075473ffffffffffffffffffffffffffffffffffffffff16331461190b576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604482015260640161068f565b611913611eac565b611940600080547fffffffffffffffffffffff00ffffffffffffffffffffffffffffffffffffffff169055565b6106d6816128c7565b6005818154811061195957600080fd5b60009182526020909120600390910201805460019091015490915082565b60075473ffffffffffffffffffffffffffffffffffffffff1633146119f8576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604482015260640161068f565b73ffffffffffffffffffffffffffffffffffffffff8116611a9b576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201527f6464726573730000000000000000000000000000000000000000000000000000606482015260840161068f565b61071a816122c2565b611aac611eac565b611ad9600080547fffffffffffffffffffffff00ffffffffffffffffffffffffffffffffffffffff169055565b60006040518061010001604052808c73ffffffffffffffffffffffffffffffffffffffff1681526020018b73ffffffffffffffffffffffffffffffffffffffff1681526020018a73ffffffffffffffffffffffffffffffffffffffff1681526020018981526020018881526020018767ffffffffffffffff1681526020018667ffffffffffffffff1681526020018563ffffffff168152509050611ba860058463ffffffff1681548110611b8f57611b8f613d5c565b90600052602060002090600302016000015482846129b3565b611c0e576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152600d60248201527f496e76616c69642070726f6f6600000000000000000000000000000000000000604482015260640161068f565b6000611c1982612339565b90504715611ca557600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663d0e30db0476040518263ffffffff1660e01b81526004016000604051808303818588803b158015611c8b57600080fd5b505af1158015611c9f573d6000803e3d6000fd5b50505050505b6000611cb9828485606001518a6001612369565b90506111838282856129cb565b611cce611eac565b611cfb600080547fffffffffffffffffffffff00ffffffffffffffffffffffffffffffffffffffff169055565b60408051608060208201819052601160a08301527f4143524f53532d56322d4645452d312e3000000000000000000000000000000060c083015267ffffffffffffffff86169282019290925263ffffffff8416606082015290810187905260009060e0016040516020818303038152906040528051906020012090506000611d8282612ac4565b9050611d8f8e8285612aff565b505060006040518061010001604052808e73ffffffffffffffffffffffffffffffffffffffff1681526020018d73ffffffffffffffffffffffffffffffffffffffff1681526020018c73ffffffffffffffffffffffffffffffffffffffff1681526020018b81526020018881526020018767ffffffffffffffff1681526020018667ffffffffffffffff1681526020018463ffffffff1681525090506000611e3682612339565b90506000611e4882848d896000612369565b9050611e5782828c898761260c565b505050611e9e600080547fffffffffffffffffffffff00ffffffffffffffffffffffffffffffffffffffff1674010000000000000000000000000000000000000000179055565b505050505050505050505050565b60005474010000000000000000000000000000000000000000900460ff16611086576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601f60248201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c00604482015260640161068f565b73ffffffffffffffffffffffffffffffffffffffff8116611fad576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601460248201527f4261642068756220706f6f6c2061646472657373000000000000000000000000604482015260640161068f565b600280547fffffffffffffffffffffffff00000000000000000000000000000000000000001673ffffffffffffffffffffffffffffffffffffffff83169081179091556040517f1f17a88f67b0f49060a34bec1a4723a563620e6aa265eb640b5046dcee0759a090600090a250565b73ffffffffffffffffffffffffffffffffffffffff8316600081815260046020908152604080832086845282529182902080547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff001685151590811790915591519182528492917f0a21fdd43d0ad0c62689ee7230a47309a050755bcc52eba00310add65297692a91015b60405180910390a3505050565b600380547fffffffff00000000ffffffffffffffffffffffffffffffffffffffffffffffff16780100000000000000000000000000000000000000000000000063ffffffff8416908102919091179091556040519081527f0e55dd180fa793d9036c804d0a116e6a7617a48e72cee1f83d92793a793fcc039060200160405180910390a150565b60405173ffffffffffffffffffffffffffffffffffffffff808516602483015283166044820152606481018290526122169085907f23b872dd00000000000000000000000000000000000000000000000000000000906084015b604080517fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe08184030181529190526020810180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff167fffffffff0000000000000000000000000000000000000000000000000000000090931692909217909152612b70565b50505050565b60058054600181018255600091909152600381027f036b6384b5eca791c62761152d0c79bb0604c104a5fb6f4eb0703f3154bb3db181018490557f036b6384b5eca791c62761152d0c79bb0604c104a5fb6f4eb0703f3154bb3db001828155604080518581526020810185905263ffffffff8416917fc86ba04c55bc5eb2f2876b91c438849a296dbec7b08751c3074d92e04f0a77af910160405180910390a250505050565b6007805473ffffffffffffffffffffffffffffffffffffffff8381167fffffffffffffffffffffffff0000000000000000000000000000000000000000831681179093556040519116919082907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e090600090a35050565b60008160405160200161234c9190613fac565b604051602081830303815290604052805190602001209050919050565b60006706f05b59d3b200008367ffffffffffffffff161080156123a157506706f05b59d3b200008560a0015167ffffffffffffffff16105b612407576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152600c60248201527f696e76616c696420666565730000000000000000000000000000000000000000604482015260640161068f565b606085015160008781526006602052604090205410612482576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152600c60248201527f72656c61792066696c6c65640000000000000000000000000000000000000000604482015260640161068f565b5060008315612603576124a484848760a0015161249f9190614038565b612c7c565b6000878152600660205260409020546060870151919250859183916124c89161405b565b101561250a5760008781526006602052604090205460608701516124ec919061405b565b915061250782858860a001516125029190614038565b612cb6565b90505b60008781526006602052604081208054849290612528908490614072565b9091555050600354604087015173ffffffffffffffffffffffffffffffffffffffff9081169116141561259457826125815760408601516125819073ffffffffffffffffffffffffffffffffffffffff1633308461213a565b61258f866020015182612cdf565b612601565b826125ce5761258f33876020015183896040015173ffffffffffffffffffffffffffffffffffffffff1661213a909392919063ffffffff16565b612601866020015182886040015173ffffffffffffffffffffffffffffffffffffffff166127cd9092919063ffffffff16565b505b95945050505050565b3373ffffffffffffffffffffffffffffffffffffffff1683867f393f1765f382b5310a9186fa707a84040f8241b280a30b74112689a92a156f698460600151600660008b815260200190815260200160002054898760800151898960a001518a60e001518b604001518c600001518d602001516040516127029a99989796959493929190998a5260208a01989098526040890196909652606088019490945267ffffffffffffffff9283166080880152911660a086015263ffffffff1660c085015273ffffffffffffffffffffffffffffffffffffffff90811660e0850152908116610100840152166101208201526101400190565b60405180910390a45050505050565b6000612744828585604051602001612729919061408a565b60405160208183030381529060405280519060200120612de7565b90505b9392505050565b60008061275d61010084614154565b9050600061276d61010085614168565b6000928352602095909552506040902054600190931b92831690921492915050565b600061279d61010083614154565b905060006127ad61010084614168565b600092835260209490945250604090208054600190931b90921790915550565b60405173ffffffffffffffffffffffffffffffffffffffff83166024820152604481018290526108cb9084907fa9059cbb0000000000000000000000000000000000000000000000000000000090606401612194565b608081015160025482516040517fa9059cbb00000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff9283166004820152602481019190915291169063a9059cbb906044016020604051808303816000875af11580156128a3573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610ff7919061417c565b73ffffffffffffffffffffffffffffffffffffffff8116612944576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601960248201527f4261642062726964676520726f75746572206164647265737300000000000000604482015260640161068f565b600180547fffffffffffffffffffffffff00000000000000000000000000000000000000001673ffffffffffffffffffffffffffffffffffffffff83169081179091556040517fa9e8c42c9e7fca7f62755189a16b2f5314d43d8fb24e91ba54e6d65f9314e84990600090a250565b60006127448285856040516020016127299190613fac565b3373ffffffffffffffffffffffffffffffffffffffff16837fc1c02fe71abee2530563583daac3d7b681ef4c00db95adc3847b886da8098bc1836060015160066000888152602001908152602001600020548686608001518760c001518860a001518960e001518a604001518b600001518c602001516040516120a69a99989796959493929190998a5260208a01989098526040890196909652606088019490945267ffffffffffffffff9283166080880152911660a086015263ffffffff1660c085015273ffffffffffffffffffffffffffffffffffffffff90811660e0850152908116610100840152166101208201526101400190565b6040517f19457468657265756d205369676e6564204d6573736167653a0a3332000000006020820152603c8101829052600090605c0161234c565b612b0a838383612dfd565b6108cb576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601160248201527f696e76616c6964207369676e6174757265000000000000000000000000000000604482015260640161068f565b6000612bd2826040518060400160405280602081526020017f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c65648152508573ffffffffffffffffffffffffffffffffffffffff16612fec9092919063ffffffff16565b8051909150156108cb5780806020019051810190612bf0919061417c565b6108cb576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602a60248201527f5361666545524332303a204552433230206f7065726174696f6e20646964206e60448201527f6f74207375636365656400000000000000000000000000000000000000000000606482015260840161068f565b6000612c9082670de0b6b3a7640000614199565b67ffffffffffffffff16612cac84670de0b6b3a76400006141ba565b6127479190614154565b6000670de0b6b3a7640000612ccb8382614199565b612cac9067ffffffffffffffff16856141ba565b73ffffffffffffffffffffffffffffffffffffffff82163b15612d2057600354610ff79073ffffffffffffffffffffffffffffffffffffffff1683836127cd565b6003546040517f2e1a7d4d0000000000000000000000000000000000000000000000000000000081526004810183905273ffffffffffffffffffffffffffffffffffffffff90911690632e1a7d4d90602401600060405180830381600087803b158015612d8c57600080fd5b505af1158015612da0573d6000803e3d6000fd5b505060405173ffffffffffffffffffffffffffffffffffffffff8516925083156108fc02915083906000818181858888f193505050501580156108cb573d6000803e3d6000fd5b600082612df48584612ffb565b14949350505050565b6000806000612e0c85856130a7565b90925090506000816004811115612e2557612e256141f7565b148015612e5d57508573ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff16145b15612e6d57600192505050612747565b6000808773ffffffffffffffffffffffffffffffffffffffff16631626ba7e60e01b8888604051602401612ea2929190614226565b604080517fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe08184030181529181526020820180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff167fffffffff00000000000000000000000000000000000000000000000000000000909416939093179092529051612f2b919061423f565b600060405180830381855afa9150503d8060008114612f66576040519150601f19603f3d011682016040523d82523d6000602084013e612f6b565b606091505b5091509150818015612f7e575080516020145b8015612fe0575080517f1626ba7e0000000000000000000000000000000000000000000000000000000090612fbc908301602090810190840161425b565b7fffffffff0000000000000000000000000000000000000000000000000000000016145b98975050505050505050565b60606127448484600085613117565b600081815b845181101561309f57600085828151811061301d5761301d613d5c565b6020026020010151905080831161305f57604080516020810185905290810182905260600160405160208183030381529060405280519060200120925061308c565b60408051602081018390529081018490526060016040516020818303038152906040528051906020012092505b508061309781613e81565b915050613000565b509392505050565b6000808251604114156130de5760208301516040840151606085015160001a6130d287828585613297565b94509450505050613110565b82516040141561310857602083015160408401516130fd8683836133af565b935093505050613110565b506000905060025b9250929050565b6060824710156131a9576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602660248201527f416464726573733a20696e73756666696369656e742062616c616e636520666f60448201527f722063616c6c0000000000000000000000000000000000000000000000000000606482015260840161068f565b843b613211576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e7472616374000000604482015260640161068f565b6000808673ffffffffffffffffffffffffffffffffffffffff16858760405161323a919061423f565b60006040518083038185875af1925050503d8060008114613277576040519150601f19603f3d011682016040523d82523d6000602084013e61327c565b606091505b509150915061328c8282866133f7565b979650505050505050565b6000807f7fffffffffffffffffffffffffffffff5d576e7357a4501ddfe92f46681b20a08311156132ce57506000905060036133a6565b8460ff16601b141580156132e657508460ff16601c14155b156132f757506000905060046133a6565b6040805160008082526020820180845289905260ff881692820192909252606081018690526080810185905260019060a0016020604051602081039080840390855afa15801561334b573d6000803e3d6000fd5b50506040517fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0015191505073ffffffffffffffffffffffffffffffffffffffff811661339f576000600192509250506133a6565b9150600090505b94509492505050565b6000807f7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff831660ff84901c601b016133e987828885613297565b935093505050935093915050565b60608315613406575081612747565b8251156134165782518084602001fd5b816040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161068f9190613e6e565b803573ffffffffffffffffffffffffffffffffffffffff8116811461346e57600080fd5b919050565b60006020828403121561348557600080fd5b6127478261344a565b6000602082840312156134a057600080fd5b5035919050565b801515811461071a57600080fd5b6000806000606084860312156134ca57600080fd5b6134d38461344a565b92506020840135915060408401356134ea816134a7565b809150509250925092565b803563ffffffff8116811461346e57600080fd5b60006020828403121561351b57600080fd5b612747826134f5565b803567ffffffffffffffff8116811461346e57600080fd5b60008060008060008060c0878903121561355557600080fd5b61355e8761344a565b955061356c6020880161344a565b9450604087013593506060870135925061358860808801613524565b915061359660a088016134f5565b90509295509295509295565b600080604083850312156135b557600080fd5b50508035926020909101359150565b600080604083850312156135d757600080fd5b6135e08361344a565b946020939093013593505050565b6000806000806000806000806000806101408b8d03121561360e57600080fd5b6136178b61344a565b995061362560208c0161344a565b985061363360408c0161344a565b975060608b0135965060808b0135955060a08b0135945060c08b0135935061365d60e08c01613524565b925061366c6101008c01613524565b915061367b6101208c016134f5565b90509295989b9194979a5092959850565b6000806020838503121561369f57600080fd5b823567ffffffffffffffff808211156136b757600080fd5b818501915085601f8301126136cb57600080fd5b8135818111156136da57600080fd5b8660208260051b85010111156136ef57600080fd5b60209290920196919550909350505050565b60005b8381101561371c578181015183820152602001613704565b838111156122165750506000910152565b60008151808452613745816020860160208601613701565b601f017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0169290920160200192915050565b6000602080830181845280855180835260408601915060408160051b870101925083870160005b828110156137ea577fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc08886030184526137d885835161372d565b9450928501929085019060010161379e565b5092979650505050505050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b60405160c0810167ffffffffffffffff81118282101715613849576138496137f7565b60405290565b604051601f82017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe016810167ffffffffffffffff81118282101715613896576138966137f7565b604052919050565b600067ffffffffffffffff8211156138b8576138b86137f7565b5060051b60200190565b600082601f8301126138d357600080fd5b813560206138e86138e38361389e565b61384f565b82815260059290921b8401810191818101908684111561390757600080fd5b8286015b84811015613922578035835291830191830161390b565b509695505050505050565b600082601f83011261393e57600080fd5b8135602061394e6138e38361389e565b82815260059290921b8401810191818101908684111561396d57600080fd5b8286015b84811015613922576139828161344a565b8352918301918301613971565b6000806000606084860312156139a457600080fd5b6139ad846134f5565b9250602084013567ffffffffffffffff808211156139ca57600080fd5b9085019060c082880312156139de57600080fd5b6139e6613826565b8235815260208301356020820152604083013582811115613a0657600080fd5b613a12898286016138c2565b604083015250613a24606084016134f5565b6060820152613a356080840161344a565b608082015260a083013582811115613a4c57600080fd5b613a588982860161392d565b60a08301525093506040860135915080821115613a7457600080fd5b50613a81868287016138c2565b9150509250925092565b6000806000806000806000806000806101408b8d031215613aab57600080fd5b613ab48b61344a565b9950613ac260208c0161344a565b9850613ad060408c0161344a565b975060608b0135965060808b01359550613aec60a08c01613524565b9450613afa60c08c01613524565b9350613b0860e08c016134f5565b9250613b176101008c016134f5565b91506101208b013567ffffffffffffffff811115613b3457600080fd5b613b408d828e016138c2565b9150509295989b9194979a5092959850565b600067ffffffffffffffff821115613b6c57613b6c6137f7565b50601f017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe01660200190565b600082601f830112613ba957600080fd5b8135613bb76138e382613b52565b818152846020838601011115613bcc57600080fd5b816020850160208301376000918101602001919091529392505050565b6000806000806000806000806000806000806101808d8f031215613c0c57600080fd5b613c158d61344a565b9b50613c2360208e0161344a565b9a50613c3160408e0161344a565b995060608d0135985060808d0135975060a08d0135965060c08d01359550613c5b60e08e01613524565b9450613c6a6101008e01613524565b9350613c796101208e01613524565b9250613c886101408e016134f5565b915067ffffffffffffffff6101608e01351115613ca457600080fd5b613cb58e6101608f01358f01613b98565b90509295989b509295989b509295989b565b600060208284031215613cd957600080fd5b5051919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b600063ffffffff83811690831681811015613d2c57613d2c613ce0565b039392505050565b600063ffffffff808316818516808303821115613d5357613d53613ce0565b01949350505050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b60008083357fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe1843603018112613dc057600080fd5b83018035915067ffffffffffffffff821115613ddb57600080fd5b60200191503681900382131561311057600080fd5b8183823760009101908152919050565b600060208284031215613e1257600080fd5b815167ffffffffffffffff811115613e2957600080fd5b8201601f81018413613e3a57600080fd5b8051613e486138e382613b52565b818152856020838501011115613e5d57600080fd5b612603826020830160208601613701565b602081526000612747602083018461372d565b60007fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff821415613eb357613eb3613ce0565b5060010190565b600063ffffffff80831681811415613ed457613ed4613ce0565b6001019392505050565b600081518084526020808501945080840160005b83811015613f0e57815187529582019590820190600101613ef2565b509495945050505050565b600081518084526020808501945080840160005b83811015613f0e57815173ffffffffffffffffffffffffffffffffffffffff1687529582019590820190600101613f2d565b85815284602082015260a060408201526000613f7e60a0830186613ede565b73ffffffffffffffffffffffffffffffffffffffff851660608401528281036080840152612fe08185613f19565b60006101008201905073ffffffffffffffffffffffffffffffffffffffff80845116835280602085015116602084015280604085015116604084015250606083015160608301526080830151608083015260a083015167ffffffffffffffff80821660a08501528060c08601511660c0850152505060e08301516113a960e084018263ffffffff169052565b600067ffffffffffffffff808316818516808303821115613d5357613d53613ce0565b60008282101561406d5761406d613ce0565b500390565b6000821982111561408557614085613ce0565b500190565b6020815281516020820152602082015160408201526000604083015160c060608401526140ba60e0840182613ede565b905063ffffffff606085015116608084015273ffffffffffffffffffffffffffffffffffffffff60808501511660a084015260a08401517fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe08483030160c08501526126038282613f19565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601260045260246000fd5b60008261416357614163614125565b500490565b60008261417757614177614125565b500690565b60006020828403121561418e57600080fd5b8151612747816134a7565b600067ffffffffffffffff83811690831681811015613d2c57613d2c613ce0565b6000817fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff04831182151516156141f2576141f2613ce0565b500290565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052602160045260246000fd5b828152604060208201526000612744604083018461372d565b60008251614251818460208701613701565b9190910192915050565b60006020828403121561426d57600080fd5b81517fffffffff000000000000000000000000000000000000000000000000000000008116811461274757600080fdfea264697066735822122034e62a2d7a0c316af494fc65ff7a902b6f838e6440b399cb3e9b88ee19ec45a964736f6c634300080b0033", + "solcInputHash": "c8b9349311d8b5049b613ac98eb998d0", + "metadata": "{\"compiler\":{\"version\":\"0.8.13+commit.abaa5c0e\"},\"language\":\"Solidity\",\"output\":{\"abi\":[{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_hubPool\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"_wethAddress\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"timerAddress\",\"type\":\"address\"}],\"stateMutability\":\"nonpayable\",\"type\":\"constructor\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"uint256\",\"name\":\"rootBundleId\",\"type\":\"uint256\"}],\"name\":\"EmergencyDeleteRootBundle\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"originToken\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"uint256\",\"name\":\"destinationChainId\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"bool\",\"name\":\"enabled\",\"type\":\"bool\"}],\"name\":\"EnabledDepositRoute\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"amountToReturn\",\"type\":\"uint256\"},{\"indexed\":true,\"internalType\":\"uint256\",\"name\":\"chainId\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"uint256[]\",\"name\":\"refundAmounts\",\"type\":\"uint256[]\"},{\"indexed\":true,\"internalType\":\"uint32\",\"name\":\"rootBundleId\",\"type\":\"uint32\"},{\"indexed\":true,\"internalType\":\"uint32\",\"name\":\"leafId\",\"type\":\"uint32\"},{\"indexed\":false,\"internalType\":\"address\",\"name\":\"l2TokenAddress\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"address[]\",\"name\":\"refundAddresses\",\"type\":\"address[]\"},{\"indexed\":false,\"internalType\":\"address\",\"name\":\"caller\",\"type\":\"address\"}],\"name\":\"ExecutedRelayerRefundRoot\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"bytes32\",\"name\":\"relayHash\",\"type\":\"bytes32\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"totalFilledAmount\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"fillAmount\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"repaymentChainId\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"originChainId\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"destinationChainId\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"uint64\",\"name\":\"relayerFeePct\",\"type\":\"uint64\"},{\"indexed\":false,\"internalType\":\"uint64\",\"name\":\"realizedLpFeePct\",\"type\":\"uint64\"},{\"indexed\":false,\"internalType\":\"uint32\",\"name\":\"depositId\",\"type\":\"uint32\"},{\"indexed\":false,\"internalType\":\"address\",\"name\":\"destinationToken\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"relayer\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"depositor\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"address\",\"name\":\"recipient\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"bool\",\"name\":\"isSlowRelay\",\"type\":\"bool\"}],\"name\":\"FilledRelay\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"originChainId\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"destinationChainId\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"uint64\",\"name\":\"relayerFeePct\",\"type\":\"uint64\"},{\"indexed\":true,\"internalType\":\"uint32\",\"name\":\"depositId\",\"type\":\"uint32\"},{\"indexed\":false,\"internalType\":\"uint32\",\"name\":\"quoteTimestamp\",\"type\":\"uint32\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"originToken\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"address\",\"name\":\"recipient\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"depositor\",\"type\":\"address\"}],\"name\":\"FundsDeposited\",\"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\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"uint32\",\"name\":\"rootBundleId\",\"type\":\"uint32\"},{\"indexed\":false,\"internalType\":\"bytes32\",\"name\":\"relayerRefundRoot\",\"type\":\"bytes32\"},{\"indexed\":false,\"internalType\":\"bytes32\",\"name\":\"slowRelayRoot\",\"type\":\"bytes32\"}],\"name\":\"RelayedRootBundle\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"uint64\",\"name\":\"newRelayerFeePct\",\"type\":\"uint64\"},{\"indexed\":true,\"internalType\":\"uint32\",\"name\":\"depositId\",\"type\":\"uint32\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"depositor\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"bytes\",\"name\":\"depositorSignature\",\"type\":\"bytes\"}],\"name\":\"RequestedSpeedUpDeposit\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"uint32\",\"name\":\"newBuffer\",\"type\":\"uint32\"}],\"name\":\"SetDepositQuoteTimeBuffer\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"newHubPool\",\"type\":\"address\"}],\"name\":\"SetHubPool\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"newAdmin\",\"type\":\"address\"}],\"name\":\"SetXDomainAdmin\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"amountToReturn\",\"type\":\"uint256\"},{\"indexed\":true,\"internalType\":\"uint256\",\"name\":\"chainId\",\"type\":\"uint256\"},{\"indexed\":true,\"internalType\":\"uint32\",\"name\":\"leafId\",\"type\":\"uint32\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"l2TokenAddress\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"address\",\"name\":\"caller\",\"type\":\"address\"}],\"name\":\"TokensBridged\",\"type\":\"event\"},{\"inputs\":[],\"name\":\"chainId\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"crossDomainAdmin\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"recipient\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"originToken\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"destinationChainId\",\"type\":\"uint256\"},{\"internalType\":\"uint64\",\"name\":\"relayerFeePct\",\"type\":\"uint64\"},{\"internalType\":\"uint32\",\"name\":\"quoteTimestamp\",\"type\":\"uint32\"}],\"name\":\"deposit\",\"outputs\":[],\"stateMutability\":\"payable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"depositQuoteTimeBuffer\",\"outputs\":[{\"internalType\":\"uint32\",\"name\":\"\",\"type\":\"uint32\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"rootBundleId\",\"type\":\"uint256\"}],\"name\":\"emergencyDeleteRootBundle\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"name\":\"enabledDepositRoutes\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint32\",\"name\":\"rootBundleId\",\"type\":\"uint32\"},{\"components\":[{\"internalType\":\"uint256\",\"name\":\"amountToReturn\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"chainId\",\"type\":\"uint256\"},{\"internalType\":\"uint256[]\",\"name\":\"refundAmounts\",\"type\":\"uint256[]\"},{\"internalType\":\"uint32\",\"name\":\"leafId\",\"type\":\"uint32\"},{\"internalType\":\"address\",\"name\":\"l2TokenAddress\",\"type\":\"address\"},{\"internalType\":\"address[]\",\"name\":\"refundAddresses\",\"type\":\"address[]\"}],\"internalType\":\"struct SpokePoolInterface.RelayerRefundLeaf\",\"name\":\"relayerRefundLeaf\",\"type\":\"tuple\"},{\"internalType\":\"bytes32[]\",\"name\":\"proof\",\"type\":\"bytes32[]\"}],\"name\":\"executeRelayerRefundRoot\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"depositor\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"recipient\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"destinationToken\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"originChainId\",\"type\":\"uint256\"},{\"internalType\":\"uint64\",\"name\":\"realizedLpFeePct\",\"type\":\"uint64\"},{\"internalType\":\"uint64\",\"name\":\"relayerFeePct\",\"type\":\"uint64\"},{\"internalType\":\"uint32\",\"name\":\"depositId\",\"type\":\"uint32\"},{\"internalType\":\"uint32\",\"name\":\"rootBundleId\",\"type\":\"uint32\"},{\"internalType\":\"bytes32[]\",\"name\":\"proof\",\"type\":\"bytes32[]\"}],\"name\":\"executeSlowRelayRoot\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"depositor\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"recipient\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"destinationToken\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"maxTokensToSend\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"repaymentChainId\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"originChainId\",\"type\":\"uint256\"},{\"internalType\":\"uint64\",\"name\":\"realizedLpFeePct\",\"type\":\"uint64\"},{\"internalType\":\"uint64\",\"name\":\"relayerFeePct\",\"type\":\"uint64\"},{\"internalType\":\"uint32\",\"name\":\"depositId\",\"type\":\"uint32\"}],\"name\":\"fillRelay\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"depositor\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"recipient\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"destinationToken\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"maxTokensToSend\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"repaymentChainId\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"originChainId\",\"type\":\"uint256\"},{\"internalType\":\"uint64\",\"name\":\"realizedLpFeePct\",\"type\":\"uint64\"},{\"internalType\":\"uint64\",\"name\":\"relayerFeePct\",\"type\":\"uint64\"},{\"internalType\":\"uint64\",\"name\":\"newRelayerFeePct\",\"type\":\"uint64\"},{\"internalType\":\"uint32\",\"name\":\"depositId\",\"type\":\"uint32\"},{\"internalType\":\"bytes\",\"name\":\"depositorSignature\",\"type\":\"bytes\"}],\"name\":\"fillRelayWithUpdatedFee\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"getCurrentTime\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"hubPool\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes[]\",\"name\":\"data\",\"type\":\"bytes[]\"}],\"name\":\"multicall\",\"outputs\":[{\"internalType\":\"bytes[]\",\"name\":\"results\",\"type\":\"bytes[]\"}],\"stateMutability\":\"payable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"numberOfDeposits\",\"outputs\":[{\"internalType\":\"uint32\",\"name\":\"\",\"type\":\"uint32\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"owner\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"\",\"type\":\"bytes32\"}],\"name\":\"relayFills\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"relayerRefundRoot\",\"type\":\"bytes32\"},{\"internalType\":\"bytes32\",\"name\":\"slowRelayRoot\",\"type\":\"bytes32\"}],\"name\":\"relayRootBundle\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"renounceOwnership\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"name\":\"rootBundles\",\"outputs\":[{\"internalType\":\"bytes32\",\"name\":\"slowRelayRoot\",\"type\":\"bytes32\"},{\"internalType\":\"bytes32\",\"name\":\"relayerRefundRoot\",\"type\":\"bytes32\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"newCrossDomainAdmin\",\"type\":\"address\"}],\"name\":\"setCrossDomainAdmin\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"time\",\"type\":\"uint256\"}],\"name\":\"setCurrentTime\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint32\",\"name\":\"newDepositQuoteTimeBuffer\",\"type\":\"uint32\"}],\"name\":\"setDepositQuoteTimeBuffer\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"originToken\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"destinationChainId\",\"type\":\"uint256\"},{\"internalType\":\"bool\",\"name\":\"enabled\",\"type\":\"bool\"}],\"name\":\"setEnableRoute\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"newHubPool\",\"type\":\"address\"}],\"name\":\"setHubPool\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"depositor\",\"type\":\"address\"},{\"internalType\":\"uint64\",\"name\":\"newRelayerFeePct\",\"type\":\"uint64\"},{\"internalType\":\"uint32\",\"name\":\"depositId\",\"type\":\"uint32\"},{\"internalType\":\"bytes\",\"name\":\"depositorSignature\",\"type\":\"bytes\"}],\"name\":\"speedUpDeposit\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"timerAddress\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"newOwner\",\"type\":\"address\"}],\"name\":\"transferOwnership\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"weth\",\"outputs\":[{\"internalType\":\"contract WETH9\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"stateMutability\":\"payable\",\"type\":\"receive\"}],\"devdoc\":{\"kind\":\"dev\",\"methods\":{\"chainId()\":{\"details\":\"Some L2s like ZKSync don't support the CHAIN_ID opcode so we allow the implementer to override this.\"},\"constructor\":{\"params\":{\"_hubPool\":\"Hub pool address to set. Can be changed by admin.\",\"_wethAddress\":\"Weth address for this network to set.\",\"timerAddress\":\"Timer address to set.\"}},\"deposit(address,address,uint256,uint256,uint64,uint32)\":{\"params\":{\"amount\":\"Amount of tokens to deposit. Will be amount of tokens to receive less fees.\",\"destinationChainId\":\"Denotes network where user will receive funds from SpokePool by a relayer.\",\"originToken\":\"Token to lock into this contract to initiate deposit.\",\"quoteTimestamp\":\"Timestamp used by relayers to compute this deposit's realizedLPFeePct which is paid to LP pool on HubPool.\",\"recipient\":\"Address to receive funds at on destination chain.\",\"relayerFeePct\":\"% of deposit amount taken out to incentivize a fast relayer.\"}},\"emergencyDeleteRootBundle(uint256)\":{\"params\":{\"rootBundleId\":\"Index of the root bundle that needs to be deleted. Note: this is intentionally a uint256 to ensure that a small input range doesn't limit which indices this method is able to reach.\"}},\"executeRelayerRefundRoot(uint32,(uint256,uint256,uint256[],uint32,address,address[]),bytes32[])\":{\"params\":{\"proof\":\"Inclusion proof for this leaf in relayer refund root in root bundle.\",\"relayerRefundLeaf\":\"Contains all data necessary to reconstruct leaf contained in root bundle and to refund relayer. This data structure is explained in detail in the SpokePoolInterface.\",\"rootBundleId\":\"Unique ID of root bundle containing relayer refund root that this leaf is contained in.\"}},\"executeSlowRelayRoot(address,address,address,uint256,uint256,uint64,uint64,uint32,uint32,bytes32[])\":{\"details\":\"This function assumes that the relay's destination chain ID is the current chain ID, which prevents the caller from executing a slow relay intended for another chain on this chain.\",\"params\":{\"amount\":\"Full size of the deposit.\",\"depositId\":\"Unique deposit ID on origin spoke pool.\",\"depositor\":\"Depositor on origin chain who set this chain as the destination chain.\",\"destinationToken\":\"Token to send to recipient. Should be mapped to the origin token, origin chain ID and this chain ID via a mapping on the HubPool.\",\"originChainId\":\"Chain of SpokePool where deposit originated.\",\"proof\":\"Inclusion proof for this leaf in slow relay root in root bundle.\",\"realizedLpFeePct\":\"Fee % based on L1 HubPool utilization at deposit quote time. Deterministic based on quote time.\",\"recipient\":\"Specified recipient on this chain.\",\"relayerFeePct\":\"Original fee % to keep as relayer set by depositor.\",\"rootBundleId\":\"Unique ID of root bundle containing slow relay root that this leaf is contained in.\"}},\"fillRelay(address,address,address,uint256,uint256,uint256,uint256,uint64,uint64,uint32)\":{\"params\":{\"amount\":\"Full size of the deposit.\",\"depositId\":\"Unique deposit ID on origin spoke pool.\",\"depositor\":\"Depositor on origin chain who set this chain as the destination chain.\",\"destinationToken\":\"Token to send to recipient. Should be mapped to the origin token, origin chain ID and this chain ID via a mapping on the HubPool.\",\"maxTokensToSend\":\"Max amount of tokens to send recipient. If higher than amount, then caller will send recipient the full relay amount.\",\"originChainId\":\"Chain of SpokePool where deposit originated.\",\"realizedLpFeePct\":\"Fee % based on L1 HubPool utilization at deposit quote time. Deterministic based on quote time.\",\"recipient\":\"Specified recipient on this chain.\",\"relayerFeePct\":\"Fee % to keep as relayer, specified by depositor.\",\"repaymentChainId\":\"Chain of SpokePool where relayer wants to be refunded after the challenge window has passed.\"}},\"fillRelayWithUpdatedFee(address,address,address,uint256,uint256,uint256,uint256,uint64,uint64,uint64,uint32,bytes)\":{\"params\":{\"amount\":\"Full size of the deposit.\",\"depositId\":\"Unique deposit ID on origin spoke pool.\",\"depositor\":\"Depositor on origin chain who set this chain as the destination chain.\",\"depositorSignature\":\"Depositor-signed message containing updated fee %.\",\"destinationToken\":\"Token to send to recipient. Should be mapped to the origin token, origin chain ID and this chain ID via a mapping on the HubPool.\",\"maxTokensToSend\":\"Max amount of tokens to send recipient. If higher than amount, then caller will send recipient the full relay amount.\",\"newRelayerFeePct\":\"New fee % to keep as relayer also specified by depositor.\",\"originChainId\":\"Chain of SpokePool where deposit originated.\",\"realizedLpFeePct\":\"Fee % based on L1 HubPool utilization at deposit quote time. Deterministic based on quote time.\",\"recipient\":\"Specified recipient on this chain.\",\"relayerFeePct\":\"Original fee % to keep as relayer set by depositor.\",\"repaymentChainId\":\"Chain of SpokePool where relayer wants to be refunded after the challenge window has passed.\"}},\"getCurrentTime()\":{\"returns\":{\"_0\":\"uint for the current Testable timestamp.\"}},\"owner()\":{\"details\":\"Returns the address of the current owner.\"},\"relayRootBundle(bytes32,bytes32)\":{\"params\":{\"relayerRefundRoot\":\"Merkle root containing relayer refund leaves that can be individually executed via executeRelayerRefundRoot().\",\"slowRelayRoot\":\"Merkle root containing slow relay fulfillment leaves that can be individually executed via executeSlowRelayRoot().\"}},\"renounceOwnership()\":{\"details\":\"Leaves the contract without owner. It will not be possible to call `onlyOwner` functions anymore. Can only be called by the current owner. NOTE: Renouncing ownership will leave the contract without an owner, thereby removing any functionality that is only available to the owner.\"},\"setCrossDomainAdmin(address)\":{\"params\":{\"newCrossDomainAdmin\":\"New cross domain admin.\"}},\"setCurrentTime(uint256)\":{\"details\":\"Will revert if not running in test mode.\",\"params\":{\"time\":\"timestamp to set current Testable time to.\"}},\"setDepositQuoteTimeBuffer(uint32)\":{\"params\":{\"newDepositQuoteTimeBuffer\":\"New quote time buffer.\"}},\"setEnableRoute(address,uint256,bool)\":{\"params\":{\"destinationChainId\":\"Chain ID for where depositor wants to receive funds.\",\"enabled\":\"True to enable deposits, False otherwise.\",\"originToken\":\"Token that depositor can deposit to this contract.\"}},\"setHubPool(address)\":{\"params\":{\"newHubPool\":\"New hub pool.\"}},\"speedUpDeposit(address,uint64,uint32,bytes)\":{\"params\":{\"depositId\":\"Deposit to update fee for that originated in this contract.\",\"depositor\":\"Signer of the update fee message who originally submitted the deposit. If the deposit doesn't exist, then the relayer will not be able to fill any relay, so the caller should validate that the depositor did in fact submit a relay.\",\"depositorSignature\":\"Signed message containing the depositor address, this contract chain ID, the updated relayer fee %, and the deposit ID. This signature is produced by signing a hash of data according to the EIP-191 standard. See more in the _verifyUpdateRelayerFeeMessage() comments.\",\"newRelayerFeePct\":\"New relayer fee that relayers can use.\"}},\"transferOwnership(address)\":{\"details\":\"Transfers ownership of the contract to a new account (`newOwner`). Can only be called by the current owner.\"}},\"version\":1},\"userdoc\":{\"kind\":\"user\",\"methods\":{\"chainId()\":{\"notice\":\"Returns chain ID for this network.\"},\"constructor\":{\"notice\":\"Construct the Ethereum SpokePool.\"},\"deposit(address,address,uint256,uint256,uint64,uint32)\":{\"notice\":\"Called by user to bridge funds from origin to destination chain. Depositor will effectively lock tokens in this contract and receive a destination token on the destination chain. The origin => destination token mapping is stored on the L1 HubPool.The caller must first approve this contract to spend amount of originToken.The originToken => destinationChainId must be enabled.This method is payable because the caller is able to deposit ETH if the originToken is WETH and this function will handle wrapping ETH.\"},\"emergencyDeleteRootBundle(uint256)\":{\"notice\":\"This method is intended to only be used in emergencies where a bad root bundle has reached the SpokePool.\"},\"executeRelayerRefundRoot(uint32,(uint256,uint256,uint256[],uint32,address,address[]),bytes32[])\":{\"notice\":\"Executes a relayer refund leaf stored as part of a root bundle. Will send the relayer the amount they sent to the recipient plus a relayer fee.\"},\"executeSlowRelayRoot(address,address,address,uint256,uint256,uint64,uint64,uint32,uint32,bytes32[])\":{\"notice\":\"Executes a slow relay leaf stored as part of a root bundle. Will send the full amount remaining in the relay to the recipient, less fees.\"},\"fillRelay(address,address,address,uint256,uint256,uint256,uint256,uint64,uint64,uint32)\":{\"notice\":\"Called by relayer to fulfill part of a deposit by sending destination tokens to the recipient. Relayer is expected to pass in unique identifying information for deposit that they want to fulfill, and this relay submission will be validated by off-chain data workers who can dispute this relay if any part is invalid. If the relay is valid, then the relayer will be refunded on their desired repayment chain. If relay is invalid, then relayer will not receive any refund.All of the deposit data can be found via on-chain events from the origin SpokePool, except for the realizedLpFeePct which is a function of the HubPool's utilization at the deposit quote time. This fee % is deterministic based on the quote time, so the relayer should just compute it using the canonical algorithm as described in a UMIP linked to the HubPool's identifier.\"},\"fillRelayWithUpdatedFee(address,address,address,uint256,uint256,uint256,uint256,uint64,uint64,uint64,uint32,bytes)\":{\"notice\":\"Called by relayer to execute same logic as calling fillRelay except that relayer is using an updated relayer fee %. The fee % must have been emitted in a message cryptographically signed by the depositor.By design, the depositor probably emitted the message with the updated fee by calling speedUpRelay().\"},\"getCurrentTime()\":{\"notice\":\"Gets the current time. Will return the last time set in `setCurrentTime` if running in test mode. Otherwise, it will return the block timestamp.\"},\"relayRootBundle(bytes32,bytes32)\":{\"notice\":\"This method stores a new root bundle in this contract that can be executed to refund relayers, fulfill slow relays, and send funds back to the HubPool on L1. This method can only be called by the admin and is designed to be called as part of a cross-chain message from the HubPool's executeRootBundle method.\"},\"setCrossDomainAdmin(address)\":{\"notice\":\"Change cross domain admin address. Callable by admin only.\"},\"setCurrentTime(uint256)\":{\"notice\":\"Sets the current time.\"},\"setDepositQuoteTimeBuffer(uint32)\":{\"notice\":\"Change allowance for deposit quote time to differ from current block time. Callable by admin only.\"},\"setEnableRoute(address,uint256,bool)\":{\"notice\":\"Enable/Disable an origin token => destination chain ID route for deposits. Callable by admin only.\"},\"setHubPool(address)\":{\"notice\":\"Change L1 hub pool address. Callable by admin only.\"},\"speedUpDeposit(address,uint64,uint32,bytes)\":{\"notice\":\"Convenience method that depositor can use to signal to relayer to use updated fee.Relayer should only use events emitted by this function to submit fills with updated fees, otherwise they risk their fills getting disputed for being invalid, for example if the depositor never actually signed the update fee message.This function will revert if the depositor did not sign a message containing the updated fee for the deposit ID stored in this contract. If the deposit ID is for another contract, or the depositor address is incorrect, or the updated fee is incorrect, then the signature will not match and this function will revert.\"}},\"notice\":\"Ethereum L1 specific SpokePool. Used on Ethereum L1 to facilitate L2->L1 transfers.\",\"version\":1}},\"settings\":{\"compilationTarget\":{\"contracts/Ethereum_SpokePool.sol\":\"Ethereum_SpokePool\"},\"evmVersion\":\"london\",\"libraries\":{},\"metadata\":{\"bytecodeHash\":\"ipfs\",\"useLiteralContent\":true},\"optimizer\":{\"enabled\":true,\"runs\":1000000},\"remappings\":[]},\"sources\":{\"@openzeppelin/contracts/access/Ownable.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts v4.4.1 (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 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 called by any account other than the owner.\\n */\\n modifier onlyOwner() {\\n require(owner() == _msgSender(), \\\"Ownable: caller is not the owner\\\");\\n _;\\n }\\n\\n /**\\n * @dev Leaves the contract without owner. It will not be possible to call\\n * `onlyOwner` functions anymore. Can only be called by the current owner.\\n *\\n * NOTE: Renouncing ownership will leave the contract without an owner,\\n * thereby removing 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\",\"keccak256\":\"0x24e0364e503a9bbde94c715d26573a76f14cd2a202d45f96f52134ab806b67b9\",\"license\":\"MIT\"},\"@openzeppelin/contracts/token/ERC20/IERC20.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.5.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 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(\\n address from,\\n address to,\\n uint256 amount\\n ) external returns (bool);\\n\\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\",\"keccak256\":\"0xbbc8ac883ac3c0078ce5ad3e288fbb3ffcc8a30c3a98c0fda0114d64fc44fca2\",\"license\":\"MIT\"},\"@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts v4.4.1 (token/ERC20/utils/SafeERC20.sol)\\n\\npragma solidity ^0.8.0;\\n\\nimport \\\"../IERC20.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 function safeTransfer(\\n IERC20 token,\\n address to,\\n uint256 value\\n ) internal {\\n _callOptionalReturn(token, abi.encodeWithSelector(token.transfer.selector, to, value));\\n }\\n\\n function safeTransferFrom(\\n IERC20 token,\\n address from,\\n address to,\\n uint256 value\\n ) 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(\\n IERC20 token,\\n address spender,\\n uint256 value\\n ) 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 function safeIncreaseAllowance(\\n IERC20 token,\\n address spender,\\n uint256 value\\n ) internal {\\n uint256 newAllowance = token.allowance(address(this), spender) + value;\\n _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, newAllowance));\\n }\\n\\n function safeDecreaseAllowance(\\n IERC20 token,\\n address spender,\\n uint256 value\\n ) internal {\\n unchecked {\\n uint256 oldAllowance = token.allowance(address(this), spender);\\n require(oldAllowance >= value, \\\"SafeERC20: decreased allowance below zero\\\");\\n uint256 newAllowance = oldAllowance - value;\\n _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, newAllowance));\\n }\\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 if (returndata.length > 0) {\\n // Return data is optional\\n require(abi.decode(returndata, (bool)), \\\"SafeERC20: ERC20 operation did not succeed\\\");\\n }\\n }\\n}\\n\",\"keccak256\":\"0xc3d946432c0ddbb1f846a0d3985be71299df331b91d06732152117f62f0be2b5\",\"license\":\"MIT\"},\"@openzeppelin/contracts/utils/Address.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.5.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 *\\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://diligence.consensys.net/posts/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.5.11/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 functionCall(target, data, \\\"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(\\n address target,\\n bytes memory data,\\n uint256 value\\n ) 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 require(isContract(target), \\\"Address: call to non-contract\\\");\\n\\n (bool success, bytes memory returndata) = target.call{value: value}(data);\\n return verifyCallResult(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 require(isContract(target), \\\"Address: static call to non-contract\\\");\\n\\n (bool success, bytes memory returndata) = target.staticcall(data);\\n return verifyCallResult(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 require(isContract(target), \\\"Address: delegate call to non-contract\\\");\\n\\n (bool success, bytes memory returndata) = target.delegatecall(data);\\n return verifyCallResult(success, returndata, errorMessage);\\n }\\n\\n /**\\n * @dev Tool to verifies that a low level call was successful, and revert if it wasn't, either by bubbling the\\n * revert reason 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 // 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\\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}\\n\",\"keccak256\":\"0x2ccf9d2313a313d41a791505f2b5abfdc62191b5d4334f7f7a82691c088a1c87\",\"license\":\"MIT\"},\"@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\",\"keccak256\":\"0xe2e337e6dde9ef6b680e07338c493ebea1b5fd09b43424112868e9cc1706bca7\",\"license\":\"MIT\"},\"@openzeppelin/contracts/utils/Strings.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts v4.4.1 (utils/Strings.sol)\\n\\npragma solidity ^0.8.0;\\n\\n/**\\n * @dev String operations.\\n */\\nlibrary Strings {\\n bytes16 private constant _HEX_SYMBOLS = \\\"0123456789abcdef\\\";\\n\\n /**\\n * @dev Converts a `uint256` to its ASCII `string` decimal representation.\\n */\\n function toString(uint256 value) internal pure returns (string memory) {\\n // Inspired by OraclizeAPI's implementation - MIT licence\\n // https://github.com/oraclize/ethereum-api/blob/b42146b063c7d6ee1358846c198246239e9360e8/oraclizeAPI_0.4.25.sol\\n\\n if (value == 0) {\\n return \\\"0\\\";\\n }\\n uint256 temp = value;\\n uint256 digits;\\n while (temp != 0) {\\n digits++;\\n temp /= 10;\\n }\\n bytes memory buffer = new bytes(digits);\\n while (value != 0) {\\n digits -= 1;\\n buffer[digits] = bytes1(uint8(48 + uint256(value % 10)));\\n value /= 10;\\n }\\n return string(buffer);\\n }\\n\\n /**\\n * @dev Converts a `uint256` to its ASCII `string` hexadecimal representation.\\n */\\n function toHexString(uint256 value) internal pure returns (string memory) {\\n if (value == 0) {\\n return \\\"0x00\\\";\\n }\\n uint256 temp = value;\\n uint256 length = 0;\\n while (temp != 0) {\\n length++;\\n temp >>= 8;\\n }\\n return toHexString(value, length);\\n }\\n\\n /**\\n * @dev Converts a `uint256` to its ASCII `string` hexadecimal representation with fixed length.\\n */\\n function toHexString(uint256 value, uint256 length) internal pure returns (string memory) {\\n bytes memory buffer = new bytes(2 * length + 2);\\n buffer[0] = \\\"0\\\";\\n buffer[1] = \\\"x\\\";\\n for (uint256 i = 2 * length + 1; i > 1; --i) {\\n buffer[i] = _HEX_SYMBOLS[value & 0xf];\\n value >>= 4;\\n }\\n require(value == 0, \\\"Strings: hex length insufficient\\\");\\n return string(buffer);\\n }\\n}\\n\",\"keccak256\":\"0x32c202bd28995dd20c4347b7c6467a6d3241c74c8ad3edcbb610cd9205916c45\",\"license\":\"MIT\"},\"@openzeppelin/contracts/utils/cryptography/ECDSA.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.5.0) (utils/cryptography/ECDSA.sol)\\n\\npragma solidity ^0.8.0;\\n\\nimport \\\"../Strings.sol\\\";\\n\\n/**\\n * @dev Elliptic Curve Digital Signature Algorithm (ECDSA) operations.\\n *\\n * These functions can be used to verify that a message was signed by the holder\\n * of the private keys of a given address.\\n */\\nlibrary ECDSA {\\n enum RecoverError {\\n NoError,\\n InvalidSignature,\\n InvalidSignatureLength,\\n InvalidSignatureS,\\n InvalidSignatureV\\n }\\n\\n function _throwError(RecoverError error) private pure {\\n if (error == RecoverError.NoError) {\\n return; // no error: do nothing\\n } else if (error == RecoverError.InvalidSignature) {\\n revert(\\\"ECDSA: invalid signature\\\");\\n } else if (error == RecoverError.InvalidSignatureLength) {\\n revert(\\\"ECDSA: invalid signature length\\\");\\n } else if (error == RecoverError.InvalidSignatureS) {\\n revert(\\\"ECDSA: invalid signature 's' value\\\");\\n } else if (error == RecoverError.InvalidSignatureV) {\\n revert(\\\"ECDSA: invalid signature 'v' value\\\");\\n }\\n }\\n\\n /**\\n * @dev Returns the address that signed a hashed message (`hash`) with\\n * `signature` or error string. This address can then be used for verification purposes.\\n *\\n * The `ecrecover` EVM opcode allows for malleable (non-unique) signatures:\\n * this function rejects them by requiring the `s` value to be in the lower\\n * half order, and the `v` value to be either 27 or 28.\\n *\\n * IMPORTANT: `hash` _must_ be the result of a hash operation for the\\n * verification to be secure: it is possible to craft signatures that\\n * recover to arbitrary addresses for non-hashed data. A safe way to ensure\\n * this is by receiving a hash of the original message (which may otherwise\\n * be too long), and then calling {toEthSignedMessageHash} on it.\\n *\\n * Documentation for signature generation:\\n * - with https://web3js.readthedocs.io/en/v1.3.4/web3-eth-accounts.html#sign[Web3.js]\\n * - with https://docs.ethers.io/v5/api/signer/#Signer-signMessage[ethers]\\n *\\n * _Available since v4.3._\\n */\\n function tryRecover(bytes32 hash, bytes memory signature) internal pure returns (address, RecoverError) {\\n // Check the signature length\\n // - case 65: r,s,v signature (standard)\\n // - case 64: r,vs signature (cf https://eips.ethereum.org/EIPS/eip-2098) _Available since v4.1._\\n if (signature.length == 65) {\\n bytes32 r;\\n bytes32 s;\\n uint8 v;\\n // ecrecover takes the signature parameters, and the only way to get them\\n // currently is to use assembly.\\n assembly {\\n r := mload(add(signature, 0x20))\\n s := mload(add(signature, 0x40))\\n v := byte(0, mload(add(signature, 0x60)))\\n }\\n return tryRecover(hash, v, r, s);\\n } else if (signature.length == 64) {\\n bytes32 r;\\n bytes32 vs;\\n // ecrecover takes the signature parameters, and the only way to get them\\n // currently is to use assembly.\\n assembly {\\n r := mload(add(signature, 0x20))\\n vs := mload(add(signature, 0x40))\\n }\\n return tryRecover(hash, r, vs);\\n } else {\\n return (address(0), RecoverError.InvalidSignatureLength);\\n }\\n }\\n\\n /**\\n * @dev Returns the address that signed a hashed message (`hash`) with\\n * `signature`. This address can then be used for verification purposes.\\n *\\n * The `ecrecover` EVM opcode allows for malleable (non-unique) signatures:\\n * this function rejects them by requiring the `s` value to be in the lower\\n * half order, and the `v` value to be either 27 or 28.\\n *\\n * IMPORTANT: `hash` _must_ be the result of a hash operation for the\\n * verification to be secure: it is possible to craft signatures that\\n * recover to arbitrary addresses for non-hashed data. A safe way to ensure\\n * this is by receiving a hash of the original message (which may otherwise\\n * be too long), and then calling {toEthSignedMessageHash} on it.\\n */\\n function recover(bytes32 hash, bytes memory signature) internal pure returns (address) {\\n (address recovered, RecoverError error) = tryRecover(hash, signature);\\n _throwError(error);\\n return recovered;\\n }\\n\\n /**\\n * @dev Overload of {ECDSA-tryRecover} that receives the `r` and `vs` short-signature fields separately.\\n *\\n * See https://eips.ethereum.org/EIPS/eip-2098[EIP-2098 short signatures]\\n *\\n * _Available since v4.3._\\n */\\n function tryRecover(\\n bytes32 hash,\\n bytes32 r,\\n bytes32 vs\\n ) internal pure returns (address, RecoverError) {\\n bytes32 s = vs & bytes32(0x7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff);\\n uint8 v = uint8((uint256(vs) >> 255) + 27);\\n return tryRecover(hash, v, r, s);\\n }\\n\\n /**\\n * @dev Overload of {ECDSA-recover} that receives the `r and `vs` short-signature fields separately.\\n *\\n * _Available since v4.2._\\n */\\n function recover(\\n bytes32 hash,\\n bytes32 r,\\n bytes32 vs\\n ) internal pure returns (address) {\\n (address recovered, RecoverError error) = tryRecover(hash, r, vs);\\n _throwError(error);\\n return recovered;\\n }\\n\\n /**\\n * @dev Overload of {ECDSA-tryRecover} that receives the `v`,\\n * `r` and `s` signature fields separately.\\n *\\n * _Available since v4.3._\\n */\\n function tryRecover(\\n bytes32 hash,\\n uint8 v,\\n bytes32 r,\\n bytes32 s\\n ) internal pure returns (address, RecoverError) {\\n // EIP-2 still allows signature malleability for ecrecover(). Remove this possibility and make the signature\\n // unique. Appendix F in the Ethereum Yellow paper (https://ethereum.github.io/yellowpaper/paper.pdf), defines\\n // the valid range for s in (301): 0 < s < secp256k1n \\u00f7 2 + 1, and for v in (302): v \\u2208 {27, 28}. Most\\n // signatures from current libraries generate a unique signature with an s-value in the lower half order.\\n //\\n // If your library generates malleable signatures, such as s-values in the upper range, calculate a new s-value\\n // with 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFEBAAEDCE6AF48A03BBFD25E8CD0364141 - s1 and flip v from 27 to 28 or\\n // vice versa. If your library also generates signatures with 0/1 for v instead 27/28, add 27 to v to accept\\n // these malleable signatures as well.\\n if (uint256(s) > 0x7FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF5D576E7357A4501DDFE92F46681B20A0) {\\n return (address(0), RecoverError.InvalidSignatureS);\\n }\\n if (v != 27 && v != 28) {\\n return (address(0), RecoverError.InvalidSignatureV);\\n }\\n\\n // If the signature is valid (and not malleable), return the signer address\\n address signer = ecrecover(hash, v, r, s);\\n if (signer == address(0)) {\\n return (address(0), RecoverError.InvalidSignature);\\n }\\n\\n return (signer, RecoverError.NoError);\\n }\\n\\n /**\\n * @dev Overload of {ECDSA-recover} that receives the `v`,\\n * `r` and `s` signature fields separately.\\n */\\n function recover(\\n bytes32 hash,\\n uint8 v,\\n bytes32 r,\\n bytes32 s\\n ) internal pure returns (address) {\\n (address recovered, RecoverError error) = tryRecover(hash, v, r, s);\\n _throwError(error);\\n return recovered;\\n }\\n\\n /**\\n * @dev Returns an Ethereum Signed Message, created from a `hash`. This\\n * produces hash corresponding to the one signed with the\\n * https://eth.wiki/json-rpc/API#eth_sign[`eth_sign`]\\n * JSON-RPC method as part of EIP-191.\\n *\\n * See {recover}.\\n */\\n function toEthSignedMessageHash(bytes32 hash) internal pure returns (bytes32) {\\n // 32 is the length in bytes of hash,\\n // enforced by the type signature above\\n return keccak256(abi.encodePacked(\\\"\\\\x19Ethereum Signed Message:\\\\n32\\\", hash));\\n }\\n\\n /**\\n * @dev Returns an Ethereum Signed Message, created from `s`. This\\n * produces hash corresponding to the one signed with the\\n * https://eth.wiki/json-rpc/API#eth_sign[`eth_sign`]\\n * JSON-RPC method as part of EIP-191.\\n *\\n * See {recover}.\\n */\\n function toEthSignedMessageHash(bytes memory s) internal pure returns (bytes32) {\\n return keccak256(abi.encodePacked(\\\"\\\\x19Ethereum Signed Message:\\\\n\\\", Strings.toString(s.length), s));\\n }\\n\\n /**\\n * @dev Returns an Ethereum Signed Typed Data, created from a\\n * `domainSeparator` and a `structHash`. This produces hash corresponding\\n * to the one signed with the\\n * https://eips.ethereum.org/EIPS/eip-712[`eth_signTypedData`]\\n * JSON-RPC method as part of EIP-712.\\n *\\n * See {recover}.\\n */\\n function toTypedDataHash(bytes32 domainSeparator, bytes32 structHash) internal pure returns (bytes32) {\\n return keccak256(abi.encodePacked(\\\"\\\\x19\\\\x01\\\", domainSeparator, structHash));\\n }\\n}\\n\",\"keccak256\":\"0x3c07f43e60e099b3b157243b3152722e73b80eeb7985c2cd73712828d7f7da29\",\"license\":\"MIT\"},\"@openzeppelin/contracts/utils/cryptography/MerkleProof.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.5.0) (utils/cryptography/MerkleProof.sol)\\n\\npragma solidity ^0.8.0;\\n\\n/**\\n * @dev These functions deal with verification of Merkle Trees proofs.\\n *\\n * The proofs can be generated using the JavaScript library\\n * https://github.com/miguelmota/merkletreejs[merkletreejs].\\n * Note: the hashing algorithm should be keccak256 and pair sorting should be enabled.\\n *\\n * See `test/utils/cryptography/MerkleProof.test.js` for some examples.\\n */\\nlibrary MerkleProof {\\n /**\\n * @dev Returns true if a `leaf` can be proved to be a part of a Merkle tree\\n * defined by `root`. For this, a `proof` must be provided, containing\\n * sibling hashes on the branch from the leaf to the root of the tree. Each\\n * pair of leaves and each pair of pre-images are assumed to be sorted.\\n */\\n function verify(\\n bytes32[] memory proof,\\n bytes32 root,\\n bytes32 leaf\\n ) internal pure returns (bool) {\\n return processProof(proof, leaf) == root;\\n }\\n\\n /**\\n * @dev Returns the rebuilt hash obtained by traversing a Merklee tree up\\n * from `leaf` using `proof`. A `proof` is valid if and only if the rebuilt\\n * hash matches the root of the tree. When processing the proof, the pairs\\n * of leafs & pre-images are assumed to be sorted.\\n *\\n * _Available since v4.4._\\n */\\n function processProof(bytes32[] memory proof, bytes32 leaf) internal pure returns (bytes32) {\\n bytes32 computedHash = leaf;\\n for (uint256 i = 0; i < proof.length; i++) {\\n bytes32 proofElement = proof[i];\\n if (computedHash <= proofElement) {\\n // Hash(current computed hash + current element of the proof)\\n computedHash = _efficientHash(computedHash, proofElement);\\n } else {\\n // Hash(current element of the proof + current computed hash)\\n computedHash = _efficientHash(proofElement, computedHash);\\n }\\n }\\n return computedHash;\\n }\\n\\n function _efficientHash(bytes32 a, bytes32 b) private pure returns (bytes32 value) {\\n assembly {\\n mstore(0x00, a)\\n mstore(0x20, b)\\n value := keccak256(0x00, 0x40)\\n }\\n }\\n}\\n\",\"keccak256\":\"0xea64fbaccbf9d8c235cf6838240ddcebb97f9fc383660289e9dff32e4fb85f7a\",\"license\":\"MIT\"},\"@uma/core/contracts/common/implementation/MultiCaller.sol\":{\"content\":\"// This contract is taken from Uniswaps'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.\\npragma solidity ^0.8.0;\\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 payable returns (bytes[] memory results) {\\n require(msg.value == 0, \\\"Only multicall with 0 value\\\");\\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\",\"keccak256\":\"0x31f18055b14fd9eeb459c6d6a88d1a60921bf3755031f6db4b709c3e01d078f7\"},\"@uma/core/contracts/common/implementation/Testable.sol\":{\"content\":\"// SPDX-License-Identifier: AGPL-3.0-only\\npragma solidity ^0.8.0;\\n\\nimport \\\"./Timer.sol\\\";\\n\\n/**\\n * @title Base class that provides time overrides, but only if being run in test mode.\\n */\\nabstract contract Testable {\\n // If the contract is being run in production, then `timerAddress` will be the 0x0 address.\\n // Note: this variable should be set on construction and never modified.\\n address public timerAddress;\\n\\n /**\\n * @notice Constructs the Testable contract. Called by child contracts.\\n * @param _timerAddress Contract that stores the current time in a testing environment.\\n * Must be set to 0x0 for production environments that use live time.\\n */\\n constructor(address _timerAddress) {\\n timerAddress = _timerAddress;\\n }\\n\\n /**\\n * @notice Reverts if not running in test mode.\\n */\\n modifier onlyIfTest {\\n require(timerAddress != address(0x0));\\n _;\\n }\\n\\n /**\\n * @notice Sets the current time.\\n * @dev Will revert if not running in test mode.\\n * @param time timestamp to set current Testable time to.\\n */\\n function setCurrentTime(uint256 time) external onlyIfTest {\\n Timer(timerAddress).setCurrentTime(time);\\n }\\n\\n /**\\n * @notice Gets the current time. Will return the last time set in `setCurrentTime` if running in test mode.\\n * Otherwise, it will return the block timestamp.\\n * @return uint for the current Testable timestamp.\\n */\\n function getCurrentTime() public view virtual returns (uint256) {\\n if (timerAddress != address(0x0)) {\\n return Timer(timerAddress).getCurrentTime();\\n } else {\\n return block.timestamp; // solhint-disable-line not-rely-on-time\\n }\\n }\\n}\\n\",\"keccak256\":\"0x0254b45747293bb800373a58d123969adec0428f7be79dc941cab10fcad09918\",\"license\":\"AGPL-3.0-only\"},\"@uma/core/contracts/common/implementation/Timer.sol\":{\"content\":\"// SPDX-License-Identifier: AGPL-3.0-only\\npragma solidity ^0.8.0;\\n\\n/**\\n * @title Universal store of current contract time for testing environments.\\n */\\ncontract Timer {\\n uint256 private currentTime;\\n\\n constructor() {\\n currentTime = block.timestamp; // solhint-disable-line not-rely-on-time\\n }\\n\\n /**\\n * @notice Sets the current time.\\n * @dev Will revert if not running in test mode.\\n * @param time timestamp to set `currentTime` to.\\n */\\n function setCurrentTime(uint256 time) external {\\n currentTime = time;\\n }\\n\\n /**\\n * @notice Gets the currentTime variable set in the Timer.\\n * @return uint256 for the current Testable timestamp.\\n */\\n function getCurrentTime() public view returns (uint256) {\\n return currentTime;\\n }\\n}\\n\",\"keccak256\":\"0x9e0dd7389718bd5d1da910273a6f4cee98ee22bfc0c92bde0f0955c0e23adb5e\",\"license\":\"AGPL-3.0-only\"},\"contracts/Ethereum_SpokePool.sol\":{\"content\":\"// SPDX-License-Identifier: GPL-3.0-only\\npragma solidity ^0.8.0;\\n\\nimport \\\"./SpokePool.sol\\\";\\nimport \\\"@openzeppelin/contracts/access/Ownable.sol\\\";\\n\\n/**\\n * @notice Ethereum L1 specific SpokePool. Used on Ethereum L1 to facilitate L2->L1 transfers.\\n */\\ncontract Ethereum_SpokePool is SpokePool, Ownable {\\n /**\\n * @notice Construct the Ethereum SpokePool.\\n * @param _hubPool Hub pool address to set. Can be changed by admin.\\n * @param _wethAddress Weth address for this network to set.\\n * @param timerAddress Timer address to set.\\n */\\n constructor(\\n address _hubPool,\\n address _wethAddress,\\n address timerAddress\\n ) SpokePool(msg.sender, _hubPool, _wethAddress, timerAddress) {}\\n\\n /**************************************\\n * INTERNAL FUNCTIONS *\\n **************************************/\\n\\n function _bridgeTokensToHubPool(RelayerRefundLeaf memory relayerRefundLeaf) internal override {\\n IERC20(relayerRefundLeaf.l2TokenAddress).transfer(hubPool, relayerRefundLeaf.amountToReturn);\\n }\\n\\n // Admin is simply owner which should be same account that owns the HubPool deployed on this network. A core\\n // assumption of this contract system is that the HubPool is deployed on Ethereum.\\n function _requireAdminSender() internal override onlyOwner {}\\n}\\n\",\"keccak256\":\"0xe4bc6410665d75f98cb23420cfd30dc88091204810e0af7847e65debbf8edeea\",\"license\":\"GPL-3.0-only\"},\"contracts/HubPoolInterface.sol\":{\"content\":\"// SPDX-License-Identifier: GPL-3.0-only\\npragma solidity ^0.8.0;\\n\\nimport \\\"./interfaces/AdapterInterface.sol\\\";\\n\\nimport \\\"@openzeppelin/contracts/token/ERC20/IERC20.sol\\\";\\n\\n/**\\n * @notice Concise list of functions in HubPool implementation.\\n */\\ninterface HubPoolInterface {\\n // This leaf is meant to be decoded in the HubPool to rebalance tokens between HubPool and SpokePool.\\n struct PoolRebalanceLeaf {\\n // This is used to know which chain to send cross-chain transactions to (and which SpokePool to send to).\\n uint256 chainId;\\n // Total LP fee amount per token in this bundle, encompassing all associated bundled relays.\\n uint256[] bundleLpFees;\\n // This array is grouped with the two above, and it represents the amount to send or request back from the\\n // SpokePool. If positive, the pool will pay the SpokePool. If negative the SpokePool will pay the HubPool.\\n // There can be arbitrarily complex rebalancing rules defined offchain. This number is only nonzero when the\\n // rules indicate that a rebalancing action should occur. When a rebalance does occur, runningBalances should be\\n // set to zero for this token and the netSendAmounts should be set to the previous runningBalances + relays -\\n // deposits in this bundle. If non-zero then it must be set on the SpokePool's RelayerRefundLeaf amountToReturn\\n // as -1 * this value to indicate if funds are being sent from or to the SpokePool.\\n int256[] netSendAmounts;\\n // This is only here to be emitted in an event to track a running unpaid balance between the L2 pool and the L1\\n // pool. A positive number indicates that the HubPool owes the SpokePool funds. A negative number indicates that\\n // the SpokePool owes the HubPool funds. See the comment above for the dynamics of this and netSendAmounts.\\n int256[] runningBalances;\\n // Used by data worker to mark which leaves should relay roots to SpokePools, and to otherwise organize leaves.\\n // For example, each leaf should contain all the rebalance information for a single chain, but in the case where\\n // the list of l1Tokens is very large such that they all can't fit into a single leaf that can be executed under\\n // the block gas limit, then the data worker can use this groupIndex to organize them. Any leaves with\\n // a groupIndex equal to 0 will relay roots to the SpokePool, so the data worker should ensure that only one\\n // leaf for a specific chainId should have a groupIndex equal to 0.\\n uint256 groupIndex;\\n // Used as the index in the bitmap to track whether this leaf has been executed or not.\\n uint8 leafId;\\n // The following arrays are required to be the same length. They are parallel arrays for the given chainId and\\n // should be ordered by the l1Tokens field. All whitelisted tokens with nonzero relays on this chain in this\\n // bundle in the order of whitelisting.\\n address[] l1Tokens;\\n }\\n\\n // A data worker can optimistically store several merkle roots on this contract by staking a bond and calling\\n // proposeRootBundle. By staking a bond, the data worker is alleging that the merkle roots all contain valid leaves\\n // that can be executed later to:\\n // - Send funds from this contract to a SpokePool or vice versa\\n // - Send funds from a SpokePool to Relayer as a refund for a relayed deposit\\n // - Send funds from a SpokePool to a deposit recipient to fulfill a \\\"slow\\\" relay\\n // Anyone can dispute this struct if the merkle roots contain invalid leaves before the\\n // requestExpirationTimestamp. Once the expiration timestamp is passed, executeRootBundle to execute a leaf\\n // from the poolRebalanceRoot on this contract and it will simultaneously publish the relayerRefundRoot and\\n // slowRelayRoot to a SpokePool. The latter two roots, once published to the SpokePool, contain\\n // leaves that can be executed on the SpokePool to pay relayers or recipients.\\n struct RootBundle {\\n // Contains leaves instructing this contract to send funds to SpokePools.\\n bytes32 poolRebalanceRoot;\\n // Relayer refund merkle root to be published to a SpokePool.\\n bytes32 relayerRefundRoot;\\n // Slow relay merkle root to be published to a SpokePool.\\n bytes32 slowRelayRoot;\\n // This is a 1D bitmap, with max size of 256 elements, limiting us to 256 chainsIds.\\n uint256 claimedBitMap;\\n // Proposer of this root bundle.\\n address proposer;\\n // Number of pool rebalance leaves to execute in the poolRebalanceRoot. After this number\\n // of leaves are executed, a new root bundle can be proposed\\n uint8 unclaimedPoolRebalanceLeafCount;\\n // When root bundle challenge period passes and this root bundle becomes executable.\\n uint32 requestExpirationTimestamp;\\n }\\n\\n // Each whitelisted L1 token has an associated pooledToken struct that contains all information used to track the\\n // cumulative LP positions and if this token is enabled for deposits.\\n struct PooledToken {\\n // LP token given to LPs of a specific L1 token.\\n address lpToken;\\n // True if accepting new LP's.\\n bool isEnabled;\\n // Timestamp of last LP fee update.\\n uint32 lastLpFeeUpdate;\\n // Number of LP funds sent via pool rebalances to SpokePools and are expected to be sent\\n // back later.\\n int256 utilizedReserves;\\n // Number of LP funds held in contract less utilized reserves.\\n uint256 liquidReserves;\\n // Number of LP funds reserved to pay out to LPs as fees.\\n uint256 undistributedLpFees;\\n }\\n\\n // Helper contracts to facilitate cross chain actions between HubPool and SpokePool for a specific network.\\n struct CrossChainContract {\\n address adapter;\\n address spokePool;\\n }\\n\\n function setPaused(bool pause) external;\\n\\n function emergencyDeleteProposal() external;\\n\\n function relaySpokePoolAdminFunction(uint256 chainId, bytes memory functionData) external;\\n\\n function setProtocolFeeCapture(address newProtocolFeeCaptureAddress, uint256 newProtocolFeeCapturePct) external;\\n\\n function setBond(IERC20 newBondToken, uint256 newBondAmount) external;\\n\\n function setLiveness(uint32 newLiveness) external;\\n\\n function setIdentifier(bytes32 newIdentifier) external;\\n\\n function setCrossChainContracts(\\n uint256 l2ChainId,\\n address adapter,\\n address spokePool\\n ) external;\\n\\n function enableL1TokenForLiquidityProvision(address l1Token) external;\\n\\n function disableL1TokenForLiquidityProvision(address l1Token) external;\\n\\n function addLiquidity(address l1Token, uint256 l1TokenAmount) external payable;\\n\\n function removeLiquidity(\\n address l1Token,\\n uint256 lpTokenAmount,\\n bool sendEth\\n ) external;\\n\\n function exchangeRateCurrent(address l1Token) external returns (uint256);\\n\\n function liquidityUtilizationCurrent(address l1Token) external returns (uint256);\\n\\n function liquidityUtilizationPostRelay(address token, uint256 relayedAmount) external returns (uint256);\\n\\n function sync(address l1Token) external;\\n\\n function proposeRootBundle(\\n uint256[] memory bundleEvaluationBlockNumbers,\\n uint8 poolRebalanceLeafCount,\\n bytes32 poolRebalanceRoot,\\n bytes32 relayerRefundRoot,\\n bytes32 slowRelayRoot\\n ) external;\\n\\n function executeRootBundle(\\n uint256 chainId,\\n uint256 groupIndex,\\n uint256[] memory bundleLpFees,\\n int256[] memory netSendAmounts,\\n int256[] memory runningBalances,\\n uint8 leafId,\\n address[] memory l1Tokens,\\n bytes32[] memory proof\\n ) external;\\n\\n function disputeRootBundle() external;\\n\\n function claimProtocolFeesCaptured(address l1Token) external;\\n\\n function setPoolRebalanceRoute(\\n uint256 destinationChainId,\\n address l1Token,\\n address destinationToken\\n ) external;\\n\\n function setDepositRoute(\\n uint256 originChainId,\\n uint256 destinationChainId,\\n address originToken,\\n bool depositsEnabled\\n ) external;\\n\\n function poolRebalanceRoute(uint256 destinationChainId, address l1Token)\\n external\\n view\\n returns (address destinationToken);\\n\\n function loadEthForL2Calls() external payable;\\n}\\n\",\"keccak256\":\"0x71b427ffd4a1e8c0cc681bafe050c536d79464f12559e90172681e6745f2e7bc\",\"license\":\"GPL-3.0-only\"},\"contracts/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 * @dev The reason why we use this local contract instead of importing from uma/contracts is because of the addition\\n * of the internal method `functionCallStackOriginatesFromOutsideThisContract` which doesn't exist in the one exported\\n * by uma/contracts.\\n */\\ncontract Lockable {\\n bool internal _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 /**\\n * @dev Returns true if the contract is currently in a non-entered state, meaning that the origination of the call\\n * came from outside the contract. This is relevant with fallback/receive methods to see if the call came from ETH\\n * being dropped onto the contract externally or due to ETH dropped on the the contract from within a method in this\\n * contract, such as unwrapping WETH to ETH within the contract.\\n */\\n function functionCallStackOriginatesFromOutsideThisContract() internal view returns (bool) {\\n return _notEntered;\\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\",\"keccak256\":\"0xef490be5cb859c97c6f600f3b0db0d50c6e18f334d3c74c6d9e693a260eaec3e\",\"license\":\"AGPL-3.0-only\"},\"contracts/MerkleLib.sol\":{\"content\":\"// SPDX-License-Identifier: GPL-3.0-only\\npragma solidity ^0.8.0;\\n\\nimport \\\"./SpokePoolInterface.sol\\\";\\nimport \\\"./HubPoolInterface.sol\\\";\\n\\nimport \\\"@openzeppelin/contracts/utils/cryptography/MerkleProof.sol\\\";\\n\\n/**\\n * @notice Library to help with merkle roots, proofs, and claims.\\n */\\nlibrary MerkleLib {\\n /**\\n * @notice Verifies that a repayment is contained within a merkle root.\\n * @param root the merkle root.\\n * @param rebalance the rebalance struct.\\n * @param proof the merkle proof.\\n * @return bool to signal if the pool rebalance proof correctly shows inclusion of the rebalance within the tree.\\n */\\n function verifyPoolRebalance(\\n bytes32 root,\\n HubPoolInterface.PoolRebalanceLeaf memory rebalance,\\n bytes32[] memory proof\\n ) internal pure returns (bool) {\\n return MerkleProof.verify(proof, root, keccak256(abi.encode(rebalance)));\\n }\\n\\n /**\\n * @notice Verifies that a relayer refund is contained within a merkle root.\\n * @param root the merkle root.\\n * @param refund the refund struct.\\n * @param proof the merkle proof.\\n * @return bool to signal if the relayer refund proof correctly shows inclusion of the refund within the tree.\\n */\\n function verifyRelayerRefund(\\n bytes32 root,\\n SpokePoolInterface.RelayerRefundLeaf memory refund,\\n bytes32[] memory proof\\n ) internal pure returns (bool) {\\n return MerkleProof.verify(proof, root, keccak256(abi.encode(refund)));\\n }\\n\\n /**\\n * @notice Verifies that a distribution is contained within a merkle root.\\n * @param root the merkle root.\\n * @param slowRelayFulfillment the relayData fulfillment struct.\\n * @param proof the merkle proof.\\n * @return bool to signal if the slow relay's proof correctly shows inclusion of the slow relay within the tree.\\n */\\n function verifySlowRelayFulfillment(\\n bytes32 root,\\n SpokePoolInterface.RelayData memory slowRelayFulfillment,\\n bytes32[] memory proof\\n ) internal pure returns (bool) {\\n return MerkleProof.verify(proof, root, keccak256(abi.encode(slowRelayFulfillment)));\\n }\\n\\n // The following functions are primarily copied from\\n // https://github.com/Uniswap/merkle-distributor/blob/master/contracts/MerkleDistributor.sol with minor changes.\\n\\n /**\\n * @notice Tests whether a claim is contained within a claimedBitMap mapping.\\n * @param claimedBitMap a simple uint256 mapping in storage used as a bitmap.\\n * @param index the index to check in the bitmap.\\n * @return bool indicating if the index within the claimedBitMap has been marked as claimed.\\n */\\n function isClaimed(mapping(uint256 => uint256) storage claimedBitMap, uint256 index) internal view returns (bool) {\\n uint256 claimedWordIndex = index / 256;\\n uint256 claimedBitIndex = index % 256;\\n uint256 claimedWord = claimedBitMap[claimedWordIndex];\\n uint256 mask = (1 << claimedBitIndex);\\n return claimedWord & mask == mask;\\n }\\n\\n /**\\n * @notice Marks an index in a claimedBitMap as claimed.\\n * @param claimedBitMap a simple uint256 mapping in storage used as a bitmap.\\n * @param index the index to mark in the bitmap.\\n */\\n function setClaimed(mapping(uint256 => uint256) storage claimedBitMap, uint256 index) internal {\\n uint256 claimedWordIndex = index / 256;\\n uint256 claimedBitIndex = index % 256;\\n claimedBitMap[claimedWordIndex] = claimedBitMap[claimedWordIndex] | (1 << claimedBitIndex);\\n }\\n\\n /**\\n * @notice Tests whether a claim is contained within a 1D claimedBitMap mapping.\\n * @param claimedBitMap a simple uint256 value, encoding a 1D bitmap.\\n * @param index the index to check in the bitmap. Uint8 type enforces that index can't be > 255.\\n * @return bool indicating if the index within the claimedBitMap has been marked as claimed.\\n */\\n function isClaimed1D(uint256 claimedBitMap, uint8 index) internal pure returns (bool) {\\n uint256 mask = (1 << index);\\n return claimedBitMap & mask == mask;\\n }\\n\\n /**\\n * @notice Marks an index in a claimedBitMap as claimed.\\n * @param claimedBitMap a simple uint256 mapping in storage used as a bitmap. Uint8 type enforces that index\\n * can't be > 255.\\n * @param index the index to mark in the bitmap.\\n * @return uint256 representing the modified input claimedBitMap with the index set to true.\\n */\\n function setClaimed1D(uint256 claimedBitMap, uint8 index) internal pure returns (uint256) {\\n return claimedBitMap | (1 << index % 256);\\n }\\n}\\n\",\"keccak256\":\"0x5b49211d8b8e5a2792d08adb818fddc2ad8abaef45822f91ca678ceb7ea018ea\",\"license\":\"GPL-3.0-only\"},\"contracts/SpokePool.sol\":{\"content\":\"// SPDX-License-Identifier: GPL-3.0-only\\npragma solidity ^0.8.0;\\n\\nimport \\\"./MerkleLib.sol\\\";\\nimport \\\"./interfaces/WETH9.sol\\\";\\nimport \\\"./Lockable.sol\\\";\\nimport \\\"./SpokePoolInterface.sol\\\";\\n\\nimport \\\"@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol\\\";\\nimport \\\"@openzeppelin/contracts/token/ERC20/IERC20.sol\\\";\\nimport \\\"@openzeppelin/contracts/utils/Address.sol\\\";\\n\\nimport \\\"@openzeppelin/contracts/utils/cryptography/ECDSA.sol\\\";\\nimport \\\"@uma/core/contracts/common/implementation/Testable.sol\\\";\\nimport \\\"@uma/core/contracts/common/implementation/MultiCaller.sol\\\";\\n\\n/**\\n * @title SpokePool\\n * @notice Base contract deployed on source and destination chains enabling depositors to transfer assets from source to\\n * destination. Deposit orders are fulfilled by off-chain relayers who also interact with this contract. Deposited\\n * tokens are locked on the source chain and relayers send the recipient the desired token currency and amount\\n * on the destination chain. Locked source chain tokens are later sent over the canonical token bridge to L1 HubPool.\\n * Relayers are refunded with destination tokens out of this contract after another off-chain actor, a \\\"data worker\\\",\\n * submits a proof that the relayer correctly submitted a relay on this SpokePool.\\n */\\nabstract contract SpokePool is SpokePoolInterface, Testable, Lockable, MultiCaller {\\n using SafeERC20 for IERC20;\\n using Address for address;\\n\\n // Address of the L1 contract that acts as the owner of this SpokePool. If this contract is deployed on Ethereum,\\n // then this address should be set to the same owner as the HubPool and the whole system.\\n address public crossDomainAdmin;\\n\\n // Address of the L1 contract that will send tokens to and receive tokens from this contract to fund relayer\\n // refunds and slow relays.\\n address public hubPool;\\n\\n // Address of WETH contract for this network. If an origin token matches this, then the caller can optionally\\n // instruct this contract to wrap ETH when depositing.\\n WETH9 public immutable weth;\\n\\n // Any deposit quote times greater than or less than this value to the current contract time is blocked. Forces\\n // caller to use an approximately \\\"current\\\" realized fee. Defaults to 10 minutes.\\n uint32 public depositQuoteTimeBuffer = 600;\\n\\n // Count of deposits is used to construct a unique deposit identifier for this spoke pool.\\n uint32 public numberOfDeposits;\\n\\n // Origin token to destination token routings can be turned on or off, which can enable or disable deposits.\\n\\n mapping(address => mapping(uint256 => bool)) public enabledDepositRoutes;\\n\\n // This contract can store as many root bundles as the HubPool chooses to publish here.\\n RootBundle[] public rootBundles;\\n\\n // Each relay is associated with the hash of parameters that uniquely identify the original deposit and a relay\\n // attempt for that deposit. The relay itself is just represented as the amount filled so far. The total amount to\\n // relay, the fees, and the agents are all parameters included in the hash key.\\n mapping(bytes32 => uint256) public relayFills;\\n\\n /****************************************\\n * EVENTS *\\n ****************************************/\\n event SetXDomainAdmin(address indexed newAdmin);\\n event SetHubPool(address indexed newHubPool);\\n event EnabledDepositRoute(address indexed originToken, uint256 indexed destinationChainId, bool enabled);\\n event SetDepositQuoteTimeBuffer(uint32 newBuffer);\\n event FundsDeposited(\\n uint256 amount,\\n uint256 originChainId,\\n uint256 destinationChainId,\\n uint64 relayerFeePct,\\n uint32 indexed depositId,\\n uint32 quoteTimestamp,\\n address indexed originToken,\\n address recipient,\\n address indexed depositor\\n );\\n event RequestedSpeedUpDeposit(\\n uint64 newRelayerFeePct,\\n uint32 indexed depositId,\\n address indexed depositor,\\n bytes depositorSignature\\n );\\n event FilledRelay(\\n bytes32 indexed relayHash,\\n uint256 amount,\\n uint256 totalFilledAmount,\\n uint256 fillAmount,\\n uint256 repaymentChainId,\\n uint256 originChainId,\\n uint256 destinationChainId,\\n uint64 relayerFeePct,\\n uint64 realizedLpFeePct,\\n uint32 depositId,\\n address destinationToken,\\n address indexed relayer,\\n address indexed depositor,\\n address recipient,\\n bool isSlowRelay\\n );\\n event RelayedRootBundle(uint32 indexed rootBundleId, bytes32 relayerRefundRoot, bytes32 slowRelayRoot);\\n event ExecutedRelayerRefundRoot(\\n uint256 amountToReturn,\\n uint256 indexed chainId,\\n uint256[] refundAmounts,\\n uint32 indexed rootBundleId,\\n uint32 indexed leafId,\\n address l2TokenAddress,\\n address[] refundAddresses,\\n address caller\\n );\\n event TokensBridged(\\n uint256 amountToReturn,\\n uint256 indexed chainId,\\n uint32 indexed leafId,\\n address indexed l2TokenAddress,\\n address caller\\n );\\n event EmergencyDeleteRootBundle(uint256 indexed rootBundleId);\\n\\n /**\\n * @notice Construct the base SpokePool.\\n * @param _crossDomainAdmin Cross domain admin to set. Can be changed by admin.\\n * @param _hubPool Hub pool address to set. Can be changed by admin.\\n * @param _wethAddress Weth address for this network to set.\\n * @param timerAddress Timer address to set.\\n */\\n constructor(\\n address _crossDomainAdmin,\\n address _hubPool,\\n address _wethAddress,\\n address timerAddress\\n ) Testable(timerAddress) {\\n _setCrossDomainAdmin(_crossDomainAdmin);\\n _setHubPool(_hubPool);\\n weth = WETH9(_wethAddress);\\n }\\n\\n /****************************************\\n * MODIFIERS *\\n ****************************************/\\n\\n // Implementing contract needs to override _requireAdminSender() to ensure that admin functions are protected\\n // appropriately.\\n modifier onlyAdmin() {\\n _requireAdminSender();\\n _;\\n }\\n\\n /**************************************\\n * ADMIN FUNCTIONS *\\n **************************************/\\n\\n /**\\n * @notice Change cross domain admin address. Callable by admin only.\\n * @param newCrossDomainAdmin New cross domain admin.\\n */\\n function setCrossDomainAdmin(address newCrossDomainAdmin) public override onlyAdmin nonReentrant {\\n _setCrossDomainAdmin(newCrossDomainAdmin);\\n }\\n\\n /**\\n * @notice Change L1 hub pool address. Callable by admin only.\\n * @param newHubPool New hub pool.\\n */\\n function setHubPool(address newHubPool) public override onlyAdmin nonReentrant {\\n _setHubPool(newHubPool);\\n }\\n\\n /**\\n * @notice Enable/Disable an origin token => destination chain ID route for deposits. Callable by admin only.\\n * @param originToken Token that depositor can deposit to this contract.\\n * @param destinationChainId Chain ID for where depositor wants to receive funds.\\n * @param enabled True to enable deposits, False otherwise.\\n */\\n function setEnableRoute(\\n address originToken,\\n uint256 destinationChainId,\\n bool enabled\\n ) public override onlyAdmin nonReentrant {\\n enabledDepositRoutes[originToken][destinationChainId] = enabled;\\n emit EnabledDepositRoute(originToken, destinationChainId, enabled);\\n }\\n\\n /**\\n * @notice Change allowance for deposit quote time to differ from current block time. Callable by admin only.\\n * @param newDepositQuoteTimeBuffer New quote time buffer.\\n */\\n function setDepositQuoteTimeBuffer(uint32 newDepositQuoteTimeBuffer) public override onlyAdmin nonReentrant {\\n depositQuoteTimeBuffer = newDepositQuoteTimeBuffer;\\n emit SetDepositQuoteTimeBuffer(newDepositQuoteTimeBuffer);\\n }\\n\\n /**\\n * @notice This method stores a new root bundle in this contract that can be executed to refund relayers, fulfill\\n * slow relays, and send funds back to the HubPool on L1. This method can only be called by the admin and is\\n * designed to be called as part of a cross-chain message from the HubPool's executeRootBundle method.\\n * @param relayerRefundRoot Merkle root containing relayer refund leaves that can be individually executed via\\n * executeRelayerRefundRoot().\\n * @param slowRelayRoot Merkle root containing slow relay fulfillment leaves that can be individually executed via\\n * executeSlowRelayRoot().\\n */\\n function relayRootBundle(bytes32 relayerRefundRoot, bytes32 slowRelayRoot) public override onlyAdmin nonReentrant {\\n uint32 rootBundleId = uint32(rootBundles.length);\\n RootBundle storage rootBundle = rootBundles.push();\\n rootBundle.relayerRefundRoot = relayerRefundRoot;\\n rootBundle.slowRelayRoot = slowRelayRoot;\\n emit RelayedRootBundle(rootBundleId, relayerRefundRoot, slowRelayRoot);\\n }\\n\\n /**\\n * @notice This method is intended to only be used in emergencies where a bad root bundle has reached the\\n * SpokePool.\\n * @param rootBundleId Index of the root bundle that needs to be deleted. Note: this is intentionally a uint256\\n * to ensure that a small input range doesn't limit which indices this method is able to reach.\\n */\\n function emergencyDeleteRootBundle(uint256 rootBundleId) public override onlyAdmin nonReentrant {\\n delete rootBundles[rootBundleId];\\n emit EmergencyDeleteRootBundle(rootBundleId);\\n }\\n\\n /**************************************\\n * DEPOSITOR FUNCTIONS *\\n **************************************/\\n\\n /**\\n * @notice Called by user to bridge funds from origin to destination chain. Depositor will effectively lock\\n * tokens in this contract and receive a destination token on the destination chain. The origin => destination\\n * token mapping is stored on the L1 HubPool.\\n * @notice The caller must first approve this contract to spend amount of originToken.\\n * @notice The originToken => destinationChainId must be enabled.\\n * @notice This method is payable because the caller is able to deposit ETH if the originToken is WETH and this\\n * function will handle wrapping ETH.\\n * @param recipient Address to receive funds at on destination chain.\\n * @param originToken Token to lock into this contract to initiate deposit.\\n * @param amount Amount of tokens to deposit. Will be amount of tokens to receive less fees.\\n * @param destinationChainId Denotes network where user will receive funds from SpokePool by a relayer.\\n * @param relayerFeePct % of deposit amount taken out to incentivize a fast relayer.\\n * @param quoteTimestamp Timestamp used by relayers to compute this deposit's realizedLPFeePct which is paid\\n * to LP pool on HubPool.\\n */\\n function deposit(\\n address recipient,\\n address originToken,\\n uint256 amount,\\n uint256 destinationChainId,\\n uint64 relayerFeePct,\\n uint32 quoteTimestamp\\n ) public payable override nonReentrant {\\n // Check that deposit route is enabled.\\n require(enabledDepositRoutes[originToken][destinationChainId], \\\"Disabled route\\\");\\n\\n // We limit the relay fees to prevent the user spending all their funds on fees.\\n require(relayerFeePct < 0.5e18, \\\"invalid relayer fee\\\");\\n // This function assumes that L2 timing cannot be compared accurately and consistently to L1 timing. Therefore,\\n // block.timestamp is different from the L1 EVM's. Therefore, the quoteTimestamp must be within a configurable\\n // buffer of this contract's block time to allow for this variance.\\n // Note also that quoteTimestamp cannot be less than the buffer otherwise the following arithmetic can result\\n // in underflow. This isn't a problem as the deposit will revert, but the error might be unexpected for clients.\\n require(\\n getCurrentTime() >= quoteTimestamp - depositQuoteTimeBuffer &&\\n getCurrentTime() <= quoteTimestamp + depositQuoteTimeBuffer,\\n \\\"invalid quote time\\\"\\n );\\n // If the address of the origin token is a WETH contract and there is a msg.value with the transaction\\n // then the user is sending ETH. In this case, the ETH should be deposited to WETH.\\n if (originToken == address(weth) && msg.value > 0) {\\n require(msg.value == amount, \\\"msg.value must match amount\\\");\\n weth.deposit{ value: msg.value }();\\n // Else, it is a normal ERC20. In this case pull the token from the user's wallet as per normal.\\n // Note: this includes the case where the L2 user has WETH (already wrapped ETH) and wants to bridge them.\\n // In this case the msg.value will be set to 0, indicating a \\\"normal\\\" ERC20 bridging action.\\n } else IERC20(originToken).safeTransferFrom(msg.sender, address(this), amount);\\n\\n _emitDeposit(\\n amount,\\n chainId(),\\n destinationChainId,\\n relayerFeePct,\\n numberOfDeposits,\\n quoteTimestamp,\\n originToken,\\n recipient,\\n msg.sender\\n );\\n\\n // Increment count of deposits so that deposit ID for this spoke pool is unique.\\n numberOfDeposits += 1;\\n }\\n\\n /**\\n * @notice Convenience method that depositor can use to signal to relayer to use updated fee.\\n * @notice Relayer should only use events emitted by this function to submit fills with updated fees, otherwise they\\n * risk their fills getting disputed for being invalid, for example if the depositor never actually signed the\\n * update fee message.\\n * @notice This function will revert if the depositor did not sign a message containing the updated fee for the\\n * deposit ID stored in this contract. If the deposit ID is for another contract, or the depositor address is\\n * incorrect, or the updated fee is incorrect, then the signature will not match and this function will revert.\\n * @param depositor Signer of the update fee message who originally submitted the deposit. If the deposit doesn't\\n * exist, then the relayer will not be able to fill any relay, so the caller should validate that the depositor\\n * did in fact submit a relay.\\n * @param newRelayerFeePct New relayer fee that relayers can use.\\n * @param depositId Deposit to update fee for that originated in this contract.\\n * @param depositorSignature Signed message containing the depositor address, this contract chain ID, the updated\\n * relayer fee %, and the deposit ID. This signature is produced by signing a hash of data according to the\\n * EIP-191 standard. See more in the _verifyUpdateRelayerFeeMessage() comments.\\n */\\n function speedUpDeposit(\\n address depositor,\\n uint64 newRelayerFeePct,\\n uint32 depositId,\\n bytes memory depositorSignature\\n ) public override nonReentrant {\\n require(newRelayerFeePct < 0.5e18, \\\"invalid relayer fee\\\");\\n\\n _verifyUpdateRelayerFeeMessage(depositor, chainId(), newRelayerFeePct, depositId, depositorSignature);\\n\\n // Assuming the above checks passed, a relayer can take the signature and the updated relayer fee information\\n // from the following event to submit a fill with an updated fee %.\\n emit RequestedSpeedUpDeposit(newRelayerFeePct, depositId, depositor, depositorSignature);\\n }\\n\\n /**************************************\\n * RELAYER FUNCTIONS *\\n **************************************/\\n\\n /**\\n * @notice Called by relayer to fulfill part of a deposit by sending destination tokens to the recipient.\\n * Relayer is expected to pass in unique identifying information for deposit that they want to fulfill, and this\\n * relay submission will be validated by off-chain data workers who can dispute this relay if any part is invalid.\\n * If the relay is valid, then the relayer will be refunded on their desired repayment chain. If relay is invalid,\\n * then relayer will not receive any refund.\\n * @notice All of the deposit data can be found via on-chain events from the origin SpokePool, except for the\\n * realizedLpFeePct which is a function of the HubPool's utilization at the deposit quote time. This fee %\\n * is deterministic based on the quote time, so the relayer should just compute it using the canonical algorithm\\n * as described in a UMIP linked to the HubPool's identifier.\\n * @param depositor Depositor on origin chain who set this chain as the destination chain.\\n * @param recipient Specified recipient on this chain.\\n * @param destinationToken Token to send to recipient. Should be mapped to the origin token, origin chain ID\\n * and this chain ID via a mapping on the HubPool.\\n * @param amount Full size of the deposit.\\n * @param maxTokensToSend Max amount of tokens to send recipient. If higher than amount, then caller will\\n * send recipient the full relay amount.\\n * @param repaymentChainId Chain of SpokePool where relayer wants to be refunded after the challenge window has\\n * passed.\\n * @param originChainId Chain of SpokePool where deposit originated.\\n * @param realizedLpFeePct Fee % based on L1 HubPool utilization at deposit quote time. Deterministic based on\\n * quote time.\\n * @param relayerFeePct Fee % to keep as relayer, specified by depositor.\\n * @param depositId Unique deposit ID on origin spoke pool.\\n */\\n function fillRelay(\\n address depositor,\\n address recipient,\\n address destinationToken,\\n uint256 amount,\\n uint256 maxTokensToSend,\\n uint256 repaymentChainId,\\n uint256 originChainId,\\n uint64 realizedLpFeePct,\\n uint64 relayerFeePct,\\n uint32 depositId\\n ) public nonReentrant {\\n // Each relay attempt is mapped to the hash of data uniquely identifying it, which includes the deposit data\\n // such as the origin chain ID and the deposit ID, and the data in a relay attempt such as who the recipient\\n // is, which chain and currency the recipient wants to receive funds on, and the relay fees.\\n SpokePoolInterface.RelayData memory relayData = SpokePoolInterface.RelayData({\\n depositor: depositor,\\n recipient: recipient,\\n destinationToken: destinationToken,\\n amount: amount,\\n realizedLpFeePct: realizedLpFeePct,\\n relayerFeePct: relayerFeePct,\\n depositId: depositId,\\n originChainId: originChainId,\\n destinationChainId: chainId()\\n });\\n bytes32 relayHash = _getRelayHash(relayData);\\n\\n uint256 fillAmountPreFees = _fillRelay(relayHash, relayData, maxTokensToSend, relayerFeePct, false);\\n\\n _emitFillRelay(relayHash, fillAmountPreFees, repaymentChainId, relayerFeePct, relayData, false);\\n }\\n\\n /**\\n * @notice Called by relayer to execute same logic as calling fillRelay except that relayer is using an updated\\n * relayer fee %. The fee % must have been emitted in a message cryptographically signed by the depositor.\\n * @notice By design, the depositor probably emitted the message with the updated fee by calling speedUpRelay().\\n * @param depositor Depositor on origin chain who set this chain as the destination chain.\\n * @param recipient Specified recipient on this chain.\\n * @param destinationToken Token to send to recipient. Should be mapped to the origin token, origin chain ID\\n * and this chain ID via a mapping on the HubPool.\\n * @param amount Full size of the deposit.\\n * @param maxTokensToSend Max amount of tokens to send recipient. If higher than amount, then caller will\\n * send recipient the full relay amount.\\n * @param repaymentChainId Chain of SpokePool where relayer wants to be refunded after the challenge window has\\n * passed.\\n * @param originChainId Chain of SpokePool where deposit originated.\\n * @param realizedLpFeePct Fee % based on L1 HubPool utilization at deposit quote time. Deterministic based on\\n * quote time.\\n * @param relayerFeePct Original fee % to keep as relayer set by depositor.\\n * @param newRelayerFeePct New fee % to keep as relayer also specified by depositor.\\n * @param depositId Unique deposit ID on origin spoke pool.\\n * @param depositorSignature Depositor-signed message containing updated fee %.\\n */\\n function fillRelayWithUpdatedFee(\\n address depositor,\\n address recipient,\\n address destinationToken,\\n uint256 amount,\\n uint256 maxTokensToSend,\\n uint256 repaymentChainId,\\n uint256 originChainId,\\n uint64 realizedLpFeePct,\\n uint64 relayerFeePct,\\n uint64 newRelayerFeePct,\\n uint32 depositId,\\n bytes memory depositorSignature\\n ) public override nonReentrant {\\n _verifyUpdateRelayerFeeMessage(depositor, originChainId, newRelayerFeePct, depositId, depositorSignature);\\n\\n // Now follow the default fillRelay flow with the updated fee and the original relay hash.\\n RelayData memory relayData = RelayData({\\n depositor: depositor,\\n recipient: recipient,\\n destinationToken: destinationToken,\\n amount: amount,\\n realizedLpFeePct: realizedLpFeePct,\\n relayerFeePct: relayerFeePct,\\n depositId: depositId,\\n originChainId: originChainId,\\n destinationChainId: chainId()\\n });\\n bytes32 relayHash = _getRelayHash(relayData);\\n uint256 fillAmountPreFees = _fillRelay(relayHash, relayData, maxTokensToSend, newRelayerFeePct, false);\\n\\n _emitFillRelay(relayHash, fillAmountPreFees, repaymentChainId, newRelayerFeePct, relayData, false);\\n }\\n\\n /**************************************\\n * DATA WORKER FUNCTIONS *\\n **************************************/\\n\\n /**\\n * @notice Executes a slow relay leaf stored as part of a root bundle. Will send the full amount remaining in the\\n * relay to the recipient, less fees.\\n * @dev This function assumes that the relay's destination chain ID is the current chain ID, which prevents\\n * the caller from executing a slow relay intended for another chain on this chain.\\n * @param depositor Depositor on origin chain who set this chain as the destination chain.\\n * @param recipient Specified recipient on this chain.\\n * @param destinationToken Token to send to recipient. Should be mapped to the origin token, origin chain ID\\n * and this chain ID via a mapping on the HubPool.\\n * @param amount Full size of the deposit.\\n * @param originChainId Chain of SpokePool where deposit originated.\\n * @param realizedLpFeePct Fee % based on L1 HubPool utilization at deposit quote time. Deterministic based on\\n * quote time.\\n * @param relayerFeePct Original fee % to keep as relayer set by depositor.\\n * @param depositId Unique deposit ID on origin spoke pool.\\n * @param rootBundleId Unique ID of root bundle containing slow relay root that this leaf is contained in.\\n * @param proof Inclusion proof for this leaf in slow relay root in root bundle.\\n */\\n function executeSlowRelayRoot(\\n address depositor,\\n address recipient,\\n address destinationToken,\\n uint256 amount,\\n uint256 originChainId,\\n uint64 realizedLpFeePct,\\n uint64 relayerFeePct,\\n uint32 depositId,\\n uint32 rootBundleId,\\n bytes32[] memory proof\\n ) public virtual override nonReentrant {\\n _executeSlowRelayRoot(\\n depositor,\\n recipient,\\n destinationToken,\\n amount,\\n originChainId,\\n chainId(),\\n realizedLpFeePct,\\n relayerFeePct,\\n depositId,\\n rootBundleId,\\n proof\\n );\\n }\\n\\n /**\\n * @notice Executes a relayer refund leaf stored as part of a root bundle. Will send the relayer the amount they\\n * sent to the recipient plus a relayer fee.\\n * @param rootBundleId Unique ID of root bundle containing relayer refund root that this leaf is contained in.\\n * @param relayerRefundLeaf Contains all data necessary to reconstruct leaf contained in root bundle and to\\n * refund relayer. This data structure is explained in detail in the SpokePoolInterface.\\n * @param proof Inclusion proof for this leaf in relayer refund root in root bundle.\\n */\\n function executeRelayerRefundRoot(\\n uint32 rootBundleId,\\n SpokePoolInterface.RelayerRefundLeaf memory relayerRefundLeaf,\\n bytes32[] memory proof\\n ) public virtual override nonReentrant {\\n _executeRelayerRefundRoot(rootBundleId, relayerRefundLeaf, proof);\\n }\\n\\n /**************************************\\n * VIEW FUNCTIONS *\\n **************************************/\\n\\n /**\\n * @notice Returns chain ID for this network.\\n * @dev Some L2s like ZKSync don't support the CHAIN_ID opcode so we allow the implementer to override this.\\n */\\n function chainId() public view virtual override returns (uint256) {\\n return block.chainid;\\n }\\n\\n /**************************************\\n * INTERNAL FUNCTIONS *\\n **************************************/\\n\\n // Verifies inclusion proof of leaf in root, sends relayer their refund, and sends to HubPool any rebalance\\n // transfers.\\n function _executeRelayerRefundRoot(\\n uint32 rootBundleId,\\n SpokePoolInterface.RelayerRefundLeaf memory relayerRefundLeaf,\\n bytes32[] memory proof\\n ) internal {\\n // Check integrity of leaf structure:\\n require(relayerRefundLeaf.chainId == chainId(), \\\"Invalid chainId\\\");\\n require(relayerRefundLeaf.refundAddresses.length == relayerRefundLeaf.refundAmounts.length, \\\"invalid leaf\\\");\\n\\n RootBundle storage rootBundle = rootBundles[rootBundleId];\\n\\n // Check that inclusionProof proves that relayerRefundLeaf is contained within the relayer refund root.\\n // Note: This should revert if the relayerRefundRoot is uninitialized.\\n require(MerkleLib.verifyRelayerRefund(rootBundle.relayerRefundRoot, relayerRefundLeaf, proof), \\\"Bad Proof\\\");\\n\\n // Verify the leafId in the leaf has not yet been claimed.\\n require(!MerkleLib.isClaimed(rootBundle.claimedBitmap, relayerRefundLeaf.leafId), \\\"Already claimed\\\");\\n\\n // Set leaf as claimed in bitmap. This is passed by reference to the storage rootBundle.\\n MerkleLib.setClaimed(rootBundle.claimedBitmap, relayerRefundLeaf.leafId);\\n\\n // Send each relayer refund address the associated refundAmount for the L2 token address.\\n // Note: Even if the L2 token is not enabled on this spoke pool, we should still refund relayers.\\n for (uint32 i = 0; i < relayerRefundLeaf.refundAmounts.length; i++) {\\n uint256 amount = relayerRefundLeaf.refundAmounts[i];\\n if (amount > 0)\\n IERC20(relayerRefundLeaf.l2TokenAddress).safeTransfer(relayerRefundLeaf.refundAddresses[i], amount);\\n }\\n\\n // If leaf's amountToReturn is positive, then send L2 --> L1 message to bridge tokens back via\\n // chain-specific bridging method.\\n if (relayerRefundLeaf.amountToReturn > 0) {\\n _bridgeTokensToHubPool(relayerRefundLeaf);\\n\\n emit TokensBridged(\\n relayerRefundLeaf.amountToReturn,\\n relayerRefundLeaf.chainId,\\n relayerRefundLeaf.leafId,\\n relayerRefundLeaf.l2TokenAddress,\\n msg.sender\\n );\\n }\\n\\n emit ExecutedRelayerRefundRoot(\\n relayerRefundLeaf.amountToReturn,\\n relayerRefundLeaf.chainId,\\n relayerRefundLeaf.refundAmounts,\\n rootBundleId,\\n relayerRefundLeaf.leafId,\\n relayerRefundLeaf.l2TokenAddress,\\n relayerRefundLeaf.refundAddresses,\\n msg.sender\\n );\\n }\\n\\n // Verifies inclusion proof of leaf in root and sends recipient remainder of relay. Marks relay as filled.\\n function _executeSlowRelayRoot(\\n address depositor,\\n address recipient,\\n address destinationToken,\\n uint256 amount,\\n uint256 originChainId,\\n uint256 destinationChainId,\\n uint64 realizedLpFeePct,\\n uint64 relayerFeePct,\\n uint32 depositId,\\n uint32 rootBundleId,\\n bytes32[] memory proof\\n ) internal {\\n RelayData memory relayData = RelayData({\\n depositor: depositor,\\n recipient: recipient,\\n destinationToken: destinationToken,\\n amount: amount,\\n originChainId: originChainId,\\n destinationChainId: destinationChainId,\\n realizedLpFeePct: realizedLpFeePct,\\n relayerFeePct: relayerFeePct,\\n depositId: depositId\\n });\\n\\n require(\\n MerkleLib.verifySlowRelayFulfillment(rootBundles[rootBundleId].slowRelayRoot, relayData, proof),\\n \\\"Invalid proof\\\"\\n );\\n\\n bytes32 relayHash = _getRelayHash(relayData);\\n\\n // Note: use relayAmount as the max amount to send, so the relay is always completely filled by the contract's\\n // funds in all cases. As this is a slow relay we set the relayerFeePct to 0. This effectively refunds the\\n // relayer component of the relayerFee thereby only charging the depositor the LpFee.\\n uint256 fillAmountPreFees = _fillRelay(relayHash, relayData, relayData.amount, 0, true);\\n\\n // Note: Set repayment chain ID to 0 to indicate that there is no repayment to be made. The off-chain data\\n // worker can use repaymentChainId=0 as a signal to ignore such relays for refunds. Also, set the relayerFeePct\\n // to 0 as slow relays do not pay the caller of this method (depositor is refunded this fee).\\n _emitFillRelay(relayHash, fillAmountPreFees, 0, 0, relayData, true);\\n }\\n\\n function _setCrossDomainAdmin(address newCrossDomainAdmin) internal {\\n require(newCrossDomainAdmin != address(0), \\\"Bad bridge router address\\\");\\n crossDomainAdmin = newCrossDomainAdmin;\\n emit SetXDomainAdmin(crossDomainAdmin);\\n }\\n\\n function _setHubPool(address newHubPool) internal {\\n require(newHubPool != address(0), \\\"Bad hub pool address\\\");\\n hubPool = newHubPool;\\n emit SetHubPool(hubPool);\\n }\\n\\n // Should be overriden by implementing contract depending on how L2 handles sending tokens to L1.\\n function _bridgeTokensToHubPool(SpokePoolInterface.RelayerRefundLeaf memory relayerRefundLeaf) internal virtual;\\n\\n function _verifyUpdateRelayerFeeMessage(\\n address depositor,\\n uint256 originChainId,\\n uint64 newRelayerFeePct,\\n uint32 depositId,\\n bytes memory depositorSignature\\n ) internal view {\\n // A depositor can request to speed up an un-relayed deposit by signing a hash containing the relayer\\n // fee % to update to and information uniquely identifying the deposit to relay. This information ensures\\n // that this signature cannot be re-used for other deposits. The version string is included as a precaution\\n // in case this contract is upgraded.\\n // Note: we use encode instead of encodePacked because it is more secure, more in the \\\"warning\\\" section\\n // here: https://docs.soliditylang.org/en/v0.8.11/abi-spec.html#non-standard-packed-mode\\n bytes32 expectedDepositorMessageHash = keccak256(\\n abi.encode(\\\"ACROSS-V2-FEE-1.0\\\", newRelayerFeePct, depositId, originChainId)\\n );\\n\\n // Check the hash corresponding to the https://eth.wiki/json-rpc/API#eth_sign[eth_sign]\\n // If the depositor signed a message with a different updated fee (or any other param included in the\\n // above keccak156 hash), then this will revert.\\n bytes32 ethSignedMessageHash = ECDSA.toEthSignedMessageHash(expectedDepositorMessageHash);\\n\\n _verifyDepositorUpdateFeeMessage(depositor, ethSignedMessageHash, depositorSignature);\\n }\\n\\n // This function is isolated and made virtual to allow different L2's to implement chain specific recovery of\\n // signers from signatures because some L2s might not support ecrecover. To be safe, consider always reverting\\n // this function for L2s where ecrecover is different from how it works on Ethereum, otherwise there is the\\n // potential to forge a signature from the depositor using a different private key than the original depositor's.\\n function _verifyDepositorUpdateFeeMessage(\\n address depositor,\\n bytes32 ethSignedMessageHash,\\n bytes memory depositorSignature\\n ) internal view virtual {\\n // Note: We purposefully do not support EIP-191 signatures (meaning that multisigs and smart contract wallets\\n // like Argent are not supported) because of the possibility that a multisig that signed a message on the origin\\n // chain does not have a parallel on this destination chain.\\n require(depositor == ECDSA.recover(ethSignedMessageHash, depositorSignature), \\\"invalid signature\\\");\\n }\\n\\n function _computeAmountPreFees(uint256 amount, uint64 feesPct) private pure returns (uint256) {\\n return (1e18 * amount) / (1e18 - feesPct);\\n }\\n\\n function _computeAmountPostFees(uint256 amount, uint64 feesPct) private pure returns (uint256) {\\n return (amount * (1e18 - feesPct)) / 1e18;\\n }\\n\\n function _getRelayHash(SpokePoolInterface.RelayData memory relayData) private pure returns (bytes32) {\\n return keccak256(abi.encode(relayData));\\n }\\n\\n // Unwraps ETH and does a transfer to a recipient address. If the recipient is a smart contract then sends WETH.\\n function _unwrapWETHTo(address payable to, uint256 amount) internal {\\n if (address(to).isContract()) {\\n IERC20(address(weth)).safeTransfer(to, amount);\\n } else {\\n weth.withdraw(amount);\\n to.transfer(amount);\\n }\\n }\\n\\n /**\\n * @notice Caller specifies the max amount of tokens to send to user. Based on this amount and the amount of the\\n * relay remaining (as stored in the relayFills mapping), pull the amount of tokens from the caller\\n * and send to the recipient.\\n * @dev relayFills keeps track of pre-fee fill amounts as a convenience to relayers who want to specify round\\n * numbers for the maxTokensToSend parameter or convenient numbers like 100 (i.e. relayers who will fully\\n * fill any relay up to 100 tokens, and partial fill with 100 tokens for larger relays).\\n * @dev Caller must approve this contract to transfer up to maxTokensToSend of the relayData.destinationToken.\\n * The amount to be sent might end up less if there is insufficient relay amount remaining to be sent.\\n */\\n function _fillRelay(\\n bytes32 relayHash,\\n RelayData memory relayData,\\n uint256 maxTokensToSend,\\n uint64 updatableRelayerFeePct,\\n bool useContractFunds\\n ) internal returns (uint256 fillAmountPreFees) {\\n // We limit the relay fees to prevent the user spending all their funds on fees. Note that 0.5e18 (i.e. 50%)\\n // fees are just magic numbers. The important point is to prevent the total fee from being 100%, otherwise\\n // computing the amount pre fees runs into divide-by-0 issues.\\n require(updatableRelayerFeePct < 0.5e18 && relayData.realizedLpFeePct < 0.5e18, \\\"invalid fees\\\");\\n\\n // Check that the relay has not already been completely filled. Note that the relays mapping will point to\\n // the amount filled so far for a particular relayHash, so this will start at 0 and increment with each fill.\\n require(relayFills[relayHash] < relayData.amount, \\\"relay filled\\\");\\n\\n // Stores the equivalent amount to be sent by the relayer before fees have been taken out.\\n if (maxTokensToSend == 0) return 0;\\n\\n // Derive the amount of the relay filled if the caller wants to send exactly maxTokensToSend tokens to\\n // the recipient. For example, if the user wants to send 10 tokens to the recipient, the full relay amount\\n // is 100, and the fee %'s total 5%, then this computation would return ~10.5, meaning that to fill 10.5/100\\n // of the full relay size, the caller would need to send 10 tokens to the user.\\n fillAmountPreFees = _computeAmountPreFees(\\n maxTokensToSend,\\n (relayData.realizedLpFeePct + updatableRelayerFeePct)\\n );\\n // If user's specified max amount to send is greater than the amount of the relay remaining pre-fees,\\n // we'll pull exactly enough tokens to complete the relay.\\n uint256 amountToSend = maxTokensToSend;\\n uint256 amountRemainingInRelay = relayData.amount - relayFills[relayHash];\\n if (amountRemainingInRelay < fillAmountPreFees) {\\n fillAmountPreFees = amountRemainingInRelay;\\n\\n // The user will fulfill the remainder of the relay, so we need to compute exactly how many tokens post-fees\\n // that they need to send to the recipient. Note that if the relayer is filled using contract funds then\\n // this is a slow relay.\\n amountToSend = _computeAmountPostFees(\\n fillAmountPreFees,\\n relayData.realizedLpFeePct + updatableRelayerFeePct\\n );\\n }\\n\\n // relayFills keeps track of pre-fee fill amounts as a convenience to relayers who want to specify round\\n // numbers for the maxTokensToSend parameter or convenient numbers like 100 (i.e. relayers who will fully\\n // fill any relay up to 100 tokens, and partial fill with 100 tokens for larger relays).\\n relayFills[relayHash] += fillAmountPreFees;\\n\\n // If relay token is weth then unwrap and send eth.\\n if (relayData.destinationToken == address(weth)) {\\n // Note: useContractFunds is True if we want to send funds to the recipient directly out of this contract,\\n // otherwise we expect the caller to send funds to the recipient. If useContractFunds is True and the\\n // recipient wants WETH, then we can assume that WETH is already in the contract, otherwise we'll need the\\n // the user to send WETH to this contract. Regardless, we'll need to unwrap it before sending to the user.\\n if (!useContractFunds)\\n IERC20(relayData.destinationToken).safeTransferFrom(msg.sender, address(this), amountToSend);\\n _unwrapWETHTo(payable(relayData.recipient), amountToSend);\\n // Else, this is a normal ERC20 token. Send to recipient.\\n } else {\\n // Note: Similar to note above, send token directly from the contract to the user in the slow relay case.\\n if (!useContractFunds)\\n IERC20(relayData.destinationToken).safeTransferFrom(msg.sender, relayData.recipient, amountToSend);\\n else IERC20(relayData.destinationToken).safeTransfer(relayData.recipient, amountToSend);\\n }\\n }\\n\\n // The following internal methods emit events with many params to overcome solidity stack too deep issues.\\n function _emitFillRelay(\\n bytes32 relayHash,\\n uint256 fillAmount,\\n uint256 repaymentChainId,\\n uint64 relayerFeePct,\\n RelayData memory relayData,\\n bool isSlowRelay\\n ) internal {\\n emit FilledRelay(\\n relayHash,\\n relayData.amount,\\n relayFills[relayHash],\\n fillAmount,\\n repaymentChainId,\\n relayData.originChainId,\\n relayData.destinationChainId,\\n relayerFeePct,\\n relayData.realizedLpFeePct,\\n relayData.depositId,\\n relayData.destinationToken,\\n msg.sender,\\n relayData.depositor,\\n relayData.recipient,\\n isSlowRelay\\n );\\n }\\n\\n function _emitDeposit(\\n uint256 amount,\\n uint256 originChainId,\\n uint256 destinationChainId,\\n uint64 relayerFeePct,\\n uint32 depositId,\\n uint32 quoteTimestamp,\\n address originToken,\\n address recipient,\\n address depositor\\n ) internal {\\n emit FundsDeposited(\\n amount,\\n originChainId,\\n destinationChainId,\\n relayerFeePct,\\n depositId,\\n quoteTimestamp,\\n originToken,\\n recipient,\\n depositor\\n );\\n }\\n\\n // Implementing contract needs to override this to ensure that only the appropriate cross chain admin can execute\\n // certain admin functions. For L2 contracts, the cross chain admin refers to some L1 address or contract, and for\\n // L1, this would just be the same admin of the HubPool.\\n function _requireAdminSender() internal virtual;\\n\\n // Added to enable the this contract to receive ETH. Used when unwrapping Weth.\\n receive() external payable {}\\n}\\n\",\"keccak256\":\"0x460bea0562b87af55699b2ec0e53735b2224039573f9c5243815541263588bc1\",\"license\":\"GPL-3.0-only\"},\"contracts/SpokePoolInterface.sol\":{\"content\":\"// SPDX-License-Identifier: GPL-3.0-only\\npragma solidity ^0.8.0;\\n\\n/**\\n * @notice Contains common data structures and functions used by all SpokePool implementations.\\n */\\ninterface SpokePoolInterface {\\n // This leaf is meant to be decoded in the SpokePool to pay out successful relayers.\\n struct RelayerRefundLeaf {\\n // This is the amount to return to the HubPool. This occurs when there is a PoolRebalanceLeaf netSendAmount that\\n // is negative. This is just the negative of this value.\\n uint256 amountToReturn;\\n // Used to verify that this is being executed on the correct destination chainId.\\n uint256 chainId;\\n // This array designates how much each of those addresses should be refunded.\\n uint256[] refundAmounts;\\n // Used as the index in the bitmap to track whether this leaf has been executed or not.\\n uint32 leafId;\\n // The associated L2TokenAddress that these claims apply to.\\n address l2TokenAddress;\\n // Must be same length as refundAmounts and designates each address that must be refunded.\\n address[] refundAddresses;\\n }\\n\\n // This struct represents the data to fully specify a relay. If any portion of this data differs, the relay is\\n // considered to be completely distinct. Only one relay for a particular depositId, chainId pair should be\\n // considered valid and repaid. This data is hashed and inserted into the slow relay merkle root so that an off\\n // chain validator can choose when to refund slow relayers.\\n struct RelayData {\\n // The address that made the deposit on the origin chain.\\n address depositor;\\n // The recipient address on the destination chain.\\n address recipient;\\n // The corresponding token address on the destination chain.\\n address destinationToken;\\n // The total relay amount before fees are taken out.\\n uint256 amount;\\n // Origin chain id.\\n uint256 originChainId;\\n // Destination chain id.\\n uint256 destinationChainId;\\n // The LP Fee percentage computed by the relayer based on the deposit's quote timestamp\\n // and the HubPool's utilization.\\n uint64 realizedLpFeePct;\\n // The relayer fee percentage specified in the deposit.\\n uint64 relayerFeePct;\\n // The id uniquely identifying this deposit on the origin chain.\\n uint32 depositId;\\n }\\n\\n // Stores collection of merkle roots that can be published to this contract from the HubPool, which are referenced\\n // by \\\"data workers\\\" via inclusion proofs to execute leaves in the roots.\\n struct RootBundle {\\n // Merkle root of slow relays that were not fully filled and whose recipient is still owed funds from the LP pool.\\n bytes32 slowRelayRoot;\\n // Merkle root of relayer refunds for successful relays.\\n bytes32 relayerRefundRoot;\\n // This is a 2D bitmap tracking which leaves in the relayer refund root have been claimed, with max size of\\n // 256x256 leaves per root.\\n mapping(uint256 => uint256) claimedBitmap;\\n }\\n\\n function setCrossDomainAdmin(address newCrossDomainAdmin) external;\\n\\n function setHubPool(address newHubPool) external;\\n\\n function setEnableRoute(\\n address originToken,\\n uint256 destinationChainId,\\n bool enable\\n ) external;\\n\\n function setDepositQuoteTimeBuffer(uint32 buffer) external;\\n\\n function relayRootBundle(bytes32 relayerRefundRoot, bytes32 slowRelayRoot) external;\\n\\n function emergencyDeleteRootBundle(uint256 rootBundleId) external;\\n\\n function deposit(\\n address recipient,\\n address originToken,\\n uint256 amount,\\n uint256 destinationChainId,\\n uint64 relayerFeePct,\\n uint32 quoteTimestamp\\n ) external payable;\\n\\n function speedUpDeposit(\\n address depositor,\\n uint64 newRelayerFeePct,\\n uint32 depositId,\\n bytes memory depositorSignature\\n ) external;\\n\\n function fillRelay(\\n address depositor,\\n address recipient,\\n address destinationToken,\\n uint256 amount,\\n uint256 maxTokensToSend,\\n uint256 repaymentChainId,\\n uint256 originChainId,\\n uint64 realizedLpFeePct,\\n uint64 relayerFeePct,\\n uint32 depositId\\n ) external;\\n\\n function fillRelayWithUpdatedFee(\\n address depositor,\\n address recipient,\\n address destinationToken,\\n uint256 amount,\\n uint256 maxTokensToSend,\\n uint256 repaymentChainId,\\n uint256 originChainId,\\n uint64 realizedLpFeePct,\\n uint64 relayerFeePct,\\n uint64 newRelayerFeePct,\\n uint32 depositId,\\n bytes memory depositorSignature\\n ) external;\\n\\n function executeSlowRelayRoot(\\n address depositor,\\n address recipient,\\n address destinationToken,\\n uint256 amount,\\n uint256 originChainId,\\n uint64 realizedLpFeePct,\\n uint64 relayerFeePct,\\n uint32 depositId,\\n uint32 rootBundleId,\\n bytes32[] memory proof\\n ) external;\\n\\n function executeRelayerRefundRoot(\\n uint32 rootBundleId,\\n SpokePoolInterface.RelayerRefundLeaf memory relayerRefundLeaf,\\n bytes32[] memory proof\\n ) external;\\n\\n function chainId() external view returns (uint256);\\n}\\n\",\"keccak256\":\"0xe0ae593c1cd9c8204f0b7a3f226a5d4bd30d580692d2ecb2a33548b5b4e75f12\",\"license\":\"GPL-3.0-only\"},\"contracts/interfaces/AdapterInterface.sol\":{\"content\":\"// SPDX-License-Identifier: AGPL-3.0-only\\npragma solidity ^0.8.0;\\n\\n/**\\n * @notice Sends cross chain messages and tokens to contracts on a specific L2 network.\\n */\\n\\ninterface AdapterInterface {\\n event MessageRelayed(address target, bytes message);\\n\\n event TokensRelayed(address l1Token, address l2Token, uint256 amount, address to);\\n\\n function relayMessage(address target, bytes memory message) external payable;\\n\\n function relayTokens(\\n address l1Token,\\n address l2Token,\\n uint256 amount,\\n address to\\n ) external payable;\\n}\\n\",\"keccak256\":\"0xbd7091006acbdfe72b21ce985f964f0682a2316d9d3b38967beeb55f4ae5118c\",\"license\":\"AGPL-3.0-only\"},\"contracts/interfaces/WETH9.sol\":{\"content\":\"// SPDX-License-Identifier: GPL-3.0-only\\npragma solidity ^0.8.0;\\n\\ninterface WETH9 {\\n function withdraw(uint256 wad) external;\\n\\n function deposit() external payable;\\n\\n function balanceOf(address guy) external view returns (uint256 wad);\\n\\n function transfer(address guy, uint256 wad) external;\\n}\\n\",\"keccak256\":\"0x7b444d0840b1f76eee9bf39d74830f70644395613b96cce2d80fc50785a82eaa\",\"license\":\"GPL-3.0-only\"}},\"version\":1}", + "bytecode": "0x60a06040526002805463ffffffff60a01b1916604b60a31b1790553480156200002757600080fd5b506040516200467a3803806200467a8339810160408190526200004a9162000260565b600080546001600160a81b0319166001600160a01b03831617600160a01b179055338383836200007a84620000a9565b62000085836200014f565b506001600160a01b031660805250620000a0905033620001f1565b505050620002aa565b6001600160a01b038116620001055760405162461bcd60e51b815260206004820152601960248201527f4261642062726964676520726f7574657220616464726573730000000000000060448201526064015b60405180910390fd5b600180546001600160a01b0319166001600160a01b0383169081179091556040517fa9e8c42c9e7fca7f62755189a16b2f5314d43d8fb24e91ba54e6d65f9314e84990600090a250565b6001600160a01b038116620001a75760405162461bcd60e51b815260206004820152601460248201527f4261642068756220706f6f6c20616464726573730000000000000000000000006044820152606401620000fc565b600280546001600160a01b0319166001600160a01b0383169081179091556040517f1f17a88f67b0f49060a34bec1a4723a563620e6aa265eb640b5046dcee0759a090600090a250565b600680546001600160a01b038381166001600160a01b0319831681179093556040519116919082907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e090600090a35050565b80516001600160a01b03811681146200025b57600080fd5b919050565b6000806000606084860312156200027657600080fd5b620002818462000243565b9250620002916020850162000243565b9150620002a16040850162000243565b90509250925092565b608051614391620002e9600039600081816102d501528181610c6201528181610d2b01528181611f9e01528181612a2e0152612a8401526143916000f3fe6080604052600436106101bb5760003560e01c80638a7860ce116100ec578063e19044021161008a578063f06850f611610064578063f06850f61461059a578063f2fde38b146105c7578063f500697c146105e7578063ffc351a31461060757600080fd5b8063e190440214610518578063e282d5b914610545578063ee2a53f81461056557600080fd5b8063a1244c67116100c6578063a1244c671461047f578063ac9650d8146104b8578063c894c0ca146104d8578063de7eba78146104f857600080fd5b80638a7860ce146104215780638da5cb5b146104415780639a8a05921461046c57600080fd5b806349228978116101595780635285e058116101335780635285e0581461037557806357f6dcb8146103a2578063715018a6146103ec57806389a153cc1461040157600080fd5b806349228978146102f7578063493a4f841461030a5780635249fef11461032a57600080fd5b8063272751c711610195578063272751c7146102605780632752042e1461028057806329cb924d146102a05780633fc8cef3146102c357600080fd5b80631c39c38d146101c75780631dfb2d021461021e57806322f8e5661461024057600080fd5b366101c257005b600080fd5b3480156101d357600080fd5b506000546101f49073ffffffffffffffffffffffffffffffffffffffff1681565b60405173ffffffffffffffffffffffffffffffffffffffff90911681526020015b60405180910390f35b34801561022a57600080fd5b5061023e6102393660046134d0565b610627565b005b34801561024c57600080fd5b5061023e61025b3660046134eb565b6106b4565b34801561026c57600080fd5b5061023e61027b366004613512565b61075d565b34801561028c57600080fd5b5061023e61029b366004613566565b610874565b3480156102ac57600080fd5b506102b5610975565b604051908152602001610215565b3480156102cf57600080fd5b506101f47f000000000000000000000000000000000000000000000000000000000000000081565b61023e610305366004613599565b610a2d565b34801561031657600080fd5b5061023e6103253660046135ff565b610e94565b34801561033657600080fd5b50610365610345366004613621565b600360209081526000928352604080842090915290825290205460ff1681565b6040519015158152602001610215565b34801561038157600080fd5b506001546101f49073ffffffffffffffffffffffffffffffffffffffff1681565b3480156103ae57600080fd5b506002546103d79074010000000000000000000000000000000000000000900463ffffffff1681565b60405163ffffffff9091168152602001610215565b3480156103f857600080fd5b5061023e610fbb565b34801561040d57600080fd5b5061023e61041c36600461364b565b611048565b34801561042d57600080fd5b5061023e61043c3660046134eb565b6111a4565b34801561044d57600080fd5b5060065473ffffffffffffffffffffffffffffffffffffffff166101f4565b34801561047857600080fd5b50466102b5565b34801561048b57600080fd5b506002546103d7907801000000000000000000000000000000000000000000000000900463ffffffff1681565b6104cb6104c63660046136e9565b611278565b60405161021591906137d4565b3480156104e457600080fd5b5061023e6104f33660046139ec565b611452565b34801561050457600080fd5b5061023e6105133660046134d0565b6114d6565b34801561052457600080fd5b506002546101f49073ffffffffffffffffffffffffffffffffffffffff1681565b34801561055157600080fd5b5061023e610560366004613b7f565b61151c565b34801561057157600080fd5b506105856105803660046134eb565b61167a565b60408051928352602083019190915201610215565b3480156105a657600080fd5b506102b56105b53660046134eb565b60056020526000908152604090205481565b3480156105d357600080fd5b5061023e6105e23660046134d0565b6116a8565b3480156105f357600080fd5b5061023e610602366004613bee565b6117d5565b34801561061357600080fd5b5061023e610622366004613cb5565b611861565b61062f6119cc565b610637611a4d565b610664600080547fffffffffffffffffffffff00ffffffffffffffffffffffffffffffffffffffff169055565b61066d81611ad1565b6106b1600080547fffffffffffffffffffffff00ffffffffffffffffffffffffffffffffffffffff1674010000000000000000000000000000000000000000179055565b50565b60005473ffffffffffffffffffffffffffffffffffffffff166106d657600080fd5b6000546040517f22f8e5660000000000000000000000000000000000000000000000000000000081526004810183905273ffffffffffffffffffffffffffffffffffffffff909116906322f8e56690602401600060405180830381600087803b15801561074257600080fd5b505af1158015610756573d6000803e3d6000fd5b5050505050565b6107656119cc565b61076d611a4d565b61079a600080547fffffffffffffffffffffff00ffffffffffffffffffffffffffffffffffffffff169055565b73ffffffffffffffffffffffffffffffffffffffff8316600081815260036020908152604080832086845282529182902080547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff001685151590811790915591519182528492917f0a21fdd43d0ad0c62689ee7230a47309a050755bcc52eba00310add65297692a910160405180910390a361086f600080547fffffffffffffffffffffff00ffffffffffffffffffffffffffffffffffffffff1674010000000000000000000000000000000000000000179055565b505050565b61087c6119cc565b610884611a4d565b6108b1600080547fffffffffffffffffffffff00ffffffffffffffffffffffffffffffffffffffff169055565b600280547fffffffffffffffff00000000ffffffffffffffffffffffffffffffffffffffff167401000000000000000000000000000000000000000063ffffffff8416908102919091179091556040519081527f0e55dd180fa793d9036c804d0a116e6a7617a48e72cee1f83d92793a793fcc039060200160405180910390a16106b1600080547fffffffffffffffffffffff00ffffffffffffffffffffffffffffffffffffffff1674010000000000000000000000000000000000000000179055565b6000805473ffffffffffffffffffffffffffffffffffffffff1615610a285760008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166329cb924d6040518163ffffffff1660e01b8152600401602060405180830381865afa1580156109ff573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610a239190613d93565b905090565b504290565b610a35611a4d565b610a62600080547fffffffffffffffffffffff00ffffffffffffffffffffffffffffffffffffffff169055565b73ffffffffffffffffffffffffffffffffffffffff8516600090815260036020908152604080832086845290915290205460ff16610b01576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152600e60248201527f44697361626c656420726f75746500000000000000000000000000000000000060448201526064015b60405180910390fd5b6706f05b59d3b200008267ffffffffffffffff1610610b7c576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601360248201527f696e76616c69642072656c6179657220666565000000000000000000000000006044820152606401610af8565b600254610ba79074010000000000000000000000000000000000000000900463ffffffff1682613ddb565b63ffffffff16610bb5610975565b10158015610bfa5750600254610be99074010000000000000000000000000000000000000000900463ffffffff1682613e00565b63ffffffff16610bf7610975565b11155b610c60576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601260248201527f696e76616c69642071756f74652074696d6500000000000000000000000000006044820152606401610af8565b7f000000000000000000000000000000000000000000000000000000000000000073ffffffffffffffffffffffffffffffffffffffff168573ffffffffffffffffffffffffffffffffffffffff16148015610cbb5750600034115b15610daf57833414610d29576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601b60248201527f6d73672e76616c7565206d757374206d6174636820616d6f756e7400000000006044820152606401610af8565b7f000000000000000000000000000000000000000000000000000000000000000073ffffffffffffffffffffffffffffffffffffffff1663d0e30db0346040518263ffffffff1660e01b81526004016000604051808303818588803b158015610d9157600080fd5b505af1158015610da5573d6000803e3d6000fd5b5050505050610dd1565b610dd173ffffffffffffffffffffffffffffffffffffffff8616333087611bbd565b610e088446600254869086907801000000000000000000000000000000000000000000000000900463ffffffff16868b8d33611c99565b6001600260188282829054906101000a900463ffffffff16610e2a9190613e00565b92506101000a81548163ffffffff021916908363ffffffff160217905550610e8c600080547fffffffffffffffffffffff00ffffffffffffffffffffffffffffffffffffffff1674010000000000000000000000000000000000000000179055565b505050505050565b610e9c6119cc565b610ea4611a4d565b610ed1600080547fffffffffffffffffffffff00ffffffffffffffffffffffffffffffffffffffff169055565b60048054600181018255600091909152600381027f8a35acfbc15ff81a39ae7d344fd709f28e8600b4aa8c65c6b64bfe7fe36bd19c81018490557f8a35acfbc15ff81a39ae7d344fd709f28e8600b4aa8c65c6b64bfe7fe36bd19b01828155604080518581526020810185905263ffffffff8416917fc86ba04c55bc5eb2f2876b91c438849a296dbec7b08751c3074d92e04f0a77af910160405180910390a25050610fb7600080547fffffffffffffffffffffff00ffffffffffffffffffffffffffffffffffffffff1674010000000000000000000000000000000000000000179055565b5050565b60065473ffffffffffffffffffffffffffffffffffffffff16331461103c576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e65726044820152606401610af8565b6110466000611d2a565b565b611050611a4d565b61107d600080547fffffffffffffffffffffff00ffffffffffffffffffffffffffffffffffffffff169055565b60006040518061012001604052808c73ffffffffffffffffffffffffffffffffffffffff1681526020018b73ffffffffffffffffffffffffffffffffffffffff1681526020018a73ffffffffffffffffffffffffffffffffffffffff1681526020018981526020018681526020016110f24690565b81526020018567ffffffffffffffff1681526020018467ffffffffffffffff1681526020018363ffffffff168152509050600061112e82611da1565b9050600061114082848b886000611dd1565b905061115182828a8887600061207e565b505050611198600080547fffffffffffffffffffffff00ffffffffffffffffffffffffffffffffffffffff1674010000000000000000000000000000000000000000179055565b50505050505050505050565b6111ac6119cc565b6111b4611a4d565b6111e1600080547fffffffffffffffffffffff00ffffffffffffffffffffffffffffffffffffffff169055565b600481815481106111f4576111f4613e28565b60009182526020822060039091020181815560010181905560405182917f3569b846531b754c99cb80df3f49cd72fa6fe106aaee5ab8e0caf35a9d7ce88d91a26106b1600080547fffffffffffffffffffffff00ffffffffffffffffffffffffffffffffffffffff1674010000000000000000000000000000000000000000179055565b606034156112e2576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601b60248201527f4f6e6c79206d756c746963616c6c207769746820302076616c756500000000006044820152606401610af8565b8167ffffffffffffffff8111156112fb576112fb613854565b60405190808252806020026020018201604052801561132e57816020015b60608152602001906001900390816113195790505b50905060005b8281101561144b576000803086868581811061135257611352613e28565b90506020028101906113649190613e57565b604051611372929190613ebc565b600060405180830381855af49150503d80600081146113ad576040519150601f19603f3d011682016040523d82523d6000602084013e6113b2565b606091505b509150915081611418576044815110156113cb57600080fd5b600481019050808060200190518101906113e59190613ecc565b6040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610af89190613f3a565b8084848151811061142b5761142b613e28565b60200260200101819052505050808061144390613f4d565b915050611334565b5092915050565b61145a611a4d565b611487600080547fffffffffffffffffffffff00ffffffffffffffffffffffffffffffffffffffff169055565b6114928383836121b3565b61086f600080547fffffffffffffffffffffff00ffffffffffffffffffffffffffffffffffffffff1674010000000000000000000000000000000000000000179055565b6114de6119cc565b6114e6611a4d565b611513600080547fffffffffffffffffffffff00ffffffffffffffffffffffffffffffffffffffff169055565b61066d81612579565b611524611a4d565b611551600080547fffffffffffffffffffffff00ffffffffffffffffffffffffffffffffffffffff169055565b6706f05b59d3b200008367ffffffffffffffff16106115cc576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601360248201527f696e76616c69642072656c6179657220666565000000000000000000000000006044820152606401610af8565b6115d98446858585612665565b8373ffffffffffffffffffffffffffffffffffffffff168263ffffffff167fb9de16bf376724405019a10ef4fedac57fecd292bf86c08d81d7c42d394d5d378584604051611628929190613f85565b60405180910390a3611674600080547fffffffffffffffffffffff00ffffffffffffffffffffffffffffffffffffffff1674010000000000000000000000000000000000000000179055565b50505050565b6004818154811061168a57600080fd5b60009182526020909120600390910201805460019091015490915082565b60065473ffffffffffffffffffffffffffffffffffffffff163314611729576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e65726044820152606401610af8565b73ffffffffffffffffffffffffffffffffffffffff81166117cc576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201527f64647265737300000000000000000000000000000000000000000000000000006064820152608401610af8565b6106b181611d2a565b6117dd611a4d565b61180a600080547fffffffffffffffffffffff00ffffffffffffffffffffffffffffffffffffffff169055565b61181d8a8a8a8a8a468b8b8b8b8b612702565b611198600080547fffffffffffffffffffffff00ffffffffffffffffffffffffffffffffffffffff1674010000000000000000000000000000000000000000179055565b611869611a4d565b611896600080547fffffffffffffffffffffff00ffffffffffffffffffffffffffffffffffffffff169055565b6118a38c87858585612665565b60006040518061012001604052808e73ffffffffffffffffffffffffffffffffffffffff1681526020018d73ffffffffffffffffffffffffffffffffffffffff1681526020018c73ffffffffffffffffffffffffffffffffffffffff1681526020018b81526020018881526020016119184690565b81526020018767ffffffffffffffff1681526020018667ffffffffffffffff1681526020018463ffffffff168152509050600061195482611da1565b9050600061196682848d896000611dd1565b905061197782828c8987600061207e565b5050506119be600080547fffffffffffffffffffffff00ffffffffffffffffffffffffffffffffffffffff1674010000000000000000000000000000000000000000179055565b505050505050505050505050565b60065473ffffffffffffffffffffffffffffffffffffffff163314611046576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e65726044820152606401610af8565b60005474010000000000000000000000000000000000000000900460ff16611046576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601f60248201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c006044820152606401610af8565b73ffffffffffffffffffffffffffffffffffffffff8116611b4e576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601460248201527f4261642068756220706f6f6c20616464726573730000000000000000000000006044820152606401610af8565b600280547fffffffffffffffffffffffff00000000000000000000000000000000000000001673ffffffffffffffffffffffffffffffffffffffff83169081179091556040517f1f17a88f67b0f49060a34bec1a4723a563620e6aa265eb640b5046dcee0759a090600090a250565b60405173ffffffffffffffffffffffffffffffffffffffff808516602483015283166044820152606481018290526116749085907f23b872dd00000000000000000000000000000000000000000000000000000000906084015b604080517fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe08184030181529190526020810180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff167fffffffff0000000000000000000000000000000000000000000000000000000090931692909217909152612881565b604080518a8152602081018a905290810188905267ffffffffffffffff8716606082015263ffffffff858116608083015273ffffffffffffffffffffffffffffffffffffffff84811660a084015280841692908616918816907f4a4fc49abd237bfd7f4ac82d6c7a284c69daaea5154430cff04ad7482c6c42549060c00160405180910390a4505050505050505050565b6006805473ffffffffffffffffffffffffffffffffffffffff8381167fffffffffffffffffffffffff0000000000000000000000000000000000000000831681179093556040519116919082907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e090600090a35050565b600081604051602001611db49190613fa8565b604051602081830303815290604052805190602001209050919050565b60006706f05b59d3b200008367ffffffffffffffff16108015611e0957506706f05b59d3b200008560c0015167ffffffffffffffff16105b611e6f576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152600c60248201527f696e76616c6964206665657300000000000000000000000000000000000000006044820152606401610af8565b606085015160008781526005602052604090205410611eea576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152600c60248201527f72656c61792066696c6c656400000000000000000000000000000000000000006044820152606401610af8565b83600003611efa57506000612075565b611f1384848760c00151611f0e919061404f565b61298d565b60008781526005602052604081205460608801519293508692611f369190614072565b905082811015611f5f57809250611f5c83868960c00151611f57919061404f565b6129ce565b91505b60008881526005602052604081208054859290611f7d908490614089565b9091555050604087015173ffffffffffffffffffffffffffffffffffffffff7f000000000000000000000000000000000000000000000000000000000000000081169116036120055783611ff2576040870151611ff29073ffffffffffffffffffffffffffffffffffffffff16333085611bbd565b6120008760200151836129f7565b612072565b8361203f57612000338860200151848a6040015173ffffffffffffffffffffffffffffffffffffffff16611bbd909392919063ffffffff16565b612072876020015183896040015173ffffffffffffffffffffffffffffffffffffffff16612b389092919063ffffffff16565b50505b95945050505050565b816000015173ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16877f1d59c1d19baf4b4de03cec9c844258e7ca2f2004975025eb14fe9a5e1d4e0d888560600151600560008c8152602001908152602001600020548a8a89608001518a60a001518c8c60c001518d61010001518e604001518f602001518f6040516121a39c9b9a999897969594939291909b8c5260208c019a909a5260408b019890985260608a0196909652608089019490945260a088019290925267ffffffffffffffff90811660c08801521660e086015263ffffffff1661010085015273ffffffffffffffffffffffffffffffffffffffff9081166101208501521661014083015215156101608201526101800190565b60405180910390a4505050505050565b46826020015114612220576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152600f60248201527f496e76616c696420636861696e496400000000000000000000000000000000006044820152606401610af8565b8160400151518260a001515114612293576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152600c60248201527f696e76616c6964206c65616600000000000000000000000000000000000000006044820152606401610af8565b600060048463ffffffff16815481106122ae576122ae613e28565b906000526020600020906003020190506122cd81600101548484612b8e565b612333576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152600960248201527f4261642050726f6f6600000000000000000000000000000000000000000000006044820152606401610af8565b61234a81600201846060015163ffffffff16612bc9565b156123b1576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152600f60248201527f416c726561647920636c61696d656400000000000000000000000000000000006044820152606401610af8565b6123c881600201846060015163ffffffff16612c0a565b60005b8360400151518163ffffffff16101561247457600084604001518263ffffffff16815181106123fc576123fc613e28565b602002602001015190506000811115612461576124618560a001518363ffffffff168151811061242e5761242e613e28565b602002602001015182876080015173ffffffffffffffffffffffffffffffffffffffff16612b389092919063ffffffff16565b508061246c816140a1565b9150506123cb565b5082511561250d5761248583612c48565b826080015173ffffffffffffffffffffffffffffffffffffffff16836060015163ffffffff1684602001517f828fc203220356df8f072a91681caee7d5c75095e2a95e80ed5a14b384697f7186600001513360405161250492919091825273ffffffffffffffffffffffffffffffffffffffff16602082015260400190565b60405180910390a45b826060015163ffffffff168463ffffffff1684602001517ff8bd640004bcec1b89657020f561d0b070cbdf662d0b158db9dccb0a8301bfab8660000151876040015188608001518960a001513360405161256b959493929190614145565b60405180910390a450505050565b73ffffffffffffffffffffffffffffffffffffffff81166125f6576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601960248201527f4261642062726964676520726f757465722061646472657373000000000000006044820152606401610af8565b600180547fffffffffffffffffffffffff00000000000000000000000000000000000000001673ffffffffffffffffffffffffffffffffffffffff83169081179091556040517fa9e8c42c9e7fca7f62755189a16b2f5314d43d8fb24e91ba54e6d65f9314e84990600090a250565b60408051608060208201819052601160a08301527f4143524f53532d56322d4645452d312e3000000000000000000000000000000060c083015267ffffffffffffffff86169282019290925263ffffffff8416606082015290810185905260009060e00160405160208183030381529060405280519060200120905060006126ec82612cec565b90506126f9878285612d27565b50505050505050565b60006040518061012001604052808d73ffffffffffffffffffffffffffffffffffffffff1681526020018c73ffffffffffffffffffffffffffffffffffffffff1681526020018b73ffffffffffffffffffffffffffffffffffffffff1681526020018a81526020018981526020018881526020018767ffffffffffffffff1681526020018667ffffffffffffffff1681526020018563ffffffff1681525090506127d760048463ffffffff16815481106127be576127be613e28565b9060005260206000209060030201600001548284612dc5565b61283d576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152600d60248201527f496e76616c69642070726f6f66000000000000000000000000000000000000006044820152606401610af8565b600061284882611da1565b9050600061285f8284856060015160006001611dd1565b9050612871828260008087600161207e565b5050505050505050505050505050565b60006128e3826040518060400160405280602081526020017f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c65648152508573ffffffffffffffffffffffffffffffffffffffff16612ddd9092919063ffffffff16565b80519091501561086f578080602001905181019061290191906141a3565b61086f576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602a60248201527f5361666545524332303a204552433230206f7065726174696f6e20646964206e60448201527f6f742073756363656564000000000000000000000000000000000000000000006064820152608401610af8565b60006129a182670de0b6b3a76400006141c0565b67ffffffffffffffff166129bd84670de0b6b3a76400006141e1565b6129c7919061424d565b9392505050565b6000670de0b6b3a76400006129e383826141c0565b6129bd9067ffffffffffffffff16856141e1565b73ffffffffffffffffffffffffffffffffffffffff82163b15612a5557610fb773ffffffffffffffffffffffffffffffffffffffff7f0000000000000000000000000000000000000000000000000000000000000000168383612b38565b6040517f2e1a7d4d000000000000000000000000000000000000000000000000000000008152600481018290527f000000000000000000000000000000000000000000000000000000000000000073ffffffffffffffffffffffffffffffffffffffff1690632e1a7d4d90602401600060405180830381600087803b158015612add57600080fd5b505af1158015612af1573d6000803e3d6000fd5b505060405173ffffffffffffffffffffffffffffffffffffffff8516925083156108fc02915083906000818181858888f1935050505015801561086f573d6000803e3d6000fd5b60405173ffffffffffffffffffffffffffffffffffffffff831660248201526044810182905261086f9084907fa9059cbb0000000000000000000000000000000000000000000000000000000090606401611c17565b6000612bc1828585604051602001612ba69190614261565b60405160208183030381529060405280519060200120612dec565b949350505050565b600080612bd86101008461424d565b90506000612be8610100856142fc565b6000928352602095909552506040902054600190931b92831690921492915050565b6000612c186101008361424d565b90506000612c28610100846142fc565b600092835260209490945250604090208054600190931b90921790915550565b608081015160025482516040517fa9059cbb00000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff9283166004820152602481019190915291169063a9059cbb906044016020604051808303816000875af1158015612cc8573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610fb791906141a3565b6040517f19457468657265756d205369676e6564204d6573736167653a0a3332000000006020820152603c8101829052600090605c01611db4565b612d318282612e02565b73ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161461086f576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601160248201527f696e76616c6964207369676e61747572650000000000000000000000000000006044820152606401610af8565b6000612bc1828585604051602001612ba69190613fa8565b6060612bc18484600085612e26565b600082612df98584612fbc565b14949350505050565b6000806000612e118585613028565b91509150612e1e81613096565b509392505050565b606082471015612eb8576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602660248201527f416464726573733a20696e73756666696369656e742062616c616e636520666f60448201527f722063616c6c00000000000000000000000000000000000000000000000000006064820152608401610af8565b73ffffffffffffffffffffffffffffffffffffffff85163b612f36576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e74726163740000006044820152606401610af8565b6000808673ffffffffffffffffffffffffffffffffffffffff168587604051612f5f9190614310565b60006040518083038185875af1925050503d8060008114612f9c576040519150601f19603f3d011682016040523d82523d6000602084013e612fa1565b606091505b5091509150612fb18282866132ea565b979650505050505050565b600081815b8451811015612e1e576000858281518110612fde57612fde613e28565b602002602001015190508083116130045760008381526020829052604090209250613015565b600081815260208490526040902092505b508061302081613f4d565b915050612fc1565b600080825160410361305e5760208301516040840151606085015160001a6130528782858561333d565b9450945050505061308f565b8251604003613087576020830151604084015161307c868383613455565b93509350505061308f565b506000905060025b9250929050565b60008160048111156130aa576130aa61432c565b036130b25750565b60018160048111156130c6576130c661432c565b0361312d576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601860248201527f45434453413a20696e76616c6964207369676e617475726500000000000000006044820152606401610af8565b60028160048111156131415761314161432c565b036131a8576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601f60248201527f45434453413a20696e76616c6964207369676e6174757265206c656e677468006044820152606401610af8565b60038160048111156131bc576131bc61432c565b03613249576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602260248201527f45434453413a20696e76616c6964207369676e6174757265202773272076616c60448201527f75650000000000000000000000000000000000000000000000000000000000006064820152608401610af8565b600481600481111561325d5761325d61432c565b036106b1576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602260248201527f45434453413a20696e76616c6964207369676e6174757265202776272076616c60448201527f75650000000000000000000000000000000000000000000000000000000000006064820152608401610af8565b606083156132f95750816129c7565b8251156133095782518084602001fd5b816040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610af89190613f3a565b6000807f7fffffffffffffffffffffffffffffff5d576e7357a4501ddfe92f46681b20a0831115613374575060009050600361344c565b8460ff16601b1415801561338c57508460ff16601c14155b1561339d575060009050600461344c565b6040805160008082526020820180845289905260ff881692820192909252606081018690526080810185905260019060a0016020604051602081039080840390855afa1580156133f1573d6000803e3d6000fd5b50506040517fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0015191505073ffffffffffffffffffffffffffffffffffffffff81166134455760006001925092505061344c565b9150600090505b94509492505050565b6000807f7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff83168161348b60ff86901c601b614089565b90506134998782888561333d565b935093505050935093915050565b803573ffffffffffffffffffffffffffffffffffffffff811681146134cb57600080fd5b919050565b6000602082840312156134e257600080fd5b6129c7826134a7565b6000602082840312156134fd57600080fd5b5035919050565b80151581146106b157600080fd5b60008060006060848603121561352757600080fd5b613530846134a7565b925060208401359150604084013561354781613504565b809150509250925092565b803563ffffffff811681146134cb57600080fd5b60006020828403121561357857600080fd5b6129c782613552565b803567ffffffffffffffff811681146134cb57600080fd5b60008060008060008060c087890312156135b257600080fd5b6135bb876134a7565b95506135c9602088016134a7565b945060408701359350606087013592506135e560808801613581565b91506135f360a08801613552565b90509295509295509295565b6000806040838503121561361257600080fd5b50508035926020909101359150565b6000806040838503121561363457600080fd5b61363d836134a7565b946020939093013593505050565b6000806000806000806000806000806101408b8d03121561366b57600080fd5b6136748b6134a7565b995061368260208c016134a7565b985061369060408c016134a7565b975060608b0135965060808b0135955060a08b0135945060c08b013593506136ba60e08c01613581565b92506136c96101008c01613581565b91506136d86101208c01613552565b90509295989b9194979a5092959850565b600080602083850312156136fc57600080fd5b823567ffffffffffffffff8082111561371457600080fd5b818501915085601f83011261372857600080fd5b81358181111561373757600080fd5b8660208260051b850101111561374c57600080fd5b60209290920196919550909350505050565b60005b83811015613779578181015183820152602001613761565b838111156116745750506000910152565b600081518084526137a281602086016020860161375e565b601f017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0169290920160200192915050565b6000602080830181845280855180835260408601915060408160051b870101925083870160005b82811015613847577fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc088860301845261383585835161378a565b945092850192908501906001016137fb565b5092979650505050505050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b60405160c0810167ffffffffffffffff811182821017156138a6576138a6613854565b60405290565b604051601f82017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe016810167ffffffffffffffff811182821017156138f3576138f3613854565b604052919050565b600067ffffffffffffffff82111561391557613915613854565b5060051b60200190565b600082601f83011261393057600080fd5b81356020613945613940836138fb565b6138ac565b82815260059290921b8401810191818101908684111561396457600080fd5b8286015b8481101561397f5780358352918301918301613968565b509695505050505050565b600082601f83011261399b57600080fd5b813560206139ab613940836138fb565b82815260059290921b840181019181810190868411156139ca57600080fd5b8286015b8481101561397f576139df816134a7565b83529183019183016139ce565b600080600060608486031215613a0157600080fd5b613a0a84613552565b9250602084013567ffffffffffffffff80821115613a2757600080fd5b9085019060c08288031215613a3b57600080fd5b613a43613883565b8235815260208301356020820152604083013582811115613a6357600080fd5b613a6f8982860161391f565b604083015250613a8160608401613552565b6060820152613a92608084016134a7565b608082015260a083013582811115613aa957600080fd5b613ab58982860161398a565b60a08301525093506040860135915080821115613ad157600080fd5b50613ade8682870161391f565b9150509250925092565b600067ffffffffffffffff821115613b0257613b02613854565b50601f017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe01660200190565b600082601f830112613b3f57600080fd5b8135613b4d61394082613ae8565b818152846020838601011115613b6257600080fd5b816020850160208301376000918101602001919091529392505050565b60008060008060808587031215613b9557600080fd5b613b9e856134a7565b9350613bac60208601613581565b9250613bba60408601613552565b9150606085013567ffffffffffffffff811115613bd657600080fd5b613be287828801613b2e565b91505092959194509250565b6000806000806000806000806000806101408b8d031215613c0e57600080fd5b613c178b6134a7565b9950613c2560208c016134a7565b9850613c3360408c016134a7565b975060608b0135965060808b01359550613c4f60a08c01613581565b9450613c5d60c08c01613581565b9350613c6b60e08c01613552565b9250613c7a6101008c01613552565b91506101208b013567ffffffffffffffff811115613c9757600080fd5b613ca38d828e0161391f565b9150509295989b9194979a5092959850565b6000806000806000806000806000806000806101808d8f031215613cd857600080fd5b613ce18d6134a7565b9b50613cef60208e016134a7565b9a50613cfd60408e016134a7565b995060608d0135985060808d0135975060a08d0135965060c08d01359550613d2760e08e01613581565b9450613d366101008e01613581565b9350613d456101208e01613581565b9250613d546101408e01613552565b915067ffffffffffffffff6101608e01351115613d7057600080fd5b613d818e6101608f01358f01613b2e565b90509295989b509295989b509295989b565b600060208284031215613da557600080fd5b5051919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b600063ffffffff83811690831681811015613df857613df8613dac565b039392505050565b600063ffffffff808316818516808303821115613e1f57613e1f613dac565b01949350505050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b60008083357fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe1843603018112613e8c57600080fd5b83018035915067ffffffffffffffff821115613ea757600080fd5b60200191503681900382131561308f57600080fd5b8183823760009101908152919050565b600060208284031215613ede57600080fd5b815167ffffffffffffffff811115613ef557600080fd5b8201601f81018413613f0657600080fd5b8051613f1461394082613ae8565b818152856020838501011115613f2957600080fd5b61207582602083016020860161375e565b6020815260006129c7602083018461378a565b60007fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff8203613f7e57613f7e613dac565b5060010190565b67ffffffffffffffff83168152604060208201526000612bc1604083018461378a565b815173ffffffffffffffffffffffffffffffffffffffff90811682526020808401518216908301526040808401519182169083015261012082019050606083015160608301526080830151608083015260a083015160a083015260c083015161401d60c084018267ffffffffffffffff169052565b5060e083015161403960e084018267ffffffffffffffff169052565b506101009283015163ffffffff16919092015290565b600067ffffffffffffffff808316818516808303821115613e1f57613e1f613dac565b60008282101561408457614084613dac565b500390565b6000821982111561409c5761409c613dac565b500190565b600063ffffffff8083168181036140ba576140ba613dac565b6001019392505050565b600081518084526020808501945080840160005b838110156140f4578151875295820195908201906001016140d8565b509495945050505050565b600081518084526020808501945080840160005b838110156140f457815173ffffffffffffffffffffffffffffffffffffffff1687529582019590820190600101614113565b85815260a06020820152600061415e60a08301876140c4565b73ffffffffffffffffffffffffffffffffffffffff8087166040850152838203606085015261418d82876140ff565b9250808516608085015250509695505050505050565b6000602082840312156141b557600080fd5b81516129c781613504565b600067ffffffffffffffff83811690831681811015613df857613df8613dac565b6000817fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff048311821515161561421957614219613dac565b500290565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601260045260246000fd5b60008261425c5761425c61421e565b500490565b6020815281516020820152602082015160408201526000604083015160c0606084015261429160e08401826140c4565b905063ffffffff606085015116608084015273ffffffffffffffffffffffffffffffffffffffff60808501511660a084015260a08401517fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe08483030160c085015261207582826140ff565b60008261430b5761430b61421e565b500690565b6000825161432281846020870161375e565b9190910192915050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052602160045260246000fdfea2646970667358221220a7f1307b7dde32a245b37e5a351651f10990f2f8b407aded39d08202e81402e464736f6c634300080d0033", + "deployedBytecode": "0x6080604052600436106101bb5760003560e01c80638a7860ce116100ec578063e19044021161008a578063f06850f611610064578063f06850f61461059a578063f2fde38b146105c7578063f500697c146105e7578063ffc351a31461060757600080fd5b8063e190440214610518578063e282d5b914610545578063ee2a53f81461056557600080fd5b8063a1244c67116100c6578063a1244c671461047f578063ac9650d8146104b8578063c894c0ca146104d8578063de7eba78146104f857600080fd5b80638a7860ce146104215780638da5cb5b146104415780639a8a05921461046c57600080fd5b806349228978116101595780635285e058116101335780635285e0581461037557806357f6dcb8146103a2578063715018a6146103ec57806389a153cc1461040157600080fd5b806349228978146102f7578063493a4f841461030a5780635249fef11461032a57600080fd5b8063272751c711610195578063272751c7146102605780632752042e1461028057806329cb924d146102a05780633fc8cef3146102c357600080fd5b80631c39c38d146101c75780631dfb2d021461021e57806322f8e5661461024057600080fd5b366101c257005b600080fd5b3480156101d357600080fd5b506000546101f49073ffffffffffffffffffffffffffffffffffffffff1681565b60405173ffffffffffffffffffffffffffffffffffffffff90911681526020015b60405180910390f35b34801561022a57600080fd5b5061023e6102393660046134d0565b610627565b005b34801561024c57600080fd5b5061023e61025b3660046134eb565b6106b4565b34801561026c57600080fd5b5061023e61027b366004613512565b61075d565b34801561028c57600080fd5b5061023e61029b366004613566565b610874565b3480156102ac57600080fd5b506102b5610975565b604051908152602001610215565b3480156102cf57600080fd5b506101f47f000000000000000000000000000000000000000000000000000000000000000081565b61023e610305366004613599565b610a2d565b34801561031657600080fd5b5061023e6103253660046135ff565b610e94565b34801561033657600080fd5b50610365610345366004613621565b600360209081526000928352604080842090915290825290205460ff1681565b6040519015158152602001610215565b34801561038157600080fd5b506001546101f49073ffffffffffffffffffffffffffffffffffffffff1681565b3480156103ae57600080fd5b506002546103d79074010000000000000000000000000000000000000000900463ffffffff1681565b60405163ffffffff9091168152602001610215565b3480156103f857600080fd5b5061023e610fbb565b34801561040d57600080fd5b5061023e61041c36600461364b565b611048565b34801561042d57600080fd5b5061023e61043c3660046134eb565b6111a4565b34801561044d57600080fd5b5060065473ffffffffffffffffffffffffffffffffffffffff166101f4565b34801561047857600080fd5b50466102b5565b34801561048b57600080fd5b506002546103d7907801000000000000000000000000000000000000000000000000900463ffffffff1681565b6104cb6104c63660046136e9565b611278565b60405161021591906137d4565b3480156104e457600080fd5b5061023e6104f33660046139ec565b611452565b34801561050457600080fd5b5061023e6105133660046134d0565b6114d6565b34801561052457600080fd5b506002546101f49073ffffffffffffffffffffffffffffffffffffffff1681565b34801561055157600080fd5b5061023e610560366004613b7f565b61151c565b34801561057157600080fd5b506105856105803660046134eb565b61167a565b60408051928352602083019190915201610215565b3480156105a657600080fd5b506102b56105b53660046134eb565b60056020526000908152604090205481565b3480156105d357600080fd5b5061023e6105e23660046134d0565b6116a8565b3480156105f357600080fd5b5061023e610602366004613bee565b6117d5565b34801561061357600080fd5b5061023e610622366004613cb5565b611861565b61062f6119cc565b610637611a4d565b610664600080547fffffffffffffffffffffff00ffffffffffffffffffffffffffffffffffffffff169055565b61066d81611ad1565b6106b1600080547fffffffffffffffffffffff00ffffffffffffffffffffffffffffffffffffffff1674010000000000000000000000000000000000000000179055565b50565b60005473ffffffffffffffffffffffffffffffffffffffff166106d657600080fd5b6000546040517f22f8e5660000000000000000000000000000000000000000000000000000000081526004810183905273ffffffffffffffffffffffffffffffffffffffff909116906322f8e56690602401600060405180830381600087803b15801561074257600080fd5b505af1158015610756573d6000803e3d6000fd5b5050505050565b6107656119cc565b61076d611a4d565b61079a600080547fffffffffffffffffffffff00ffffffffffffffffffffffffffffffffffffffff169055565b73ffffffffffffffffffffffffffffffffffffffff8316600081815260036020908152604080832086845282529182902080547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff001685151590811790915591519182528492917f0a21fdd43d0ad0c62689ee7230a47309a050755bcc52eba00310add65297692a910160405180910390a361086f600080547fffffffffffffffffffffff00ffffffffffffffffffffffffffffffffffffffff1674010000000000000000000000000000000000000000179055565b505050565b61087c6119cc565b610884611a4d565b6108b1600080547fffffffffffffffffffffff00ffffffffffffffffffffffffffffffffffffffff169055565b600280547fffffffffffffffff00000000ffffffffffffffffffffffffffffffffffffffff167401000000000000000000000000000000000000000063ffffffff8416908102919091179091556040519081527f0e55dd180fa793d9036c804d0a116e6a7617a48e72cee1f83d92793a793fcc039060200160405180910390a16106b1600080547fffffffffffffffffffffff00ffffffffffffffffffffffffffffffffffffffff1674010000000000000000000000000000000000000000179055565b6000805473ffffffffffffffffffffffffffffffffffffffff1615610a285760008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166329cb924d6040518163ffffffff1660e01b8152600401602060405180830381865afa1580156109ff573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610a239190613d93565b905090565b504290565b610a35611a4d565b610a62600080547fffffffffffffffffffffff00ffffffffffffffffffffffffffffffffffffffff169055565b73ffffffffffffffffffffffffffffffffffffffff8516600090815260036020908152604080832086845290915290205460ff16610b01576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152600e60248201527f44697361626c656420726f75746500000000000000000000000000000000000060448201526064015b60405180910390fd5b6706f05b59d3b200008267ffffffffffffffff1610610b7c576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601360248201527f696e76616c69642072656c6179657220666565000000000000000000000000006044820152606401610af8565b600254610ba79074010000000000000000000000000000000000000000900463ffffffff1682613ddb565b63ffffffff16610bb5610975565b10158015610bfa5750600254610be99074010000000000000000000000000000000000000000900463ffffffff1682613e00565b63ffffffff16610bf7610975565b11155b610c60576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601260248201527f696e76616c69642071756f74652074696d6500000000000000000000000000006044820152606401610af8565b7f000000000000000000000000000000000000000000000000000000000000000073ffffffffffffffffffffffffffffffffffffffff168573ffffffffffffffffffffffffffffffffffffffff16148015610cbb5750600034115b15610daf57833414610d29576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601b60248201527f6d73672e76616c7565206d757374206d6174636820616d6f756e7400000000006044820152606401610af8565b7f000000000000000000000000000000000000000000000000000000000000000073ffffffffffffffffffffffffffffffffffffffff1663d0e30db0346040518263ffffffff1660e01b81526004016000604051808303818588803b158015610d9157600080fd5b505af1158015610da5573d6000803e3d6000fd5b5050505050610dd1565b610dd173ffffffffffffffffffffffffffffffffffffffff8616333087611bbd565b610e088446600254869086907801000000000000000000000000000000000000000000000000900463ffffffff16868b8d33611c99565b6001600260188282829054906101000a900463ffffffff16610e2a9190613e00565b92506101000a81548163ffffffff021916908363ffffffff160217905550610e8c600080547fffffffffffffffffffffff00ffffffffffffffffffffffffffffffffffffffff1674010000000000000000000000000000000000000000179055565b505050505050565b610e9c6119cc565b610ea4611a4d565b610ed1600080547fffffffffffffffffffffff00ffffffffffffffffffffffffffffffffffffffff169055565b60048054600181018255600091909152600381027f8a35acfbc15ff81a39ae7d344fd709f28e8600b4aa8c65c6b64bfe7fe36bd19c81018490557f8a35acfbc15ff81a39ae7d344fd709f28e8600b4aa8c65c6b64bfe7fe36bd19b01828155604080518581526020810185905263ffffffff8416917fc86ba04c55bc5eb2f2876b91c438849a296dbec7b08751c3074d92e04f0a77af910160405180910390a25050610fb7600080547fffffffffffffffffffffff00ffffffffffffffffffffffffffffffffffffffff1674010000000000000000000000000000000000000000179055565b5050565b60065473ffffffffffffffffffffffffffffffffffffffff16331461103c576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e65726044820152606401610af8565b6110466000611d2a565b565b611050611a4d565b61107d600080547fffffffffffffffffffffff00ffffffffffffffffffffffffffffffffffffffff169055565b60006040518061012001604052808c73ffffffffffffffffffffffffffffffffffffffff1681526020018b73ffffffffffffffffffffffffffffffffffffffff1681526020018a73ffffffffffffffffffffffffffffffffffffffff1681526020018981526020018681526020016110f24690565b81526020018567ffffffffffffffff1681526020018467ffffffffffffffff1681526020018363ffffffff168152509050600061112e82611da1565b9050600061114082848b886000611dd1565b905061115182828a8887600061207e565b505050611198600080547fffffffffffffffffffffff00ffffffffffffffffffffffffffffffffffffffff1674010000000000000000000000000000000000000000179055565b50505050505050505050565b6111ac6119cc565b6111b4611a4d565b6111e1600080547fffffffffffffffffffffff00ffffffffffffffffffffffffffffffffffffffff169055565b600481815481106111f4576111f4613e28565b60009182526020822060039091020181815560010181905560405182917f3569b846531b754c99cb80df3f49cd72fa6fe106aaee5ab8e0caf35a9d7ce88d91a26106b1600080547fffffffffffffffffffffff00ffffffffffffffffffffffffffffffffffffffff1674010000000000000000000000000000000000000000179055565b606034156112e2576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601b60248201527f4f6e6c79206d756c746963616c6c207769746820302076616c756500000000006044820152606401610af8565b8167ffffffffffffffff8111156112fb576112fb613854565b60405190808252806020026020018201604052801561132e57816020015b60608152602001906001900390816113195790505b50905060005b8281101561144b576000803086868581811061135257611352613e28565b90506020028101906113649190613e57565b604051611372929190613ebc565b600060405180830381855af49150503d80600081146113ad576040519150601f19603f3d011682016040523d82523d6000602084013e6113b2565b606091505b509150915081611418576044815110156113cb57600080fd5b600481019050808060200190518101906113e59190613ecc565b6040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610af89190613f3a565b8084848151811061142b5761142b613e28565b60200260200101819052505050808061144390613f4d565b915050611334565b5092915050565b61145a611a4d565b611487600080547fffffffffffffffffffffff00ffffffffffffffffffffffffffffffffffffffff169055565b6114928383836121b3565b61086f600080547fffffffffffffffffffffff00ffffffffffffffffffffffffffffffffffffffff1674010000000000000000000000000000000000000000179055565b6114de6119cc565b6114e6611a4d565b611513600080547fffffffffffffffffffffff00ffffffffffffffffffffffffffffffffffffffff169055565b61066d81612579565b611524611a4d565b611551600080547fffffffffffffffffffffff00ffffffffffffffffffffffffffffffffffffffff169055565b6706f05b59d3b200008367ffffffffffffffff16106115cc576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601360248201527f696e76616c69642072656c6179657220666565000000000000000000000000006044820152606401610af8565b6115d98446858585612665565b8373ffffffffffffffffffffffffffffffffffffffff168263ffffffff167fb9de16bf376724405019a10ef4fedac57fecd292bf86c08d81d7c42d394d5d378584604051611628929190613f85565b60405180910390a3611674600080547fffffffffffffffffffffff00ffffffffffffffffffffffffffffffffffffffff1674010000000000000000000000000000000000000000179055565b50505050565b6004818154811061168a57600080fd5b60009182526020909120600390910201805460019091015490915082565b60065473ffffffffffffffffffffffffffffffffffffffff163314611729576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e65726044820152606401610af8565b73ffffffffffffffffffffffffffffffffffffffff81166117cc576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201527f64647265737300000000000000000000000000000000000000000000000000006064820152608401610af8565b6106b181611d2a565b6117dd611a4d565b61180a600080547fffffffffffffffffffffff00ffffffffffffffffffffffffffffffffffffffff169055565b61181d8a8a8a8a8a468b8b8b8b8b612702565b611198600080547fffffffffffffffffffffff00ffffffffffffffffffffffffffffffffffffffff1674010000000000000000000000000000000000000000179055565b611869611a4d565b611896600080547fffffffffffffffffffffff00ffffffffffffffffffffffffffffffffffffffff169055565b6118a38c87858585612665565b60006040518061012001604052808e73ffffffffffffffffffffffffffffffffffffffff1681526020018d73ffffffffffffffffffffffffffffffffffffffff1681526020018c73ffffffffffffffffffffffffffffffffffffffff1681526020018b81526020018881526020016119184690565b81526020018767ffffffffffffffff1681526020018667ffffffffffffffff1681526020018463ffffffff168152509050600061195482611da1565b9050600061196682848d896000611dd1565b905061197782828c8987600061207e565b5050506119be600080547fffffffffffffffffffffff00ffffffffffffffffffffffffffffffffffffffff1674010000000000000000000000000000000000000000179055565b505050505050505050505050565b60065473ffffffffffffffffffffffffffffffffffffffff163314611046576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e65726044820152606401610af8565b60005474010000000000000000000000000000000000000000900460ff16611046576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601f60248201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c006044820152606401610af8565b73ffffffffffffffffffffffffffffffffffffffff8116611b4e576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601460248201527f4261642068756220706f6f6c20616464726573730000000000000000000000006044820152606401610af8565b600280547fffffffffffffffffffffffff00000000000000000000000000000000000000001673ffffffffffffffffffffffffffffffffffffffff83169081179091556040517f1f17a88f67b0f49060a34bec1a4723a563620e6aa265eb640b5046dcee0759a090600090a250565b60405173ffffffffffffffffffffffffffffffffffffffff808516602483015283166044820152606481018290526116749085907f23b872dd00000000000000000000000000000000000000000000000000000000906084015b604080517fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe08184030181529190526020810180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff167fffffffff0000000000000000000000000000000000000000000000000000000090931692909217909152612881565b604080518a8152602081018a905290810188905267ffffffffffffffff8716606082015263ffffffff858116608083015273ffffffffffffffffffffffffffffffffffffffff84811660a084015280841692908616918816907f4a4fc49abd237bfd7f4ac82d6c7a284c69daaea5154430cff04ad7482c6c42549060c00160405180910390a4505050505050505050565b6006805473ffffffffffffffffffffffffffffffffffffffff8381167fffffffffffffffffffffffff0000000000000000000000000000000000000000831681179093556040519116919082907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e090600090a35050565b600081604051602001611db49190613fa8565b604051602081830303815290604052805190602001209050919050565b60006706f05b59d3b200008367ffffffffffffffff16108015611e0957506706f05b59d3b200008560c0015167ffffffffffffffff16105b611e6f576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152600c60248201527f696e76616c6964206665657300000000000000000000000000000000000000006044820152606401610af8565b606085015160008781526005602052604090205410611eea576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152600c60248201527f72656c61792066696c6c656400000000000000000000000000000000000000006044820152606401610af8565b83600003611efa57506000612075565b611f1384848760c00151611f0e919061404f565b61298d565b60008781526005602052604081205460608801519293508692611f369190614072565b905082811015611f5f57809250611f5c83868960c00151611f57919061404f565b6129ce565b91505b60008881526005602052604081208054859290611f7d908490614089565b9091555050604087015173ffffffffffffffffffffffffffffffffffffffff7f000000000000000000000000000000000000000000000000000000000000000081169116036120055783611ff2576040870151611ff29073ffffffffffffffffffffffffffffffffffffffff16333085611bbd565b6120008760200151836129f7565b612072565b8361203f57612000338860200151848a6040015173ffffffffffffffffffffffffffffffffffffffff16611bbd909392919063ffffffff16565b612072876020015183896040015173ffffffffffffffffffffffffffffffffffffffff16612b389092919063ffffffff16565b50505b95945050505050565b816000015173ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16877f1d59c1d19baf4b4de03cec9c844258e7ca2f2004975025eb14fe9a5e1d4e0d888560600151600560008c8152602001908152602001600020548a8a89608001518a60a001518c8c60c001518d61010001518e604001518f602001518f6040516121a39c9b9a999897969594939291909b8c5260208c019a909a5260408b019890985260608a0196909652608089019490945260a088019290925267ffffffffffffffff90811660c08801521660e086015263ffffffff1661010085015273ffffffffffffffffffffffffffffffffffffffff9081166101208501521661014083015215156101608201526101800190565b60405180910390a4505050505050565b46826020015114612220576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152600f60248201527f496e76616c696420636861696e496400000000000000000000000000000000006044820152606401610af8565b8160400151518260a001515114612293576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152600c60248201527f696e76616c6964206c65616600000000000000000000000000000000000000006044820152606401610af8565b600060048463ffffffff16815481106122ae576122ae613e28565b906000526020600020906003020190506122cd81600101548484612b8e565b612333576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152600960248201527f4261642050726f6f6600000000000000000000000000000000000000000000006044820152606401610af8565b61234a81600201846060015163ffffffff16612bc9565b156123b1576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152600f60248201527f416c726561647920636c61696d656400000000000000000000000000000000006044820152606401610af8565b6123c881600201846060015163ffffffff16612c0a565b60005b8360400151518163ffffffff16101561247457600084604001518263ffffffff16815181106123fc576123fc613e28565b602002602001015190506000811115612461576124618560a001518363ffffffff168151811061242e5761242e613e28565b602002602001015182876080015173ffffffffffffffffffffffffffffffffffffffff16612b389092919063ffffffff16565b508061246c816140a1565b9150506123cb565b5082511561250d5761248583612c48565b826080015173ffffffffffffffffffffffffffffffffffffffff16836060015163ffffffff1684602001517f828fc203220356df8f072a91681caee7d5c75095e2a95e80ed5a14b384697f7186600001513360405161250492919091825273ffffffffffffffffffffffffffffffffffffffff16602082015260400190565b60405180910390a45b826060015163ffffffff168463ffffffff1684602001517ff8bd640004bcec1b89657020f561d0b070cbdf662d0b158db9dccb0a8301bfab8660000151876040015188608001518960a001513360405161256b959493929190614145565b60405180910390a450505050565b73ffffffffffffffffffffffffffffffffffffffff81166125f6576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601960248201527f4261642062726964676520726f757465722061646472657373000000000000006044820152606401610af8565b600180547fffffffffffffffffffffffff00000000000000000000000000000000000000001673ffffffffffffffffffffffffffffffffffffffff83169081179091556040517fa9e8c42c9e7fca7f62755189a16b2f5314d43d8fb24e91ba54e6d65f9314e84990600090a250565b60408051608060208201819052601160a08301527f4143524f53532d56322d4645452d312e3000000000000000000000000000000060c083015267ffffffffffffffff86169282019290925263ffffffff8416606082015290810185905260009060e00160405160208183030381529060405280519060200120905060006126ec82612cec565b90506126f9878285612d27565b50505050505050565b60006040518061012001604052808d73ffffffffffffffffffffffffffffffffffffffff1681526020018c73ffffffffffffffffffffffffffffffffffffffff1681526020018b73ffffffffffffffffffffffffffffffffffffffff1681526020018a81526020018981526020018881526020018767ffffffffffffffff1681526020018667ffffffffffffffff1681526020018563ffffffff1681525090506127d760048463ffffffff16815481106127be576127be613e28565b9060005260206000209060030201600001548284612dc5565b61283d576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152600d60248201527f496e76616c69642070726f6f66000000000000000000000000000000000000006044820152606401610af8565b600061284882611da1565b9050600061285f8284856060015160006001611dd1565b9050612871828260008087600161207e565b5050505050505050505050505050565b60006128e3826040518060400160405280602081526020017f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c65648152508573ffffffffffffffffffffffffffffffffffffffff16612ddd9092919063ffffffff16565b80519091501561086f578080602001905181019061290191906141a3565b61086f576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602a60248201527f5361666545524332303a204552433230206f7065726174696f6e20646964206e60448201527f6f742073756363656564000000000000000000000000000000000000000000006064820152608401610af8565b60006129a182670de0b6b3a76400006141c0565b67ffffffffffffffff166129bd84670de0b6b3a76400006141e1565b6129c7919061424d565b9392505050565b6000670de0b6b3a76400006129e383826141c0565b6129bd9067ffffffffffffffff16856141e1565b73ffffffffffffffffffffffffffffffffffffffff82163b15612a5557610fb773ffffffffffffffffffffffffffffffffffffffff7f0000000000000000000000000000000000000000000000000000000000000000168383612b38565b6040517f2e1a7d4d000000000000000000000000000000000000000000000000000000008152600481018290527f000000000000000000000000000000000000000000000000000000000000000073ffffffffffffffffffffffffffffffffffffffff1690632e1a7d4d90602401600060405180830381600087803b158015612add57600080fd5b505af1158015612af1573d6000803e3d6000fd5b505060405173ffffffffffffffffffffffffffffffffffffffff8516925083156108fc02915083906000818181858888f1935050505015801561086f573d6000803e3d6000fd5b60405173ffffffffffffffffffffffffffffffffffffffff831660248201526044810182905261086f9084907fa9059cbb0000000000000000000000000000000000000000000000000000000090606401611c17565b6000612bc1828585604051602001612ba69190614261565b60405160208183030381529060405280519060200120612dec565b949350505050565b600080612bd86101008461424d565b90506000612be8610100856142fc565b6000928352602095909552506040902054600190931b92831690921492915050565b6000612c186101008361424d565b90506000612c28610100846142fc565b600092835260209490945250604090208054600190931b90921790915550565b608081015160025482516040517fa9059cbb00000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff9283166004820152602481019190915291169063a9059cbb906044016020604051808303816000875af1158015612cc8573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610fb791906141a3565b6040517f19457468657265756d205369676e6564204d6573736167653a0a3332000000006020820152603c8101829052600090605c01611db4565b612d318282612e02565b73ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161461086f576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601160248201527f696e76616c6964207369676e61747572650000000000000000000000000000006044820152606401610af8565b6000612bc1828585604051602001612ba69190613fa8565b6060612bc18484600085612e26565b600082612df98584612fbc565b14949350505050565b6000806000612e118585613028565b91509150612e1e81613096565b509392505050565b606082471015612eb8576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602660248201527f416464726573733a20696e73756666696369656e742062616c616e636520666f60448201527f722063616c6c00000000000000000000000000000000000000000000000000006064820152608401610af8565b73ffffffffffffffffffffffffffffffffffffffff85163b612f36576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e74726163740000006044820152606401610af8565b6000808673ffffffffffffffffffffffffffffffffffffffff168587604051612f5f9190614310565b60006040518083038185875af1925050503d8060008114612f9c576040519150601f19603f3d011682016040523d82523d6000602084013e612fa1565b606091505b5091509150612fb18282866132ea565b979650505050505050565b600081815b8451811015612e1e576000858281518110612fde57612fde613e28565b602002602001015190508083116130045760008381526020829052604090209250613015565b600081815260208490526040902092505b508061302081613f4d565b915050612fc1565b600080825160410361305e5760208301516040840151606085015160001a6130528782858561333d565b9450945050505061308f565b8251604003613087576020830151604084015161307c868383613455565b93509350505061308f565b506000905060025b9250929050565b60008160048111156130aa576130aa61432c565b036130b25750565b60018160048111156130c6576130c661432c565b0361312d576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601860248201527f45434453413a20696e76616c6964207369676e617475726500000000000000006044820152606401610af8565b60028160048111156131415761314161432c565b036131a8576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601f60248201527f45434453413a20696e76616c6964207369676e6174757265206c656e677468006044820152606401610af8565b60038160048111156131bc576131bc61432c565b03613249576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602260248201527f45434453413a20696e76616c6964207369676e6174757265202773272076616c60448201527f75650000000000000000000000000000000000000000000000000000000000006064820152608401610af8565b600481600481111561325d5761325d61432c565b036106b1576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602260248201527f45434453413a20696e76616c6964207369676e6174757265202776272076616c60448201527f75650000000000000000000000000000000000000000000000000000000000006064820152608401610af8565b606083156132f95750816129c7565b8251156133095782518084602001fd5b816040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610af89190613f3a565b6000807f7fffffffffffffffffffffffffffffff5d576e7357a4501ddfe92f46681b20a0831115613374575060009050600361344c565b8460ff16601b1415801561338c57508460ff16601c14155b1561339d575060009050600461344c565b6040805160008082526020820180845289905260ff881692820192909252606081018690526080810185905260019060a0016020604051602081039080840390855afa1580156133f1573d6000803e3d6000fd5b50506040517fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0015191505073ffffffffffffffffffffffffffffffffffffffff81166134455760006001925092505061344c565b9150600090505b94509492505050565b6000807f7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff83168161348b60ff86901c601b614089565b90506134998782888561333d565b935093505050935093915050565b803573ffffffffffffffffffffffffffffffffffffffff811681146134cb57600080fd5b919050565b6000602082840312156134e257600080fd5b6129c7826134a7565b6000602082840312156134fd57600080fd5b5035919050565b80151581146106b157600080fd5b60008060006060848603121561352757600080fd5b613530846134a7565b925060208401359150604084013561354781613504565b809150509250925092565b803563ffffffff811681146134cb57600080fd5b60006020828403121561357857600080fd5b6129c782613552565b803567ffffffffffffffff811681146134cb57600080fd5b60008060008060008060c087890312156135b257600080fd5b6135bb876134a7565b95506135c9602088016134a7565b945060408701359350606087013592506135e560808801613581565b91506135f360a08801613552565b90509295509295509295565b6000806040838503121561361257600080fd5b50508035926020909101359150565b6000806040838503121561363457600080fd5b61363d836134a7565b946020939093013593505050565b6000806000806000806000806000806101408b8d03121561366b57600080fd5b6136748b6134a7565b995061368260208c016134a7565b985061369060408c016134a7565b975060608b0135965060808b0135955060a08b0135945060c08b013593506136ba60e08c01613581565b92506136c96101008c01613581565b91506136d86101208c01613552565b90509295989b9194979a5092959850565b600080602083850312156136fc57600080fd5b823567ffffffffffffffff8082111561371457600080fd5b818501915085601f83011261372857600080fd5b81358181111561373757600080fd5b8660208260051b850101111561374c57600080fd5b60209290920196919550909350505050565b60005b83811015613779578181015183820152602001613761565b838111156116745750506000910152565b600081518084526137a281602086016020860161375e565b601f017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0169290920160200192915050565b6000602080830181845280855180835260408601915060408160051b870101925083870160005b82811015613847577fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc088860301845261383585835161378a565b945092850192908501906001016137fb565b5092979650505050505050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b60405160c0810167ffffffffffffffff811182821017156138a6576138a6613854565b60405290565b604051601f82017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe016810167ffffffffffffffff811182821017156138f3576138f3613854565b604052919050565b600067ffffffffffffffff82111561391557613915613854565b5060051b60200190565b600082601f83011261393057600080fd5b81356020613945613940836138fb565b6138ac565b82815260059290921b8401810191818101908684111561396457600080fd5b8286015b8481101561397f5780358352918301918301613968565b509695505050505050565b600082601f83011261399b57600080fd5b813560206139ab613940836138fb565b82815260059290921b840181019181810190868411156139ca57600080fd5b8286015b8481101561397f576139df816134a7565b83529183019183016139ce565b600080600060608486031215613a0157600080fd5b613a0a84613552565b9250602084013567ffffffffffffffff80821115613a2757600080fd5b9085019060c08288031215613a3b57600080fd5b613a43613883565b8235815260208301356020820152604083013582811115613a6357600080fd5b613a6f8982860161391f565b604083015250613a8160608401613552565b6060820152613a92608084016134a7565b608082015260a083013582811115613aa957600080fd5b613ab58982860161398a565b60a08301525093506040860135915080821115613ad157600080fd5b50613ade8682870161391f565b9150509250925092565b600067ffffffffffffffff821115613b0257613b02613854565b50601f017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe01660200190565b600082601f830112613b3f57600080fd5b8135613b4d61394082613ae8565b818152846020838601011115613b6257600080fd5b816020850160208301376000918101602001919091529392505050565b60008060008060808587031215613b9557600080fd5b613b9e856134a7565b9350613bac60208601613581565b9250613bba60408601613552565b9150606085013567ffffffffffffffff811115613bd657600080fd5b613be287828801613b2e565b91505092959194509250565b6000806000806000806000806000806101408b8d031215613c0e57600080fd5b613c178b6134a7565b9950613c2560208c016134a7565b9850613c3360408c016134a7565b975060608b0135965060808b01359550613c4f60a08c01613581565b9450613c5d60c08c01613581565b9350613c6b60e08c01613552565b9250613c7a6101008c01613552565b91506101208b013567ffffffffffffffff811115613c9757600080fd5b613ca38d828e0161391f565b9150509295989b9194979a5092959850565b6000806000806000806000806000806000806101808d8f031215613cd857600080fd5b613ce18d6134a7565b9b50613cef60208e016134a7565b9a50613cfd60408e016134a7565b995060608d0135985060808d0135975060a08d0135965060c08d01359550613d2760e08e01613581565b9450613d366101008e01613581565b9350613d456101208e01613581565b9250613d546101408e01613552565b915067ffffffffffffffff6101608e01351115613d7057600080fd5b613d818e6101608f01358f01613b2e565b90509295989b509295989b509295989b565b600060208284031215613da557600080fd5b5051919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b600063ffffffff83811690831681811015613df857613df8613dac565b039392505050565b600063ffffffff808316818516808303821115613e1f57613e1f613dac565b01949350505050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b60008083357fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe1843603018112613e8c57600080fd5b83018035915067ffffffffffffffff821115613ea757600080fd5b60200191503681900382131561308f57600080fd5b8183823760009101908152919050565b600060208284031215613ede57600080fd5b815167ffffffffffffffff811115613ef557600080fd5b8201601f81018413613f0657600080fd5b8051613f1461394082613ae8565b818152856020838501011115613f2957600080fd5b61207582602083016020860161375e565b6020815260006129c7602083018461378a565b60007fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff8203613f7e57613f7e613dac565b5060010190565b67ffffffffffffffff83168152604060208201526000612bc1604083018461378a565b815173ffffffffffffffffffffffffffffffffffffffff90811682526020808401518216908301526040808401519182169083015261012082019050606083015160608301526080830151608083015260a083015160a083015260c083015161401d60c084018267ffffffffffffffff169052565b5060e083015161403960e084018267ffffffffffffffff169052565b506101009283015163ffffffff16919092015290565b600067ffffffffffffffff808316818516808303821115613e1f57613e1f613dac565b60008282101561408457614084613dac565b500390565b6000821982111561409c5761409c613dac565b500190565b600063ffffffff8083168181036140ba576140ba613dac565b6001019392505050565b600081518084526020808501945080840160005b838110156140f4578151875295820195908201906001016140d8565b509495945050505050565b600081518084526020808501945080840160005b838110156140f457815173ffffffffffffffffffffffffffffffffffffffff1687529582019590820190600101614113565b85815260a06020820152600061415e60a08301876140c4565b73ffffffffffffffffffffffffffffffffffffffff8087166040850152838203606085015261418d82876140ff565b9250808516608085015250509695505050505050565b6000602082840312156141b557600080fd5b81516129c781613504565b600067ffffffffffffffff83811690831681811015613df857613df8613dac565b6000817fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff048311821515161561421957614219613dac565b500290565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601260045260246000fd5b60008261425c5761425c61421e565b500490565b6020815281516020820152602082015160408201526000604083015160c0606084015261429160e08401826140c4565b905063ffffffff606085015116608084015273ffffffffffffffffffffffffffffffffffffffff60808501511660a084015260a08401517fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe08483030160c085015261207582826140ff565b60008261430b5761430b61421e565b500690565b6000825161432281846020870161375e565b9190910192915050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052602160045260246000fdfea2646970667358221220a7f1307b7dde32a245b37e5a351651f10990f2f8b407aded39d08202e81402e464736f6c634300080d0033", "devdoc": { - "details": "Used on Ethereum L1 to facilitate L2->L1 transfers.", "kind": "dev", "methods": { + "chainId()": { + "details": "Some L2s like ZKSync don't support the CHAIN_ID opcode so we allow the implementer to override this." + }, + "constructor": { + "params": { + "_hubPool": "Hub pool address to set. Can be changed by admin.", + "_wethAddress": "Weth address for this network to set.", + "timerAddress": "Timer address to set." + } + }, "deposit(address,address,uint256,uint256,uint64,uint32)": { - "details": "The caller must first approve this contract to spend `amount` of `originToken`." + "params": { + "amount": "Amount of tokens to deposit. Will be amount of tokens to receive less fees.", + "destinationChainId": "Denotes network where user will receive funds from SpokePool by a relayer.", + "originToken": "Token to lock into this contract to initiate deposit.", + "quoteTimestamp": "Timestamp used by relayers to compute this deposit's realizedLPFeePct which is paid to LP pool on HubPool.", + "recipient": "Address to receive funds at on destination chain.", + "relayerFeePct": "% of deposit amount taken out to incentivize a fast relayer." + } + }, + "emergencyDeleteRootBundle(uint256)": { + "params": { + "rootBundleId": "Index of the root bundle that needs to be deleted. Note: this is intentionally a uint256 to ensure that a small input range doesn't limit which indices this method is able to reach." + } + }, + "executeRelayerRefundRoot(uint32,(uint256,uint256,uint256[],uint32,address,address[]),bytes32[])": { + "params": { + "proof": "Inclusion proof for this leaf in relayer refund root in root bundle.", + "relayerRefundLeaf": "Contains all data necessary to reconstruct leaf contained in root bundle and to refund relayer. This data structure is explained in detail in the SpokePoolInterface.", + "rootBundleId": "Unique ID of root bundle containing relayer refund root that this leaf is contained in." + } + }, + "executeSlowRelayRoot(address,address,address,uint256,uint256,uint64,uint64,uint32,uint32,bytes32[])": { + "details": "This function assumes that the relay's destination chain ID is the current chain ID, which prevents the caller from executing a slow relay intended for another chain on this chain.", + "params": { + "amount": "Full size of the deposit.", + "depositId": "Unique deposit ID on origin spoke pool.", + "depositor": "Depositor on origin chain who set this chain as the destination chain.", + "destinationToken": "Token to send to recipient. Should be mapped to the origin token, origin chain ID and this chain ID via a mapping on the HubPool.", + "originChainId": "Chain of SpokePool where deposit originated.", + "proof": "Inclusion proof for this leaf in slow relay root in root bundle.", + "realizedLpFeePct": "Fee % based on L1 HubPool utilization at deposit quote time. Deterministic based on quote time.", + "recipient": "Specified recipient on this chain.", + "relayerFeePct": "Original fee % to keep as relayer set by depositor.", + "rootBundleId": "Unique ID of root bundle containing slow relay root that this leaf is contained in." + } + }, + "fillRelay(address,address,address,uint256,uint256,uint256,uint256,uint64,uint64,uint32)": { + "params": { + "amount": "Full size of the deposit.", + "depositId": "Unique deposit ID on origin spoke pool.", + "depositor": "Depositor on origin chain who set this chain as the destination chain.", + "destinationToken": "Token to send to recipient. Should be mapped to the origin token, origin chain ID and this chain ID via a mapping on the HubPool.", + "maxTokensToSend": "Max amount of tokens to send recipient. If higher than amount, then caller will send recipient the full relay amount.", + "originChainId": "Chain of SpokePool where deposit originated.", + "realizedLpFeePct": "Fee % based on L1 HubPool utilization at deposit quote time. Deterministic based on quote time.", + "recipient": "Specified recipient on this chain.", + "relayerFeePct": "Fee % to keep as relayer, specified by depositor.", + "repaymentChainId": "Chain of SpokePool where relayer wants to be refunded after the challenge window has passed." + } + }, + "fillRelayWithUpdatedFee(address,address,address,uint256,uint256,uint256,uint256,uint64,uint64,uint64,uint32,bytes)": { + "params": { + "amount": "Full size of the deposit.", + "depositId": "Unique deposit ID on origin spoke pool.", + "depositor": "Depositor on origin chain who set this chain as the destination chain.", + "depositorSignature": "Depositor-signed message containing updated fee %.", + "destinationToken": "Token to send to recipient. Should be mapped to the origin token, origin chain ID and this chain ID via a mapping on the HubPool.", + "maxTokensToSend": "Max amount of tokens to send recipient. If higher than amount, then caller will send recipient the full relay amount.", + "newRelayerFeePct": "New fee % to keep as relayer also specified by depositor.", + "originChainId": "Chain of SpokePool where deposit originated.", + "realizedLpFeePct": "Fee % based on L1 HubPool utilization at deposit quote time. Deterministic based on quote time.", + "recipient": "Specified recipient on this chain.", + "relayerFeePct": "Original fee % to keep as relayer set by depositor.", + "repaymentChainId": "Chain of SpokePool where relayer wants to be refunded after the challenge window has passed." + } }, "getCurrentTime()": { "returns": { @@ -1134,15 +1218,51 @@ "owner()": { "details": "Returns the address of the current owner." }, + "relayRootBundle(bytes32,bytes32)": { + "params": { + "relayerRefundRoot": "Merkle root containing relayer refund leaves that can be individually executed via executeRelayerRefundRoot().", + "slowRelayRoot": "Merkle root containing slow relay fulfillment leaves that can be individually executed via executeSlowRelayRoot()." + } + }, "renounceOwnership()": { "details": "Leaves the contract without owner. It will not be possible to call `onlyOwner` functions anymore. Can only be called by the current owner. NOTE: Renouncing ownership will leave the contract without an owner, thereby removing any functionality that is only available to the owner." }, + "setCrossDomainAdmin(address)": { + "params": { + "newCrossDomainAdmin": "New cross domain admin." + } + }, "setCurrentTime(uint256)": { "details": "Will revert if not running in test mode.", "params": { "time": "timestamp to set current Testable time to." } }, + "setDepositQuoteTimeBuffer(uint32)": { + "params": { + "newDepositQuoteTimeBuffer": "New quote time buffer." + } + }, + "setEnableRoute(address,uint256,bool)": { + "params": { + "destinationChainId": "Chain ID for where depositor wants to receive funds.", + "enabled": "True to enable deposits, False otherwise.", + "originToken": "Token that depositor can deposit to this contract." + } + }, + "setHubPool(address)": { + "params": { + "newHubPool": "New hub pool." + } + }, + "speedUpDeposit(address,uint64,uint32,bytes)": { + "params": { + "depositId": "Deposit to update fee for that originated in this contract.", + "depositor": "Signer of the update fee message who originally submitted the deposit. If the deposit doesn't exist, then the relayer will not be able to fill any relay, so the caller should validate that the depositor did in fact submit a relay.", + "depositorSignature": "Signed message containing the depositor address, this contract chain ID, the updated relayer fee %, and the deposit ID. This signature is produced by signing a hash of data according to the EIP-191 standard. See more in the _verifyUpdateRelayerFeeMessage() comments.", + "newRelayerFeePct": "New relayer fee that relayers can use." + } + }, "transferOwnership(address)": { "details": "Transfers ownership of the contract to a new account (`newOwner`). Can only be called by the current owner." } @@ -1152,23 +1272,62 @@ "userdoc": { "kind": "user", "methods": { + "chainId()": { + "notice": "Returns chain ID for this network." + }, + "constructor": { + "notice": "Construct the Ethereum SpokePool." + }, "deposit(address,address,uint256,uint256,uint64,uint32)": { - "notice": "Called by user to bridge funds from origin to destination chain." + "notice": "Called by user to bridge funds from origin to destination chain. Depositor will effectively lock tokens in this contract and receive a destination token on the destination chain. The origin => destination token mapping is stored on the L1 HubPool.The caller must first approve this contract to spend amount of originToken.The originToken => destinationChainId must be enabled.This method is payable because the caller is able to deposit ETH if the originToken is WETH and this function will handle wrapping ETH." + }, + "emergencyDeleteRootBundle(uint256)": { + "notice": "This method is intended to only be used in emergencies where a bad root bundle has reached the SpokePool." + }, + "executeRelayerRefundRoot(uint32,(uint256,uint256,uint256[],uint32,address,address[]),bytes32[])": { + "notice": "Executes a relayer refund leaf stored as part of a root bundle. Will send the relayer the amount they sent to the recipient plus a relayer fee." + }, + "executeSlowRelayRoot(address,address,address,uint256,uint256,uint64,uint64,uint32,uint32,bytes32[])": { + "notice": "Executes a slow relay leaf stored as part of a root bundle. Will send the full amount remaining in the relay to the recipient, less fees." + }, + "fillRelay(address,address,address,uint256,uint256,uint256,uint256,uint64,uint64,uint32)": { + "notice": "Called by relayer to fulfill part of a deposit by sending destination tokens to the recipient. Relayer is expected to pass in unique identifying information for deposit that they want to fulfill, and this relay submission will be validated by off-chain data workers who can dispute this relay if any part is invalid. If the relay is valid, then the relayer will be refunded on their desired repayment chain. If relay is invalid, then relayer will not receive any refund.All of the deposit data can be found via on-chain events from the origin SpokePool, except for the realizedLpFeePct which is a function of the HubPool's utilization at the deposit quote time. This fee % is deterministic based on the quote time, so the relayer should just compute it using the canonical algorithm as described in a UMIP linked to the HubPool's identifier." + }, + "fillRelayWithUpdatedFee(address,address,address,uint256,uint256,uint256,uint256,uint64,uint64,uint64,uint32,bytes)": { + "notice": "Called by relayer to execute same logic as calling fillRelay except that relayer is using an updated relayer fee %. The fee % must have been emitted in a message cryptographically signed by the depositor.By design, the depositor probably emitted the message with the updated fee by calling speedUpRelay()." }, "getCurrentTime()": { "notice": "Gets the current time. Will return the last time set in `setCurrentTime` if running in test mode. Otherwise, it will return the block timestamp." }, + "relayRootBundle(bytes32,bytes32)": { + "notice": "This method stores a new root bundle in this contract that can be executed to refund relayers, fulfill slow relays, and send funds back to the HubPool on L1. This method can only be called by the admin and is designed to be called as part of a cross-chain message from the HubPool's executeRootBundle method." + }, + "setCrossDomainAdmin(address)": { + "notice": "Change cross domain admin address. Callable by admin only." + }, "setCurrentTime(uint256)": { "notice": "Sets the current time." + }, + "setDepositQuoteTimeBuffer(uint32)": { + "notice": "Change allowance for deposit quote time to differ from current block time. Callable by admin only." + }, + "setEnableRoute(address,uint256,bool)": { + "notice": "Enable/Disable an origin token => destination chain ID route for deposits. Callable by admin only." + }, + "setHubPool(address)": { + "notice": "Change L1 hub pool address. Callable by admin only." + }, + "speedUpDeposit(address,uint64,uint32,bytes)": { + "notice": "Convenience method that depositor can use to signal to relayer to use updated fee.Relayer should only use events emitted by this function to submit fills with updated fees, otherwise they risk their fills getting disputed for being invalid, for example if the depositor never actually signed the update fee message.This function will revert if the depositor did not sign a message containing the updated fee for the deposit ID stored in this contract. If the deposit ID is for another contract, or the depositor address is incorrect, or the updated fee is incorrect, then the signature will not match and this function will revert." } }, - "notice": "Ethereum L1 specific SpokePool.", + "notice": "Ethereum L1 specific SpokePool. Used on Ethereum L1 to facilitate L2->L1 transfers.", "version": 1 }, "storageLayout": { "storage": [ { - "astId": 5882, + "astId": 5790, "contract": "contracts/Ethereum_SpokePool.sol:Ethereum_SpokePool", "label": "timerAddress", "offset": 0, @@ -1176,7 +1335,7 @@ "type": "t_address" }, { - "astId": 5108, + "astId": 7084, "contract": "contracts/Ethereum_SpokePool.sol:Ethereum_SpokePool", "label": "_notEntered", "offset": 20, @@ -1184,7 +1343,7 @@ "type": "t_bool" }, { - "astId": 7835, + "astId": 8179, "contract": "contracts/Ethereum_SpokePool.sol:Ethereum_SpokePool", "label": "crossDomainAdmin", "offset": 0, @@ -1192,7 +1351,7 @@ "type": "t_address" }, { - "astId": 7837, + "astId": 8181, "contract": "contracts/Ethereum_SpokePool.sol:Ethereum_SpokePool", "label": "hubPool", "offset": 0, @@ -1200,59 +1359,43 @@ "type": "t_address" }, { - "astId": 7840, - "contract": "contracts/Ethereum_SpokePool.sol:Ethereum_SpokePool", - "label": "weth", - "offset": 0, - "slot": "3", - "type": "t_contract(WETH9)9916" - }, - { - "astId": 7842, - "contract": "contracts/Ethereum_SpokePool.sol:Ethereum_SpokePool", - "label": "deploymentTime", - "offset": 20, - "slot": "3", - "type": "t_uint32" - }, - { - "astId": 7845, + "astId": 8187, "contract": "contracts/Ethereum_SpokePool.sol:Ethereum_SpokePool", "label": "depositQuoteTimeBuffer", - "offset": 24, - "slot": "3", + "offset": 20, + "slot": "2", "type": "t_uint32" }, { - "astId": 7847, + "astId": 8189, "contract": "contracts/Ethereum_SpokePool.sol:Ethereum_SpokePool", "label": "numberOfDeposits", - "offset": 28, - "slot": "3", + "offset": 24, + "slot": "2", "type": "t_uint32" }, { - "astId": 7853, + "astId": 8195, "contract": "contracts/Ethereum_SpokePool.sol:Ethereum_SpokePool", "label": "enabledDepositRoutes", "offset": 0, - "slot": "4", + "slot": "3", "type": "t_mapping(t_address,t_mapping(t_uint256,t_bool))" }, { - "astId": 7866, + "astId": 8199, "contract": "contracts/Ethereum_SpokePool.sol:Ethereum_SpokePool", "label": "rootBundles", "offset": 0, - "slot": "5", - "type": "t_array(t_struct(RootBundle)7862_storage)dyn_storage" + "slot": "4", + "type": "t_array(t_struct(RootBundle)9627_storage)dyn_storage" }, { - "astId": 7870, + "astId": 8203, "contract": "contracts/Ethereum_SpokePool.sol:Ethereum_SpokePool", "label": "relayFills", "offset": 0, - "slot": "6", + "slot": "5", "type": "t_mapping(t_bytes32,t_uint256)" }, { @@ -1260,7 +1403,7 @@ "contract": "contracts/Ethereum_SpokePool.sol:Ethereum_SpokePool", "label": "_owner", "offset": 0, - "slot": "7", + "slot": "6", "type": "t_address" } ], @@ -1270,10 +1413,10 @@ "label": "address", "numberOfBytes": "20" }, - "t_array(t_struct(RootBundle)7862_storage)dyn_storage": { - "base": "t_struct(RootBundle)7862_storage", + "t_array(t_struct(RootBundle)9627_storage)dyn_storage": { + "base": "t_struct(RootBundle)9627_storage", "encoding": "dynamic_array", - "label": "struct SpokePool.RootBundle[]", + "label": "struct SpokePoolInterface.RootBundle[]", "numberOfBytes": "32" }, "t_bool": { @@ -1286,11 +1429,6 @@ "label": "bytes32", "numberOfBytes": "32" }, - "t_contract(WETH9)9916": { - "encoding": "inplace", - "label": "contract WETH9", - "numberOfBytes": "20" - }, "t_mapping(t_address,t_mapping(t_uint256,t_bool))": { "encoding": "mapping", "key": "t_address", @@ -1319,20 +1457,20 @@ "numberOfBytes": "32", "value": "t_uint256" }, - "t_struct(RootBundle)7862_storage": { + "t_struct(RootBundle)9627_storage": { "encoding": "inplace", - "label": "struct SpokePool.RootBundle", + "label": "struct SpokePoolInterface.RootBundle", "members": [ { - "astId": 7855, + "astId": 9620, "contract": "contracts/Ethereum_SpokePool.sol:Ethereum_SpokePool", - "label": "slowRelayFulfillmentRoot", + "label": "slowRelayRoot", "offset": 0, "slot": "0", "type": "t_bytes32" }, { - "astId": 7857, + "astId": 9622, "contract": "contracts/Ethereum_SpokePool.sol:Ethereum_SpokePool", "label": "relayerRefundRoot", "offset": 0, @@ -1340,7 +1478,7 @@ "type": "t_bytes32" }, { - "astId": 7861, + "astId": 9626, "contract": "contracts/Ethereum_SpokePool.sol:Ethereum_SpokePool", "label": "claimedBitmap", "offset": 0, diff --git a/deployments/rinkeby/HubPool.json b/deployments/rinkeby/HubPool.json index 953fb4cfc..e241cfb42 100644 --- a/deployments/rinkeby/HubPool.json +++ b/deployments/rinkeby/HubPool.json @@ -1,5 +1,5 @@ { - "address": "0xFA6326FdF1f149B63d116576fCfbc7e15cc0355A", + "address": "0xa1b6DA4AaE90fA16F3A3338c8d1Dc70B4926FCa7", "abi": [ { "inputs": [ @@ -71,6 +71,37 @@ "name": "CrossChainContractsSet", "type": "event" }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "bytes32", + "name": "poolRebalanceRoot", + "type": "bytes32" + }, + { + "indexed": true, + "internalType": "bytes32", + "name": "relayerRefundRoot", + "type": "bytes32" + }, + { + "indexed": false, + "internalType": "bytes32", + "name": "slowRelayRoot", + "type": "bytes32" + }, + { + "indexed": true, + "internalType": "address", + "name": "proposer", + "type": "address" + } + ], + "name": "EmergencyRootBundleDeleted", + "type": "event" + }, { "anonymous": false, "inputs": [ @@ -216,14 +247,27 @@ "name": "OwnershipTransferred", "type": "event" }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "bool", + "name": "isPaused", + "type": "bool" + } + ], + "name": "Paused", + "type": "event" + }, { "anonymous": false, "inputs": [ { "indexed": false, - "internalType": "uint64", + "internalType": "uint32", "name": "requestExpirationTimestamp", - "type": "uint64" + "type": "uint32" }, { "indexed": false, @@ -252,7 +296,7 @@ { "indexed": false, "internalType": "bytes32", - "name": "slowRelayFulfillmentRoot", + "name": "slowRelayRoot", "type": "bytes32" }, { @@ -317,12 +361,25 @@ "internalType": "uint256", "name": "requestTime", "type": "uint256" + } + ], + "name": "RootBundleCanceled", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "disputer", + "type": "address" }, { "indexed": false, - "internalType": "bytes", - "name": "disputedAncillaryData", - "type": "bytes" + "internalType": "uint256", + "name": "requestTime", + "type": "uint256" } ], "name": "RootBundleDisputed", @@ -331,6 +388,12 @@ { "anonymous": false, "inputs": [ + { + "indexed": false, + "internalType": "uint256", + "name": "groupIndex", + "type": "uint256" + }, { "indexed": true, "internalType": "uint256", @@ -383,48 +446,73 @@ { "indexed": true, "internalType": "uint256", - "name": "chainId", + "name": "originChainId", "type": "uint256" }, + { + "indexed": true, + "internalType": "uint256", + "name": "destinationChainId", + "type": "uint256" + }, + { + "indexed": true, + "internalType": "address", + "name": "originToken", + "type": "address" + }, { "indexed": false, - "internalType": "bytes", - "name": "message", - "type": "bytes" + "internalType": "bool", + "name": "depositsEnabled", + "type": "bool" } ], - "name": "SpokePoolAdminFunctionTriggered", + "name": "SetEnableDepositRoute", "type": "event" }, { "anonymous": false, "inputs": [ { - "indexed": false, - "internalType": "uint256", - "name": "originChainId", - "type": "uint256" - }, - { - "indexed": false, + "indexed": true, "internalType": "uint256", "name": "destinationChainId", "type": "uint256" }, { - "indexed": false, + "indexed": true, "internalType": "address", - "name": "originToken", + "name": "l1Token", "type": "address" }, { - "indexed": false, + "indexed": true, "internalType": "address", "name": "destinationToken", "type": "address" } ], - "name": "WhitelistRoute", + "name": "SetPoolRebalanceRoute", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "uint256", + "name": "chainId", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "bytes", + "name": "message", + "type": "bytes" + } + ], + "name": "SpokePoolAdminFunctionTriggered", "type": "event" }, { @@ -499,7 +587,7 @@ "name": "crossChainContracts", "outputs": [ { - "internalType": "contract AdapterInterface", + "internalType": "address", "name": "adapter", "type": "address" }, @@ -512,13 +600,6 @@ "stateMutability": "view", "type": "function" }, - { - "inputs": [], - "name": "depositEthToWeth", - "outputs": [], - "stateMutability": "payable", - "type": "function" - }, { "inputs": [ { @@ -539,6 +620,13 @@ "stateMutability": "nonpayable", "type": "function" }, + { + "inputs": [], + "name": "emergencyDeleteProposal", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, { "inputs": [ { @@ -574,41 +662,39 @@ { "inputs": [ { - "components": [ - { - "internalType": "uint256", - "name": "chainId", - "type": "uint256" - }, - { - "internalType": "uint256[]", - "name": "bundleLpFees", - "type": "uint256[]" - }, - { - "internalType": "int256[]", - "name": "netSendAmounts", - "type": "int256[]" - }, - { - "internalType": "int256[]", - "name": "runningBalances", - "type": "int256[]" - }, - { - "internalType": "uint8", - "name": "leafId", - "type": "uint8" - }, - { - "internalType": "address[]", - "name": "l1Tokens", - "type": "address[]" - } - ], - "internalType": "struct HubPoolInterface.PoolRebalanceLeaf", - "name": "poolRebalanceLeaf", - "type": "tuple" + "internalType": "uint256", + "name": "chainId", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "groupIndex", + "type": "uint256" + }, + { + "internalType": "uint256[]", + "name": "bundleLpFees", + "type": "uint256[]" + }, + { + "internalType": "int256[]", + "name": "netSendAmounts", + "type": "int256[]" + }, + { + "internalType": "int256[]", + "name": "runningBalances", + "type": "int256[]" + }, + { + "internalType": "uint8", + "name": "leafId", + "type": "uint8" + }, + { + "internalType": "address[]", + "name": "l1Tokens", + "type": "address[]" }, { "internalType": "bytes32[]", @@ -647,19 +733,6 @@ "stateMutability": "view", "type": "function" }, - { - "inputs": [], - "name": "getRootBundleProposalAncillaryData", - "outputs": [ - { - "internalType": "bytes", - "name": "ancillaryData", - "type": "bytes" - } - ], - "stateMutability": "view", - "type": "function" - }, { "inputs": [], "name": "identifier", @@ -721,14 +794,21 @@ "name": "liveness", "outputs": [ { - "internalType": "uint64", + "internalType": "uint32", "name": "", - "type": "uint64" + "type": "uint32" } ], "stateMutability": "view", "type": "function" }, + { + "inputs": [], + "name": "loadEthForL2Calls", + "outputs": [], + "stateMutability": "payable", + "type": "function" + }, { "inputs": [], "name": "lpFeeRatePerSecond", @@ -787,6 +867,43 @@ "stateMutability": "view", "type": "function" }, + { + "inputs": [], + "name": "paused", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "destinationChainId", + "type": "uint256" + }, + { + "internalType": "address", + "name": "l1Token", + "type": "address" + } + ], + "name": "poolRebalanceRoute", + "outputs": [ + { + "internalType": "address", + "name": "destinationToken", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, { "inputs": [ { @@ -855,7 +972,7 @@ }, { "internalType": "bytes32", - "name": "slowRelayFulfillmentRoot", + "name": "slowRelayRoot", "type": "bytes32" } ], @@ -942,16 +1059,6 @@ "inputs": [], "name": "rootBundleProposal", "outputs": [ - { - "internalType": "uint64", - "name": "requestExpirationTimestamp", - "type": "uint64" - }, - { - "internalType": "uint64", - "name": "unclaimedPoolRebalanceLeafCount", - "type": "uint64" - }, { "internalType": "bytes32", "name": "poolRebalanceRoot", @@ -964,7 +1071,7 @@ }, { "internalType": "bytes32", - "name": "slowRelayFulfillmentRoot", + "name": "slowRelayRoot", "type": "bytes32" }, { @@ -978,9 +1085,14 @@ "type": "address" }, { - "internalType": "bool", - "name": "proposerBondRepaid", - "type": "bool" + "internalType": "uint8", + "name": "unclaimedPoolRebalanceLeafCount", + "type": "uint8" + }, + { + "internalType": "uint32", + "name": "requestExpirationTimestamp", + "type": "uint32" } ], "stateMutability": "view", @@ -1040,6 +1152,34 @@ "stateMutability": "nonpayable", "type": "function" }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "originChainId", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "destinationChainId", + "type": "uint256" + }, + { + "internalType": "address", + "name": "originToken", + "type": "address" + }, + { + "internalType": "bool", + "name": "depositsEnabled", + "type": "bool" + } + ], + "name": "setDepositRoute", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, { "inputs": [ { @@ -1056,9 +1196,9 @@ { "inputs": [ { - "internalType": "uint64", + "internalType": "uint32", "name": "newLiveness", - "type": "uint64" + "type": "uint32" } ], "name": "setLiveness", @@ -1066,6 +1206,42 @@ "stateMutability": "nonpayable", "type": "function" }, + { + "inputs": [ + { + "internalType": "bool", + "name": "pause", + "type": "bool" + } + ], + "name": "setPaused", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "destinationChainId", + "type": "uint256" + }, + { + "internalType": "address", + "name": "l1Token", + "type": "address" + }, + { + "internalType": "address", + "name": "destinationToken", + "type": "address" + } + ], + "name": "setPoolRebalanceRoute", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, { "inputs": [ { @@ -1155,106 +1331,54 @@ "stateMutability": "view", "type": "function" }, - { - "inputs": [ - { - "internalType": "uint256", - "name": "originChainId", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "destinationChainId", - "type": "uint256" - }, - { - "internalType": "address", - "name": "originToken", - "type": "address" - }, - { - "internalType": "address", - "name": "destinationToken", - "type": "address" - } - ], - "name": "whitelistRoute", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "", - "type": "address" - }, - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "name": "whitelistedRoutes", - "outputs": [ - { - "internalType": "address", - "name": "", - "type": "address" - } - ], - "stateMutability": "view", - "type": "function" - }, { "stateMutability": "payable", "type": "receive" } ], - "transactionHash": "0x5b4fda9217fa9097111c15f06b797bfc6034812e328dedf4cbddbe6cd24da79b", + "transactionHash": "0x07d298c49009bf45d06d66b102d1efeaca7661b78a6e258a21b303c2e07de7f9", "receipt": { "to": null, "from": "0x9A8f92a830A5cB89a3816e3D267CB7791c16b04D", - "contractAddress": "0xFA6326FdF1f149B63d116576fCfbc7e15cc0355A", - "transactionIndex": 19, - "gasUsed": "4319056", - "logsBloom": "0x00000000000000000000000000000000000000000000000000800000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001000000000000000000000000000000000000020000000000000000000800000000000000000000000000040000400000000000000000000000000000000000000000000000000000000000000000000000000000000000800000000000000000000000000000000000000000000000000000000000800000000000000000000000000000000000000000004020000001000000000000002000000000000000000000000000000000000000000000", - "blockHash": "0xff4806c31f442d44db382d3aebe476b492493d0dd48d3db949ff49dabace0b5f", - "transactionHash": "0x5b4fda9217fa9097111c15f06b797bfc6034812e328dedf4cbddbe6cd24da79b", + "contractAddress": "0xa1b6DA4AaE90fA16F3A3338c8d1Dc70B4926FCa7", + "transactionIndex": 20, + "gasUsed": "4284004", + "logsBloom": "0x00000000000000000000000000000000000000000000000000800000000000000000000000000000000000000000100000000000000000000000000000000000000000000000000000000000000000000001000000000000000000000000000000000000020000000000000000000800000000000000000000000000040010400000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000800000000000000000000000000000000000000000000020000001020000000000000000000000000000000000000000000000000000000000", + "blockHash": "0x40ea495772e0aca74a7fc70f68ee35a0f97e259115f82a867402c6b7f51800d8", + "transactionHash": "0x07d298c49009bf45d06d66b102d1efeaca7661b78a6e258a21b303c2e07de7f9", "logs": [ { - "transactionIndex": 19, - "blockNumber": 10226903, - "transactionHash": "0x5b4fda9217fa9097111c15f06b797bfc6034812e328dedf4cbddbe6cd24da79b", - "address": "0xFA6326FdF1f149B63d116576fCfbc7e15cc0355A", + "transactionIndex": 20, + "blockNumber": 10365599, + "transactionHash": "0x07d298c49009bf45d06d66b102d1efeaca7661b78a6e258a21b303c2e07de7f9", + "address": "0xa1b6DA4AaE90fA16F3A3338c8d1Dc70B4926FCa7", "topics": [ "0x8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0", "0x0000000000000000000000000000000000000000000000000000000000000000", "0x0000000000000000000000009a8f92a830a5cb89a3816e3d267cb7791c16b04d" ], "data": "0x", - "logIndex": 25, - "blockHash": "0xff4806c31f442d44db382d3aebe476b492493d0dd48d3db949ff49dabace0b5f" + "logIndex": 14, + "blockHash": "0x40ea495772e0aca74a7fc70f68ee35a0f97e259115f82a867402c6b7f51800d8" } ], - "blockNumber": 10226903, - "cumulativeGasUsed": "10006797", + "blockNumber": 10365599, + "cumulativeGasUsed": "6522811", "status": 1, "byzantium": true }, "args": [ - "0x0aF162c78f095bC5924d5a3363aEfd6700962f6B", + "0x0668ab3839346ebf95d969b3e18B2a96b1CC2b02", "0xbb6206fb01fAad31e8aaFc3AD303cEA89D8c8157", "0xc778417E063141139Fce010982780140Aa0cD5Ab", "0x0000000000000000000000000000000000000000" ], "numDeployments": 1, - "solcInputHash": "b448085fba4896ef879334e29280c4da", - "metadata": "{\"compiler\":{\"version\":\"0.8.11+commit.d7f03943\"},\"language\":\"Solidity\",\"output\":{\"abi\":[{\"inputs\":[{\"internalType\":\"contract LpTokenFactoryInterface\",\"name\":\"_lpTokenFactory\",\"type\":\"address\"},{\"internalType\":\"contract FinderInterface\",\"name\":\"_finder\",\"type\":\"address\"},{\"internalType\":\"contract WETH9\",\"name\":\"_weth\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"_timer\",\"type\":\"address\"}],\"stateMutability\":\"nonpayable\",\"type\":\"constructor\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"newBondToken\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"newBondAmount\",\"type\":\"uint256\"}],\"name\":\"BondSet\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"l2ChainId\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"address\",\"name\":\"adapter\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"address\",\"name\":\"spokePool\",\"type\":\"address\"}],\"name\":\"CrossChainContractsSet\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"bytes32\",\"name\":\"newIdentifier\",\"type\":\"bytes32\"}],\"name\":\"IdentifierSet\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"address\",\"name\":\"l1Token\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"address\",\"name\":\"lpToken\",\"type\":\"address\"}],\"name\":\"L1TokenEnabledForLiquidityProvision\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"address\",\"name\":\"l1Token\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"address\",\"name\":\"lpToken\",\"type\":\"address\"}],\"name\":\"L2TokenDisabledForLiquidityProvision\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"l1Token\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"lpTokensMinted\",\"type\":\"uint256\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"liquidityProvider\",\"type\":\"address\"}],\"name\":\"LiquidityAdded\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"l1Token\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"lpTokensBurnt\",\"type\":\"uint256\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"liquidityProvider\",\"type\":\"address\"}],\"name\":\"LiquidityRemoved\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"newLiveness\",\"type\":\"uint256\"}],\"name\":\"LivenessSet\",\"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\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"uint64\",\"name\":\"requestExpirationTimestamp\",\"type\":\"uint64\"},{\"indexed\":false,\"internalType\":\"uint64\",\"name\":\"unclaimedPoolRebalanceLeafCount\",\"type\":\"uint64\"},{\"indexed\":false,\"internalType\":\"uint256[]\",\"name\":\"bundleEvaluationBlockNumbers\",\"type\":\"uint256[]\"},{\"indexed\":true,\"internalType\":\"bytes32\",\"name\":\"poolRebalanceRoot\",\"type\":\"bytes32\"},{\"indexed\":true,\"internalType\":\"bytes32\",\"name\":\"relayerRefundRoot\",\"type\":\"bytes32\"},{\"indexed\":false,\"internalType\":\"bytes32\",\"name\":\"slowRelayFulfillmentRoot\",\"type\":\"bytes32\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"proposer\",\"type\":\"address\"}],\"name\":\"ProposeRootBundle\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"newProtocolFeeCaptureAddress\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"uint256\",\"name\":\"newProtocolFeeCapturePct\",\"type\":\"uint256\"}],\"name\":\"ProtocolFeeCaptureSet\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"l1Token\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"uint256\",\"name\":\"accumulatedFees\",\"type\":\"uint256\"}],\"name\":\"ProtocolFeesCapturedClaimed\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"disputer\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"requestTime\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"bytes\",\"name\":\"disputedAncillaryData\",\"type\":\"bytes\"}],\"name\":\"RootBundleDisputed\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"uint256\",\"name\":\"leafId\",\"type\":\"uint256\"},{\"indexed\":true,\"internalType\":\"uint256\",\"name\":\"chainId\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"address[]\",\"name\":\"l1Token\",\"type\":\"address[]\"},{\"indexed\":false,\"internalType\":\"uint256[]\",\"name\":\"bundleLpFees\",\"type\":\"uint256[]\"},{\"indexed\":false,\"internalType\":\"int256[]\",\"name\":\"netSendAmount\",\"type\":\"int256[]\"},{\"indexed\":false,\"internalType\":\"int256[]\",\"name\":\"runningBalance\",\"type\":\"int256[]\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"caller\",\"type\":\"address\"}],\"name\":\"RootBundleExecuted\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"uint256\",\"name\":\"chainId\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"bytes\",\"name\":\"message\",\"type\":\"bytes\"}],\"name\":\"SpokePoolAdminFunctionTriggered\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"originChainId\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"destinationChainId\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"address\",\"name\":\"originToken\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"address\",\"name\":\"destinationToken\",\"type\":\"address\"}],\"name\":\"WhitelistRoute\",\"type\":\"event\"},{\"stateMutability\":\"payable\",\"type\":\"fallback\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"l1Token\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"l1TokenAmount\",\"type\":\"uint256\"}],\"name\":\"addLiquidity\",\"outputs\":[],\"stateMutability\":\"payable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"bondAmount\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"bondToken\",\"outputs\":[{\"internalType\":\"contract IERC20\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"l1Token\",\"type\":\"address\"}],\"name\":\"claimProtocolFeesCaptured\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"name\":\"crossChainContracts\",\"outputs\":[{\"internalType\":\"contract AdapterInterface\",\"name\":\"adapter\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"spokePool\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"depositEthToWeth\",\"outputs\":[],\"stateMutability\":\"payable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"l1Token\",\"type\":\"address\"}],\"name\":\"disableL1TokenForLiquidityProvision\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"disputeRootBundle\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"l1Token\",\"type\":\"address\"}],\"name\":\"enableL1TokenForLiquidityProvision\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"l1Token\",\"type\":\"address\"}],\"name\":\"exchangeRateCurrent\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"components\":[{\"internalType\":\"uint256\",\"name\":\"chainId\",\"type\":\"uint256\"},{\"internalType\":\"uint256[]\",\"name\":\"bundleLpFees\",\"type\":\"uint256[]\"},{\"internalType\":\"int256[]\",\"name\":\"netSendAmounts\",\"type\":\"int256[]\"},{\"internalType\":\"int256[]\",\"name\":\"runningBalances\",\"type\":\"int256[]\"},{\"internalType\":\"uint8\",\"name\":\"leafId\",\"type\":\"uint8\"},{\"internalType\":\"address[]\",\"name\":\"l1Tokens\",\"type\":\"address[]\"}],\"internalType\":\"struct HubPoolInterface.PoolRebalanceLeaf\",\"name\":\"poolRebalanceLeaf\",\"type\":\"tuple\"},{\"internalType\":\"bytes32[]\",\"name\":\"proof\",\"type\":\"bytes32[]\"}],\"name\":\"executeRootBundle\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"finder\",\"outputs\":[{\"internalType\":\"contract FinderInterface\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"getCurrentTime\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"getRootBundleProposalAncillaryData\",\"outputs\":[{\"internalType\":\"bytes\",\"name\":\"ancillaryData\",\"type\":\"bytes\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"identifier\",\"outputs\":[{\"internalType\":\"bytes32\",\"name\":\"\",\"type\":\"bytes32\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"l1Token\",\"type\":\"address\"}],\"name\":\"liquidityUtilizationCurrent\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"l1Token\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"relayedAmount\",\"type\":\"uint256\"}],\"name\":\"liquidityUtilizationPostRelay\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"liveness\",\"outputs\":[{\"internalType\":\"uint64\",\"name\":\"\",\"type\":\"uint64\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"lpFeeRatePerSecond\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"lpTokenFactory\",\"outputs\":[{\"internalType\":\"contract LpTokenFactoryInterface\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes[]\",\"name\":\"data\",\"type\":\"bytes[]\"}],\"name\":\"multicall\",\"outputs\":[{\"internalType\":\"bytes[]\",\"name\":\"results\",\"type\":\"bytes[]\"}],\"stateMutability\":\"payable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"owner\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"name\":\"pooledTokens\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"lpToken\",\"type\":\"address\"},{\"internalType\":\"bool\",\"name\":\"isEnabled\",\"type\":\"bool\"},{\"internalType\":\"uint32\",\"name\":\"lastLpFeeUpdate\",\"type\":\"uint32\"},{\"internalType\":\"int256\",\"name\":\"utilizedReserves\",\"type\":\"int256\"},{\"internalType\":\"uint256\",\"name\":\"liquidReserves\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"undistributedLpFees\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256[]\",\"name\":\"bundleEvaluationBlockNumbers\",\"type\":\"uint256[]\"},{\"internalType\":\"uint8\",\"name\":\"poolRebalanceLeafCount\",\"type\":\"uint8\"},{\"internalType\":\"bytes32\",\"name\":\"poolRebalanceRoot\",\"type\":\"bytes32\"},{\"internalType\":\"bytes32\",\"name\":\"relayerRefundRoot\",\"type\":\"bytes32\"},{\"internalType\":\"bytes32\",\"name\":\"slowRelayFulfillmentRoot\",\"type\":\"bytes32\"}],\"name\":\"proposeRootBundle\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"protocolFeeCaptureAddress\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"protocolFeeCapturePct\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"chainId\",\"type\":\"uint256\"},{\"internalType\":\"bytes\",\"name\":\"functionData\",\"type\":\"bytes\"}],\"name\":\"relaySpokePoolAdminFunction\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"l1Token\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"lpTokenAmount\",\"type\":\"uint256\"},{\"internalType\":\"bool\",\"name\":\"sendEth\",\"type\":\"bool\"}],\"name\":\"removeLiquidity\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"renounceOwnership\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"rootBundleProposal\",\"outputs\":[{\"internalType\":\"uint64\",\"name\":\"requestExpirationTimestamp\",\"type\":\"uint64\"},{\"internalType\":\"uint64\",\"name\":\"unclaimedPoolRebalanceLeafCount\",\"type\":\"uint64\"},{\"internalType\":\"bytes32\",\"name\":\"poolRebalanceRoot\",\"type\":\"bytes32\"},{\"internalType\":\"bytes32\",\"name\":\"relayerRefundRoot\",\"type\":\"bytes32\"},{\"internalType\":\"bytes32\",\"name\":\"slowRelayFulfillmentRoot\",\"type\":\"bytes32\"},{\"internalType\":\"uint256\",\"name\":\"claimedBitMap\",\"type\":\"uint256\"},{\"internalType\":\"address\",\"name\":\"proposer\",\"type\":\"address\"},{\"internalType\":\"bool\",\"name\":\"proposerBondRepaid\",\"type\":\"bool\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"contract IERC20\",\"name\":\"newBondToken\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"newBondAmount\",\"type\":\"uint256\"}],\"name\":\"setBond\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"l2ChainId\",\"type\":\"uint256\"},{\"internalType\":\"address\",\"name\":\"adapter\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"spokePool\",\"type\":\"address\"}],\"name\":\"setCrossChainContracts\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"time\",\"type\":\"uint256\"}],\"name\":\"setCurrentTime\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"newIdentifier\",\"type\":\"bytes32\"}],\"name\":\"setIdentifier\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint64\",\"name\":\"newLiveness\",\"type\":\"uint64\"}],\"name\":\"setLiveness\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"newProtocolFeeCaptureAddress\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"newProtocolFeeCapturePct\",\"type\":\"uint256\"}],\"name\":\"setProtocolFeeCapture\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"l1Token\",\"type\":\"address\"}],\"name\":\"sync\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"timerAddress\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"newOwner\",\"type\":\"address\"}],\"name\":\"transferOwnership\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"name\":\"unclaimedAccumulatedProtocolFees\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"weth\",\"outputs\":[{\"internalType\":\"contract WETH9\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"originChainId\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"destinationChainId\",\"type\":\"uint256\"},{\"internalType\":\"address\",\"name\":\"originToken\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"destinationToken\",\"type\":\"address\"}],\"name\":\"whitelistRoute\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"name\":\"whitelistedRoutes\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"stateMutability\":\"payable\",\"type\":\"receive\"}],\"devdoc\":{\"kind\":\"dev\",\"methods\":{\"getCurrentTime()\":{\"returns\":{\"_0\":\"uint for the current Testable timestamp.\"}},\"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 anymore. Can only be called by the current owner. NOTE: Renouncing ownership will leave the contract without an owner, thereby removing any functionality that is only available to the owner.\"},\"setCurrentTime(uint256)\":{\"details\":\"Will revert if not running in test mode.\",\"params\":{\"time\":\"timestamp to set current Testable time to.\"}},\"transferOwnership(address)\":{\"details\":\"Transfers ownership of the contract to a new account (`newOwner`). Can only be called by the current owner.\"}},\"version\":1},\"userdoc\":{\"kind\":\"user\",\"methods\":{\"getCurrentTime()\":{\"notice\":\"Gets the current time. Will return the last time set in `setCurrentTime` if running in test mode. Otherwise, it will return the block timestamp.\"},\"setCurrentTime(uint256)\":{\"notice\":\"Sets the current time.\"},\"whitelistRoute(uint256,uint256,address,address)\":{\"notice\":\"Whitelist an origin token <-> destination token route.\"}},\"version\":1}},\"settings\":{\"compilationTarget\":{\"contracts/HubPool.sol\":\"HubPool\"},\"evmVersion\":\"london\",\"libraries\":{},\"metadata\":{\"bytecodeHash\":\"ipfs\"},\"optimizer\":{\"enabled\":true,\"runs\":200},\"remappings\":[]},\"sources\":{\"@openzeppelin/contracts/access/Ownable.sol\":{\"keccak256\":\"0x24e0364e503a9bbde94c715d26573a76f14cd2a202d45f96f52134ab806b67b9\",\"license\":\"MIT\",\"urls\":[\"bzz-raw://e12cbaa7378fd9b62280e4e1d164bedcb4399ce238f5f98fc0eefb7e50577981\",\"dweb:/ipfs/QmXRoFGUgfsaRkoPT5bxNMtSayKTQ8GZATLPXf69HcRA51\"]},\"@openzeppelin/contracts/token/ERC20/IERC20.sol\":{\"keccak256\":\"0x61437cb513a887a1bbad006e7b1c8b414478427d33de47c5600af3c748f108da\",\"license\":\"MIT\",\"urls\":[\"bzz-raw://2c3d0973630ed74f2b5ce3944677a885dc70ec32fc83b35f55045a10224da32b\",\"dweb:/ipfs/QmbefZ5RoEZKNHXCALfh683PnaNYzKPcKMFjyY1DVAgq8A\"]},\"@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol\":{\"keccak256\":\"0xc3d946432c0ddbb1f846a0d3985be71299df331b91d06732152117f62f0be2b5\",\"license\":\"MIT\",\"urls\":[\"bzz-raw://4632c341a06ba5c079b51ca5a915efab4e6ab57735b37839b3e8365ff806a43e\",\"dweb:/ipfs/QmTHT3xHYed2wajEoA5qu7ii2BxLpPhQZHwAhtLK5Z7ANK\"]},\"@openzeppelin/contracts/utils/Address.sol\":{\"keccak256\":\"0x51b758a8815ecc9596c66c37d56b1d33883a444631a3f916b9fe65cb863ef7c4\",\"license\":\"MIT\",\"urls\":[\"bzz-raw://997ca03557985b3c6f9143a18b6c3a710b3bc1c7f189ee956d305a966ecfb922\",\"dweb:/ipfs/QmQaD3Wb62F88SHqmpLttvF6wKuPDQep2LLUcKPekeRzvz\"]},\"@openzeppelin/contracts/utils/Context.sol\":{\"keccak256\":\"0xe2e337e6dde9ef6b680e07338c493ebea1b5fd09b43424112868e9cc1706bca7\",\"license\":\"MIT\",\"urls\":[\"bzz-raw://6df0ddf21ce9f58271bdfaa85cde98b200ef242a05a3f85c2bc10a8294800a92\",\"dweb:/ipfs/QmRK2Y5Yc6BK7tGKkgsgn3aJEQGi5aakeSPZvS65PV8Xp3\"]},\"@openzeppelin/contracts/utils/cryptography/MerkleProof.sol\":{\"keccak256\":\"0x9c35727c74a6ffd8d02237b414e7bfb532c0323b1088709def98ea5c628157de\",\"license\":\"MIT\",\"urls\":[\"bzz-raw://43ea1c4a5760f18794645133057e0a3df8eeac81a6ba266fb95f28233f088662\",\"dweb:/ipfs/QmbUHWmwqBMrub71Rs3dLnAoVkf2HPzmUAKfA6Eu28P3G7\"]},\"@openzeppelin/contracts/utils/math/SafeMath.sol\":{\"keccak256\":\"0xa2f576be637946f767aa56601c26d717f48a0aff44f82e46f13807eea1009a21\",\"license\":\"MIT\",\"urls\":[\"bzz-raw://973868f808e88e21a1a0a01d4839314515ee337ad096286c88e41b74dcc11fc2\",\"dweb:/ipfs/QmfYuZxRfx2J2xdk4EXN7jKg4bUYEMTaYk9BAw9Bqn4o2Y\"]},\"@openzeppelin/contracts/utils/math/SignedSafeMath.sol\":{\"keccak256\":\"0x62f53f262fabbbc6d8ab49488d8fce36370351aff2b8d3898d499d68995a71c2\",\"license\":\"MIT\",\"urls\":[\"bzz-raw://efd599513c2f313a3f5e9536beb2b80a0d2b3dd34202c174a707d81b7dc751ce\",\"dweb:/ipfs/QmdDiENVFSyWjfFskNLnViMH77DHg3oDthkSZk7dMzNNKB\"]},\"@uma/core/contracts/common/implementation/AncillaryData.sol\":{\"keccak256\":\"0x8ff33ac32d3e6de25de9e0ac2c0ff9a621f187fa97e9ee84092b327471baa3ce\",\"license\":\"AGPL-3.0-only\",\"urls\":[\"bzz-raw://0bbaed49756e8cf7ef405e132f441cd7a735ac6186a200b0179147e7d137b74a\",\"dweb:/ipfs/QmeSBJX5a61LZPxbkUKS2NF4LSxemgDwjD65fCAmyP7PX2\"]},\"@uma/core/contracts/common/implementation/FixedPoint.sol\":{\"keccak256\":\"0x996b97cc4fa5da4064e3aee500edc6972485d59a9334ceec81155e2c2f484dae\",\"license\":\"AGPL-3.0-only\",\"urls\":[\"bzz-raw://8d7c028926dc2b27e7dc103363dca8a43f60b3351f4a14bcb702660f95c68663\",\"dweb:/ipfs/QmXz4ieFjP5RxJ35F8GbPryYEGvFmxc4Gqx8EK7N57ixzT\"]},\"@uma/core/contracts/common/implementation/MultiCaller.sol\":{\"keccak256\":\"0x31f18055b14fd9eeb459c6d6a88d1a60921bf3755031f6db4b709c3e01d078f7\",\"urls\":[\"bzz-raw://1a002084305bc747b23e69e24cfd1f3aa730adc22dd76d1e077dc72bcffc41f0\",\"dweb:/ipfs/Qmb611uGKzhc2MHkMhqW3NG49FY3Tg1udh7zXttmPtfU2s\"]},\"@uma/core/contracts/common/implementation/Testable.sol\":{\"keccak256\":\"0x0254b45747293bb800373a58d123969adec0428f7be79dc941cab10fcad09918\",\"license\":\"AGPL-3.0-only\",\"urls\":[\"bzz-raw://537d694e3753596f507d071f283be9caeaad0010c444c9c9955d729affeb4907\",\"dweb:/ipfs/QmZ1WfVTBao11QaN6aygMhnt45UjRq77ZwfKPFmHiVSdaJ\"]},\"@uma/core/contracts/common/implementation/Timer.sol\":{\"keccak256\":\"0x9e0dd7389718bd5d1da910273a6f4cee98ee22bfc0c92bde0f0955c0e23adb5e\",\"license\":\"AGPL-3.0-only\",\"urls\":[\"bzz-raw://7ddac8d3cb76f8811156a11a7702d7c05b15a0f18c22b5abdc318723193f9266\",\"dweb:/ipfs/QmPxL7AU8NkURJaZ6WxXNcw88wGMSoPX4jbt7SMdPJqtYv\"]},\"@uma/core/contracts/common/interfaces/AddressWhitelistInterface.sol\":{\"keccak256\":\"0x22fb8588dff1d5cff76a28111d6c9b190765d99facd93c8ff3b54771f245c0d8\",\"license\":\"AGPL-3.0-only\",\"urls\":[\"bzz-raw://5ecd993f00de290a3c7bf21da23a9439cf2ccb22028316df92b79780ac8aa533\",\"dweb:/ipfs/QmTZ7x7U4EEzTacqapzSdFs2np5WNsqm4XeUBqzQxxDJei\"]},\"@uma/core/contracts/common/interfaces/ExpandedIERC20.sol\":{\"keccak256\":\"0xb8252039cba45f1c19cd677f150a9823a5d6e1845cad90e3041d97c96f273c26\",\"license\":\"AGPL-3.0-only\",\"urls\":[\"bzz-raw://95106656c95e12c30a2a4c482a859df6df55c3b56bb9f7835eb5c685ca3175d3\",\"dweb:/ipfs/QmcuJoX7T53vTCDcQK8WcCJdT1LzHS35vPmSVfg1DG32cd\"]},\"@uma/core/contracts/oracle/implementation/Constants.sol\":{\"keccak256\":\"0x36dcec83c5ac265b759b6a5559ec76088ce24854bf590ba66f808e8ecb59b97e\",\"license\":\"AGPL-3.0-only\",\"urls\":[\"bzz-raw://b6f16b1705220fe3692cca201d65993046b4cbb6dddbc35508c489606575bfc2\",\"dweb:/ipfs/QmdHvPibiSD7j9VJg73DaDPFBsCsWSxKpZJnVCSTErVTHC\"]},\"@uma/core/contracts/oracle/interfaces/FinderInterface.sol\":{\"keccak256\":\"0x9166fbfe08e954eb86d33c114fcde7ce4fd0dda5d9d28b31210582bfc769fa86\",\"license\":\"AGPL-3.0-only\",\"urls\":[\"bzz-raw://e611e12bcaaebfdf65b67c566ff1d34708e757f01a445bd87c55862e89383b81\",\"dweb:/ipfs/QmYNSq5oopTShdS6j4VWKqoLxmQSRKmWebCxw6K4LfmKrf\"]},\"@uma/core/contracts/oracle/interfaces/IdentifierWhitelistInterface.sol\":{\"keccak256\":\"0x9ae86a30dd1a8c03fb2c6d27be570bb30c4c0b13ac63cde8620b7e4b51d88dc9\",\"license\":\"AGPL-3.0-only\",\"urls\":[\"bzz-raw://a71d2aff48e075ecab56a9c9767775d1d77e04ec9191fed124e71003220549e3\",\"dweb:/ipfs/QmYPWsZXro6fzqpZY6UxQ5X8znEXfLp2sun8oXzdz8bTyc\"]},\"@uma/core/contracts/oracle/interfaces/OptimisticOracleInterface.sol\":{\"keccak256\":\"0x92e7280c1abd5f0c4fcd20247fc1b8428aaf4eeea59439c074d15fdaf9c64989\",\"license\":\"AGPL-3.0-only\",\"urls\":[\"bzz-raw://8d12bbcf0a91cef63c4767bffd047254599c5a1fce38e5e81d3005e102fdeef8\",\"dweb:/ipfs/QmTkd3AG9gdvBZq3HKCUW8eErvkguM2QqE3nUDGfvye3Yi\"]},\"@uma/core/contracts/oracle/interfaces/SkinnyOptimisticOracleInterface.sol\":{\"keccak256\":\"0x91d21e44a97b719106e8f97b99399a3d8dc3697badd01df06518892f38fe033f\",\"license\":\"AGPL-3.0-only\",\"urls\":[\"bzz-raw://68c350c822b256b43543ac4dd3dd1413ed95f25a9415d5dba4c562cd11d55716\",\"dweb:/ipfs/QmZyYeBnM59oPmWcK1KERNayg7xuHv12sLzzmqC42Lq76a\"]},\"@uma/core/contracts/oracle/interfaces/StoreInterface.sol\":{\"keccak256\":\"0xbb73671684309c91ad5ef3da1474051d03f2e7d5882bed7f5c4317e5d4c768df\",\"license\":\"AGPL-3.0-only\",\"urls\":[\"bzz-raw://32386544d3119fd0187a8c4e8b01c739f508ab863faa04345cabc2544081f9e8\",\"dweb:/ipfs/QmYszDURs1x75rsejZkGt9zCkASXnJtufbNsL3XHe2eJPQ\"]},\"contracts/HubPool.sol\":{\"keccak256\":\"0x00567b6b4254462d121ea380c42c2654b627b71d7e77e220ecd7543c0ed03a55\",\"license\":\"GPL-3.0-only\",\"urls\":[\"bzz-raw://d48999bc7506af8d9f4662f8119231ca0c1c15a377e89458c1785ed5cf913a31\",\"dweb:/ipfs/QmTHWp5pdVfmk1bfKYHo715ixnQv8zBivt4bvYRKqjtQiA\"]},\"contracts/HubPoolInterface.sol\":{\"keccak256\":\"0x493f6803156dc7129c3af9b7d5b99172ffbd9e93a98d4a44604dc0b984502777\",\"license\":\"GPL-3.0-only\",\"urls\":[\"bzz-raw://859918369c162d1cf7beff34550bad001dac80d8d885f2c09d7762dc563e09e0\",\"dweb:/ipfs/QmTR2e7EpmRpAhWkk6qGnUvUAc3gEFfgiH8BYXFNgfDkVV\"]},\"contracts/Lockable.sol\":{\"keccak256\":\"0x5bb409da6eac2098c893e8ef5eeb9979b50c640db253299e2373e785362407ac\",\"license\":\"AGPL-3.0-only\",\"urls\":[\"bzz-raw://125cb16a154f4cef89d00d0cc9bcc26c8c1c384481c79ac88dcf1810c319c434\",\"dweb:/ipfs/Qmd8KQEJdo8MWddnFwg1LtpsHkTVZtDkqdJahv9qtpdVw3\"]},\"contracts/MerkleLib.sol\":{\"keccak256\":\"0x50079aae972160054e34f9acbad1724dc3111491c8b712b6ab1eb49ff4d9869d\",\"license\":\"GPL-3.0-only\",\"urls\":[\"bzz-raw://d7b069e219585b85cfcb23c1892b46f3ffe58a50818a4c9bd486b13c8d272cb3\",\"dweb:/ipfs/Qmb6n1BdCfqc1AkgmDEngbhxzxbtDyzXbiZ2Vw84AB4adE\"]},\"contracts/SpokePoolInterface.sol\":{\"keccak256\":\"0xa420a9b5431195ecead66166fe4b316a0a1e86ad26514cdc6ace529e8941cf4d\",\"license\":\"Unlicense\",\"urls\":[\"bzz-raw://b7769c662fffe9d0547b67bf3d8602e05b4a17709d66ee669a62297c78e0affd\",\"dweb:/ipfs/QmUxULUNimPgTEhxF9EmPK9kZzv4bPA6XGcpvvHXzbGju2\"]},\"contracts/interfaces/AdapterInterface.sol\":{\"keccak256\":\"0x60e1ed2205f90655fe4152a90709be15bc9550fb3faeaf9835fee22c095bab11\",\"license\":\"AGPL-3.0-only\",\"urls\":[\"bzz-raw://98cb02fd21defa131082d7f433abdc5d872044caf19aee0b6d253b3561249dcc\",\"dweb:/ipfs/QmbqrocBKc7z4Ne1syg9J2TuAqdZTUFmWAqxR3CzW3Nk92\"]},\"contracts/interfaces/LpTokenFactoryInterface.sol\":{\"keccak256\":\"0xbff9f636f087e2c5acc05be2da6fe26d3558f0ff6d270f8738bd8027b4ac8eff\",\"license\":\"AGPL-3.0-only\",\"urls\":[\"bzz-raw://15632b718000ab8036a2bbfea107515f5cf7102009728c6280e969ef402f4c15\",\"dweb:/ipfs/QmdsMySHkCVWUWGRw7RgfVV9H6cE1t6YcQt85owGCMTJdC\"]},\"contracts/interfaces/WETH9.sol\":{\"keccak256\":\"0x08755a7e4fc4ed75895c9b803f19552c4f0a455947dca04d86db4355114253b3\",\"license\":\"GPL-3.0-only\",\"urls\":[\"bzz-raw://74181b83b035409b3b0158670af75a399a8b85e9c8ee224bc0db227e23492612\",\"dweb:/ipfs/QmX1tpoHx5KB7sLu5xLA18krjMXXQjHWXAX2UfJ5QCqMxQ\"]}},\"version\":1}", - "bytecode": "0x60806040527f49535f4143524f53535f56325f42554e444c455f56414c494400000000000000600e5565015d3ef79800600f55601580546001600160401b031916611c201790553480156200005357600080fd5b5060405162004b4438038062004b44833981016040819052620000769162000169565b600080546001600160a81b0319166001600160a01b03831617600160a01b179055620000a9620000a33390565b620000fe565b50600c80546001600160a01b03199081166001600160a01b0395861617909155600d8054821693851693909317909255600b8054831691841691909117905560015460118054919093169116179055620001d1565b600180546001600160a01b038381166001600160a01b0319831681179093556040519116919082907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e090600090a35050565b6001600160a01b03811681146200016657600080fd5b50565b600080600080608085870312156200018057600080fd5b84516200018d8162000150565b6020860151909450620001a08162000150565b6040860151909350620001b38162000150565b6060860151909250620001c68162000150565b939692955090935050565b61496380620001e16000396000f3fe60806040526004361061025e5760003560e01c8063552188a711610144578063ac9650d8116100b6578063dd70e5e81161007a578063dd70e5e8146107cc578063e0f339e3146107ec578063e40064d71461080c578063e460e35c14610839578063f0056a7d14610859578063f2fde38b146108fe5761026d565b8063ac9650d81461070b578063b60c2d7d1461072b578063b9a3c84c1461074b578063bb9219a21461076b578063c28f4392146107ac5761026d565b80637998a1c4116101085780637998a1c41461066157806380f323a7146106775780638bda0c001461068d5780638da5cb5b146106ad578063a16fd6e9146106cb578063a5841194146106eb5761026d565b8063552188a71461026d57806356688700146105e15780636ad0690a146105f4578063715018a61461062c57806376ec08dd146106415761026d565b806322f8e566116101dd57806338b9e2ce116101a157806338b9e2ce146104a35780633994a3ce146104c35780633c4432f1146104e35780633fc8cef3146105035780634144fd61146105235780634f7473ff146105cb5761026d565b806322f8e5661461040e578063240f475f1461042e57806329cb924d1461044e5780632d0f6f841461046357806333dc09ca146104835761026d565b80630c501af9116102245780630c501af91461036b5780630ee28a881461038b57806311cfc159146103ab5780631c39c38d146103c157806322395aaa146103f95761026d565b8062660b5314610275578062c9920614610295578063084d0513146102b557806309474ae2146102e85780630a2dc9ec146103495761026d565b3661026d5761026b61091e565b005b61026b61091e565b34801561028157600080fd5b5061026b610290366004613b7f565b61099c565b3480156102a157600080fd5b5061026b6102b0366004613bab565b610a7a565b3480156102c157600080fd5b506102d56102d0366004613b7f565b610c4b565b6040519081526020015b60405180910390f35b3480156102f457600080fd5b50610329610303366004613bab565b600a60205260009081526040902080546001909101546001600160a01b03918216911682565b604080516001600160a01b039384168152929091166020830152016102df565b34801561035557600080fd5b5061035e610c77565b6040516102df9190613c1c565b34801561037757600080fd5b5061026b610386366004613c2f565b610e58565b34801561039757600080fd5b5061026b6103a6366004613c5a565b610eea565b3480156103b757600080fd5b506102d5600f5481565b3480156103cd57600080fd5b506000546103e1906001600160a01b031681565b6040516001600160a01b0390911681526020016102df565b34801561040557600080fd5b5061026b6110ac565b34801561041a57600080fd5b5061026b610429366004613bab565b611401565b34801561043a57600080fd5b506011546103e1906001600160a01b031681565b34801561045a57600080fd5b506102d561145c565b34801561046f57600080fd5b5061026b61047e366004613c2f565b6114e8565b34801561048f57600080fd5b5061026b61049e366004613b7f565b61158a565b3480156104af57600080fd5b5061026b6104be366004613e0d565b61178a565b3480156104cf57600080fd5b5061026b6104de366004613f25565b6119b8565b3480156104ef57600080fd5b5061026b6104fe366004613f6f565b611ac4565b34801561050f57600080fd5b50600b546103e1906001600160a01b031681565b34801561052f57600080fd5b5060025460035460045460055460065460075461057a956001600160401b0380821696600160401b90920416949093909290916001600160a01b03811690600160a01b900460ff1688565b604080516001600160401b03998a168152989097166020890152958701949094526060860192909252608085015260a08401526001600160a01b031660c0830152151560e0820152610100016102df565b3480156105d757600080fd5b506102d560125481565b61026b6105ef366004613b7f565b611b8c565b34801561060057600080fd5b50601554610614906001600160401b031681565b6040516001600160401b0390911681526020016102df565b34801561063857600080fd5b5061026b611e09565b34801561064d57600080fd5b50600c546103e1906001600160a01b031681565b34801561066d57600080fd5b506102d5600e5481565b34801561068357600080fd5b506102d560145481565b34801561069957600080fd5b5061026b6106a8366004613f98565b611e3d565b3480156106b957600080fd5b506001546001600160a01b03166103e1565b3480156106d757600080fd5b506102d56106e6366004613c2f565b611fb4565b3480156106f757600080fd5b5061026b610706366004613c2f565b611fe0565b61071e610719366004613fff565b612001565b6040516102df9190614073565b34801561073757600080fd5b5061026b610746366004613c2f565b6121a6565b34801561075757600080fd5b50600d546103e1906001600160a01b031681565b34801561077757600080fd5b506103e1610786366004613b7f565b60086020908152600092835260408084209091529082529020546001600160a01b031681565b3480156107b857600080fd5b506013546103e1906001600160a01b031681565b3480156107d857600080fd5b5061026b6107e73660046140fc565b612346565b3480156107f857600080fd5b506102d5610807366004613c2f565b612392565b34801561081857600080fd5b506102d5610827366004613c2f565b60106020526000908152604090205481565b34801561084557600080fd5b5061026b610854366004614180565b6123ad565b34801561086557600080fd5b506108bc610874366004613c2f565b60096020526000908152604090208054600182015460028301546003909301546001600160a01b03831693600160a01b840460ff1693600160a81b900463ffffffff16929186565b604080516001600160a01b039097168752941515602087015263ffffffff909316938501939093526060840152608083019190915260a082015260c0016102df565b34801561090a57600080fd5b5061026b610919366004613c2f565b6124a3565b600054600160a01b900460ff161561099a57600b60009054906101000a90046001600160a01b03166001600160a01b031663d0e30db0476040518263ffffffff1660e01b81526004016000604051808303818588803b15801561098057600080fd5b505af1158015610994573d6000803e3d6000fd5b50505050505b565b6001546001600160a01b031633146109cf5760405162461bcd60e51b81526004016109c6906141b7565b60405180910390fd5b670de0b6b3a7640000811115610a275760405162461bcd60e51b815260206004820152601960248201527f4261642070726f746f636f6c466565436170747572655063740000000000000060448201526064016109c6565b601180546001600160a01b0319166001600160a01b03841690811790915560128290556040518291907fc1993b89fd79a19ece7beb067ddc8534ca26d29c0ff94ea2f53b4a508d1eedc990600090a35050565b6001546001600160a01b03163314610aa45760405162461bcd60e51b81526004016109c6906141b7565b600254600160401b90046001600160401b031615610ad45760405162461bcd60e51b81526004016109c6906141ec565b600d546040516302abf57960e61b8152721259195b9d1a599a595c95da1a5d195b1a5cdd606a1b60048201526000916001600160a01b03169063aafd5e4090602401602060405180830381865afa158015610b33573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610b579190614223565b6040516390978d1b60e01b8152600481018490529091506001600160a01b038216906390978d1b90602401602060405180830381865afa158015610b9f573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610bc39190614240565b610c0f5760405162461bcd60e51b815260206004820152601860248201527f4964656e746966696572206e6f7420737570706f72746564000000000000000060448201526064016109c6565b600e8290556040518281527ff45367c278fcceff23d601ce4bdd191e5bd61687ff9f29dc7276a08fe54c0c5d9060200160405180910390a15050565b6000610c5561253b565b610c5d612594565b610c6783836125a3565b9050610c71612698565b92915050565b6040805160208082018352600082528251808401909352601a83527f7265717565737445787069726174696f6e54696d657374616d7000000000000090830152600254606092610cd092916001600160401b03166126ad565b60408051808201909152601f81527f756e636c61696d6564506f6f6c526562616c616e63654c656166436f756e74006020820152600254919250610d2691839190600160401b90046001600160401b03166126ad565b9050610d6181604051806040016040528060118152602001701c1bdbdb149958985b185b98d9549bdbdd607a1b8152506002600101546126f4565b9050610d9b81604051806040016040528060118152602001701c995b185e595c9499599d5b99149bdbdd607a1b81525060028001546126f4565b9050610de2816040518060400160405280601881526020017f736c6f7752656c617946756c66696c6c6d656e74526f6f7400000000000000008152506002600301546126f4565b9050610e19816040518060400160405280600d81526020016c0636c61696d65644269744d617609c1b8152506002600401546126ad565b604080518082019091526008815267383937b837b9b2b960c11b6020820152600754919250610e53918391906001600160a01b031661270f565b905090565b6001546001600160a01b03163314610e825760405162461bcd60e51b81526004016109c6906141b7565b6001600160a01b03818116600081815260096020908152604091829020805460ff60a01b1981169091558251938452909316928201929092527fac111b3b527b307393c94d98f26140effb71411054466818be97912d2d65f77691015b60405180910390a150565b610ef261253b565b610efa612594565b600b546001600160a01b0384811691161480610f14575080155b610f505760405162461bcd60e51b815260206004820152600d60248201526c086c2dce840e6cadcc840cae8d609b1b60448201526064016109c6565b6000670de0b6b3a7640000610f648561272a565b610f6e9085614273565b610f7891906142a8565b6001600160a01b038581166000908152600960205260409081902054905163079cc67960e41b81523360048201526024810187905292935016906379cc6790906044016020604051808303816000875af1158015610fda573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610ffe9190614240565b506001600160a01b0384166000908152600960205260408120600201805483929061102a9084906142bc565b909155505081156110445761103f3382612822565b611058565b6110586001600160a01b03851633836128dd565b604080518281526020810185905233916001600160a01b038716917fcda1185f28599e6bd14ab8a68b3c30a11e1dce4256b5e67e94dd3fd846a6c589910160405180910390a3506110a7612698565b505050565b6110b461253b565b6110bc612594565b6002546001600160401b03166110d061145c565b111561111e5760405162461bcd60e51b815260206004820152601760248201527f5265717565737420706173736564206c6976656e65737300000000000000000060448201526064016109c6565b601454600061112b610c77565b601354909150611146906001600160a01b0316333085612940565b61116f61115161297e565b61115c846002614273565b6013546001600160a01b03169190612a04565b61117761297e565b6001600160a01b031663af355d1e600e5461119061145c565b60135485906001600160a01b031660006111a8612b19565b6014546111b591906142bc565b6015546007546040516001600160e01b031960e08b901b1681526111ff989796959493926001600160401b0316916001600160a01b031690670de0b6b3a7640000906004016142d3565b6020604051808303816000875af115801561121e573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906112429190614343565b5060408051610160810182526007546001600160a01b0390811682526000602083018190526013549091169282019290925260608101829052670de0b6b3a7640000608082015260a0810182905260155460c08201906001600160401b03166112a961145c565b6112b3919061435c565b8152602001600081526020016112c7612b19565b81526020016112d4612b19565b6014546112e191906142bc565b81526015546001600160401b031660209091015290506112ff61297e565b6001600160a01b0316639ce320c8600e5461131861145c565b858533306040518763ffffffff1660e01b815260040161133d96959493929190614374565b6020604051808303816000875af115801561135c573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906113809190614343565b50337f4c789f44a7398cb63bf580e03ad5a7ec8228ea4935d3c1a1135eb449f0bb301b6113ab61145c565b846040516113ba929190614473565b60405180910390a25050600280546001600160801b0319169055506000600381905560048190556005819055600655600780546001600160a81b031916905561099a612698565b6000546001600160a01b031661141657600080fd5b60005460405163117c72b360e11b8152600481018390526001600160a01b03909116906322f8e56690602401600060405180830381600087803b15801561098057600080fd5b600080546001600160a01b0316156114e35760008054906101000a90046001600160a01b03166001600160a01b03166329cb924d6040518163ffffffff1660e01b8152600401602060405180830381865afa1580156114bf573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610e539190614343565b504290565b6114f061253b565b6114f8612594565b6011546001600160a01b03828116600081815260106020526040902054611524939192909116906128dd565b6001600160a01b0381166000818152601060205260408082205490519092917f74740239d7d696c84422b720e125e1f47c4138c66d1f4d2a48e99f4197cdb79c91a36001600160a01b038116600090815260106020526040812055611587612698565b50565b6001546001600160a01b031633146115b45760405162461bcd60e51b81526004016109c6906141b7565b600254600160401b90046001600160401b0316156115e45760405162461bcd60e51b81526004016109c6906141ec565b600d546040516302abf57960e61b81527210dbdb1b185d195c985b15da1a5d195b1a5cdd606a1b60048201526000916001600160a01b03169063aafd5e4090602401602060405180830381865afa158015611643573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906116679190614223565b604051631d1d5b3960e11b81526001600160a01b03858116600483015291925090821690633a3ab67290602401602060405180830381865afa1580156116b1573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906116d59190614240565b6117145760405162461bcd60e51b815260206004820152601060248201526f139bdd081bdb881dda1a5d195b1a5cdd60821b60448201526064016109c6565b601380546001600160a01b0319166001600160a01b038516179055611737612b19565b611741908361435c565b60148190556040519081526001600160a01b038416907fbfa9a96010167e98ce8c004f718932cbbfd33a58d681c752e693be7d457a1b3b906020015b60405180910390a2505050565b61179261253b565b61179a612594565b6002546001600160401b03166117ae61145c565b10156117f25760405162461bcd60e51b81526020600482015260136024820152724e6f7420706173736564206c6976656e65737360681b60448201526064016109c6565b6006546080830151600160ff9091161b90811614156118455760405162461bcd60e51b815260206004820152600f60248201526e105b1c9958591e4818db185a5b5959608a1b60448201526064016109c6565b600354611853908383612c01565b61188b5760405162461bcd60e51b81526020600482015260096024820152682130b210283937b7b360b91b60448201526064016109c6565b6118a1600260040154836080015160ff16612c3c565b60065560028054600160401b90046001600160401b03169060086118c48361448c565b91906101000a8154816001600160401b0302191690836001600160401b031602179055505061190582600001518360a0015184604001518560200151612c9f565b815161191090613085565b600254600160401b90046001600160401b031661194857600754601454601354611948926001600160a01b03918216929116906128dd565b336001600160a01b03168260000151836080015160ff167f269bcb1817facd431d586b474ce46fe1ca2921cd1a19314c01a606804ea8b9458560a001518660200151876040015188606001516040516119a49493929190614523565b60405180910390a46119b4612698565b5050565b6001546001600160a01b031633146119e25760405162461bcd60e51b81526004016109c6906141b7565b6001600160a01b0382811660008181526008602090815260408083208884529091529081902080546001600160a01b03191693851693909317909255905160248101919091526044810184905260016064820152611a6e90859060840160408051601f198184030181529190526020810180516001600160e01b031663272751c760e01b17905261314b565b60408051858152602081018590526001600160a01b03848116828401528316606082015290517f9ea2ac5578d6a787096208b4dbd9fc248858ea249f9c342f10caf9ca943ec9d49181900360800190a150505050565b6001546001600160a01b03163314611aee5760405162461bcd60e51b81526004016109c6906141b7565b610258816001600160401b031611611b3d5760405162461bcd60e51b8152602060048201526012602482015271131a5d995b995cdcc81d1bdbc81cda1bdc9d60721b60448201526064016109c6565b6015805467ffffffffffffffff19166001600160401b0383169081179091556040519081527f04dd1d84d387f404568a7954b5e398518bdd716e1a8f4a790be9a1a225ad934790602001610edf565b6001600160a01b038216600090815260096020526040902054600160a01b900460ff16611bef5760405162461bcd60e51b8152602060048201526011602482015270151bdad95b881b9bdd08195b98589b1959607a1b60448201526064016109c6565b600b546001600160a01b038381169116148015611c0b57508034145b80611c14575034155b611c505760405162461bcd60e51b815260206004820152600d60248201526c426164206d73672e76616c756560981b60448201526064016109c6565b6000611c5b8361272a565b611c6d83670de0b6b3a7640000614273565b611c7791906142a8565b6001600160a01b03848116600090815260096020526040908190205490516340c10f1960e01b81523360048201526024810184905292935016906340c10f19906044016020604051808303816000875af1158015611cd9573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611cfd9190614240565b506001600160a01b03831660009081526009602052604081206002018054849290611d2990849061435c565b9091555050600b546001600160a01b038481169116148015611d4b5750600034115b15611da957826001600160a01b031663d0e30db0346040518263ffffffff1660e01b81526004016000604051808303818588803b158015611d8b57600080fd5b505af1158015611d9f573d6000803e3d6000fd5b5050505050611dbe565b611dbe6001600160a01b038416333085612940565b604080518381526020810183905233916001600160a01b038616917f3c69701a61c79a92ef9692903aaa0068bce8771361ecb09547391e4fb4df8537910160405180910390a3505050565b6001546001600160a01b03163314611e335760405162461bcd60e51b81526004016109c6906141b7565b61099a60006131f7565b611e4561253b565b611e4d612594565b600254600160401b90046001600160401b031615611e7d5760405162461bcd60e51b81526004016109c6906141ec565b60008460ff1611611ed05760405162461bcd60e51b815260206004820181905260248201527f42756e646c65206d7573742068617665206174206c656173742031206c65616660448201526064016109c6565b6015546000906001600160401b0316611ee761145c565b611ef1919061435c565b600280546000600655600780546001600160801b03199092166001600160401b03851617600160401b60ff8b1602179092556003879055600486905560058590556001600160a81b03191633908117909155601454601354929350611f62926001600160a01b031691903090612940565b336001600160a01b031683857fc8af40a0d5158e00ff775a1ed68cc732ad2636d1c595398cb3f8fd14ec32295e84898b88604051611fa39493929190614570565b60405180910390a450610994612698565b6000611fbe61253b565b611fc6612594565b611fd18260006125a3565b9050611fdb612698565b919050565b611fe861253b565b611ff0612594565b611ff981613249565b611587612698565b606034156120515760405162461bcd60e51b815260206004820152601b60248201527f4f6e6c79206d756c746963616c6c207769746820302076616c7565000000000060448201526064016109c6565b816001600160401b0381111561206957612069613c9c565b60405190808252806020026020018201604052801561209c57816020015b60608152602001906001900390816120875790505b50905060005b8281101561219f57600080308686858181106120c0576120c06145ac565b90506020028101906120d291906145c2565b6040516120e092919061460f565b600060405180830381855af49150503d806000811461211b576040519150601f19603f3d011682016040523d82523d6000602084013e612120565b606091505b50915091508161216c5760448151101561213957600080fd5b60048101905080806020019051810190612153919061461f565b60405162461bcd60e51b81526004016109c69190613c1c565b8084848151811061217f5761217f6145ac565b6020026020010181905250505080806121979061468c565b9150506120a2565b5092915050565b6001546001600160a01b031633146121d05760405162461bcd60e51b81526004016109c6906141b7565b6001600160a01b038181166000908152600960205260409020541661228f57600c54604051637e178db760e11b81526001600160a01b0383811660048301529091169063fc2f1b6e906024016020604051808303816000875af115801561223b573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061225f9190614223565b6001600160a01b03828116600090815260096020526040902080546001600160a01b031916929091169190911790555b6001600160a01b0381166000908152600960205260409020805460ff60a01b1916600160a01b1790556122c061145c565b6001600160a01b0380831660009081526009602052604090819020805463ffffffff94909416600160a81b0263ffffffff60a81b198516811790915590517f04e291c80180d65a57b5bf1bed775777ec0d6f283ef34bcf130712714d8bb7f793610edf9386938116911617906001600160a01b0392831681529116602082015260400190565b6001546001600160a01b031633146123705760405162461bcd60e51b81526004016109c6906141b7565b61237861253b565b612380612594565b61238a828261314b565b6119b4612698565b600061239c61253b565b6123a4612594565b611fd18261272a565b6001546001600160a01b031633146123d75760405162461bcd60e51b81526004016109c6906141b7565b600254600160401b90046001600160401b0316156124075760405162461bcd60e51b81526004016109c6906141ec565b6040805180820182526001600160a01b03848116808352848216602080850182815260008a8152600a8352879020955186549086166001600160a01b031991821617875590516001909601805496909516951694909417909255835187815292830152918101919091527f36050d958750e6ac3aa674ac7bbe8d0ae6a2f7d4b808e8c2c42c1f22fc9fc4bb9060600160405180910390a1505050565b6001546001600160a01b031633146124cd5760405162461bcd60e51b81526004016109c6906141b7565b6001600160a01b0381166125325760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201526564647265737360d01b60648201526084016109c6565b611587816131f7565b600054600160a01b900460ff1661099a5760405162461bcd60e51b815260206004820152601f60248201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c0060448201526064016109c6565b6000805460ff60a01b19169055565b60006125ae83613249565b6001600160a01b038381166000908152600960209081526040808320815160c08101835281549586168152600160a01b860460ff16151593810193909352600160a81b90940463ffffffff16908201526001830154606082018190526002840154608083015260039093015460a082015291811261262d576000612633565b81606001515b90506000612641828661435c565b90506000828460800151612655919061435c565b90508061267057670de0b6b3a7640000945050505050610c71565b8061268383670de0b6b3a7640000614273565b61268d91906142a8565b979650505050505050565b6000805460ff60a01b1916600160a01b179055565b606060006126bb8585613350565b905084816126c885613392565b6040516020016126da939291906146a7565b6040516020818303038152906040529150505b9392505050565b606060006127028585613350565b905084816126c8856134ba565b6060600061271d8585613350565b905084816126c8856134fb565b6001600160a01b038082166000908152600960209081526040808320805482516318160ddd60e01b8152925194959194869491909216926318160ddd92600480830193928290030181865afa158015612787573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906127ab9190614343565b9050806127c35750670de0b6b3a76400009392505050565b6127cc82613552565b6127d584613249565b60008260030154836001015484600201546127f091906146ea565b6127fa919061472b565b90508161280f82670de0b6b3a7640000614273565b61281991906142a8565b95945050505050565b6001600160a01b0382163b1561284957600b546119b4906001600160a01b031683836128dd565b600b54604051632e1a7d4d60e01b8152600481018390526001600160a01b0390911690632e1a7d4d90602401600060405180830381600087803b15801561288f57600080fd5b505af11580156128a3573d6000803e3d6000fd5b50506040516001600160a01b038516925083156108fc02915083906000818181858888f193505050501580156110a7573d6000803e3d6000fd5b6040516001600160a01b0383166024820152604481018290526110a790849063a9059cbb60e01b906064015b60408051601f198184030181529190526020810180516001600160e01b03166001600160e01b0319909316929092179091526135ba565b6040516001600160a01b03808516602483015283166044820152606481018290526129789085906323b872dd60e01b90608401612909565b50505050565b600d546040516302abf57960e61b815275536b696e6e794f7074696d69737469634f7261636c6560501b60048201526000916001600160a01b03169063aafd5e4090602401602060405180830381865afa1580156129e0573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610e539190614223565b801580612a7e5750604051636eb1769f60e11b81523060048201526001600160a01b03838116602483015284169063dd62ed3e90604401602060405180830381865afa158015612a58573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190612a7c9190614343565b155b612ae95760405162461bcd60e51b815260206004820152603660248201527f5361666545524332303a20617070726f76652066726f6d206e6f6e2d7a65726f60448201527520746f206e6f6e2d7a65726f20616c6c6f77616e636560501b60648201526084016109c6565b6040516001600160a01b0383166024820152604481018290526110a790849063095ea7b360e01b90606401612909565b600d546040516302abf57960e61b81526453746f726560d81b60048201526000916001600160a01b03169063aafd5e4090602401602060405180830381865afa158015612b6a573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190612b8e9190614223565b601354604051635b97aadd60e01b81526001600160a01b039182166004820152911690635b97aadd90602401602060405180830381865afa158015612bd7573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190612bfb919061476a565b51919050565b6000612c34828585604051602001612c1991906147ab565b6040516020818303038152906040528051906020012061368c565b949350505050565b600060ff821115612c855760405162461bcd60e51b8152602060048201526013602482015272496e646578206f7574206f6620626f756e647360681b60448201526064016109c6565b612c9161010083614837565b6001901b8317905092915050565b6000848152600a60205260408120546001600160a01b0316905b84518163ffffffff16101561307d5760006001600160a01b031660086000878463ffffffff1681518110612cef57612cef6145ac565b6020908102919091018101516001600160a01b03908116835282820193909352604091820160009081208b82529091522054161415612d685760405162461bcd60e51b8152602060048201526015602482015274149bdd5d19481b9bdd081dda1a5d195b1a5cdd1959605a1b60448201526064016109c6565b6000848263ffffffff1681518110612d8257612d826145ac565b6020026020010151131561302357612dec82858363ffffffff1681518110612dac57612dac6145ac565b6020026020010151878463ffffffff1681518110612dcc57612dcc6145ac565b60200260200101516001600160a01b03166128dd9092919063ffffffff16565b816001600160a01b03166352c8c75c868363ffffffff1681518110612e1357612e136145ac565b602002602001015160086000898663ffffffff1681518110612e3757612e376145ac565b60200260200101516001600160a01b03166001600160a01b0316815260200190815260200160002060008a815260200190815260200160002060009054906101000a90046001600160a01b0316878563ffffffff1681518110612e9c57612e9c6145ac565b60209081029190910181015160008c8152600a90925260409182902060010154915160e086901b6001600160e01b03191681526001600160a01b03948516600482015292841660248401526044830152919091166064820152608401600060405180830381600087803b158015612f1257600080fd5b505af1158015612f26573d6000803e3d6000fd5b50505050838163ffffffff1681518110612f4257612f426145ac565b602002602001015160096000878463ffffffff1681518110612f6657612f666145ac565b60200260200101516001600160a01b03166001600160a01b031681526020019081526020016000206001016000828254612fa091906146ea565b92505081905550838163ffffffff1681518110612fbf57612fbf6145ac565b602002602001015160096000878463ffffffff1681518110612fe357612fe36145ac565b60200260200101516001600160a01b03166001600160a01b03168152602001908152602001600020600201600082825461301d91906142bc565b90915550505b61306b858263ffffffff168151811061303e5761303e6145ac565b6020026020010151848363ffffffff168151811061305e5761305e6145ac565b60200260200101516136a2565b806130758161484b565b915050612cb9565b505050505050565b6000818152600a602052604090819020805460019091015460045460055493516001600160a01b0393841694859463e6eb8ade9416926130d392909190602401918252602082015260400190565b60408051601f198184030181529181526020820180516001600160e01b031663124e93e160e21b1790525160e084901b6001600160e01b031916815261311d92919060040161486f565b600060405180830381600087803b15801561313757600080fd5b505af115801561307d573d6000803e3d6000fd5b6000828152600a60205260409081902080546001909101549151637375c56f60e11b81526001600160a01b0391821692839263e6eb8ade926131959290911690869060040161486f565b600060405180830381600087803b1580156131af57600080fd5b505af11580156131c3573d6000803e3d6000fd5b50505050827f218987b934c2f6bc596136829fbf43a5fef4d6fafce41f3f6254d9a870c2deec8360405161177d9190613c1c565b600180546001600160a01b038381166001600160a01b0319831681179093556040519116919082907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e090600090a35050565b6040516370a0823160e01b81523060048201526000906001600160a01b038316906370a0823190602401602060405180830381865afa158015613290573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906132b49190614343565b6001600160a01b0383166000908152600960205260409020600201549091508111156119b4576001600160a01b03821660009081526009602052604090206002015461330090826142bc565b6001600160a01b0383166000908152600960205260408120600101805490919061332b90849061472b565b90915550506001600160a01b0391909116600090815260096020526040902060020155565b815160609015613381578160405160200161336b9190614893565b6040516020818303038152906040529050610c71565b8160405160200161336b91906148c7565b6060816133b65750506040805180820190915260018152600360fc1b602082015290565b8160005b81156133e057806133ca8161468c565b91506133d99050600a836142a8565b91506133ba565b6000816001600160401b038111156133fa576133fa613c9c565b6040519080825280601f01601f191660200182016040528015613424576020820181803683370190505b509050815b85156134b15761343a6001826142bc565b90506000613449600a886142a8565b61345490600a614273565b61345e90886142bc565b6134699060306148ec565b905060008160f81b905080848481518110613486576134866145ac565b60200101906001600160f81b031916908160001a9053506134a8600a896142a8565b97505050613429565b50949350505050565b60606134c9608083901c613775565b6134d283613775565b6040805160208101939093528201526060015b6040516020818303038152906040529050919050565b60606135136001600160801b03602084901c16613775565b61352e8360601b6bffffffffffffffffffffffff1916613775565b6040516020016134e59291909182526001600160c01b031916602082015260280190565b6003810154815460009161357291600160a81b900463ffffffff16613909565b90508082600301600082825461358891906142bc565b90915550613596905061145c565b825463ffffffff91909116600160a81b0263ffffffff60a81b199091161790915550565b600061360f826040518060400160405280602081526020017f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c6564815250856001600160a01b031661395e9092919063ffffffff16565b8051909150156110a7578080602001905181019061362d9190614240565b6110a75760405162461bcd60e51b815260206004820152602a60248201527f5361666545524332303a204552433230206f7065726174696f6e20646964206e6044820152691bdd081cdd58d8d9595960b21b60648201526084016109c6565b600082613699858461396d565b14949350505050565b6000670de0b6b3a7640000601254836136bb9190614273565b6136c591906142a8565b905060006136d382846142bc565b9050801561373c576001600160a01b0384166000908152600960205260408120600301805483929061370690849061435c565b90915550506001600160a01b038416600090815260096020526040812060010180548392906137369084906146ea565b90915550505b8115612978576001600160a01b0384166000908152601060205260408120805484929061376a90849061435c565b909155505050505050565b6000808260001c9050806001600160801b0316905080600160401b02811777ffffffffffffffff0000000000000000ffffffffffffffff169050806401000000000281177bffffffff00000000ffffffff00000000ffffffff00000000ffffffff16905080620100000281177dffff0000ffff0000ffff0000ffff0000ffff0000ffff0000ffff0000ffff169050806101000281177eff00ff00ff00ff00ff00ff00ff00ff00ff00ff00ff00ff00ff00ff00ff00ff1690508060100281177f0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f16905060006008827f0808080808080808080808080808080808080808080808080808080808080808168161388b5761388b614292565b0460047f040404040404040404040404040404040404040404040404040404040404040484160460027f020202020202020202020202020202020202020202020202020202020202020285160417166027029091017f3030303030303030303030303030303030303030303030303030303030303030019392505050565b6000808261391561145c565b61391f91906142bc565b90506000670de0b6b3a764000082600f548761393b9190614273565b6139459190614273565b61394f91906142a8565b9050848110612c345784612819565b6060612c348484600085613a19565b600081815b8451811015613a1157600085828151811061398f5761398f6145ac565b602002602001015190508083116139d15760408051602081018590529081018290526060016040516020818303038152906040528051906020012092506139fe565b60408051602081018390529081018490526060016040516020818303038152906040528051906020012092505b5080613a098161468c565b915050613972565b509392505050565b606082471015613a7a5760405162461bcd60e51b815260206004820152602660248201527f416464726573733a20696e73756666696369656e742062616c616e636520666f6044820152651c8818d85b1b60d21b60648201526084016109c6565b843b613ac85760405162461bcd60e51b815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e747261637400000060448201526064016109c6565b600080866001600160a01b03168587604051613ae49190614911565b60006040518083038185875af1925050503d8060008114613b21576040519150601f19603f3d011682016040523d82523d6000602084013e613b26565b606091505b509150915061268d82828660608315613b405750816126ed565b825115613b505782518084602001fd5b8160405162461bcd60e51b81526004016109c69190613c1c565b6001600160a01b038116811461158757600080fd5b60008060408385031215613b9257600080fd5b8235613b9d81613b6a565b946020939093013593505050565b600060208284031215613bbd57600080fd5b5035919050565b60005b83811015613bdf578181015183820152602001613bc7565b838111156129785750506000910152565b60008151808452613c08816020860160208601613bc4565b601f01601f19169290920160200192915050565b6020815260006126ed6020830184613bf0565b600060208284031215613c4157600080fd5b81356126ed81613b6a565b801515811461158757600080fd5b600080600060608486031215613c6f57600080fd5b8335613c7a81613b6a565b9250602084013591506040840135613c9181613c4c565b809150509250925092565b634e487b7160e01b600052604160045260246000fd5b60405160c081016001600160401b0381118282101715613cd457613cd4613c9c565b60405290565b604051601f8201601f191681016001600160401b0381118282101715613d0257613d02613c9c565b604052919050565b60006001600160401b03821115613d2357613d23613c9c565b5060051b60200190565b600082601f830112613d3e57600080fd5b81356020613d53613d4e83613d0a565b613cda565b82815260059290921b84018101918181019086841115613d7257600080fd5b8286015b84811015613d8d5780358352918301918301613d76565b509695505050505050565b803560ff81168114611fdb57600080fd5b600082601f830112613dba57600080fd5b81356020613dca613d4e83613d0a565b82815260059290921b84018101918181019086841115613de957600080fd5b8286015b84811015613d8d578035613e0081613b6a565b8352918301918301613ded565b60008060408385031215613e2057600080fd5b82356001600160401b0380821115613e3757600080fd5b9084019060c08287031215613e4b57600080fd5b613e53613cb2565b82358152602083013582811115613e6957600080fd5b613e7588828601613d2d565b602083015250604083013582811115613e8d57600080fd5b613e9988828601613d2d565b604083015250606083013582811115613eb157600080fd5b613ebd88828601613d2d565b606083015250613ecf60808401613d98565b608082015260a083013582811115613ee657600080fd5b613ef288828601613da9565b60a08301525093506020850135915080821115613f0e57600080fd5b50613f1b85828601613d2d565b9150509250929050565b60008060008060808587031215613f3b57600080fd5b84359350602085013592506040850135613f5481613b6a565b91506060850135613f6481613b6a565b939692955090935050565b600060208284031215613f8157600080fd5b81356001600160401b03811681146126ed57600080fd5b600080600080600060a08688031215613fb057600080fd5b85356001600160401b03811115613fc657600080fd5b613fd288828901613d2d565b955050613fe160208701613d98565b94979496505050506040830135926060810135926080909101359150565b6000806020838503121561401257600080fd5b82356001600160401b038082111561402957600080fd5b818501915085601f83011261403d57600080fd5b81358181111561404c57600080fd5b8660208260051b850101111561406157600080fd5b60209290920196919550909350505050565b6000602080830181845280855180835260408601915060408160051b870101925083870160005b828110156140c857603f198886030184526140b6858351613bf0565b9450928501929085019060010161409a565b5092979650505050505050565b60006001600160401b038211156140ee576140ee613c9c565b50601f01601f191660200190565b6000806040838503121561410f57600080fd5b8235915060208301356001600160401b0381111561412c57600080fd5b8301601f8101851361413d57600080fd5b803561414b613d4e826140d5565b81815286602083850101111561416057600080fd5b816020840160208301376000602083830101528093505050509250929050565b60008060006060848603121561419557600080fd5b8335925060208401356141a781613b6a565b91506040840135613c9181613b6a565b6020808252818101527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604082015260600190565b6020808252601c908201527f70726f706f73616c2068617320756e636c61696d6564206c6561667300000000604082015260600190565b60006020828403121561423557600080fd5b81516126ed81613b6a565b60006020828403121561425257600080fd5b81516126ed81613c4c565b634e487b7160e01b600052601160045260246000fd5b600081600019048311821515161561428d5761428d61425d565b500290565b634e487b7160e01b600052601260045260246000fd5b6000826142b7576142b7614292565b500490565b6000828210156142ce576142ce61425d565b500390565b60006101208b835263ffffffff8b1660208401528060408401526142f98184018b613bf0565b6001600160a01b03998a1660608501526080840198909852505060a08101949094526001600160401b039290921660c084015290931660e082015261010001919091529392505050565b60006020828403121561435557600080fd5b5051919050565b6000821982111561436f5761436f61425d565b500190565b600061020088835263ffffffff8816602084015280604084015261439a81840188613bf0565b9150506143b36060830186516001600160a01b03169052565b60208501516001600160a01b03811660808401525060408501516001600160a01b03811660a084015250606085015180151560c084015250608085015160e083015260a0850151610100818185015260c08701519150610120828186015260e0880151925061014083818701528289015161016087015281890151610180870152808901516101a0870152505050506144586101c08301856001600160a01b03169052565b6001600160a01b0383166101e0830152979650505050505050565b828152604060208201526000612c346040830184613bf0565b60006001600160401b038216806144a5576144a561425d565b6000190192915050565b600081518084526020808501945080840160005b838110156144e85781516001600160a01b0316875295820195908201906001016144c3565b509495945050505050565b600081518084526020808501945080840160005b838110156144e857815187529582019590820190600101614507565b60808152600061453660808301876144af565b828103602084015261454881876144f3565b9050828103604084015261455c81866144f3565b9050828103606084015261268d81856144f3565b6001600160401b038516815260ff8416602082015260806040820152600061459b60808301856144f3565b905082606083015295945050505050565b634e487b7160e01b600052603260045260246000fd5b6000808335601e198436030181126145d957600080fd5b8301803591506001600160401b038211156145f357600080fd5b60200191503681900382131561460857600080fd5b9250929050565b8183823760009101908152919050565b60006020828403121561463157600080fd5b81516001600160401b0381111561464757600080fd5b8201601f8101841361465857600080fd5b8051614666613d4e826140d5565b81815285602083850101111561467b57600080fd5b612819826020830160208601613bc4565b60006000198214156146a0576146a061425d565b5060010190565b600084516146b9818460208901613bc4565b8451908301906146cd818360208901613bc4565b84519101906146e0818360208801613bc4565b0195945050505050565b600080821280156001600160ff1b038490038513161561470c5761470c61425d565b600160ff1b83900384128116156147255761472561425d565b50500190565b60008083128015600160ff1b8501841216156147495761474961425d565b6001600160ff1b03840183138116156147645761476461425d565b50500390565b60006020828403121561477c57600080fd5b604051602081018181106001600160401b038211171561479e5761479e613c9c565b6040529151825250919050565b60208152815160208201526000602083015160c060408401526147d160e08401826144f3565b90506040840151601f19808584030160608601526147ef83836144f3565b9250606086015191508085840301608086015261480c83836144f3565b925060ff60808701511660a086015260a08601519150808584030160c08601525061281982826144af565b60008261484657614846614292565b500690565b600063ffffffff808316818114156148655761486561425d565b6001019392505050565b6001600160a01b0383168152604060208201819052600090612c3490830184613bf0565b600b60fa1b8152600082516148af816001850160208701613bc4565b601d60f91b6001939091019283015250600201919050565b600082516148d9818460208701613bc4565b601d60f91b920191825250600101919050565b600060ff821660ff84168060ff038211156149095761490961425d565b019392505050565b60008251614923818460208701613bc4565b919091019291505056fea264697066735822122072032f81f08788bd28728ee8debb4d15a1230240734cab3d664d84adc11077b564736f6c634300080b0033", - "deployedBytecode": "0x60806040526004361061025e5760003560e01c8063552188a711610144578063ac9650d8116100b6578063dd70e5e81161007a578063dd70e5e8146107cc578063e0f339e3146107ec578063e40064d71461080c578063e460e35c14610839578063f0056a7d14610859578063f2fde38b146108fe5761026d565b8063ac9650d81461070b578063b60c2d7d1461072b578063b9a3c84c1461074b578063bb9219a21461076b578063c28f4392146107ac5761026d565b80637998a1c4116101085780637998a1c41461066157806380f323a7146106775780638bda0c001461068d5780638da5cb5b146106ad578063a16fd6e9146106cb578063a5841194146106eb5761026d565b8063552188a71461026d57806356688700146105e15780636ad0690a146105f4578063715018a61461062c57806376ec08dd146106415761026d565b806322f8e566116101dd57806338b9e2ce116101a157806338b9e2ce146104a35780633994a3ce146104c35780633c4432f1146104e35780633fc8cef3146105035780634144fd61146105235780634f7473ff146105cb5761026d565b806322f8e5661461040e578063240f475f1461042e57806329cb924d1461044e5780632d0f6f841461046357806333dc09ca146104835761026d565b80630c501af9116102245780630c501af91461036b5780630ee28a881461038b57806311cfc159146103ab5780631c39c38d146103c157806322395aaa146103f95761026d565b8062660b5314610275578062c9920614610295578063084d0513146102b557806309474ae2146102e85780630a2dc9ec146103495761026d565b3661026d5761026b61091e565b005b61026b61091e565b34801561028157600080fd5b5061026b610290366004613b7f565b61099c565b3480156102a157600080fd5b5061026b6102b0366004613bab565b610a7a565b3480156102c157600080fd5b506102d56102d0366004613b7f565b610c4b565b6040519081526020015b60405180910390f35b3480156102f457600080fd5b50610329610303366004613bab565b600a60205260009081526040902080546001909101546001600160a01b03918216911682565b604080516001600160a01b039384168152929091166020830152016102df565b34801561035557600080fd5b5061035e610c77565b6040516102df9190613c1c565b34801561037757600080fd5b5061026b610386366004613c2f565b610e58565b34801561039757600080fd5b5061026b6103a6366004613c5a565b610eea565b3480156103b757600080fd5b506102d5600f5481565b3480156103cd57600080fd5b506000546103e1906001600160a01b031681565b6040516001600160a01b0390911681526020016102df565b34801561040557600080fd5b5061026b6110ac565b34801561041a57600080fd5b5061026b610429366004613bab565b611401565b34801561043a57600080fd5b506011546103e1906001600160a01b031681565b34801561045a57600080fd5b506102d561145c565b34801561046f57600080fd5b5061026b61047e366004613c2f565b6114e8565b34801561048f57600080fd5b5061026b61049e366004613b7f565b61158a565b3480156104af57600080fd5b5061026b6104be366004613e0d565b61178a565b3480156104cf57600080fd5b5061026b6104de366004613f25565b6119b8565b3480156104ef57600080fd5b5061026b6104fe366004613f6f565b611ac4565b34801561050f57600080fd5b50600b546103e1906001600160a01b031681565b34801561052f57600080fd5b5060025460035460045460055460065460075461057a956001600160401b0380821696600160401b90920416949093909290916001600160a01b03811690600160a01b900460ff1688565b604080516001600160401b03998a168152989097166020890152958701949094526060860192909252608085015260a08401526001600160a01b031660c0830152151560e0820152610100016102df565b3480156105d757600080fd5b506102d560125481565b61026b6105ef366004613b7f565b611b8c565b34801561060057600080fd5b50601554610614906001600160401b031681565b6040516001600160401b0390911681526020016102df565b34801561063857600080fd5b5061026b611e09565b34801561064d57600080fd5b50600c546103e1906001600160a01b031681565b34801561066d57600080fd5b506102d5600e5481565b34801561068357600080fd5b506102d560145481565b34801561069957600080fd5b5061026b6106a8366004613f98565b611e3d565b3480156106b957600080fd5b506001546001600160a01b03166103e1565b3480156106d757600080fd5b506102d56106e6366004613c2f565b611fb4565b3480156106f757600080fd5b5061026b610706366004613c2f565b611fe0565b61071e610719366004613fff565b612001565b6040516102df9190614073565b34801561073757600080fd5b5061026b610746366004613c2f565b6121a6565b34801561075757600080fd5b50600d546103e1906001600160a01b031681565b34801561077757600080fd5b506103e1610786366004613b7f565b60086020908152600092835260408084209091529082529020546001600160a01b031681565b3480156107b857600080fd5b506013546103e1906001600160a01b031681565b3480156107d857600080fd5b5061026b6107e73660046140fc565b612346565b3480156107f857600080fd5b506102d5610807366004613c2f565b612392565b34801561081857600080fd5b506102d5610827366004613c2f565b60106020526000908152604090205481565b34801561084557600080fd5b5061026b610854366004614180565b6123ad565b34801561086557600080fd5b506108bc610874366004613c2f565b60096020526000908152604090208054600182015460028301546003909301546001600160a01b03831693600160a01b840460ff1693600160a81b900463ffffffff16929186565b604080516001600160a01b039097168752941515602087015263ffffffff909316938501939093526060840152608083019190915260a082015260c0016102df565b34801561090a57600080fd5b5061026b610919366004613c2f565b6124a3565b600054600160a01b900460ff161561099a57600b60009054906101000a90046001600160a01b03166001600160a01b031663d0e30db0476040518263ffffffff1660e01b81526004016000604051808303818588803b15801561098057600080fd5b505af1158015610994573d6000803e3d6000fd5b50505050505b565b6001546001600160a01b031633146109cf5760405162461bcd60e51b81526004016109c6906141b7565b60405180910390fd5b670de0b6b3a7640000811115610a275760405162461bcd60e51b815260206004820152601960248201527f4261642070726f746f636f6c466565436170747572655063740000000000000060448201526064016109c6565b601180546001600160a01b0319166001600160a01b03841690811790915560128290556040518291907fc1993b89fd79a19ece7beb067ddc8534ca26d29c0ff94ea2f53b4a508d1eedc990600090a35050565b6001546001600160a01b03163314610aa45760405162461bcd60e51b81526004016109c6906141b7565b600254600160401b90046001600160401b031615610ad45760405162461bcd60e51b81526004016109c6906141ec565b600d546040516302abf57960e61b8152721259195b9d1a599a595c95da1a5d195b1a5cdd606a1b60048201526000916001600160a01b03169063aafd5e4090602401602060405180830381865afa158015610b33573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610b579190614223565b6040516390978d1b60e01b8152600481018490529091506001600160a01b038216906390978d1b90602401602060405180830381865afa158015610b9f573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610bc39190614240565b610c0f5760405162461bcd60e51b815260206004820152601860248201527f4964656e746966696572206e6f7420737570706f72746564000000000000000060448201526064016109c6565b600e8290556040518281527ff45367c278fcceff23d601ce4bdd191e5bd61687ff9f29dc7276a08fe54c0c5d9060200160405180910390a15050565b6000610c5561253b565b610c5d612594565b610c6783836125a3565b9050610c71612698565b92915050565b6040805160208082018352600082528251808401909352601a83527f7265717565737445787069726174696f6e54696d657374616d7000000000000090830152600254606092610cd092916001600160401b03166126ad565b60408051808201909152601f81527f756e636c61696d6564506f6f6c526562616c616e63654c656166436f756e74006020820152600254919250610d2691839190600160401b90046001600160401b03166126ad565b9050610d6181604051806040016040528060118152602001701c1bdbdb149958985b185b98d9549bdbdd607a1b8152506002600101546126f4565b9050610d9b81604051806040016040528060118152602001701c995b185e595c9499599d5b99149bdbdd607a1b81525060028001546126f4565b9050610de2816040518060400160405280601881526020017f736c6f7752656c617946756c66696c6c6d656e74526f6f7400000000000000008152506002600301546126f4565b9050610e19816040518060400160405280600d81526020016c0636c61696d65644269744d617609c1b8152506002600401546126ad565b604080518082019091526008815267383937b837b9b2b960c11b6020820152600754919250610e53918391906001600160a01b031661270f565b905090565b6001546001600160a01b03163314610e825760405162461bcd60e51b81526004016109c6906141b7565b6001600160a01b03818116600081815260096020908152604091829020805460ff60a01b1981169091558251938452909316928201929092527fac111b3b527b307393c94d98f26140effb71411054466818be97912d2d65f77691015b60405180910390a150565b610ef261253b565b610efa612594565b600b546001600160a01b0384811691161480610f14575080155b610f505760405162461bcd60e51b815260206004820152600d60248201526c086c2dce840e6cadcc840cae8d609b1b60448201526064016109c6565b6000670de0b6b3a7640000610f648561272a565b610f6e9085614273565b610f7891906142a8565b6001600160a01b038581166000908152600960205260409081902054905163079cc67960e41b81523360048201526024810187905292935016906379cc6790906044016020604051808303816000875af1158015610fda573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610ffe9190614240565b506001600160a01b0384166000908152600960205260408120600201805483929061102a9084906142bc565b909155505081156110445761103f3382612822565b611058565b6110586001600160a01b03851633836128dd565b604080518281526020810185905233916001600160a01b038716917fcda1185f28599e6bd14ab8a68b3c30a11e1dce4256b5e67e94dd3fd846a6c589910160405180910390a3506110a7612698565b505050565b6110b461253b565b6110bc612594565b6002546001600160401b03166110d061145c565b111561111e5760405162461bcd60e51b815260206004820152601760248201527f5265717565737420706173736564206c6976656e65737300000000000000000060448201526064016109c6565b601454600061112b610c77565b601354909150611146906001600160a01b0316333085612940565b61116f61115161297e565b61115c846002614273565b6013546001600160a01b03169190612a04565b61117761297e565b6001600160a01b031663af355d1e600e5461119061145c565b60135485906001600160a01b031660006111a8612b19565b6014546111b591906142bc565b6015546007546040516001600160e01b031960e08b901b1681526111ff989796959493926001600160401b0316916001600160a01b031690670de0b6b3a7640000906004016142d3565b6020604051808303816000875af115801561121e573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906112429190614343565b5060408051610160810182526007546001600160a01b0390811682526000602083018190526013549091169282019290925260608101829052670de0b6b3a7640000608082015260a0810182905260155460c08201906001600160401b03166112a961145c565b6112b3919061435c565b8152602001600081526020016112c7612b19565b81526020016112d4612b19565b6014546112e191906142bc565b81526015546001600160401b031660209091015290506112ff61297e565b6001600160a01b0316639ce320c8600e5461131861145c565b858533306040518763ffffffff1660e01b815260040161133d96959493929190614374565b6020604051808303816000875af115801561135c573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906113809190614343565b50337f4c789f44a7398cb63bf580e03ad5a7ec8228ea4935d3c1a1135eb449f0bb301b6113ab61145c565b846040516113ba929190614473565b60405180910390a25050600280546001600160801b0319169055506000600381905560048190556005819055600655600780546001600160a81b031916905561099a612698565b6000546001600160a01b031661141657600080fd5b60005460405163117c72b360e11b8152600481018390526001600160a01b03909116906322f8e56690602401600060405180830381600087803b15801561098057600080fd5b600080546001600160a01b0316156114e35760008054906101000a90046001600160a01b03166001600160a01b03166329cb924d6040518163ffffffff1660e01b8152600401602060405180830381865afa1580156114bf573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610e539190614343565b504290565b6114f061253b565b6114f8612594565b6011546001600160a01b03828116600081815260106020526040902054611524939192909116906128dd565b6001600160a01b0381166000818152601060205260408082205490519092917f74740239d7d696c84422b720e125e1f47c4138c66d1f4d2a48e99f4197cdb79c91a36001600160a01b038116600090815260106020526040812055611587612698565b50565b6001546001600160a01b031633146115b45760405162461bcd60e51b81526004016109c6906141b7565b600254600160401b90046001600160401b0316156115e45760405162461bcd60e51b81526004016109c6906141ec565b600d546040516302abf57960e61b81527210dbdb1b185d195c985b15da1a5d195b1a5cdd606a1b60048201526000916001600160a01b03169063aafd5e4090602401602060405180830381865afa158015611643573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906116679190614223565b604051631d1d5b3960e11b81526001600160a01b03858116600483015291925090821690633a3ab67290602401602060405180830381865afa1580156116b1573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906116d59190614240565b6117145760405162461bcd60e51b815260206004820152601060248201526f139bdd081bdb881dda1a5d195b1a5cdd60821b60448201526064016109c6565b601380546001600160a01b0319166001600160a01b038516179055611737612b19565b611741908361435c565b60148190556040519081526001600160a01b038416907fbfa9a96010167e98ce8c004f718932cbbfd33a58d681c752e693be7d457a1b3b906020015b60405180910390a2505050565b61179261253b565b61179a612594565b6002546001600160401b03166117ae61145c565b10156117f25760405162461bcd60e51b81526020600482015260136024820152724e6f7420706173736564206c6976656e65737360681b60448201526064016109c6565b6006546080830151600160ff9091161b90811614156118455760405162461bcd60e51b815260206004820152600f60248201526e105b1c9958591e4818db185a5b5959608a1b60448201526064016109c6565b600354611853908383612c01565b61188b5760405162461bcd60e51b81526020600482015260096024820152682130b210283937b7b360b91b60448201526064016109c6565b6118a1600260040154836080015160ff16612c3c565b60065560028054600160401b90046001600160401b03169060086118c48361448c565b91906101000a8154816001600160401b0302191690836001600160401b031602179055505061190582600001518360a0015184604001518560200151612c9f565b815161191090613085565b600254600160401b90046001600160401b031661194857600754601454601354611948926001600160a01b03918216929116906128dd565b336001600160a01b03168260000151836080015160ff167f269bcb1817facd431d586b474ce46fe1ca2921cd1a19314c01a606804ea8b9458560a001518660200151876040015188606001516040516119a49493929190614523565b60405180910390a46119b4612698565b5050565b6001546001600160a01b031633146119e25760405162461bcd60e51b81526004016109c6906141b7565b6001600160a01b0382811660008181526008602090815260408083208884529091529081902080546001600160a01b03191693851693909317909255905160248101919091526044810184905260016064820152611a6e90859060840160408051601f198184030181529190526020810180516001600160e01b031663272751c760e01b17905261314b565b60408051858152602081018590526001600160a01b03848116828401528316606082015290517f9ea2ac5578d6a787096208b4dbd9fc248858ea249f9c342f10caf9ca943ec9d49181900360800190a150505050565b6001546001600160a01b03163314611aee5760405162461bcd60e51b81526004016109c6906141b7565b610258816001600160401b031611611b3d5760405162461bcd60e51b8152602060048201526012602482015271131a5d995b995cdcc81d1bdbc81cda1bdc9d60721b60448201526064016109c6565b6015805467ffffffffffffffff19166001600160401b0383169081179091556040519081527f04dd1d84d387f404568a7954b5e398518bdd716e1a8f4a790be9a1a225ad934790602001610edf565b6001600160a01b038216600090815260096020526040902054600160a01b900460ff16611bef5760405162461bcd60e51b8152602060048201526011602482015270151bdad95b881b9bdd08195b98589b1959607a1b60448201526064016109c6565b600b546001600160a01b038381169116148015611c0b57508034145b80611c14575034155b611c505760405162461bcd60e51b815260206004820152600d60248201526c426164206d73672e76616c756560981b60448201526064016109c6565b6000611c5b8361272a565b611c6d83670de0b6b3a7640000614273565b611c7791906142a8565b6001600160a01b03848116600090815260096020526040908190205490516340c10f1960e01b81523360048201526024810184905292935016906340c10f19906044016020604051808303816000875af1158015611cd9573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611cfd9190614240565b506001600160a01b03831660009081526009602052604081206002018054849290611d2990849061435c565b9091555050600b546001600160a01b038481169116148015611d4b5750600034115b15611da957826001600160a01b031663d0e30db0346040518263ffffffff1660e01b81526004016000604051808303818588803b158015611d8b57600080fd5b505af1158015611d9f573d6000803e3d6000fd5b5050505050611dbe565b611dbe6001600160a01b038416333085612940565b604080518381526020810183905233916001600160a01b038616917f3c69701a61c79a92ef9692903aaa0068bce8771361ecb09547391e4fb4df8537910160405180910390a3505050565b6001546001600160a01b03163314611e335760405162461bcd60e51b81526004016109c6906141b7565b61099a60006131f7565b611e4561253b565b611e4d612594565b600254600160401b90046001600160401b031615611e7d5760405162461bcd60e51b81526004016109c6906141ec565b60008460ff1611611ed05760405162461bcd60e51b815260206004820181905260248201527f42756e646c65206d7573742068617665206174206c656173742031206c65616660448201526064016109c6565b6015546000906001600160401b0316611ee761145c565b611ef1919061435c565b600280546000600655600780546001600160801b03199092166001600160401b03851617600160401b60ff8b1602179092556003879055600486905560058590556001600160a81b03191633908117909155601454601354929350611f62926001600160a01b031691903090612940565b336001600160a01b031683857fc8af40a0d5158e00ff775a1ed68cc732ad2636d1c595398cb3f8fd14ec32295e84898b88604051611fa39493929190614570565b60405180910390a450610994612698565b6000611fbe61253b565b611fc6612594565b611fd18260006125a3565b9050611fdb612698565b919050565b611fe861253b565b611ff0612594565b611ff981613249565b611587612698565b606034156120515760405162461bcd60e51b815260206004820152601b60248201527f4f6e6c79206d756c746963616c6c207769746820302076616c7565000000000060448201526064016109c6565b816001600160401b0381111561206957612069613c9c565b60405190808252806020026020018201604052801561209c57816020015b60608152602001906001900390816120875790505b50905060005b8281101561219f57600080308686858181106120c0576120c06145ac565b90506020028101906120d291906145c2565b6040516120e092919061460f565b600060405180830381855af49150503d806000811461211b576040519150601f19603f3d011682016040523d82523d6000602084013e612120565b606091505b50915091508161216c5760448151101561213957600080fd5b60048101905080806020019051810190612153919061461f565b60405162461bcd60e51b81526004016109c69190613c1c565b8084848151811061217f5761217f6145ac565b6020026020010181905250505080806121979061468c565b9150506120a2565b5092915050565b6001546001600160a01b031633146121d05760405162461bcd60e51b81526004016109c6906141b7565b6001600160a01b038181166000908152600960205260409020541661228f57600c54604051637e178db760e11b81526001600160a01b0383811660048301529091169063fc2f1b6e906024016020604051808303816000875af115801561223b573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061225f9190614223565b6001600160a01b03828116600090815260096020526040902080546001600160a01b031916929091169190911790555b6001600160a01b0381166000908152600960205260409020805460ff60a01b1916600160a01b1790556122c061145c565b6001600160a01b0380831660009081526009602052604090819020805463ffffffff94909416600160a81b0263ffffffff60a81b198516811790915590517f04e291c80180d65a57b5bf1bed775777ec0d6f283ef34bcf130712714d8bb7f793610edf9386938116911617906001600160a01b0392831681529116602082015260400190565b6001546001600160a01b031633146123705760405162461bcd60e51b81526004016109c6906141b7565b61237861253b565b612380612594565b61238a828261314b565b6119b4612698565b600061239c61253b565b6123a4612594565b611fd18261272a565b6001546001600160a01b031633146123d75760405162461bcd60e51b81526004016109c6906141b7565b600254600160401b90046001600160401b0316156124075760405162461bcd60e51b81526004016109c6906141ec565b6040805180820182526001600160a01b03848116808352848216602080850182815260008a8152600a8352879020955186549086166001600160a01b031991821617875590516001909601805496909516951694909417909255835187815292830152918101919091527f36050d958750e6ac3aa674ac7bbe8d0ae6a2f7d4b808e8c2c42c1f22fc9fc4bb9060600160405180910390a1505050565b6001546001600160a01b031633146124cd5760405162461bcd60e51b81526004016109c6906141b7565b6001600160a01b0381166125325760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201526564647265737360d01b60648201526084016109c6565b611587816131f7565b600054600160a01b900460ff1661099a5760405162461bcd60e51b815260206004820152601f60248201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c0060448201526064016109c6565b6000805460ff60a01b19169055565b60006125ae83613249565b6001600160a01b038381166000908152600960209081526040808320815160c08101835281549586168152600160a01b860460ff16151593810193909352600160a81b90940463ffffffff16908201526001830154606082018190526002840154608083015260039093015460a082015291811261262d576000612633565b81606001515b90506000612641828661435c565b90506000828460800151612655919061435c565b90508061267057670de0b6b3a7640000945050505050610c71565b8061268383670de0b6b3a7640000614273565b61268d91906142a8565b979650505050505050565b6000805460ff60a01b1916600160a01b179055565b606060006126bb8585613350565b905084816126c885613392565b6040516020016126da939291906146a7565b6040516020818303038152906040529150505b9392505050565b606060006127028585613350565b905084816126c8856134ba565b6060600061271d8585613350565b905084816126c8856134fb565b6001600160a01b038082166000908152600960209081526040808320805482516318160ddd60e01b8152925194959194869491909216926318160ddd92600480830193928290030181865afa158015612787573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906127ab9190614343565b9050806127c35750670de0b6b3a76400009392505050565b6127cc82613552565b6127d584613249565b60008260030154836001015484600201546127f091906146ea565b6127fa919061472b565b90508161280f82670de0b6b3a7640000614273565b61281991906142a8565b95945050505050565b6001600160a01b0382163b1561284957600b546119b4906001600160a01b031683836128dd565b600b54604051632e1a7d4d60e01b8152600481018390526001600160a01b0390911690632e1a7d4d90602401600060405180830381600087803b15801561288f57600080fd5b505af11580156128a3573d6000803e3d6000fd5b50506040516001600160a01b038516925083156108fc02915083906000818181858888f193505050501580156110a7573d6000803e3d6000fd5b6040516001600160a01b0383166024820152604481018290526110a790849063a9059cbb60e01b906064015b60408051601f198184030181529190526020810180516001600160e01b03166001600160e01b0319909316929092179091526135ba565b6040516001600160a01b03808516602483015283166044820152606481018290526129789085906323b872dd60e01b90608401612909565b50505050565b600d546040516302abf57960e61b815275536b696e6e794f7074696d69737469634f7261636c6560501b60048201526000916001600160a01b03169063aafd5e4090602401602060405180830381865afa1580156129e0573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610e539190614223565b801580612a7e5750604051636eb1769f60e11b81523060048201526001600160a01b03838116602483015284169063dd62ed3e90604401602060405180830381865afa158015612a58573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190612a7c9190614343565b155b612ae95760405162461bcd60e51b815260206004820152603660248201527f5361666545524332303a20617070726f76652066726f6d206e6f6e2d7a65726f60448201527520746f206e6f6e2d7a65726f20616c6c6f77616e636560501b60648201526084016109c6565b6040516001600160a01b0383166024820152604481018290526110a790849063095ea7b360e01b90606401612909565b600d546040516302abf57960e61b81526453746f726560d81b60048201526000916001600160a01b03169063aafd5e4090602401602060405180830381865afa158015612b6a573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190612b8e9190614223565b601354604051635b97aadd60e01b81526001600160a01b039182166004820152911690635b97aadd90602401602060405180830381865afa158015612bd7573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190612bfb919061476a565b51919050565b6000612c34828585604051602001612c1991906147ab565b6040516020818303038152906040528051906020012061368c565b949350505050565b600060ff821115612c855760405162461bcd60e51b8152602060048201526013602482015272496e646578206f7574206f6620626f756e647360681b60448201526064016109c6565b612c9161010083614837565b6001901b8317905092915050565b6000848152600a60205260408120546001600160a01b0316905b84518163ffffffff16101561307d5760006001600160a01b031660086000878463ffffffff1681518110612cef57612cef6145ac565b6020908102919091018101516001600160a01b03908116835282820193909352604091820160009081208b82529091522054161415612d685760405162461bcd60e51b8152602060048201526015602482015274149bdd5d19481b9bdd081dda1a5d195b1a5cdd1959605a1b60448201526064016109c6565b6000848263ffffffff1681518110612d8257612d826145ac565b6020026020010151131561302357612dec82858363ffffffff1681518110612dac57612dac6145ac565b6020026020010151878463ffffffff1681518110612dcc57612dcc6145ac565b60200260200101516001600160a01b03166128dd9092919063ffffffff16565b816001600160a01b03166352c8c75c868363ffffffff1681518110612e1357612e136145ac565b602002602001015160086000898663ffffffff1681518110612e3757612e376145ac565b60200260200101516001600160a01b03166001600160a01b0316815260200190815260200160002060008a815260200190815260200160002060009054906101000a90046001600160a01b0316878563ffffffff1681518110612e9c57612e9c6145ac565b60209081029190910181015160008c8152600a90925260409182902060010154915160e086901b6001600160e01b03191681526001600160a01b03948516600482015292841660248401526044830152919091166064820152608401600060405180830381600087803b158015612f1257600080fd5b505af1158015612f26573d6000803e3d6000fd5b50505050838163ffffffff1681518110612f4257612f426145ac565b602002602001015160096000878463ffffffff1681518110612f6657612f666145ac565b60200260200101516001600160a01b03166001600160a01b031681526020019081526020016000206001016000828254612fa091906146ea565b92505081905550838163ffffffff1681518110612fbf57612fbf6145ac565b602002602001015160096000878463ffffffff1681518110612fe357612fe36145ac565b60200260200101516001600160a01b03166001600160a01b03168152602001908152602001600020600201600082825461301d91906142bc565b90915550505b61306b858263ffffffff168151811061303e5761303e6145ac565b6020026020010151848363ffffffff168151811061305e5761305e6145ac565b60200260200101516136a2565b806130758161484b565b915050612cb9565b505050505050565b6000818152600a602052604090819020805460019091015460045460055493516001600160a01b0393841694859463e6eb8ade9416926130d392909190602401918252602082015260400190565b60408051601f198184030181529181526020820180516001600160e01b031663124e93e160e21b1790525160e084901b6001600160e01b031916815261311d92919060040161486f565b600060405180830381600087803b15801561313757600080fd5b505af115801561307d573d6000803e3d6000fd5b6000828152600a60205260409081902080546001909101549151637375c56f60e11b81526001600160a01b0391821692839263e6eb8ade926131959290911690869060040161486f565b600060405180830381600087803b1580156131af57600080fd5b505af11580156131c3573d6000803e3d6000fd5b50505050827f218987b934c2f6bc596136829fbf43a5fef4d6fafce41f3f6254d9a870c2deec8360405161177d9190613c1c565b600180546001600160a01b038381166001600160a01b0319831681179093556040519116919082907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e090600090a35050565b6040516370a0823160e01b81523060048201526000906001600160a01b038316906370a0823190602401602060405180830381865afa158015613290573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906132b49190614343565b6001600160a01b0383166000908152600960205260409020600201549091508111156119b4576001600160a01b03821660009081526009602052604090206002015461330090826142bc565b6001600160a01b0383166000908152600960205260408120600101805490919061332b90849061472b565b90915550506001600160a01b0391909116600090815260096020526040902060020155565b815160609015613381578160405160200161336b9190614893565b6040516020818303038152906040529050610c71565b8160405160200161336b91906148c7565b6060816133b65750506040805180820190915260018152600360fc1b602082015290565b8160005b81156133e057806133ca8161468c565b91506133d99050600a836142a8565b91506133ba565b6000816001600160401b038111156133fa576133fa613c9c565b6040519080825280601f01601f191660200182016040528015613424576020820181803683370190505b509050815b85156134b15761343a6001826142bc565b90506000613449600a886142a8565b61345490600a614273565b61345e90886142bc565b6134699060306148ec565b905060008160f81b905080848481518110613486576134866145ac565b60200101906001600160f81b031916908160001a9053506134a8600a896142a8565b97505050613429565b50949350505050565b60606134c9608083901c613775565b6134d283613775565b6040805160208101939093528201526060015b6040516020818303038152906040529050919050565b60606135136001600160801b03602084901c16613775565b61352e8360601b6bffffffffffffffffffffffff1916613775565b6040516020016134e59291909182526001600160c01b031916602082015260280190565b6003810154815460009161357291600160a81b900463ffffffff16613909565b90508082600301600082825461358891906142bc565b90915550613596905061145c565b825463ffffffff91909116600160a81b0263ffffffff60a81b199091161790915550565b600061360f826040518060400160405280602081526020017f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c6564815250856001600160a01b031661395e9092919063ffffffff16565b8051909150156110a7578080602001905181019061362d9190614240565b6110a75760405162461bcd60e51b815260206004820152602a60248201527f5361666545524332303a204552433230206f7065726174696f6e20646964206e6044820152691bdd081cdd58d8d9595960b21b60648201526084016109c6565b600082613699858461396d565b14949350505050565b6000670de0b6b3a7640000601254836136bb9190614273565b6136c591906142a8565b905060006136d382846142bc565b9050801561373c576001600160a01b0384166000908152600960205260408120600301805483929061370690849061435c565b90915550506001600160a01b038416600090815260096020526040812060010180548392906137369084906146ea565b90915550505b8115612978576001600160a01b0384166000908152601060205260408120805484929061376a90849061435c565b909155505050505050565b6000808260001c9050806001600160801b0316905080600160401b02811777ffffffffffffffff0000000000000000ffffffffffffffff169050806401000000000281177bffffffff00000000ffffffff00000000ffffffff00000000ffffffff16905080620100000281177dffff0000ffff0000ffff0000ffff0000ffff0000ffff0000ffff0000ffff169050806101000281177eff00ff00ff00ff00ff00ff00ff00ff00ff00ff00ff00ff00ff00ff00ff00ff1690508060100281177f0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f16905060006008827f0808080808080808080808080808080808080808080808080808080808080808168161388b5761388b614292565b0460047f040404040404040404040404040404040404040404040404040404040404040484160460027f020202020202020202020202020202020202020202020202020202020202020285160417166027029091017f3030303030303030303030303030303030303030303030303030303030303030019392505050565b6000808261391561145c565b61391f91906142bc565b90506000670de0b6b3a764000082600f548761393b9190614273565b6139459190614273565b61394f91906142a8565b9050848110612c345784612819565b6060612c348484600085613a19565b600081815b8451811015613a1157600085828151811061398f5761398f6145ac565b602002602001015190508083116139d15760408051602081018590529081018290526060016040516020818303038152906040528051906020012092506139fe565b60408051602081018390529081018490526060016040516020818303038152906040528051906020012092505b5080613a098161468c565b915050613972565b509392505050565b606082471015613a7a5760405162461bcd60e51b815260206004820152602660248201527f416464726573733a20696e73756666696369656e742062616c616e636520666f6044820152651c8818d85b1b60d21b60648201526084016109c6565b843b613ac85760405162461bcd60e51b815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e747261637400000060448201526064016109c6565b600080866001600160a01b03168587604051613ae49190614911565b60006040518083038185875af1925050503d8060008114613b21576040519150601f19603f3d011682016040523d82523d6000602084013e613b26565b606091505b509150915061268d82828660608315613b405750816126ed565b825115613b505782518084602001fd5b8160405162461bcd60e51b81526004016109c69190613c1c565b6001600160a01b038116811461158757600080fd5b60008060408385031215613b9257600080fd5b8235613b9d81613b6a565b946020939093013593505050565b600060208284031215613bbd57600080fd5b5035919050565b60005b83811015613bdf578181015183820152602001613bc7565b838111156129785750506000910152565b60008151808452613c08816020860160208601613bc4565b601f01601f19169290920160200192915050565b6020815260006126ed6020830184613bf0565b600060208284031215613c4157600080fd5b81356126ed81613b6a565b801515811461158757600080fd5b600080600060608486031215613c6f57600080fd5b8335613c7a81613b6a565b9250602084013591506040840135613c9181613c4c565b809150509250925092565b634e487b7160e01b600052604160045260246000fd5b60405160c081016001600160401b0381118282101715613cd457613cd4613c9c565b60405290565b604051601f8201601f191681016001600160401b0381118282101715613d0257613d02613c9c565b604052919050565b60006001600160401b03821115613d2357613d23613c9c565b5060051b60200190565b600082601f830112613d3e57600080fd5b81356020613d53613d4e83613d0a565b613cda565b82815260059290921b84018101918181019086841115613d7257600080fd5b8286015b84811015613d8d5780358352918301918301613d76565b509695505050505050565b803560ff81168114611fdb57600080fd5b600082601f830112613dba57600080fd5b81356020613dca613d4e83613d0a565b82815260059290921b84018101918181019086841115613de957600080fd5b8286015b84811015613d8d578035613e0081613b6a565b8352918301918301613ded565b60008060408385031215613e2057600080fd5b82356001600160401b0380821115613e3757600080fd5b9084019060c08287031215613e4b57600080fd5b613e53613cb2565b82358152602083013582811115613e6957600080fd5b613e7588828601613d2d565b602083015250604083013582811115613e8d57600080fd5b613e9988828601613d2d565b604083015250606083013582811115613eb157600080fd5b613ebd88828601613d2d565b606083015250613ecf60808401613d98565b608082015260a083013582811115613ee657600080fd5b613ef288828601613da9565b60a08301525093506020850135915080821115613f0e57600080fd5b50613f1b85828601613d2d565b9150509250929050565b60008060008060808587031215613f3b57600080fd5b84359350602085013592506040850135613f5481613b6a565b91506060850135613f6481613b6a565b939692955090935050565b600060208284031215613f8157600080fd5b81356001600160401b03811681146126ed57600080fd5b600080600080600060a08688031215613fb057600080fd5b85356001600160401b03811115613fc657600080fd5b613fd288828901613d2d565b955050613fe160208701613d98565b94979496505050506040830135926060810135926080909101359150565b6000806020838503121561401257600080fd5b82356001600160401b038082111561402957600080fd5b818501915085601f83011261403d57600080fd5b81358181111561404c57600080fd5b8660208260051b850101111561406157600080fd5b60209290920196919550909350505050565b6000602080830181845280855180835260408601915060408160051b870101925083870160005b828110156140c857603f198886030184526140b6858351613bf0565b9450928501929085019060010161409a565b5092979650505050505050565b60006001600160401b038211156140ee576140ee613c9c565b50601f01601f191660200190565b6000806040838503121561410f57600080fd5b8235915060208301356001600160401b0381111561412c57600080fd5b8301601f8101851361413d57600080fd5b803561414b613d4e826140d5565b81815286602083850101111561416057600080fd5b816020840160208301376000602083830101528093505050509250929050565b60008060006060848603121561419557600080fd5b8335925060208401356141a781613b6a565b91506040840135613c9181613b6a565b6020808252818101527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604082015260600190565b6020808252601c908201527f70726f706f73616c2068617320756e636c61696d6564206c6561667300000000604082015260600190565b60006020828403121561423557600080fd5b81516126ed81613b6a565b60006020828403121561425257600080fd5b81516126ed81613c4c565b634e487b7160e01b600052601160045260246000fd5b600081600019048311821515161561428d5761428d61425d565b500290565b634e487b7160e01b600052601260045260246000fd5b6000826142b7576142b7614292565b500490565b6000828210156142ce576142ce61425d565b500390565b60006101208b835263ffffffff8b1660208401528060408401526142f98184018b613bf0565b6001600160a01b03998a1660608501526080840198909852505060a08101949094526001600160401b039290921660c084015290931660e082015261010001919091529392505050565b60006020828403121561435557600080fd5b5051919050565b6000821982111561436f5761436f61425d565b500190565b600061020088835263ffffffff8816602084015280604084015261439a81840188613bf0565b9150506143b36060830186516001600160a01b03169052565b60208501516001600160a01b03811660808401525060408501516001600160a01b03811660a084015250606085015180151560c084015250608085015160e083015260a0850151610100818185015260c08701519150610120828186015260e0880151925061014083818701528289015161016087015281890151610180870152808901516101a0870152505050506144586101c08301856001600160a01b03169052565b6001600160a01b0383166101e0830152979650505050505050565b828152604060208201526000612c346040830184613bf0565b60006001600160401b038216806144a5576144a561425d565b6000190192915050565b600081518084526020808501945080840160005b838110156144e85781516001600160a01b0316875295820195908201906001016144c3565b509495945050505050565b600081518084526020808501945080840160005b838110156144e857815187529582019590820190600101614507565b60808152600061453660808301876144af565b828103602084015261454881876144f3565b9050828103604084015261455c81866144f3565b9050828103606084015261268d81856144f3565b6001600160401b038516815260ff8416602082015260806040820152600061459b60808301856144f3565b905082606083015295945050505050565b634e487b7160e01b600052603260045260246000fd5b6000808335601e198436030181126145d957600080fd5b8301803591506001600160401b038211156145f357600080fd5b60200191503681900382131561460857600080fd5b9250929050565b8183823760009101908152919050565b60006020828403121561463157600080fd5b81516001600160401b0381111561464757600080fd5b8201601f8101841361465857600080fd5b8051614666613d4e826140d5565b81815285602083850101111561467b57600080fd5b612819826020830160208601613bc4565b60006000198214156146a0576146a061425d565b5060010190565b600084516146b9818460208901613bc4565b8451908301906146cd818360208901613bc4565b84519101906146e0818360208801613bc4565b0195945050505050565b600080821280156001600160ff1b038490038513161561470c5761470c61425d565b600160ff1b83900384128116156147255761472561425d565b50500190565b60008083128015600160ff1b8501841216156147495761474961425d565b6001600160ff1b03840183138116156147645761476461425d565b50500390565b60006020828403121561477c57600080fd5b604051602081018181106001600160401b038211171561479e5761479e613c9c565b6040529151825250919050565b60208152815160208201526000602083015160c060408401526147d160e08401826144f3565b90506040840151601f19808584030160608601526147ef83836144f3565b9250606086015191508085840301608086015261480c83836144f3565b925060ff60808701511660a086015260a08601519150808584030160c08601525061281982826144af565b60008261484657614846614292565b500690565b600063ffffffff808316818114156148655761486561425d565b6001019392505050565b6001600160a01b0383168152604060208201819052600090612c3490830184613bf0565b600b60fa1b8152600082516148af816001850160208701613bc4565b601d60f91b6001939091019283015250600201919050565b600082516148d9818460208701613bc4565b601d60f91b920191825250600101919050565b600060ff821660ff84168060ff038211156149095761490961425d565b019392505050565b60008251614923818460208701613bc4565b919091019291505056fea264697066735822122072032f81f08788bd28728ee8debb4d15a1230240734cab3d664d84adc11077b564736f6c634300080b0033", + "solcInputHash": "2fe6c4b637a440a1380be3adbf7d9e12", + "metadata": "{\"compiler\":{\"version\":\"0.8.13+commit.abaa5c0e\"},\"language\":\"Solidity\",\"output\":{\"abi\":[{\"inputs\":[{\"internalType\":\"contract LpTokenFactoryInterface\",\"name\":\"_lpTokenFactory\",\"type\":\"address\"},{\"internalType\":\"contract FinderInterface\",\"name\":\"_finder\",\"type\":\"address\"},{\"internalType\":\"contract WETH9\",\"name\":\"_weth\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"_timer\",\"type\":\"address\"}],\"stateMutability\":\"nonpayable\",\"type\":\"constructor\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"newBondToken\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"newBondAmount\",\"type\":\"uint256\"}],\"name\":\"BondSet\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"l2ChainId\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"address\",\"name\":\"adapter\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"address\",\"name\":\"spokePool\",\"type\":\"address\"}],\"name\":\"CrossChainContractsSet\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"bytes32\",\"name\":\"poolRebalanceRoot\",\"type\":\"bytes32\"},{\"indexed\":true,\"internalType\":\"bytes32\",\"name\":\"relayerRefundRoot\",\"type\":\"bytes32\"},{\"indexed\":false,\"internalType\":\"bytes32\",\"name\":\"slowRelayRoot\",\"type\":\"bytes32\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"proposer\",\"type\":\"address\"}],\"name\":\"EmergencyRootBundleDeleted\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"bytes32\",\"name\":\"newIdentifier\",\"type\":\"bytes32\"}],\"name\":\"IdentifierSet\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"address\",\"name\":\"l1Token\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"address\",\"name\":\"lpToken\",\"type\":\"address\"}],\"name\":\"L1TokenEnabledForLiquidityProvision\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"address\",\"name\":\"l1Token\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"address\",\"name\":\"lpToken\",\"type\":\"address\"}],\"name\":\"L2TokenDisabledForLiquidityProvision\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"l1Token\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"lpTokensMinted\",\"type\":\"uint256\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"liquidityProvider\",\"type\":\"address\"}],\"name\":\"LiquidityAdded\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"l1Token\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"lpTokensBurnt\",\"type\":\"uint256\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"liquidityProvider\",\"type\":\"address\"}],\"name\":\"LiquidityRemoved\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"newLiveness\",\"type\":\"uint256\"}],\"name\":\"LivenessSet\",\"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\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"bool\",\"name\":\"isPaused\",\"type\":\"bool\"}],\"name\":\"Paused\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"uint32\",\"name\":\"requestExpirationTimestamp\",\"type\":\"uint32\"},{\"indexed\":false,\"internalType\":\"uint64\",\"name\":\"unclaimedPoolRebalanceLeafCount\",\"type\":\"uint64\"},{\"indexed\":false,\"internalType\":\"uint256[]\",\"name\":\"bundleEvaluationBlockNumbers\",\"type\":\"uint256[]\"},{\"indexed\":true,\"internalType\":\"bytes32\",\"name\":\"poolRebalanceRoot\",\"type\":\"bytes32\"},{\"indexed\":true,\"internalType\":\"bytes32\",\"name\":\"relayerRefundRoot\",\"type\":\"bytes32\"},{\"indexed\":false,\"internalType\":\"bytes32\",\"name\":\"slowRelayRoot\",\"type\":\"bytes32\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"proposer\",\"type\":\"address\"}],\"name\":\"ProposeRootBundle\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"newProtocolFeeCaptureAddress\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"uint256\",\"name\":\"newProtocolFeeCapturePct\",\"type\":\"uint256\"}],\"name\":\"ProtocolFeeCaptureSet\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"l1Token\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"uint256\",\"name\":\"accumulatedFees\",\"type\":\"uint256\"}],\"name\":\"ProtocolFeesCapturedClaimed\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"disputer\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"requestTime\",\"type\":\"uint256\"}],\"name\":\"RootBundleCanceled\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"disputer\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"requestTime\",\"type\":\"uint256\"}],\"name\":\"RootBundleDisputed\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"groupIndex\",\"type\":\"uint256\"},{\"indexed\":true,\"internalType\":\"uint256\",\"name\":\"leafId\",\"type\":\"uint256\"},{\"indexed\":true,\"internalType\":\"uint256\",\"name\":\"chainId\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"address[]\",\"name\":\"l1Token\",\"type\":\"address[]\"},{\"indexed\":false,\"internalType\":\"uint256[]\",\"name\":\"bundleLpFees\",\"type\":\"uint256[]\"},{\"indexed\":false,\"internalType\":\"int256[]\",\"name\":\"netSendAmount\",\"type\":\"int256[]\"},{\"indexed\":false,\"internalType\":\"int256[]\",\"name\":\"runningBalance\",\"type\":\"int256[]\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"caller\",\"type\":\"address\"}],\"name\":\"RootBundleExecuted\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"uint256\",\"name\":\"originChainId\",\"type\":\"uint256\"},{\"indexed\":true,\"internalType\":\"uint256\",\"name\":\"destinationChainId\",\"type\":\"uint256\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"originToken\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"bool\",\"name\":\"depositsEnabled\",\"type\":\"bool\"}],\"name\":\"SetEnableDepositRoute\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"uint256\",\"name\":\"destinationChainId\",\"type\":\"uint256\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"l1Token\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"destinationToken\",\"type\":\"address\"}],\"name\":\"SetPoolRebalanceRoute\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"uint256\",\"name\":\"chainId\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"bytes\",\"name\":\"message\",\"type\":\"bytes\"}],\"name\":\"SpokePoolAdminFunctionTriggered\",\"type\":\"event\"},{\"stateMutability\":\"payable\",\"type\":\"fallback\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"l1Token\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"l1TokenAmount\",\"type\":\"uint256\"}],\"name\":\"addLiquidity\",\"outputs\":[],\"stateMutability\":\"payable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"bondAmount\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"bondToken\",\"outputs\":[{\"internalType\":\"contract IERC20\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"l1Token\",\"type\":\"address\"}],\"name\":\"claimProtocolFeesCaptured\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"name\":\"crossChainContracts\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"adapter\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"spokePool\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"l1Token\",\"type\":\"address\"}],\"name\":\"disableL1TokenForLiquidityProvision\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"disputeRootBundle\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"emergencyDeleteProposal\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"l1Token\",\"type\":\"address\"}],\"name\":\"enableL1TokenForLiquidityProvision\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"l1Token\",\"type\":\"address\"}],\"name\":\"exchangeRateCurrent\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"chainId\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"groupIndex\",\"type\":\"uint256\"},{\"internalType\":\"uint256[]\",\"name\":\"bundleLpFees\",\"type\":\"uint256[]\"},{\"internalType\":\"int256[]\",\"name\":\"netSendAmounts\",\"type\":\"int256[]\"},{\"internalType\":\"int256[]\",\"name\":\"runningBalances\",\"type\":\"int256[]\"},{\"internalType\":\"uint8\",\"name\":\"leafId\",\"type\":\"uint8\"},{\"internalType\":\"address[]\",\"name\":\"l1Tokens\",\"type\":\"address[]\"},{\"internalType\":\"bytes32[]\",\"name\":\"proof\",\"type\":\"bytes32[]\"}],\"name\":\"executeRootBundle\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"finder\",\"outputs\":[{\"internalType\":\"contract FinderInterface\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"getCurrentTime\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"identifier\",\"outputs\":[{\"internalType\":\"bytes32\",\"name\":\"\",\"type\":\"bytes32\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"l1Token\",\"type\":\"address\"}],\"name\":\"liquidityUtilizationCurrent\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"l1Token\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"relayedAmount\",\"type\":\"uint256\"}],\"name\":\"liquidityUtilizationPostRelay\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"liveness\",\"outputs\":[{\"internalType\":\"uint32\",\"name\":\"\",\"type\":\"uint32\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"loadEthForL2Calls\",\"outputs\":[],\"stateMutability\":\"payable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"lpFeeRatePerSecond\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"lpTokenFactory\",\"outputs\":[{\"internalType\":\"contract LpTokenFactoryInterface\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes[]\",\"name\":\"data\",\"type\":\"bytes[]\"}],\"name\":\"multicall\",\"outputs\":[{\"internalType\":\"bytes[]\",\"name\":\"results\",\"type\":\"bytes[]\"}],\"stateMutability\":\"payable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"owner\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"paused\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"destinationChainId\",\"type\":\"uint256\"},{\"internalType\":\"address\",\"name\":\"l1Token\",\"type\":\"address\"}],\"name\":\"poolRebalanceRoute\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"destinationToken\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"name\":\"pooledTokens\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"lpToken\",\"type\":\"address\"},{\"internalType\":\"bool\",\"name\":\"isEnabled\",\"type\":\"bool\"},{\"internalType\":\"uint32\",\"name\":\"lastLpFeeUpdate\",\"type\":\"uint32\"},{\"internalType\":\"int256\",\"name\":\"utilizedReserves\",\"type\":\"int256\"},{\"internalType\":\"uint256\",\"name\":\"liquidReserves\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"undistributedLpFees\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256[]\",\"name\":\"bundleEvaluationBlockNumbers\",\"type\":\"uint256[]\"},{\"internalType\":\"uint8\",\"name\":\"poolRebalanceLeafCount\",\"type\":\"uint8\"},{\"internalType\":\"bytes32\",\"name\":\"poolRebalanceRoot\",\"type\":\"bytes32\"},{\"internalType\":\"bytes32\",\"name\":\"relayerRefundRoot\",\"type\":\"bytes32\"},{\"internalType\":\"bytes32\",\"name\":\"slowRelayRoot\",\"type\":\"bytes32\"}],\"name\":\"proposeRootBundle\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"protocolFeeCaptureAddress\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"protocolFeeCapturePct\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"chainId\",\"type\":\"uint256\"},{\"internalType\":\"bytes\",\"name\":\"functionData\",\"type\":\"bytes\"}],\"name\":\"relaySpokePoolAdminFunction\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"l1Token\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"lpTokenAmount\",\"type\":\"uint256\"},{\"internalType\":\"bool\",\"name\":\"sendEth\",\"type\":\"bool\"}],\"name\":\"removeLiquidity\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"renounceOwnership\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"rootBundleProposal\",\"outputs\":[{\"internalType\":\"bytes32\",\"name\":\"poolRebalanceRoot\",\"type\":\"bytes32\"},{\"internalType\":\"bytes32\",\"name\":\"relayerRefundRoot\",\"type\":\"bytes32\"},{\"internalType\":\"bytes32\",\"name\":\"slowRelayRoot\",\"type\":\"bytes32\"},{\"internalType\":\"uint256\",\"name\":\"claimedBitMap\",\"type\":\"uint256\"},{\"internalType\":\"address\",\"name\":\"proposer\",\"type\":\"address\"},{\"internalType\":\"uint8\",\"name\":\"unclaimedPoolRebalanceLeafCount\",\"type\":\"uint8\"},{\"internalType\":\"uint32\",\"name\":\"requestExpirationTimestamp\",\"type\":\"uint32\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"contract IERC20\",\"name\":\"newBondToken\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"newBondAmount\",\"type\":\"uint256\"}],\"name\":\"setBond\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"l2ChainId\",\"type\":\"uint256\"},{\"internalType\":\"address\",\"name\":\"adapter\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"spokePool\",\"type\":\"address\"}],\"name\":\"setCrossChainContracts\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"time\",\"type\":\"uint256\"}],\"name\":\"setCurrentTime\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"originChainId\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"destinationChainId\",\"type\":\"uint256\"},{\"internalType\":\"address\",\"name\":\"originToken\",\"type\":\"address\"},{\"internalType\":\"bool\",\"name\":\"depositsEnabled\",\"type\":\"bool\"}],\"name\":\"setDepositRoute\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"newIdentifier\",\"type\":\"bytes32\"}],\"name\":\"setIdentifier\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint32\",\"name\":\"newLiveness\",\"type\":\"uint32\"}],\"name\":\"setLiveness\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bool\",\"name\":\"pause\",\"type\":\"bool\"}],\"name\":\"setPaused\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"destinationChainId\",\"type\":\"uint256\"},{\"internalType\":\"address\",\"name\":\"l1Token\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"destinationToken\",\"type\":\"address\"}],\"name\":\"setPoolRebalanceRoute\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"newProtocolFeeCaptureAddress\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"newProtocolFeeCapturePct\",\"type\":\"uint256\"}],\"name\":\"setProtocolFeeCapture\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"l1Token\",\"type\":\"address\"}],\"name\":\"sync\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"timerAddress\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"newOwner\",\"type\":\"address\"}],\"name\":\"transferOwnership\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"name\":\"unclaimedAccumulatedProtocolFees\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"weth\",\"outputs\":[{\"internalType\":\"contract WETH9\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"stateMutability\":\"payable\",\"type\":\"receive\"}],\"devdoc\":{\"details\":\"This contract should be deprecated by the year 2106, at which point uint32 timestamps will roll over. This is an issue for this contract because fee calculations will become bizarre when multiplying by negative time deltas. Before this date, this contract should be paused from accepting new root bundles and all LP tokens should be disabled by the admin.\",\"kind\":\"dev\",\"methods\":{\"addLiquidity(address,uint256)\":{\"params\":{\"l1Token\":\"Token to deposit into this contract.\",\"l1TokenAmount\":\"Amount of liquidity to provide.\"}},\"claimProtocolFeesCaptured(address)\":{\"params\":{\"l1Token\":\"Token whose protocol fees the caller wants to disburse.\"}},\"constructor\":{\"params\":{\"_finder\":\"Finder address.\",\"_lpTokenFactory\":\"LP Token factory address used to deploy LP tokens for new collateral types.\",\"_timer\":\"Timer address.\",\"_weth\":\"WETH address.\"}},\"disableL1TokenForLiquidityProvision(address)\":{\"params\":{\"l1Token\":\"Token to disable liquidity provision for.\"}},\"emergencyDeleteProposal()\":{\"details\":\"This is primarily intended to rectify situations where an unexecutable bundle gets through liveness in the case of a non-malicious bug in the proposal/dispute code. Without this function, the contract would be indefinitely blocked, migration would be required, and in-progress transfers would never be repaid.\"},\"enableL1TokenForLiquidityProvision(address)\":{\"params\":{\"l1Token\":\"Token to provide liquidity for.\"}},\"exchangeRateCurrent(address)\":{\"params\":{\"l1Token\":\"L1 token redeemable by burning LP token.\"},\"returns\":{\"_0\":\"Amount of L1 tokens redeemable for 1 unit LP token.\"}},\"executeRootBundle(uint256,uint256,uint256[],int256[],int256[],uint8,address[],bytes32[])\":{\"details\":\"In some cases, will instruct spokePool to send funds back to L1.\",\"params\":{\"bundleLpFees\":\"Array representing the total LP fee amount per token in this bundle for all bundled relays.\",\"chainId\":\"ChainId number of the target spoke pool on which the bundle is executed.\",\"groupIndex\":\"If set to 0, then relay roots to SpokePool via cross chain bridge. Used by off-chain validator to organize leaves with the same chain ID and also set which leaves should result in relayed messages.\",\"l1Tokens\":\"Array of all the tokens associated with the bundleLpFees, nedSendAmounts and runningBalances.\",\"leafId\":\"Index of this executed leaf within the poolRebalance tree.\",\"netSendAmounts\":\"Array representing the amount of tokens to send to the SpokePool on the target chainId.\",\"proof\":\"Inclusion proof for this leaf in pool rebalance root in root bundle.\",\"runningBalances\":\"Array used to track any unsent tokens that are not included in the netSendAmounts.\"}},\"getCurrentTime()\":{\"returns\":{\"_0\":\"uint for the current Testable timestamp.\"}},\"liquidityUtilizationCurrent(address)\":{\"params\":{\"l1Token\":\"L1 token to query utilization for.\"},\"returns\":{\"_0\":\"% of liquid reserves currently being \\\"used\\\" and sitting in SpokePools.\"}},\"liquidityUtilizationPostRelay(address,uint256)\":{\"params\":{\"l1Token\":\"L1 token to query utilization for.\",\"relayedAmount\":\"The higher this amount, the higher the utilization.\"},\"returns\":{\"_0\":\"% of liquid reserves currently being \\\"used\\\" and sitting in SpokePools plus the relayedAmount.\"}},\"loadEthForL2Calls()\":{\"details\":\"This function cannot be included in a multicall transaction call because it is payable. A realistic situation where this might be an issue is if the caller is executing a PoolRebalanceLeaf that needs to relay messages to Arbitrum. Relaying messages to Arbitrum requires that this contract has an ETH balance, so in this case the caller would need to pre-load this contract with ETH before multicall-executing the leaf.\"},\"owner()\":{\"details\":\"Returns the address of the current owner.\"},\"poolRebalanceRoute(uint256,address)\":{\"params\":{\"destinationChainId\":\"Where destination token is deployed.\",\"l1Token\":\"Ethereum version token.\"},\"returns\":{\"destinationToken\":\"address The destination token that is sent to spoke pools after this contract bridges the l1Token to the destination chain.\"}},\"proposeRootBundle(uint256[],uint8,bytes32,bytes32,bytes32)\":{\"params\":{\"bundleEvaluationBlockNumbers\":\"should contain the latest block number for all chains, even if there are no relays contained on some of them. The usage of this variable should be defined in an off chain UMIP.\",\"poolRebalanceLeafCount\":\"Number of leaves contained in pool rebalance root. Max is # of whitelisted chains.\",\"poolRebalanceRoot\":\"Pool rebalance root containing leaves that sends tokens from this contract to SpokePool.\",\"relayerRefundRoot\":\"Relayer refund root to publish to SpokePool where a data worker can execute leaves to refund relayers on their chosen refund chainId.\",\"slowRelayRoot\":\"Slow relay root to publish to Spoke Pool where a data worker can execute leaves to fulfill slow relays.\"}},\"relaySpokePoolAdminFunction(uint256,bytes)\":{\"details\":\"This function has permission to call onlyAdmin functions on the SpokePool, so it's imperative that this contract only allows the owner to call this method directly or indirectly.\",\"params\":{\"chainId\":\"Chain with SpokePool to send message to.\",\"functionData\":\"ABI encoded function call to send to SpokePool, but can be any arbitrary data technically.\"}},\"removeLiquidity(address,uint256,bool)\":{\"params\":{\"l1Token\":\"Token to redeem LP share for.\",\"lpTokenAmount\":\"Amount of LP tokens to burn. Exchange rate between L1 token and LP token can be queried via public exchangeRateCurrent method.\",\"sendEth\":\"Set to True if L1 token is WETH and user wants to receive ETH. Note that if caller is a contract, then the contract should have a way to receive ETH if this value is set to True. Similarly, if this value is set to False, then the calling contract should have a way to handle WETH.\"}},\"renounceOwnership()\":{\"details\":\"Leaves the contract without owner. It will not be possible to call `onlyOwner` functions anymore. Can only be called by the current owner. NOTE: Renouncing ownership will leave the contract without an owner, thereby removing any functionality that is only available to the owner.\"},\"setBond(address,uint256)\":{\"params\":{\"newBondAmount\":\"New bond amount.\",\"newBondToken\":\"New bond currency.\"}},\"setCrossChainContracts(uint256,address,address)\":{\"details\":\"We do not block setting the adapter or SpokePool to invalid/zero addresses because we want to allow the admin to block relaying roots to the spoke pool for emergency recovery purposes.\",\"params\":{\"adapter\":\"Adapter used to relay messages and tokens to spoke pool. Deployed on current chain.\",\"l2ChainId\":\"Chain to set contracts for.\",\"spokePool\":\"Recipient of relayed messages and tokens on spoke pool. Deployed on l2ChainId.\"}},\"setCurrentTime(uint256)\":{\"details\":\"Will revert if not running in test mode.\",\"params\":{\"time\":\"timestamp to set current Testable time to.\"}},\"setDepositRoute(uint256,uint256,address,bool)\":{\"details\":\"Admin is responsible for ensuring that `originToken` is linked to some L1 token on this contract, via poolRebalanceRoutes(), and that this L1 token also has a counterpart on the destination chain. If either condition fails, then the deposit will be unrelayable by off-chain relayers because they will not know which token to relay to recipients on the destination chain, and data workers wouldn't know which L1 token to send to the destination chain to refund the relayer.\",\"params\":{\"depositsEnabled\":\"Set to true to whitelist this route for deposits, set to false if caller just wants to map the origin token + destination ID to the destination token address on the origin chain's SpokePool.\",\"destinationChainId\":\"Chain where token depositor wants to receive funds.\",\"originChainId\":\"Chain where token deposit occurs.\",\"originToken\":\"Token sent in deposit.\"}},\"setIdentifier(bytes32)\":{\"params\":{\"newIdentifier\":\"New identifier.\"}},\"setLiveness(uint32)\":{\"params\":{\"newLiveness\":\"New liveness period.\"}},\"setPaused(bool)\":{\"params\":{\"pause\":\"true if the call is meant to pause the system, false if the call is meant to unpause it.\"}},\"setPoolRebalanceRoute(uint256,address,address)\":{\"details\":\"Admin can set destinationToken to 0x0 to effectively disable executing any root bundles with leaves containing this l1 token + destination chain ID combination.\",\"params\":{\"destinationChainId\":\"Destination chain where destination token resides.\",\"destinationToken\":\"Destination chain counterpart of L1 token.\",\"l1Token\":\"Token enabled for liquidity in this pool, and the L1 counterpart to the destination token on the destination chain ID.\"}},\"setProtocolFeeCapture(address,uint256)\":{\"params\":{\"newProtocolFeeCaptureAddress\":\"New protocol fee capture address.\",\"newProtocolFeeCapturePct\":\"New protocol fee capture %.\"}},\"transferOwnership(address)\":{\"details\":\"Transfers ownership of the contract to a new account (`newOwner`). Can only be called by the current owner.\"}},\"version\":1},\"userdoc\":{\"kind\":\"user\",\"methods\":{\"addLiquidity(address,uint256)\":{\"notice\":\"Deposit liquidity into this contract to earn LP fees in exchange for funding relays on SpokePools. Caller is essentially loaning their funds to be sent from this contract to the SpokePool, where it will be used to repay a relayer, and ultimately receives their loan back after the tokens are bridged back to this contract via the canonical token bridge. Then, the caller's loans are used again. This loan cycle repeats continuously and the caller, or \\\"liquidity provider\\\" earns a continuous fee for their credit that they are extending relayers.Caller will receive an LP token representing their share of this pool. The LP token's redemption value increments from the time that they enter the pool to reflect their accrued fees.The caller of this function must approve this contract to spend l1TokenAmount of l1Token.\"},\"claimProtocolFeesCaptured(address)\":{\"notice\":\"Send unclaimed accumulated protocol fees to fee capture address.\"},\"constructor\":{\"notice\":\"Construct HubPool.\"},\"disableL1TokenForLiquidityProvision(address)\":{\"notice\":\"Disables LPs from providing liquidity for L1 token. Callable only by owner.\"},\"disputeRootBundle()\":{\"notice\":\"Caller stakes a bond to dispute the current root bundle proposal assuming it has not passed liveness yet. The proposal is deleted, allowing a follow-up proposal to be submitted, and the dispute is sent to the optimistic oracle to be adjudicated. Can only be called within the liveness period of the current proposal.The caller of this function must approve this contract to spend bondAmount of l1Token.\"},\"emergencyDeleteProposal()\":{\"notice\":\"This allows for the deletion of the active proposal in case of emergency.\"},\"enableL1TokenForLiquidityProvision(address)\":{\"notice\":\"Enables LPs to provide liquidity for L1 token. Deploys new LP token for L1 token if appropriate. Callable only by owner.\"},\"exchangeRateCurrent(address)\":{\"notice\":\"Returns exchange rate of L1 token to LP token.\"},\"executeRootBundle(uint256,uint256,uint256[],int256[],int256[],uint8,address[],bytes32[])\":{\"notice\":\"Executes a pool rebalance leaf as part of the currently published root bundle. Will bridge any tokens from this contract to the SpokePool designated in the leaf, and will also publish relayer refund and slow relay roots to the SpokePool on the network specified in the leaf.Deletes the published root bundle if this is the last leaf to be executed in the root bundle.\"},\"getCurrentTime()\":{\"notice\":\"Gets the current time. Will return the last time set in `setCurrentTime` if running in test mode. Otherwise, it will return the block timestamp.\"},\"liquidityUtilizationCurrent(address)\":{\"notice\":\"Returns % of liquid reserves currently being \\\"used\\\" and sitting in SpokePools.\"},\"liquidityUtilizationPostRelay(address,uint256)\":{\"notice\":\"Returns % of liquid reserves currently being \\\"used\\\" and sitting in SpokePools and accounting for relayedAmount of tokens to be withdrawn from the pool.\"},\"loadEthForL2Calls()\":{\"notice\":\"This function allows a caller to load the contract with raw ETH to perform L2 calls. This is needed for Arbitrum calls, but may also be needed for others.\"},\"poolRebalanceRoute(uint256,address)\":{\"notice\":\"Conveniently queries which destination token is mapped to the hash of an l1 token + destination chain ID.\"},\"proposeRootBundle(uint256[],uint8,bytes32,bytes32,bytes32)\":{\"notice\":\"Publish a new root bundle along with all of the block numbers that the merkle roots are relevant for. This is used to aid off-chain validators in evaluating the correctness of this bundle. Caller stakes a bond that can be slashed if the root bundle proposal is invalid, and they will receive it back if accepted.After proposeRootBundle is called, if the any props are wrong then this proposal can be challenged. Once the challenge period passes, then the roots are no longer disputable, and only executeRootBundle can be called; moreover, this method can't be called again until all leaves are executed.The caller of this function must approve this contract to spend bondAmount of bondToken.\"},\"relaySpokePoolAdminFunction(uint256,bytes)\":{\"notice\":\"Sends message to SpokePool from this contract. Callable only by owner.\"},\"removeLiquidity(address,uint256,bool)\":{\"notice\":\"Burns LP share to redeem for underlying l1Token original deposit amount plus fees.\"},\"setBond(address,uint256)\":{\"notice\":\"Sets bond token and amount. Callable only by owner.\"},\"setCrossChainContracts(uint256,address,address)\":{\"notice\":\"Sets cross chain relay helper contracts for L2 chain ID. Callable only by owner.\"},\"setCurrentTime(uint256)\":{\"notice\":\"Sets the current time.\"},\"setDepositRoute(uint256,uint256,address,bool)\":{\"notice\":\"Sends cross-chain message to SpokePool on originChainId to enable or disable deposit route from that SpokePool to another one. Callable only by owner.\"},\"setIdentifier(bytes32)\":{\"notice\":\"Sets identifier for root bundle disputes. Callable only by owner.\"},\"setLiveness(uint32)\":{\"notice\":\"Sets root bundle proposal liveness period. Callable only by owner.\"},\"setPaused(bool)\":{\"notice\":\"Pauses the bundle proposal and execution process. This is intended to be used during upgrades or when something goes awry.\"},\"setPoolRebalanceRoute(uint256,address,address)\":{\"notice\":\"Store canonical destination token counterpart for l1 token. Callable only by owner.\"},\"setProtocolFeeCapture(address,uint256)\":{\"notice\":\"Sets protocolFeeCaptureAddress and protocolFeeCapturePct. Callable only by owner.\"},\"sync(address)\":{\"notice\":\"Synchronize any balance changes in this contract with the utilized & liquid reserves. This should be done at the conclusion of a L2->L1 token transfer via the canonical token bridge, when this contract's reserves do not reflect its true balance due to new tokens being dropped onto the contract at the conclusion of a bridging action.\"}},\"notice\":\"Contract deployed on Ethereum that houses L1 token liquidity for all SpokePools. A dataworker can interact with merkle roots stored in this contract via inclusion proofs to instruct this contract to send tokens to L2 SpokePools via \\\"pool rebalances\\\" that can be used to pay out relayers on those networks. This contract is also responsible for publishing relayer refund and slow relay merkle roots to SpokePools.This contract is meant to act as the cross chain administrator and owner of all L2 spoke pools, so all governance actions and pool rebalances originate from here and bridge instructions to L2s.\",\"version\":1}},\"settings\":{\"compilationTarget\":{\"contracts/HubPool.sol\":\"HubPool\"},\"evmVersion\":\"london\",\"libraries\":{},\"metadata\":{\"bytecodeHash\":\"ipfs\"},\"optimizer\":{\"enabled\":true,\"runs\":200},\"remappings\":[]},\"sources\":{\"@openzeppelin/contracts/access/Ownable.sol\":{\"keccak256\":\"0x24e0364e503a9bbde94c715d26573a76f14cd2a202d45f96f52134ab806b67b9\",\"license\":\"MIT\",\"urls\":[\"bzz-raw://e12cbaa7378fd9b62280e4e1d164bedcb4399ce238f5f98fc0eefb7e50577981\",\"dweb:/ipfs/QmXRoFGUgfsaRkoPT5bxNMtSayKTQ8GZATLPXf69HcRA51\"]},\"@openzeppelin/contracts/token/ERC20/IERC20.sol\":{\"keccak256\":\"0xbbc8ac883ac3c0078ce5ad3e288fbb3ffcc8a30c3a98c0fda0114d64fc44fca2\",\"license\":\"MIT\",\"urls\":[\"bzz-raw://87a7a5d2f6f63f84598af02b8c50ca2df2631cb8ba2453e8d95fcb17e4be9824\",\"dweb:/ipfs/QmR76hqtAcRqoFj33tmNjcWTLrgNsAaakYwnKZ8zoJtKei\"]},\"@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol\":{\"keccak256\":\"0xc3d946432c0ddbb1f846a0d3985be71299df331b91d06732152117f62f0be2b5\",\"license\":\"MIT\",\"urls\":[\"bzz-raw://4632c341a06ba5c079b51ca5a915efab4e6ab57735b37839b3e8365ff806a43e\",\"dweb:/ipfs/QmTHT3xHYed2wajEoA5qu7ii2BxLpPhQZHwAhtLK5Z7ANK\"]},\"@openzeppelin/contracts/utils/Address.sol\":{\"keccak256\":\"0x2ccf9d2313a313d41a791505f2b5abfdc62191b5d4334f7f7a82691c088a1c87\",\"license\":\"MIT\",\"urls\":[\"bzz-raw://b3a57d0854b2fdce6ebff933a48dca2445643d1eccfc27f00292e937f26c6a58\",\"dweb:/ipfs/QmW45rZooS9TqR4YXUbjRbtf2Bpb5ouSarBvfW1LdGprvV\"]},\"@openzeppelin/contracts/utils/Context.sol\":{\"keccak256\":\"0xe2e337e6dde9ef6b680e07338c493ebea1b5fd09b43424112868e9cc1706bca7\",\"license\":\"MIT\",\"urls\":[\"bzz-raw://6df0ddf21ce9f58271bdfaa85cde98b200ef242a05a3f85c2bc10a8294800a92\",\"dweb:/ipfs/QmRK2Y5Yc6BK7tGKkgsgn3aJEQGi5aakeSPZvS65PV8Xp3\"]},\"@openzeppelin/contracts/utils/cryptography/MerkleProof.sol\":{\"keccak256\":\"0xea64fbaccbf9d8c235cf6838240ddcebb97f9fc383660289e9dff32e4fb85f7a\",\"license\":\"MIT\",\"urls\":[\"bzz-raw://1e8a1dd0eac2fa865dc9a052bee01eec31677d7bc01b5b5aa825d820f3f1b343\",\"dweb:/ipfs/QmR8WuNeoAvJhnL7msQfQwaZEkwVnNyNDUNBL3Y616ohYa\"]},\"@openzeppelin/contracts/utils/math/SafeMath.sol\":{\"keccak256\":\"0xa2f576be637946f767aa56601c26d717f48a0aff44f82e46f13807eea1009a21\",\"license\":\"MIT\",\"urls\":[\"bzz-raw://973868f808e88e21a1a0a01d4839314515ee337ad096286c88e41b74dcc11fc2\",\"dweb:/ipfs/QmfYuZxRfx2J2xdk4EXN7jKg4bUYEMTaYk9BAw9Bqn4o2Y\"]},\"@openzeppelin/contracts/utils/math/SignedSafeMath.sol\":{\"keccak256\":\"0x62f53f262fabbbc6d8ab49488d8fce36370351aff2b8d3898d499d68995a71c2\",\"license\":\"MIT\",\"urls\":[\"bzz-raw://efd599513c2f313a3f5e9536beb2b80a0d2b3dd34202c174a707d81b7dc751ce\",\"dweb:/ipfs/QmdDiENVFSyWjfFskNLnViMH77DHg3oDthkSZk7dMzNNKB\"]},\"@uma/core/contracts/common/implementation/AncillaryData.sol\":{\"keccak256\":\"0x8ff33ac32d3e6de25de9e0ac2c0ff9a621f187fa97e9ee84092b327471baa3ce\",\"license\":\"AGPL-3.0-only\",\"urls\":[\"bzz-raw://0bbaed49756e8cf7ef405e132f441cd7a735ac6186a200b0179147e7d137b74a\",\"dweb:/ipfs/QmeSBJX5a61LZPxbkUKS2NF4LSxemgDwjD65fCAmyP7PX2\"]},\"@uma/core/contracts/common/implementation/FixedPoint.sol\":{\"keccak256\":\"0x996b97cc4fa5da4064e3aee500edc6972485d59a9334ceec81155e2c2f484dae\",\"license\":\"AGPL-3.0-only\",\"urls\":[\"bzz-raw://8d7c028926dc2b27e7dc103363dca8a43f60b3351f4a14bcb702660f95c68663\",\"dweb:/ipfs/QmXz4ieFjP5RxJ35F8GbPryYEGvFmxc4Gqx8EK7N57ixzT\"]},\"@uma/core/contracts/common/implementation/MultiCaller.sol\":{\"keccak256\":\"0x31f18055b14fd9eeb459c6d6a88d1a60921bf3755031f6db4b709c3e01d078f7\",\"urls\":[\"bzz-raw://1a002084305bc747b23e69e24cfd1f3aa730adc22dd76d1e077dc72bcffc41f0\",\"dweb:/ipfs/Qmb611uGKzhc2MHkMhqW3NG49FY3Tg1udh7zXttmPtfU2s\"]},\"@uma/core/contracts/common/implementation/Testable.sol\":{\"keccak256\":\"0x0254b45747293bb800373a58d123969adec0428f7be79dc941cab10fcad09918\",\"license\":\"AGPL-3.0-only\",\"urls\":[\"bzz-raw://537d694e3753596f507d071f283be9caeaad0010c444c9c9955d729affeb4907\",\"dweb:/ipfs/QmZ1WfVTBao11QaN6aygMhnt45UjRq77ZwfKPFmHiVSdaJ\"]},\"@uma/core/contracts/common/implementation/Timer.sol\":{\"keccak256\":\"0x9e0dd7389718bd5d1da910273a6f4cee98ee22bfc0c92bde0f0955c0e23adb5e\",\"license\":\"AGPL-3.0-only\",\"urls\":[\"bzz-raw://7ddac8d3cb76f8811156a11a7702d7c05b15a0f18c22b5abdc318723193f9266\",\"dweb:/ipfs/QmPxL7AU8NkURJaZ6WxXNcw88wGMSoPX4jbt7SMdPJqtYv\"]},\"@uma/core/contracts/common/interfaces/AddressWhitelistInterface.sol\":{\"keccak256\":\"0x22fb8588dff1d5cff76a28111d6c9b190765d99facd93c8ff3b54771f245c0d8\",\"license\":\"AGPL-3.0-only\",\"urls\":[\"bzz-raw://5ecd993f00de290a3c7bf21da23a9439cf2ccb22028316df92b79780ac8aa533\",\"dweb:/ipfs/QmTZ7x7U4EEzTacqapzSdFs2np5WNsqm4XeUBqzQxxDJei\"]},\"@uma/core/contracts/common/interfaces/ExpandedIERC20.sol\":{\"keccak256\":\"0xb8252039cba45f1c19cd677f150a9823a5d6e1845cad90e3041d97c96f273c26\",\"license\":\"AGPL-3.0-only\",\"urls\":[\"bzz-raw://95106656c95e12c30a2a4c482a859df6df55c3b56bb9f7835eb5c685ca3175d3\",\"dweb:/ipfs/QmcuJoX7T53vTCDcQK8WcCJdT1LzHS35vPmSVfg1DG32cd\"]},\"@uma/core/contracts/oracle/implementation/Constants.sol\":{\"keccak256\":\"0x36dcec83c5ac265b759b6a5559ec76088ce24854bf590ba66f808e8ecb59b97e\",\"license\":\"AGPL-3.0-only\",\"urls\":[\"bzz-raw://b6f16b1705220fe3692cca201d65993046b4cbb6dddbc35508c489606575bfc2\",\"dweb:/ipfs/QmdHvPibiSD7j9VJg73DaDPFBsCsWSxKpZJnVCSTErVTHC\"]},\"@uma/core/contracts/oracle/interfaces/FinderInterface.sol\":{\"keccak256\":\"0x9166fbfe08e954eb86d33c114fcde7ce4fd0dda5d9d28b31210582bfc769fa86\",\"license\":\"AGPL-3.0-only\",\"urls\":[\"bzz-raw://e611e12bcaaebfdf65b67c566ff1d34708e757f01a445bd87c55862e89383b81\",\"dweb:/ipfs/QmYNSq5oopTShdS6j4VWKqoLxmQSRKmWebCxw6K4LfmKrf\"]},\"@uma/core/contracts/oracle/interfaces/IdentifierWhitelistInterface.sol\":{\"keccak256\":\"0x9ae86a30dd1a8c03fb2c6d27be570bb30c4c0b13ac63cde8620b7e4b51d88dc9\",\"license\":\"AGPL-3.0-only\",\"urls\":[\"bzz-raw://a71d2aff48e075ecab56a9c9767775d1d77e04ec9191fed124e71003220549e3\",\"dweb:/ipfs/QmYPWsZXro6fzqpZY6UxQ5X8znEXfLp2sun8oXzdz8bTyc\"]},\"@uma/core/contracts/oracle/interfaces/OptimisticOracleInterface.sol\":{\"keccak256\":\"0x92e7280c1abd5f0c4fcd20247fc1b8428aaf4eeea59439c074d15fdaf9c64989\",\"license\":\"AGPL-3.0-only\",\"urls\":[\"bzz-raw://8d12bbcf0a91cef63c4767bffd047254599c5a1fce38e5e81d3005e102fdeef8\",\"dweb:/ipfs/QmTkd3AG9gdvBZq3HKCUW8eErvkguM2QqE3nUDGfvye3Yi\"]},\"@uma/core/contracts/oracle/interfaces/SkinnyOptimisticOracleInterface.sol\":{\"keccak256\":\"0x91d21e44a97b719106e8f97b99399a3d8dc3697badd01df06518892f38fe033f\",\"license\":\"AGPL-3.0-only\",\"urls\":[\"bzz-raw://68c350c822b256b43543ac4dd3dd1413ed95f25a9415d5dba4c562cd11d55716\",\"dweb:/ipfs/QmZyYeBnM59oPmWcK1KERNayg7xuHv12sLzzmqC42Lq76a\"]},\"@uma/core/contracts/oracle/interfaces/StoreInterface.sol\":{\"keccak256\":\"0xbb73671684309c91ad5ef3da1474051d03f2e7d5882bed7f5c4317e5d4c768df\",\"license\":\"AGPL-3.0-only\",\"urls\":[\"bzz-raw://32386544d3119fd0187a8c4e8b01c739f508ab863faa04345cabc2544081f9e8\",\"dweb:/ipfs/QmYszDURs1x75rsejZkGt9zCkASXnJtufbNsL3XHe2eJPQ\"]},\"contracts/HubPool.sol\":{\"keccak256\":\"0x15d7acdb5efa93d253a9bbe19bb262c05247cae31a9be00327b9ee52fa977759\",\"license\":\"GPL-3.0-only\",\"urls\":[\"bzz-raw://ef0985abd398be2138017319d96f26cf5a7c8c3ae62b42b68db1b34fa747932e\",\"dweb:/ipfs/Qma2Quw2Eoa3pohHPTzGbbxYY7RzvA1bN5iTQyAQfRssxy\"]},\"contracts/HubPoolInterface.sol\":{\"keccak256\":\"0x71b427ffd4a1e8c0cc681bafe050c536d79464f12559e90172681e6745f2e7bc\",\"license\":\"GPL-3.0-only\",\"urls\":[\"bzz-raw://ec8e6649ba75c2adbbb4b31b758dfb93dc175a763ce707585d392b86af4a51a1\",\"dweb:/ipfs/QmWqohvT4c9x8XqMgrYaGjyQpYzrxHT5qgwZQZ58NtaiVn\"]},\"contracts/Lockable.sol\":{\"keccak256\":\"0xef490be5cb859c97c6f600f3b0db0d50c6e18f334d3c74c6d9e693a260eaec3e\",\"license\":\"AGPL-3.0-only\",\"urls\":[\"bzz-raw://ff9fc27e0d0046034b06552411f1be06a0a6f1060291e259b9905616482f9382\",\"dweb:/ipfs/QmV7GNM5PztsfSnpnzJ5pcoPi4czE8SnxRWSz3QNKrzMx6\"]},\"contracts/MerkleLib.sol\":{\"keccak256\":\"0x5b49211d8b8e5a2792d08adb818fddc2ad8abaef45822f91ca678ceb7ea018ea\",\"license\":\"GPL-3.0-only\",\"urls\":[\"bzz-raw://0fe42462005b1ac62fe4eac31901bdcb2a1516489cbd0c061d0b99afbb8028c5\",\"dweb:/ipfs/QmZnAWBwPDnqgSK9cftJvQEXJfRjjCDR4ok8LiCB8VDqbX\"]},\"contracts/SpokePoolInterface.sol\":{\"keccak256\":\"0xe0ae593c1cd9c8204f0b7a3f226a5d4bd30d580692d2ecb2a33548b5b4e75f12\",\"license\":\"GPL-3.0-only\",\"urls\":[\"bzz-raw://b0c106a893a4de24bac6b59f85dc1e0eb8eb64c433f1d91bace911f14d62f093\",\"dweb:/ipfs/QmbttLUsuJQH9kvBcdb12r17DTi8M4eyStbuFP2QwMdJET\"]},\"contracts/interfaces/AdapterInterface.sol\":{\"keccak256\":\"0xbd7091006acbdfe72b21ce985f964f0682a2316d9d3b38967beeb55f4ae5118c\",\"license\":\"AGPL-3.0-only\",\"urls\":[\"bzz-raw://e9e59e0b5396d7d3f75e367d2b1892efd1e704a96823a95eabe67b5d91df2821\",\"dweb:/ipfs/QmXsyx77ZKLGigeiS425jhXJJiu7tbtEbnBxe3RaSiFqk6\"]},\"contracts/interfaces/LpTokenFactoryInterface.sol\":{\"keccak256\":\"0x9cf1d6df25bb1bdf34db2473f3caaa4264b628ae2fc0f0a5a0256fd41214b47d\",\"license\":\"AGPL-3.0-only\",\"urls\":[\"bzz-raw://446f2e36f2ebf2220253f1626e5ee9f8291b717733fbe720bd90f8fa8c8ffefc\",\"dweb:/ipfs/QmYX7HeRao7gGsNwLxfCKDicLJi7EnDBJtYSCdYmDxdx34\"]},\"contracts/interfaces/WETH9.sol\":{\"keccak256\":\"0x7b444d0840b1f76eee9bf39d74830f70644395613b96cce2d80fc50785a82eaa\",\"license\":\"GPL-3.0-only\",\"urls\":[\"bzz-raw://9241f8ea371edb800af4529a224c5ecc791b517b20a60cea69e2ebc51f7481ce\",\"dweb:/ipfs/QmTkRUXUrqhEvKBs1dcUypQ9n8ai9i8jH6AG1ziBRJTNvS\"]}},\"version\":1}", + "bytecode": "0x60e06040527f49535f4143524f53535f56325f42554e444c455f56414c494400000000000000600b5565015d3ef79800600c556012805463ffffffff1916611c201790553480156200005057600080fd5b5060405162004c2a38038062004c2a833981016040819052620000739162000149565b600080546001600160a81b0319166001600160a01b03831617600160a01b179055620000a6620000a03390565b620000de565b506001600160a01b0392831660a05290821660c0528116608052600154600e80546001600160a01b03191691909216179055620001b1565b600180546001600160a01b038381166001600160a01b0319831681179093556040519116919082907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e090600090a35050565b6001600160a01b03811681146200014657600080fd5b50565b600080600080608085870312156200016057600080fd5b84516200016d8162000130565b6020860151909450620001808162000130565b6040860151909350620001938162000130565b6060860151909250620001a68162000130565b939692955090935050565b60805160a05160c051614a0362000227600039600081816107e601528181610c010152818161184001528181612d8a0152612f800152600081816106a8015261266d015260008181610514015281816109ae01528181610e5f01528181610fc801528181611a580152611bbe0152614a036000f3fe60806040526004361061027f5760003560e01c8063625997c01161014f578063a5841194116100c1578063dd70e5e81161007a578063dd70e5e814610848578063e0f339e314610868578063e40064d714610888578063e460e35c146108b5578063f0056a7d146108d5578063f2fde38b1461097a5761028e565b8063a584119414610774578063ac9650d814610794578063b60c2d7d146107b4578063b9a3c84c146107d4578063c28f439214610808578063cd949995146108285761028e565b80637998a1c4116101135780637998a1c4146106ca57806380c09a82146106e057806380f323a7146107005780638bda0c00146107165780638da5cb5b14610736578063a16fd6e9146107545761028e565b8063625997c01461063a57806369b625021461028c5780636ad0690a1461064f578063715018a61461068157806376ec08dd146106965761028e565b806322f8e566116101f35780633fc8cef3116101ac5780633fc8cef3146105025780634144fd61146105365780634f7473ff146105c757806356688700146105dd57806356864f38146105f05780635c975abb146106105761028e565b806322f8e5661461044d578063240f475f1461046d57806329cb924d1461048d5780632d0f6f84146104a25780632d32d557146104c257806333dc09ca146104e25761028e565b80630ee28a88116102455780630ee28a881461038a57806310b99527146103aa57806311cfc159146103ca57806316c38b3c146103e05780631c39c38d1461040057806322395aaa146104385761028e565b8062660b5314610296578062c99206146102b6578063084d0513146102d657806309474ae2146103095780630c501af91461036a5761028e565b3661028e5761028c61099a565b005b61028c61099a565b3480156102a257600080fd5b5061028c6102b1366004613cf9565b610a23565b3480156102c257600080fd5b5061028c6102d1366004613d25565b610b6f565b3480156102e257600080fd5b506102f66102f1366004613cf9565b610d70565b6040519081526020015b60405180910390f35b34801561031557600080fd5b5061034a610324366004613d25565b600a60205260009081526040902080546001909101546001600160a01b03918216911682565b604080516001600160a01b03938416815292909116602083015201610300565b34801561037657600080fd5b5061028c610385366004613d3e565b610d9c565b34801561039657600080fd5b5061028c6103a5366004613d69565b610e43565b3480156103b657600080fd5b5061028c6103c5366004613dab565b6110c7565b3480156103d657600080fd5b506102f6600c5481565b3480156103ec57600080fd5b5061028c6103fb366004613de2565b611175565b34801561040c57600080fd5b50600054610420906001600160a01b031681565b6040516001600160a01b039091168152602001610300565b34801561044457600080fd5b5061028c6111f1565b34801561045957600080fd5b5061028c610468366004613d25565b6115c3565b34801561047957600080fd5b50600e54610420906001600160a01b031681565b34801561049957600080fd5b506102f661161e565b3480156104ae57600080fd5b5061028c6104bd366004613d3e565b6116af565b3480156104ce57600080fd5b506104206104dd366004613dff565b61172d565b3480156104ee57600080fd5b5061028c6104fd366004613cf9565b61175e565b34801561050e57600080fd5b506104207f000000000000000000000000000000000000000000000000000000000000000081565b34801561054257600080fd5b5060025460035460045460055460065461058094939291906001600160a01b03811690600160a01b810460ff1690600160a81b900463ffffffff1687565b6040805197885260208801969096529486019390935260608501919091526001600160a01b0316608084015260ff1660a083015263ffffffff1660c082015260e001610300565b3480156105d357600080fd5b506102f6600f5481565b61028c6105eb366004613cf9565b6119d9565b3480156105fc57600080fd5b5061028c61060b366004613e2f565b611cb5565b34801561061c57600080fd5b5060075461062a9060ff1681565b6040519015158152602001610300565b34801561064657600080fd5b5061028c611d9d565b34801561065b57600080fd5b5060125461066c9063ffffffff1681565b60405163ffffffff9091168152602001610300565b34801561068d57600080fd5b5061028c611e81565b3480156106a257600080fd5b506104207f000000000000000000000000000000000000000000000000000000000000000081565b3480156106d657600080fd5b506102f6600b5481565b3480156106ec57600080fd5b5061028c6106fb366004613fc4565b611eb5565b34801561070c57600080fd5b506102f660115481565b34801561072257600080fd5b5061028c6107313660046140ba565b612238565b34801561074257600080fd5b506001546001600160a01b0316610420565b34801561076057600080fd5b506102f661076f366004613d3e565b612402565b34801561078057600080fd5b5061028c61078f366004613d3e565b61242e565b6107a76107a2366004614122565b61244f565b60405161030091906141ef565b3480156107c057600080fd5b5061028c6107cf366004613d3e565b6125f5565b3480156107e057600080fd5b506104207f000000000000000000000000000000000000000000000000000000000000000081565b34801561081457600080fd5b50601054610420906001600160a01b031681565b34801561083457600080fd5b5061028c610843366004614251565b6127b4565b34801561085457600080fd5b5061028c61086336600461429f565b612882565b34801561087457600080fd5b506102f6610883366004613d3e565b6128ce565b34801561089457600080fd5b506102f66108a3366004613d3e565b600d6020526000908152604090205481565b3480156108c157600080fd5b5061028c6108d0366004613dab565b6128e9565b3480156108e157600080fd5b506109386108f0366004613d3e565b60096020526000908152604090208054600182015460028301546003909301546001600160a01b03831693600160a01b840460ff1693600160a81b900463ffffffff16929186565b604080516001600160a01b039097168752941515602087015263ffffffff909316938501939093526060840152608083019190915260a082015260c001610300565b34801561098657600080fd5b5061028c610995366004613d3e565b6129c2565b600054600160a01b900460ff1615610a21577f00000000000000000000000000000000000000000000000000000000000000006001600160a01b031663d0e30db0346040518263ffffffff1660e01b81526004016000604051808303818588803b158015610a0757600080fd5b505af1158015610a1b573d6000803e3d6000fd5b50505050505b565b6001546001600160a01b03163314610a565760405162461bcd60e51b8152600401610a4d90614324565b60405180910390fd5b610a5e612a5a565b610a66612ab3565b670de0b6b3a7640000811115610abe5760405162461bcd60e51b815260206004820152601960248201527f4261642070726f746f636f6c46656543617074757265506374000000000000006044820152606401610a4d565b6001600160a01b038216610b145760405162461bcd60e51b815260206004820152601d60248201527f4261642070726f746f636f6c46656543617074757265416464726573730000006044820152606401610a4d565b600e80546001600160a01b0319166001600160a01b038416908117909155600f8290556040518291907fc1993b89fd79a19ece7beb067ddc8534ca26d29c0ff94ea2f53b4a508d1eedc990600090a3610b6b612ac2565b5050565b6001546001600160a01b03163314610b995760405162461bcd60e51b8152600401610a4d90614324565b600654600160a01b900460ff1615610bc35760405162461bcd60e51b8152600401610a4d90614359565b610bcb612a5a565b610bd3612ab3565b6040516302abf57960e61b8152721259195b9d1a599a595c95da1a5d195b1a5cdd606a1b60048201526000907f00000000000000000000000000000000000000000000000000000000000000006001600160a01b03169063aafd5e4090602401602060405180830381865afa158015610c50573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610c749190614390565b6040516390978d1b60e01b8152600481018490529091506001600160a01b038216906390978d1b90602401602060405180830381865afa158015610cbc573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610ce091906143ad565b610d2c5760405162461bcd60e51b815260206004820152601860248201527f4964656e746966696572206e6f7420737570706f7274656400000000000000006044820152606401610a4d565b600b8290556040518281527ff45367c278fcceff23d601ce4bdd191e5bd61687ff9f29dc7276a08fe54c0c5d9060200160405180910390a150610d6d612ac2565b50565b6000610d7a612a5a565b610d82612ab3565b610d8c8383612ad7565b9050610d96612ac2565b92915050565b6001546001600160a01b03163314610dc65760405162461bcd60e51b8152600401610a4d90614324565b610dce612a5a565b610dd6612ab3565b6001600160a01b03818116600081815260096020908152604091829020805460ff60a01b1981169091558251938452909316928201929092527fac111b3b527b307393c94d98f26140effb71411054466818be97912d2d65f77691015b60405180910390a1610d6d612ac2565b610e4b612a5a565b610e53612ab3565b826001600160a01b03167f00000000000000000000000000000000000000000000000000000000000000006001600160a01b03161480610e91575080155b610ecd5760405162461bcd60e51b815260206004820152600d60248201526c086c2dce840e6cadcc840cae8d609b1b6044820152606401610a4d565b6000670de0b6b3a7640000610ee185612bcf565b610eeb90856143e0565b610ef59190614415565b6001600160a01b038581166000908152600960205260409081902054905163079cc67960e41b81523360048201526024810187905292935016906379cc6790906044016020604051808303816000875af1158015610f57573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610f7b91906143ad565b506001600160a01b03841660009081526009602052604081206002018054839290610fa7908490614429565b9091555050811561105f57604051632e1a7d4d60e01b8152600481018290527f00000000000000000000000000000000000000000000000000000000000000006001600160a01b031690632e1a7d4d90602401600060405180830381600087803b15801561101457600080fd5b505af1158015611028573d6000803e3d6000fd5b505060405133925083156108fc02915083906000818181858888f19350505050158015611059573d6000803e3d6000fd5b50611073565b6110736001600160a01b0385163383612cca565b604080518281526020810185905233916001600160a01b038716917fcda1185f28599e6bd14ab8a68b3c30a11e1dce4256b5e67e94dd3fd846a6c589910160405180910390a3506110c2612ac2565b505050565b6001546001600160a01b031633146110f15760405162461bcd60e51b8152600401610a4d90614324565b6110f9612a5a565b611101612ab3565b80600860006111108587612d2d565b815260208101919091526040908101600090812080546001600160a01b0319166001600160a01b0394851617905590518383169285169186917f234e7af08f77827792cc909447f27d2e6a3e2d839b04e26b50b71704a131c8a89190a46110c2612ac2565b6001546001600160a01b0316331461119f5760405162461bcd60e51b8152600401610a4d90614324565b6111a7612a5a565b6111af612ab3565b6007805460ff19168215159081179091556040517f0e2fb031ee032dc02d8011dc50b816eb450cf856abd8261680dac74f72165bd290600090a2610d6d612ac2565b6111f9612a5a565b611201612ab3565b600061120b61161e565b60065490915063ffffffff600160a81b909104811690821611156112715760405162461bcd60e51b815260206004820152601760248201527f5265717565737420706173736564206c6976656e6573730000000000000000006044820152606401610a4d565b600061127b612d6a565b905060115481106112955761128e612e70565b505061159c565b600061129f612f4f565b6011546010549192506112bd916001600160a01b0316908390612ff3565b806001600160a01b031663af355d1e600b5485601060009054906101000a90046001600160a01b03166000876011546112f69190614429565b60125460065460405160e089901b6001600160e01b0319168152600481019790975263ffffffff9586166024880152610120604488015260006101248801526001600160a01b039485166064880152608487019390935260a48601919091529290921660c48401521660e4820152670de0b6b3a7640000610104820152610144016020604051808303816000875af19250505080156113b2575060408051601f3d908101601f191682019092526113af91810190614440565b60015b6113c6576113be612e70565b50505061159c565b6010546113de906001600160a01b03168360006130a5565b5060408051610160810182526006546001600160a01b0390811682526000602083018190526010549091169282019290925260608101829052670de0b6b3a7640000608082015260a0810182905260125460c08201906114449063ffffffff1687614459565b63ffffffff168152602001600081526020018481526020018460115461146a9190614429565b815260125463ffffffff9081166020909201919091526000600281905560038190556004819055600555600680546001600160c81b03191690556011546010549293506114c5926001600160a01b031691339130916131ba16565b6011546010546114e2916001600160a01b03909116908490612ff3565b600b5460405163139c641960e31b81526001600160a01b03841691639ce320c89161151891908890869033903090600401614481565b6020604051808303816000875af1158015611537573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061155b9190614440565b5060405163ffffffff8516815233907f15951cb2ef6993bc23a55912e7d0bcac13e4797c432aaa334816aed6914a7a909060200160405180910390a2505050505b6115bb6115a7612f4f565b6010546001600160a01b03169060006130a5565b610a21612ac2565b6000546001600160a01b03166115d857600080fd5b60005460405163117c72b360e11b8152600481018390526001600160a01b03909116906322f8e56690602401600060405180830381600087803b158015610a0757600080fd5b600080546001600160a01b0316156116aa5760008054906101000a90046001600160a01b03166001600160a01b03166329cb924d6040518163ffffffff1660e01b8152600401602060405180830381865afa158015611681573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906116a59190614440565b905090565b504290565b6116b7612a5a565b6116bf612ab3565b6001600160a01b038082166000818152600d602052604081208054919055600e5490926116ee92911683612cca565b60405181906001600160a01b038416907f74740239d7d696c84422b720e125e1f47c4138c66d1f4d2a48e99f4197cdb79c90600090a350610d6d612ac2565b60006008600061173d8486612d2d565b81526020810191909152604001600020546001600160a01b03169392505050565b6001546001600160a01b031633146117885760405162461bcd60e51b8152600401610a4d90614324565b600654600160a01b900460ff16156117b25760405162461bcd60e51b8152600401610a4d90614359565b6117ba612a5a565b6117c2612ab3565b806000036118125760405162461bcd60e51b815260206004820152601760248201527f626f6e6420657175616c20746f2066696e616c206665650000000000000000006044820152606401610a4d565b6040516302abf57960e61b81527210dbdb1b185d195c985b15da1a5d195b1a5cdd606a1b60048201526000907f00000000000000000000000000000000000000000000000000000000000000006001600160a01b03169063aafd5e4090602401602060405180830381865afa15801561188f573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906118b39190614390565b604051631d1d5b3960e11b81526001600160a01b03858116600483015291925090821690633a3ab67290602401602060405180830381865afa1580156118fd573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061192191906143ad565b6119605760405162461bcd60e51b815260206004820152601060248201526f139bdd081bdb881dda1a5d195b1a5cdd60821b6044820152606401610a4d565b601080546001600160a01b0319166001600160a01b038516179055611983612d6a565b61198d9083614574565b60118190556040519081526001600160a01b038416907fbfa9a96010167e98ce8c004f718932cbbfd33a58d681c752e693be7d457a1b3b9060200160405180910390a250610b6b612ac2565b6119e1612a5a565b6119e9612ab3565b6001600160a01b038216600090815260096020526040902054600160a01b900460ff16611a4c5760405162461bcd60e51b8152602060048201526011602482015270151bdad95b881b9bdd08195b98589b1959607a1b6044820152606401610a4d565b816001600160a01b03167f00000000000000000000000000000000000000000000000000000000000000006001600160a01b0316148015611a8c57508034145b80611a95575034155b611ad15760405162461bcd60e51b815260206004820152600d60248201526c426164206d73672e76616c756560981b6044820152606401610a4d565b6000611adc83612bcf565b611aee83670de0b6b3a76400006143e0565b611af89190614415565b6001600160a01b038416600090815260096020526040812060020180549293508492909190611b28908490614574565b90915550506001600160a01b03838116600090815260096020526040908190205490516340c10f1960e01b8152336004820152602481018490529116906340c10f19906044016020604051808303816000875af1158015611b8d573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611bb191906143ad565b50826001600160a01b03167f00000000000000000000000000000000000000000000000000000000000000006001600160a01b0316148015611bf35750600034115b15611c5157826001600160a01b031663d0e30db0346040518263ffffffff1660e01b81526004016000604051808303818588803b158015611c3357600080fd5b505af1158015611c47573d6000803e3d6000fd5b5050505050611c66565b611c666001600160a01b0384163330856131ba565b604080518381526020810183905233916001600160a01b038616917f3c69701a61c79a92ef9692903aaa0068bce8771361ecb09547391e4fb4df8537910160405180910390a350610b6b612ac2565b611cbd612a5a565b611cc5612ab3565b6001546001600160a01b03163314611cef5760405162461bcd60e51b8152600401610a4d90614324565b6040516001600160a01b0383166024820152604481018490528115156064820152611d4890859060840160408051601f198184030181529190526020810180516001600160e01b031663272751c760e01b1790526131f2565b816001600160a01b031683857fb7d00a563842efb2c121a0eb02b7bb7ba1a34625bbc3d65057f1f0dbec0ec2a184604051611d87911515815260200190565b60405180910390a4611d97612ac2565b50505050565b6001546001600160a01b03163314611dc75760405162461bcd60e51b8152600401610a4d90614324565b611dcf612a5a565b611dd7612ab3565b600654600160a01b900460ff1615611e0a57600654601154601054611e0a926001600160a01b0391821692911690612cca565b6006546003546002546004546040519081526001600160a01b03909316927f993cba33f9b140c9ce20ba10d7eda92128d5beb6df856f064916108a11647a739060200160405180910390a46000600281905560038190556004819055600555600680546001600160c81b0319169055610a21612ac2565b6001546001600160a01b03163314611eab5760405162461bcd60e51b8152600401610a4d90614324565b610a2160006132f6565b611ebd612a5a565b611ec5612ab3565b60075460ff1615611f185760405162461bcd60e51b815260206004820181905260248201527f50726f706f73616c2070726f6365737320686173206265656e207061757365646044820152606401610a4d565b600654600160a81b900463ffffffff16611f3061161e565b11611f735760405162461bcd60e51b81526020600482015260136024820152724e6f7420706173736564206c6976656e65737360681b6044820152606401610a4d565b600554600160ff85161b90811603611fbf5760405162461bcd60e51b815260206004820152600f60248201526e105b1c9958591e4818db185a5b5959608a1b6044820152606401610a4d565b6120046002600001546040518060e001604052808b81526020018981526020018881526020018781526020018a81526020018660ff1681526020018581525083613348565b61203c5760405162461bcd60e51b81526020600482015260096024820152682130b210283937b7b360b91b6044820152606401610a4d565b6000806120488a613385565b9150915061205b60026003015486613451565b60055560068054600160a01b900460ff169060146120788361458c565b91906101000a81548160ff021916908360ff1602179055505061209f82828c878b8d613474565b886000036121a157600354600454604051602481019290925260448201526000906001600160a01b03841690839060640160408051601f198184030181529181526020820180516001600160e01b031663124e93e160e21b179052516121099291906024016145a9565b60408051601f198184030181529181526020820180516001600160e01b0316637375c56f60e11b1790525161213e91906145cd565b600060405180830381855af49150503d8060008114612179576040519150601f19603f3d011682016040523d82523d6000602084013e61217e565b606091505b505090508061219f5760405162461bcd60e51b8152600401610a4d906145e9565b505b600654600160a01b900460ff166000036121d6576006546011546010546121d6926001600160a01b0391821692911690612cca565b336001600160a01b03168a8660ff167ff652dd63b1aedbf9e740f3152fb67b0d94d069cf1182811ebd88921850d935678c888d8d8d60405161221c95949392919061468a565b60405180910390a4505061222e612ac2565b5050505050505050565b612240612a5a565b612248612ab3565b600654600160a01b900460ff16156122725760405162461bcd60e51b8152600401610a4d90614359565b60075460ff16156122c55760405162461bcd60e51b815260206004820181905260248201527f50726f706f73616c2070726f6365737320686173206265656e207061757365646044820152606401610a4d565b60008460ff16116123185760405162461bcd60e51b815260206004820181905260248201527f42756e646c65206d7573742068617665206174206c656173742031206c6561666044820152606401610a4d565b60125460009063ffffffff1661232c61161e565b6123369190614459565b60006005556006805460028790556003869055600485905560ff8816600160a01b0263ffffffff808516600160a81b0260ff60a01b19166001600160c81b031990931692909217176001600160a01b031916339081179092556011546010549394506123b0936001600160a01b031692913091906131ba16565b336001600160a01b031683857f50e585dd6361c7cb2613ce2334814bb2a789f5a8ad4b161fe0e248043737d1d284898b886040516123f194939291906146e9565b60405180910390a450610a1b612ac2565b600061240c612a5a565b612414612ab3565b61241f826000612ad7565b9050612429612ac2565b919050565b612436612a5a565b61243e612ab3565b61244781613738565b610d6d612ac2565b6060341561249f5760405162461bcd60e51b815260206004820152601b60248201527f4f6e6c79206d756c746963616c6c207769746820302076616c756500000000006044820152606401610a4d565b8167ffffffffffffffff8111156124b8576124b8613e79565b6040519080825280602002602001820160405280156124eb57816020015b60608152602001906001900390816124d65790505b50905060005b828110156125ee576000803086868581811061250f5761250f614722565b90506020028101906125219190614738565b60405161252f929190614786565b600060405180830381855af49150503d806000811461256a576040519150601f19603f3d011682016040523d82523d6000602084013e61256f565b606091505b5091509150816125bb5760448151101561258857600080fd5b600481019050808060200190518101906125a29190614796565b60405162461bcd60e51b8152600401610a4d9190614804565b808484815181106125ce576125ce614722565b6020026020010181905250505080806125e690614817565b9150506124f1565b5092915050565b6001546001600160a01b0316331461261f5760405162461bcd60e51b8152600401610a4d90614324565b612627612a5a565b61262f612ab3565b6001600160a01b038181166000908152600960205260409020541661274d57604051637e178db760e11b81526001600160a01b0382811660048301527f0000000000000000000000000000000000000000000000000000000000000000169063fc2f1b6e906024016020604051808303816000875af11580156126b6573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906126da9190614390565b6001600160a01b03828116600090815260096020526040902080546001600160a01b0319169290911691909117905561271161161e565b6001600160a01b0382166000908152600960205260409020805463ffffffff92909216600160a81b0263ffffffff60a81b199092169190911790555b6001600160a01b038181166000818152600960209081526040918290208054600160a01b60ff60a01b198216179091558251938452909316928201929092527f04e291c80180d65a57b5bf1bed775777ec0d6f283ef34bcf130712714d8bb7f79101610e33565b6001546001600160a01b031633146127de5760405162461bcd60e51b8152600401610a4d90614324565b6127e6612a5a565b6127ee612ab3565b6102588163ffffffff161161283a5760405162461bcd60e51b8152602060048201526012602482015271131a5d995b995cdcc81d1bdbc81cda1bdc9d60721b6044820152606401610a4d565b6012805463ffffffff191663ffffffff83169081179091556040519081527f04dd1d84d387f404568a7954b5e398518bdd716e1a8f4a790be9a1a225ad934790602001610e33565b6001546001600160a01b031633146128ac5760405162461bcd60e51b8152600401610a4d90614324565b6128b4612a5a565b6128bc612ab3565b6128c682826131f2565b610b6b612ac2565b60006128d8612a5a565b6128e0612ab3565b61241f82612bcf565b6001546001600160a01b031633146129135760405162461bcd60e51b8152600401610a4d90614324565b61291b612a5a565b612923612ab3565b6040805180820182526001600160a01b03848116808352848216602080850182815260008a8152600a8352879020955186549086166001600160a01b031991821617875590516001909601805496909516951694909417909255835187815292830152918101919091527f36050d958750e6ac3aa674ac7bbe8d0ae6a2f7d4b808e8c2c42c1f22fc9fc4bb9060600160405180910390a16110c2612ac2565b6001546001600160a01b031633146129ec5760405162461bcd60e51b8152600401610a4d90614324565b6001600160a01b038116612a515760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201526564647265737360d01b6064820152608401610a4d565b610d6d816132f6565b600054600160a01b900460ff16610a215760405162461bcd60e51b815260206004820152601f60248201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c006044820152606401610a4d565b6000805460ff60a01b19169055565b6000805460ff60a01b1916600160a01b179055565b6000612ae283613738565b6001600160a01b038381166000908152600960209081526040808320815160c08101835281549586168152600160a01b860460ff16151593810193909352600160a81b90940463ffffffff16908201526001830154606082018190526002840154608083015260039093015460a0820152918112612b61576000612b67565b81606001515b90506000612b758286614574565b90506000828460800151612b899190614574565b905080600003612ba757670de0b6b3a7640000945050505050610d96565b80612bba83670de0b6b3a76400006143e0565b612bc49190614415565b979650505050505050565b6001600160a01b038082166000908152600960209081526040808320805482516318160ddd60e01b8152925194959194869491909216926318160ddd92600480830193928290030181865afa158015612c2c573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190612c509190614440565b905080600003612c6b5750670de0b6b3a76400009392505050565b612c7482613887565b612c7d84613738565b6000826003015483600101548460020154612c989190614830565b612ca29190614871565b905081612cb782670de0b6b3a76400006143e0565b612cc19190614415565b95945050505050565b6040516001600160a01b0383166024820152604481018290526110c290849063a9059cbb60e01b906064015b60408051601f198184030181529190526020810180516001600160e01b03166001600160e01b0319909316929092179091526138ef565b604080516001600160a01b038416602082015290810182905260009060600160405160208183030381529060405280519060200120905092915050565b6040516302abf57960e61b81526453746f726560d81b60048201526000907f00000000000000000000000000000000000000000000000000000000000000006001600160a01b03169063aafd5e4090602401602060405180830381865afa158015612dd9573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190612dfd9190614390565b601054604051635b97aadd60e01b81526001600160a01b039182166004820152911690635b97aadd90602401602060405180830381865afa158015612e46573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190612e6a91906148b0565b51919050565b60105460065460115460405163a9059cbb60e01b81526001600160a01b039283166004820152602481019190915291169063a9059cbb906044016020604051808303816000875af1158015612ec9573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190612eed91906143ad565b506000600281905560038190556004819055600555600680546001600160c81b0319169055337f0cfbbf45ab7f5225663454de7117b1b0ed5a7c133b61f54ccf367dcf8b6d4d59612f3c61161e565b60405190815260200160405180910390a2565b6040516302abf57960e61b815275536b696e6e794f7074696d69737469634f7261636c6560501b60048201526000907f00000000000000000000000000000000000000000000000000000000000000006001600160a01b03169063aafd5e4090602401602060405180830381865afa158015612fcf573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906116a59190614390565b604051636eb1769f60e11b81523060048201526001600160a01b038381166024830152600091839186169063dd62ed3e90604401602060405180830381865afa158015613044573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906130689190614440565b6130729190614574565b6040516001600160a01b038516602482015260448101829052909150611d9790859063095ea7b360e01b90606401612cf6565b80158061311f5750604051636eb1769f60e11b81523060048201526001600160a01b03838116602483015284169063dd62ed3e90604401602060405180830381865afa1580156130f9573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061311d9190614440565b155b61318a5760405162461bcd60e51b815260206004820152603660248201527f5361666545524332303a20617070726f76652066726f6d206e6f6e2d7a65726f60448201527520746f206e6f6e2d7a65726f20616c6c6f77616e636560501b6064820152608401610a4d565b6040516001600160a01b0383166024820152604481018290526110c290849063095ea7b360e01b90606401612cf6565b6040516001600160a01b0380851660248301528316604482015260648101829052611d979085906323b872dd60e01b90608401612cf6565b6000806131fe84613385565b915091506000826001600160a01b031682856040516024016132219291906145a9565b60408051601f198184030181529181526020820180516001600160e01b0316637375c56f60e11b1790525161325691906145cd565b600060405180830381855af49150503d8060008114613291576040519150601f19603f3d011682016040523d82523d6000602084013e613296565b606091505b50509050806132b75760405162461bcd60e51b8152600401610a4d906145e9565b847f218987b934c2f6bc596136829fbf43a5fef4d6fafce41f3f6254d9a870c2deec856040516132e79190614804565b60405180910390a25050505050565b600180546001600160a01b038381166001600160a01b0319831681179093556040519116919082907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e090600090a35050565b600061337b82858560405160200161336091906148f2565b604051602081830303815290604052805190602001206139c1565b90505b9392505050565b6000818152600a6020526040902080546001909101546001600160a01b039182169116806133f55760405162461bcd60e51b815260206004820152601960248201527f53706f6b65506f6f6c206e6f7420696e697469616c697a6564000000000000006044820152606401610a4d565b6001600160a01b0382163b61344c5760405162461bcd60e51b815260206004820152601760248201527f41646170746572206e6f7420696e697469616c697a65640000000000000000006044820152606401610a4d565b915091565b600061346261010060ff8416614989565b61ffff166001901b8317905092915050565b60005b83518163ffffffff16101561372f576000848263ffffffff16815181106134a0576134a0614722565b602002602001015190506000600860006134ba848a612d2d565b81526020810191909152604001600020546001600160a01b031690508061351b5760405162461bcd60e51b8152602060048201526015602482015274149bdd5d19481b9bdd081dda1a5d195b1a5cdd1959605a1b6044820152606401610a4d565b6000858463ffffffff168151811061353557613535614722565b602002602001015113156136f1576000896001600160a01b03168383888763ffffffff168151811061356957613569614722565b60209081029190910101516040516001600160a01b03938416602482015291831660448301526064820152908b16608482015260a40160408051601f198184030181529181526020820180516001600160e01b03166314b231d760e21b179052516135d491906145cd565b600060405180830381855af49150503d806000811461360f576040519150601f19603f3d011682016040523d82523d6000602084013e613614565b606091505b50509050806136355760405162461bcd60e51b8152600401610a4d906145e9565b858463ffffffff168151811061364d5761364d614722565b602002602001015160096000856001600160a01b03166001600160a01b03168152602001908152602001600020600101600082825461368c9190614830565b92505081905550858463ffffffff16815181106136ab576136ab614722565b602002602001015160096000856001600160a01b03166001600160a01b0316815260200190815260200160002060020160008282546136ea9190614429565b9091555050505b61371a82858563ffffffff168151811061370d5761370d614722565b60200260200101516139d7565b50508080613727906149aa565b915050613477565b50505050505050565b6040516370a0823160e01b81523060048201526000906001600160a01b038316906370a0823190602401602060405180830381865afa15801561377f573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906137a39190614440565b6010549091506000906001600160a01b0384811691161480156137d15750600654600160a01b900460ff1615155b6137db57816137e8565b6011546137e89083614429565b6001600160a01b0384166000908152600960205260409020600201549091508111156110c2576001600160a01b0383166000908152600960205260409020600201546138349082614429565b6001600160a01b0384166000908152600960205260408120600101805490919061385f908490614871565b90915550506001600160a01b0383166000908152600960205260409020600201819055505050565b600381015481546000916138a791600160a81b900463ffffffff16613aaa565b9050808260030160008282546138bd9190614429565b909155506138cb905061161e565b825463ffffffff91909116600160a81b0263ffffffff60a81b199091161790915550565b6000613944826040518060400160405280602081526020017f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c6564815250856001600160a01b0316613b079092919063ffffffff16565b8051909150156110c2578080602001905181019061396291906143ad565b6110c25760405162461bcd60e51b815260206004820152602a60248201527f5361666545524332303a204552433230206f7065726174696f6e20646964206e6044820152691bdd081cdd58d8d9595960b21b6064820152608401610a4d565b6000826139ce8584613b16565b14949350505050565b6000670de0b6b3a7640000600f54836139f091906143e0565b6139fa9190614415565b90506000613a088284614429565b90508015613a71576001600160a01b03841660009081526009602052604081206003018054839290613a3b908490614574565b90915550506001600160a01b03841660009081526009602052604081206001018054839290613a6b908490614830565b90915550505b8115611d97576001600160a01b0384166000908152600d602052604081208054849290613a9f908490614574565b909155505050505050565b60008082613ab661161e565b613ac09190614429565b90506000670de0b6b3a764000082600c5487613adc91906143e0565b613ae691906143e0565b613af09190614415565b9050848110613aff5784612cc1565b949350505050565b606061337b8484600085613b8a565b600081815b8451811015613b82576000858281518110613b3857613b38614722565b60200260200101519050808311613b5e5760008381526020829052604090209250613b6f565b600081815260208490526040902092505b5080613b7a81614817565b915050613b1b565b509392505050565b606082471015613beb5760405162461bcd60e51b815260206004820152602660248201527f416464726573733a20696e73756666696369656e742062616c616e636520666f6044820152651c8818d85b1b60d21b6064820152608401610a4d565b6001600160a01b0385163b613c425760405162461bcd60e51b815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e74726163740000006044820152606401610a4d565b600080866001600160a01b03168587604051613c5e91906145cd565b60006040518083038185875af1925050503d8060008114613c9b576040519150601f19603f3d011682016040523d82523d6000602084013e613ca0565b606091505b5091509150612bc482828660608315613cba57508161337e565b825115613cca5782518084602001fd5b8160405162461bcd60e51b8152600401610a4d9190614804565b6001600160a01b0381168114610d6d57600080fd5b60008060408385031215613d0c57600080fd5b8235613d1781613ce4565b946020939093013593505050565b600060208284031215613d3757600080fd5b5035919050565b600060208284031215613d5057600080fd5b813561337e81613ce4565b8015158114610d6d57600080fd5b600080600060608486031215613d7e57600080fd5b8335613d8981613ce4565b9250602084013591506040840135613da081613d5b565b809150509250925092565b600080600060608486031215613dc057600080fd5b833592506020840135613dd281613ce4565b91506040840135613da081613ce4565b600060208284031215613df457600080fd5b813561337e81613d5b565b60008060408385031215613e1257600080fd5b823591506020830135613e2481613ce4565b809150509250929050565b60008060008060808587031215613e4557600080fd5b84359350602085013592506040850135613e5e81613ce4565b91506060850135613e6e81613d5b565b939692955090935050565b634e487b7160e01b600052604160045260246000fd5b604051601f8201601f1916810167ffffffffffffffff81118282101715613eb857613eb8613e79565b604052919050565b600067ffffffffffffffff821115613eda57613eda613e79565b5060051b60200190565b600082601f830112613ef557600080fd5b81356020613f0a613f0583613ec0565b613e8f565b82815260059290921b84018101918181019086841115613f2957600080fd5b8286015b84811015613f445780358352918301918301613f2d565b509695505050505050565b803560ff8116811461242957600080fd5b600082601f830112613f7157600080fd5b81356020613f81613f0583613ec0565b82815260059290921b84018101918181019086841115613fa057600080fd5b8286015b84811015613f44578035613fb781613ce4565b8352918301918301613fa4565b600080600080600080600080610100898b031215613fe157600080fd5b8835975060208901359650604089013567ffffffffffffffff8082111561400757600080fd5b6140138c838d01613ee4565b975060608b013591508082111561402957600080fd5b6140358c838d01613ee4565b965060808b013591508082111561404b57600080fd5b6140578c838d01613ee4565b955061406560a08c01613f4f565b945060c08b013591508082111561407b57600080fd5b6140878c838d01613f60565b935060e08b013591508082111561409d57600080fd5b506140aa8b828c01613ee4565b9150509295985092959890939650565b600080600080600060a086880312156140d257600080fd5b853567ffffffffffffffff8111156140e957600080fd5b6140f588828901613ee4565b95505061410460208701613f4f565b94979496505050506040830135926060810135926080909101359150565b6000806020838503121561413557600080fd5b823567ffffffffffffffff8082111561414d57600080fd5b818501915085601f83011261416157600080fd5b81358181111561417057600080fd5b8660208260051b850101111561418557600080fd5b60209290920196919550909350505050565b60005b838110156141b257818101518382015260200161419a565b83811115611d975750506000910152565b600081518084526141db816020860160208601614197565b601f01601f19169290920160200192915050565b6000602080830181845280855180835260408601915060408160051b870101925083870160005b8281101561424457603f198886030184526142328583516141c3565b94509285019290850190600101614216565b5092979650505050505050565b60006020828403121561426357600080fd5b813563ffffffff8116811461337e57600080fd5b600067ffffffffffffffff82111561429157614291613e79565b50601f01601f191660200190565b600080604083850312156142b257600080fd5b82359150602083013567ffffffffffffffff8111156142d057600080fd5b8301601f810185136142e157600080fd5b80356142ef613f0582614277565b81815286602083850101111561430457600080fd5b816020840160208301376000602083830101528093505050509250929050565b6020808252818101527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604082015260600190565b6020808252601d908201527f50726f706f73616c2068617320756e636c61696d6564206c6561766573000000604082015260600190565b6000602082840312156143a257600080fd5b815161337e81613ce4565b6000602082840312156143bf57600080fd5b815161337e81613d5b565b634e487b7160e01b600052601160045260246000fd5b60008160001904831182151516156143fa576143fa6143ca565b500290565b634e487b7160e01b600052601260045260246000fd5b600082614424576144246143ff565b500490565b60008282101561443b5761443b6143ca565b500390565b60006020828403121561445257600080fd5b5051919050565b600063ffffffff808316818516808303821115614478576144786143ca565b01949350505050565b85815263ffffffff851660208201526102006040820181905260009082015283516001600160a01b03166060820152610220810160208501516001600160a01b03811660808401525060408501516001600160a01b03811660a084015250606085015180151560c084015250608085015160e083015260a0850151610100818185015260c08701519150610120828186015260e0880151925061014083818701528289015161016087015281890151610180870152808901516101a08701525050505061455a6101c08301856001600160a01b03169052565b6001600160a01b0383166101e08301529695505050505050565b60008219821115614587576145876143ca565b500190565b600060ff82168061459f5761459f6143ca565b6000190192915050565b6001600160a01b038316815260406020820181905260009061337b908301846141c3565b600082516145df818460208701614197565b9190910192915050565b60208082526013908201527219195b1959d85d1958d85b1b0819985a5b1959606a1b604082015260600190565b600081518084526020808501945080840160005b8381101561464f5781516001600160a01b03168752958201959082019060010161462a565b509495945050505050565b600081518084526020808501945080840160005b8381101561464f5781518752958201959082019060010161466e565b85815260a0602082015260006146a360a0830187614616565b82810360408401526146b5818761465a565b905082810360608401526146c9818661465a565b905082810360808401526146dd818561465a565b98975050505050505050565b63ffffffff8516815260ff84166020820152608060408201526000614711608083018561465a565b905082606083015295945050505050565b634e487b7160e01b600052603260045260246000fd5b6000808335601e1984360301811261474f57600080fd5b83018035915067ffffffffffffffff82111561476a57600080fd5b60200191503681900382131561477f57600080fd5b9250929050565b8183823760009101908152919050565b6000602082840312156147a857600080fd5b815167ffffffffffffffff8111156147bf57600080fd5b8201601f810184136147d057600080fd5b80516147de613f0582614277565b8181528560208385010111156147f357600080fd5b612cc1826020830160208601614197565b60208152600061337e60208301846141c3565b600060018201614829576148296143ca565b5060010190565b600080821280156001600160ff1b0384900385131615614852576148526143ca565b600160ff1b839003841281161561486b5761486b6143ca565b50500190565b60008083128015600160ff1b85018412161561488f5761488f6143ca565b6001600160ff1b03840183138116156148aa576148aa6143ca565b50500390565b6000602082840312156148c257600080fd5b6040516020810181811067ffffffffffffffff821117156148e5576148e5613e79565b6040529151825250919050565b60208152815160208201526000602083015160e0604084015261491961010084018261465a565b90506040840151601f1980858403016060860152614937838361465a565b92506060860151915080858403016080860152614954838361465a565b9250608086015160a086015260ff60a08701511660c086015260c08601519150808584030160e086015250612cc18282614616565b600061ffff8084168061499e5761499e6143ff565b92169190910692915050565b600063ffffffff8083168181036149c3576149c36143ca565b600101939250505056fea2646970667358221220c0f77367fbe7680ae33ec5e4f8cd016f3ab7286f7ccd46b4b1294ff178ce5ac664736f6c634300080d0033", + "deployedBytecode": "0x60806040526004361061027f5760003560e01c8063625997c01161014f578063a5841194116100c1578063dd70e5e81161007a578063dd70e5e814610848578063e0f339e314610868578063e40064d714610888578063e460e35c146108b5578063f0056a7d146108d5578063f2fde38b1461097a5761028e565b8063a584119414610774578063ac9650d814610794578063b60c2d7d146107b4578063b9a3c84c146107d4578063c28f439214610808578063cd949995146108285761028e565b80637998a1c4116101135780637998a1c4146106ca57806380c09a82146106e057806380f323a7146107005780638bda0c00146107165780638da5cb5b14610736578063a16fd6e9146107545761028e565b8063625997c01461063a57806369b625021461028c5780636ad0690a1461064f578063715018a61461068157806376ec08dd146106965761028e565b806322f8e566116101f35780633fc8cef3116101ac5780633fc8cef3146105025780634144fd61146105365780634f7473ff146105c757806356688700146105dd57806356864f38146105f05780635c975abb146106105761028e565b806322f8e5661461044d578063240f475f1461046d57806329cb924d1461048d5780632d0f6f84146104a25780632d32d557146104c257806333dc09ca146104e25761028e565b80630ee28a88116102455780630ee28a881461038a57806310b99527146103aa57806311cfc159146103ca57806316c38b3c146103e05780631c39c38d1461040057806322395aaa146104385761028e565b8062660b5314610296578062c99206146102b6578063084d0513146102d657806309474ae2146103095780630c501af91461036a5761028e565b3661028e5761028c61099a565b005b61028c61099a565b3480156102a257600080fd5b5061028c6102b1366004613cf9565b610a23565b3480156102c257600080fd5b5061028c6102d1366004613d25565b610b6f565b3480156102e257600080fd5b506102f66102f1366004613cf9565b610d70565b6040519081526020015b60405180910390f35b34801561031557600080fd5b5061034a610324366004613d25565b600a60205260009081526040902080546001909101546001600160a01b03918216911682565b604080516001600160a01b03938416815292909116602083015201610300565b34801561037657600080fd5b5061028c610385366004613d3e565b610d9c565b34801561039657600080fd5b5061028c6103a5366004613d69565b610e43565b3480156103b657600080fd5b5061028c6103c5366004613dab565b6110c7565b3480156103d657600080fd5b506102f6600c5481565b3480156103ec57600080fd5b5061028c6103fb366004613de2565b611175565b34801561040c57600080fd5b50600054610420906001600160a01b031681565b6040516001600160a01b039091168152602001610300565b34801561044457600080fd5b5061028c6111f1565b34801561045957600080fd5b5061028c610468366004613d25565b6115c3565b34801561047957600080fd5b50600e54610420906001600160a01b031681565b34801561049957600080fd5b506102f661161e565b3480156104ae57600080fd5b5061028c6104bd366004613d3e565b6116af565b3480156104ce57600080fd5b506104206104dd366004613dff565b61172d565b3480156104ee57600080fd5b5061028c6104fd366004613cf9565b61175e565b34801561050e57600080fd5b506104207f000000000000000000000000000000000000000000000000000000000000000081565b34801561054257600080fd5b5060025460035460045460055460065461058094939291906001600160a01b03811690600160a01b810460ff1690600160a81b900463ffffffff1687565b6040805197885260208801969096529486019390935260608501919091526001600160a01b0316608084015260ff1660a083015263ffffffff1660c082015260e001610300565b3480156105d357600080fd5b506102f6600f5481565b61028c6105eb366004613cf9565b6119d9565b3480156105fc57600080fd5b5061028c61060b366004613e2f565b611cb5565b34801561061c57600080fd5b5060075461062a9060ff1681565b6040519015158152602001610300565b34801561064657600080fd5b5061028c611d9d565b34801561065b57600080fd5b5060125461066c9063ffffffff1681565b60405163ffffffff9091168152602001610300565b34801561068d57600080fd5b5061028c611e81565b3480156106a257600080fd5b506104207f000000000000000000000000000000000000000000000000000000000000000081565b3480156106d657600080fd5b506102f6600b5481565b3480156106ec57600080fd5b5061028c6106fb366004613fc4565b611eb5565b34801561070c57600080fd5b506102f660115481565b34801561072257600080fd5b5061028c6107313660046140ba565b612238565b34801561074257600080fd5b506001546001600160a01b0316610420565b34801561076057600080fd5b506102f661076f366004613d3e565b612402565b34801561078057600080fd5b5061028c61078f366004613d3e565b61242e565b6107a76107a2366004614122565b61244f565b60405161030091906141ef565b3480156107c057600080fd5b5061028c6107cf366004613d3e565b6125f5565b3480156107e057600080fd5b506104207f000000000000000000000000000000000000000000000000000000000000000081565b34801561081457600080fd5b50601054610420906001600160a01b031681565b34801561083457600080fd5b5061028c610843366004614251565b6127b4565b34801561085457600080fd5b5061028c61086336600461429f565b612882565b34801561087457600080fd5b506102f6610883366004613d3e565b6128ce565b34801561089457600080fd5b506102f66108a3366004613d3e565b600d6020526000908152604090205481565b3480156108c157600080fd5b5061028c6108d0366004613dab565b6128e9565b3480156108e157600080fd5b506109386108f0366004613d3e565b60096020526000908152604090208054600182015460028301546003909301546001600160a01b03831693600160a01b840460ff1693600160a81b900463ffffffff16929186565b604080516001600160a01b039097168752941515602087015263ffffffff909316938501939093526060840152608083019190915260a082015260c001610300565b34801561098657600080fd5b5061028c610995366004613d3e565b6129c2565b600054600160a01b900460ff1615610a21577f00000000000000000000000000000000000000000000000000000000000000006001600160a01b031663d0e30db0346040518263ffffffff1660e01b81526004016000604051808303818588803b158015610a0757600080fd5b505af1158015610a1b573d6000803e3d6000fd5b50505050505b565b6001546001600160a01b03163314610a565760405162461bcd60e51b8152600401610a4d90614324565b60405180910390fd5b610a5e612a5a565b610a66612ab3565b670de0b6b3a7640000811115610abe5760405162461bcd60e51b815260206004820152601960248201527f4261642070726f746f636f6c46656543617074757265506374000000000000006044820152606401610a4d565b6001600160a01b038216610b145760405162461bcd60e51b815260206004820152601d60248201527f4261642070726f746f636f6c46656543617074757265416464726573730000006044820152606401610a4d565b600e80546001600160a01b0319166001600160a01b038416908117909155600f8290556040518291907fc1993b89fd79a19ece7beb067ddc8534ca26d29c0ff94ea2f53b4a508d1eedc990600090a3610b6b612ac2565b5050565b6001546001600160a01b03163314610b995760405162461bcd60e51b8152600401610a4d90614324565b600654600160a01b900460ff1615610bc35760405162461bcd60e51b8152600401610a4d90614359565b610bcb612a5a565b610bd3612ab3565b6040516302abf57960e61b8152721259195b9d1a599a595c95da1a5d195b1a5cdd606a1b60048201526000907f00000000000000000000000000000000000000000000000000000000000000006001600160a01b03169063aafd5e4090602401602060405180830381865afa158015610c50573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610c749190614390565b6040516390978d1b60e01b8152600481018490529091506001600160a01b038216906390978d1b90602401602060405180830381865afa158015610cbc573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610ce091906143ad565b610d2c5760405162461bcd60e51b815260206004820152601860248201527f4964656e746966696572206e6f7420737570706f7274656400000000000000006044820152606401610a4d565b600b8290556040518281527ff45367c278fcceff23d601ce4bdd191e5bd61687ff9f29dc7276a08fe54c0c5d9060200160405180910390a150610d6d612ac2565b50565b6000610d7a612a5a565b610d82612ab3565b610d8c8383612ad7565b9050610d96612ac2565b92915050565b6001546001600160a01b03163314610dc65760405162461bcd60e51b8152600401610a4d90614324565b610dce612a5a565b610dd6612ab3565b6001600160a01b03818116600081815260096020908152604091829020805460ff60a01b1981169091558251938452909316928201929092527fac111b3b527b307393c94d98f26140effb71411054466818be97912d2d65f77691015b60405180910390a1610d6d612ac2565b610e4b612a5a565b610e53612ab3565b826001600160a01b03167f00000000000000000000000000000000000000000000000000000000000000006001600160a01b03161480610e91575080155b610ecd5760405162461bcd60e51b815260206004820152600d60248201526c086c2dce840e6cadcc840cae8d609b1b6044820152606401610a4d565b6000670de0b6b3a7640000610ee185612bcf565b610eeb90856143e0565b610ef59190614415565b6001600160a01b038581166000908152600960205260409081902054905163079cc67960e41b81523360048201526024810187905292935016906379cc6790906044016020604051808303816000875af1158015610f57573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610f7b91906143ad565b506001600160a01b03841660009081526009602052604081206002018054839290610fa7908490614429565b9091555050811561105f57604051632e1a7d4d60e01b8152600481018290527f00000000000000000000000000000000000000000000000000000000000000006001600160a01b031690632e1a7d4d90602401600060405180830381600087803b15801561101457600080fd5b505af1158015611028573d6000803e3d6000fd5b505060405133925083156108fc02915083906000818181858888f19350505050158015611059573d6000803e3d6000fd5b50611073565b6110736001600160a01b0385163383612cca565b604080518281526020810185905233916001600160a01b038716917fcda1185f28599e6bd14ab8a68b3c30a11e1dce4256b5e67e94dd3fd846a6c589910160405180910390a3506110c2612ac2565b505050565b6001546001600160a01b031633146110f15760405162461bcd60e51b8152600401610a4d90614324565b6110f9612a5a565b611101612ab3565b80600860006111108587612d2d565b815260208101919091526040908101600090812080546001600160a01b0319166001600160a01b0394851617905590518383169285169186917f234e7af08f77827792cc909447f27d2e6a3e2d839b04e26b50b71704a131c8a89190a46110c2612ac2565b6001546001600160a01b0316331461119f5760405162461bcd60e51b8152600401610a4d90614324565b6111a7612a5a565b6111af612ab3565b6007805460ff19168215159081179091556040517f0e2fb031ee032dc02d8011dc50b816eb450cf856abd8261680dac74f72165bd290600090a2610d6d612ac2565b6111f9612a5a565b611201612ab3565b600061120b61161e565b60065490915063ffffffff600160a81b909104811690821611156112715760405162461bcd60e51b815260206004820152601760248201527f5265717565737420706173736564206c6976656e6573730000000000000000006044820152606401610a4d565b600061127b612d6a565b905060115481106112955761128e612e70565b505061159c565b600061129f612f4f565b6011546010549192506112bd916001600160a01b0316908390612ff3565b806001600160a01b031663af355d1e600b5485601060009054906101000a90046001600160a01b03166000876011546112f69190614429565b60125460065460405160e089901b6001600160e01b0319168152600481019790975263ffffffff9586166024880152610120604488015260006101248801526001600160a01b039485166064880152608487019390935260a48601919091529290921660c48401521660e4820152670de0b6b3a7640000610104820152610144016020604051808303816000875af19250505080156113b2575060408051601f3d908101601f191682019092526113af91810190614440565b60015b6113c6576113be612e70565b50505061159c565b6010546113de906001600160a01b03168360006130a5565b5060408051610160810182526006546001600160a01b0390811682526000602083018190526010549091169282019290925260608101829052670de0b6b3a7640000608082015260a0810182905260125460c08201906114449063ffffffff1687614459565b63ffffffff168152602001600081526020018481526020018460115461146a9190614429565b815260125463ffffffff9081166020909201919091526000600281905560038190556004819055600555600680546001600160c81b03191690556011546010549293506114c5926001600160a01b031691339130916131ba16565b6011546010546114e2916001600160a01b03909116908490612ff3565b600b5460405163139c641960e31b81526001600160a01b03841691639ce320c89161151891908890869033903090600401614481565b6020604051808303816000875af1158015611537573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061155b9190614440565b5060405163ffffffff8516815233907f15951cb2ef6993bc23a55912e7d0bcac13e4797c432aaa334816aed6914a7a909060200160405180910390a2505050505b6115bb6115a7612f4f565b6010546001600160a01b03169060006130a5565b610a21612ac2565b6000546001600160a01b03166115d857600080fd5b60005460405163117c72b360e11b8152600481018390526001600160a01b03909116906322f8e56690602401600060405180830381600087803b158015610a0757600080fd5b600080546001600160a01b0316156116aa5760008054906101000a90046001600160a01b03166001600160a01b03166329cb924d6040518163ffffffff1660e01b8152600401602060405180830381865afa158015611681573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906116a59190614440565b905090565b504290565b6116b7612a5a565b6116bf612ab3565b6001600160a01b038082166000818152600d602052604081208054919055600e5490926116ee92911683612cca565b60405181906001600160a01b038416907f74740239d7d696c84422b720e125e1f47c4138c66d1f4d2a48e99f4197cdb79c90600090a350610d6d612ac2565b60006008600061173d8486612d2d565b81526020810191909152604001600020546001600160a01b03169392505050565b6001546001600160a01b031633146117885760405162461bcd60e51b8152600401610a4d90614324565b600654600160a01b900460ff16156117b25760405162461bcd60e51b8152600401610a4d90614359565b6117ba612a5a565b6117c2612ab3565b806000036118125760405162461bcd60e51b815260206004820152601760248201527f626f6e6420657175616c20746f2066696e616c206665650000000000000000006044820152606401610a4d565b6040516302abf57960e61b81527210dbdb1b185d195c985b15da1a5d195b1a5cdd606a1b60048201526000907f00000000000000000000000000000000000000000000000000000000000000006001600160a01b03169063aafd5e4090602401602060405180830381865afa15801561188f573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906118b39190614390565b604051631d1d5b3960e11b81526001600160a01b03858116600483015291925090821690633a3ab67290602401602060405180830381865afa1580156118fd573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061192191906143ad565b6119605760405162461bcd60e51b815260206004820152601060248201526f139bdd081bdb881dda1a5d195b1a5cdd60821b6044820152606401610a4d565b601080546001600160a01b0319166001600160a01b038516179055611983612d6a565b61198d9083614574565b60118190556040519081526001600160a01b038416907fbfa9a96010167e98ce8c004f718932cbbfd33a58d681c752e693be7d457a1b3b9060200160405180910390a250610b6b612ac2565b6119e1612a5a565b6119e9612ab3565b6001600160a01b038216600090815260096020526040902054600160a01b900460ff16611a4c5760405162461bcd60e51b8152602060048201526011602482015270151bdad95b881b9bdd08195b98589b1959607a1b6044820152606401610a4d565b816001600160a01b03167f00000000000000000000000000000000000000000000000000000000000000006001600160a01b0316148015611a8c57508034145b80611a95575034155b611ad15760405162461bcd60e51b815260206004820152600d60248201526c426164206d73672e76616c756560981b6044820152606401610a4d565b6000611adc83612bcf565b611aee83670de0b6b3a76400006143e0565b611af89190614415565b6001600160a01b038416600090815260096020526040812060020180549293508492909190611b28908490614574565b90915550506001600160a01b03838116600090815260096020526040908190205490516340c10f1960e01b8152336004820152602481018490529116906340c10f19906044016020604051808303816000875af1158015611b8d573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611bb191906143ad565b50826001600160a01b03167f00000000000000000000000000000000000000000000000000000000000000006001600160a01b0316148015611bf35750600034115b15611c5157826001600160a01b031663d0e30db0346040518263ffffffff1660e01b81526004016000604051808303818588803b158015611c3357600080fd5b505af1158015611c47573d6000803e3d6000fd5b5050505050611c66565b611c666001600160a01b0384163330856131ba565b604080518381526020810183905233916001600160a01b038616917f3c69701a61c79a92ef9692903aaa0068bce8771361ecb09547391e4fb4df8537910160405180910390a350610b6b612ac2565b611cbd612a5a565b611cc5612ab3565b6001546001600160a01b03163314611cef5760405162461bcd60e51b8152600401610a4d90614324565b6040516001600160a01b0383166024820152604481018490528115156064820152611d4890859060840160408051601f198184030181529190526020810180516001600160e01b031663272751c760e01b1790526131f2565b816001600160a01b031683857fb7d00a563842efb2c121a0eb02b7bb7ba1a34625bbc3d65057f1f0dbec0ec2a184604051611d87911515815260200190565b60405180910390a4611d97612ac2565b50505050565b6001546001600160a01b03163314611dc75760405162461bcd60e51b8152600401610a4d90614324565b611dcf612a5a565b611dd7612ab3565b600654600160a01b900460ff1615611e0a57600654601154601054611e0a926001600160a01b0391821692911690612cca565b6006546003546002546004546040519081526001600160a01b03909316927f993cba33f9b140c9ce20ba10d7eda92128d5beb6df856f064916108a11647a739060200160405180910390a46000600281905560038190556004819055600555600680546001600160c81b0319169055610a21612ac2565b6001546001600160a01b03163314611eab5760405162461bcd60e51b8152600401610a4d90614324565b610a2160006132f6565b611ebd612a5a565b611ec5612ab3565b60075460ff1615611f185760405162461bcd60e51b815260206004820181905260248201527f50726f706f73616c2070726f6365737320686173206265656e207061757365646044820152606401610a4d565b600654600160a81b900463ffffffff16611f3061161e565b11611f735760405162461bcd60e51b81526020600482015260136024820152724e6f7420706173736564206c6976656e65737360681b6044820152606401610a4d565b600554600160ff85161b90811603611fbf5760405162461bcd60e51b815260206004820152600f60248201526e105b1c9958591e4818db185a5b5959608a1b6044820152606401610a4d565b6120046002600001546040518060e001604052808b81526020018981526020018881526020018781526020018a81526020018660ff1681526020018581525083613348565b61203c5760405162461bcd60e51b81526020600482015260096024820152682130b210283937b7b360b91b6044820152606401610a4d565b6000806120488a613385565b9150915061205b60026003015486613451565b60055560068054600160a01b900460ff169060146120788361458c565b91906101000a81548160ff021916908360ff1602179055505061209f82828c878b8d613474565b886000036121a157600354600454604051602481019290925260448201526000906001600160a01b03841690839060640160408051601f198184030181529181526020820180516001600160e01b031663124e93e160e21b179052516121099291906024016145a9565b60408051601f198184030181529181526020820180516001600160e01b0316637375c56f60e11b1790525161213e91906145cd565b600060405180830381855af49150503d8060008114612179576040519150601f19603f3d011682016040523d82523d6000602084013e61217e565b606091505b505090508061219f5760405162461bcd60e51b8152600401610a4d906145e9565b505b600654600160a01b900460ff166000036121d6576006546011546010546121d6926001600160a01b0391821692911690612cca565b336001600160a01b03168a8660ff167ff652dd63b1aedbf9e740f3152fb67b0d94d069cf1182811ebd88921850d935678c888d8d8d60405161221c95949392919061468a565b60405180910390a4505061222e612ac2565b5050505050505050565b612240612a5a565b612248612ab3565b600654600160a01b900460ff16156122725760405162461bcd60e51b8152600401610a4d90614359565b60075460ff16156122c55760405162461bcd60e51b815260206004820181905260248201527f50726f706f73616c2070726f6365737320686173206265656e207061757365646044820152606401610a4d565b60008460ff16116123185760405162461bcd60e51b815260206004820181905260248201527f42756e646c65206d7573742068617665206174206c656173742031206c6561666044820152606401610a4d565b60125460009063ffffffff1661232c61161e565b6123369190614459565b60006005556006805460028790556003869055600485905560ff8816600160a01b0263ffffffff808516600160a81b0260ff60a01b19166001600160c81b031990931692909217176001600160a01b031916339081179092556011546010549394506123b0936001600160a01b031692913091906131ba16565b336001600160a01b031683857f50e585dd6361c7cb2613ce2334814bb2a789f5a8ad4b161fe0e248043737d1d284898b886040516123f194939291906146e9565b60405180910390a450610a1b612ac2565b600061240c612a5a565b612414612ab3565b61241f826000612ad7565b9050612429612ac2565b919050565b612436612a5a565b61243e612ab3565b61244781613738565b610d6d612ac2565b6060341561249f5760405162461bcd60e51b815260206004820152601b60248201527f4f6e6c79206d756c746963616c6c207769746820302076616c756500000000006044820152606401610a4d565b8167ffffffffffffffff8111156124b8576124b8613e79565b6040519080825280602002602001820160405280156124eb57816020015b60608152602001906001900390816124d65790505b50905060005b828110156125ee576000803086868581811061250f5761250f614722565b90506020028101906125219190614738565b60405161252f929190614786565b600060405180830381855af49150503d806000811461256a576040519150601f19603f3d011682016040523d82523d6000602084013e61256f565b606091505b5091509150816125bb5760448151101561258857600080fd5b600481019050808060200190518101906125a29190614796565b60405162461bcd60e51b8152600401610a4d9190614804565b808484815181106125ce576125ce614722565b6020026020010181905250505080806125e690614817565b9150506124f1565b5092915050565b6001546001600160a01b0316331461261f5760405162461bcd60e51b8152600401610a4d90614324565b612627612a5a565b61262f612ab3565b6001600160a01b038181166000908152600960205260409020541661274d57604051637e178db760e11b81526001600160a01b0382811660048301527f0000000000000000000000000000000000000000000000000000000000000000169063fc2f1b6e906024016020604051808303816000875af11580156126b6573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906126da9190614390565b6001600160a01b03828116600090815260096020526040902080546001600160a01b0319169290911691909117905561271161161e565b6001600160a01b0382166000908152600960205260409020805463ffffffff92909216600160a81b0263ffffffff60a81b199092169190911790555b6001600160a01b038181166000818152600960209081526040918290208054600160a01b60ff60a01b198216179091558251938452909316928201929092527f04e291c80180d65a57b5bf1bed775777ec0d6f283ef34bcf130712714d8bb7f79101610e33565b6001546001600160a01b031633146127de5760405162461bcd60e51b8152600401610a4d90614324565b6127e6612a5a565b6127ee612ab3565b6102588163ffffffff161161283a5760405162461bcd60e51b8152602060048201526012602482015271131a5d995b995cdcc81d1bdbc81cda1bdc9d60721b6044820152606401610a4d565b6012805463ffffffff191663ffffffff83169081179091556040519081527f04dd1d84d387f404568a7954b5e398518bdd716e1a8f4a790be9a1a225ad934790602001610e33565b6001546001600160a01b031633146128ac5760405162461bcd60e51b8152600401610a4d90614324565b6128b4612a5a565b6128bc612ab3565b6128c682826131f2565b610b6b612ac2565b60006128d8612a5a565b6128e0612ab3565b61241f82612bcf565b6001546001600160a01b031633146129135760405162461bcd60e51b8152600401610a4d90614324565b61291b612a5a565b612923612ab3565b6040805180820182526001600160a01b03848116808352848216602080850182815260008a8152600a8352879020955186549086166001600160a01b031991821617875590516001909601805496909516951694909417909255835187815292830152918101919091527f36050d958750e6ac3aa674ac7bbe8d0ae6a2f7d4b808e8c2c42c1f22fc9fc4bb9060600160405180910390a16110c2612ac2565b6001546001600160a01b031633146129ec5760405162461bcd60e51b8152600401610a4d90614324565b6001600160a01b038116612a515760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201526564647265737360d01b6064820152608401610a4d565b610d6d816132f6565b600054600160a01b900460ff16610a215760405162461bcd60e51b815260206004820152601f60248201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c006044820152606401610a4d565b6000805460ff60a01b19169055565b6000805460ff60a01b1916600160a01b179055565b6000612ae283613738565b6001600160a01b038381166000908152600960209081526040808320815160c08101835281549586168152600160a01b860460ff16151593810193909352600160a81b90940463ffffffff16908201526001830154606082018190526002840154608083015260039093015460a0820152918112612b61576000612b67565b81606001515b90506000612b758286614574565b90506000828460800151612b899190614574565b905080600003612ba757670de0b6b3a7640000945050505050610d96565b80612bba83670de0b6b3a76400006143e0565b612bc49190614415565b979650505050505050565b6001600160a01b038082166000908152600960209081526040808320805482516318160ddd60e01b8152925194959194869491909216926318160ddd92600480830193928290030181865afa158015612c2c573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190612c509190614440565b905080600003612c6b5750670de0b6b3a76400009392505050565b612c7482613887565b612c7d84613738565b6000826003015483600101548460020154612c989190614830565b612ca29190614871565b905081612cb782670de0b6b3a76400006143e0565b612cc19190614415565b95945050505050565b6040516001600160a01b0383166024820152604481018290526110c290849063a9059cbb60e01b906064015b60408051601f198184030181529190526020810180516001600160e01b03166001600160e01b0319909316929092179091526138ef565b604080516001600160a01b038416602082015290810182905260009060600160405160208183030381529060405280519060200120905092915050565b6040516302abf57960e61b81526453746f726560d81b60048201526000907f00000000000000000000000000000000000000000000000000000000000000006001600160a01b03169063aafd5e4090602401602060405180830381865afa158015612dd9573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190612dfd9190614390565b601054604051635b97aadd60e01b81526001600160a01b039182166004820152911690635b97aadd90602401602060405180830381865afa158015612e46573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190612e6a91906148b0565b51919050565b60105460065460115460405163a9059cbb60e01b81526001600160a01b039283166004820152602481019190915291169063a9059cbb906044016020604051808303816000875af1158015612ec9573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190612eed91906143ad565b506000600281905560038190556004819055600555600680546001600160c81b0319169055337f0cfbbf45ab7f5225663454de7117b1b0ed5a7c133b61f54ccf367dcf8b6d4d59612f3c61161e565b60405190815260200160405180910390a2565b6040516302abf57960e61b815275536b696e6e794f7074696d69737469634f7261636c6560501b60048201526000907f00000000000000000000000000000000000000000000000000000000000000006001600160a01b03169063aafd5e4090602401602060405180830381865afa158015612fcf573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906116a59190614390565b604051636eb1769f60e11b81523060048201526001600160a01b038381166024830152600091839186169063dd62ed3e90604401602060405180830381865afa158015613044573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906130689190614440565b6130729190614574565b6040516001600160a01b038516602482015260448101829052909150611d9790859063095ea7b360e01b90606401612cf6565b80158061311f5750604051636eb1769f60e11b81523060048201526001600160a01b03838116602483015284169063dd62ed3e90604401602060405180830381865afa1580156130f9573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061311d9190614440565b155b61318a5760405162461bcd60e51b815260206004820152603660248201527f5361666545524332303a20617070726f76652066726f6d206e6f6e2d7a65726f60448201527520746f206e6f6e2d7a65726f20616c6c6f77616e636560501b6064820152608401610a4d565b6040516001600160a01b0383166024820152604481018290526110c290849063095ea7b360e01b90606401612cf6565b6040516001600160a01b0380851660248301528316604482015260648101829052611d979085906323b872dd60e01b90608401612cf6565b6000806131fe84613385565b915091506000826001600160a01b031682856040516024016132219291906145a9565b60408051601f198184030181529181526020820180516001600160e01b0316637375c56f60e11b1790525161325691906145cd565b600060405180830381855af49150503d8060008114613291576040519150601f19603f3d011682016040523d82523d6000602084013e613296565b606091505b50509050806132b75760405162461bcd60e51b8152600401610a4d906145e9565b847f218987b934c2f6bc596136829fbf43a5fef4d6fafce41f3f6254d9a870c2deec856040516132e79190614804565b60405180910390a25050505050565b600180546001600160a01b038381166001600160a01b0319831681179093556040519116919082907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e090600090a35050565b600061337b82858560405160200161336091906148f2565b604051602081830303815290604052805190602001206139c1565b90505b9392505050565b6000818152600a6020526040902080546001909101546001600160a01b039182169116806133f55760405162461bcd60e51b815260206004820152601960248201527f53706f6b65506f6f6c206e6f7420696e697469616c697a6564000000000000006044820152606401610a4d565b6001600160a01b0382163b61344c5760405162461bcd60e51b815260206004820152601760248201527f41646170746572206e6f7420696e697469616c697a65640000000000000000006044820152606401610a4d565b915091565b600061346261010060ff8416614989565b61ffff166001901b8317905092915050565b60005b83518163ffffffff16101561372f576000848263ffffffff16815181106134a0576134a0614722565b602002602001015190506000600860006134ba848a612d2d565b81526020810191909152604001600020546001600160a01b031690508061351b5760405162461bcd60e51b8152602060048201526015602482015274149bdd5d19481b9bdd081dda1a5d195b1a5cdd1959605a1b6044820152606401610a4d565b6000858463ffffffff168151811061353557613535614722565b602002602001015113156136f1576000896001600160a01b03168383888763ffffffff168151811061356957613569614722565b60209081029190910101516040516001600160a01b03938416602482015291831660448301526064820152908b16608482015260a40160408051601f198184030181529181526020820180516001600160e01b03166314b231d760e21b179052516135d491906145cd565b600060405180830381855af49150503d806000811461360f576040519150601f19603f3d011682016040523d82523d6000602084013e613614565b606091505b50509050806136355760405162461bcd60e51b8152600401610a4d906145e9565b858463ffffffff168151811061364d5761364d614722565b602002602001015160096000856001600160a01b03166001600160a01b03168152602001908152602001600020600101600082825461368c9190614830565b92505081905550858463ffffffff16815181106136ab576136ab614722565b602002602001015160096000856001600160a01b03166001600160a01b0316815260200190815260200160002060020160008282546136ea9190614429565b9091555050505b61371a82858563ffffffff168151811061370d5761370d614722565b60200260200101516139d7565b50508080613727906149aa565b915050613477565b50505050505050565b6040516370a0823160e01b81523060048201526000906001600160a01b038316906370a0823190602401602060405180830381865afa15801561377f573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906137a39190614440565b6010549091506000906001600160a01b0384811691161480156137d15750600654600160a01b900460ff1615155b6137db57816137e8565b6011546137e89083614429565b6001600160a01b0384166000908152600960205260409020600201549091508111156110c2576001600160a01b0383166000908152600960205260409020600201546138349082614429565b6001600160a01b0384166000908152600960205260408120600101805490919061385f908490614871565b90915550506001600160a01b0383166000908152600960205260409020600201819055505050565b600381015481546000916138a791600160a81b900463ffffffff16613aaa565b9050808260030160008282546138bd9190614429565b909155506138cb905061161e565b825463ffffffff91909116600160a81b0263ffffffff60a81b199091161790915550565b6000613944826040518060400160405280602081526020017f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c6564815250856001600160a01b0316613b079092919063ffffffff16565b8051909150156110c2578080602001905181019061396291906143ad565b6110c25760405162461bcd60e51b815260206004820152602a60248201527f5361666545524332303a204552433230206f7065726174696f6e20646964206e6044820152691bdd081cdd58d8d9595960b21b6064820152608401610a4d565b6000826139ce8584613b16565b14949350505050565b6000670de0b6b3a7640000600f54836139f091906143e0565b6139fa9190614415565b90506000613a088284614429565b90508015613a71576001600160a01b03841660009081526009602052604081206003018054839290613a3b908490614574565b90915550506001600160a01b03841660009081526009602052604081206001018054839290613a6b908490614830565b90915550505b8115611d97576001600160a01b0384166000908152600d602052604081208054849290613a9f908490614574565b909155505050505050565b60008082613ab661161e565b613ac09190614429565b90506000670de0b6b3a764000082600c5487613adc91906143e0565b613ae691906143e0565b613af09190614415565b9050848110613aff5784612cc1565b949350505050565b606061337b8484600085613b8a565b600081815b8451811015613b82576000858281518110613b3857613b38614722565b60200260200101519050808311613b5e5760008381526020829052604090209250613b6f565b600081815260208490526040902092505b5080613b7a81614817565b915050613b1b565b509392505050565b606082471015613beb5760405162461bcd60e51b815260206004820152602660248201527f416464726573733a20696e73756666696369656e742062616c616e636520666f6044820152651c8818d85b1b60d21b6064820152608401610a4d565b6001600160a01b0385163b613c425760405162461bcd60e51b815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e74726163740000006044820152606401610a4d565b600080866001600160a01b03168587604051613c5e91906145cd565b60006040518083038185875af1925050503d8060008114613c9b576040519150601f19603f3d011682016040523d82523d6000602084013e613ca0565b606091505b5091509150612bc482828660608315613cba57508161337e565b825115613cca5782518084602001fd5b8160405162461bcd60e51b8152600401610a4d9190614804565b6001600160a01b0381168114610d6d57600080fd5b60008060408385031215613d0c57600080fd5b8235613d1781613ce4565b946020939093013593505050565b600060208284031215613d3757600080fd5b5035919050565b600060208284031215613d5057600080fd5b813561337e81613ce4565b8015158114610d6d57600080fd5b600080600060608486031215613d7e57600080fd5b8335613d8981613ce4565b9250602084013591506040840135613da081613d5b565b809150509250925092565b600080600060608486031215613dc057600080fd5b833592506020840135613dd281613ce4565b91506040840135613da081613ce4565b600060208284031215613df457600080fd5b813561337e81613d5b565b60008060408385031215613e1257600080fd5b823591506020830135613e2481613ce4565b809150509250929050565b60008060008060808587031215613e4557600080fd5b84359350602085013592506040850135613e5e81613ce4565b91506060850135613e6e81613d5b565b939692955090935050565b634e487b7160e01b600052604160045260246000fd5b604051601f8201601f1916810167ffffffffffffffff81118282101715613eb857613eb8613e79565b604052919050565b600067ffffffffffffffff821115613eda57613eda613e79565b5060051b60200190565b600082601f830112613ef557600080fd5b81356020613f0a613f0583613ec0565b613e8f565b82815260059290921b84018101918181019086841115613f2957600080fd5b8286015b84811015613f445780358352918301918301613f2d565b509695505050505050565b803560ff8116811461242957600080fd5b600082601f830112613f7157600080fd5b81356020613f81613f0583613ec0565b82815260059290921b84018101918181019086841115613fa057600080fd5b8286015b84811015613f44578035613fb781613ce4565b8352918301918301613fa4565b600080600080600080600080610100898b031215613fe157600080fd5b8835975060208901359650604089013567ffffffffffffffff8082111561400757600080fd5b6140138c838d01613ee4565b975060608b013591508082111561402957600080fd5b6140358c838d01613ee4565b965060808b013591508082111561404b57600080fd5b6140578c838d01613ee4565b955061406560a08c01613f4f565b945060c08b013591508082111561407b57600080fd5b6140878c838d01613f60565b935060e08b013591508082111561409d57600080fd5b506140aa8b828c01613ee4565b9150509295985092959890939650565b600080600080600060a086880312156140d257600080fd5b853567ffffffffffffffff8111156140e957600080fd5b6140f588828901613ee4565b95505061410460208701613f4f565b94979496505050506040830135926060810135926080909101359150565b6000806020838503121561413557600080fd5b823567ffffffffffffffff8082111561414d57600080fd5b818501915085601f83011261416157600080fd5b81358181111561417057600080fd5b8660208260051b850101111561418557600080fd5b60209290920196919550909350505050565b60005b838110156141b257818101518382015260200161419a565b83811115611d975750506000910152565b600081518084526141db816020860160208601614197565b601f01601f19169290920160200192915050565b6000602080830181845280855180835260408601915060408160051b870101925083870160005b8281101561424457603f198886030184526142328583516141c3565b94509285019290850190600101614216565b5092979650505050505050565b60006020828403121561426357600080fd5b813563ffffffff8116811461337e57600080fd5b600067ffffffffffffffff82111561429157614291613e79565b50601f01601f191660200190565b600080604083850312156142b257600080fd5b82359150602083013567ffffffffffffffff8111156142d057600080fd5b8301601f810185136142e157600080fd5b80356142ef613f0582614277565b81815286602083850101111561430457600080fd5b816020840160208301376000602083830101528093505050509250929050565b6020808252818101527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604082015260600190565b6020808252601d908201527f50726f706f73616c2068617320756e636c61696d6564206c6561766573000000604082015260600190565b6000602082840312156143a257600080fd5b815161337e81613ce4565b6000602082840312156143bf57600080fd5b815161337e81613d5b565b634e487b7160e01b600052601160045260246000fd5b60008160001904831182151516156143fa576143fa6143ca565b500290565b634e487b7160e01b600052601260045260246000fd5b600082614424576144246143ff565b500490565b60008282101561443b5761443b6143ca565b500390565b60006020828403121561445257600080fd5b5051919050565b600063ffffffff808316818516808303821115614478576144786143ca565b01949350505050565b85815263ffffffff851660208201526102006040820181905260009082015283516001600160a01b03166060820152610220810160208501516001600160a01b03811660808401525060408501516001600160a01b03811660a084015250606085015180151560c084015250608085015160e083015260a0850151610100818185015260c08701519150610120828186015260e0880151925061014083818701528289015161016087015281890151610180870152808901516101a08701525050505061455a6101c08301856001600160a01b03169052565b6001600160a01b0383166101e08301529695505050505050565b60008219821115614587576145876143ca565b500190565b600060ff82168061459f5761459f6143ca565b6000190192915050565b6001600160a01b038316815260406020820181905260009061337b908301846141c3565b600082516145df818460208701614197565b9190910192915050565b60208082526013908201527219195b1959d85d1958d85b1b0819985a5b1959606a1b604082015260600190565b600081518084526020808501945080840160005b8381101561464f5781516001600160a01b03168752958201959082019060010161462a565b509495945050505050565b600081518084526020808501945080840160005b8381101561464f5781518752958201959082019060010161466e565b85815260a0602082015260006146a360a0830187614616565b82810360408401526146b5818761465a565b905082810360608401526146c9818661465a565b905082810360808401526146dd818561465a565b98975050505050505050565b63ffffffff8516815260ff84166020820152608060408201526000614711608083018561465a565b905082606083015295945050505050565b634e487b7160e01b600052603260045260246000fd5b6000808335601e1984360301811261474f57600080fd5b83018035915067ffffffffffffffff82111561476a57600080fd5b60200191503681900382131561477f57600080fd5b9250929050565b8183823760009101908152919050565b6000602082840312156147a857600080fd5b815167ffffffffffffffff8111156147bf57600080fd5b8201601f810184136147d057600080fd5b80516147de613f0582614277565b8181528560208385010111156147f357600080fd5b612cc1826020830160208601614197565b60208152600061337e60208301846141c3565b600060018201614829576148296143ca565b5060010190565b600080821280156001600160ff1b0384900385131615614852576148526143ca565b600160ff1b839003841281161561486b5761486b6143ca565b50500190565b60008083128015600160ff1b85018412161561488f5761488f6143ca565b6001600160ff1b03840183138116156148aa576148aa6143ca565b50500390565b6000602082840312156148c257600080fd5b6040516020810181811067ffffffffffffffff821117156148e5576148e5613e79565b6040529151825250919050565b60208152815160208201526000602083015160e0604084015261491961010084018261465a565b90506040840151601f1980858403016060860152614937838361465a565b92506060860151915080858403016080860152614954838361465a565b9250608086015160a086015260ff60a08701511660c086015260c08601519150808584030160e086015250612cc18282614616565b600061ffff8084168061499e5761499e6143ff565b92169190910692915050565b600063ffffffff8083168181036149c3576149c36143ca565b600101939250505056fea2646970667358221220c0f77367fbe7680ae33ec5e4f8cd016f3ab7286f7ccd46b4b1294ff178ce5ac664736f6c634300080d0033", "libraries": { - "MerkleLib": "0x0aF162c78f095bC5924d5a3363aEfd6700962f6B" + "MerkleLib": "0x0668ab3839346ebf95d969b3e18B2a96b1CC2b02" } } diff --git a/deployments/rinkeby/LpTokenFactory.json b/deployments/rinkeby/LpTokenFactory.json index 86b86a13b..1bd08ca1b 100644 --- a/deployments/rinkeby/LpTokenFactory.json +++ b/deployments/rinkeby/LpTokenFactory.json @@ -1,5 +1,5 @@ { - "address": "0x0aF162c78f095bC5924d5a3363aEfd6700962f6B", + "address": "0x0668ab3839346ebf95d969b3e18B2a96b1CC2b02", "abi": [ { "inputs": [ @@ -21,36 +21,50 @@ "type": "function" } ], - "transactionHash": "0xd23a65a464bb4729bf16b3123ff9d300c20fe898edd870b8dad86659ac995833", + "transactionHash": "0xf553846472e6c15ab42343490f10830ef8afb7b0f572283a6e8ed2579b983443", "receipt": { "to": null, "from": "0x9A8f92a830A5cB89a3816e3D267CB7791c16b04D", - "contractAddress": "0x0aF162c78f095bC5924d5a3363aEfd6700962f6B", - "transactionIndex": 24, - "gasUsed": "2519000", + "contractAddress": "0x0668ab3839346ebf95d969b3e18B2a96b1CC2b02", + "transactionIndex": 21, + "gasUsed": "2546113", "logsBloom": "0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", - "blockHash": "0x7cffd18d6536676e78f24095c769628398ae5c879aec329bde2e0713633170bb", - "transactionHash": "0xd23a65a464bb4729bf16b3123ff9d300c20fe898edd870b8dad86659ac995833", + "blockHash": "0xd7a21a292bde96bdfbbe4a08ee35d8a9b8fbbc8d43eff80bf96e0887cbda135c", + "transactionHash": "0xf553846472e6c15ab42343490f10830ef8afb7b0f572283a6e8ed2579b983443", "logs": [], - "blockNumber": 10226902, - "cumulativeGasUsed": "7304076", + "blockNumber": 10365598, + "cumulativeGasUsed": "4920384", "status": 1, "byzantium": true }, "args": [], "numDeployments": 1, - "solcInputHash": "cee77d8f3a5225b985a9cf3439956316", - "metadata": "{\"compiler\":{\"version\":\"0.8.11+commit.d7f03943\"},\"language\":\"Solidity\",\"output\":{\"abi\":[{\"inputs\":[{\"internalType\":\"address\",\"name\":\"l1Token\",\"type\":\"address\"}],\"name\":\"createLpToken\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"nonpayable\",\"type\":\"function\"}],\"devdoc\":{\"kind\":\"dev\",\"methods\":{},\"version\":1},\"userdoc\":{\"kind\":\"user\",\"methods\":{},\"version\":1}},\"settings\":{\"compilationTarget\":{\"contracts/LpTokenFactory.sol\":\"LpTokenFactory\"},\"evmVersion\":\"london\",\"libraries\":{},\"metadata\":{\"bytecodeHash\":\"ipfs\",\"useLiteralContent\":true},\"optimizer\":{\"enabled\":true,\"runs\":1000000},\"remappings\":[]},\"sources\":{\"@openzeppelin/contracts/token/ERC20/ERC20.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts v4.4.1 (token/ERC20/ERC20.sol)\\n\\npragma solidity ^0.8.0;\\n\\nimport \\\"./IERC20.sol\\\";\\nimport \\\"./extensions/IERC20Metadata.sol\\\";\\nimport \\\"../../utils/Context.sol\\\";\\n\\n/**\\n * @dev Implementation of the {IERC20} interface.\\n *\\n * This implementation is agnostic to the way tokens are created. This means\\n * that a supply mechanism has to be added in a derived contract using {_mint}.\\n * For a generic mechanism see {ERC20PresetMinterPauser}.\\n *\\n * TIP: For a detailed writeup see our guide\\n * https://forum.zeppelin.solutions/t/how-to-implement-erc20-supply-mechanisms/226[How\\n * to implement supply mechanisms].\\n *\\n * We have followed general OpenZeppelin Contracts guidelines: functions revert\\n * instead returning `false` on failure. This behavior is nonetheless\\n * conventional and does not conflict with the expectations of ERC20\\n * applications.\\n *\\n * Additionally, an {Approval} event is emitted on calls to {transferFrom}.\\n * This allows applications to reconstruct the allowance for all accounts just\\n * by listening to said events. Other implementations of the EIP may not emit\\n * these events, as it isn't required by the specification.\\n *\\n * Finally, the non-standard {decreaseAllowance} and {increaseAllowance}\\n * functions have been added to mitigate the well-known issues around setting\\n * allowances. See {IERC20-approve}.\\n */\\ncontract ERC20 is Context, IERC20, IERC20Metadata {\\n mapping(address => uint256) private _balances;\\n\\n mapping(address => mapping(address => uint256)) private _allowances;\\n\\n uint256 private _totalSupply;\\n\\n string private _name;\\n string private _symbol;\\n\\n /**\\n * @dev Sets the values for {name} and {symbol}.\\n *\\n * The default value of {decimals} is 18. To select a different value for\\n * {decimals} you should overload it.\\n *\\n * All two of these values are immutable: they can only be set once during\\n * construction.\\n */\\n constructor(string memory name_, string memory symbol_) {\\n _name = name_;\\n _symbol = symbol_;\\n }\\n\\n /**\\n * @dev Returns the name of the token.\\n */\\n function name() public view virtual override returns (string memory) {\\n return _name;\\n }\\n\\n /**\\n * @dev Returns the symbol of the token, usually a shorter version of the\\n * name.\\n */\\n function symbol() public view virtual override returns (string memory) {\\n return _symbol;\\n }\\n\\n /**\\n * @dev Returns the number of decimals used to get its user representation.\\n * For example, if `decimals` equals `2`, a balance of `505` tokens should\\n * be displayed to a user as `5.05` (`505 / 10 ** 2`).\\n *\\n * Tokens usually opt for a value of 18, imitating the relationship between\\n * Ether and Wei. This is the value {ERC20} uses, unless this function is\\n * overridden;\\n *\\n * NOTE: This information is only used for _display_ purposes: it in\\n * no way affects any of the arithmetic of the contract, including\\n * {IERC20-balanceOf} and {IERC20-transfer}.\\n */\\n function decimals() public view virtual override returns (uint8) {\\n return 18;\\n }\\n\\n /**\\n * @dev See {IERC20-totalSupply}.\\n */\\n function totalSupply() public view virtual override returns (uint256) {\\n return _totalSupply;\\n }\\n\\n /**\\n * @dev See {IERC20-balanceOf}.\\n */\\n function balanceOf(address account) public view virtual override returns (uint256) {\\n return _balances[account];\\n }\\n\\n /**\\n * @dev See {IERC20-transfer}.\\n *\\n * Requirements:\\n *\\n * - `recipient` cannot be the zero address.\\n * - the caller must have a balance of at least `amount`.\\n */\\n function transfer(address recipient, uint256 amount) public virtual override returns (bool) {\\n _transfer(_msgSender(), recipient, amount);\\n return true;\\n }\\n\\n /**\\n * @dev See {IERC20-allowance}.\\n */\\n function allowance(address owner, address spender) public view virtual override returns (uint256) {\\n return _allowances[owner][spender];\\n }\\n\\n /**\\n * @dev See {IERC20-approve}.\\n *\\n * Requirements:\\n *\\n * - `spender` cannot be the zero address.\\n */\\n function approve(address spender, uint256 amount) public virtual override returns (bool) {\\n _approve(_msgSender(), spender, amount);\\n return true;\\n }\\n\\n /**\\n * @dev See {IERC20-transferFrom}.\\n *\\n * Emits an {Approval} event indicating the updated allowance. This is not\\n * required by the EIP. See the note at the beginning of {ERC20}.\\n *\\n * Requirements:\\n *\\n * - `sender` and `recipient` cannot be the zero address.\\n * - `sender` must have a balance of at least `amount`.\\n * - the caller must have allowance for ``sender``'s tokens of at least\\n * `amount`.\\n */\\n function transferFrom(\\n address sender,\\n address recipient,\\n uint256 amount\\n ) public virtual override returns (bool) {\\n _transfer(sender, recipient, amount);\\n\\n uint256 currentAllowance = _allowances[sender][_msgSender()];\\n require(currentAllowance >= amount, \\\"ERC20: transfer amount exceeds allowance\\\");\\n unchecked {\\n _approve(sender, _msgSender(), currentAllowance - amount);\\n }\\n\\n return true;\\n }\\n\\n /**\\n * @dev Atomically increases the allowance granted to `spender` by the caller.\\n *\\n * This is an alternative to {approve} that can be used as a mitigation for\\n * problems described in {IERC20-approve}.\\n *\\n * Emits an {Approval} event indicating the updated allowance.\\n *\\n * Requirements:\\n *\\n * - `spender` cannot be the zero address.\\n */\\n function increaseAllowance(address spender, uint256 addedValue) public virtual returns (bool) {\\n _approve(_msgSender(), spender, _allowances[_msgSender()][spender] + addedValue);\\n return true;\\n }\\n\\n /**\\n * @dev Atomically decreases the allowance granted to `spender` by the caller.\\n *\\n * This is an alternative to {approve} that can be used as a mitigation for\\n * problems described in {IERC20-approve}.\\n *\\n * Emits an {Approval} event indicating the updated allowance.\\n *\\n * Requirements:\\n *\\n * - `spender` cannot be the zero address.\\n * - `spender` must have allowance for the caller of at least\\n * `subtractedValue`.\\n */\\n function decreaseAllowance(address spender, uint256 subtractedValue) public virtual returns (bool) {\\n uint256 currentAllowance = _allowances[_msgSender()][spender];\\n require(currentAllowance >= subtractedValue, \\\"ERC20: decreased allowance below zero\\\");\\n unchecked {\\n _approve(_msgSender(), spender, currentAllowance - subtractedValue);\\n }\\n\\n return true;\\n }\\n\\n /**\\n * @dev Moves `amount` of tokens from `sender` to `recipient`.\\n *\\n * This internal function is equivalent to {transfer}, and can be used to\\n * e.g. implement automatic token fees, slashing mechanisms, etc.\\n *\\n * Emits a {Transfer} event.\\n *\\n * Requirements:\\n *\\n * - `sender` cannot be the zero address.\\n * - `recipient` cannot be the zero address.\\n * - `sender` must have a balance of at least `amount`.\\n */\\n function _transfer(\\n address sender,\\n address recipient,\\n uint256 amount\\n ) internal virtual {\\n require(sender != address(0), \\\"ERC20: transfer from the zero address\\\");\\n require(recipient != address(0), \\\"ERC20: transfer to the zero address\\\");\\n\\n _beforeTokenTransfer(sender, recipient, amount);\\n\\n uint256 senderBalance = _balances[sender];\\n require(senderBalance >= amount, \\\"ERC20: transfer amount exceeds balance\\\");\\n unchecked {\\n _balances[sender] = senderBalance - amount;\\n }\\n _balances[recipient] += amount;\\n\\n emit Transfer(sender, recipient, amount);\\n\\n _afterTokenTransfer(sender, recipient, amount);\\n }\\n\\n /** @dev Creates `amount` tokens and assigns them to `account`, increasing\\n * the total supply.\\n *\\n * Emits a {Transfer} event with `from` set to the zero address.\\n *\\n * Requirements:\\n *\\n * - `account` cannot be the zero address.\\n */\\n function _mint(address account, uint256 amount) internal virtual {\\n require(account != address(0), \\\"ERC20: mint to the zero address\\\");\\n\\n _beforeTokenTransfer(address(0), account, amount);\\n\\n _totalSupply += amount;\\n _balances[account] += amount;\\n emit Transfer(address(0), account, amount);\\n\\n _afterTokenTransfer(address(0), account, amount);\\n }\\n\\n /**\\n * @dev Destroys `amount` tokens from `account`, reducing the\\n * total supply.\\n *\\n * Emits a {Transfer} event with `to` set to the zero address.\\n *\\n * Requirements:\\n *\\n * - `account` cannot be the zero address.\\n * - `account` must have at least `amount` tokens.\\n */\\n function _burn(address account, uint256 amount) internal virtual {\\n require(account != address(0), \\\"ERC20: burn from the zero address\\\");\\n\\n _beforeTokenTransfer(account, address(0), amount);\\n\\n uint256 accountBalance = _balances[account];\\n require(accountBalance >= amount, \\\"ERC20: burn amount exceeds balance\\\");\\n unchecked {\\n _balances[account] = accountBalance - amount;\\n }\\n _totalSupply -= amount;\\n\\n emit Transfer(account, address(0), amount);\\n\\n _afterTokenTransfer(account, address(0), amount);\\n }\\n\\n /**\\n * @dev Sets `amount` as the allowance of `spender` over the `owner` s tokens.\\n *\\n * This internal function is equivalent to `approve`, and can be used to\\n * e.g. set automatic allowances for certain subsystems, etc.\\n *\\n * Emits an {Approval} event.\\n *\\n * Requirements:\\n *\\n * - `owner` cannot be the zero address.\\n * - `spender` cannot be the zero address.\\n */\\n function _approve(\\n address owner,\\n address spender,\\n uint256 amount\\n ) internal virtual {\\n require(owner != address(0), \\\"ERC20: approve from the zero address\\\");\\n require(spender != address(0), \\\"ERC20: approve to the zero address\\\");\\n\\n _allowances[owner][spender] = amount;\\n emit Approval(owner, spender, amount);\\n }\\n\\n /**\\n * @dev Hook that is called before any transfer of tokens. This includes\\n * minting and burning.\\n *\\n * Calling conditions:\\n *\\n * - when `from` and `to` are both non-zero, `amount` of ``from``'s tokens\\n * will be transferred to `to`.\\n * - when `from` is zero, `amount` tokens will be minted for `to`.\\n * - when `to` is zero, `amount` of ``from``'s tokens will be burned.\\n * - `from` and `to` are never both zero.\\n *\\n * To learn more about hooks, head to xref:ROOT:extending-contracts.adoc#using-hooks[Using Hooks].\\n */\\n function _beforeTokenTransfer(\\n address from,\\n address to,\\n uint256 amount\\n ) internal virtual {}\\n\\n /**\\n * @dev Hook that is called after any transfer of tokens. This includes\\n * minting and burning.\\n *\\n * Calling conditions:\\n *\\n * - when `from` and `to` are both non-zero, `amount` of ``from``'s tokens\\n * has been transferred to `to`.\\n * - when `from` is zero, `amount` tokens have been minted for `to`.\\n * - when `to` is zero, `amount` of ``from``'s tokens have been burned.\\n * - `from` and `to` are never both zero.\\n *\\n * To learn more about hooks, head to xref:ROOT:extending-contracts.adoc#using-hooks[Using Hooks].\\n */\\n function _afterTokenTransfer(\\n address from,\\n address to,\\n uint256 amount\\n ) internal virtual {}\\n}\\n\",\"keccak256\":\"0xd1d8caaeb45f78e0b0715664d56c220c283c89bf8b8c02954af86404d6b367f8\",\"license\":\"MIT\"},\"@openzeppelin/contracts/token/ERC20/IERC20.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts v4.4.1 (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 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 `recipient`.\\n *\\n * Returns a boolean value indicating whether the operation succeeded.\\n *\\n * Emits a {Transfer} event.\\n */\\n function transfer(address recipient, 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 `sender` to `recipient` 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(\\n address sender,\\n address recipient,\\n uint256 amount\\n ) external returns (bool);\\n\\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\",\"keccak256\":\"0x61437cb513a887a1bbad006e7b1c8b414478427d33de47c5600af3c748f108da\",\"license\":\"MIT\"},\"@openzeppelin/contracts/token/ERC20/extensions/IERC20Metadata.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts v4.4.1 (token/ERC20/extensions/IERC20Metadata.sol)\\n\\npragma solidity ^0.8.0;\\n\\nimport \\\"../IERC20.sol\\\";\\n\\n/**\\n * @dev Interface for the optional metadata functions from the ERC20 standard.\\n *\\n * _Available since v4.1._\\n */\\ninterface IERC20Metadata is IERC20 {\\n /**\\n * @dev Returns the name of the token.\\n */\\n function name() external view returns (string memory);\\n\\n /**\\n * @dev Returns the symbol of the token.\\n */\\n function symbol() external view returns (string memory);\\n\\n /**\\n * @dev Returns the decimals places of the token.\\n */\\n function decimals() external view returns (uint8);\\n}\\n\",\"keccak256\":\"0x8de418a5503946cabe331f35fe242d3201a73f67f77aaeb7110acb1f30423aca\",\"license\":\"MIT\"},\"@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\",\"keccak256\":\"0xe2e337e6dde9ef6b680e07338c493ebea1b5fd09b43424112868e9cc1706bca7\",\"license\":\"MIT\"},\"@uma/core/contracts/common/implementation/ExpandedERC20.sol\":{\"content\":\"// SPDX-License-Identifier: AGPL-3.0-only\\npragma solidity ^0.8.0;\\n\\nimport \\\"@openzeppelin/contracts/token/ERC20/ERC20.sol\\\";\\nimport \\\"./MultiRole.sol\\\";\\nimport \\\"../interfaces/ExpandedIERC20.sol\\\";\\n\\n/**\\n * @title An ERC20 with permissioned burning and minting. The contract deployer will initially\\n * be the owner who is capable of adding new roles.\\n */\\ncontract ExpandedERC20 is ExpandedIERC20, ERC20, MultiRole {\\n enum Roles {\\n // Can set the minter and burner.\\n Owner,\\n // Addresses that can mint new tokens.\\n Minter,\\n // Addresses that can burn tokens that address owns.\\n Burner\\n }\\n\\n uint8 _decimals;\\n\\n /**\\n * @notice Constructs the ExpandedERC20.\\n * @param _tokenName The name which describes the new token.\\n * @param _tokenSymbol The ticker abbreviation of the name. Ideally < 5 chars.\\n * @param _tokenDecimals The number of decimals to define token precision.\\n */\\n constructor(\\n string memory _tokenName,\\n string memory _tokenSymbol,\\n uint8 _tokenDecimals\\n ) ERC20(_tokenName, _tokenSymbol) {\\n _decimals = _tokenDecimals;\\n _createExclusiveRole(uint256(Roles.Owner), uint256(Roles.Owner), msg.sender);\\n _createSharedRole(uint256(Roles.Minter), uint256(Roles.Owner), new address[](0));\\n _createSharedRole(uint256(Roles.Burner), uint256(Roles.Owner), new address[](0));\\n }\\n\\n function decimals() public view virtual override(ERC20) returns (uint8) {\\n return _decimals;\\n }\\n\\n /**\\n * @dev Mints `value` tokens to `recipient`, returning true on success.\\n * @param recipient address to mint to.\\n * @param value amount of tokens to mint.\\n * @return True if the mint succeeded, or False.\\n */\\n function mint(address recipient, uint256 value)\\n external\\n override\\n onlyRoleHolder(uint256(Roles.Minter))\\n returns (bool)\\n {\\n _mint(recipient, value);\\n return true;\\n }\\n\\n /**\\n * @dev Burns `value` tokens owned by `msg.sender`.\\n * @param value amount of tokens to burn.\\n */\\n function burn(uint256 value) external override onlyRoleHolder(uint256(Roles.Burner)) {\\n _burn(msg.sender, value);\\n }\\n\\n /**\\n * @dev Burns `value` tokens owned by `recipient`.\\n * @param recipient address to burn tokens from.\\n * @param value amount of tokens to burn.\\n * @return True if the burn succeeded, or False.\\n */\\n function burnFrom(address recipient, uint256 value)\\n external\\n override\\n onlyRoleHolder(uint256(Roles.Burner))\\n returns (bool)\\n {\\n _burn(recipient, value);\\n return true;\\n }\\n\\n /**\\n * @notice Add Minter role to account.\\n * @dev The caller must have the Owner role.\\n * @param account The address to which the Minter role is added.\\n */\\n function addMinter(address account) external virtual override {\\n addMember(uint256(Roles.Minter), account);\\n }\\n\\n /**\\n * @notice Add Burner role to account.\\n * @dev The caller must have the Owner role.\\n * @param account The address to which the Burner role is added.\\n */\\n function addBurner(address account) external virtual override {\\n addMember(uint256(Roles.Burner), account);\\n }\\n\\n /**\\n * @notice Reset Owner role to account.\\n * @dev The caller must have the Owner role.\\n * @param account The new holder of the Owner role.\\n */\\n function resetOwner(address account) external virtual override {\\n resetMember(uint256(Roles.Owner), account);\\n }\\n}\\n\",\"keccak256\":\"0x8201459d3f78a1f97da7c421f2fbb859924d4facfc5fc235ba65d85bf12b2229\",\"license\":\"AGPL-3.0-only\"},\"@uma/core/contracts/common/implementation/MultiRole.sol\":{\"content\":\"// SPDX-License-Identifier: AGPL-3.0-only\\npragma solidity ^0.8.0;\\n\\nlibrary Exclusive {\\n struct RoleMembership {\\n address member;\\n }\\n\\n function isMember(RoleMembership storage roleMembership, address memberToCheck) internal view returns (bool) {\\n return roleMembership.member == memberToCheck;\\n }\\n\\n function resetMember(RoleMembership storage roleMembership, address newMember) internal {\\n require(newMember != address(0x0), \\\"Cannot set an exclusive role to 0x0\\\");\\n roleMembership.member = newMember;\\n }\\n\\n function getMember(RoleMembership storage roleMembership) internal view returns (address) {\\n return roleMembership.member;\\n }\\n\\n function init(RoleMembership storage roleMembership, address initialMember) internal {\\n resetMember(roleMembership, initialMember);\\n }\\n}\\n\\nlibrary Shared {\\n struct RoleMembership {\\n mapping(address => bool) members;\\n }\\n\\n function isMember(RoleMembership storage roleMembership, address memberToCheck) internal view returns (bool) {\\n return roleMembership.members[memberToCheck];\\n }\\n\\n function addMember(RoleMembership storage roleMembership, address memberToAdd) internal {\\n require(memberToAdd != address(0x0), \\\"Cannot add 0x0 to a shared role\\\");\\n roleMembership.members[memberToAdd] = true;\\n }\\n\\n function removeMember(RoleMembership storage roleMembership, address memberToRemove) internal {\\n roleMembership.members[memberToRemove] = false;\\n }\\n\\n function init(RoleMembership storage roleMembership, address[] memory initialMembers) internal {\\n for (uint256 i = 0; i < initialMembers.length; i++) {\\n addMember(roleMembership, initialMembers[i]);\\n }\\n }\\n}\\n\\n/**\\n * @title Base class to manage permissions for the derived class.\\n */\\nabstract contract MultiRole {\\n using Exclusive for Exclusive.RoleMembership;\\n using Shared for Shared.RoleMembership;\\n\\n enum RoleType { Invalid, Exclusive, Shared }\\n\\n struct Role {\\n uint256 managingRole;\\n RoleType roleType;\\n Exclusive.RoleMembership exclusiveRoleMembership;\\n Shared.RoleMembership sharedRoleMembership;\\n }\\n\\n mapping(uint256 => Role) private roles;\\n\\n event ResetExclusiveMember(uint256 indexed roleId, address indexed newMember, address indexed manager);\\n event AddedSharedMember(uint256 indexed roleId, address indexed newMember, address indexed manager);\\n event RemovedSharedMember(uint256 indexed roleId, address indexed oldMember, address indexed manager);\\n\\n /**\\n * @notice Reverts unless the caller is a member of the specified roleId.\\n */\\n modifier onlyRoleHolder(uint256 roleId) {\\n require(holdsRole(roleId, msg.sender), \\\"Sender does not hold required role\\\");\\n _;\\n }\\n\\n /**\\n * @notice Reverts unless the caller is a member of the manager role for the specified roleId.\\n */\\n modifier onlyRoleManager(uint256 roleId) {\\n require(holdsRole(roles[roleId].managingRole, msg.sender), \\\"Can only be called by a role manager\\\");\\n _;\\n }\\n\\n /**\\n * @notice Reverts unless the roleId represents an initialized, exclusive roleId.\\n */\\n modifier onlyExclusive(uint256 roleId) {\\n require(roles[roleId].roleType == RoleType.Exclusive, \\\"Must be called on an initialized Exclusive role\\\");\\n _;\\n }\\n\\n /**\\n * @notice Reverts unless the roleId represents an initialized, shared roleId.\\n */\\n modifier onlyShared(uint256 roleId) {\\n require(roles[roleId].roleType == RoleType.Shared, \\\"Must be called on an initialized Shared role\\\");\\n _;\\n }\\n\\n /**\\n * @notice Whether `memberToCheck` is a member of roleId.\\n * @dev Reverts if roleId does not correspond to an initialized role.\\n * @param roleId the Role to check.\\n * @param memberToCheck the address to check.\\n * @return True if `memberToCheck` is a member of `roleId`.\\n */\\n function holdsRole(uint256 roleId, address memberToCheck) public view returns (bool) {\\n Role storage role = roles[roleId];\\n if (role.roleType == RoleType.Exclusive) {\\n return role.exclusiveRoleMembership.isMember(memberToCheck);\\n } else if (role.roleType == RoleType.Shared) {\\n return role.sharedRoleMembership.isMember(memberToCheck);\\n }\\n revert(\\\"Invalid roleId\\\");\\n }\\n\\n /**\\n * @notice Changes the exclusive role holder of `roleId` to `newMember`.\\n * @dev Reverts if the caller is not a member of the managing role for `roleId` or if `roleId` is not an\\n * initialized, ExclusiveRole.\\n * @param roleId the ExclusiveRole membership to modify.\\n * @param newMember the new ExclusiveRole member.\\n */\\n function resetMember(uint256 roleId, address newMember) public onlyExclusive(roleId) onlyRoleManager(roleId) {\\n roles[roleId].exclusiveRoleMembership.resetMember(newMember);\\n emit ResetExclusiveMember(roleId, newMember, msg.sender);\\n }\\n\\n /**\\n * @notice Gets the current holder of the exclusive role, `roleId`.\\n * @dev Reverts if `roleId` does not represent an initialized, exclusive role.\\n * @param roleId the ExclusiveRole membership to check.\\n * @return the address of the current ExclusiveRole member.\\n */\\n function getMember(uint256 roleId) public view onlyExclusive(roleId) returns (address) {\\n return roles[roleId].exclusiveRoleMembership.getMember();\\n }\\n\\n /**\\n * @notice Adds `newMember` to the shared role, `roleId`.\\n * @dev Reverts if `roleId` does not represent an initialized, SharedRole or if the caller is not a member of the\\n * managing role for `roleId`.\\n * @param roleId the SharedRole membership to modify.\\n * @param newMember the new SharedRole member.\\n */\\n function addMember(uint256 roleId, address newMember) public onlyShared(roleId) onlyRoleManager(roleId) {\\n roles[roleId].sharedRoleMembership.addMember(newMember);\\n emit AddedSharedMember(roleId, newMember, msg.sender);\\n }\\n\\n /**\\n * @notice Removes `memberToRemove` from the shared role, `roleId`.\\n * @dev Reverts if `roleId` does not represent an initialized, SharedRole or if the caller is not a member of the\\n * managing role for `roleId`.\\n * @param roleId the SharedRole membership to modify.\\n * @param memberToRemove the current SharedRole member to remove.\\n */\\n function removeMember(uint256 roleId, address memberToRemove) public onlyShared(roleId) onlyRoleManager(roleId) {\\n roles[roleId].sharedRoleMembership.removeMember(memberToRemove);\\n emit RemovedSharedMember(roleId, memberToRemove, msg.sender);\\n }\\n\\n /**\\n * @notice Removes caller from the role, `roleId`.\\n * @dev Reverts if the caller is not a member of the role for `roleId` or if `roleId` is not an\\n * initialized, SharedRole.\\n * @param roleId the SharedRole membership to modify.\\n */\\n function renounceMembership(uint256 roleId) public onlyShared(roleId) onlyRoleHolder(roleId) {\\n roles[roleId].sharedRoleMembership.removeMember(msg.sender);\\n emit RemovedSharedMember(roleId, msg.sender, msg.sender);\\n }\\n\\n /**\\n * @notice Reverts if `roleId` is not initialized.\\n */\\n modifier onlyValidRole(uint256 roleId) {\\n require(roles[roleId].roleType != RoleType.Invalid, \\\"Attempted to use an invalid roleId\\\");\\n _;\\n }\\n\\n /**\\n * @notice Reverts if `roleId` is initialized.\\n */\\n modifier onlyInvalidRole(uint256 roleId) {\\n require(roles[roleId].roleType == RoleType.Invalid, \\\"Cannot use a pre-existing role\\\");\\n _;\\n }\\n\\n /**\\n * @notice Internal method to initialize a shared role, `roleId`, which will be managed by `managingRoleId`.\\n * `initialMembers` will be immediately added to the role.\\n * @dev Should be called by derived contracts, usually at construction time. Will revert if the role is already\\n * initialized.\\n */\\n function _createSharedRole(\\n uint256 roleId,\\n uint256 managingRoleId,\\n address[] memory initialMembers\\n ) internal onlyInvalidRole(roleId) {\\n Role storage role = roles[roleId];\\n role.roleType = RoleType.Shared;\\n role.managingRole = managingRoleId;\\n role.sharedRoleMembership.init(initialMembers);\\n require(\\n roles[managingRoleId].roleType != RoleType.Invalid,\\n \\\"Attempted to use an invalid role to manage a shared role\\\"\\n );\\n }\\n\\n /**\\n * @notice Internal method to initialize an exclusive role, `roleId`, which will be managed by `managingRoleId`.\\n * `initialMember` will be immediately added to the role.\\n * @dev Should be called by derived contracts, usually at construction time. Will revert if the role is already\\n * initialized.\\n */\\n function _createExclusiveRole(\\n uint256 roleId,\\n uint256 managingRoleId,\\n address initialMember\\n ) internal onlyInvalidRole(roleId) {\\n Role storage role = roles[roleId];\\n role.roleType = RoleType.Exclusive;\\n role.managingRole = managingRoleId;\\n role.exclusiveRoleMembership.init(initialMember);\\n require(\\n roles[managingRoleId].roleType != RoleType.Invalid,\\n \\\"Attempted to use an invalid role to manage an exclusive role\\\"\\n );\\n }\\n}\\n\",\"keccak256\":\"0x134c5a2f847832705be631f2b4eb2a3e23a91a2f0e63560abb481e85eeebfae6\",\"license\":\"AGPL-3.0-only\"},\"@uma/core/contracts/common/interfaces/ExpandedIERC20.sol\":{\"content\":\"// SPDX-License-Identifier: AGPL-3.0-only\\npragma solidity ^0.8.0;\\n\\nimport \\\"@openzeppelin/contracts/token/ERC20/IERC20.sol\\\";\\n\\n/**\\n * @title ERC20 interface that includes burn and mint methods.\\n */\\nabstract contract ExpandedIERC20 is IERC20 {\\n /**\\n * @notice Burns a specific amount of the caller's tokens.\\n * @dev Only burns the caller's tokens, so it is safe to leave this method permissionless.\\n */\\n function burn(uint256 value) external virtual;\\n\\n /**\\n * @dev Burns `value` tokens owned by `recipient`.\\n * @param recipient address to burn tokens from.\\n * @param value amount of tokens to burn.\\n */\\n function burnFrom(address recipient, uint256 value) external virtual returns (bool);\\n\\n /**\\n * @notice Mints tokens and adds them to the balance of the `to` address.\\n * @dev This method should be permissioned to only allow designated parties to mint tokens.\\n */\\n function mint(address to, uint256 value) external virtual returns (bool);\\n\\n function addMinter(address account) external virtual;\\n\\n function addBurner(address account) external virtual;\\n\\n function resetOwner(address account) external virtual;\\n}\\n\",\"keccak256\":\"0xb8252039cba45f1c19cd677f150a9823a5d6e1845cad90e3041d97c96f273c26\",\"license\":\"AGPL-3.0-only\"},\"contracts/LpTokenFactory.sol\":{\"content\":\"// SPDX-License-Identifier: GPL-3.0-only\\npragma solidity ^0.8.0;\\n\\nimport \\\"./interfaces/LpTokenFactoryInterface.sol\\\";\\n\\nimport \\\"@uma/core/contracts/common/implementation/ExpandedERC20.sol\\\";\\n\\ncontract LpTokenFactory is LpTokenFactoryInterface {\\n function createLpToken(address l1Token) public returns (address) {\\n ExpandedERC20 lpToken = new ExpandedERC20(\\n _append(\\\"Across \\\", IERC20Metadata(l1Token).name(), \\\" LP Token\\\"), // LP Token Name\\n _append(\\\"Av2-\\\", IERC20Metadata(l1Token).symbol(), \\\"-LP\\\"), // LP Token Symbol\\n IERC20Metadata(l1Token).decimals() // LP Token Decimals\\n );\\n lpToken.addMember(1, msg.sender); // Set this contract as the LP Token's minter.\\n lpToken.addMember(2, msg.sender); // Set this contract as the LP Token's burner.\\n\\n return address(lpToken);\\n }\\n\\n function _append(\\n string memory a,\\n string memory b,\\n string memory c\\n ) internal pure returns (string memory) {\\n return string(abi.encodePacked(a, b, c));\\n }\\n}\\n\",\"keccak256\":\"0x51b55f2c875ae6e1c8e2dd867201c962a4f8c4a74a63a83f4ab94ed00cf6c954\",\"license\":\"GPL-3.0-only\"},\"contracts/interfaces/LpTokenFactoryInterface.sol\":{\"content\":\"// SPDX-License-Identifier: AGPL-3.0-only\\npragma solidity ^0.8.0;\\n\\nimport \\\"@openzeppelin/contracts/token/ERC20/IERC20.sol\\\";\\n\\ninterface LpTokenFactoryInterface {\\n function createLpToken(address l1Token) external returns (address);\\n}\\n\",\"keccak256\":\"0xbff9f636f087e2c5acc05be2da6fe26d3558f0ff6d270f8738bd8027b4ac8eff\",\"license\":\"AGPL-3.0-only\"}},\"version\":1}", - "bytecode": "0x608060405234801561001057600080fd5b50612cfa806100206000396000f3fe60806040523480156200001157600080fd5b50600436106200002e5760003560e01c8063fc2f1b6e1462000033575b600080fd5b6200004a620000443660046200048f565b62000073565b60405173ffffffffffffffffffffffffffffffffffffffff909116815260200160405180910390f35b600080620001806040518060400160405280600781526020017f4163726f737320000000000000000000000000000000000000000000000000008152508473ffffffffffffffffffffffffffffffffffffffff166306fdde036040518163ffffffff1660e01b8152600401600060405180830381865afa158015620000fc573d6000803e3d6000fd5b505050506040513d6000823e601f3d9081017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe016820160405262000144919081019062000530565b6040518060400160405280600981526020017f204c5020546f6b656e000000000000000000000000000000000000000000000081525062000450565b6200028a6040518060400160405280600481526020017f4176322d000000000000000000000000000000000000000000000000000000008152508573ffffffffffffffffffffffffffffffffffffffff166395d89b416040518163ffffffff1660e01b8152600401600060405180830381865afa15801562000206573d6000803e3d6000fd5b505050506040513d6000823e601f3d9081017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe01682016040526200024e919081019062000530565b6040518060400160405280600381526020017f2d4c50000000000000000000000000000000000000000000000000000000000081525062000450565b8473ffffffffffffffffffffffffffffffffffffffff1663313ce5676040518163ffffffff1660e01b8152600401602060405180830381865afa158015620002d6573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190620002fc919062000607565b6040516200030a9062000481565b620003189392919062000678565b604051809103906000f08015801562000335573d6000803e3d6000fd5b506040517f74d0a6760000000000000000000000000000000000000000000000000000000081526001600482015233602482015290915073ffffffffffffffffffffffffffffffffffffffff8216906374d0a67690604401600060405180830381600087803b158015620003a857600080fd5b505af1158015620003bd573d6000803e3d6000fd5b50506040517f74d0a6760000000000000000000000000000000000000000000000000000000081526002600482015233602482015273ffffffffffffffffffffffffffffffffffffffff841692506374d0a6769150604401600060405180830381600087803b1580156200043057600080fd5b505af115801562000445573d6000803e3d6000fd5b509295945050505050565b60608383836040516020016200046993929190620006b5565b60405160208183030381529060405290509392505050565b6125c680620006ff83390190565b600060208284031215620004a257600080fd5b813573ffffffffffffffffffffffffffffffffffffffff81168114620004c757600080fd5b9392505050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b60005b838110156200051a57818101518382015260200162000500565b838111156200052a576000848401525b50505050565b6000602082840312156200054357600080fd5b815167ffffffffffffffff808211156200055c57600080fd5b818401915084601f8301126200057157600080fd5b815181811115620005865762000586620004ce565b604051601f82017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0908116603f01168101908382118183101715620005cf57620005cf620004ce565b81604052828152876020848701011115620005e957600080fd5b620005fc836020830160208801620004fd565b979650505050505050565b6000602082840312156200061a57600080fd5b815160ff81168114620004c757600080fd5b6000815180845262000646816020860160208601620004fd565b601f017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0169290920160200192915050565b6060815260006200068d60608301866200062c565b8281036020840152620006a181866200062c565b91505060ff83166040830152949350505050565b60008451620006c9818460208901620004fd565b845190830190620006df818360208901620004fd565b8451910190620006f4818360208801620004fd565b019594505050505056fe60806040523480156200001157600080fd5b50604051620025c6380380620025c6833981016040819052620000349162000623565b8251839083906200004d906003906020850190620004b0565b50805162000063906004906020840190620004b0565b50506006805460ff191660ff8416179055506200008360008033620000b5565b620000a060015b6040805160008082526020820190925262000206565b620000ac60026200008a565b5050506200073b565b826000808281526005602052604090206001015460ff166002811115620000e057620000e0620006a8565b14620001335760405162461bcd60e51b815260206004820152601e60248201527f43616e6e6f74207573652061207072652d6578697374696e6720726f6c65000060448201526064015b60405180910390fd5b60008481526005602052604090206001808201805460ff1916828002179055508381556200017160028201846200034d602090811b620011d917901c565b60008481526005602052604081206001015460ff1660028111156200019a576200019a620006a8565b1415620001ff5760405162461bcd60e51b815260206004820152603c6024820152600080516020620025a683398151915260448201527f20746f206d616e61676520616e206578636c757369766520726f6c650000000060648201526084016200012a565b5050505050565b826000808281526005602052604090206001015460ff166002811115620002315762000231620006a8565b14620002805760405162461bcd60e51b815260206004820152601e60248201527f43616e6e6f74207573652061207072652d6578697374696e6720726f6c65000060448201526064016200012a565b600084815260056020908152604090912060018101805460ff1916600217905584815590620002bf9060038301908590620011e36200035d821b17901c565b60008481526005602052604081206001015460ff166002811115620002e857620002e8620006a8565b1415620001ff5760405162461bcd60e51b81526020600482015260386024820152600080516020620025a683398151915260448201527f20746f206d616e61676520612073686172656420726f6c65000000000000000060648201526084016200012a565b620003598282620003b2565b5050565b60005b8151811015620003ad576200039883838381518110620003845762000384620006be565b60200260200101516200043360201b60201c565b80620003a481620006d4565b91505062000360565b505050565b6001600160a01b038116620004165760405162461bcd60e51b815260206004820152602360248201527f43616e6e6f742073657420616e206578636c757369766520726f6c6520746f2060448201526203078360ec1b60648201526084016200012a565b81546001600160a01b0319166001600160a01b0391909116179055565b6001600160a01b0381166200048b5760405162461bcd60e51b815260206004820152601f60248201527f43616e6e6f74206164642030783020746f20612073686172656420726f6c650060448201526064016200012a565b6001600160a01b0316600090815260209190915260409020805460ff19166001179055565b828054620004be90620006fe565b90600052602060002090601f016020900481019282620004e257600085556200052d565b82601f10620004fd57805160ff19168380011785556200052d565b828001600101855582156200052d579182015b828111156200052d57825182559160200191906001019062000510565b506200053b9291506200053f565b5090565b5b808211156200053b576000815560010162000540565b634e487b7160e01b600052604160045260246000fd5b600082601f8301126200057e57600080fd5b81516001600160401b03808211156200059b576200059b62000556565b604051601f8301601f19908116603f01168101908282118183101715620005c657620005c662000556565b81604052838152602092508683858801011115620005e357600080fd5b600091505b83821015620006075785820183015181830184015290820190620005e8565b83821115620006195760008385830101525b9695505050505050565b6000806000606084860312156200063957600080fd5b83516001600160401b03808211156200065157600080fd5b6200065f878388016200056c565b945060208601519150808211156200067657600080fd5b5062000685868287016200056c565b925050604084015160ff811681146200069d57600080fd5b809150509250925092565b634e487b7160e01b600052602160045260246000fd5b634e487b7160e01b600052603260045260246000fd5b6000600019821415620006f757634e487b7160e01b600052601160045260246000fd5b5060010190565b600181811c908216806200071357607f821691505b602082108114156200073557634e487b7160e01b600052602260045260246000fd5b50919050565b611e5b806200074b6000396000f3fe608060405234801561001057600080fd5b506004361061018d5760003560e01c806374d0a676116100e3578063a9059cbb1161008c578063d97c05be11610066578063d97c05be14610369578063dd62ed3e1461037c578063f44637ba146103c257600080fd5b8063a9059cbb1461030b578063aaa14ca31461031e578063ab3545e51461033157600080fd5b806395d89b41116100bd57806395d89b41146102dd578063983b2d56146102e5578063a457c2d7146102f857600080fd5b806374d0a676146102a457806379cc6790146102b75780637cdc1cb9146102ca57600080fd5b806339509351116101455780636be7658b1161011f5780636be7658b1461024857806370a082311461025b57806373cc802a1461029157600080fd5b8063395093511461020d57806340c10f191461022057806342966c681461023357600080fd5b806318160ddd1161017657806318160ddd146101d357806323b872dd146101e5578063313ce567146101f857600080fd5b806306fdde0314610192578063095ea7b3146101b0575b600080fd5b61019a6103d5565b6040516101a79190611b4f565b60405180910390f35b6101c36101be366004611beb565b610467565b60405190151581526020016101a7565b6002545b6040519081526020016101a7565b6101c36101f3366004611c15565b61047e565b60065460405160ff90911681526020016101a7565b6101c361021b366004611beb565b610569565b6101c361022e366004611beb565b6105b2565b610246610241366004611c51565b610660565b005b610246610256366004611c6a565b610706565b6101d7610269366004611c96565b73ffffffffffffffffffffffffffffffffffffffff1660009081526020819052604090205490565b61024661029f366004611c96565b6108ed565b6102466102b2366004611c6a565b6108fb565b6101c36102c5366004611beb565b610abd565b6101c36102d8366004611c6a565b610b61565b61019a610c6b565b6102466102f3366004611c96565b610c7a565b6101c3610306366004611beb565b610c86565b6101c3610319366004611beb565b610d54565b61024661032c366004611c51565b610d61565b61034461033f366004611c51565b610f24565b60405173ffffffffffffffffffffffffffffffffffffffff90911681526020016101a7565b610246610377366004611c6a565b61100d565b6101d761038a366004611cb8565b73ffffffffffffffffffffffffffffffffffffffff918216600090815260016020908152604080832093909416825291909152205490565b6102466103d0366004611c96565b6111cf565b6060600380546103e490611ce2565b80601f016020809104026020016040519081016040528092919081815260200182805461041090611ce2565b801561045d5780601f106104325761010080835404028352916020019161045d565b820191906000526020600020905b81548152906001019060200180831161044057829003601f168201915b5050505050905090565b6000610474338484611229565b5060015b92915050565b600061048b8484846113dc565b73ffffffffffffffffffffffffffffffffffffffff8416600090815260016020908152604080832033845290915290205482811015610551576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602860248201527f45524332303a207472616e7366657220616d6f756e742065786365656473206160448201527f6c6c6f77616e636500000000000000000000000000000000000000000000000060648201526084015b60405180910390fd5b61055e8533858403611229565b506001949350505050565b33600081815260016020908152604080832073ffffffffffffffffffffffffffffffffffffffff8716845290915281205490916104749185906105ad908690611d5f565b611229565b600060016105c08133610b61565b61064c576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602260248201527f53656e64657220646f6573206e6f7420686f6c6420726571756972656420726f60448201527f6c650000000000000000000000000000000000000000000000000000000000006064820152608401610548565b6106568484611690565b5060019392505050565b600261066c8133610b61565b6106f8576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602260248201527f53656e64657220646f6573206e6f7420686f6c6420726571756972656420726f60448201527f6c650000000000000000000000000000000000000000000000000000000000006064820152608401610548565b61070233836117b0565b5050565b81600260008281526005602052604090206001015460ff16600281111561072f5761072f611d77565b146107bc576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602c60248201527f4d7573742062652063616c6c6564206f6e20616e20696e697469616c697a656460448201527f2053686172656420726f6c6500000000000000000000000000000000000000006064820152608401610548565b60008381526005602052604090205483906107d79033610b61565b610862576040517f08c379a0000000000000000000000000000000000000000000000000000000008152602060048201526024808201527f43616e206f6e6c792062652063616c6c6564206279206120726f6c65206d616e60448201527f61676572000000000000000000000000000000000000000000000000000000006064820152608401610548565b600084815260056020908152604080832073ffffffffffffffffffffffffffffffffffffffff8716808552600390910190925280832080547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0016905551339287917feb3e33034c392e69263b04ec0fa376dc12784a41b6676c7f31b936cbc0fbb5af9190a450505050565b6108f860008261100d565b50565b81600260008281526005602052604090206001015460ff16600281111561092457610924611d77565b146109b1576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602c60248201527f4d7573742062652063616c6c6564206f6e20616e20696e697469616c697a656460448201527f2053686172656420726f6c6500000000000000000000000000000000000000006064820152608401610548565b60008381526005602052604090205483906109cc9033610b61565b610a57576040517f08c379a0000000000000000000000000000000000000000000000000000000008152602060048201526024808201527f43616e206f6e6c792062652063616c6c6564206279206120726f6c65206d616e60448201527f61676572000000000000000000000000000000000000000000000000000000006064820152608401610548565b6000848152600560205260409020610a72906003018461199d565b604051339073ffffffffffffffffffffffffffffffffffffffff85169086907f63502af7324ff6db91ab38f8236a648727d9385ea6c782073dd4882d8a61a48f90600090a450505050565b60006002610acb8133610b61565b610b57576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602260248201527f53656e64657220646f6573206e6f7420686f6c6420726571756972656420726f60448201527f6c650000000000000000000000000000000000000000000000000000000000006064820152608401610548565b61065684846117b0565b600082815260056020526040812060018082015460ff166002811115610b8957610b89611d77565b1415610bb857600281015473ffffffffffffffffffffffffffffffffffffffff8481169116145b915050610478565b6002600182015460ff166002811115610bd357610bd3611d77565b1415610c095773ffffffffffffffffffffffffffffffffffffffff8316600090815260038201602052604090205460ff16610bb0565b6040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152600e60248201527f496e76616c696420726f6c6549640000000000000000000000000000000000006044820152606401610548565b6060600480546103e490611ce2565b6108f860015b826108fb565b33600090815260016020908152604080832073ffffffffffffffffffffffffffffffffffffffff8616845290915281205482811015610d47576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602560248201527f45524332303a2064656372656173656420616c6c6f77616e63652062656c6f7760448201527f207a65726f0000000000000000000000000000000000000000000000000000006064820152608401610548565b6106563385858403611229565b60006104743384846113dc565b80600260008281526005602052604090206001015460ff166002811115610d8a57610d8a611d77565b14610e17576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602c60248201527f4d7573742062652063616c6c6564206f6e20616e20696e697469616c697a656460448201527f2053686172656420726f6c6500000000000000000000000000000000000000006064820152608401610548565b81610e228133610b61565b610eae576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602260248201527f53656e64657220646f6573206e6f7420686f6c6420726571756972656420726f60448201527f6c650000000000000000000000000000000000000000000000000000000000006064820152608401610548565b6000838152600560209081526040808320338452600301909152902080547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff001690556040513390819085907feb3e33034c392e69263b04ec0fa376dc12784a41b6676c7f31b936cbc0fbb5af90600090a4505050565b600081600160008281526005602052604090206001015460ff166002811115610f4f57610f4f611d77565b14610fdc576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602f60248201527f4d7573742062652063616c6c6564206f6e20616e20696e697469616c697a656460448201527f204578636c757369766520726f6c6500000000000000000000000000000000006064820152608401610548565b60008381526005602052604090206002015473ffffffffffffffffffffffffffffffffffffffff1691505b50919050565b81600160008281526005602052604090206001015460ff16600281111561103657611036611d77565b146110c3576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602f60248201527f4d7573742062652063616c6c6564206f6e20616e20696e697469616c697a656460448201527f204578636c757369766520726f6c6500000000000000000000000000000000006064820152608401610548565b60008381526005602052604090205483906110de9033610b61565b611169576040517f08c379a0000000000000000000000000000000000000000000000000000000008152602060048201526024808201527f43616e206f6e6c792062652063616c6c6564206279206120726f6c65206d616e60448201527f61676572000000000000000000000000000000000000000000000000000000006064820152608401610548565b60008481526005602052604090206111849060020184611a6a565b604051339073ffffffffffffffffffffffffffffffffffffffff85169086907f3b855c56b409b671c7112789d022675eb639d0bcb8896f1b6197c132f799e74690600090a450505050565b6108f86002610c80565b6107028282611a6a565b60005b8151811015611224576112128383838151811061120557611205611da6565b602002602001015161199d565b8061121c81611dd5565b9150506111e6565b505050565b73ffffffffffffffffffffffffffffffffffffffff83166112cb576040517f08c379a0000000000000000000000000000000000000000000000000000000008152602060048201526024808201527f45524332303a20617070726f76652066726f6d20746865207a65726f2061646460448201527f72657373000000000000000000000000000000000000000000000000000000006064820152608401610548565b73ffffffffffffffffffffffffffffffffffffffff821661136e576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602260248201527f45524332303a20617070726f766520746f20746865207a65726f20616464726560448201527f73730000000000000000000000000000000000000000000000000000000000006064820152608401610548565b73ffffffffffffffffffffffffffffffffffffffff83811660008181526001602090815260408083209487168084529482529182902085905590518481527f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925910160405180910390a3505050565b73ffffffffffffffffffffffffffffffffffffffff831661147f576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602560248201527f45524332303a207472616e736665722066726f6d20746865207a65726f20616460448201527f64726573730000000000000000000000000000000000000000000000000000006064820152608401610548565b73ffffffffffffffffffffffffffffffffffffffff8216611522576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602360248201527f45524332303a207472616e7366657220746f20746865207a65726f206164647260448201527f65737300000000000000000000000000000000000000000000000000000000006064820152608401610548565b73ffffffffffffffffffffffffffffffffffffffff8316600090815260208190526040902054818110156115d8576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602660248201527f45524332303a207472616e7366657220616d6f756e742065786365656473206260448201527f616c616e636500000000000000000000000000000000000000000000000000006064820152608401610548565b73ffffffffffffffffffffffffffffffffffffffff80851660009081526020819052604080822085850390559185168152908120805484929061161c908490611d5f565b925050819055508273ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef8460405161168291815260200190565b60405180910390a350505050565b73ffffffffffffffffffffffffffffffffffffffff821661170d576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601f60248201527f45524332303a206d696e7420746f20746865207a65726f2061646472657373006044820152606401610548565b806002600082825461171f9190611d5f565b909155505073ffffffffffffffffffffffffffffffffffffffff821660009081526020819052604081208054839290611759908490611d5f565b909155505060405181815273ffffffffffffffffffffffffffffffffffffffff8316906000907fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef9060200160405180910390a35050565b73ffffffffffffffffffffffffffffffffffffffff8216611853576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602160248201527f45524332303a206275726e2066726f6d20746865207a65726f2061646472657360448201527f73000000000000000000000000000000000000000000000000000000000000006064820152608401610548565b73ffffffffffffffffffffffffffffffffffffffff821660009081526020819052604090205481811015611909576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602260248201527f45524332303a206275726e20616d6f756e7420657863656564732062616c616e60448201527f63650000000000000000000000000000000000000000000000000000000000006064820152608401610548565b73ffffffffffffffffffffffffffffffffffffffff83166000908152602081905260408120838303905560028054849290611945908490611e0e565b909155505060405182815260009073ffffffffffffffffffffffffffffffffffffffff8516907fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef9060200160405180910390a3505050565b73ffffffffffffffffffffffffffffffffffffffff8116611a1a576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601f60248201527f43616e6e6f74206164642030783020746f20612073686172656420726f6c65006044820152606401610548565b73ffffffffffffffffffffffffffffffffffffffff1660009081526020919091526040902080547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff00166001179055565b73ffffffffffffffffffffffffffffffffffffffff8116611b0d576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602360248201527f43616e6e6f742073657420616e206578636c757369766520726f6c6520746f2060448201527f30783000000000000000000000000000000000000000000000000000000000006064820152608401610548565b81547fffffffffffffffffffffffff00000000000000000000000000000000000000001673ffffffffffffffffffffffffffffffffffffffff91909116179055565b600060208083528351808285015260005b81811015611b7c57858101830151858201604001528201611b60565b81811115611b8e576000604083870101525b50601f017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe016929092016040019392505050565b803573ffffffffffffffffffffffffffffffffffffffff81168114611be657600080fd5b919050565b60008060408385031215611bfe57600080fd5b611c0783611bc2565b946020939093013593505050565b600080600060608486031215611c2a57600080fd5b611c3384611bc2565b9250611c4160208501611bc2565b9150604084013590509250925092565b600060208284031215611c6357600080fd5b5035919050565b60008060408385031215611c7d57600080fd5b82359150611c8d60208401611bc2565b90509250929050565b600060208284031215611ca857600080fd5b611cb182611bc2565b9392505050565b60008060408385031215611ccb57600080fd5b611cd483611bc2565b9150611c8d60208401611bc2565b600181811c90821680611cf657607f821691505b60208210811415611007577f4e487b7100000000000000000000000000000000000000000000000000000000600052602260045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b60008219821115611d7257611d72611d30565b500190565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052602160045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b60007fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff821415611e0757611e07611d30565b5060010190565b600082821015611e2057611e20611d30565b50039056fea26469706673582212206711b075929f95fe84e8886d266c57cb729d320a6e18d9be873ebf48ca86bf8764736f6c634300080b0033417474656d7074656420746f2075736520616e20696e76616c696420726f6c65a26469706673582212208f4dfad5cf85f250d1f373171e32179d88acdd0fe441528253448fa05bbbe45464736f6c634300080b0033", - "deployedBytecode": "0x60806040523480156200001157600080fd5b50600436106200002e5760003560e01c8063fc2f1b6e1462000033575b600080fd5b6200004a620000443660046200048f565b62000073565b60405173ffffffffffffffffffffffffffffffffffffffff909116815260200160405180910390f35b600080620001806040518060400160405280600781526020017f4163726f737320000000000000000000000000000000000000000000000000008152508473ffffffffffffffffffffffffffffffffffffffff166306fdde036040518163ffffffff1660e01b8152600401600060405180830381865afa158015620000fc573d6000803e3d6000fd5b505050506040513d6000823e601f3d9081017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe016820160405262000144919081019062000530565b6040518060400160405280600981526020017f204c5020546f6b656e000000000000000000000000000000000000000000000081525062000450565b6200028a6040518060400160405280600481526020017f4176322d000000000000000000000000000000000000000000000000000000008152508573ffffffffffffffffffffffffffffffffffffffff166395d89b416040518163ffffffff1660e01b8152600401600060405180830381865afa15801562000206573d6000803e3d6000fd5b505050506040513d6000823e601f3d9081017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe01682016040526200024e919081019062000530565b6040518060400160405280600381526020017f2d4c50000000000000000000000000000000000000000000000000000000000081525062000450565b8473ffffffffffffffffffffffffffffffffffffffff1663313ce5676040518163ffffffff1660e01b8152600401602060405180830381865afa158015620002d6573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190620002fc919062000607565b6040516200030a9062000481565b620003189392919062000678565b604051809103906000f08015801562000335573d6000803e3d6000fd5b506040517f74d0a6760000000000000000000000000000000000000000000000000000000081526001600482015233602482015290915073ffffffffffffffffffffffffffffffffffffffff8216906374d0a67690604401600060405180830381600087803b158015620003a857600080fd5b505af1158015620003bd573d6000803e3d6000fd5b50506040517f74d0a6760000000000000000000000000000000000000000000000000000000081526002600482015233602482015273ffffffffffffffffffffffffffffffffffffffff841692506374d0a6769150604401600060405180830381600087803b1580156200043057600080fd5b505af115801562000445573d6000803e3d6000fd5b509295945050505050565b60608383836040516020016200046993929190620006b5565b60405160208183030381529060405290509392505050565b6125c680620006ff83390190565b600060208284031215620004a257600080fd5b813573ffffffffffffffffffffffffffffffffffffffff81168114620004c757600080fd5b9392505050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b60005b838110156200051a57818101518382015260200162000500565b838111156200052a576000848401525b50505050565b6000602082840312156200054357600080fd5b815167ffffffffffffffff808211156200055c57600080fd5b818401915084601f8301126200057157600080fd5b815181811115620005865762000586620004ce565b604051601f82017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0908116603f01168101908382118183101715620005cf57620005cf620004ce565b81604052828152876020848701011115620005e957600080fd5b620005fc836020830160208801620004fd565b979650505050505050565b6000602082840312156200061a57600080fd5b815160ff81168114620004c757600080fd5b6000815180845262000646816020860160208601620004fd565b601f017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0169290920160200192915050565b6060815260006200068d60608301866200062c565b8281036020840152620006a181866200062c565b91505060ff83166040830152949350505050565b60008451620006c9818460208901620004fd565b845190830190620006df818360208901620004fd565b8451910190620006f4818360208801620004fd565b019594505050505056fe60806040523480156200001157600080fd5b50604051620025c6380380620025c6833981016040819052620000349162000623565b8251839083906200004d906003906020850190620004b0565b50805162000063906004906020840190620004b0565b50506006805460ff191660ff8416179055506200008360008033620000b5565b620000a060015b6040805160008082526020820190925262000206565b620000ac60026200008a565b5050506200073b565b826000808281526005602052604090206001015460ff166002811115620000e057620000e0620006a8565b14620001335760405162461bcd60e51b815260206004820152601e60248201527f43616e6e6f74207573652061207072652d6578697374696e6720726f6c65000060448201526064015b60405180910390fd5b60008481526005602052604090206001808201805460ff1916828002179055508381556200017160028201846200034d602090811b620011d917901c565b60008481526005602052604081206001015460ff1660028111156200019a576200019a620006a8565b1415620001ff5760405162461bcd60e51b815260206004820152603c6024820152600080516020620025a683398151915260448201527f20746f206d616e61676520616e206578636c757369766520726f6c650000000060648201526084016200012a565b5050505050565b826000808281526005602052604090206001015460ff166002811115620002315762000231620006a8565b14620002805760405162461bcd60e51b815260206004820152601e60248201527f43616e6e6f74207573652061207072652d6578697374696e6720726f6c65000060448201526064016200012a565b600084815260056020908152604090912060018101805460ff1916600217905584815590620002bf9060038301908590620011e36200035d821b17901c565b60008481526005602052604081206001015460ff166002811115620002e857620002e8620006a8565b1415620001ff5760405162461bcd60e51b81526020600482015260386024820152600080516020620025a683398151915260448201527f20746f206d616e61676520612073686172656420726f6c65000000000000000060648201526084016200012a565b620003598282620003b2565b5050565b60005b8151811015620003ad576200039883838381518110620003845762000384620006be565b60200260200101516200043360201b60201c565b80620003a481620006d4565b91505062000360565b505050565b6001600160a01b038116620004165760405162461bcd60e51b815260206004820152602360248201527f43616e6e6f742073657420616e206578636c757369766520726f6c6520746f2060448201526203078360ec1b60648201526084016200012a565b81546001600160a01b0319166001600160a01b0391909116179055565b6001600160a01b0381166200048b5760405162461bcd60e51b815260206004820152601f60248201527f43616e6e6f74206164642030783020746f20612073686172656420726f6c650060448201526064016200012a565b6001600160a01b0316600090815260209190915260409020805460ff19166001179055565b828054620004be90620006fe565b90600052602060002090601f016020900481019282620004e257600085556200052d565b82601f10620004fd57805160ff19168380011785556200052d565b828001600101855582156200052d579182015b828111156200052d57825182559160200191906001019062000510565b506200053b9291506200053f565b5090565b5b808211156200053b576000815560010162000540565b634e487b7160e01b600052604160045260246000fd5b600082601f8301126200057e57600080fd5b81516001600160401b03808211156200059b576200059b62000556565b604051601f8301601f19908116603f01168101908282118183101715620005c657620005c662000556565b81604052838152602092508683858801011115620005e357600080fd5b600091505b83821015620006075785820183015181830184015290820190620005e8565b83821115620006195760008385830101525b9695505050505050565b6000806000606084860312156200063957600080fd5b83516001600160401b03808211156200065157600080fd5b6200065f878388016200056c565b945060208601519150808211156200067657600080fd5b5062000685868287016200056c565b925050604084015160ff811681146200069d57600080fd5b809150509250925092565b634e487b7160e01b600052602160045260246000fd5b634e487b7160e01b600052603260045260246000fd5b6000600019821415620006f757634e487b7160e01b600052601160045260246000fd5b5060010190565b600181811c908216806200071357607f821691505b602082108114156200073557634e487b7160e01b600052602260045260246000fd5b50919050565b611e5b806200074b6000396000f3fe608060405234801561001057600080fd5b506004361061018d5760003560e01c806374d0a676116100e3578063a9059cbb1161008c578063d97c05be11610066578063d97c05be14610369578063dd62ed3e1461037c578063f44637ba146103c257600080fd5b8063a9059cbb1461030b578063aaa14ca31461031e578063ab3545e51461033157600080fd5b806395d89b41116100bd57806395d89b41146102dd578063983b2d56146102e5578063a457c2d7146102f857600080fd5b806374d0a676146102a457806379cc6790146102b75780637cdc1cb9146102ca57600080fd5b806339509351116101455780636be7658b1161011f5780636be7658b1461024857806370a082311461025b57806373cc802a1461029157600080fd5b8063395093511461020d57806340c10f191461022057806342966c681461023357600080fd5b806318160ddd1161017657806318160ddd146101d357806323b872dd146101e5578063313ce567146101f857600080fd5b806306fdde0314610192578063095ea7b3146101b0575b600080fd5b61019a6103d5565b6040516101a79190611b4f565b60405180910390f35b6101c36101be366004611beb565b610467565b60405190151581526020016101a7565b6002545b6040519081526020016101a7565b6101c36101f3366004611c15565b61047e565b60065460405160ff90911681526020016101a7565b6101c361021b366004611beb565b610569565b6101c361022e366004611beb565b6105b2565b610246610241366004611c51565b610660565b005b610246610256366004611c6a565b610706565b6101d7610269366004611c96565b73ffffffffffffffffffffffffffffffffffffffff1660009081526020819052604090205490565b61024661029f366004611c96565b6108ed565b6102466102b2366004611c6a565b6108fb565b6101c36102c5366004611beb565b610abd565b6101c36102d8366004611c6a565b610b61565b61019a610c6b565b6102466102f3366004611c96565b610c7a565b6101c3610306366004611beb565b610c86565b6101c3610319366004611beb565b610d54565b61024661032c366004611c51565b610d61565b61034461033f366004611c51565b610f24565b60405173ffffffffffffffffffffffffffffffffffffffff90911681526020016101a7565b610246610377366004611c6a565b61100d565b6101d761038a366004611cb8565b73ffffffffffffffffffffffffffffffffffffffff918216600090815260016020908152604080832093909416825291909152205490565b6102466103d0366004611c96565b6111cf565b6060600380546103e490611ce2565b80601f016020809104026020016040519081016040528092919081815260200182805461041090611ce2565b801561045d5780601f106104325761010080835404028352916020019161045d565b820191906000526020600020905b81548152906001019060200180831161044057829003601f168201915b5050505050905090565b6000610474338484611229565b5060015b92915050565b600061048b8484846113dc565b73ffffffffffffffffffffffffffffffffffffffff8416600090815260016020908152604080832033845290915290205482811015610551576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602860248201527f45524332303a207472616e7366657220616d6f756e742065786365656473206160448201527f6c6c6f77616e636500000000000000000000000000000000000000000000000060648201526084015b60405180910390fd5b61055e8533858403611229565b506001949350505050565b33600081815260016020908152604080832073ffffffffffffffffffffffffffffffffffffffff8716845290915281205490916104749185906105ad908690611d5f565b611229565b600060016105c08133610b61565b61064c576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602260248201527f53656e64657220646f6573206e6f7420686f6c6420726571756972656420726f60448201527f6c650000000000000000000000000000000000000000000000000000000000006064820152608401610548565b6106568484611690565b5060019392505050565b600261066c8133610b61565b6106f8576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602260248201527f53656e64657220646f6573206e6f7420686f6c6420726571756972656420726f60448201527f6c650000000000000000000000000000000000000000000000000000000000006064820152608401610548565b61070233836117b0565b5050565b81600260008281526005602052604090206001015460ff16600281111561072f5761072f611d77565b146107bc576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602c60248201527f4d7573742062652063616c6c6564206f6e20616e20696e697469616c697a656460448201527f2053686172656420726f6c6500000000000000000000000000000000000000006064820152608401610548565b60008381526005602052604090205483906107d79033610b61565b610862576040517f08c379a0000000000000000000000000000000000000000000000000000000008152602060048201526024808201527f43616e206f6e6c792062652063616c6c6564206279206120726f6c65206d616e60448201527f61676572000000000000000000000000000000000000000000000000000000006064820152608401610548565b600084815260056020908152604080832073ffffffffffffffffffffffffffffffffffffffff8716808552600390910190925280832080547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0016905551339287917feb3e33034c392e69263b04ec0fa376dc12784a41b6676c7f31b936cbc0fbb5af9190a450505050565b6108f860008261100d565b50565b81600260008281526005602052604090206001015460ff16600281111561092457610924611d77565b146109b1576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602c60248201527f4d7573742062652063616c6c6564206f6e20616e20696e697469616c697a656460448201527f2053686172656420726f6c6500000000000000000000000000000000000000006064820152608401610548565b60008381526005602052604090205483906109cc9033610b61565b610a57576040517f08c379a0000000000000000000000000000000000000000000000000000000008152602060048201526024808201527f43616e206f6e6c792062652063616c6c6564206279206120726f6c65206d616e60448201527f61676572000000000000000000000000000000000000000000000000000000006064820152608401610548565b6000848152600560205260409020610a72906003018461199d565b604051339073ffffffffffffffffffffffffffffffffffffffff85169086907f63502af7324ff6db91ab38f8236a648727d9385ea6c782073dd4882d8a61a48f90600090a450505050565b60006002610acb8133610b61565b610b57576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602260248201527f53656e64657220646f6573206e6f7420686f6c6420726571756972656420726f60448201527f6c650000000000000000000000000000000000000000000000000000000000006064820152608401610548565b61065684846117b0565b600082815260056020526040812060018082015460ff166002811115610b8957610b89611d77565b1415610bb857600281015473ffffffffffffffffffffffffffffffffffffffff8481169116145b915050610478565b6002600182015460ff166002811115610bd357610bd3611d77565b1415610c095773ffffffffffffffffffffffffffffffffffffffff8316600090815260038201602052604090205460ff16610bb0565b6040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152600e60248201527f496e76616c696420726f6c6549640000000000000000000000000000000000006044820152606401610548565b6060600480546103e490611ce2565b6108f860015b826108fb565b33600090815260016020908152604080832073ffffffffffffffffffffffffffffffffffffffff8616845290915281205482811015610d47576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602560248201527f45524332303a2064656372656173656420616c6c6f77616e63652062656c6f7760448201527f207a65726f0000000000000000000000000000000000000000000000000000006064820152608401610548565b6106563385858403611229565b60006104743384846113dc565b80600260008281526005602052604090206001015460ff166002811115610d8a57610d8a611d77565b14610e17576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602c60248201527f4d7573742062652063616c6c6564206f6e20616e20696e697469616c697a656460448201527f2053686172656420726f6c6500000000000000000000000000000000000000006064820152608401610548565b81610e228133610b61565b610eae576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602260248201527f53656e64657220646f6573206e6f7420686f6c6420726571756972656420726f60448201527f6c650000000000000000000000000000000000000000000000000000000000006064820152608401610548565b6000838152600560209081526040808320338452600301909152902080547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff001690556040513390819085907feb3e33034c392e69263b04ec0fa376dc12784a41b6676c7f31b936cbc0fbb5af90600090a4505050565b600081600160008281526005602052604090206001015460ff166002811115610f4f57610f4f611d77565b14610fdc576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602f60248201527f4d7573742062652063616c6c6564206f6e20616e20696e697469616c697a656460448201527f204578636c757369766520726f6c6500000000000000000000000000000000006064820152608401610548565b60008381526005602052604090206002015473ffffffffffffffffffffffffffffffffffffffff1691505b50919050565b81600160008281526005602052604090206001015460ff16600281111561103657611036611d77565b146110c3576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602f60248201527f4d7573742062652063616c6c6564206f6e20616e20696e697469616c697a656460448201527f204578636c757369766520726f6c6500000000000000000000000000000000006064820152608401610548565b60008381526005602052604090205483906110de9033610b61565b611169576040517f08c379a0000000000000000000000000000000000000000000000000000000008152602060048201526024808201527f43616e206f6e6c792062652063616c6c6564206279206120726f6c65206d616e60448201527f61676572000000000000000000000000000000000000000000000000000000006064820152608401610548565b60008481526005602052604090206111849060020184611a6a565b604051339073ffffffffffffffffffffffffffffffffffffffff85169086907f3b855c56b409b671c7112789d022675eb639d0bcb8896f1b6197c132f799e74690600090a450505050565b6108f86002610c80565b6107028282611a6a565b60005b8151811015611224576112128383838151811061120557611205611da6565b602002602001015161199d565b8061121c81611dd5565b9150506111e6565b505050565b73ffffffffffffffffffffffffffffffffffffffff83166112cb576040517f08c379a0000000000000000000000000000000000000000000000000000000008152602060048201526024808201527f45524332303a20617070726f76652066726f6d20746865207a65726f2061646460448201527f72657373000000000000000000000000000000000000000000000000000000006064820152608401610548565b73ffffffffffffffffffffffffffffffffffffffff821661136e576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602260248201527f45524332303a20617070726f766520746f20746865207a65726f20616464726560448201527f73730000000000000000000000000000000000000000000000000000000000006064820152608401610548565b73ffffffffffffffffffffffffffffffffffffffff83811660008181526001602090815260408083209487168084529482529182902085905590518481527f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925910160405180910390a3505050565b73ffffffffffffffffffffffffffffffffffffffff831661147f576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602560248201527f45524332303a207472616e736665722066726f6d20746865207a65726f20616460448201527f64726573730000000000000000000000000000000000000000000000000000006064820152608401610548565b73ffffffffffffffffffffffffffffffffffffffff8216611522576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602360248201527f45524332303a207472616e7366657220746f20746865207a65726f206164647260448201527f65737300000000000000000000000000000000000000000000000000000000006064820152608401610548565b73ffffffffffffffffffffffffffffffffffffffff8316600090815260208190526040902054818110156115d8576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602660248201527f45524332303a207472616e7366657220616d6f756e742065786365656473206260448201527f616c616e636500000000000000000000000000000000000000000000000000006064820152608401610548565b73ffffffffffffffffffffffffffffffffffffffff80851660009081526020819052604080822085850390559185168152908120805484929061161c908490611d5f565b925050819055508273ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef8460405161168291815260200190565b60405180910390a350505050565b73ffffffffffffffffffffffffffffffffffffffff821661170d576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601f60248201527f45524332303a206d696e7420746f20746865207a65726f2061646472657373006044820152606401610548565b806002600082825461171f9190611d5f565b909155505073ffffffffffffffffffffffffffffffffffffffff821660009081526020819052604081208054839290611759908490611d5f565b909155505060405181815273ffffffffffffffffffffffffffffffffffffffff8316906000907fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef9060200160405180910390a35050565b73ffffffffffffffffffffffffffffffffffffffff8216611853576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602160248201527f45524332303a206275726e2066726f6d20746865207a65726f2061646472657360448201527f73000000000000000000000000000000000000000000000000000000000000006064820152608401610548565b73ffffffffffffffffffffffffffffffffffffffff821660009081526020819052604090205481811015611909576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602260248201527f45524332303a206275726e20616d6f756e7420657863656564732062616c616e60448201527f63650000000000000000000000000000000000000000000000000000000000006064820152608401610548565b73ffffffffffffffffffffffffffffffffffffffff83166000908152602081905260408120838303905560028054849290611945908490611e0e565b909155505060405182815260009073ffffffffffffffffffffffffffffffffffffffff8516907fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef9060200160405180910390a3505050565b73ffffffffffffffffffffffffffffffffffffffff8116611a1a576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601f60248201527f43616e6e6f74206164642030783020746f20612073686172656420726f6c65006044820152606401610548565b73ffffffffffffffffffffffffffffffffffffffff1660009081526020919091526040902080547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff00166001179055565b73ffffffffffffffffffffffffffffffffffffffff8116611b0d576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602360248201527f43616e6e6f742073657420616e206578636c757369766520726f6c6520746f2060448201527f30783000000000000000000000000000000000000000000000000000000000006064820152608401610548565b81547fffffffffffffffffffffffff00000000000000000000000000000000000000001673ffffffffffffffffffffffffffffffffffffffff91909116179055565b600060208083528351808285015260005b81811015611b7c57858101830151858201604001528201611b60565b81811115611b8e576000604083870101525b50601f017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe016929092016040019392505050565b803573ffffffffffffffffffffffffffffffffffffffff81168114611be657600080fd5b919050565b60008060408385031215611bfe57600080fd5b611c0783611bc2565b946020939093013593505050565b600080600060608486031215611c2a57600080fd5b611c3384611bc2565b9250611c4160208501611bc2565b9150604084013590509250925092565b600060208284031215611c6357600080fd5b5035919050565b60008060408385031215611c7d57600080fd5b82359150611c8d60208401611bc2565b90509250929050565b600060208284031215611ca857600080fd5b611cb182611bc2565b9392505050565b60008060408385031215611ccb57600080fd5b611cd483611bc2565b9150611c8d60208401611bc2565b600181811c90821680611cf657607f821691505b60208210811415611007577f4e487b7100000000000000000000000000000000000000000000000000000000600052602260045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b60008219821115611d7257611d72611d30565b500190565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052602160045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b60007fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff821415611e0757611e07611d30565b5060010190565b600082821015611e2057611e20611d30565b50039056fea26469706673582212206711b075929f95fe84e8886d266c57cb729d320a6e18d9be873ebf48ca86bf8764736f6c634300080b0033417474656d7074656420746f2075736520616e20696e76616c696420726f6c65a26469706673582212208f4dfad5cf85f250d1f373171e32179d88acdd0fe441528253448fa05bbbe45464736f6c634300080b0033", + "solcInputHash": "c8b9349311d8b5049b613ac98eb998d0", + "metadata": "{\"compiler\":{\"version\":\"0.8.13+commit.abaa5c0e\"},\"language\":\"Solidity\",\"output\":{\"abi\":[{\"inputs\":[{\"internalType\":\"address\",\"name\":\"l1Token\",\"type\":\"address\"}],\"name\":\"createLpToken\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"nonpayable\",\"type\":\"function\"}],\"devdoc\":{\"kind\":\"dev\",\"methods\":{\"createLpToken(address)\":{\"params\":{\"l1Token\":\"L1 token to name in LP token name.\"},\"returns\":{\"_0\":\"address of new LP token.\"}}},\"version\":1},\"userdoc\":{\"kind\":\"user\",\"methods\":{\"createLpToken(address)\":{\"notice\":\"Deploys new LP token for L1 token. Sets caller as minter and burner of token.\"}},\"notice\":\"Factory to create new LP ERC20 tokens that represent a liquidity provider's position. HubPool is the intended client of this contract.\",\"version\":1}},\"settings\":{\"compilationTarget\":{\"contracts/LpTokenFactory.sol\":\"LpTokenFactory\"},\"evmVersion\":\"london\",\"libraries\":{},\"metadata\":{\"bytecodeHash\":\"ipfs\",\"useLiteralContent\":true},\"optimizer\":{\"enabled\":true,\"runs\":1000000},\"remappings\":[]},\"sources\":{\"@openzeppelin/contracts/token/ERC20/ERC20.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.5.0) (token/ERC20/ERC20.sol)\\n\\npragma solidity ^0.8.0;\\n\\nimport \\\"./IERC20.sol\\\";\\nimport \\\"./extensions/IERC20Metadata.sol\\\";\\nimport \\\"../../utils/Context.sol\\\";\\n\\n/**\\n * @dev Implementation of the {IERC20} interface.\\n *\\n * This implementation is agnostic to the way tokens are created. This means\\n * that a supply mechanism has to be added in a derived contract using {_mint}.\\n * For a generic mechanism see {ERC20PresetMinterPauser}.\\n *\\n * TIP: For a detailed writeup see our guide\\n * https://forum.zeppelin.solutions/t/how-to-implement-erc20-supply-mechanisms/226[How\\n * to implement supply mechanisms].\\n *\\n * We have followed general OpenZeppelin Contracts guidelines: functions revert\\n * instead returning `false` on failure. This behavior is nonetheless\\n * conventional and does not conflict with the expectations of ERC20\\n * applications.\\n *\\n * Additionally, an {Approval} event is emitted on calls to {transferFrom}.\\n * This allows applications to reconstruct the allowance for all accounts just\\n * by listening to said events. Other implementations of the EIP may not emit\\n * these events, as it isn't required by the specification.\\n *\\n * Finally, the non-standard {decreaseAllowance} and {increaseAllowance}\\n * functions have been added to mitigate the well-known issues around setting\\n * allowances. See {IERC20-approve}.\\n */\\ncontract ERC20 is Context, IERC20, IERC20Metadata {\\n mapping(address => uint256) private _balances;\\n\\n mapping(address => mapping(address => uint256)) private _allowances;\\n\\n uint256 private _totalSupply;\\n\\n string private _name;\\n string private _symbol;\\n\\n /**\\n * @dev Sets the values for {name} and {symbol}.\\n *\\n * The default value of {decimals} is 18. To select a different value for\\n * {decimals} you should overload it.\\n *\\n * All two of these values are immutable: they can only be set once during\\n * construction.\\n */\\n constructor(string memory name_, string memory symbol_) {\\n _name = name_;\\n _symbol = symbol_;\\n }\\n\\n /**\\n * @dev Returns the name of the token.\\n */\\n function name() public view virtual override returns (string memory) {\\n return _name;\\n }\\n\\n /**\\n * @dev Returns the symbol of the token, usually a shorter version of the\\n * name.\\n */\\n function symbol() public view virtual override returns (string memory) {\\n return _symbol;\\n }\\n\\n /**\\n * @dev Returns the number of decimals used to get its user representation.\\n * For example, if `decimals` equals `2`, a balance of `505` tokens should\\n * be displayed to a user as `5.05` (`505 / 10 ** 2`).\\n *\\n * Tokens usually opt for a value of 18, imitating the relationship between\\n * Ether and Wei. This is the value {ERC20} uses, unless this function is\\n * overridden;\\n *\\n * NOTE: This information is only used for _display_ purposes: it in\\n * no way affects any of the arithmetic of the contract, including\\n * {IERC20-balanceOf} and {IERC20-transfer}.\\n */\\n function decimals() public view virtual override returns (uint8) {\\n return 18;\\n }\\n\\n /**\\n * @dev See {IERC20-totalSupply}.\\n */\\n function totalSupply() public view virtual override returns (uint256) {\\n return _totalSupply;\\n }\\n\\n /**\\n * @dev See {IERC20-balanceOf}.\\n */\\n function balanceOf(address account) public view virtual override returns (uint256) {\\n return _balances[account];\\n }\\n\\n /**\\n * @dev See {IERC20-transfer}.\\n *\\n * Requirements:\\n *\\n * - `to` cannot be the zero address.\\n * - the caller must have a balance of at least `amount`.\\n */\\n function transfer(address to, uint256 amount) public virtual override returns (bool) {\\n address owner = _msgSender();\\n _transfer(owner, to, amount);\\n return true;\\n }\\n\\n /**\\n * @dev See {IERC20-allowance}.\\n */\\n function allowance(address owner, address spender) public view virtual override returns (uint256) {\\n return _allowances[owner][spender];\\n }\\n\\n /**\\n * @dev See {IERC20-approve}.\\n *\\n * NOTE: If `amount` is the maximum `uint256`, the allowance is not updated on\\n * `transferFrom`. This is semantically equivalent to an infinite approval.\\n *\\n * Requirements:\\n *\\n * - `spender` cannot be the zero address.\\n */\\n function approve(address spender, uint256 amount) public virtual override returns (bool) {\\n address owner = _msgSender();\\n _approve(owner, spender, amount);\\n return true;\\n }\\n\\n /**\\n * @dev See {IERC20-transferFrom}.\\n *\\n * Emits an {Approval} event indicating the updated allowance. This is not\\n * required by the EIP. See the note at the beginning of {ERC20}.\\n *\\n * NOTE: Does not update the allowance if the current allowance\\n * is the maximum `uint256`.\\n *\\n * Requirements:\\n *\\n * - `from` and `to` cannot be the zero address.\\n * - `from` must have a balance of at least `amount`.\\n * - the caller must have allowance for ``from``'s tokens of at least\\n * `amount`.\\n */\\n function transferFrom(\\n address from,\\n address to,\\n uint256 amount\\n ) public virtual override returns (bool) {\\n address spender = _msgSender();\\n _spendAllowance(from, spender, amount);\\n _transfer(from, to, amount);\\n return true;\\n }\\n\\n /**\\n * @dev Atomically increases the allowance granted to `spender` by the caller.\\n *\\n * This is an alternative to {approve} that can be used as a mitigation for\\n * problems described in {IERC20-approve}.\\n *\\n * Emits an {Approval} event indicating the updated allowance.\\n *\\n * Requirements:\\n *\\n * - `spender` cannot be the zero address.\\n */\\n function increaseAllowance(address spender, uint256 addedValue) public virtual returns (bool) {\\n address owner = _msgSender();\\n _approve(owner, spender, _allowances[owner][spender] + addedValue);\\n return true;\\n }\\n\\n /**\\n * @dev Atomically decreases the allowance granted to `spender` by the caller.\\n *\\n * This is an alternative to {approve} that can be used as a mitigation for\\n * problems described in {IERC20-approve}.\\n *\\n * Emits an {Approval} event indicating the updated allowance.\\n *\\n * Requirements:\\n *\\n * - `spender` cannot be the zero address.\\n * - `spender` must have allowance for the caller of at least\\n * `subtractedValue`.\\n */\\n function decreaseAllowance(address spender, uint256 subtractedValue) public virtual returns (bool) {\\n address owner = _msgSender();\\n uint256 currentAllowance = _allowances[owner][spender];\\n require(currentAllowance >= subtractedValue, \\\"ERC20: decreased allowance below zero\\\");\\n unchecked {\\n _approve(owner, spender, currentAllowance - subtractedValue);\\n }\\n\\n return true;\\n }\\n\\n /**\\n * @dev Moves `amount` of tokens from `sender` to `recipient`.\\n *\\n * This internal function is equivalent to {transfer}, and can be used to\\n * e.g. implement automatic token fees, slashing mechanisms, etc.\\n *\\n * Emits a {Transfer} event.\\n *\\n * Requirements:\\n *\\n * - `from` cannot be the zero address.\\n * - `to` cannot be the zero address.\\n * - `from` must have a balance of at least `amount`.\\n */\\n function _transfer(\\n address from,\\n address to,\\n uint256 amount\\n ) internal virtual {\\n require(from != address(0), \\\"ERC20: transfer from the zero address\\\");\\n require(to != address(0), \\\"ERC20: transfer to the zero address\\\");\\n\\n _beforeTokenTransfer(from, to, amount);\\n\\n uint256 fromBalance = _balances[from];\\n require(fromBalance >= amount, \\\"ERC20: transfer amount exceeds balance\\\");\\n unchecked {\\n _balances[from] = fromBalance - amount;\\n }\\n _balances[to] += amount;\\n\\n emit Transfer(from, to, amount);\\n\\n _afterTokenTransfer(from, to, amount);\\n }\\n\\n /** @dev Creates `amount` tokens and assigns them to `account`, increasing\\n * the total supply.\\n *\\n * Emits a {Transfer} event with `from` set to the zero address.\\n *\\n * Requirements:\\n *\\n * - `account` cannot be the zero address.\\n */\\n function _mint(address account, uint256 amount) internal virtual {\\n require(account != address(0), \\\"ERC20: mint to the zero address\\\");\\n\\n _beforeTokenTransfer(address(0), account, amount);\\n\\n _totalSupply += amount;\\n _balances[account] += amount;\\n emit Transfer(address(0), account, amount);\\n\\n _afterTokenTransfer(address(0), account, amount);\\n }\\n\\n /**\\n * @dev Destroys `amount` tokens from `account`, reducing the\\n * total supply.\\n *\\n * Emits a {Transfer} event with `to` set to the zero address.\\n *\\n * Requirements:\\n *\\n * - `account` cannot be the zero address.\\n * - `account` must have at least `amount` tokens.\\n */\\n function _burn(address account, uint256 amount) internal virtual {\\n require(account != address(0), \\\"ERC20: burn from the zero address\\\");\\n\\n _beforeTokenTransfer(account, address(0), amount);\\n\\n uint256 accountBalance = _balances[account];\\n require(accountBalance >= amount, \\\"ERC20: burn amount exceeds balance\\\");\\n unchecked {\\n _balances[account] = accountBalance - amount;\\n }\\n _totalSupply -= amount;\\n\\n emit Transfer(account, address(0), amount);\\n\\n _afterTokenTransfer(account, address(0), amount);\\n }\\n\\n /**\\n * @dev Sets `amount` as the allowance of `spender` over the `owner` s tokens.\\n *\\n * This internal function is equivalent to `approve`, and can be used to\\n * e.g. set automatic allowances for certain subsystems, etc.\\n *\\n * Emits an {Approval} event.\\n *\\n * Requirements:\\n *\\n * - `owner` cannot be the zero address.\\n * - `spender` cannot be the zero address.\\n */\\n function _approve(\\n address owner,\\n address spender,\\n uint256 amount\\n ) internal virtual {\\n require(owner != address(0), \\\"ERC20: approve from the zero address\\\");\\n require(spender != address(0), \\\"ERC20: approve to the zero address\\\");\\n\\n _allowances[owner][spender] = amount;\\n emit Approval(owner, spender, amount);\\n }\\n\\n /**\\n * @dev Spend `amount` form the allowance of `owner` toward `spender`.\\n *\\n * Does not update the allowance amount in case of infinite allowance.\\n * Revert if not enough allowance is available.\\n *\\n * Might emit an {Approval} event.\\n */\\n function _spendAllowance(\\n address owner,\\n address spender,\\n uint256 amount\\n ) internal virtual {\\n uint256 currentAllowance = allowance(owner, spender);\\n if (currentAllowance != type(uint256).max) {\\n require(currentAllowance >= amount, \\\"ERC20: insufficient allowance\\\");\\n unchecked {\\n _approve(owner, spender, currentAllowance - amount);\\n }\\n }\\n }\\n\\n /**\\n * @dev Hook that is called before any transfer of tokens. This includes\\n * minting and burning.\\n *\\n * Calling conditions:\\n *\\n * - when `from` and `to` are both non-zero, `amount` of ``from``'s tokens\\n * will be transferred to `to`.\\n * - when `from` is zero, `amount` tokens will be minted for `to`.\\n * - when `to` is zero, `amount` of ``from``'s tokens will be burned.\\n * - `from` and `to` are never both zero.\\n *\\n * To learn more about hooks, head to xref:ROOT:extending-contracts.adoc#using-hooks[Using Hooks].\\n */\\n function _beforeTokenTransfer(\\n address from,\\n address to,\\n uint256 amount\\n ) internal virtual {}\\n\\n /**\\n * @dev Hook that is called after any transfer of tokens. This includes\\n * minting and burning.\\n *\\n * Calling conditions:\\n *\\n * - when `from` and `to` are both non-zero, `amount` of ``from``'s tokens\\n * has been transferred to `to`.\\n * - when `from` is zero, `amount` tokens have been minted for `to`.\\n * - when `to` is zero, `amount` of ``from``'s tokens have been burned.\\n * - `from` and `to` are never both zero.\\n *\\n * To learn more about hooks, head to xref:ROOT:extending-contracts.adoc#using-hooks[Using Hooks].\\n */\\n function _afterTokenTransfer(\\n address from,\\n address to,\\n uint256 amount\\n ) internal virtual {}\\n}\\n\",\"keccak256\":\"0xdadd41acb749920eccf40aeaa8d291adf9751399a7343561bad13e7a8d99be0b\",\"license\":\"MIT\"},\"@openzeppelin/contracts/token/ERC20/IERC20.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.5.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 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(\\n address from,\\n address to,\\n uint256 amount\\n ) external returns (bool);\\n\\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\",\"keccak256\":\"0xbbc8ac883ac3c0078ce5ad3e288fbb3ffcc8a30c3a98c0fda0114d64fc44fca2\",\"license\":\"MIT\"},\"@openzeppelin/contracts/token/ERC20/extensions/IERC20Metadata.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts v4.4.1 (token/ERC20/extensions/IERC20Metadata.sol)\\n\\npragma solidity ^0.8.0;\\n\\nimport \\\"../IERC20.sol\\\";\\n\\n/**\\n * @dev Interface for the optional metadata functions from the ERC20 standard.\\n *\\n * _Available since v4.1._\\n */\\ninterface IERC20Metadata is IERC20 {\\n /**\\n * @dev Returns the name of the token.\\n */\\n function name() external view returns (string memory);\\n\\n /**\\n * @dev Returns the symbol of the token.\\n */\\n function symbol() external view returns (string memory);\\n\\n /**\\n * @dev Returns the decimals places of the token.\\n */\\n function decimals() external view returns (uint8);\\n}\\n\",\"keccak256\":\"0x8de418a5503946cabe331f35fe242d3201a73f67f77aaeb7110acb1f30423aca\",\"license\":\"MIT\"},\"@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\",\"keccak256\":\"0xe2e337e6dde9ef6b680e07338c493ebea1b5fd09b43424112868e9cc1706bca7\",\"license\":\"MIT\"},\"@uma/core/contracts/common/implementation/ExpandedERC20.sol\":{\"content\":\"// SPDX-License-Identifier: AGPL-3.0-only\\npragma solidity ^0.8.0;\\n\\nimport \\\"@openzeppelin/contracts/token/ERC20/ERC20.sol\\\";\\nimport \\\"./MultiRole.sol\\\";\\nimport \\\"../interfaces/ExpandedIERC20.sol\\\";\\n\\n/**\\n * @title An ERC20 with permissioned burning and minting. The contract deployer will initially\\n * be the owner who is capable of adding new roles.\\n */\\ncontract ExpandedERC20 is ExpandedIERC20, ERC20, MultiRole {\\n enum Roles {\\n // Can set the minter and burner.\\n Owner,\\n // Addresses that can mint new tokens.\\n Minter,\\n // Addresses that can burn tokens that address owns.\\n Burner\\n }\\n\\n uint8 _decimals;\\n\\n /**\\n * @notice Constructs the ExpandedERC20.\\n * @param _tokenName The name which describes the new token.\\n * @param _tokenSymbol The ticker abbreviation of the name. Ideally < 5 chars.\\n * @param _tokenDecimals The number of decimals to define token precision.\\n */\\n constructor(\\n string memory _tokenName,\\n string memory _tokenSymbol,\\n uint8 _tokenDecimals\\n ) ERC20(_tokenName, _tokenSymbol) {\\n _decimals = _tokenDecimals;\\n _createExclusiveRole(uint256(Roles.Owner), uint256(Roles.Owner), msg.sender);\\n _createSharedRole(uint256(Roles.Minter), uint256(Roles.Owner), new address[](0));\\n _createSharedRole(uint256(Roles.Burner), uint256(Roles.Owner), new address[](0));\\n }\\n\\n function decimals() public view virtual override(ERC20) returns (uint8) {\\n return _decimals;\\n }\\n\\n /**\\n * @dev Mints `value` tokens to `recipient`, returning true on success.\\n * @param recipient address to mint to.\\n * @param value amount of tokens to mint.\\n * @return True if the mint succeeded, or False.\\n */\\n function mint(address recipient, uint256 value)\\n external\\n override\\n onlyRoleHolder(uint256(Roles.Minter))\\n returns (bool)\\n {\\n _mint(recipient, value);\\n return true;\\n }\\n\\n /**\\n * @dev Burns `value` tokens owned by `msg.sender`.\\n * @param value amount of tokens to burn.\\n */\\n function burn(uint256 value) external override onlyRoleHolder(uint256(Roles.Burner)) {\\n _burn(msg.sender, value);\\n }\\n\\n /**\\n * @dev Burns `value` tokens owned by `recipient`.\\n * @param recipient address to burn tokens from.\\n * @param value amount of tokens to burn.\\n * @return True if the burn succeeded, or False.\\n */\\n function burnFrom(address recipient, uint256 value)\\n external\\n override\\n onlyRoleHolder(uint256(Roles.Burner))\\n returns (bool)\\n {\\n _burn(recipient, value);\\n return true;\\n }\\n\\n /**\\n * @notice Add Minter role to account.\\n * @dev The caller must have the Owner role.\\n * @param account The address to which the Minter role is added.\\n */\\n function addMinter(address account) external virtual override {\\n addMember(uint256(Roles.Minter), account);\\n }\\n\\n /**\\n * @notice Add Burner role to account.\\n * @dev The caller must have the Owner role.\\n * @param account The address to which the Burner role is added.\\n */\\n function addBurner(address account) external virtual override {\\n addMember(uint256(Roles.Burner), account);\\n }\\n\\n /**\\n * @notice Reset Owner role to account.\\n * @dev The caller must have the Owner role.\\n * @param account The new holder of the Owner role.\\n */\\n function resetOwner(address account) external virtual override {\\n resetMember(uint256(Roles.Owner), account);\\n }\\n}\\n\",\"keccak256\":\"0x8201459d3f78a1f97da7c421f2fbb859924d4facfc5fc235ba65d85bf12b2229\",\"license\":\"AGPL-3.0-only\"},\"@uma/core/contracts/common/implementation/MultiRole.sol\":{\"content\":\"// SPDX-License-Identifier: AGPL-3.0-only\\npragma solidity ^0.8.0;\\n\\nlibrary Exclusive {\\n struct RoleMembership {\\n address member;\\n }\\n\\n function isMember(RoleMembership storage roleMembership, address memberToCheck) internal view returns (bool) {\\n return roleMembership.member == memberToCheck;\\n }\\n\\n function resetMember(RoleMembership storage roleMembership, address newMember) internal {\\n require(newMember != address(0x0), \\\"Cannot set an exclusive role to 0x0\\\");\\n roleMembership.member = newMember;\\n }\\n\\n function getMember(RoleMembership storage roleMembership) internal view returns (address) {\\n return roleMembership.member;\\n }\\n\\n function init(RoleMembership storage roleMembership, address initialMember) internal {\\n resetMember(roleMembership, initialMember);\\n }\\n}\\n\\nlibrary Shared {\\n struct RoleMembership {\\n mapping(address => bool) members;\\n }\\n\\n function isMember(RoleMembership storage roleMembership, address memberToCheck) internal view returns (bool) {\\n return roleMembership.members[memberToCheck];\\n }\\n\\n function addMember(RoleMembership storage roleMembership, address memberToAdd) internal {\\n require(memberToAdd != address(0x0), \\\"Cannot add 0x0 to a shared role\\\");\\n roleMembership.members[memberToAdd] = true;\\n }\\n\\n function removeMember(RoleMembership storage roleMembership, address memberToRemove) internal {\\n roleMembership.members[memberToRemove] = false;\\n }\\n\\n function init(RoleMembership storage roleMembership, address[] memory initialMembers) internal {\\n for (uint256 i = 0; i < initialMembers.length; i++) {\\n addMember(roleMembership, initialMembers[i]);\\n }\\n }\\n}\\n\\n/**\\n * @title Base class to manage permissions for the derived class.\\n */\\nabstract contract MultiRole {\\n using Exclusive for Exclusive.RoleMembership;\\n using Shared for Shared.RoleMembership;\\n\\n enum RoleType { Invalid, Exclusive, Shared }\\n\\n struct Role {\\n uint256 managingRole;\\n RoleType roleType;\\n Exclusive.RoleMembership exclusiveRoleMembership;\\n Shared.RoleMembership sharedRoleMembership;\\n }\\n\\n mapping(uint256 => Role) private roles;\\n\\n event ResetExclusiveMember(uint256 indexed roleId, address indexed newMember, address indexed manager);\\n event AddedSharedMember(uint256 indexed roleId, address indexed newMember, address indexed manager);\\n event RemovedSharedMember(uint256 indexed roleId, address indexed oldMember, address indexed manager);\\n\\n /**\\n * @notice Reverts unless the caller is a member of the specified roleId.\\n */\\n modifier onlyRoleHolder(uint256 roleId) {\\n require(holdsRole(roleId, msg.sender), \\\"Sender does not hold required role\\\");\\n _;\\n }\\n\\n /**\\n * @notice Reverts unless the caller is a member of the manager role for the specified roleId.\\n */\\n modifier onlyRoleManager(uint256 roleId) {\\n require(holdsRole(roles[roleId].managingRole, msg.sender), \\\"Can only be called by a role manager\\\");\\n _;\\n }\\n\\n /**\\n * @notice Reverts unless the roleId represents an initialized, exclusive roleId.\\n */\\n modifier onlyExclusive(uint256 roleId) {\\n require(roles[roleId].roleType == RoleType.Exclusive, \\\"Must be called on an initialized Exclusive role\\\");\\n _;\\n }\\n\\n /**\\n * @notice Reverts unless the roleId represents an initialized, shared roleId.\\n */\\n modifier onlyShared(uint256 roleId) {\\n require(roles[roleId].roleType == RoleType.Shared, \\\"Must be called on an initialized Shared role\\\");\\n _;\\n }\\n\\n /**\\n * @notice Whether `memberToCheck` is a member of roleId.\\n * @dev Reverts if roleId does not correspond to an initialized role.\\n * @param roleId the Role to check.\\n * @param memberToCheck the address to check.\\n * @return True if `memberToCheck` is a member of `roleId`.\\n */\\n function holdsRole(uint256 roleId, address memberToCheck) public view returns (bool) {\\n Role storage role = roles[roleId];\\n if (role.roleType == RoleType.Exclusive) {\\n return role.exclusiveRoleMembership.isMember(memberToCheck);\\n } else if (role.roleType == RoleType.Shared) {\\n return role.sharedRoleMembership.isMember(memberToCheck);\\n }\\n revert(\\\"Invalid roleId\\\");\\n }\\n\\n /**\\n * @notice Changes the exclusive role holder of `roleId` to `newMember`.\\n * @dev Reverts if the caller is not a member of the managing role for `roleId` or if `roleId` is not an\\n * initialized, ExclusiveRole.\\n * @param roleId the ExclusiveRole membership to modify.\\n * @param newMember the new ExclusiveRole member.\\n */\\n function resetMember(uint256 roleId, address newMember) public onlyExclusive(roleId) onlyRoleManager(roleId) {\\n roles[roleId].exclusiveRoleMembership.resetMember(newMember);\\n emit ResetExclusiveMember(roleId, newMember, msg.sender);\\n }\\n\\n /**\\n * @notice Gets the current holder of the exclusive role, `roleId`.\\n * @dev Reverts if `roleId` does not represent an initialized, exclusive role.\\n * @param roleId the ExclusiveRole membership to check.\\n * @return the address of the current ExclusiveRole member.\\n */\\n function getMember(uint256 roleId) public view onlyExclusive(roleId) returns (address) {\\n return roles[roleId].exclusiveRoleMembership.getMember();\\n }\\n\\n /**\\n * @notice Adds `newMember` to the shared role, `roleId`.\\n * @dev Reverts if `roleId` does not represent an initialized, SharedRole or if the caller is not a member of the\\n * managing role for `roleId`.\\n * @param roleId the SharedRole membership to modify.\\n * @param newMember the new SharedRole member.\\n */\\n function addMember(uint256 roleId, address newMember) public onlyShared(roleId) onlyRoleManager(roleId) {\\n roles[roleId].sharedRoleMembership.addMember(newMember);\\n emit AddedSharedMember(roleId, newMember, msg.sender);\\n }\\n\\n /**\\n * @notice Removes `memberToRemove` from the shared role, `roleId`.\\n * @dev Reverts if `roleId` does not represent an initialized, SharedRole or if the caller is not a member of the\\n * managing role for `roleId`.\\n * @param roleId the SharedRole membership to modify.\\n * @param memberToRemove the current SharedRole member to remove.\\n */\\n function removeMember(uint256 roleId, address memberToRemove) public onlyShared(roleId) onlyRoleManager(roleId) {\\n roles[roleId].sharedRoleMembership.removeMember(memberToRemove);\\n emit RemovedSharedMember(roleId, memberToRemove, msg.sender);\\n }\\n\\n /**\\n * @notice Removes caller from the role, `roleId`.\\n * @dev Reverts if the caller is not a member of the role for `roleId` or if `roleId` is not an\\n * initialized, SharedRole.\\n * @param roleId the SharedRole membership to modify.\\n */\\n function renounceMembership(uint256 roleId) public onlyShared(roleId) onlyRoleHolder(roleId) {\\n roles[roleId].sharedRoleMembership.removeMember(msg.sender);\\n emit RemovedSharedMember(roleId, msg.sender, msg.sender);\\n }\\n\\n /**\\n * @notice Reverts if `roleId` is not initialized.\\n */\\n modifier onlyValidRole(uint256 roleId) {\\n require(roles[roleId].roleType != RoleType.Invalid, \\\"Attempted to use an invalid roleId\\\");\\n _;\\n }\\n\\n /**\\n * @notice Reverts if `roleId` is initialized.\\n */\\n modifier onlyInvalidRole(uint256 roleId) {\\n require(roles[roleId].roleType == RoleType.Invalid, \\\"Cannot use a pre-existing role\\\");\\n _;\\n }\\n\\n /**\\n * @notice Internal method to initialize a shared role, `roleId`, which will be managed by `managingRoleId`.\\n * `initialMembers` will be immediately added to the role.\\n * @dev Should be called by derived contracts, usually at construction time. Will revert if the role is already\\n * initialized.\\n */\\n function _createSharedRole(\\n uint256 roleId,\\n uint256 managingRoleId,\\n address[] memory initialMembers\\n ) internal onlyInvalidRole(roleId) {\\n Role storage role = roles[roleId];\\n role.roleType = RoleType.Shared;\\n role.managingRole = managingRoleId;\\n role.sharedRoleMembership.init(initialMembers);\\n require(\\n roles[managingRoleId].roleType != RoleType.Invalid,\\n \\\"Attempted to use an invalid role to manage a shared role\\\"\\n );\\n }\\n\\n /**\\n * @notice Internal method to initialize an exclusive role, `roleId`, which will be managed by `managingRoleId`.\\n * `initialMember` will be immediately added to the role.\\n * @dev Should be called by derived contracts, usually at construction time. Will revert if the role is already\\n * initialized.\\n */\\n function _createExclusiveRole(\\n uint256 roleId,\\n uint256 managingRoleId,\\n address initialMember\\n ) internal onlyInvalidRole(roleId) {\\n Role storage role = roles[roleId];\\n role.roleType = RoleType.Exclusive;\\n role.managingRole = managingRoleId;\\n role.exclusiveRoleMembership.init(initialMember);\\n require(\\n roles[managingRoleId].roleType != RoleType.Invalid,\\n \\\"Attempted to use an invalid role to manage an exclusive role\\\"\\n );\\n }\\n}\\n\",\"keccak256\":\"0x134c5a2f847832705be631f2b4eb2a3e23a91a2f0e63560abb481e85eeebfae6\",\"license\":\"AGPL-3.0-only\"},\"@uma/core/contracts/common/interfaces/ExpandedIERC20.sol\":{\"content\":\"// SPDX-License-Identifier: AGPL-3.0-only\\npragma solidity ^0.8.0;\\n\\nimport \\\"@openzeppelin/contracts/token/ERC20/IERC20.sol\\\";\\n\\n/**\\n * @title ERC20 interface that includes burn and mint methods.\\n */\\nabstract contract ExpandedIERC20 is IERC20 {\\n /**\\n * @notice Burns a specific amount of the caller's tokens.\\n * @dev Only burns the caller's tokens, so it is safe to leave this method permissionless.\\n */\\n function burn(uint256 value) external virtual;\\n\\n /**\\n * @dev Burns `value` tokens owned by `recipient`.\\n * @param recipient address to burn tokens from.\\n * @param value amount of tokens to burn.\\n */\\n function burnFrom(address recipient, uint256 value) external virtual returns (bool);\\n\\n /**\\n * @notice Mints tokens and adds them to the balance of the `to` address.\\n * @dev This method should be permissioned to only allow designated parties to mint tokens.\\n */\\n function mint(address to, uint256 value) external virtual returns (bool);\\n\\n function addMinter(address account) external virtual;\\n\\n function addBurner(address account) external virtual;\\n\\n function resetOwner(address account) external virtual;\\n}\\n\",\"keccak256\":\"0xb8252039cba45f1c19cd677f150a9823a5d6e1845cad90e3041d97c96f273c26\",\"license\":\"AGPL-3.0-only\"},\"contracts/LpTokenFactory.sol\":{\"content\":\"// SPDX-License-Identifier: GPL-3.0-only\\npragma solidity ^0.8.0;\\n\\nimport \\\"./interfaces/LpTokenFactoryInterface.sol\\\";\\n\\nimport \\\"@uma/core/contracts/common/implementation/ExpandedERC20.sol\\\";\\n\\n/**\\n * @notice Factory to create new LP ERC20 tokens that represent a liquidity provider's position. HubPool is the\\n * intended client of this contract.\\n */\\ncontract LpTokenFactory is LpTokenFactoryInterface {\\n /**\\n * @notice Deploys new LP token for L1 token. Sets caller as minter and burner of token.\\n * @param l1Token L1 token to name in LP token name.\\n * @return address of new LP token.\\n */\\n function createLpToken(address l1Token) public returns (address) {\\n ExpandedERC20 lpToken = new ExpandedERC20(\\n _append(\\\"Across V2 \\\", IERC20Metadata(l1Token).name(), \\\" LP Token\\\"), // LP Token Name\\n _append(\\\"Av2-\\\", IERC20Metadata(l1Token).symbol(), \\\"-LP\\\"), // LP Token Symbol\\n IERC20Metadata(l1Token).decimals() // LP Token Decimals\\n );\\n lpToken.addMinter(msg.sender); // Set the caller as the LP Token's minter.\\n lpToken.addBurner(msg.sender); // Set the caller as the LP Token's burner.\\n lpToken.resetOwner(msg.sender); // Set the caller as the LP Token's owner.\\n\\n return address(lpToken);\\n }\\n\\n function _append(\\n string memory a,\\n string memory b,\\n string memory c\\n ) internal pure returns (string memory) {\\n return string(abi.encodePacked(a, b, c));\\n }\\n}\\n\",\"keccak256\":\"0x3af40092646f132fcdba4c42b51359abcd3797e5084fad627dd27ba47e0ca9c9\",\"license\":\"GPL-3.0-only\"},\"contracts/interfaces/LpTokenFactoryInterface.sol\":{\"content\":\"// SPDX-License-Identifier: AGPL-3.0-only\\npragma solidity ^0.8.0;\\n\\ninterface LpTokenFactoryInterface {\\n function createLpToken(address l1Token) external returns (address);\\n}\\n\",\"keccak256\":\"0x9cf1d6df25bb1bdf34db2473f3caaa4264b628ae2fc0f0a5a0256fd41214b47d\",\"license\":\"AGPL-3.0-only\"}},\"version\":1}", + "bytecode": "0x608060405234801561001057600080fd5b50612d78806100206000396000f3fe60806040523480156200001157600080fd5b50600436106200002e5760003560e01c8063fc2f1b6e1462000033575b600080fd5b6200004a6200004436600462000502565b62000073565b60405173ffffffffffffffffffffffffffffffffffffffff909116815260200160405180910390f35b600080620001806040518060400160405280600a81526020017f4163726f737320563220000000000000000000000000000000000000000000008152508473ffffffffffffffffffffffffffffffffffffffff166306fdde036040518163ffffffff1660e01b8152600401600060405180830381865afa158015620000fc573d6000803e3d6000fd5b505050506040513d6000823e601f3d9081017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0168201604052620001449190810190620005a3565b6040518060400160405280600981526020017f204c5020546f6b656e0000000000000000000000000000000000000000000000815250620004c3565b6200028a6040518060400160405280600481526020017f4176322d000000000000000000000000000000000000000000000000000000008152508573ffffffffffffffffffffffffffffffffffffffff166395d89b416040518163ffffffff1660e01b8152600401600060405180830381865afa15801562000206573d6000803e3d6000fd5b505050506040513d6000823e601f3d9081017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe01682016040526200024e9190810190620005a3565b6040518060400160405280600381526020017f2d4c500000000000000000000000000000000000000000000000000000000000815250620004c3565b8473ffffffffffffffffffffffffffffffffffffffff1663313ce5676040518163ffffffff1660e01b8152600401602060405180830381865afa158015620002d6573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190620002fc91906200067a565b6040516200030a90620004f4565b6200031893929190620006eb565b604051809103906000f08015801562000335573d6000803e3d6000fd5b506040517f983b2d5600000000000000000000000000000000000000000000000000000000815233600482015290915073ffffffffffffffffffffffffffffffffffffffff82169063983b2d5690602401600060405180830381600087803b158015620003a157600080fd5b505af1158015620003b6573d6000803e3d6000fd5b50506040517ff44637ba00000000000000000000000000000000000000000000000000000000815233600482015273ffffffffffffffffffffffffffffffffffffffff8416925063f44637ba9150602401600060405180830381600087803b1580156200042257600080fd5b505af115801562000437573d6000803e3d6000fd5b50506040517f73cc802a00000000000000000000000000000000000000000000000000000000815233600482015273ffffffffffffffffffffffffffffffffffffffff841692506373cc802a9150602401600060405180830381600087803b158015620004a357600080fd5b505af1158015620004b8573d6000803e3d6000fd5b509295945050505050565b6060838383604051602001620004dc9392919062000728565b60405160208183030381529060405290509392505050565b6125d1806200077283390190565b6000602082840312156200051557600080fd5b813573ffffffffffffffffffffffffffffffffffffffff811681146200053a57600080fd5b9392505050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b60005b838110156200058d57818101518382015260200162000573565b838111156200059d576000848401525b50505050565b600060208284031215620005b657600080fd5b815167ffffffffffffffff80821115620005cf57600080fd5b818401915084601f830112620005e457600080fd5b815181811115620005f957620005f962000541565b604051601f82017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0908116603f0116810190838211818310171562000642576200064262000541565b816040528281528760208487010111156200065c57600080fd5b6200066f83602083016020880162000570565b979650505050505050565b6000602082840312156200068d57600080fd5b815160ff811681146200053a57600080fd5b60008151808452620006b981602086016020860162000570565b601f017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0169290920160200192915050565b6060815260006200070060608301866200069f565b82810360208401526200071481866200069f565b91505060ff83166040830152949350505050565b600084516200073c81846020890162000570565b8451908301906200075281836020890162000570565b84519101906200076781836020880162000570565b019594505050505056fe60806040523480156200001157600080fd5b50604051620025d1380380620025d1833981016040819052620000349162000621565b8251839083906200004d906003906020850190620004ae565b50805162000063906004906020840190620004ae565b50506006805460ff191660ff8416179055506200008360008033620000b5565b620000a060015b6040805160008082526020820190925262000205565b620000ac60026200008a565b50505062000736565b826000808281526005602052604090206001015460ff166002811115620000e057620000e0620006a6565b14620001335760405162461bcd60e51b815260206004820152601e60248201527f43616e6e6f74207573652061207072652d6578697374696e6720726f6c65000060448201526064015b60405180910390fd5b60008481526005602052604090206001808201805460ff1916828002179055508381556200017160028201846200034b602090811b6200111517901c565b60008481526005602052604081206001015460ff1660028111156200019a576200019a620006a6565b03620001fe5760405162461bcd60e51b815260206004820152603c6024820152600080516020620025b183398151915260448201527f20746f206d616e61676520616e206578636c757369766520726f6c650000000060648201526084016200012a565b5050505050565b826000808281526005602052604090206001015460ff166002811115620002305762000230620006a6565b146200027f5760405162461bcd60e51b815260206004820152601e60248201527f43616e6e6f74207573652061207072652d6578697374696e6720726f6c65000060448201526064016200012a565b600084815260056020908152604090912060018101805460ff1916600217905584815590620002be90600383019085906200111f6200035b821b17901c565b60008481526005602052604081206001015460ff166002811115620002e757620002e7620006a6565b03620001fe5760405162461bcd60e51b81526020600482015260386024820152600080516020620025b183398151915260448201527f20746f206d616e61676520612073686172656420726f6c65000000000000000060648201526084016200012a565b620003578282620003b0565b5050565b60005b8151811015620003ab576200039683838381518110620003825762000382620006bc565b60200260200101516200043160201b60201c565b80620003a281620006d2565b9150506200035e565b505050565b6001600160a01b038116620004145760405162461bcd60e51b815260206004820152602360248201527f43616e6e6f742073657420616e206578636c757369766520726f6c6520746f2060448201526203078360ec1b60648201526084016200012a565b81546001600160a01b0319166001600160a01b0391909116179055565b6001600160a01b038116620004895760405162461bcd60e51b815260206004820152601f60248201527f43616e6e6f74206164642030783020746f20612073686172656420726f6c650060448201526064016200012a565b6001600160a01b0316600090815260209190915260409020805460ff19166001179055565b828054620004bc90620006fa565b90600052602060002090601f016020900481019282620004e057600085556200052b565b82601f10620004fb57805160ff19168380011785556200052b565b828001600101855582156200052b579182015b828111156200052b5782518255916020019190600101906200050e565b50620005399291506200053d565b5090565b5b808211156200053957600081556001016200053e565b634e487b7160e01b600052604160045260246000fd5b600082601f8301126200057c57600080fd5b81516001600160401b038082111562000599576200059962000554565b604051601f8301601f19908116603f01168101908282118183101715620005c457620005c462000554565b81604052838152602092508683858801011115620005e157600080fd5b600091505b83821015620006055785820183015181830184015290820190620005e6565b83821115620006175760008385830101525b9695505050505050565b6000806000606084860312156200063757600080fd5b83516001600160401b03808211156200064f57600080fd5b6200065d878388016200056a565b945060208601519150808211156200067457600080fd5b5062000683868287016200056a565b925050604084015160ff811681146200069b57600080fd5b809150509250925092565b634e487b7160e01b600052602160045260246000fd5b634e487b7160e01b600052603260045260246000fd5b600060018201620006f357634e487b7160e01b600052601160045260246000fd5b5060010190565b600181811c908216806200070f57607f821691505b6020821081036200073057634e487b7160e01b600052602260045260246000fd5b50919050565b611e6b80620007466000396000f3fe608060405234801561001057600080fd5b506004361061018d5760003560e01c806374d0a676116100e3578063a9059cbb1161008c578063d97c05be11610066578063d97c05be14610369578063dd62ed3e1461037c578063f44637ba146103c257600080fd5b8063a9059cbb1461030b578063aaa14ca31461031e578063ab3545e51461033157600080fd5b806395d89b41116100bd57806395d89b41146102dd578063983b2d56146102e5578063a457c2d7146102f857600080fd5b806374d0a676146102a457806379cc6790146102b75780637cdc1cb9146102ca57600080fd5b806339509351116101455780636be7658b1161011f5780636be7658b1461024857806370a082311461025b57806373cc802a1461029157600080fd5b8063395093511461020d57806340c10f191461022057806342966c681461023357600080fd5b806318160ddd1161017657806318160ddd146101d357806323b872dd146101e5578063313ce567146101f857600080fd5b806306fdde0314610192578063095ea7b3146101b0575b600080fd5b61019a6103d5565b6040516101a79190611b61565b60405180910390f35b6101c36101be366004611bfd565b610467565b60405190151581526020016101a7565b6002545b6040519081526020016101a7565b6101c36101f3366004611c27565b610481565b60065460405160ff90911681526020016101a7565b6101c361021b366004611bfd565b6104a5565b6101c361022e366004611bfd565b6104f1565b610246610241366004611c63565b61059a565b005b610246610256366004611c7c565b610640565b6101d7610269366004611ca8565b73ffffffffffffffffffffffffffffffffffffffff1660009081526020819052604090205490565b61024661029f366004611ca8565b610827565b6102466102b2366004611c7c565b610835565b6101c36102c5366004611bfd565b6109f7565b6101c36102d8366004611c7c565b610a9b565b61019a610ba3565b6102466102f3366004611ca8565b610bb2565b6101c3610306366004611bfd565b610bbe565b6101c3610319366004611bfd565b610c8f565b61024661032c366004611c63565b610c9d565b61034461033f366004611c63565b610e60565b60405173ffffffffffffffffffffffffffffffffffffffff90911681526020016101a7565b610246610377366004611c7c565b610f49565b6101d761038a366004611cca565b73ffffffffffffffffffffffffffffffffffffffff918216600090815260016020908152604080832093909416825291909152205490565b6102466103d0366004611ca8565b61110b565b6060600380546103e490611cf4565b80601f016020809104026020016040519081016040528092919081815260200182805461041090611cf4565b801561045d5780601f106104325761010080835404028352916020019161045d565b820191906000526020600020905b81548152906001019060200180831161044057829003601f168201915b5050505050905090565b600033610475818585611165565b60019150505b92915050565b60003361048f858285611318565b61049a8585856113ef565b506001949350505050565b33600081815260016020908152604080832073ffffffffffffffffffffffffffffffffffffffff8716845290915281205490919061047590829086906104ec908790611d70565b611165565b600060016104ff8133610a9b565b610590576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602260248201527f53656e64657220646f6573206e6f7420686f6c6420726571756972656420726f60448201527f6c6500000000000000000000000000000000000000000000000000000000000060648201526084015b60405180910390fd5b61047584846116a2565b60026105a68133610a9b565b610632576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602260248201527f53656e64657220646f6573206e6f7420686f6c6420726571756972656420726f60448201527f6c650000000000000000000000000000000000000000000000000000000000006064820152608401610587565b61063c33836117c2565b5050565b81600260008281526005602052604090206001015460ff16600281111561066957610669611d88565b146106f6576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602c60248201527f4d7573742062652063616c6c6564206f6e20616e20696e697469616c697a656460448201527f2053686172656420726f6c6500000000000000000000000000000000000000006064820152608401610587565b60008381526005602052604090205483906107119033610a9b565b61079c576040517f08c379a0000000000000000000000000000000000000000000000000000000008152602060048201526024808201527f43616e206f6e6c792062652063616c6c6564206279206120726f6c65206d616e60448201527f61676572000000000000000000000000000000000000000000000000000000006064820152608401610587565b600084815260056020908152604080832073ffffffffffffffffffffffffffffffffffffffff8716808552600390910190925280832080547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0016905551339287917feb3e33034c392e69263b04ec0fa376dc12784a41b6676c7f31b936cbc0fbb5af9190a450505050565b610832600082610f49565b50565b81600260008281526005602052604090206001015460ff16600281111561085e5761085e611d88565b146108eb576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602c60248201527f4d7573742062652063616c6c6564206f6e20616e20696e697469616c697a656460448201527f2053686172656420726f6c6500000000000000000000000000000000000000006064820152608401610587565b60008381526005602052604090205483906109069033610a9b565b610991576040517f08c379a0000000000000000000000000000000000000000000000000000000008152602060048201526024808201527f43616e206f6e6c792062652063616c6c6564206279206120726f6c65206d616e60448201527f61676572000000000000000000000000000000000000000000000000000000006064820152608401610587565b60008481526005602052604090206109ac90600301846119af565b604051339073ffffffffffffffffffffffffffffffffffffffff85169086907f63502af7324ff6db91ab38f8236a648727d9385ea6c782073dd4882d8a61a48f90600090a450505050565b60006002610a058133610a9b565b610a91576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602260248201527f53656e64657220646f6573206e6f7420686f6c6420726571756972656420726f60448201527f6c650000000000000000000000000000000000000000000000000000000000006064820152608401610587565b61047584846117c2565b600082815260056020526040812060018082015460ff166002811115610ac357610ac3611d88565b03610af157600281015473ffffffffffffffffffffffffffffffffffffffff8481169116145b91505061047b565b6002600182015460ff166002811115610b0c57610b0c611d88565b03610b415773ffffffffffffffffffffffffffffffffffffffff8316600090815260038201602052604090205460ff16610ae9565b6040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152600e60248201527f496e76616c696420726f6c6549640000000000000000000000000000000000006044820152606401610587565b6060600480546103e490611cf4565b61083260015b82610835565b33600081815260016020908152604080832073ffffffffffffffffffffffffffffffffffffffff8716845290915281205490919083811015610c82576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602560248201527f45524332303a2064656372656173656420616c6c6f77616e63652062656c6f7760448201527f207a65726f0000000000000000000000000000000000000000000000000000006064820152608401610587565b61049a8286868403611165565b6000336104758185856113ef565b80600260008281526005602052604090206001015460ff166002811115610cc657610cc6611d88565b14610d53576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602c60248201527f4d7573742062652063616c6c6564206f6e20616e20696e697469616c697a656460448201527f2053686172656420726f6c6500000000000000000000000000000000000000006064820152608401610587565b81610d5e8133610a9b565b610dea576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602260248201527f53656e64657220646f6573206e6f7420686f6c6420726571756972656420726f60448201527f6c650000000000000000000000000000000000000000000000000000000000006064820152608401610587565b6000838152600560209081526040808320338452600301909152902080547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff001690556040513390819085907feb3e33034c392e69263b04ec0fa376dc12784a41b6676c7f31b936cbc0fbb5af90600090a4505050565b600081600160008281526005602052604090206001015460ff166002811115610e8b57610e8b611d88565b14610f18576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602f60248201527f4d7573742062652063616c6c6564206f6e20616e20696e697469616c697a656460448201527f204578636c757369766520726f6c6500000000000000000000000000000000006064820152608401610587565b60008381526005602052604090206002015473ffffffffffffffffffffffffffffffffffffffff1691505b50919050565b81600160008281526005602052604090206001015460ff166002811115610f7257610f72611d88565b14610fff576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602f60248201527f4d7573742062652063616c6c6564206f6e20616e20696e697469616c697a656460448201527f204578636c757369766520726f6c6500000000000000000000000000000000006064820152608401610587565b600083815260056020526040902054839061101a9033610a9b565b6110a5576040517f08c379a0000000000000000000000000000000000000000000000000000000008152602060048201526024808201527f43616e206f6e6c792062652063616c6c6564206279206120726f6c65206d616e60448201527f61676572000000000000000000000000000000000000000000000000000000006064820152608401610587565b60008481526005602052604090206110c09060020184611a7c565b604051339073ffffffffffffffffffffffffffffffffffffffff85169086907f3b855c56b409b671c7112789d022675eb639d0bcb8896f1b6197c132f799e74690600090a450505050565b6108326002610bb8565b61063c8282611a7c565b60005b81518110156111605761114e8383838151811061114157611141611db7565b60200260200101516119af565b8061115881611de6565b915050611122565b505050565b73ffffffffffffffffffffffffffffffffffffffff8316611207576040517f08c379a0000000000000000000000000000000000000000000000000000000008152602060048201526024808201527f45524332303a20617070726f76652066726f6d20746865207a65726f2061646460448201527f72657373000000000000000000000000000000000000000000000000000000006064820152608401610587565b73ffffffffffffffffffffffffffffffffffffffff82166112aa576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602260248201527f45524332303a20617070726f766520746f20746865207a65726f20616464726560448201527f73730000000000000000000000000000000000000000000000000000000000006064820152608401610587565b73ffffffffffffffffffffffffffffffffffffffff83811660008181526001602090815260408083209487168084529482529182902085905590518481527f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925910160405180910390a3505050565b73ffffffffffffffffffffffffffffffffffffffff8381166000908152600160209081526040808320938616835292905220547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff81146113e957818110156113dc576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601d60248201527f45524332303a20696e73756666696369656e7420616c6c6f77616e63650000006044820152606401610587565b6113e98484848403611165565b50505050565b73ffffffffffffffffffffffffffffffffffffffff8316611492576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602560248201527f45524332303a207472616e736665722066726f6d20746865207a65726f20616460448201527f64726573730000000000000000000000000000000000000000000000000000006064820152608401610587565b73ffffffffffffffffffffffffffffffffffffffff8216611535576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602360248201527f45524332303a207472616e7366657220746f20746865207a65726f206164647260448201527f65737300000000000000000000000000000000000000000000000000000000006064820152608401610587565b73ffffffffffffffffffffffffffffffffffffffff8316600090815260208190526040902054818110156115eb576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602660248201527f45524332303a207472616e7366657220616d6f756e742065786365656473206260448201527f616c616e636500000000000000000000000000000000000000000000000000006064820152608401610587565b73ffffffffffffffffffffffffffffffffffffffff80851660009081526020819052604080822085850390559185168152908120805484929061162f908490611d70565b925050819055508273ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef8460405161169591815260200190565b60405180910390a36113e9565b73ffffffffffffffffffffffffffffffffffffffff821661171f576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601f60248201527f45524332303a206d696e7420746f20746865207a65726f2061646472657373006044820152606401610587565b80600260008282546117319190611d70565b909155505073ffffffffffffffffffffffffffffffffffffffff82166000908152602081905260408120805483929061176b908490611d70565b909155505060405181815273ffffffffffffffffffffffffffffffffffffffff8316906000907fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef9060200160405180910390a35050565b73ffffffffffffffffffffffffffffffffffffffff8216611865576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602160248201527f45524332303a206275726e2066726f6d20746865207a65726f2061646472657360448201527f73000000000000000000000000000000000000000000000000000000000000006064820152608401610587565b73ffffffffffffffffffffffffffffffffffffffff82166000908152602081905260409020548181101561191b576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602260248201527f45524332303a206275726e20616d6f756e7420657863656564732062616c616e60448201527f63650000000000000000000000000000000000000000000000000000000000006064820152608401610587565b73ffffffffffffffffffffffffffffffffffffffff83166000908152602081905260408120838303905560028054849290611957908490611e1e565b909155505060405182815260009073ffffffffffffffffffffffffffffffffffffffff8516907fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef9060200160405180910390a3505050565b73ffffffffffffffffffffffffffffffffffffffff8116611a2c576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601f60248201527f43616e6e6f74206164642030783020746f20612073686172656420726f6c65006044820152606401610587565b73ffffffffffffffffffffffffffffffffffffffff1660009081526020919091526040902080547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff00166001179055565b73ffffffffffffffffffffffffffffffffffffffff8116611b1f576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602360248201527f43616e6e6f742073657420616e206578636c757369766520726f6c6520746f2060448201527f30783000000000000000000000000000000000000000000000000000000000006064820152608401610587565b81547fffffffffffffffffffffffff00000000000000000000000000000000000000001673ffffffffffffffffffffffffffffffffffffffff91909116179055565b600060208083528351808285015260005b81811015611b8e57858101830151858201604001528201611b72565b81811115611ba0576000604083870101525b50601f017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe016929092016040019392505050565b803573ffffffffffffffffffffffffffffffffffffffff81168114611bf857600080fd5b919050565b60008060408385031215611c1057600080fd5b611c1983611bd4565b946020939093013593505050565b600080600060608486031215611c3c57600080fd5b611c4584611bd4565b9250611c5360208501611bd4565b9150604084013590509250925092565b600060208284031215611c7557600080fd5b5035919050565b60008060408385031215611c8f57600080fd5b82359150611c9f60208401611bd4565b90509250929050565b600060208284031215611cba57600080fd5b611cc382611bd4565b9392505050565b60008060408385031215611cdd57600080fd5b611ce683611bd4565b9150611c9f60208401611bd4565b600181811c90821680611d0857607f821691505b602082108103610f43577f4e487b7100000000000000000000000000000000000000000000000000000000600052602260045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b60008219821115611d8357611d83611d41565b500190565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052602160045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b60007fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff8203611e1757611e17611d41565b5060010190565b600082821015611e3057611e30611d41565b50039056fea2646970667358221220af62dd4c842a6ec357c4de2464fc459ad78dbb38819fa288eb99f4a3a869cfcb64736f6c634300080d0033417474656d7074656420746f2075736520616e20696e76616c696420726f6c65a26469706673582212209d0b7b3b71c235b34e79d5b72791522522cbfce906136557bf267400633999a264736f6c634300080d0033", + "deployedBytecode": "0x60806040523480156200001157600080fd5b50600436106200002e5760003560e01c8063fc2f1b6e1462000033575b600080fd5b6200004a6200004436600462000502565b62000073565b60405173ffffffffffffffffffffffffffffffffffffffff909116815260200160405180910390f35b600080620001806040518060400160405280600a81526020017f4163726f737320563220000000000000000000000000000000000000000000008152508473ffffffffffffffffffffffffffffffffffffffff166306fdde036040518163ffffffff1660e01b8152600401600060405180830381865afa158015620000fc573d6000803e3d6000fd5b505050506040513d6000823e601f3d9081017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0168201604052620001449190810190620005a3565b6040518060400160405280600981526020017f204c5020546f6b656e0000000000000000000000000000000000000000000000815250620004c3565b6200028a6040518060400160405280600481526020017f4176322d000000000000000000000000000000000000000000000000000000008152508573ffffffffffffffffffffffffffffffffffffffff166395d89b416040518163ffffffff1660e01b8152600401600060405180830381865afa15801562000206573d6000803e3d6000fd5b505050506040513d6000823e601f3d9081017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe01682016040526200024e9190810190620005a3565b6040518060400160405280600381526020017f2d4c500000000000000000000000000000000000000000000000000000000000815250620004c3565b8473ffffffffffffffffffffffffffffffffffffffff1663313ce5676040518163ffffffff1660e01b8152600401602060405180830381865afa158015620002d6573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190620002fc91906200067a565b6040516200030a90620004f4565b6200031893929190620006eb565b604051809103906000f08015801562000335573d6000803e3d6000fd5b506040517f983b2d5600000000000000000000000000000000000000000000000000000000815233600482015290915073ffffffffffffffffffffffffffffffffffffffff82169063983b2d5690602401600060405180830381600087803b158015620003a157600080fd5b505af1158015620003b6573d6000803e3d6000fd5b50506040517ff44637ba00000000000000000000000000000000000000000000000000000000815233600482015273ffffffffffffffffffffffffffffffffffffffff8416925063f44637ba9150602401600060405180830381600087803b1580156200042257600080fd5b505af115801562000437573d6000803e3d6000fd5b50506040517f73cc802a00000000000000000000000000000000000000000000000000000000815233600482015273ffffffffffffffffffffffffffffffffffffffff841692506373cc802a9150602401600060405180830381600087803b158015620004a357600080fd5b505af1158015620004b8573d6000803e3d6000fd5b509295945050505050565b6060838383604051602001620004dc9392919062000728565b60405160208183030381529060405290509392505050565b6125d1806200077283390190565b6000602082840312156200051557600080fd5b813573ffffffffffffffffffffffffffffffffffffffff811681146200053a57600080fd5b9392505050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b60005b838110156200058d57818101518382015260200162000573565b838111156200059d576000848401525b50505050565b600060208284031215620005b657600080fd5b815167ffffffffffffffff80821115620005cf57600080fd5b818401915084601f830112620005e457600080fd5b815181811115620005f957620005f962000541565b604051601f82017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0908116603f0116810190838211818310171562000642576200064262000541565b816040528281528760208487010111156200065c57600080fd5b6200066f83602083016020880162000570565b979650505050505050565b6000602082840312156200068d57600080fd5b815160ff811681146200053a57600080fd5b60008151808452620006b981602086016020860162000570565b601f017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0169290920160200192915050565b6060815260006200070060608301866200069f565b82810360208401526200071481866200069f565b91505060ff83166040830152949350505050565b600084516200073c81846020890162000570565b8451908301906200075281836020890162000570565b84519101906200076781836020880162000570565b019594505050505056fe60806040523480156200001157600080fd5b50604051620025d1380380620025d1833981016040819052620000349162000621565b8251839083906200004d906003906020850190620004ae565b50805162000063906004906020840190620004ae565b50506006805460ff191660ff8416179055506200008360008033620000b5565b620000a060015b6040805160008082526020820190925262000205565b620000ac60026200008a565b50505062000736565b826000808281526005602052604090206001015460ff166002811115620000e057620000e0620006a6565b14620001335760405162461bcd60e51b815260206004820152601e60248201527f43616e6e6f74207573652061207072652d6578697374696e6720726f6c65000060448201526064015b60405180910390fd5b60008481526005602052604090206001808201805460ff1916828002179055508381556200017160028201846200034b602090811b6200111517901c565b60008481526005602052604081206001015460ff1660028111156200019a576200019a620006a6565b03620001fe5760405162461bcd60e51b815260206004820152603c6024820152600080516020620025b183398151915260448201527f20746f206d616e61676520616e206578636c757369766520726f6c650000000060648201526084016200012a565b5050505050565b826000808281526005602052604090206001015460ff166002811115620002305762000230620006a6565b146200027f5760405162461bcd60e51b815260206004820152601e60248201527f43616e6e6f74207573652061207072652d6578697374696e6720726f6c65000060448201526064016200012a565b600084815260056020908152604090912060018101805460ff1916600217905584815590620002be90600383019085906200111f6200035b821b17901c565b60008481526005602052604081206001015460ff166002811115620002e757620002e7620006a6565b03620001fe5760405162461bcd60e51b81526020600482015260386024820152600080516020620025b183398151915260448201527f20746f206d616e61676520612073686172656420726f6c65000000000000000060648201526084016200012a565b620003578282620003b0565b5050565b60005b8151811015620003ab576200039683838381518110620003825762000382620006bc565b60200260200101516200043160201b60201c565b80620003a281620006d2565b9150506200035e565b505050565b6001600160a01b038116620004145760405162461bcd60e51b815260206004820152602360248201527f43616e6e6f742073657420616e206578636c757369766520726f6c6520746f2060448201526203078360ec1b60648201526084016200012a565b81546001600160a01b0319166001600160a01b0391909116179055565b6001600160a01b038116620004895760405162461bcd60e51b815260206004820152601f60248201527f43616e6e6f74206164642030783020746f20612073686172656420726f6c650060448201526064016200012a565b6001600160a01b0316600090815260209190915260409020805460ff19166001179055565b828054620004bc90620006fa565b90600052602060002090601f016020900481019282620004e057600085556200052b565b82601f10620004fb57805160ff19168380011785556200052b565b828001600101855582156200052b579182015b828111156200052b5782518255916020019190600101906200050e565b50620005399291506200053d565b5090565b5b808211156200053957600081556001016200053e565b634e487b7160e01b600052604160045260246000fd5b600082601f8301126200057c57600080fd5b81516001600160401b038082111562000599576200059962000554565b604051601f8301601f19908116603f01168101908282118183101715620005c457620005c462000554565b81604052838152602092508683858801011115620005e157600080fd5b600091505b83821015620006055785820183015181830184015290820190620005e6565b83821115620006175760008385830101525b9695505050505050565b6000806000606084860312156200063757600080fd5b83516001600160401b03808211156200064f57600080fd5b6200065d878388016200056a565b945060208601519150808211156200067457600080fd5b5062000683868287016200056a565b925050604084015160ff811681146200069b57600080fd5b809150509250925092565b634e487b7160e01b600052602160045260246000fd5b634e487b7160e01b600052603260045260246000fd5b600060018201620006f357634e487b7160e01b600052601160045260246000fd5b5060010190565b600181811c908216806200070f57607f821691505b6020821081036200073057634e487b7160e01b600052602260045260246000fd5b50919050565b611e6b80620007466000396000f3fe608060405234801561001057600080fd5b506004361061018d5760003560e01c806374d0a676116100e3578063a9059cbb1161008c578063d97c05be11610066578063d97c05be14610369578063dd62ed3e1461037c578063f44637ba146103c257600080fd5b8063a9059cbb1461030b578063aaa14ca31461031e578063ab3545e51461033157600080fd5b806395d89b41116100bd57806395d89b41146102dd578063983b2d56146102e5578063a457c2d7146102f857600080fd5b806374d0a676146102a457806379cc6790146102b75780637cdc1cb9146102ca57600080fd5b806339509351116101455780636be7658b1161011f5780636be7658b1461024857806370a082311461025b57806373cc802a1461029157600080fd5b8063395093511461020d57806340c10f191461022057806342966c681461023357600080fd5b806318160ddd1161017657806318160ddd146101d357806323b872dd146101e5578063313ce567146101f857600080fd5b806306fdde0314610192578063095ea7b3146101b0575b600080fd5b61019a6103d5565b6040516101a79190611b61565b60405180910390f35b6101c36101be366004611bfd565b610467565b60405190151581526020016101a7565b6002545b6040519081526020016101a7565b6101c36101f3366004611c27565b610481565b60065460405160ff90911681526020016101a7565b6101c361021b366004611bfd565b6104a5565b6101c361022e366004611bfd565b6104f1565b610246610241366004611c63565b61059a565b005b610246610256366004611c7c565b610640565b6101d7610269366004611ca8565b73ffffffffffffffffffffffffffffffffffffffff1660009081526020819052604090205490565b61024661029f366004611ca8565b610827565b6102466102b2366004611c7c565b610835565b6101c36102c5366004611bfd565b6109f7565b6101c36102d8366004611c7c565b610a9b565b61019a610ba3565b6102466102f3366004611ca8565b610bb2565b6101c3610306366004611bfd565b610bbe565b6101c3610319366004611bfd565b610c8f565b61024661032c366004611c63565b610c9d565b61034461033f366004611c63565b610e60565b60405173ffffffffffffffffffffffffffffffffffffffff90911681526020016101a7565b610246610377366004611c7c565b610f49565b6101d761038a366004611cca565b73ffffffffffffffffffffffffffffffffffffffff918216600090815260016020908152604080832093909416825291909152205490565b6102466103d0366004611ca8565b61110b565b6060600380546103e490611cf4565b80601f016020809104026020016040519081016040528092919081815260200182805461041090611cf4565b801561045d5780601f106104325761010080835404028352916020019161045d565b820191906000526020600020905b81548152906001019060200180831161044057829003601f168201915b5050505050905090565b600033610475818585611165565b60019150505b92915050565b60003361048f858285611318565b61049a8585856113ef565b506001949350505050565b33600081815260016020908152604080832073ffffffffffffffffffffffffffffffffffffffff8716845290915281205490919061047590829086906104ec908790611d70565b611165565b600060016104ff8133610a9b565b610590576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602260248201527f53656e64657220646f6573206e6f7420686f6c6420726571756972656420726f60448201527f6c6500000000000000000000000000000000000000000000000000000000000060648201526084015b60405180910390fd5b61047584846116a2565b60026105a68133610a9b565b610632576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602260248201527f53656e64657220646f6573206e6f7420686f6c6420726571756972656420726f60448201527f6c650000000000000000000000000000000000000000000000000000000000006064820152608401610587565b61063c33836117c2565b5050565b81600260008281526005602052604090206001015460ff16600281111561066957610669611d88565b146106f6576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602c60248201527f4d7573742062652063616c6c6564206f6e20616e20696e697469616c697a656460448201527f2053686172656420726f6c6500000000000000000000000000000000000000006064820152608401610587565b60008381526005602052604090205483906107119033610a9b565b61079c576040517f08c379a0000000000000000000000000000000000000000000000000000000008152602060048201526024808201527f43616e206f6e6c792062652063616c6c6564206279206120726f6c65206d616e60448201527f61676572000000000000000000000000000000000000000000000000000000006064820152608401610587565b600084815260056020908152604080832073ffffffffffffffffffffffffffffffffffffffff8716808552600390910190925280832080547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0016905551339287917feb3e33034c392e69263b04ec0fa376dc12784a41b6676c7f31b936cbc0fbb5af9190a450505050565b610832600082610f49565b50565b81600260008281526005602052604090206001015460ff16600281111561085e5761085e611d88565b146108eb576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602c60248201527f4d7573742062652063616c6c6564206f6e20616e20696e697469616c697a656460448201527f2053686172656420726f6c6500000000000000000000000000000000000000006064820152608401610587565b60008381526005602052604090205483906109069033610a9b565b610991576040517f08c379a0000000000000000000000000000000000000000000000000000000008152602060048201526024808201527f43616e206f6e6c792062652063616c6c6564206279206120726f6c65206d616e60448201527f61676572000000000000000000000000000000000000000000000000000000006064820152608401610587565b60008481526005602052604090206109ac90600301846119af565b604051339073ffffffffffffffffffffffffffffffffffffffff85169086907f63502af7324ff6db91ab38f8236a648727d9385ea6c782073dd4882d8a61a48f90600090a450505050565b60006002610a058133610a9b565b610a91576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602260248201527f53656e64657220646f6573206e6f7420686f6c6420726571756972656420726f60448201527f6c650000000000000000000000000000000000000000000000000000000000006064820152608401610587565b61047584846117c2565b600082815260056020526040812060018082015460ff166002811115610ac357610ac3611d88565b03610af157600281015473ffffffffffffffffffffffffffffffffffffffff8481169116145b91505061047b565b6002600182015460ff166002811115610b0c57610b0c611d88565b03610b415773ffffffffffffffffffffffffffffffffffffffff8316600090815260038201602052604090205460ff16610ae9565b6040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152600e60248201527f496e76616c696420726f6c6549640000000000000000000000000000000000006044820152606401610587565b6060600480546103e490611cf4565b61083260015b82610835565b33600081815260016020908152604080832073ffffffffffffffffffffffffffffffffffffffff8716845290915281205490919083811015610c82576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602560248201527f45524332303a2064656372656173656420616c6c6f77616e63652062656c6f7760448201527f207a65726f0000000000000000000000000000000000000000000000000000006064820152608401610587565b61049a8286868403611165565b6000336104758185856113ef565b80600260008281526005602052604090206001015460ff166002811115610cc657610cc6611d88565b14610d53576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602c60248201527f4d7573742062652063616c6c6564206f6e20616e20696e697469616c697a656460448201527f2053686172656420726f6c6500000000000000000000000000000000000000006064820152608401610587565b81610d5e8133610a9b565b610dea576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602260248201527f53656e64657220646f6573206e6f7420686f6c6420726571756972656420726f60448201527f6c650000000000000000000000000000000000000000000000000000000000006064820152608401610587565b6000838152600560209081526040808320338452600301909152902080547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff001690556040513390819085907feb3e33034c392e69263b04ec0fa376dc12784a41b6676c7f31b936cbc0fbb5af90600090a4505050565b600081600160008281526005602052604090206001015460ff166002811115610e8b57610e8b611d88565b14610f18576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602f60248201527f4d7573742062652063616c6c6564206f6e20616e20696e697469616c697a656460448201527f204578636c757369766520726f6c6500000000000000000000000000000000006064820152608401610587565b60008381526005602052604090206002015473ffffffffffffffffffffffffffffffffffffffff1691505b50919050565b81600160008281526005602052604090206001015460ff166002811115610f7257610f72611d88565b14610fff576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602f60248201527f4d7573742062652063616c6c6564206f6e20616e20696e697469616c697a656460448201527f204578636c757369766520726f6c6500000000000000000000000000000000006064820152608401610587565b600083815260056020526040902054839061101a9033610a9b565b6110a5576040517f08c379a0000000000000000000000000000000000000000000000000000000008152602060048201526024808201527f43616e206f6e6c792062652063616c6c6564206279206120726f6c65206d616e60448201527f61676572000000000000000000000000000000000000000000000000000000006064820152608401610587565b60008481526005602052604090206110c09060020184611a7c565b604051339073ffffffffffffffffffffffffffffffffffffffff85169086907f3b855c56b409b671c7112789d022675eb639d0bcb8896f1b6197c132f799e74690600090a450505050565b6108326002610bb8565b61063c8282611a7c565b60005b81518110156111605761114e8383838151811061114157611141611db7565b60200260200101516119af565b8061115881611de6565b915050611122565b505050565b73ffffffffffffffffffffffffffffffffffffffff8316611207576040517f08c379a0000000000000000000000000000000000000000000000000000000008152602060048201526024808201527f45524332303a20617070726f76652066726f6d20746865207a65726f2061646460448201527f72657373000000000000000000000000000000000000000000000000000000006064820152608401610587565b73ffffffffffffffffffffffffffffffffffffffff82166112aa576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602260248201527f45524332303a20617070726f766520746f20746865207a65726f20616464726560448201527f73730000000000000000000000000000000000000000000000000000000000006064820152608401610587565b73ffffffffffffffffffffffffffffffffffffffff83811660008181526001602090815260408083209487168084529482529182902085905590518481527f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925910160405180910390a3505050565b73ffffffffffffffffffffffffffffffffffffffff8381166000908152600160209081526040808320938616835292905220547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff81146113e957818110156113dc576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601d60248201527f45524332303a20696e73756666696369656e7420616c6c6f77616e63650000006044820152606401610587565b6113e98484848403611165565b50505050565b73ffffffffffffffffffffffffffffffffffffffff8316611492576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602560248201527f45524332303a207472616e736665722066726f6d20746865207a65726f20616460448201527f64726573730000000000000000000000000000000000000000000000000000006064820152608401610587565b73ffffffffffffffffffffffffffffffffffffffff8216611535576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602360248201527f45524332303a207472616e7366657220746f20746865207a65726f206164647260448201527f65737300000000000000000000000000000000000000000000000000000000006064820152608401610587565b73ffffffffffffffffffffffffffffffffffffffff8316600090815260208190526040902054818110156115eb576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602660248201527f45524332303a207472616e7366657220616d6f756e742065786365656473206260448201527f616c616e636500000000000000000000000000000000000000000000000000006064820152608401610587565b73ffffffffffffffffffffffffffffffffffffffff80851660009081526020819052604080822085850390559185168152908120805484929061162f908490611d70565b925050819055508273ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef8460405161169591815260200190565b60405180910390a36113e9565b73ffffffffffffffffffffffffffffffffffffffff821661171f576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601f60248201527f45524332303a206d696e7420746f20746865207a65726f2061646472657373006044820152606401610587565b80600260008282546117319190611d70565b909155505073ffffffffffffffffffffffffffffffffffffffff82166000908152602081905260408120805483929061176b908490611d70565b909155505060405181815273ffffffffffffffffffffffffffffffffffffffff8316906000907fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef9060200160405180910390a35050565b73ffffffffffffffffffffffffffffffffffffffff8216611865576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602160248201527f45524332303a206275726e2066726f6d20746865207a65726f2061646472657360448201527f73000000000000000000000000000000000000000000000000000000000000006064820152608401610587565b73ffffffffffffffffffffffffffffffffffffffff82166000908152602081905260409020548181101561191b576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602260248201527f45524332303a206275726e20616d6f756e7420657863656564732062616c616e60448201527f63650000000000000000000000000000000000000000000000000000000000006064820152608401610587565b73ffffffffffffffffffffffffffffffffffffffff83166000908152602081905260408120838303905560028054849290611957908490611e1e565b909155505060405182815260009073ffffffffffffffffffffffffffffffffffffffff8516907fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef9060200160405180910390a3505050565b73ffffffffffffffffffffffffffffffffffffffff8116611a2c576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601f60248201527f43616e6e6f74206164642030783020746f20612073686172656420726f6c65006044820152606401610587565b73ffffffffffffffffffffffffffffffffffffffff1660009081526020919091526040902080547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff00166001179055565b73ffffffffffffffffffffffffffffffffffffffff8116611b1f576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602360248201527f43616e6e6f742073657420616e206578636c757369766520726f6c6520746f2060448201527f30783000000000000000000000000000000000000000000000000000000000006064820152608401610587565b81547fffffffffffffffffffffffff00000000000000000000000000000000000000001673ffffffffffffffffffffffffffffffffffffffff91909116179055565b600060208083528351808285015260005b81811015611b8e57858101830151858201604001528201611b72565b81811115611ba0576000604083870101525b50601f017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe016929092016040019392505050565b803573ffffffffffffffffffffffffffffffffffffffff81168114611bf857600080fd5b919050565b60008060408385031215611c1057600080fd5b611c1983611bd4565b946020939093013593505050565b600080600060608486031215611c3c57600080fd5b611c4584611bd4565b9250611c5360208501611bd4565b9150604084013590509250925092565b600060208284031215611c7557600080fd5b5035919050565b60008060408385031215611c8f57600080fd5b82359150611c9f60208401611bd4565b90509250929050565b600060208284031215611cba57600080fd5b611cc382611bd4565b9392505050565b60008060408385031215611cdd57600080fd5b611ce683611bd4565b9150611c9f60208401611bd4565b600181811c90821680611d0857607f821691505b602082108103610f43577f4e487b7100000000000000000000000000000000000000000000000000000000600052602260045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b60008219821115611d8357611d83611d41565b500190565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052602160045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b60007fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff8203611e1757611e17611d41565b5060010190565b600082821015611e3057611e30611d41565b50039056fea2646970667358221220af62dd4c842a6ec357c4de2464fc459ad78dbb38819fa288eb99f4a3a869cfcb64736f6c634300080d0033417474656d7074656420746f2075736520616e20696e76616c696420726f6c65a26469706673582212209d0b7b3b71c235b34e79d5b72791522522cbfce906136557bf267400633999a264736f6c634300080d0033", "devdoc": { "kind": "dev", - "methods": {}, + "methods": { + "createLpToken(address)": { + "params": { + "l1Token": "L1 token to name in LP token name." + }, + "returns": { + "_0": "address of new LP token." + } + } + }, "version": 1 }, "userdoc": { "kind": "user", - "methods": {}, + "methods": { + "createLpToken(address)": { + "notice": "Deploys new LP token for L1 token. Sets caller as minter and burner of token." + } + }, + "notice": "Factory to create new LP ERC20 tokens that represent a liquidity provider's position. HubPool is the intended client of this contract.", "version": 1 }, "storageLayout": { diff --git a/deployments/rinkeby/Optimism_Adapter.json b/deployments/rinkeby/Optimism_Adapter.json new file mode 100644 index 000000000..6f432d09b --- /dev/null +++ b/deployments/rinkeby/Optimism_Adapter.json @@ -0,0 +1,300 @@ +{ + "address": "0x277C7ecB45851dcB49c494fB4D0d9d8228037f0C", + "abi": [ + { + "inputs": [ + { + "internalType": "contract WETH9", + "name": "_l1Weth", + "type": "address" + }, + { + "internalType": "address", + "name": "_crossDomainMessenger", + "type": "address" + }, + { + "internalType": "contract IL1StandardBridge", + "name": "_l1StandardBridge", + "type": "address" + } + ], + "stateMutability": "nonpayable", + "type": "constructor" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "address", + "name": "target", + "type": "address" + }, + { + "indexed": false, + "internalType": "bytes", + "name": "message", + "type": "bytes" + } + ], + "name": "MessageRelayed", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "address", + "name": "l1Token", + "type": "address" + }, + { + "indexed": false, + "internalType": "address", + "name": "l2Token", + "type": "address" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "amount", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "address", + "name": "to", + "type": "address" + } + ], + "name": "TokensRelayed", + "type": "event" + }, + { + "inputs": [], + "name": "dai", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "daiOptimismBridge", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "l1StandardBridge", + "outputs": [ + { + "internalType": "contract IL1StandardBridge", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "l1Weth", + "outputs": [ + { + "internalType": "contract WETH9", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "l2GasLimit", + "outputs": [ + { + "internalType": "uint32", + "name": "", + "type": "uint32" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "messenger", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "target", + "type": "address" + }, + { + "internalType": "bytes", + "name": "message", + "type": "bytes" + } + ], + "name": "relayMessage", + "outputs": [], + "stateMutability": "payable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "l1Token", + "type": "address" + }, + { + "internalType": "address", + "name": "l2Token", + "type": "address" + }, + { + "internalType": "uint256", + "name": "amount", + "type": "uint256" + }, + { + "internalType": "address", + "name": "to", + "type": "address" + } + ], + "name": "relayTokens", + "outputs": [], + "stateMutability": "payable", + "type": "function" + }, + { + "inputs": [], + "name": "snx", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "snxOptimismBridge", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + } + ], + "transactionHash": "0x6a85408152957a3d6ee9f8c80d9ea8b7c781c3e930a4effed3131627308d4990", + "receipt": { + "to": null, + "from": "0x9A8f92a830A5cB89a3816e3D267CB7791c16b04D", + "contractAddress": "0x277C7ecB45851dcB49c494fB4D0d9d8228037f0C", + "transactionIndex": 41, + "gasUsed": "912742", + "logsBloom": "0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", + "blockHash": "0x72b0495d4083e0456a4b98fab89b461beb427c362ebd5a22792d4519de8b37fe", + "transactionHash": "0x6a85408152957a3d6ee9f8c80d9ea8b7c781c3e930a4effed3131627308d4990", + "logs": [], + "blockNumber": 10365600, + "cumulativeGasUsed": "10564147", + "status": 1, + "byzantium": true + }, + "args": [ + "0xc778417E063141139Fce010982780140Aa0cD5Ab", + "0x25ace71c97B33Cc4729CF772ae268934F7ab5fA1", + "0x99C9fc46f92E8a1c0deC1b1747d010903E884bE1" + ], + "numDeployments": 1, + "solcInputHash": "c8b9349311d8b5049b613ac98eb998d0", + "metadata": "{\"compiler\":{\"version\":\"0.8.13+commit.abaa5c0e\"},\"language\":\"Solidity\",\"output\":{\"abi\":[{\"inputs\":[{\"internalType\":\"contract WETH9\",\"name\":\"_l1Weth\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"_crossDomainMessenger\",\"type\":\"address\"},{\"internalType\":\"contract IL1StandardBridge\",\"name\":\"_l1StandardBridge\",\"type\":\"address\"}],\"stateMutability\":\"nonpayable\",\"type\":\"constructor\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"address\",\"name\":\"target\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"bytes\",\"name\":\"message\",\"type\":\"bytes\"}],\"name\":\"MessageRelayed\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"address\",\"name\":\"l1Token\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"address\",\"name\":\"l2Token\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"address\",\"name\":\"to\",\"type\":\"address\"}],\"name\":\"TokensRelayed\",\"type\":\"event\"},{\"inputs\":[],\"name\":\"dai\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"daiOptimismBridge\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"l1StandardBridge\",\"outputs\":[{\"internalType\":\"contract IL1StandardBridge\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"l1Weth\",\"outputs\":[{\"internalType\":\"contract WETH9\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"l2GasLimit\",\"outputs\":[{\"internalType\":\"uint32\",\"name\":\"\",\"type\":\"uint32\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"messenger\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"target\",\"type\":\"address\"},{\"internalType\":\"bytes\",\"name\":\"message\",\"type\":\"bytes\"}],\"name\":\"relayMessage\",\"outputs\":[],\"stateMutability\":\"payable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"l1Token\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"l2Token\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"},{\"internalType\":\"address\",\"name\":\"to\",\"type\":\"address\"}],\"name\":\"relayTokens\",\"outputs\":[],\"stateMutability\":\"payable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"snx\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"snxOptimismBridge\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"}],\"devdoc\":{\"details\":\"Public functions calling external contracts do not guard against reentrancy because they are expected to be called via delegatecall, which will execute this contract's logic within the context of the originating contract. For example, the HubPool will delegatecall these functions, therefore its only necessary that the HubPool's methods that call this contract's logic guard against reentrancy.\",\"kind\":\"dev\",\"methods\":{\"constructor\":{\"params\":{\"_crossDomainMessenger\":\"XDomainMessenger Optimism system contract.\",\"_l1StandardBridge\":\"Standard bridge contract.\",\"_l1Weth\":\"WETH address on L1.\"}},\"relayMessage(address,bytes)\":{\"params\":{\"message\":\"Data to send to target.\",\"target\":\"Contract on Optimism that will receive message.\"}},\"relayTokens(address,address,uint256,address)\":{\"params\":{\"amount\":\"Amount of L1 tokens to deposit and L2 tokens to receive.\",\"l1Token\":\"L1 token to deposit.\",\"l2Token\":\"L2 token to receive.\",\"to\":\"Bridge recipient.\"}}},\"version\":1},\"userdoc\":{\"kind\":\"user\",\"methods\":{\"constructor\":{\"notice\":\"Constructs new Adapter.\"},\"relayMessage(address,bytes)\":{\"notice\":\"Send cross-chain message to target on Optimism.\"},\"relayTokens(address,address,uint256,address)\":{\"notice\":\"Bridge tokens to Optimism.\"}},\"notice\":\"Contract containing logic to send messages from L1 to Optimism.\",\"version\":1}},\"settings\":{\"compilationTarget\":{\"contracts/chain-adapters/Optimism_Adapter.sol\":\"Optimism_Adapter\"},\"evmVersion\":\"london\",\"libraries\":{},\"metadata\":{\"bytecodeHash\":\"ipfs\",\"useLiteralContent\":true},\"optimizer\":{\"enabled\":true,\"runs\":1000000},\"remappings\":[]},\"sources\":{\"@eth-optimism/contracts/L1/messaging/IL1ERC20Bridge.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >0.5.0 <0.9.0;\\n\\n/**\\n * @title IL1ERC20Bridge\\n */\\ninterface IL1ERC20Bridge {\\n /**********\\n * Events *\\n **********/\\n\\n event ERC20DepositInitiated(\\n address indexed _l1Token,\\n address indexed _l2Token,\\n address indexed _from,\\n address _to,\\n uint256 _amount,\\n bytes _data\\n );\\n\\n event ERC20WithdrawalFinalized(\\n address indexed _l1Token,\\n address indexed _l2Token,\\n address indexed _from,\\n address _to,\\n uint256 _amount,\\n bytes _data\\n );\\n\\n /********************\\n * Public Functions *\\n ********************/\\n\\n /**\\n * @dev get the address of the corresponding L2 bridge contract.\\n * @return Address of the corresponding L2 bridge contract.\\n */\\n function l2TokenBridge() external returns (address);\\n\\n /**\\n * @dev deposit an amount of the ERC20 to the caller's balance on L2.\\n * @param _l1Token Address of the L1 ERC20 we are depositing\\n * @param _l2Token Address of the L1 respective L2 ERC20\\n * @param _amount Amount of the ERC20 to deposit\\n * @param _l2Gas Gas limit required to complete the deposit on L2.\\n * @param _data Optional data to forward to L2. This data is provided\\n * solely as a convenience for external contracts. Aside from enforcing a maximum\\n * length, these contracts provide no guarantees about its content.\\n */\\n function depositERC20(\\n address _l1Token,\\n address _l2Token,\\n uint256 _amount,\\n uint32 _l2Gas,\\n bytes calldata _data\\n ) external;\\n\\n /**\\n * @dev deposit an amount of ERC20 to a recipient's balance on L2.\\n * @param _l1Token Address of the L1 ERC20 we are depositing\\n * @param _l2Token Address of the L1 respective L2 ERC20\\n * @param _to L2 address to credit the withdrawal to.\\n * @param _amount Amount of the ERC20 to deposit.\\n * @param _l2Gas Gas limit required to complete the deposit on L2.\\n * @param _data Optional data to forward to L2. This data is provided\\n * solely as a convenience for external contracts. Aside from enforcing a maximum\\n * length, these contracts provide no guarantees about its content.\\n */\\n function depositERC20To(\\n address _l1Token,\\n address _l2Token,\\n address _to,\\n uint256 _amount,\\n uint32 _l2Gas,\\n bytes calldata _data\\n ) external;\\n\\n /*************************\\n * Cross-chain Functions *\\n *************************/\\n\\n /**\\n * @dev Complete a withdrawal from L2 to L1, and credit funds to the recipient's balance of the\\n * L1 ERC20 token.\\n * This call will fail if the initialized withdrawal from L2 has not been finalized.\\n *\\n * @param _l1Token Address of L1 token to finalizeWithdrawal for.\\n * @param _l2Token Address of L2 token where withdrawal was initiated.\\n * @param _from L2 address initiating the transfer.\\n * @param _to L1 address to credit the withdrawal to.\\n * @param _amount Amount of the ERC20 to deposit.\\n * @param _data Data provided by the sender on L2. This data is provided\\n * solely as a convenience for external contracts. Aside from enforcing a maximum\\n * length, these contracts provide no guarantees about its content.\\n */\\n function finalizeERC20Withdrawal(\\n address _l1Token,\\n address _l2Token,\\n address _from,\\n address _to,\\n uint256 _amount,\\n bytes calldata _data\\n ) external;\\n}\\n\",\"keccak256\":\"0x69f831896dcbb6bef4f2d6c8be6cd1bf352f5910074d3ce973b9f8e0a4f4c1dd\",\"license\":\"MIT\"},\"@eth-optimism/contracts/L1/messaging/IL1StandardBridge.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >0.5.0 <0.9.0;\\n\\nimport \\\"./IL1ERC20Bridge.sol\\\";\\n\\n/**\\n * @title IL1StandardBridge\\n */\\ninterface IL1StandardBridge is IL1ERC20Bridge {\\n /**********\\n * Events *\\n **********/\\n event ETHDepositInitiated(\\n address indexed _from,\\n address indexed _to,\\n uint256 _amount,\\n bytes _data\\n );\\n\\n event ETHWithdrawalFinalized(\\n address indexed _from,\\n address indexed _to,\\n uint256 _amount,\\n bytes _data\\n );\\n\\n /********************\\n * Public Functions *\\n ********************/\\n\\n /**\\n * @dev Deposit an amount of the ETH to the caller's balance on L2.\\n * @param _l2Gas Gas limit required to complete the deposit on L2.\\n * @param _data Optional data to forward to L2. This data is provided\\n * solely as a convenience for external contracts. Aside from enforcing a maximum\\n * length, these contracts provide no guarantees about its content.\\n */\\n function depositETH(uint32 _l2Gas, bytes calldata _data) external payable;\\n\\n /**\\n * @dev Deposit an amount of ETH to a recipient's balance on L2.\\n * @param _to L2 address to credit the withdrawal to.\\n * @param _l2Gas Gas limit required to complete the deposit on L2.\\n * @param _data Optional data to forward to L2. This data is provided\\n * solely as a convenience for external contracts. Aside from enforcing a maximum\\n * length, these contracts provide no guarantees about its content.\\n */\\n function depositETHTo(\\n address _to,\\n uint32 _l2Gas,\\n bytes calldata _data\\n ) external payable;\\n\\n /*************************\\n * Cross-chain Functions *\\n *************************/\\n\\n /**\\n * @dev Complete a withdrawal from L2 to L1, and credit funds to the recipient's balance of the\\n * L1 ETH token. Since only the xDomainMessenger can call this function, it will never be called\\n * before the withdrawal is finalized.\\n * @param _from L2 address initiating the transfer.\\n * @param _to L1 address to credit the withdrawal to.\\n * @param _amount Amount of the ERC20 to deposit.\\n * @param _data Optional data to forward to L2. This data is provided\\n * solely as a convenience for external contracts. Aside from enforcing a maximum\\n * length, these contracts provide no guarantees about its content.\\n */\\n function finalizeETHWithdrawal(\\n address _from,\\n address _to,\\n uint256 _amount,\\n bytes calldata _data\\n ) external;\\n}\\n\",\"keccak256\":\"0x3d511f1bcea86aa88a9c41798926ea75b5b3f455c0377e63223a123a9e714ddc\",\"license\":\"MIT\"},\"@eth-optimism/contracts/libraries/bridge/ICrossDomainMessenger.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >0.5.0 <0.9.0;\\n\\n/**\\n * @title ICrossDomainMessenger\\n */\\ninterface ICrossDomainMessenger {\\n /**********\\n * Events *\\n **********/\\n\\n event SentMessage(\\n address indexed target,\\n address sender,\\n bytes message,\\n uint256 messageNonce,\\n uint256 gasLimit\\n );\\n event RelayedMessage(bytes32 indexed msgHash);\\n event FailedRelayedMessage(bytes32 indexed msgHash);\\n\\n /*************\\n * Variables *\\n *************/\\n\\n function xDomainMessageSender() external view returns (address);\\n\\n /********************\\n * Public Functions *\\n ********************/\\n\\n /**\\n * Sends a cross domain message to the target messenger.\\n * @param _target Target contract address.\\n * @param _message Message to send to the target.\\n * @param _gasLimit Gas limit for the provided message.\\n */\\n function sendMessage(\\n address _target,\\n bytes calldata _message,\\n uint32 _gasLimit\\n ) external;\\n}\\n\",\"keccak256\":\"0x8f29ae23021345a20ccac7b5edb3fc38268aef943b65adc8a32e74b80bf1833a\",\"license\":\"MIT\"},\"@openzeppelin/contracts/token/ERC20/IERC20.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.5.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 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(\\n address from,\\n address to,\\n uint256 amount\\n ) external returns (bool);\\n\\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\",\"keccak256\":\"0xbbc8ac883ac3c0078ce5ad3e288fbb3ffcc8a30c3a98c0fda0114d64fc44fca2\",\"license\":\"MIT\"},\"@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts v4.4.1 (token/ERC20/utils/SafeERC20.sol)\\n\\npragma solidity ^0.8.0;\\n\\nimport \\\"../IERC20.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 function safeTransfer(\\n IERC20 token,\\n address to,\\n uint256 value\\n ) internal {\\n _callOptionalReturn(token, abi.encodeWithSelector(token.transfer.selector, to, value));\\n }\\n\\n function safeTransferFrom(\\n IERC20 token,\\n address from,\\n address to,\\n uint256 value\\n ) 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(\\n IERC20 token,\\n address spender,\\n uint256 value\\n ) 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 function safeIncreaseAllowance(\\n IERC20 token,\\n address spender,\\n uint256 value\\n ) internal {\\n uint256 newAllowance = token.allowance(address(this), spender) + value;\\n _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, newAllowance));\\n }\\n\\n function safeDecreaseAllowance(\\n IERC20 token,\\n address spender,\\n uint256 value\\n ) internal {\\n unchecked {\\n uint256 oldAllowance = token.allowance(address(this), spender);\\n require(oldAllowance >= value, \\\"SafeERC20: decreased allowance below zero\\\");\\n uint256 newAllowance = oldAllowance - value;\\n _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, newAllowance));\\n }\\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 if (returndata.length > 0) {\\n // Return data is optional\\n require(abi.decode(returndata, (bool)), \\\"SafeERC20: ERC20 operation did not succeed\\\");\\n }\\n }\\n}\\n\",\"keccak256\":\"0xc3d946432c0ddbb1f846a0d3985be71299df331b91d06732152117f62f0be2b5\",\"license\":\"MIT\"},\"@openzeppelin/contracts/utils/Address.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.5.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 *\\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://diligence.consensys.net/posts/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.5.11/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 functionCall(target, data, \\\"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(\\n address target,\\n bytes memory data,\\n uint256 value\\n ) 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 require(isContract(target), \\\"Address: call to non-contract\\\");\\n\\n (bool success, bytes memory returndata) = target.call{value: value}(data);\\n return verifyCallResult(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 require(isContract(target), \\\"Address: static call to non-contract\\\");\\n\\n (bool success, bytes memory returndata) = target.staticcall(data);\\n return verifyCallResult(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 require(isContract(target), \\\"Address: delegate call to non-contract\\\");\\n\\n (bool success, bytes memory returndata) = target.delegatecall(data);\\n return verifyCallResult(success, returndata, errorMessage);\\n }\\n\\n /**\\n * @dev Tool to verifies that a low level call was successful, and revert if it wasn't, either by bubbling the\\n * revert reason 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 // 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\\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}\\n\",\"keccak256\":\"0x2ccf9d2313a313d41a791505f2b5abfdc62191b5d4334f7f7a82691c088a1c87\",\"license\":\"MIT\"},\"contracts/chain-adapters/CrossDomainEnabled.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >0.5.0 <0.9.0;\\n\\n/* Interface Imports */\\nimport { ICrossDomainMessenger } from \\\"@eth-optimism/contracts/libraries/bridge/ICrossDomainMessenger.sol\\\";\\n\\n/**\\n * @title CrossDomainEnabled\\n * @dev Helper contract for contracts performing cross-domain communications between L1 and Optimism.\\n * @dev This modifies the eth-optimism/CrossDomainEnabled contract only by changing state variables to be\\n * immutable for use in contracts like the Optimism_Adapter which use delegateCall().\\n */\\ncontract CrossDomainEnabled {\\n // Messenger contract used to send and recieve messages from the other domain.\\n address public immutable messenger;\\n\\n /**\\n * @param _messenger Address of the CrossDomainMessenger on the current layer.\\n */\\n constructor(address _messenger) {\\n messenger = _messenger;\\n }\\n\\n /**\\n * Enforces that the modified function is only callable by a specific cross-domain account.\\n * @param _sourceDomainAccount The only account on the originating domain which is\\n * authenticated to call this function.\\n */\\n modifier onlyFromCrossDomainAccount(address _sourceDomainAccount) {\\n require(msg.sender == address(getCrossDomainMessenger()), \\\"OVM_XCHAIN: messenger contract unauthenticated\\\");\\n\\n require(\\n getCrossDomainMessenger().xDomainMessageSender() == _sourceDomainAccount,\\n \\\"OVM_XCHAIN: wrong sender of cross-domain message\\\"\\n );\\n\\n _;\\n }\\n\\n /**\\n * Gets the messenger, usually from storage. This function is exposed in case a child contract\\n * needs to override.\\n * @return The address of the cross-domain messenger contract which should be used.\\n */\\n function getCrossDomainMessenger() internal virtual returns (ICrossDomainMessenger) {\\n return ICrossDomainMessenger(messenger);\\n }\\n\\n /**\\n * Sends a message to an account on another domain\\n * @param _crossDomainTarget The intended recipient on the destination domain\\n * @param _message The data to send to the target (usually calldata to a function with\\n * onlyFromCrossDomainAccount())\\n * @param _gasLimit The gasLimit for the receipt of the message on the target domain.\\n */\\n function sendCrossDomainMessage(\\n address _crossDomainTarget,\\n uint32 _gasLimit,\\n bytes memory _message\\n ) internal {\\n // slither-disable-next-line reentrancy-events, reentrancy-benign\\n getCrossDomainMessenger().sendMessage(_crossDomainTarget, _message, _gasLimit);\\n }\\n}\\n\",\"keccak256\":\"0xb9a90934f8e09dd581cb65fa9d2f7904bfcb0dfe86f45a8b31d0b3037a1facd3\",\"license\":\"MIT\"},\"contracts/chain-adapters/Optimism_Adapter.sol\":{\"content\":\"// SPDX-License-Identifier: AGPL-3.0-only\\npragma solidity ^0.8.0;\\n\\nimport \\\"../interfaces/AdapterInterface.sol\\\";\\nimport \\\"../interfaces/WETH9.sol\\\";\\n\\n// @dev Use local modified CrossDomainEnabled contract instead of one exported by eth-optimism because we need\\n// this contract's state variables to be `immutable` because of the delegateCall call.\\nimport \\\"./CrossDomainEnabled.sol\\\";\\nimport \\\"@eth-optimism/contracts/L1/messaging/IL1StandardBridge.sol\\\";\\n\\nimport \\\"@openzeppelin/contracts/token/ERC20/IERC20.sol\\\";\\nimport \\\"@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol\\\";\\n\\n/**\\n * @notice Contract containing logic to send messages from L1 to Optimism.\\n * @dev Public functions calling external contracts do not guard against reentrancy because they are expected to be\\n * called via delegatecall, which will execute this contract's logic within the context of the originating contract.\\n * For example, the HubPool will delegatecall these functions, therefore its only necessary that the HubPool's methods\\n * that call this contract's logic guard against reentrancy.\\n */\\ncontract Optimism_Adapter is CrossDomainEnabled, AdapterInterface {\\n using SafeERC20 for IERC20;\\n uint32 public immutable l2GasLimit = 5_000_000;\\n\\n WETH9 public immutable l1Weth;\\n\\n IL1StandardBridge public immutable l1StandardBridge;\\n\\n // Optimism has the ability to support \\\"custom\\\" bridges. These bridges are not supported by the canonical bridge\\n // and so we need to store the address of the custom token and the associated bridge. In the event we want to\\n // support a new token that is not supported by Optimism, we can add a new custom bridge for it and re-deploy the\\n // adapter. A full list of custom optimism tokens and their associated bridges can be found here:\\n // https://github.com/ethereum-optimism/ethereum-optimism.github.io/blob/master/optimism.tokenlist.json\\n address public immutable dai = 0x6B175474E89094C44Da98b954EedeAC495271d0F;\\n address public immutable daiOptimismBridge = 0x10E6593CDda8c58a1d0f14C5164B376352a55f2F;\\n address public immutable snx = 0xC011a73ee8576Fb46F5E1c5751cA3B9Fe0af2a6F;\\n address public immutable snxOptimismBridge = 0xCd9D4988C0AE61887B075bA77f08cbFAd2b65068;\\n\\n /**\\n * @notice Constructs new Adapter.\\n * @param _l1Weth WETH address on L1.\\n * @param _crossDomainMessenger XDomainMessenger Optimism system contract.\\n * @param _l1StandardBridge Standard bridge contract.\\n */\\n constructor(\\n WETH9 _l1Weth,\\n address _crossDomainMessenger,\\n IL1StandardBridge _l1StandardBridge\\n ) CrossDomainEnabled(_crossDomainMessenger) {\\n l1Weth = _l1Weth;\\n l1StandardBridge = _l1StandardBridge;\\n }\\n\\n /**\\n * @notice Send cross-chain message to target on Optimism.\\n * @param target Contract on Optimism that will receive message.\\n * @param message Data to send to target.\\n */\\n function relayMessage(address target, bytes memory message) external payable override {\\n sendCrossDomainMessage(target, uint32(l2GasLimit), message);\\n emit MessageRelayed(target, message);\\n }\\n\\n /**\\n * @notice Bridge tokens to Optimism.\\n * @param l1Token L1 token to deposit.\\n * @param l2Token L2 token to receive.\\n * @param amount Amount of L1 tokens to deposit and L2 tokens to receive.\\n * @param to Bridge recipient.\\n */\\n function relayTokens(\\n address l1Token,\\n address l2Token,\\n uint256 amount,\\n address to\\n ) external payable override {\\n // If the l1Token is weth then unwrap it to ETH then send the ETH to the standard bridge.\\n if (l1Token == address(l1Weth)) {\\n l1Weth.withdraw(amount);\\n l1StandardBridge.depositETHTo{ value: amount }(to, l2GasLimit, \\\"\\\");\\n } else {\\n IL1StandardBridge _l1StandardBridge = l1StandardBridge;\\n\\n // Check if the L1 token requires a custom bridge. If so, use that bridge over the standard bridge.\\n if (l1Token == dai) _l1StandardBridge = IL1StandardBridge(daiOptimismBridge); // 1. DAI\\n if (l1Token == snx) _l1StandardBridge = IL1StandardBridge(snxOptimismBridge); // 2. SNX\\n\\n IERC20(l1Token).safeIncreaseAllowance(address(_l1StandardBridge), amount);\\n _l1StandardBridge.depositERC20To(l1Token, l2Token, to, amount, l2GasLimit, \\\"\\\");\\n }\\n emit TokensRelayed(l1Token, l2Token, amount, to);\\n }\\n}\\n\",\"keccak256\":\"0x0d38de11bc73db08f7406261d9b64b2985faa06cbd48aa8cc28042efd284e4d9\",\"license\":\"AGPL-3.0-only\"},\"contracts/interfaces/AdapterInterface.sol\":{\"content\":\"// SPDX-License-Identifier: AGPL-3.0-only\\npragma solidity ^0.8.0;\\n\\n/**\\n * @notice Sends cross chain messages and tokens to contracts on a specific L2 network.\\n */\\n\\ninterface AdapterInterface {\\n event MessageRelayed(address target, bytes message);\\n\\n event TokensRelayed(address l1Token, address l2Token, uint256 amount, address to);\\n\\n function relayMessage(address target, bytes memory message) external payable;\\n\\n function relayTokens(\\n address l1Token,\\n address l2Token,\\n uint256 amount,\\n address to\\n ) external payable;\\n}\\n\",\"keccak256\":\"0xbd7091006acbdfe72b21ce985f964f0682a2316d9d3b38967beeb55f4ae5118c\",\"license\":\"AGPL-3.0-only\"},\"contracts/interfaces/WETH9.sol\":{\"content\":\"// SPDX-License-Identifier: GPL-3.0-only\\npragma solidity ^0.8.0;\\n\\ninterface WETH9 {\\n function withdraw(uint256 wad) external;\\n\\n function deposit() external payable;\\n\\n function balanceOf(address guy) external view returns (uint256 wad);\\n\\n function transfer(address guy, uint256 wad) external;\\n}\\n\",\"keccak256\":\"0x7b444d0840b1f76eee9bf39d74830f70644395613b96cce2d80fc50785a82eaa\",\"license\":\"GPL-3.0-only\"}},\"version\":1}", + "bytecode": "0x610180604052624c4b4060a052736b175474e89094c44da98b954eedeac495271d0f610100527310e6593cdda8c58a1d0f14c5164b376352a55f2f6101205273c011a73ee8576fb46f5e1c5751ca3b9fe0af2a6f6101405273cd9d4988c0ae61887b075ba77f08cbfad2b650686101605234801561007c57600080fd5b5060405161117138038061117183398101604081905261009b916100d0565b6001600160a01b0391821660805291811660c0521660e05261011d565b6001600160a01b03811681146100cd57600080fd5b50565b6000806000606084860312156100e557600080fd5b83516100f0816100b8565b6020850151909350610101816100b8565b6040850151909250610112816100b8565b809150509250925092565b60805160a05160c05160e05161010051610120516101405161016051610f9c6101d56000396000818161015a015261056c01526000818161026701526105180152600081816101d701526104f601526000818161029b01526104ca01526000818160c80152818161042d0152610494015260008181610126015281816102bf015261033f01526000818161020b015281816103f80152818161060e01526106ec01526000818161018e01526108c60152610f9c6000f3fe6080604052600436106100b15760003560e01c8063b708886d11610069578063e6eb8ade1161004e578063e6eb8ade14610242578063e7d2799814610255578063f4b9fa751461028957600080fd5b8063b708886d146101c5578063cf6e65b7146101f957600080fd5b806328f7c66b1161009a57806328f7c66b146101485780633cb747bf1461017c57806352c8c75c146101b057600080fd5b8063078f29cf146100b6578063146bf4b114610114575b600080fd5b3480156100c257600080fd5b506100ea7f000000000000000000000000000000000000000000000000000000000000000081565b60405173ffffffffffffffffffffffffffffffffffffffff90911681526020015b60405180910390f35b34801561012057600080fd5b506100ea7f000000000000000000000000000000000000000000000000000000000000000081565b34801561015457600080fd5b506100ea7f000000000000000000000000000000000000000000000000000000000000000081565b34801561018857600080fd5b506100ea7f000000000000000000000000000000000000000000000000000000000000000081565b6101c36101be366004610c77565b6102bd565b005b3480156101d157600080fd5b506100ea7f000000000000000000000000000000000000000000000000000000000000000081565b34801561020557600080fd5b5061022d7f000000000000000000000000000000000000000000000000000000000000000081565b60405163ffffffff909116815260200161010b565b6101c3610250366004610cf3565b6106e6565b34801561026157600080fd5b506100ea7f000000000000000000000000000000000000000000000000000000000000000081565b34801561029557600080fd5b506100ea7f000000000000000000000000000000000000000000000000000000000000000081565b7f000000000000000000000000000000000000000000000000000000000000000073ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff1603610492576040517f2e1a7d4d000000000000000000000000000000000000000000000000000000008152600481018390527f000000000000000000000000000000000000000000000000000000000000000073ffffffffffffffffffffffffffffffffffffffff1690632e1a7d4d90602401600060405180830381600087803b15801561039857600080fd5b505af11580156103ac573d6000803e3d6000fd5b50506040517f9a2ac6d500000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff848116600483015263ffffffff7f000000000000000000000000000000000000000000000000000000000000000016602483015260606044830152600060648301527f0000000000000000000000000000000000000000000000000000000000000000169250639a2ac6d5915084906084016000604051808303818588803b15801561047457600080fd5b505af1158015610488573d6000803e3d6000fd5b5050505050610681565b7f000000000000000000000000000000000000000000000000000000000000000073ffffffffffffffffffffffffffffffffffffffff7f000000000000000000000000000000000000000000000000000000000000000081169086160361051657507f00000000000000000000000000000000000000000000000000000000000000005b7f000000000000000000000000000000000000000000000000000000000000000073ffffffffffffffffffffffffffffffffffffffff168573ffffffffffffffffffffffffffffffffffffffff160361058c57507f00000000000000000000000000000000000000000000000000000000000000005b6105ad73ffffffffffffffffffffffffffffffffffffffff8616828561074e565b6040517f838b252000000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff8681166004830152858116602483015283811660448301526064820185905263ffffffff7f000000000000000000000000000000000000000000000000000000000000000016608483015260c060a4830152600060c483015282169063838b25209060e401600060405180830381600087803b15801561066757600080fd5b505af115801561067b573d6000803e3d6000fd5b50505050505b6040805173ffffffffffffffffffffffffffffffffffffffff868116825285811660208301528183018590528316606082015290517fd7e09655439c3932e55857df3220186e5a7f0980825f20691c2b35d941dee75b9181900360800190a150505050565b610711827f000000000000000000000000000000000000000000000000000000000000000083610889565b7f9e6c52944e331ba6270e7fe4cea2a4086bae8f7a27e1cdba07f416806f5d0ac48282604051610742929190610e49565b60405180910390a15050565b6040517fdd62ed3e00000000000000000000000000000000000000000000000000000000815230600482015273ffffffffffffffffffffffffffffffffffffffff8381166024830152600091839186169063dd62ed3e90604401602060405180830381865afa1580156107c5573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906107e99190610e78565b6107f39190610e91565b6040805173ffffffffffffffffffffffffffffffffffffffff8616602482015260448082018490528251808303909101815260649091019091526020810180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff167f095ea7b300000000000000000000000000000000000000000000000000000000179052909150610883908590610936565b50505050565b6040517f3dbb202b00000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff7f00000000000000000000000000000000000000000000000000000000000000001690633dbb202b906108ff90869085908790600401610ed0565b600060405180830381600087803b15801561091957600080fd5b505af115801561092d573d6000803e3d6000fd5b50505050505050565b6000610998826040518060400160405280602081526020017f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c65648152508573ffffffffffffffffffffffffffffffffffffffff16610a4c9092919063ffffffff16565b805190915015610a4757808060200190518101906109b69190610f15565b610a47576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602a60248201527f5361666545524332303a204552433230206f7065726174696f6e20646964206e60448201527f6f7420737563636565640000000000000000000000000000000000000000000060648201526084015b60405180910390fd5b505050565b6060610a5b8484600085610a65565b90505b9392505050565b606082471015610af7576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602660248201527f416464726573733a20696e73756666696369656e742062616c616e636520666f60448201527f722063616c6c00000000000000000000000000000000000000000000000000006064820152608401610a3e565b73ffffffffffffffffffffffffffffffffffffffff85163b610b75576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e74726163740000006044820152606401610a3e565b6000808673ffffffffffffffffffffffffffffffffffffffff168587604051610b9e9190610f37565b60006040518083038185875af1925050503d8060008114610bdb576040519150601f19603f3d011682016040523d82523d6000602084013e610be0565b606091505b5091509150610bf0828286610bfb565b979650505050505050565b60608315610c0a575081610a5e565b825115610c1a5782518084602001fd5b816040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610a3e9190610f53565b803573ffffffffffffffffffffffffffffffffffffffff81168114610c7257600080fd5b919050565b60008060008060808587031215610c8d57600080fd5b610c9685610c4e565b9350610ca460208601610c4e565b925060408501359150610cb960608601610c4e565b905092959194509250565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b60008060408385031215610d0657600080fd5b610d0f83610c4e565b9150602083013567ffffffffffffffff80821115610d2c57600080fd5b818501915085601f830112610d4057600080fd5b813581811115610d5257610d52610cc4565b604051601f82017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0908116603f01168101908382118183101715610d9857610d98610cc4565b81604052828152886020848701011115610db157600080fd5b8260208601602083013760006020848301015280955050505050509250929050565b60005b83811015610dee578181015183820152602001610dd6565b838111156108835750506000910152565b60008151808452610e17816020860160208601610dd3565b601f017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0169290920160200192915050565b73ffffffffffffffffffffffffffffffffffffffff83168152604060208201526000610a5b6040830184610dff565b600060208284031215610e8a57600080fd5b5051919050565b60008219821115610ecb577f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b500190565b73ffffffffffffffffffffffffffffffffffffffff84168152606060208201526000610eff6060830185610dff565b905063ffffffff83166040830152949350505050565b600060208284031215610f2757600080fd5b81518015158114610a5e57600080fd5b60008251610f49818460208701610dd3565b9190910192915050565b602081526000610a5e6020830184610dff56fea2646970667358221220b439c41917b515109464c40d4dc8343a6f6e68157bca87353f5213176038c50a64736f6c634300080d0033", + "deployedBytecode": "0x6080604052600436106100b15760003560e01c8063b708886d11610069578063e6eb8ade1161004e578063e6eb8ade14610242578063e7d2799814610255578063f4b9fa751461028957600080fd5b8063b708886d146101c5578063cf6e65b7146101f957600080fd5b806328f7c66b1161009a57806328f7c66b146101485780633cb747bf1461017c57806352c8c75c146101b057600080fd5b8063078f29cf146100b6578063146bf4b114610114575b600080fd5b3480156100c257600080fd5b506100ea7f000000000000000000000000000000000000000000000000000000000000000081565b60405173ffffffffffffffffffffffffffffffffffffffff90911681526020015b60405180910390f35b34801561012057600080fd5b506100ea7f000000000000000000000000000000000000000000000000000000000000000081565b34801561015457600080fd5b506100ea7f000000000000000000000000000000000000000000000000000000000000000081565b34801561018857600080fd5b506100ea7f000000000000000000000000000000000000000000000000000000000000000081565b6101c36101be366004610c77565b6102bd565b005b3480156101d157600080fd5b506100ea7f000000000000000000000000000000000000000000000000000000000000000081565b34801561020557600080fd5b5061022d7f000000000000000000000000000000000000000000000000000000000000000081565b60405163ffffffff909116815260200161010b565b6101c3610250366004610cf3565b6106e6565b34801561026157600080fd5b506100ea7f000000000000000000000000000000000000000000000000000000000000000081565b34801561029557600080fd5b506100ea7f000000000000000000000000000000000000000000000000000000000000000081565b7f000000000000000000000000000000000000000000000000000000000000000073ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff1603610492576040517f2e1a7d4d000000000000000000000000000000000000000000000000000000008152600481018390527f000000000000000000000000000000000000000000000000000000000000000073ffffffffffffffffffffffffffffffffffffffff1690632e1a7d4d90602401600060405180830381600087803b15801561039857600080fd5b505af11580156103ac573d6000803e3d6000fd5b50506040517f9a2ac6d500000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff848116600483015263ffffffff7f000000000000000000000000000000000000000000000000000000000000000016602483015260606044830152600060648301527f0000000000000000000000000000000000000000000000000000000000000000169250639a2ac6d5915084906084016000604051808303818588803b15801561047457600080fd5b505af1158015610488573d6000803e3d6000fd5b5050505050610681565b7f000000000000000000000000000000000000000000000000000000000000000073ffffffffffffffffffffffffffffffffffffffff7f000000000000000000000000000000000000000000000000000000000000000081169086160361051657507f00000000000000000000000000000000000000000000000000000000000000005b7f000000000000000000000000000000000000000000000000000000000000000073ffffffffffffffffffffffffffffffffffffffff168573ffffffffffffffffffffffffffffffffffffffff160361058c57507f00000000000000000000000000000000000000000000000000000000000000005b6105ad73ffffffffffffffffffffffffffffffffffffffff8616828561074e565b6040517f838b252000000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff8681166004830152858116602483015283811660448301526064820185905263ffffffff7f000000000000000000000000000000000000000000000000000000000000000016608483015260c060a4830152600060c483015282169063838b25209060e401600060405180830381600087803b15801561066757600080fd5b505af115801561067b573d6000803e3d6000fd5b50505050505b6040805173ffffffffffffffffffffffffffffffffffffffff868116825285811660208301528183018590528316606082015290517fd7e09655439c3932e55857df3220186e5a7f0980825f20691c2b35d941dee75b9181900360800190a150505050565b610711827f000000000000000000000000000000000000000000000000000000000000000083610889565b7f9e6c52944e331ba6270e7fe4cea2a4086bae8f7a27e1cdba07f416806f5d0ac48282604051610742929190610e49565b60405180910390a15050565b6040517fdd62ed3e00000000000000000000000000000000000000000000000000000000815230600482015273ffffffffffffffffffffffffffffffffffffffff8381166024830152600091839186169063dd62ed3e90604401602060405180830381865afa1580156107c5573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906107e99190610e78565b6107f39190610e91565b6040805173ffffffffffffffffffffffffffffffffffffffff8616602482015260448082018490528251808303909101815260649091019091526020810180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff167f095ea7b300000000000000000000000000000000000000000000000000000000179052909150610883908590610936565b50505050565b6040517f3dbb202b00000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff7f00000000000000000000000000000000000000000000000000000000000000001690633dbb202b906108ff90869085908790600401610ed0565b600060405180830381600087803b15801561091957600080fd5b505af115801561092d573d6000803e3d6000fd5b50505050505050565b6000610998826040518060400160405280602081526020017f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c65648152508573ffffffffffffffffffffffffffffffffffffffff16610a4c9092919063ffffffff16565b805190915015610a4757808060200190518101906109b69190610f15565b610a47576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602a60248201527f5361666545524332303a204552433230206f7065726174696f6e20646964206e60448201527f6f7420737563636565640000000000000000000000000000000000000000000060648201526084015b60405180910390fd5b505050565b6060610a5b8484600085610a65565b90505b9392505050565b606082471015610af7576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602660248201527f416464726573733a20696e73756666696369656e742062616c616e636520666f60448201527f722063616c6c00000000000000000000000000000000000000000000000000006064820152608401610a3e565b73ffffffffffffffffffffffffffffffffffffffff85163b610b75576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e74726163740000006044820152606401610a3e565b6000808673ffffffffffffffffffffffffffffffffffffffff168587604051610b9e9190610f37565b60006040518083038185875af1925050503d8060008114610bdb576040519150601f19603f3d011682016040523d82523d6000602084013e610be0565b606091505b5091509150610bf0828286610bfb565b979650505050505050565b60608315610c0a575081610a5e565b825115610c1a5782518084602001fd5b816040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610a3e9190610f53565b803573ffffffffffffffffffffffffffffffffffffffff81168114610c7257600080fd5b919050565b60008060008060808587031215610c8d57600080fd5b610c9685610c4e565b9350610ca460208601610c4e565b925060408501359150610cb960608601610c4e565b905092959194509250565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b60008060408385031215610d0657600080fd5b610d0f83610c4e565b9150602083013567ffffffffffffffff80821115610d2c57600080fd5b818501915085601f830112610d4057600080fd5b813581811115610d5257610d52610cc4565b604051601f82017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0908116603f01168101908382118183101715610d9857610d98610cc4565b81604052828152886020848701011115610db157600080fd5b8260208601602083013760006020848301015280955050505050509250929050565b60005b83811015610dee578181015183820152602001610dd6565b838111156108835750506000910152565b60008151808452610e17816020860160208601610dd3565b601f017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0169290920160200192915050565b73ffffffffffffffffffffffffffffffffffffffff83168152604060208201526000610a5b6040830184610dff565b600060208284031215610e8a57600080fd5b5051919050565b60008219821115610ecb577f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b500190565b73ffffffffffffffffffffffffffffffffffffffff84168152606060208201526000610eff6060830185610dff565b905063ffffffff83166040830152949350505050565b600060208284031215610f2757600080fd5b81518015158114610a5e57600080fd5b60008251610f49818460208701610dd3565b9190910192915050565b602081526000610a5e6020830184610dff56fea2646970667358221220b439c41917b515109464c40d4dc8343a6f6e68157bca87353f5213176038c50a64736f6c634300080d0033", + "devdoc": { + "details": "Public functions calling external contracts do not guard against reentrancy because they are expected to be called via delegatecall, which will execute this contract's logic within the context of the originating contract. For example, the HubPool will delegatecall these functions, therefore its only necessary that the HubPool's methods that call this contract's logic guard against reentrancy.", + "kind": "dev", + "methods": { + "constructor": { + "params": { + "_crossDomainMessenger": "XDomainMessenger Optimism system contract.", + "_l1StandardBridge": "Standard bridge contract.", + "_l1Weth": "WETH address on L1." + } + }, + "relayMessage(address,bytes)": { + "params": { + "message": "Data to send to target.", + "target": "Contract on Optimism that will receive message." + } + }, + "relayTokens(address,address,uint256,address)": { + "params": { + "amount": "Amount of L1 tokens to deposit and L2 tokens to receive.", + "l1Token": "L1 token to deposit.", + "l2Token": "L2 token to receive.", + "to": "Bridge recipient." + } + } + }, + "version": 1 + }, + "userdoc": { + "kind": "user", + "methods": { + "constructor": { + "notice": "Constructs new Adapter." + }, + "relayMessage(address,bytes)": { + "notice": "Send cross-chain message to target on Optimism." + }, + "relayTokens(address,address,uint256,address)": { + "notice": "Bridge tokens to Optimism." + } + }, + "notice": "Contract containing logic to send messages from L1 to Optimism.", + "version": 1 + }, + "storageLayout": { + "storage": [], + "types": null + } +} diff --git a/deployments/rinkeby/PolygonTokenBridger.json b/deployments/rinkeby/PolygonTokenBridger.json new file mode 100644 index 000000000..b560d73e7 --- /dev/null +++ b/deployments/rinkeby/PolygonTokenBridger.json @@ -0,0 +1,182 @@ +{ + "address": "0xF92B101f07df74B1f4f3160f9e8a25D48BA5d583", + "abi": [ + { + "inputs": [ + { + "internalType": "address", + "name": "_destination", + "type": "address" + }, + { + "internalType": "contract WETH9", + "name": "_l1Weth", + "type": "address" + } + ], + "stateMutability": "nonpayable", + "type": "constructor" + }, + { + "inputs": [], + "name": "destination", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "l1Weth", + "outputs": [ + { + "internalType": "contract WETH9", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "maticToken", + "outputs": [ + { + "internalType": "contract MaticToken", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "contract IERC20", + "name": "token", + "type": "address" + } + ], + "name": "retrieve", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "contract PolygonIERC20", + "name": "token", + "type": "address" + }, + { + "internalType": "uint256", + "name": "amount", + "type": "uint256" + }, + { + "internalType": "bool", + "name": "isWrappedMatic", + "type": "bool" + } + ], + "name": "send", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "stateMutability": "payable", + "type": "receive" + } + ], + "transactionHash": "0xd3dd14d65d6e542118cc66127ba63a746f1f1a95251b3436f33d23cc99c8ba7c", + "receipt": { + "to": "0x4e59b44847b379578588920cA78FbF26c0B4956C", + "from": "0x9A8f92a830A5cB89a3816e3D267CB7791c16b04D", + "contractAddress": null, + "transactionIndex": 30, + "gasUsed": "677458", + "logsBloom": "0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", + "blockHash": "0x4bca22b5654abf5a83bf889076195025a2e6ee20b44a1982b150b3a9147eab8b", + "transactionHash": "0xd3dd14d65d6e542118cc66127ba63a746f1f1a95251b3436f33d23cc99c8ba7c", + "logs": [], + "blockNumber": 10365604, + "cumulativeGasUsed": "21614741", + "status": 1, + "byzantium": true + }, + "args": ["0xa1b6DA4AaE90fA16F3A3338c8d1Dc70B4926FCa7", "0xc778417E063141139Fce010982780140Aa0cD5Ab"], + "numDeployments": 1, + "solcInputHash": "c8b9349311d8b5049b613ac98eb998d0", + "metadata": "{\"compiler\":{\"version\":\"0.8.13+commit.abaa5c0e\"},\"language\":\"Solidity\",\"output\":{\"abi\":[{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_destination\",\"type\":\"address\"},{\"internalType\":\"contract WETH9\",\"name\":\"_l1Weth\",\"type\":\"address\"}],\"stateMutability\":\"nonpayable\",\"type\":\"constructor\"},{\"inputs\":[],\"name\":\"destination\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"l1Weth\",\"outputs\":[{\"internalType\":\"contract WETH9\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"maticToken\",\"outputs\":[{\"internalType\":\"contract MaticToken\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"contract IERC20\",\"name\":\"token\",\"type\":\"address\"}],\"name\":\"retrieve\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"contract PolygonIERC20\",\"name\":\"token\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"},{\"internalType\":\"bool\",\"name\":\"isWrappedMatic\",\"type\":\"bool\"}],\"name\":\"send\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"stateMutability\":\"payable\",\"type\":\"receive\"}],\"devdoc\":{\"details\":\"Because Polygon only allows withdrawals from a particular address to go to that same address on mainnet, we need to have some sort of contract that can guarantee identical addresses on Polygon and Ethereum. This contract is intended to be completely immutable, so it's guaranteed that the contract on each side is configured identically as long as it is created via create2. create2 is an alternative creation method that uses a different address determination mechanism from normal create. Normal create: address = hash(deployer_address, deployer_nonce) create2: address = hash(0xFF, sender, salt, bytecode) This ultimately allows create2 to generate deterministic addresses that don't depend on the transaction count of the sender.\",\"kind\":\"dev\",\"methods\":{\"constructor\":{\"params\":{\"_destination\":\"Where to send tokens to for this network.\",\"_l1Weth\":\"Ethereum WETH address.\"}},\"retrieve(address)\":{\"params\":{\"token\":\"Token to send to destination.\"}},\"send(address,uint256,bool)\":{\"params\":{\"amount\":\"Amount to bridge.\",\"isWrappedMatic\":\"True if token is WMATIC.\",\"token\":\"Token to bridge.\"}}},\"version\":1},\"userdoc\":{\"kind\":\"user\",\"methods\":{\"constructor\":{\"notice\":\"Constructs Token Bridger contract.\"},\"retrieve(address)\":{\"notice\":\"Called by someone to send tokens to the destination, which should be set to the HubPool.\"},\"send(address,uint256,bool)\":{\"notice\":\"Called by Polygon SpokePool to send tokens over bridge to contract with the same address as this.The caller of this function must approve this contract to spend amount of token.\"}},\"notice\":\"Contract deployed on Ethereum and Polygon to facilitate token transfers from Polygon to the HubPool and back.\",\"version\":1}},\"settings\":{\"compilationTarget\":{\"contracts/PolygonTokenBridger.sol\":\"PolygonTokenBridger\"},\"evmVersion\":\"london\",\"libraries\":{},\"metadata\":{\"bytecodeHash\":\"ipfs\",\"useLiteralContent\":true},\"optimizer\":{\"enabled\":true,\"runs\":1000000},\"remappings\":[]},\"sources\":{\"@openzeppelin/contracts/token/ERC20/IERC20.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.5.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 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(\\n address from,\\n address to,\\n uint256 amount\\n ) external returns (bool);\\n\\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\",\"keccak256\":\"0xbbc8ac883ac3c0078ce5ad3e288fbb3ffcc8a30c3a98c0fda0114d64fc44fca2\",\"license\":\"MIT\"},\"@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts v4.4.1 (token/ERC20/utils/SafeERC20.sol)\\n\\npragma solidity ^0.8.0;\\n\\nimport \\\"../IERC20.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 function safeTransfer(\\n IERC20 token,\\n address to,\\n uint256 value\\n ) internal {\\n _callOptionalReturn(token, abi.encodeWithSelector(token.transfer.selector, to, value));\\n }\\n\\n function safeTransferFrom(\\n IERC20 token,\\n address from,\\n address to,\\n uint256 value\\n ) 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(\\n IERC20 token,\\n address spender,\\n uint256 value\\n ) 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 function safeIncreaseAllowance(\\n IERC20 token,\\n address spender,\\n uint256 value\\n ) internal {\\n uint256 newAllowance = token.allowance(address(this), spender) + value;\\n _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, newAllowance));\\n }\\n\\n function safeDecreaseAllowance(\\n IERC20 token,\\n address spender,\\n uint256 value\\n ) internal {\\n unchecked {\\n uint256 oldAllowance = token.allowance(address(this), spender);\\n require(oldAllowance >= value, \\\"SafeERC20: decreased allowance below zero\\\");\\n uint256 newAllowance = oldAllowance - value;\\n _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, newAllowance));\\n }\\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 if (returndata.length > 0) {\\n // Return data is optional\\n require(abi.decode(returndata, (bool)), \\\"SafeERC20: ERC20 operation did not succeed\\\");\\n }\\n }\\n}\\n\",\"keccak256\":\"0xc3d946432c0ddbb1f846a0d3985be71299df331b91d06732152117f62f0be2b5\",\"license\":\"MIT\"},\"@openzeppelin/contracts/utils/Address.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.5.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 *\\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://diligence.consensys.net/posts/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.5.11/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 functionCall(target, data, \\\"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(\\n address target,\\n bytes memory data,\\n uint256 value\\n ) 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 require(isContract(target), \\\"Address: call to non-contract\\\");\\n\\n (bool success, bytes memory returndata) = target.call{value: value}(data);\\n return verifyCallResult(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 require(isContract(target), \\\"Address: static call to non-contract\\\");\\n\\n (bool success, bytes memory returndata) = target.staticcall(data);\\n return verifyCallResult(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 require(isContract(target), \\\"Address: delegate call to non-contract\\\");\\n\\n (bool success, bytes memory returndata) = target.delegatecall(data);\\n return verifyCallResult(success, returndata, errorMessage);\\n }\\n\\n /**\\n * @dev Tool to verifies that a low level call was successful, and revert if it wasn't, either by bubbling the\\n * revert reason 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 // 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\\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}\\n\",\"keccak256\":\"0x2ccf9d2313a313d41a791505f2b5abfdc62191b5d4334f7f7a82691c088a1c87\",\"license\":\"MIT\"},\"contracts/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 * @dev The reason why we use this local contract instead of importing from uma/contracts is because of the addition\\n * of the internal method `functionCallStackOriginatesFromOutsideThisContract` which doesn't exist in the one exported\\n * by uma/contracts.\\n */\\ncontract Lockable {\\n bool internal _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 /**\\n * @dev Returns true if the contract is currently in a non-entered state, meaning that the origination of the call\\n * came from outside the contract. This is relevant with fallback/receive methods to see if the call came from ETH\\n * being dropped onto the contract externally or due to ETH dropped on the the contract from within a method in this\\n * contract, such as unwrapping WETH to ETH within the contract.\\n */\\n function functionCallStackOriginatesFromOutsideThisContract() internal view returns (bool) {\\n return _notEntered;\\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\",\"keccak256\":\"0xef490be5cb859c97c6f600f3b0db0d50c6e18f334d3c74c6d9e693a260eaec3e\",\"license\":\"AGPL-3.0-only\"},\"contracts/PolygonTokenBridger.sol\":{\"content\":\"// SPDX-License-Identifier: AGPL-3.0-only\\npragma solidity ^0.8.0;\\n\\nimport \\\"./Lockable.sol\\\";\\nimport \\\"./interfaces/WETH9.sol\\\";\\n\\nimport \\\"@openzeppelin/contracts/token/ERC20/IERC20.sol\\\";\\nimport \\\"@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol\\\";\\n\\n// ERC20s (on polygon) compatible with polygon's bridge have a withdraw method.\\ninterface PolygonIERC20 is IERC20 {\\n function withdraw(uint256 amount) external;\\n}\\n\\ninterface MaticToken {\\n function withdraw(uint256 amount) external payable;\\n}\\n\\n/**\\n * @notice Contract deployed on Ethereum and Polygon to facilitate token transfers from Polygon to the HubPool and back.\\n * @dev Because Polygon only allows withdrawals from a particular address to go to that same address on mainnet, we need to\\n * have some sort of contract that can guarantee identical addresses on Polygon and Ethereum. This contract is intended\\n * to be completely immutable, so it's guaranteed that the contract on each side is configured identically as long as\\n * it is created via create2. create2 is an alternative creation method that uses a different address determination\\n * mechanism from normal create.\\n * Normal create: address = hash(deployer_address, deployer_nonce)\\n * create2: address = hash(0xFF, sender, salt, bytecode)\\n * This ultimately allows create2 to generate deterministic addresses that don't depend on the transaction count of the\\n * sender.\\n */\\ncontract PolygonTokenBridger is Lockable {\\n using SafeERC20 for PolygonIERC20;\\n using SafeERC20 for IERC20;\\n\\n // Gas token for Polygon.\\n MaticToken public constant maticToken = MaticToken(0x0000000000000000000000000000000000001010);\\n\\n // Should be set to HubPool on Ethereum, or unused on Polygon.\\n address public immutable destination;\\n\\n // WETH contract on Ethereum.\\n WETH9 public immutable l1Weth;\\n\\n /**\\n * @notice Constructs Token Bridger contract.\\n * @param _destination Where to send tokens to for this network.\\n * @param _l1Weth Ethereum WETH address.\\n */\\n constructor(address _destination, WETH9 _l1Weth) {\\n destination = _destination;\\n l1Weth = _l1Weth;\\n }\\n\\n /**\\n * @notice Called by Polygon SpokePool to send tokens over bridge to contract with the same address as this.\\n * @notice The caller of this function must approve this contract to spend amount of token.\\n * @param token Token to bridge.\\n * @param amount Amount to bridge.\\n * @param isWrappedMatic True if token is WMATIC.\\n */\\n function send(\\n PolygonIERC20 token,\\n uint256 amount,\\n bool isWrappedMatic\\n ) public nonReentrant {\\n token.safeTransferFrom(msg.sender, address(this), amount);\\n\\n // In the wMatic case, this unwraps. For other ERC20s, this is the burn/send action.\\n token.withdraw(amount);\\n\\n // This takes the token that was withdrawn and calls withdraw on the \\\"native\\\" ERC20.\\n if (isWrappedMatic) maticToken.withdraw{ value: amount }(amount);\\n }\\n\\n /**\\n * @notice Called by someone to send tokens to the destination, which should be set to the HubPool.\\n * @param token Token to send to destination.\\n */\\n function retrieve(IERC20 token) public nonReentrant {\\n token.safeTransfer(destination, token.balanceOf(address(this)));\\n }\\n\\n receive() external payable {\\n // Note: this should only happen on the mainnet side where ETH is sent to the contract directly by the bridge.\\n if (functionCallStackOriginatesFromOutsideThisContract()) l1Weth.deposit{ value: address(this).balance }();\\n }\\n}\\n\",\"keccak256\":\"0x79b3a0f440bf429abcb41d4d808892d0bd73e890334585f3ab1dd67a2bbe32cd\",\"license\":\"AGPL-3.0-only\"},\"contracts/interfaces/WETH9.sol\":{\"content\":\"// SPDX-License-Identifier: GPL-3.0-only\\npragma solidity ^0.8.0;\\n\\ninterface WETH9 {\\n function withdraw(uint256 wad) external;\\n\\n function deposit() external payable;\\n\\n function balanceOf(address guy) external view returns (uint256 wad);\\n\\n function transfer(address guy, uint256 wad) external;\\n}\\n\",\"keccak256\":\"0x7b444d0840b1f76eee9bf39d74830f70644395613b96cce2d80fc50785a82eaa\",\"license\":\"GPL-3.0-only\"}},\"version\":1}", + "bytecode": "0x60c060405234801561001057600080fd5b50604051610bbd380380610bbd83398101604081905261002f9161006b565b6000805460ff191660011790556001600160a01b039182166080521660a0526100a5565b6001600160a01b038116811461006857600080fd5b50565b6000806040838503121561007e57600080fd5b825161008981610053565b602084015190925061009a81610053565b809150509250929050565b60805160a051610ae66100d7600039600081816070015261012901526000818161018601526102450152610ae66000f3fe60806040526004361061005e5760003560e01c8063b269681d11610043578063b269681d14610174578063d124dc4f146101a8578063dc354296146101c857600080fd5b80630a79309b146100f7578063146bf4b11461011757600080fd5b366100f25760005460ff16156100f0577f000000000000000000000000000000000000000000000000000000000000000073ffffffffffffffffffffffffffffffffffffffff1663d0e30db0476040518263ffffffff1660e01b81526004016000604051808303818588803b1580156100d657600080fd5b505af11580156100ea573d6000803e3d6000fd5b50505050505b005b600080fd5b34801561010357600080fd5b506100f0610112366004610974565b6101de565b34801561012357600080fd5b5061014b7f000000000000000000000000000000000000000000000000000000000000000081565b60405173ffffffffffffffffffffffffffffffffffffffff909116815260200160405180910390f35b34801561018057600080fd5b5061014b7f000000000000000000000000000000000000000000000000000000000000000081565b3480156101b457600080fd5b506100f06101c336600461099f565b610318565b3480156101d457600080fd5b5061014b61101081565b6101e6610499565b610213600080547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff00169055565b6040517f70a082310000000000000000000000000000000000000000000000000000000081523060048201526102e5907f00000000000000000000000000000000000000000000000000000000000000009073ffffffffffffffffffffffffffffffffffffffff8416906370a0823190602401602060405180830381865afa1580156102a3573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906102c791906109e1565b73ffffffffffffffffffffffffffffffffffffffff8416919061050c565b610315600080547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff00166001179055565b50565b610320610499565b61034d600080547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff00169055565b61036f73ffffffffffffffffffffffffffffffffffffffff84163330856105e0565b6040517f2e1a7d4d0000000000000000000000000000000000000000000000000000000081526004810183905273ffffffffffffffffffffffffffffffffffffffff841690632e1a7d4d90602401600060405180830381600087803b1580156103d757600080fd5b505af11580156103eb573d6000803e3d6000fd5b505050508015610464576040517f2e1a7d4d0000000000000000000000000000000000000000000000000000000081526004810183905261101090632e1a7d4d9084906024016000604051808303818588803b15801561044a57600080fd5b505af115801561045e573d6000803e3d6000fd5b50505050505b610494600080547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff00166001179055565b505050565b60005460ff1661050a576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601f60248201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c0060448201526064015b60405180910390fd5b565b60405173ffffffffffffffffffffffffffffffffffffffff83166024820152604481018290526104949084907fa9059cbb00000000000000000000000000000000000000000000000000000000906064015b604080517fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe08184030181529190526020810180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff167fffffffff0000000000000000000000000000000000000000000000000000000090931692909217909152610644565b60405173ffffffffffffffffffffffffffffffffffffffff8085166024830152831660448201526064810182905261063e9085907f23b872dd000000000000000000000000000000000000000000000000000000009060840161055e565b50505050565b60006106a6826040518060400160405280602081526020017f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c65648152508573ffffffffffffffffffffffffffffffffffffffff166107509092919063ffffffff16565b80519091501561049457808060200190518101906106c491906109fa565b610494576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602a60248201527f5361666545524332303a204552433230206f7065726174696f6e20646964206e60448201527f6f742073756363656564000000000000000000000000000000000000000000006064820152608401610501565b606061075f8484600085610769565b90505b9392505050565b6060824710156107fb576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602660248201527f416464726573733a20696e73756666696369656e742062616c616e636520666f60448201527f722063616c6c00000000000000000000000000000000000000000000000000006064820152608401610501565b73ffffffffffffffffffffffffffffffffffffffff85163b610879576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e74726163740000006044820152606401610501565b6000808673ffffffffffffffffffffffffffffffffffffffff1685876040516108a29190610a43565b60006040518083038185875af1925050503d80600081146108df576040519150601f19603f3d011682016040523d82523d6000602084013e6108e4565b606091505b50915091506108f48282866108ff565b979650505050505050565b6060831561090e575081610762565b82511561091e5782518084602001fd5b816040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016105019190610a5f565b73ffffffffffffffffffffffffffffffffffffffff8116811461031557600080fd5b60006020828403121561098657600080fd5b813561076281610952565b801515811461031557600080fd5b6000806000606084860312156109b457600080fd5b83356109bf81610952565b92506020840135915060408401356109d681610991565b809150509250925092565b6000602082840312156109f357600080fd5b5051919050565b600060208284031215610a0c57600080fd5b815161076281610991565b60005b83811015610a32578181015183820152602001610a1a565b8381111561063e5750506000910152565b60008251610a55818460208701610a17565b9190910192915050565b6020815260008251806020840152610a7e816040850160208701610a17565b601f017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe016919091016040019291505056fea2646970667358221220a6bfbc7a1aefd28bea6fd266df05752c1c618d43ebe6b51f137c909303fc674f64736f6c634300080d0033", + "deployedBytecode": "0x60806040526004361061005e5760003560e01c8063b269681d11610043578063b269681d14610174578063d124dc4f146101a8578063dc354296146101c857600080fd5b80630a79309b146100f7578063146bf4b11461011757600080fd5b366100f25760005460ff16156100f0577f000000000000000000000000000000000000000000000000000000000000000073ffffffffffffffffffffffffffffffffffffffff1663d0e30db0476040518263ffffffff1660e01b81526004016000604051808303818588803b1580156100d657600080fd5b505af11580156100ea573d6000803e3d6000fd5b50505050505b005b600080fd5b34801561010357600080fd5b506100f0610112366004610974565b6101de565b34801561012357600080fd5b5061014b7f000000000000000000000000000000000000000000000000000000000000000081565b60405173ffffffffffffffffffffffffffffffffffffffff909116815260200160405180910390f35b34801561018057600080fd5b5061014b7f000000000000000000000000000000000000000000000000000000000000000081565b3480156101b457600080fd5b506100f06101c336600461099f565b610318565b3480156101d457600080fd5b5061014b61101081565b6101e6610499565b610213600080547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff00169055565b6040517f70a082310000000000000000000000000000000000000000000000000000000081523060048201526102e5907f00000000000000000000000000000000000000000000000000000000000000009073ffffffffffffffffffffffffffffffffffffffff8416906370a0823190602401602060405180830381865afa1580156102a3573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906102c791906109e1565b73ffffffffffffffffffffffffffffffffffffffff8416919061050c565b610315600080547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff00166001179055565b50565b610320610499565b61034d600080547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff00169055565b61036f73ffffffffffffffffffffffffffffffffffffffff84163330856105e0565b6040517f2e1a7d4d0000000000000000000000000000000000000000000000000000000081526004810183905273ffffffffffffffffffffffffffffffffffffffff841690632e1a7d4d90602401600060405180830381600087803b1580156103d757600080fd5b505af11580156103eb573d6000803e3d6000fd5b505050508015610464576040517f2e1a7d4d0000000000000000000000000000000000000000000000000000000081526004810183905261101090632e1a7d4d9084906024016000604051808303818588803b15801561044a57600080fd5b505af115801561045e573d6000803e3d6000fd5b50505050505b610494600080547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff00166001179055565b505050565b60005460ff1661050a576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601f60248201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c0060448201526064015b60405180910390fd5b565b60405173ffffffffffffffffffffffffffffffffffffffff83166024820152604481018290526104949084907fa9059cbb00000000000000000000000000000000000000000000000000000000906064015b604080517fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe08184030181529190526020810180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff167fffffffff0000000000000000000000000000000000000000000000000000000090931692909217909152610644565b60405173ffffffffffffffffffffffffffffffffffffffff8085166024830152831660448201526064810182905261063e9085907f23b872dd000000000000000000000000000000000000000000000000000000009060840161055e565b50505050565b60006106a6826040518060400160405280602081526020017f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c65648152508573ffffffffffffffffffffffffffffffffffffffff166107509092919063ffffffff16565b80519091501561049457808060200190518101906106c491906109fa565b610494576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602a60248201527f5361666545524332303a204552433230206f7065726174696f6e20646964206e60448201527f6f742073756363656564000000000000000000000000000000000000000000006064820152608401610501565b606061075f8484600085610769565b90505b9392505050565b6060824710156107fb576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602660248201527f416464726573733a20696e73756666696369656e742062616c616e636520666f60448201527f722063616c6c00000000000000000000000000000000000000000000000000006064820152608401610501565b73ffffffffffffffffffffffffffffffffffffffff85163b610879576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e74726163740000006044820152606401610501565b6000808673ffffffffffffffffffffffffffffffffffffffff1685876040516108a29190610a43565b60006040518083038185875af1925050503d80600081146108df576040519150601f19603f3d011682016040523d82523d6000602084013e6108e4565b606091505b50915091506108f48282866108ff565b979650505050505050565b6060831561090e575081610762565b82511561091e5782518084602001fd5b816040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016105019190610a5f565b73ffffffffffffffffffffffffffffffffffffffff8116811461031557600080fd5b60006020828403121561098657600080fd5b813561076281610952565b801515811461031557600080fd5b6000806000606084860312156109b457600080fd5b83356109bf81610952565b92506020840135915060408401356109d681610991565b809150509250925092565b6000602082840312156109f357600080fd5b5051919050565b600060208284031215610a0c57600080fd5b815161076281610991565b60005b83811015610a32578181015183820152602001610a1a565b8381111561063e5750506000910152565b60008251610a55818460208701610a17565b9190910192915050565b6020815260008251806020840152610a7e816040850160208701610a17565b601f017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe016919091016040019291505056fea2646970667358221220a6bfbc7a1aefd28bea6fd266df05752c1c618d43ebe6b51f137c909303fc674f64736f6c634300080d0033", + "devdoc": { + "details": "Because Polygon only allows withdrawals from a particular address to go to that same address on mainnet, we need to have some sort of contract that can guarantee identical addresses on Polygon and Ethereum. This contract is intended to be completely immutable, so it's guaranteed that the contract on each side is configured identically as long as it is created via create2. create2 is an alternative creation method that uses a different address determination mechanism from normal create. Normal create: address = hash(deployer_address, deployer_nonce) create2: address = hash(0xFF, sender, salt, bytecode) This ultimately allows create2 to generate deterministic addresses that don't depend on the transaction count of the sender.", + "kind": "dev", + "methods": { + "constructor": { + "params": { + "_destination": "Where to send tokens to for this network.", + "_l1Weth": "Ethereum WETH address." + } + }, + "retrieve(address)": { + "params": { + "token": "Token to send to destination." + } + }, + "send(address,uint256,bool)": { + "params": { + "amount": "Amount to bridge.", + "isWrappedMatic": "True if token is WMATIC.", + "token": "Token to bridge." + } + } + }, + "version": 1 + }, + "userdoc": { + "kind": "user", + "methods": { + "constructor": { + "notice": "Constructs Token Bridger contract." + }, + "retrieve(address)": { + "notice": "Called by someone to send tokens to the destination, which should be set to the HubPool." + }, + "send(address,uint256,bool)": { + "notice": "Called by Polygon SpokePool to send tokens over bridge to contract with the same address as this.The caller of this function must approve this contract to spend amount of token." + } + }, + "notice": "Contract deployed on Ethereum and Polygon to facilitate token transfers from Polygon to the HubPool and back.", + "version": 1 + }, + "storageLayout": { + "storage": [ + { + "astId": 7084, + "contract": "contracts/PolygonTokenBridger.sol:PolygonTokenBridger", + "label": "_notEntered", + "offset": 0, + "slot": "0", + "type": "t_bool" + } + ], + "types": { + "t_bool": { + "encoding": "inplace", + "label": "bool", + "numberOfBytes": "1" + } + } + } +} diff --git a/deployments/rinkeby/Polygon_Adapter.json b/deployments/rinkeby/Polygon_Adapter.json new file mode 100644 index 000000000..81af24149 --- /dev/null +++ b/deployments/rinkeby/Polygon_Adapter.json @@ -0,0 +1,235 @@ +{ + "address": "0xd8176EBf6170513Aa232D065042fa480557232A4", + "abi": [ + { + "inputs": [ + { + "internalType": "contract IRootChainManager", + "name": "_rootChainManager", + "type": "address" + }, + { + "internalType": "contract IFxStateSender", + "name": "_fxStateSender", + "type": "address" + }, + { + "internalType": "contract WETH9", + "name": "_l1Weth", + "type": "address" + } + ], + "stateMutability": "nonpayable", + "type": "constructor" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "address", + "name": "target", + "type": "address" + }, + { + "indexed": false, + "internalType": "bytes", + "name": "message", + "type": "bytes" + } + ], + "name": "MessageRelayed", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "address", + "name": "l1Token", + "type": "address" + }, + { + "indexed": false, + "internalType": "address", + "name": "l2Token", + "type": "address" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "amount", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "address", + "name": "to", + "type": "address" + } + ], + "name": "TokensRelayed", + "type": "event" + }, + { + "inputs": [], + "name": "fxStateSender", + "outputs": [ + { + "internalType": "contract IFxStateSender", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "l1Weth", + "outputs": [ + { + "internalType": "contract WETH9", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "target", + "type": "address" + }, + { + "internalType": "bytes", + "name": "message", + "type": "bytes" + } + ], + "name": "relayMessage", + "outputs": [], + "stateMutability": "payable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "l1Token", + "type": "address" + }, + { + "internalType": "address", + "name": "l2Token", + "type": "address" + }, + { + "internalType": "uint256", + "name": "amount", + "type": "uint256" + }, + { + "internalType": "address", + "name": "to", + "type": "address" + } + ], + "name": "relayTokens", + "outputs": [], + "stateMutability": "payable", + "type": "function" + }, + { + "inputs": [], + "name": "rootChainManager", + "outputs": [ + { + "internalType": "contract IRootChainManager", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + } + ], + "transactionHash": "0xe956201b802ff2a0c28cc36e41c4acdbd3d2a6b6c5f733bd456b807f33d354b6", + "receipt": { + "to": null, + "from": "0x9A8f92a830A5cB89a3816e3D267CB7791c16b04D", + "contractAddress": "0xd8176EBf6170513Aa232D065042fa480557232A4", + "transactionIndex": 4, + "gasUsed": "755477", + "logsBloom": "0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", + "blockHash": "0x609c9511c6a7fb5ece6e763fb1dfcea544ac4cef9a8a71a07db95459b42369bf", + "transactionHash": "0xe956201b802ff2a0c28cc36e41c4acdbd3d2a6b6c5f733bd456b807f33d354b6", + "logs": [], + "blockNumber": 10365605, + "cumulativeGasUsed": "1756361", + "status": 1, + "byzantium": true + }, + "args": [ + "0xBbD7cBFA79faee899Eaf900F13C9065bF03B1A74", + "0x3d1d3E34f7fB6D26245E6640E1c50710eFFf15bA", + "0xc778417E063141139Fce010982780140Aa0cD5Ab" + ], + "numDeployments": 1, + "solcInputHash": "c8b9349311d8b5049b613ac98eb998d0", + "metadata": "{\"compiler\":{\"version\":\"0.8.13+commit.abaa5c0e\"},\"language\":\"Solidity\",\"output\":{\"abi\":[{\"inputs\":[{\"internalType\":\"contract IRootChainManager\",\"name\":\"_rootChainManager\",\"type\":\"address\"},{\"internalType\":\"contract IFxStateSender\",\"name\":\"_fxStateSender\",\"type\":\"address\"},{\"internalType\":\"contract WETH9\",\"name\":\"_l1Weth\",\"type\":\"address\"}],\"stateMutability\":\"nonpayable\",\"type\":\"constructor\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"address\",\"name\":\"target\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"bytes\",\"name\":\"message\",\"type\":\"bytes\"}],\"name\":\"MessageRelayed\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"address\",\"name\":\"l1Token\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"address\",\"name\":\"l2Token\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"address\",\"name\":\"to\",\"type\":\"address\"}],\"name\":\"TokensRelayed\",\"type\":\"event\"},{\"inputs\":[],\"name\":\"fxStateSender\",\"outputs\":[{\"internalType\":\"contract IFxStateSender\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"l1Weth\",\"outputs\":[{\"internalType\":\"contract WETH9\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"target\",\"type\":\"address\"},{\"internalType\":\"bytes\",\"name\":\"message\",\"type\":\"bytes\"}],\"name\":\"relayMessage\",\"outputs\":[],\"stateMutability\":\"payable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"l1Token\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"l2Token\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"},{\"internalType\":\"address\",\"name\":\"to\",\"type\":\"address\"}],\"name\":\"relayTokens\",\"outputs\":[],\"stateMutability\":\"payable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"rootChainManager\",\"outputs\":[{\"internalType\":\"contract IRootChainManager\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"}],\"devdoc\":{\"details\":\"Public functions calling external contracts do not guard against reentrancy because they are expected to be called via delegatecall, which will execute this contract's logic within the context of the originating contract. For example, the HubPool will delegatecall these functions, therefore its only necessary that the HubPool's methods that call this contract's logic guard against reentrancy.\",\"kind\":\"dev\",\"methods\":{\"constructor\":{\"params\":{\"_fxStateSender\":\"FxStateSender Polygon system helper contract.\",\"_l1Weth\":\"WETH address on L1.\",\"_rootChainManager\":\"RootChainManager Polygon system helper contract.\"}},\"relayMessage(address,bytes)\":{\"params\":{\"message\":\"Data to send to target.\",\"target\":\"Contract on Polygon that will receive message.\"}},\"relayTokens(address,address,uint256,address)\":{\"params\":{\"amount\":\"Amount of L1 tokens to deposit and L2 tokens to receive.\",\"l1Token\":\"L1 token to deposit.\",\"l2Token\":\"L2 token to receive.\",\"to\":\"Bridge recipient.\"}}},\"version\":1},\"userdoc\":{\"kind\":\"user\",\"methods\":{\"constructor\":{\"notice\":\"Constructs new Adapter.\"},\"relayMessage(address,bytes)\":{\"notice\":\"Send cross-chain message to target on Polygon.\"},\"relayTokens(address,address,uint256,address)\":{\"notice\":\"Bridge tokens to Polygon.\"}},\"notice\":\"Sends cross chain messages Polygon L2 network.\",\"version\":1}},\"settings\":{\"compilationTarget\":{\"contracts/chain-adapters/Polygon_Adapter.sol\":\"Polygon_Adapter\"},\"evmVersion\":\"london\",\"libraries\":{},\"metadata\":{\"bytecodeHash\":\"ipfs\",\"useLiteralContent\":true},\"optimizer\":{\"enabled\":true,\"runs\":1000000},\"remappings\":[]},\"sources\":{\"@openzeppelin/contracts/token/ERC20/IERC20.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.5.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 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(\\n address from,\\n address to,\\n uint256 amount\\n ) external returns (bool);\\n\\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\",\"keccak256\":\"0xbbc8ac883ac3c0078ce5ad3e288fbb3ffcc8a30c3a98c0fda0114d64fc44fca2\",\"license\":\"MIT\"},\"@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts v4.4.1 (token/ERC20/utils/SafeERC20.sol)\\n\\npragma solidity ^0.8.0;\\n\\nimport \\\"../IERC20.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 function safeTransfer(\\n IERC20 token,\\n address to,\\n uint256 value\\n ) internal {\\n _callOptionalReturn(token, abi.encodeWithSelector(token.transfer.selector, to, value));\\n }\\n\\n function safeTransferFrom(\\n IERC20 token,\\n address from,\\n address to,\\n uint256 value\\n ) 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(\\n IERC20 token,\\n address spender,\\n uint256 value\\n ) 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 function safeIncreaseAllowance(\\n IERC20 token,\\n address spender,\\n uint256 value\\n ) internal {\\n uint256 newAllowance = token.allowance(address(this), spender) + value;\\n _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, newAllowance));\\n }\\n\\n function safeDecreaseAllowance(\\n IERC20 token,\\n address spender,\\n uint256 value\\n ) internal {\\n unchecked {\\n uint256 oldAllowance = token.allowance(address(this), spender);\\n require(oldAllowance >= value, \\\"SafeERC20: decreased allowance below zero\\\");\\n uint256 newAllowance = oldAllowance - value;\\n _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, newAllowance));\\n }\\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 if (returndata.length > 0) {\\n // Return data is optional\\n require(abi.decode(returndata, (bool)), \\\"SafeERC20: ERC20 operation did not succeed\\\");\\n }\\n }\\n}\\n\",\"keccak256\":\"0xc3d946432c0ddbb1f846a0d3985be71299df331b91d06732152117f62f0be2b5\",\"license\":\"MIT\"},\"@openzeppelin/contracts/utils/Address.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.5.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 *\\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://diligence.consensys.net/posts/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.5.11/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 functionCall(target, data, \\\"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(\\n address target,\\n bytes memory data,\\n uint256 value\\n ) 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 require(isContract(target), \\\"Address: call to non-contract\\\");\\n\\n (bool success, bytes memory returndata) = target.call{value: value}(data);\\n return verifyCallResult(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 require(isContract(target), \\\"Address: static call to non-contract\\\");\\n\\n (bool success, bytes memory returndata) = target.staticcall(data);\\n return verifyCallResult(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 require(isContract(target), \\\"Address: delegate call to non-contract\\\");\\n\\n (bool success, bytes memory returndata) = target.delegatecall(data);\\n return verifyCallResult(success, returndata, errorMessage);\\n }\\n\\n /**\\n * @dev Tool to verifies that a low level call was successful, and revert if it wasn't, either by bubbling the\\n * revert reason 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 // 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\\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}\\n\",\"keccak256\":\"0x2ccf9d2313a313d41a791505f2b5abfdc62191b5d4334f7f7a82691c088a1c87\",\"license\":\"MIT\"},\"contracts/chain-adapters/Polygon_Adapter.sol\":{\"content\":\"// SPDX-License-Identifier: AGPL-3.0-only\\npragma solidity ^0.8.0;\\n\\nimport \\\"../interfaces/AdapterInterface.sol\\\";\\nimport \\\"../interfaces/WETH9.sol\\\";\\n\\nimport \\\"@openzeppelin/contracts/token/ERC20/IERC20.sol\\\";\\nimport \\\"@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol\\\";\\n\\ninterface IRootChainManager {\\n function depositEtherFor(address user) external payable;\\n\\n function depositFor(\\n address user,\\n address rootToken,\\n bytes calldata depositData\\n ) external;\\n}\\n\\ninterface IFxStateSender {\\n function sendMessageToChild(address _receiver, bytes calldata _data) external;\\n}\\n\\n/**\\n * @notice Sends cross chain messages Polygon L2 network.\\n * @dev Public functions calling external contracts do not guard against reentrancy because they are expected to be\\n * called via delegatecall, which will execute this contract's logic within the context of the originating contract.\\n * For example, the HubPool will delegatecall these functions, therefore its only necessary that the HubPool's methods\\n * that call this contract's logic guard against reentrancy.\\n */\\ncontract Polygon_Adapter is AdapterInterface {\\n using SafeERC20 for IERC20;\\n IRootChainManager public immutable rootChainManager;\\n IFxStateSender public immutable fxStateSender;\\n WETH9 public immutable l1Weth;\\n\\n /**\\n * @notice Constructs new Adapter.\\n * @param _rootChainManager RootChainManager Polygon system helper contract.\\n * @param _fxStateSender FxStateSender Polygon system helper contract.\\n * @param _l1Weth WETH address on L1.\\n */\\n constructor(\\n IRootChainManager _rootChainManager,\\n IFxStateSender _fxStateSender,\\n WETH9 _l1Weth\\n ) {\\n rootChainManager = _rootChainManager;\\n fxStateSender = _fxStateSender;\\n l1Weth = _l1Weth;\\n }\\n\\n /**\\n * @notice Send cross-chain message to target on Polygon.\\n * @param target Contract on Polygon that will receive message.\\n * @param message Data to send to target.\\n */\\n\\n function relayMessage(address target, bytes memory message) external payable override {\\n fxStateSender.sendMessageToChild(target, message);\\n emit MessageRelayed(target, message);\\n }\\n\\n /**\\n * @notice Bridge tokens to Polygon.\\n * @param l1Token L1 token to deposit.\\n * @param l2Token L2 token to receive.\\n * @param amount Amount of L1 tokens to deposit and L2 tokens to receive.\\n * @param to Bridge recipient.\\n */\\n function relayTokens(\\n address l1Token,\\n address l2Token,\\n uint256 amount,\\n address to\\n ) external payable override {\\n // If the l1Token is weth then unwrap it to ETH then send the ETH to the standard bridge.\\n if (l1Token == address(l1Weth)) {\\n l1Weth.withdraw(amount);\\n rootChainManager.depositEtherFor{ value: amount }(to);\\n } else {\\n IERC20(l1Token).safeIncreaseAllowance(address(rootChainManager), amount);\\n rootChainManager.depositFor(to, l1Token, abi.encode(amount));\\n }\\n emit TokensRelayed(l1Token, l2Token, amount, to);\\n }\\n}\\n\",\"keccak256\":\"0x0d47c68dbc8612ab9959918f1d085461bc6765e033efad68e95f2ae4e2441cf6\",\"license\":\"AGPL-3.0-only\"},\"contracts/interfaces/AdapterInterface.sol\":{\"content\":\"// SPDX-License-Identifier: AGPL-3.0-only\\npragma solidity ^0.8.0;\\n\\n/**\\n * @notice Sends cross chain messages and tokens to contracts on a specific L2 network.\\n */\\n\\ninterface AdapterInterface {\\n event MessageRelayed(address target, bytes message);\\n\\n event TokensRelayed(address l1Token, address l2Token, uint256 amount, address to);\\n\\n function relayMessage(address target, bytes memory message) external payable;\\n\\n function relayTokens(\\n address l1Token,\\n address l2Token,\\n uint256 amount,\\n address to\\n ) external payable;\\n}\\n\",\"keccak256\":\"0xbd7091006acbdfe72b21ce985f964f0682a2316d9d3b38967beeb55f4ae5118c\",\"license\":\"AGPL-3.0-only\"},\"contracts/interfaces/WETH9.sol\":{\"content\":\"// SPDX-License-Identifier: GPL-3.0-only\\npragma solidity ^0.8.0;\\n\\ninterface WETH9 {\\n function withdraw(uint256 wad) external;\\n\\n function deposit() external payable;\\n\\n function balanceOf(address guy) external view returns (uint256 wad);\\n\\n function transfer(address guy, uint256 wad) external;\\n}\\n\",\"keccak256\":\"0x7b444d0840b1f76eee9bf39d74830f70644395613b96cce2d80fc50785a82eaa\",\"license\":\"GPL-3.0-only\"}},\"version\":1}", + "bytecode": "0x60e060405234801561001057600080fd5b50604051610dc7380380610dc783398101604081905261002f91610064565b6001600160a01b0392831660805290821660a0521660c0526100b1565b6001600160a01b038116811461006157600080fd5b50565b60008060006060848603121561007957600080fd5b83516100848161004c565b60208501519093506100958161004c565b60408501519092506100a68161004c565b809150509250925092565b60805160a05160c051610cbf6101086000396000818160710152818161014e01526101ce01526000818160e3015261047b0152600081816101170152818161028201528181610303015261032a0152610cbf6000f3fe60806040526004361061005a5760003560e01c8063a996cabb11610043578063a996cabb146100d1578063bd07018d14610105578063e6eb8ade1461013957600080fd5b8063146bf4b11461005f57806352c8c75c146100bc575b600080fd5b34801561006b57600080fd5b506100937f000000000000000000000000000000000000000000000000000000000000000081565b60405173ffffffffffffffffffffffffffffffffffffffff909116815260200160405180910390f35b6100cf6100ca36600461099d565b61014c565b005b3480156100dd57600080fd5b506100937f000000000000000000000000000000000000000000000000000000000000000081565b34801561011157600080fd5b506100937f000000000000000000000000000000000000000000000000000000000000000081565b6100cf610147366004610a19565b61043e565b7f000000000000000000000000000000000000000000000000000000000000000073ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff16036102e7576040517f2e1a7d4d000000000000000000000000000000000000000000000000000000008152600481018390527f000000000000000000000000000000000000000000000000000000000000000073ffffffffffffffffffffffffffffffffffffffff1690632e1a7d4d90602401600060405180830381600087803b15801561022757600080fd5b505af115801561023b573d6000803e3d6000fd5b50506040517f4faa8a2600000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff84811660048301527f0000000000000000000000000000000000000000000000000000000000000000169250634faa8a26915084906024016000604051808303818588803b1580156102c957600080fd5b505af11580156102dd573d6000803e3d6000fd5b50505050506103d9565b61032873ffffffffffffffffffffffffffffffffffffffff85167f000000000000000000000000000000000000000000000000000000000000000084610521565b7f000000000000000000000000000000000000000000000000000000000000000073ffffffffffffffffffffffffffffffffffffffff1663e3dec8fb82868560405160200161037991815260200190565b6040516020818303038152906040526040518463ffffffff1660e01b81526004016103a693929190610b6f565b600060405180830381600087803b1580156103c057600080fd5b505af11580156103d4573d6000803e3d6000fd5b505050505b6040805173ffffffffffffffffffffffffffffffffffffffff868116825285811660208301528183018590528316606082015290517fd7e09655439c3932e55857df3220186e5a7f0980825f20691c2b35d941dee75b9181900360800190a150505050565b6040517fb472047700000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff7f0000000000000000000000000000000000000000000000000000000000000000169063b4720477906104b29085908590600401610bb1565b600060405180830381600087803b1580156104cc57600080fd5b505af11580156104e0573d6000803e3d6000fd5b505050507f9e6c52944e331ba6270e7fe4cea2a4086bae8f7a27e1cdba07f416806f5d0ac48282604051610515929190610bb1565b60405180910390a15050565b6040517fdd62ed3e00000000000000000000000000000000000000000000000000000000815230600482015273ffffffffffffffffffffffffffffffffffffffff8381166024830152600091839186169063dd62ed3e90604401602060405180830381865afa158015610598573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906105bc9190610be0565b6105c69190610bf9565b6040805173ffffffffffffffffffffffffffffffffffffffff8616602482015260448082018490528251808303909101815260649091019091526020810180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff167f095ea7b30000000000000000000000000000000000000000000000000000000017905290915061065690859061065c565b50505050565b60006106be826040518060400160405280602081526020017f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c65648152508573ffffffffffffffffffffffffffffffffffffffff166107729092919063ffffffff16565b80519091501561076d57808060200190518101906106dc9190610c38565b61076d576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602a60248201527f5361666545524332303a204552433230206f7065726174696f6e20646964206e60448201527f6f7420737563636565640000000000000000000000000000000000000000000060648201526084015b60405180910390fd5b505050565b6060610781848460008561078b565b90505b9392505050565b60608247101561081d576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602660248201527f416464726573733a20696e73756666696369656e742062616c616e636520666f60448201527f722063616c6c00000000000000000000000000000000000000000000000000006064820152608401610764565b73ffffffffffffffffffffffffffffffffffffffff85163b61089b576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e74726163740000006044820152606401610764565b6000808673ffffffffffffffffffffffffffffffffffffffff1685876040516108c49190610c5a565b60006040518083038185875af1925050503d8060008114610901576040519150601f19603f3d011682016040523d82523d6000602084013e610906565b606091505b5091509150610916828286610921565b979650505050505050565b60608315610930575081610784565b8251156109405782518084602001fd5b816040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016107649190610c76565b803573ffffffffffffffffffffffffffffffffffffffff8116811461099857600080fd5b919050565b600080600080608085870312156109b357600080fd5b6109bc85610974565b93506109ca60208601610974565b9250604085013591506109df60608601610974565b905092959194509250565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b60008060408385031215610a2c57600080fd5b610a3583610974565b9150602083013567ffffffffffffffff80821115610a5257600080fd5b818501915085601f830112610a6657600080fd5b813581811115610a7857610a786109ea565b604051601f82017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0908116603f01168101908382118183101715610abe57610abe6109ea565b81604052828152886020848701011115610ad757600080fd5b8260208601602083013760006020848301015280955050505050509250929050565b60005b83811015610b14578181015183820152602001610afc565b838111156106565750506000910152565b60008151808452610b3d816020860160208601610af9565b601f017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0169290920160200192915050565b600073ffffffffffffffffffffffffffffffffffffffff808616835280851660208401525060606040830152610ba86060830184610b25565b95945050505050565b73ffffffffffffffffffffffffffffffffffffffff831681526040602082015260006107816040830184610b25565b600060208284031215610bf257600080fd5b5051919050565b60008219821115610c33577f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b500190565b600060208284031215610c4a57600080fd5b8151801515811461078457600080fd5b60008251610c6c818460208701610af9565b9190910192915050565b6020815260006107846020830184610b2556fea2646970667358221220314a1e3672715e1c9fd64c503fc29f347e18573590a2881a1f8a69e6e8bfabd264736f6c634300080d0033", + "deployedBytecode": "0x60806040526004361061005a5760003560e01c8063a996cabb11610043578063a996cabb146100d1578063bd07018d14610105578063e6eb8ade1461013957600080fd5b8063146bf4b11461005f57806352c8c75c146100bc575b600080fd5b34801561006b57600080fd5b506100937f000000000000000000000000000000000000000000000000000000000000000081565b60405173ffffffffffffffffffffffffffffffffffffffff909116815260200160405180910390f35b6100cf6100ca36600461099d565b61014c565b005b3480156100dd57600080fd5b506100937f000000000000000000000000000000000000000000000000000000000000000081565b34801561011157600080fd5b506100937f000000000000000000000000000000000000000000000000000000000000000081565b6100cf610147366004610a19565b61043e565b7f000000000000000000000000000000000000000000000000000000000000000073ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff16036102e7576040517f2e1a7d4d000000000000000000000000000000000000000000000000000000008152600481018390527f000000000000000000000000000000000000000000000000000000000000000073ffffffffffffffffffffffffffffffffffffffff1690632e1a7d4d90602401600060405180830381600087803b15801561022757600080fd5b505af115801561023b573d6000803e3d6000fd5b50506040517f4faa8a2600000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff84811660048301527f0000000000000000000000000000000000000000000000000000000000000000169250634faa8a26915084906024016000604051808303818588803b1580156102c957600080fd5b505af11580156102dd573d6000803e3d6000fd5b50505050506103d9565b61032873ffffffffffffffffffffffffffffffffffffffff85167f000000000000000000000000000000000000000000000000000000000000000084610521565b7f000000000000000000000000000000000000000000000000000000000000000073ffffffffffffffffffffffffffffffffffffffff1663e3dec8fb82868560405160200161037991815260200190565b6040516020818303038152906040526040518463ffffffff1660e01b81526004016103a693929190610b6f565b600060405180830381600087803b1580156103c057600080fd5b505af11580156103d4573d6000803e3d6000fd5b505050505b6040805173ffffffffffffffffffffffffffffffffffffffff868116825285811660208301528183018590528316606082015290517fd7e09655439c3932e55857df3220186e5a7f0980825f20691c2b35d941dee75b9181900360800190a150505050565b6040517fb472047700000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff7f0000000000000000000000000000000000000000000000000000000000000000169063b4720477906104b29085908590600401610bb1565b600060405180830381600087803b1580156104cc57600080fd5b505af11580156104e0573d6000803e3d6000fd5b505050507f9e6c52944e331ba6270e7fe4cea2a4086bae8f7a27e1cdba07f416806f5d0ac48282604051610515929190610bb1565b60405180910390a15050565b6040517fdd62ed3e00000000000000000000000000000000000000000000000000000000815230600482015273ffffffffffffffffffffffffffffffffffffffff8381166024830152600091839186169063dd62ed3e90604401602060405180830381865afa158015610598573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906105bc9190610be0565b6105c69190610bf9565b6040805173ffffffffffffffffffffffffffffffffffffffff8616602482015260448082018490528251808303909101815260649091019091526020810180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff167f095ea7b30000000000000000000000000000000000000000000000000000000017905290915061065690859061065c565b50505050565b60006106be826040518060400160405280602081526020017f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c65648152508573ffffffffffffffffffffffffffffffffffffffff166107729092919063ffffffff16565b80519091501561076d57808060200190518101906106dc9190610c38565b61076d576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602a60248201527f5361666545524332303a204552433230206f7065726174696f6e20646964206e60448201527f6f7420737563636565640000000000000000000000000000000000000000000060648201526084015b60405180910390fd5b505050565b6060610781848460008561078b565b90505b9392505050565b60608247101561081d576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602660248201527f416464726573733a20696e73756666696369656e742062616c616e636520666f60448201527f722063616c6c00000000000000000000000000000000000000000000000000006064820152608401610764565b73ffffffffffffffffffffffffffffffffffffffff85163b61089b576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e74726163740000006044820152606401610764565b6000808673ffffffffffffffffffffffffffffffffffffffff1685876040516108c49190610c5a565b60006040518083038185875af1925050503d8060008114610901576040519150601f19603f3d011682016040523d82523d6000602084013e610906565b606091505b5091509150610916828286610921565b979650505050505050565b60608315610930575081610784565b8251156109405782518084602001fd5b816040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016107649190610c76565b803573ffffffffffffffffffffffffffffffffffffffff8116811461099857600080fd5b919050565b600080600080608085870312156109b357600080fd5b6109bc85610974565b93506109ca60208601610974565b9250604085013591506109df60608601610974565b905092959194509250565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b60008060408385031215610a2c57600080fd5b610a3583610974565b9150602083013567ffffffffffffffff80821115610a5257600080fd5b818501915085601f830112610a6657600080fd5b813581811115610a7857610a786109ea565b604051601f82017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0908116603f01168101908382118183101715610abe57610abe6109ea565b81604052828152886020848701011115610ad757600080fd5b8260208601602083013760006020848301015280955050505050509250929050565b60005b83811015610b14578181015183820152602001610afc565b838111156106565750506000910152565b60008151808452610b3d816020860160208601610af9565b601f017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0169290920160200192915050565b600073ffffffffffffffffffffffffffffffffffffffff808616835280851660208401525060606040830152610ba86060830184610b25565b95945050505050565b73ffffffffffffffffffffffffffffffffffffffff831681526040602082015260006107816040830184610b25565b600060208284031215610bf257600080fd5b5051919050565b60008219821115610c33577f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b500190565b600060208284031215610c4a57600080fd5b8151801515811461078457600080fd5b60008251610c6c818460208701610af9565b9190910192915050565b6020815260006107846020830184610b2556fea2646970667358221220314a1e3672715e1c9fd64c503fc29f347e18573590a2881a1f8a69e6e8bfabd264736f6c634300080d0033", + "devdoc": { + "details": "Public functions calling external contracts do not guard against reentrancy because they are expected to be called via delegatecall, which will execute this contract's logic within the context of the originating contract. For example, the HubPool will delegatecall these functions, therefore its only necessary that the HubPool's methods that call this contract's logic guard against reentrancy.", + "kind": "dev", + "methods": { + "constructor": { + "params": { + "_fxStateSender": "FxStateSender Polygon system helper contract.", + "_l1Weth": "WETH address on L1.", + "_rootChainManager": "RootChainManager Polygon system helper contract." + } + }, + "relayMessage(address,bytes)": { + "params": { + "message": "Data to send to target.", + "target": "Contract on Polygon that will receive message." + } + }, + "relayTokens(address,address,uint256,address)": { + "params": { + "amount": "Amount of L1 tokens to deposit and L2 tokens to receive.", + "l1Token": "L1 token to deposit.", + "l2Token": "L2 token to receive.", + "to": "Bridge recipient." + } + } + }, + "version": 1 + }, + "userdoc": { + "kind": "user", + "methods": { + "constructor": { + "notice": "Constructs new Adapter." + }, + "relayMessage(address,bytes)": { + "notice": "Send cross-chain message to target on Polygon." + }, + "relayTokens(address,address,uint256,address)": { + "notice": "Bridge tokens to Polygon." + } + }, + "notice": "Sends cross chain messages Polygon L2 network.", + "version": 1 + }, + "storageLayout": { + "storage": [], + "types": null + } +} diff --git a/deployments/rinkeby/solcInputs/b448085fba4896ef879334e29280c4da.json b/deployments/rinkeby/solcInputs/2fe6c4b637a440a1380be3adbf7d9e12.json similarity index 51% rename from deployments/rinkeby/solcInputs/b448085fba4896ef879334e29280c4da.json rename to deployments/rinkeby/solcInputs/2fe6c4b637a440a1380be3adbf7d9e12.json index f913e70c0..582dc2eab 100644 --- a/deployments/rinkeby/solcInputs/b448085fba4896ef879334e29280c4da.json +++ b/deployments/rinkeby/solcInputs/2fe6c4b637a440a1380be3adbf7d9e12.json @@ -2,25 +2,22 @@ "language": "Solidity", "sources": { "contracts/HubPool.sol": { - "content": "// SPDX-License-Identifier: GPL-3.0-only\r\npragma solidity ^0.8.0;\r\n\r\nimport \"./MerkleLib.sol\";\r\nimport \"./HubPoolInterface.sol\";\r\nimport \"./Lockable.sol\";\r\n\r\nimport \"./interfaces/AdapterInterface.sol\";\r\nimport \"./interfaces/LpTokenFactoryInterface.sol\";\r\nimport \"./interfaces/WETH9.sol\";\r\n\r\nimport \"@uma/core/contracts/common/implementation/Testable.sol\";\r\nimport \"@uma/core/contracts/common/implementation/MultiCaller.sol\";\r\nimport \"@uma/core/contracts/oracle/implementation/Constants.sol\";\r\nimport \"@uma/core/contracts/common/implementation/AncillaryData.sol\";\r\nimport \"@uma/core/contracts/common/interfaces/AddressWhitelistInterface.sol\";\r\nimport \"@uma/core/contracts/oracle/interfaces/IdentifierWhitelistInterface.sol\";\r\n\r\nimport \"@uma/core/contracts/oracle/interfaces/FinderInterface.sol\";\r\nimport \"@uma/core/contracts/oracle/interfaces/StoreInterface.sol\";\r\nimport \"@uma/core/contracts/oracle/interfaces/SkinnyOptimisticOracleInterface.sol\";\r\nimport \"@uma/core/contracts/common/interfaces/ExpandedIERC20.sol\";\r\n\r\nimport \"@openzeppelin/contracts/access/Ownable.sol\";\r\nimport \"@openzeppelin/contracts/token/ERC20/IERC20.sol\";\r\nimport \"@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol\";\r\nimport \"@openzeppelin/contracts/utils/Address.sol\";\r\n\r\ncontract HubPool is HubPoolInterface, Testable, Lockable, MultiCaller, Ownable {\r\n using SafeERC20 for IERC20;\r\n using Address for address;\r\n\r\n // A data worker can optimistically store several merkle roots on this contract by staking a bond and calling\r\n // proposeRootBundle. By staking a bond, the data worker is alleging that the merkle roots all\r\n // contain valid leaves that can be executed later to:\r\n // - Send funds from this contract to a SpokePool or vice versa\r\n // - Send funds from a SpokePool to Relayer as a refund for a relayed deposit\r\n // - Send funds from a SpokePool to a deposit recipient to fulfill a \"slow\" relay\r\n // Anyone can dispute this struct if the merkle roots contain invalid leaves before the\r\n // `requestExpirationTimestamp`. Once the expiration timestamp is passed, `executeRootBundle` to execute a leaf\r\n // from the `poolRebalanceRoot` on this contract and it will simultaneously publish the `relayerRefundRoot` and\r\n // `slowRelayFulfillmentRoot` to a SpokePool. The latter two roots, once published to the SpokePool, contain\r\n // leaves that can be executed on the SpokePool to pay relayers or recipients.\r\n struct RootBundle {\r\n uint64 requestExpirationTimestamp;\r\n uint64 unclaimedPoolRebalanceLeafCount;\r\n bytes32 poolRebalanceRoot;\r\n bytes32 relayerRefundRoot;\r\n bytes32 slowRelayFulfillmentRoot;\r\n uint256 claimedBitMap; // This is a 1D bitmap, with max size of 256 elements, limiting us to 256 chainsIds.\r\n address proposer;\r\n bool proposerBondRepaid;\r\n }\r\n\r\n RootBundle public rootBundleProposal;\r\n\r\n // Whitelist of origin token to destination token routings to be used by off-chain agents. The notion of a route\r\n // does not need to include L1; it can store L2->L2 routes i.e USDC on Arbitrum -> USDC on Optimism as a \"route\".\r\n mapping(address => mapping(uint256 => address)) public whitelistedRoutes;\r\n\r\n // Mapping of L1TokenAddress to the associated Pool information.\r\n struct PooledToken {\r\n address lpToken;\r\n bool isEnabled;\r\n uint32 lastLpFeeUpdate;\r\n int256 utilizedReserves;\r\n uint256 liquidReserves;\r\n uint256 undistributedLpFees;\r\n }\r\n\r\n mapping(address => PooledToken) public pooledTokens;\r\n\r\n struct CrossChainContract {\r\n AdapterInterface adapter;\r\n address spokePool;\r\n }\r\n\r\n mapping(uint256 => CrossChainContract) public crossChainContracts; // Mapping of chainId to the associated adapter and spokePool contracts.\r\n\r\n WETH9 public weth;\r\n\r\n LpTokenFactoryInterface public lpTokenFactory;\r\n\r\n FinderInterface public finder;\r\n\r\n // When bundles are disputed a price request is enqueued with the DVM to resolve the resolution.\r\n bytes32 public identifier = \"IS_ACROSS_V2_BUNDLE_VALID\";\r\n\r\n // Interest rate payment that scales the amount of pending fees per second paid to LPs. 0.0000015e18 will pay out\r\n // the full amount of fees entitled to LPs in ~ 7.72 days, just over the standard L2 7 day liveness.\r\n uint256 public lpFeeRatePerSecond = 1500000000000;\r\n\r\n mapping(address => uint256) public unclaimedAccumulatedProtocolFees;\r\n\r\n // Address that captures protocol fees. Accumulated protocol fees can be claimed by this address.\r\n address public protocolFeeCaptureAddress;\r\n\r\n // Percentage of lpFees that are captured by the protocol and claimable by the protocolFeeCaptureAddress.\r\n uint256 public protocolFeeCapturePct;\r\n\r\n // Token used to bond the data worker for proposing relayer refund bundles.\r\n IERC20 public bondToken;\r\n\r\n // The computed bond amount as the UMA Store's final fee multiplied by the bondTokenFinalFeeMultiplier.\r\n uint256 public bondAmount;\r\n\r\n // Each root bundle proposal must stay in liveness for this period of time before it can be considered finalized.\r\n // It can be disputed only during this period of time. Defaults to 2 hours, like the rest of the UMA ecosystem.\r\n uint64 public liveness = 7200;\r\n\r\n event ProtocolFeeCaptureSet(address indexed newProtocolFeeCaptureAddress, uint256 indexed newProtocolFeeCapturePct);\r\n\r\n event ProtocolFeesCapturedClaimed(address indexed l1Token, uint256 indexed accumulatedFees);\r\n\r\n event BondSet(address indexed newBondToken, uint256 newBondAmount);\r\n\r\n event LivenessSet(uint256 newLiveness);\r\n\r\n event IdentifierSet(bytes32 newIdentifier);\r\n\r\n event CrossChainContractsSet(uint256 l2ChainId, address adapter, address spokePool);\r\n\r\n event L1TokenEnabledForLiquidityProvision(address l1Token, address lpToken);\r\n\r\n event L2TokenDisabledForLiquidityProvision(address l1Token, address lpToken);\r\n\r\n event LiquidityAdded(\r\n address indexed l1Token,\r\n uint256 amount,\r\n uint256 lpTokensMinted,\r\n address indexed liquidityProvider\r\n );\r\n event LiquidityRemoved(\r\n address indexed l1Token,\r\n uint256 amount,\r\n uint256 lpTokensBurnt,\r\n address indexed liquidityProvider\r\n );\r\n event WhitelistRoute(\r\n uint256 originChainId,\r\n uint256 destinationChainId,\r\n address originToken,\r\n address destinationToken\r\n );\r\n\r\n event ProposeRootBundle(\r\n uint64 requestExpirationTimestamp,\r\n uint64 unclaimedPoolRebalanceLeafCount,\r\n uint256[] bundleEvaluationBlockNumbers,\r\n bytes32 indexed poolRebalanceRoot,\r\n bytes32 indexed relayerRefundRoot,\r\n bytes32 slowRelayFulfillmentRoot,\r\n address indexed proposer\r\n );\r\n event RootBundleExecuted(\r\n uint256 indexed leafId,\r\n uint256 indexed chainId,\r\n address[] l1Token,\r\n uint256[] bundleLpFees,\r\n int256[] netSendAmount,\r\n int256[] runningBalance,\r\n address indexed caller\r\n );\r\n event SpokePoolAdminFunctionTriggered(uint256 indexed chainId, bytes message);\r\n\r\n event RootBundleDisputed(address indexed disputer, uint256 requestTime, bytes disputedAncillaryData);\r\n\r\n modifier noActiveRequests() {\r\n require(rootBundleProposal.unclaimedPoolRebalanceLeafCount == 0, \"proposal has unclaimed leafs\");\r\n _;\r\n }\r\n\r\n constructor(\r\n LpTokenFactoryInterface _lpTokenFactory,\r\n FinderInterface _finder,\r\n WETH9 _weth,\r\n address _timer\r\n ) Testable(_timer) {\r\n lpTokenFactory = _lpTokenFactory;\r\n finder = _finder;\r\n weth = _weth;\r\n protocolFeeCaptureAddress = owner();\r\n }\r\n\r\n /*************************************************\r\n * ADMIN FUNCTIONS *\r\n *************************************************/\r\n\r\n // This function has permission to call onlyFromCrossChainAdmin functions on the SpokePool, so its imperative\r\n // that this contract only allows the owner to call this method directly or indirectly.\r\n function relaySpokePoolAdminFunction(uint256 chainId, bytes memory functionData) public onlyOwner nonReentrant {\r\n _relaySpokePoolAdminFunction(chainId, functionData);\r\n }\r\n\r\n function setProtocolFeeCapture(address newProtocolFeeCaptureAddress, uint256 newProtocolFeeCapturePct)\r\n public\r\n onlyOwner\r\n {\r\n require(newProtocolFeeCapturePct <= 1e18, \"Bad protocolFeeCapturePct\");\r\n protocolFeeCaptureAddress = newProtocolFeeCaptureAddress;\r\n protocolFeeCapturePct = newProtocolFeeCapturePct;\r\n emit ProtocolFeeCaptureSet(newProtocolFeeCaptureAddress, newProtocolFeeCapturePct);\r\n }\r\n\r\n function setBond(IERC20 newBondToken, uint256 newBondAmount) public onlyOwner noActiveRequests {\r\n // Check that this token is on the whitelist.\r\n AddressWhitelistInterface addressWhitelist = AddressWhitelistInterface(\r\n finder.getImplementationAddress(OracleInterfaces.CollateralWhitelist)\r\n );\r\n require(addressWhitelist.isOnWhitelist(address(newBondToken)), \"Not on whitelist\");\r\n\r\n // The bond should be the passed in bondAmount + the final fee.\r\n bondToken = newBondToken;\r\n bondAmount = newBondAmount + _getBondTokenFinalFee();\r\n emit BondSet(address(newBondToken), bondAmount);\r\n }\r\n\r\n function setLiveness(uint64 newLiveness) public onlyOwner {\r\n require(newLiveness > 10 minutes, \"Liveness too short\");\r\n liveness = newLiveness;\r\n emit LivenessSet(newLiveness);\r\n }\r\n\r\n function setIdentifier(bytes32 newIdentifier) public onlyOwner noActiveRequests {\r\n IdentifierWhitelistInterface identifierWhitelist = IdentifierWhitelistInterface(\r\n finder.getImplementationAddress(OracleInterfaces.IdentifierWhitelist)\r\n );\r\n require(identifierWhitelist.isIdentifierSupported(newIdentifier), \"Identifier not supported\");\r\n identifier = newIdentifier;\r\n emit IdentifierSet(newIdentifier);\r\n }\r\n\r\n function setCrossChainContracts(\r\n uint256 l2ChainId,\r\n address adapter,\r\n address spokePool\r\n ) public onlyOwner noActiveRequests {\r\n crossChainContracts[l2ChainId] = CrossChainContract(AdapterInterface(adapter), spokePool);\r\n emit CrossChainContractsSet(l2ChainId, adapter, spokePool);\r\n }\r\n\r\n /**\r\n * @notice Whitelist an origin token <-> destination token route.\r\n */\r\n function whitelistRoute(\r\n uint256 originChainId,\r\n uint256 destinationChainId,\r\n address originToken,\r\n address destinationToken\r\n ) public onlyOwner {\r\n whitelistedRoutes[originToken][destinationChainId] = destinationToken;\r\n\r\n // Whitelist the same route on the origin chain.\r\n _relaySpokePoolAdminFunction(\r\n originChainId,\r\n abi.encodeWithSignature(\"setEnableRoute(address,uint256,bool)\", originToken, destinationChainId, true)\r\n );\r\n emit WhitelistRoute(originChainId, destinationChainId, originToken, destinationToken);\r\n }\r\n\r\n function enableL1TokenForLiquidityProvision(address l1Token) public onlyOwner {\r\n // NOTE: if we run out of bytecode this logic could be refactored into a custom token factory that does the\r\n // appends and permission setting.\r\n if (pooledTokens[l1Token].lpToken == address(0))\r\n pooledTokens[l1Token].lpToken = lpTokenFactory.createLpToken(l1Token);\r\n\r\n pooledTokens[l1Token].isEnabled = true;\r\n pooledTokens[l1Token].lastLpFeeUpdate = uint32(getCurrentTime());\r\n\r\n emit L1TokenEnabledForLiquidityProvision(l1Token, pooledTokens[l1Token].lpToken);\r\n }\r\n\r\n function disableL1TokenForLiquidityProvision(address l1Token) public onlyOwner {\r\n pooledTokens[l1Token].isEnabled = false;\r\n emit L2TokenDisabledForLiquidityProvision(l1Token, pooledTokens[l1Token].lpToken);\r\n }\r\n\r\n /*************************************************\r\n * LIQUIDITY PROVIDER FUNCTIONS *\r\n *************************************************/\r\n\r\n function addLiquidity(address l1Token, uint256 l1TokenAmount) public payable {\r\n require(pooledTokens[l1Token].isEnabled, \"Token not enabled\");\r\n // If this is the weth pool and the caller sends msg.value then the msg.value must match the l1TokenAmount.\r\n // Else, msg.value must be set to 0.\r\n require(((address(weth) == l1Token) && msg.value == l1TokenAmount) || msg.value == 0, \"Bad msg.value\");\r\n\r\n // Since _exchangeRateCurrent() reads this contract's balance and updates contract state using it, it must be\r\n // first before transferring any tokens to this contract to ensure synchronization.\r\n uint256 lpTokensToMint = (l1TokenAmount * 1e18) / _exchangeRateCurrent(l1Token);\r\n ExpandedIERC20(pooledTokens[l1Token].lpToken).mint(msg.sender, lpTokensToMint);\r\n pooledTokens[l1Token].liquidReserves += l1TokenAmount;\r\n\r\n if (address(weth) == l1Token && msg.value > 0) WETH9(address(l1Token)).deposit{ value: msg.value }();\r\n else IERC20(l1Token).safeTransferFrom(msg.sender, address(this), l1TokenAmount);\r\n\r\n emit LiquidityAdded(l1Token, l1TokenAmount, lpTokensToMint, msg.sender);\r\n }\r\n\r\n function removeLiquidity(\r\n address l1Token,\r\n uint256 lpTokenAmount,\r\n bool sendEth\r\n ) public nonReentrant {\r\n require(address(weth) == l1Token || !sendEth, \"Cant send eth\");\r\n uint256 l1TokensToReturn = (lpTokenAmount * _exchangeRateCurrent(l1Token)) / 1e18;\r\n\r\n ExpandedIERC20(pooledTokens[l1Token].lpToken).burnFrom(msg.sender, lpTokenAmount);\r\n // Note this method does not make any liquidity utilization checks before letting the LP redeem their LP tokens.\r\n // If they try access more funds that available (i.e l1TokensToReturn > liquidReserves) this will underflow.\r\n pooledTokens[l1Token].liquidReserves -= l1TokensToReturn;\r\n\r\n if (sendEth) _unwrapWETHTo(payable(msg.sender), l1TokensToReturn);\r\n else IERC20(l1Token).safeTransfer(msg.sender, l1TokensToReturn);\r\n\r\n emit LiquidityRemoved(l1Token, l1TokensToReturn, lpTokenAmount, msg.sender);\r\n }\r\n\r\n function exchangeRateCurrent(address l1Token) public nonReentrant returns (uint256) {\r\n return _exchangeRateCurrent(l1Token);\r\n }\r\n\r\n function liquidityUtilizationCurrent(address l1Token) public nonReentrant returns (uint256) {\r\n return _liquidityUtilizationPostRelay(l1Token, 0);\r\n }\r\n\r\n function liquidityUtilizationPostRelay(address l1Token, uint256 relayedAmount)\r\n public\r\n nonReentrant\r\n returns (uint256)\r\n {\r\n return _liquidityUtilizationPostRelay(l1Token, relayedAmount);\r\n }\r\n\r\n function sync(address l1Token) public nonReentrant {\r\n _sync(l1Token);\r\n }\r\n\r\n /*************************************************\r\n * DATA WORKER FUNCTIONS *\r\n *************************************************/\r\n\r\n // After proposeRootBundle is called, if the any props are wrong then this proposal can be challenged. Once the\r\n // challenge period passes, then the roots are no longer disputable, and only executeRootBundle can be called and\r\n // this can't be called again until all leafs are executed.\r\n function proposeRootBundle(\r\n uint256[] memory bundleEvaluationBlockNumbers,\r\n uint8 poolRebalanceLeafCount,\r\n bytes32 poolRebalanceRoot,\r\n bytes32 relayerRefundRoot,\r\n bytes32 slowRelayFulfillmentRoot\r\n ) public override nonReentrant noActiveRequests {\r\n require(poolRebalanceLeafCount > 0, \"Bundle must have at least 1 leaf\");\r\n\r\n uint64 requestExpirationTimestamp = uint64(getCurrentTime() + liveness);\r\n\r\n delete rootBundleProposal; // Only one bundle of roots can be executed at a time.\r\n\r\n rootBundleProposal.requestExpirationTimestamp = requestExpirationTimestamp;\r\n rootBundleProposal.unclaimedPoolRebalanceLeafCount = poolRebalanceLeafCount;\r\n rootBundleProposal.poolRebalanceRoot = poolRebalanceRoot;\r\n rootBundleProposal.relayerRefundRoot = relayerRefundRoot;\r\n rootBundleProposal.slowRelayFulfillmentRoot = slowRelayFulfillmentRoot;\r\n rootBundleProposal.proposer = msg.sender;\r\n\r\n // Pull bondAmount of bondToken from the caller.\r\n bondToken.safeTransferFrom(msg.sender, address(this), bondAmount);\r\n\r\n emit ProposeRootBundle(\r\n requestExpirationTimestamp,\r\n poolRebalanceLeafCount,\r\n bundleEvaluationBlockNumbers,\r\n poolRebalanceRoot,\r\n relayerRefundRoot,\r\n slowRelayFulfillmentRoot,\r\n msg.sender\r\n );\r\n }\r\n\r\n function executeRootBundle(PoolRebalanceLeaf memory poolRebalanceLeaf, bytes32[] memory proof) public nonReentrant {\r\n require(getCurrentTime() >= rootBundleProposal.requestExpirationTimestamp, \"Not passed liveness\");\r\n\r\n // Verify the leafId in the poolRebalanceLeaf has not yet been claimed.\r\n require(!MerkleLib.isClaimed1D(rootBundleProposal.claimedBitMap, poolRebalanceLeaf.leafId), \"Already claimed\");\r\n\r\n // Verify the props provided generate a leaf that, along with the proof, are included in the merkle root.\r\n require(\r\n MerkleLib.verifyPoolRebalance(rootBundleProposal.poolRebalanceRoot, poolRebalanceLeaf, proof),\r\n \"Bad Proof\"\r\n );\r\n\r\n // Set the leafId in the claimed bitmap.\r\n rootBundleProposal.claimedBitMap = MerkleLib.setClaimed1D(\r\n rootBundleProposal.claimedBitMap,\r\n poolRebalanceLeaf.leafId\r\n );\r\n\r\n // Decrement the unclaimedPoolRebalanceLeafCount.\r\n rootBundleProposal.unclaimedPoolRebalanceLeafCount--;\r\n\r\n _sendTokensToChainAndUpdatePooledTokenTrackers(\r\n poolRebalanceLeaf.chainId,\r\n poolRebalanceLeaf.l1Tokens,\r\n poolRebalanceLeaf.netSendAmounts,\r\n poolRebalanceLeaf.bundleLpFees\r\n );\r\n _relayRootBundleToSpokePool(poolRebalanceLeaf.chainId);\r\n\r\n // Transfer the bondAmount to back to the proposer, if this the last executed leaf. Only sending this once all\r\n // leafs have been executed acts to force the data worker to execute all bundles or they wont receive their bond.\r\n if (rootBundleProposal.unclaimedPoolRebalanceLeafCount == 0)\r\n bondToken.safeTransfer(rootBundleProposal.proposer, bondAmount);\r\n\r\n emit RootBundleExecuted(\r\n poolRebalanceLeaf.leafId,\r\n poolRebalanceLeaf.chainId,\r\n poolRebalanceLeaf.l1Tokens,\r\n poolRebalanceLeaf.bundleLpFees,\r\n poolRebalanceLeaf.netSendAmounts,\r\n poolRebalanceLeaf.runningBalances,\r\n msg.sender\r\n );\r\n }\r\n\r\n function disputeRootBundle() public nonReentrant {\r\n require(getCurrentTime() <= rootBundleProposal.requestExpirationTimestamp, \"Request passed liveness\");\r\n\r\n // Request price from OO and dispute it.\r\n uint256 totalBond = bondAmount;\r\n bytes memory requestAncillaryData = getRootBundleProposalAncillaryData();\r\n bondToken.safeTransferFrom(msg.sender, address(this), totalBond);\r\n // This contract needs to approve totalBond*2 against the OO contract. (for the price request and dispute).\r\n bondToken.safeApprove(address(_getOptimisticOracle()), totalBond * 2);\r\n _getOptimisticOracle().requestAndProposePriceFor(\r\n identifier,\r\n uint32(getCurrentTime()),\r\n requestAncillaryData,\r\n bondToken,\r\n // Set reward to 0, since we'll settle proposer reward payouts directly from this contract after a root\r\n // proposal has passed the challenge period.\r\n 0,\r\n // Set the Optimistic oracle proposer bond for the price request.\r\n bondAmount - _getBondTokenFinalFee(),\r\n // Set the Optimistic oracle liveness for the price request.\r\n liveness,\r\n rootBundleProposal.proposer,\r\n // Canonical value representing \"True\"; i.e. the proposed relay is valid.\r\n int256(1e18)\r\n );\r\n\r\n // Dispute the request that we just sent.\r\n SkinnyOptimisticOracleInterface.Request memory ooPriceRequest = SkinnyOptimisticOracleInterface.Request({\r\n proposer: rootBundleProposal.proposer,\r\n disputer: address(0),\r\n currency: bondToken,\r\n settled: false,\r\n proposedPrice: int256(1e18),\r\n resolvedPrice: 0,\r\n expirationTime: getCurrentTime() + liveness,\r\n reward: 0,\r\n finalFee: _getBondTokenFinalFee(),\r\n bond: bondAmount - _getBondTokenFinalFee(),\r\n customLiveness: liveness\r\n });\r\n\r\n _getOptimisticOracle().disputePriceFor(\r\n identifier,\r\n uint32(getCurrentTime()),\r\n requestAncillaryData,\r\n ooPriceRequest,\r\n msg.sender,\r\n address(this)\r\n );\r\n\r\n emit RootBundleDisputed(msg.sender, getCurrentTime(), requestAncillaryData);\r\n\r\n // Finally, delete the state pertaining to the active proposal so that another proposer can submit a new\r\n // bundle of roots.\r\n delete rootBundleProposal;\r\n }\r\n\r\n function claimProtocolFeesCaptured(address l1Token) public nonReentrant {\r\n IERC20(l1Token).safeTransfer(protocolFeeCaptureAddress, unclaimedAccumulatedProtocolFees[l1Token]);\r\n emit ProtocolFeesCapturedClaimed(l1Token, unclaimedAccumulatedProtocolFees[l1Token]);\r\n unclaimedAccumulatedProtocolFees[l1Token] = 0;\r\n }\r\n\r\n function getRootBundleProposalAncillaryData() public view returns (bytes memory ancillaryData) {\r\n ancillaryData = AncillaryData.appendKeyValueUint(\r\n \"\",\r\n \"requestExpirationTimestamp\",\r\n rootBundleProposal.requestExpirationTimestamp\r\n );\r\n\r\n ancillaryData = AncillaryData.appendKeyValueUint(\r\n ancillaryData,\r\n \"unclaimedPoolRebalanceLeafCount\",\r\n rootBundleProposal.unclaimedPoolRebalanceLeafCount\r\n );\r\n ancillaryData = AncillaryData.appendKeyValueBytes32(\r\n ancillaryData,\r\n \"poolRebalanceRoot\",\r\n rootBundleProposal.poolRebalanceRoot\r\n );\r\n ancillaryData = AncillaryData.appendKeyValueBytes32(\r\n ancillaryData,\r\n \"relayerRefundRoot\",\r\n rootBundleProposal.relayerRefundRoot\r\n );\r\n ancillaryData = AncillaryData.appendKeyValueBytes32(\r\n ancillaryData,\r\n \"slowRelayFulfillmentRoot\",\r\n rootBundleProposal.slowRelayFulfillmentRoot\r\n );\r\n ancillaryData = AncillaryData.appendKeyValueUint(\r\n ancillaryData,\r\n \"claimedBitMap\",\r\n rootBundleProposal.claimedBitMap\r\n );\r\n ancillaryData = AncillaryData.appendKeyValueAddress(ancillaryData, \"proposer\", rootBundleProposal.proposer);\r\n }\r\n\r\n /*************************************************\r\n * INTERNAL FUNCTIONS *\r\n *************************************************/\r\n\r\n // Unwraps ETH and does a transfer to a recipient address. If the recipient is a smart contract then sends WETH.\r\n function _unwrapWETHTo(address payable to, uint256 amount) internal {\r\n if (address(to).isContract()) {\r\n IERC20(address(weth)).safeTransfer(to, amount);\r\n } else {\r\n weth.withdraw(amount);\r\n to.transfer(amount);\r\n }\r\n }\r\n\r\n function _append(\r\n string memory a,\r\n string memory b,\r\n string memory c\r\n ) internal pure returns (string memory) {\r\n return string(abi.encodePacked(a, b, c));\r\n }\r\n\r\n function _getOptimisticOracle() internal view returns (SkinnyOptimisticOracleInterface) {\r\n return\r\n SkinnyOptimisticOracleInterface(finder.getImplementationAddress(OracleInterfaces.SkinnyOptimisticOracle));\r\n }\r\n\r\n function _getBondTokenFinalFee() internal view returns (uint256) {\r\n return\r\n StoreInterface(finder.getImplementationAddress(OracleInterfaces.Store))\r\n .computeFinalFee(address(bondToken))\r\n .rawValue;\r\n }\r\n\r\n // Note this method does a lot and wraps together the sending of tokens and updating the pooled token trackers. This\r\n // is done as a gas saving so we don't need to iterate over the l1Tokens multiple times (can do both in one loop).\r\n function _sendTokensToChainAndUpdatePooledTokenTrackers(\r\n uint256 chainId,\r\n address[] memory l1Tokens,\r\n int256[] memory netSendAmounts,\r\n uint256[] memory bundleLpFees\r\n ) internal {\r\n AdapterInterface adapter = crossChainContracts[chainId].adapter;\r\n\r\n for (uint32 i = 0; i < l1Tokens.length; i++) {\r\n // Validate the L1 -> L2 token route is whitelisted. If it is not then the output of the bridging action\r\n // could send tokens to the 0x0 address on the L2.\r\n require(whitelistedRoutes[l1Tokens[i]][chainId] != address(0), \"Route not whitelisted\");\r\n\r\n // If the net send amount for this token is positive then: 1) send tokens from L1->L2 to facilitate the L2\r\n // relayer refund, 2) Update the liquidity trackers for the associated pooled tokens.\r\n if (netSendAmounts[i] > 0) {\r\n IERC20(l1Tokens[i]).safeTransfer(address(adapter), uint256(netSendAmounts[i]));\r\n adapter.relayTokens(\r\n l1Tokens[i], // l1Token.\r\n whitelistedRoutes[l1Tokens[i]][chainId], // l2Token.\r\n uint256(netSendAmounts[i]), // amount.\r\n crossChainContracts[chainId].spokePool // to. This should be the spokePool.\r\n );\r\n\r\n // Liquid reserves is decreased by the amount sent. utilizedReserves is increased by the amount sent.\r\n pooledTokens[l1Tokens[i]].utilizedReserves += netSendAmounts[i];\r\n pooledTokens[l1Tokens[i]].liquidReserves -= uint256(netSendAmounts[i]);\r\n }\r\n\r\n // Allocate LP fees and protocol fees from the bundle to the associated pooled token trackers.\r\n _allocateLpAndProtocolFees(l1Tokens[i], bundleLpFees[i]);\r\n }\r\n }\r\n\r\n function _relayRootBundleToSpokePool(uint256 chainId) internal {\r\n AdapterInterface adapter = crossChainContracts[chainId].adapter;\r\n adapter.relayMessage(\r\n crossChainContracts[chainId].spokePool, // target. This should be the spokePool on the L2.\r\n abi.encodeWithSignature(\r\n \"relayRootBundle(bytes32,bytes32)\",\r\n rootBundleProposal.relayerRefundRoot,\r\n rootBundleProposal.slowRelayFulfillmentRoot\r\n ) // message\r\n );\r\n }\r\n\r\n function _exchangeRateCurrent(address l1Token) internal returns (uint256) {\r\n PooledToken storage pooledToken = pooledTokens[l1Token]; // Note this is storage so the state can be modified.\r\n uint256 lpTokenTotalSupply = IERC20(pooledToken.lpToken).totalSupply();\r\n if (lpTokenTotalSupply == 0) return 1e18; // initial rate is 1:1 between LP tokens and collateral.\r\n\r\n // First, update fee counters and local accounting of finalized transfers from L2 -> L1.\r\n _updateAccumulatedLpFees(pooledToken); // Accumulate all allocated fees from the last time this method was called.\r\n _sync(l1Token); // Fetch any balance changes due to token bridging finalization and factor them in.\r\n\r\n // ExchangeRate := (liquidReserves + utilizedReserves - undistributedLpFees) / lpTokenSupply\r\n // Both utilizedReserves and undistributedLpFees contain assigned LP fees. UndistributedLpFees is gradually\r\n // decreased over the smear duration using _updateAccumulatedLpFees. This means that the exchange rate will\r\n // gradually increase over time as undistributedLpFees goes to zero.\r\n // utilizedReserves can be negative. If this is the case, then liquidReserves is offset by an equal\r\n // and opposite size. LiquidReserves + utilizedReserves will always be larger than undistributedLpFees so this\r\n // int will always be positive so there is no risk in underflow in type casting in the return line.\r\n int256 numerator = int256(pooledToken.liquidReserves) +\r\n pooledToken.utilizedReserves -\r\n int256(pooledToken.undistributedLpFees);\r\n return (uint256(numerator) * 1e18) / lpTokenTotalSupply;\r\n }\r\n\r\n // Update internal fee counters by adding in any accumulated fees from the last time this logic was called.\r\n function _updateAccumulatedLpFees(PooledToken storage pooledToken) internal {\r\n uint256 accumulatedFees = _getAccumulatedFees(pooledToken.undistributedLpFees, pooledToken.lastLpFeeUpdate);\r\n pooledToken.undistributedLpFees -= accumulatedFees;\r\n pooledToken.lastLpFeeUpdate = uint32(getCurrentTime());\r\n }\r\n\r\n // Calculate the unallocated accumulatedFees from the last time the contract was called.\r\n function _getAccumulatedFees(uint256 undistributedLpFees, uint256 lastLpFeeUpdate) internal view returns (uint256) {\r\n // accumulatedFees := min(undistributedLpFees * lpFeeRatePerSecond * timeFromLastInteraction ,undistributedLpFees)\r\n // The min acts to pay out all fees in the case the equation returns more than the remaining a fees.\r\n uint256 timeFromLastInteraction = getCurrentTime() - lastLpFeeUpdate;\r\n uint256 maxUndistributedLpFees = (undistributedLpFees * lpFeeRatePerSecond * timeFromLastInteraction) / (1e18);\r\n return maxUndistributedLpFees < undistributedLpFees ? maxUndistributedLpFees : undistributedLpFees;\r\n }\r\n\r\n function _sync(address l1Token) internal {\r\n // Check if the l1Token balance of the contract is greater than the liquidReserves. If it is then the bridging\r\n // action from L2 -> L1 has concluded and the local accounting can be updated.\r\n uint256 l1TokenBalance = IERC20(l1Token).balanceOf(address(this));\r\n if (l1TokenBalance > pooledTokens[l1Token].liquidReserves) {\r\n // Note the numerical operation below can send utilizedReserves to negative. This can occur when tokens are\r\n // dropped onto the contract, exceeding the liquidReserves.\r\n pooledTokens[l1Token].utilizedReserves -= int256(l1TokenBalance - pooledTokens[l1Token].liquidReserves);\r\n pooledTokens[l1Token].liquidReserves = l1TokenBalance;\r\n }\r\n }\r\n\r\n function _liquidityUtilizationPostRelay(address l1Token, uint256 relayedAmount) internal returns (uint256) {\r\n _sync(l1Token); // Fetch any balance changes due to token bridging finalization and factor them in.\r\n\r\n // liquidityUtilizationRatio := (relayedAmount + max(utilizedReserves,0)) / (liquidReserves + max(utilizedReserves,0))\r\n // UtilizedReserves has a dual meaning: if it's greater than zero then it represents funds pending in the bridge\r\n // that will flow from L2 to L1. In this case, we can use it normally in the equation. However, if it is\r\n // negative, then it is already counted in liquidReserves. This occurs if tokens are transferred directly to the\r\n // contract. In this case, ignore it as it is captured in liquid reserves and has no meaning in the numerator.\r\n PooledToken memory pooledToken = pooledTokens[l1Token]; // Note this is storage so the state can be modified.\r\n uint256 flooredUtilizedReserves = pooledToken.utilizedReserves > 0 ? uint256(pooledToken.utilizedReserves) : 0;\r\n uint256 numerator = relayedAmount + flooredUtilizedReserves;\r\n uint256 denominator = pooledToken.liquidReserves + flooredUtilizedReserves;\r\n\r\n // If the denominator equals zero, return 1e18 (max utilization).\r\n if (denominator == 0) return 1e18;\r\n\r\n // In all other cases, return the utilization ratio.\r\n return (numerator * 1e18) / denominator;\r\n }\r\n\r\n function _allocateLpAndProtocolFees(address l1Token, uint256 bundleLpFees) internal {\r\n // Calculate the fraction of bundledLpFees that are allocated to the protocol and to the LPs.\r\n uint256 protocolFeesCaptured = (bundleLpFees * protocolFeeCapturePct) / 1e18;\r\n uint256 lpFeesCaptured = bundleLpFees - protocolFeesCaptured;\r\n\r\n // Assign any LP fees included into the bundle to the pooled token. These LP fees are tracked in the\r\n // undistributedLpFees and within the utilizedReserves. undistributedLpFees is gradually decrease\r\n // over the smear duration to give the LPs their rewards over a period of time. Adding to utilizedReserves\r\n // acts to track these rewards after the smear duration. See _exchangeRateCurrent for more details.\r\n if (lpFeesCaptured > 0) {\r\n pooledTokens[l1Token].undistributedLpFees += lpFeesCaptured;\r\n pooledTokens[l1Token].utilizedReserves += int256(lpFeesCaptured);\r\n }\r\n\r\n // If there are any protocol fees, allocate them to the unclaimed protocol tracker amount.\r\n if (protocolFeesCaptured > 0) unclaimedAccumulatedProtocolFees[l1Token] += protocolFeesCaptured;\r\n }\r\n\r\n function _relaySpokePoolAdminFunction(uint256 chainId, bytes memory functionData) internal {\r\n AdapterInterface adapter = crossChainContracts[chainId].adapter;\r\n adapter.relayMessage(\r\n crossChainContracts[chainId].spokePool, // target. This should be the spokePool on the L2.\r\n functionData\r\n );\r\n emit SpokePoolAdminFunctionTriggered(chainId, functionData);\r\n }\r\n\r\n // If functionCallStackOriginatesFromOutsideThisContract is true then this was called by the callback function\r\n // by dropping ETH onto the contract. In this case, deposit the ETH into WETH. This would happen if ETH was sent\r\n // over the optimism bridge, for example. If false then this was set as a result of unwinding LP tokens, with the\r\n // intention of sending ETH to the LP. In this case, do nothing as we intend on sending the ETH to the LP.\r\n function depositEthToWeth() public payable {\r\n if (functionCallStackOriginatesFromOutsideThisContract()) weth.deposit{ value: address(this).balance }();\r\n }\r\n\r\n // Added to enable the HubPool to receive ETH. This will occur both when the HubPool unwraps WETH to send to LPs and\r\n // when ETH is send over the canonical Optimism bridge, which sends ETH.\r\n fallback() external payable {\r\n depositEthToWeth();\r\n }\r\n\r\n receive() external payable {\r\n depositEthToWeth();\r\n }\r\n}\r\n" + "content": "// SPDX-License-Identifier: GPL-3.0-only\npragma solidity ^0.8.0;\n\nimport \"./MerkleLib.sol\";\nimport \"./HubPoolInterface.sol\";\nimport \"./Lockable.sol\";\n\nimport \"./interfaces/LpTokenFactoryInterface.sol\";\nimport \"./interfaces/WETH9.sol\";\n\nimport \"@uma/core/contracts/common/implementation/Testable.sol\";\nimport \"@uma/core/contracts/common/implementation/MultiCaller.sol\";\nimport \"@uma/core/contracts/oracle/implementation/Constants.sol\";\nimport \"@uma/core/contracts/common/implementation/AncillaryData.sol\";\nimport \"@uma/core/contracts/common/interfaces/AddressWhitelistInterface.sol\";\nimport \"@uma/core/contracts/oracle/interfaces/IdentifierWhitelistInterface.sol\";\n\nimport \"@uma/core/contracts/oracle/interfaces/FinderInterface.sol\";\nimport \"@uma/core/contracts/oracle/interfaces/StoreInterface.sol\";\nimport \"@uma/core/contracts/oracle/interfaces/SkinnyOptimisticOracleInterface.sol\";\nimport \"@uma/core/contracts/common/interfaces/ExpandedIERC20.sol\";\n\nimport \"@openzeppelin/contracts/access/Ownable.sol\";\nimport \"@openzeppelin/contracts/token/ERC20/IERC20.sol\";\nimport \"@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol\";\nimport \"@openzeppelin/contracts/utils/Address.sol\";\n\n/**\n * @notice Contract deployed on Ethereum that houses L1 token liquidity for all SpokePools. A dataworker can interact\n * with merkle roots stored in this contract via inclusion proofs to instruct this contract to send tokens to L2\n * SpokePools via \"pool rebalances\" that can be used to pay out relayers on those networks. This contract is also\n * responsible for publishing relayer refund and slow relay merkle roots to SpokePools.\n * @notice This contract is meant to act as the cross chain administrator and owner of all L2 spoke pools, so all\n * governance actions and pool rebalances originate from here and bridge instructions to L2s.\n * @dev This contract should be deprecated by the year 2106, at which point uint32 timestamps will roll over. This is\n * an issue for this contract because fee calculations will become bizarre when multiplying by negative time deltas.\n * Before this date, this contract should be paused from accepting new root bundles and all LP tokens should be\n * disabled by the admin.\n */\ncontract HubPool is HubPoolInterface, Testable, Lockable, MultiCaller, Ownable {\n using SafeERC20 for IERC20;\n using Address for address;\n\n // Only one root bundle can be stored at a time. Once all pool rebalance leaves are executed, a new proposal\n // can be submitted.\n RootBundle public rootBundleProposal;\n\n // Whether the bundle proposal process is paused.\n bool public paused;\n\n // Stores paths from L1 token + destination ID to destination token. Since different tokens on L1 might map to\n // to the same address on different destinations, we hash (L1 token address, destination ID) to\n // use as a key that maps to a destination token. This mapping is used to direct pool rebalances from\n // HubPool to SpokePool, and also is designed to be used as a lookup for off-chain data workers to determine\n // which L1 tokens to relay to SpokePools to refund relayers. The admin can set the \"destination token\"\n // to 0x0 to disable a pool rebalance route and block executeRootBundle() from executing.\n mapping(bytes32 => address) private poolRebalanceRoutes;\n\n // Mapping of L1 token addresses to the associated pool information.\n mapping(address => PooledToken) public pooledTokens;\n\n // Mapping of chainId to the associated adapter and spokePool contracts.\n mapping(uint256 => CrossChainContract) public crossChainContracts;\n\n // WETH contract for Ethereum.\n WETH9 public immutable weth;\n\n // Helper factory to deploy new LP tokens for enabled L1 tokens\n LpTokenFactoryInterface public immutable lpTokenFactory;\n\n // Finder contract for this network.\n FinderInterface public immutable finder;\n\n // When root bundles are disputed a price request is enqueued with the DVM to resolve the resolution.\n bytes32 public identifier = \"IS_ACROSS_V2_BUNDLE_VALID\";\n\n // Interest rate payment that scales the amount of pending fees per second paid to LPs. 0.0000015e18 will pay out\n // the full amount of fees entitled to LPs in ~ 7.72 days, just over the standard L2 7 day liveness.\n uint256 public lpFeeRatePerSecond = 1500000000000;\n\n // Mapping of l1TokenAddress to cumulative unclaimed protocol tokens that can be sent to the protocolFeeCaptureAddress\n // at any time. This enables the protocol to reallocate some percentage of LP fees elsewhere.\n mapping(address => uint256) public unclaimedAccumulatedProtocolFees;\n\n // Address that captures protocol fees. Accumulated protocol fees can be claimed by this address.\n address public protocolFeeCaptureAddress;\n\n // Percentage of lpFees that are captured by the protocol and claimable by the protocolFeeCaptureAddress.\n uint256 public protocolFeeCapturePct;\n\n // Token used to bond the data worker for proposing relayer refund bundles.\n IERC20 public bondToken;\n\n // The computed bond amount as the UMA Store's final fee multiplied by the bondTokenFinalFeeMultiplier.\n uint256 public bondAmount;\n\n // Each root bundle proposal must stay in liveness for this period of time before it can be considered finalized.\n // It can be disputed only during this period of time. Defaults to 2 hours, like the rest of the UMA ecosystem.\n uint32 public liveness = 7200;\n\n event Paused(bool indexed isPaused);\n\n event EmergencyRootBundleDeleted(\n bytes32 indexed poolRebalanceRoot,\n bytes32 indexed relayerRefundRoot,\n bytes32 slowRelayRoot,\n address indexed proposer\n );\n\n event ProtocolFeeCaptureSet(address indexed newProtocolFeeCaptureAddress, uint256 indexed newProtocolFeeCapturePct);\n\n event ProtocolFeesCapturedClaimed(address indexed l1Token, uint256 indexed accumulatedFees);\n\n event BondSet(address indexed newBondToken, uint256 newBondAmount);\n\n event LivenessSet(uint256 newLiveness);\n\n event IdentifierSet(bytes32 newIdentifier);\n\n event CrossChainContractsSet(uint256 l2ChainId, address adapter, address spokePool);\n\n event L1TokenEnabledForLiquidityProvision(address l1Token, address lpToken);\n\n event L2TokenDisabledForLiquidityProvision(address l1Token, address lpToken);\n\n event LiquidityAdded(\n address indexed l1Token,\n uint256 amount,\n uint256 lpTokensMinted,\n address indexed liquidityProvider\n );\n event LiquidityRemoved(\n address indexed l1Token,\n uint256 amount,\n uint256 lpTokensBurnt,\n address indexed liquidityProvider\n );\n event SetPoolRebalanceRoute(\n uint256 indexed destinationChainId,\n address indexed l1Token,\n address indexed destinationToken\n );\n event SetEnableDepositRoute(\n uint256 indexed originChainId,\n uint256 indexed destinationChainId,\n address indexed originToken,\n bool depositsEnabled\n );\n event ProposeRootBundle(\n uint32 requestExpirationTimestamp,\n uint64 unclaimedPoolRebalanceLeafCount,\n uint256[] bundleEvaluationBlockNumbers,\n bytes32 indexed poolRebalanceRoot,\n bytes32 indexed relayerRefundRoot,\n bytes32 slowRelayRoot,\n address indexed proposer\n );\n event RootBundleExecuted(\n uint256 groupIndex,\n uint256 indexed leafId,\n uint256 indexed chainId,\n address[] l1Token,\n uint256[] bundleLpFees,\n int256[] netSendAmount,\n int256[] runningBalance,\n address indexed caller\n );\n event SpokePoolAdminFunctionTriggered(uint256 indexed chainId, bytes message);\n\n event RootBundleDisputed(address indexed disputer, uint256 requestTime);\n\n event RootBundleCanceled(address indexed disputer, uint256 requestTime);\n\n modifier noActiveRequests() {\n require(!_activeRequest(), \"Proposal has unclaimed leaves\");\n _;\n }\n\n modifier unpaused() {\n require(!paused, \"Proposal process has been paused\");\n _;\n }\n\n modifier zeroOptimisticOracleApproval() {\n _;\n bondToken.safeApprove(address(_getOptimisticOracle()), 0);\n }\n\n /**\n * @notice Construct HubPool.\n * @param _lpTokenFactory LP Token factory address used to deploy LP tokens for new collateral types.\n * @param _finder Finder address.\n * @param _weth WETH address.\n * @param _timer Timer address.\n */\n constructor(\n LpTokenFactoryInterface _lpTokenFactory,\n FinderInterface _finder,\n WETH9 _weth,\n address _timer\n ) Testable(_timer) {\n lpTokenFactory = _lpTokenFactory;\n finder = _finder;\n weth = _weth;\n protocolFeeCaptureAddress = owner();\n }\n\n /*************************************************\n * ADMIN FUNCTIONS *\n *************************************************/\n\n /**\n * @notice Pauses the bundle proposal and execution process. This is intended to be used during upgrades or when\n * something goes awry.\n * @param pause true if the call is meant to pause the system, false if the call is meant to unpause it.\n */\n function setPaused(bool pause) public onlyOwner nonReentrant {\n paused = pause;\n emit Paused(pause);\n }\n\n /**\n * @notice This allows for the deletion of the active proposal in case of emergency.\n * @dev This is primarily intended to rectify situations where an unexecutable bundle gets through liveness in the\n * case of a non-malicious bug in the proposal/dispute code. Without this function, the contract would be\n * indefinitely blocked, migration would be required, and in-progress transfers would never be repaid.\n */\n function emergencyDeleteProposal() public onlyOwner nonReentrant {\n if (rootBundleProposal.unclaimedPoolRebalanceLeafCount > 0)\n bondToken.safeTransfer(rootBundleProposal.proposer, bondAmount);\n emit EmergencyRootBundleDeleted(\n rootBundleProposal.poolRebalanceRoot,\n rootBundleProposal.relayerRefundRoot,\n rootBundleProposal.slowRelayRoot,\n rootBundleProposal.proposer\n );\n delete rootBundleProposal;\n }\n\n /**\n * @notice Sends message to SpokePool from this contract. Callable only by owner.\n * @dev This function has permission to call onlyAdmin functions on the SpokePool, so it's imperative that this\n * contract only allows the owner to call this method directly or indirectly.\n * @param chainId Chain with SpokePool to send message to.\n * @param functionData ABI encoded function call to send to SpokePool, but can be any arbitrary data technically.\n */\n function relaySpokePoolAdminFunction(uint256 chainId, bytes memory functionData)\n public\n override\n onlyOwner\n nonReentrant\n {\n _relaySpokePoolAdminFunction(chainId, functionData);\n }\n\n /**\n * @notice Sets protocolFeeCaptureAddress and protocolFeeCapturePct. Callable only by owner.\n * @param newProtocolFeeCaptureAddress New protocol fee capture address.\n * @param newProtocolFeeCapturePct New protocol fee capture %.\n */\n function setProtocolFeeCapture(address newProtocolFeeCaptureAddress, uint256 newProtocolFeeCapturePct)\n public\n override\n onlyOwner\n nonReentrant\n {\n require(newProtocolFeeCapturePct <= 1e18, \"Bad protocolFeeCapturePct\");\n require(newProtocolFeeCaptureAddress != address(0), \"Bad protocolFeeCaptureAddress\");\n protocolFeeCaptureAddress = newProtocolFeeCaptureAddress;\n protocolFeeCapturePct = newProtocolFeeCapturePct;\n emit ProtocolFeeCaptureSet(newProtocolFeeCaptureAddress, newProtocolFeeCapturePct);\n }\n\n /**\n * @notice Sets bond token and amount. Callable only by owner.\n * @param newBondToken New bond currency.\n * @param newBondAmount New bond amount.\n */\n function setBond(IERC20 newBondToken, uint256 newBondAmount)\n public\n override\n onlyOwner\n noActiveRequests\n nonReentrant\n {\n // Bond should not be great than final fee otherwise every proposal will get cancelled in a dispute.\n // In practice we expect that bond amounts are set >> final fees so this shouldn't be an inconvenience.\n // The only way for the bond amount to be equal to the final fee is if the newBondAmount == 0.\n require(newBondAmount != 0, \"bond equal to final fee\");\n\n // Check that this token is on the whitelist.\n AddressWhitelistInterface addressWhitelist = AddressWhitelistInterface(\n finder.getImplementationAddress(OracleInterfaces.CollateralWhitelist)\n );\n require(addressWhitelist.isOnWhitelist(address(newBondToken)), \"Not on whitelist\");\n\n // The bond should be the passed in bondAmount + the final fee.\n bondToken = newBondToken;\n bondAmount = newBondAmount + _getBondTokenFinalFee();\n emit BondSet(address(newBondToken), bondAmount);\n }\n\n /**\n * @notice Sets root bundle proposal liveness period. Callable only by owner.\n * @param newLiveness New liveness period.\n */\n function setLiveness(uint32 newLiveness) public override onlyOwner nonReentrant {\n require(newLiveness > 10 minutes, \"Liveness too short\");\n liveness = newLiveness;\n emit LivenessSet(newLiveness);\n }\n\n /**\n * @notice Sets identifier for root bundle disputes. Callable only by owner.\n * @param newIdentifier New identifier.\n */\n function setIdentifier(bytes32 newIdentifier) public override onlyOwner noActiveRequests nonReentrant {\n IdentifierWhitelistInterface identifierWhitelist = IdentifierWhitelistInterface(\n finder.getImplementationAddress(OracleInterfaces.IdentifierWhitelist)\n );\n require(identifierWhitelist.isIdentifierSupported(newIdentifier), \"Identifier not supported\");\n identifier = newIdentifier;\n emit IdentifierSet(newIdentifier);\n }\n\n /**\n * @notice Sets cross chain relay helper contracts for L2 chain ID. Callable only by owner.\n * @dev We do not block setting the adapter or SpokePool to invalid/zero addresses because we want to allow the\n * admin to block relaying roots to the spoke pool for emergency recovery purposes.\n * @param l2ChainId Chain to set contracts for.\n * @param adapter Adapter used to relay messages and tokens to spoke pool. Deployed on current chain.\n * @param spokePool Recipient of relayed messages and tokens on spoke pool. Deployed on l2ChainId.\n */\n\n function setCrossChainContracts(\n uint256 l2ChainId,\n address adapter,\n address spokePool\n ) public override onlyOwner nonReentrant {\n crossChainContracts[l2ChainId] = CrossChainContract(adapter, spokePool);\n emit CrossChainContractsSet(l2ChainId, adapter, spokePool);\n }\n\n /**\n * @notice Store canonical destination token counterpart for l1 token. Callable only by owner.\n * @dev Admin can set destinationToken to 0x0 to effectively disable executing any root bundles with leaves\n * containing this l1 token + destination chain ID combination.\n * @param destinationChainId Destination chain where destination token resides.\n * @param l1Token Token enabled for liquidity in this pool, and the L1 counterpart to the destination token on the\n * destination chain ID.\n * @param destinationToken Destination chain counterpart of L1 token.\n */\n function setPoolRebalanceRoute(\n uint256 destinationChainId,\n address l1Token,\n address destinationToken\n ) public override onlyOwner nonReentrant {\n poolRebalanceRoutes[_poolRebalanceRouteKey(l1Token, destinationChainId)] = destinationToken;\n emit SetPoolRebalanceRoute(destinationChainId, l1Token, destinationToken);\n }\n\n /**\n * @notice Sends cross-chain message to SpokePool on originChainId to enable or disable deposit route from that\n * SpokePool to another one. Callable only by owner.\n * @dev Admin is responsible for ensuring that `originToken` is linked to some L1 token on this contract, via\n * poolRebalanceRoutes(), and that this L1 token also has a counterpart on the destination chain. If either\n * condition fails, then the deposit will be unrelayable by off-chain relayers because they will not know which\n * token to relay to recipients on the destination chain, and data workers wouldn't know which L1 token to send\n * to the destination chain to refund the relayer.\n * @param originChainId Chain where token deposit occurs.\n * @param destinationChainId Chain where token depositor wants to receive funds.\n * @param originToken Token sent in deposit.\n * @param depositsEnabled Set to true to whitelist this route for deposits, set to false if caller just wants to\n * map the origin token + destination ID to the destination token address on the origin chain's SpokePool.\n */\n function setDepositRoute(\n uint256 originChainId,\n uint256 destinationChainId,\n address originToken,\n bool depositsEnabled\n ) public override nonReentrant onlyOwner {\n _relaySpokePoolAdminFunction(\n originChainId,\n abi.encodeWithSignature(\n \"setEnableRoute(address,uint256,bool)\",\n originToken,\n destinationChainId,\n depositsEnabled\n )\n );\n emit SetEnableDepositRoute(originChainId, destinationChainId, originToken, depositsEnabled);\n }\n\n /**\n * @notice Enables LPs to provide liquidity for L1 token. Deploys new LP token for L1 token if appropriate.\n * Callable only by owner.\n * @param l1Token Token to provide liquidity for.\n */\n function enableL1TokenForLiquidityProvision(address l1Token) public override onlyOwner nonReentrant {\n // If token is being enabled for the first time, create a new LP token and set the timestamp once. We don't\n // want to ever reset this timestamp otherwise fees that have accrued will be lost since the last update. This\n // could happen for example if an L1 token is enabled, disabled, and then enabled again.\n if (pooledTokens[l1Token].lpToken == address(0)) {\n pooledTokens[l1Token].lpToken = lpTokenFactory.createLpToken(l1Token);\n pooledTokens[l1Token].lastLpFeeUpdate = uint32(getCurrentTime());\n }\n\n pooledTokens[l1Token].isEnabled = true;\n\n emit L1TokenEnabledForLiquidityProvision(l1Token, pooledTokens[l1Token].lpToken);\n }\n\n /**\n * @notice Disables LPs from providing liquidity for L1 token. Callable only by owner.\n * @param l1Token Token to disable liquidity provision for.\n */\n function disableL1TokenForLiquidityProvision(address l1Token) public override onlyOwner nonReentrant {\n pooledTokens[l1Token].isEnabled = false;\n emit L2TokenDisabledForLiquidityProvision(l1Token, pooledTokens[l1Token].lpToken);\n }\n\n /*************************************************\n * LIQUIDITY PROVIDER FUNCTIONS *\n *************************************************/\n\n /**\n * @notice Deposit liquidity into this contract to earn LP fees in exchange for funding relays on SpokePools.\n * Caller is essentially loaning their funds to be sent from this contract to the SpokePool, where it will be used\n * to repay a relayer, and ultimately receives their loan back after the tokens are bridged back to this contract\n * via the canonical token bridge. Then, the caller's loans are used again. This loan cycle repeats continuously\n * and the caller, or \"liquidity provider\" earns a continuous fee for their credit that they are extending relayers.\n * @notice Caller will receive an LP token representing their share of this pool. The LP token's redemption value\n * increments from the time that they enter the pool to reflect their accrued fees.\n * @notice The caller of this function must approve this contract to spend l1TokenAmount of l1Token.\n * @param l1Token Token to deposit into this contract.\n * @param l1TokenAmount Amount of liquidity to provide.\n */\n function addLiquidity(address l1Token, uint256 l1TokenAmount) public payable override nonReentrant {\n require(pooledTokens[l1Token].isEnabled, \"Token not enabled\");\n // If this is the weth pool and the caller sends msg.value then the msg.value must match the l1TokenAmount.\n // Else, msg.value must be set to 0.\n require(((address(weth) == l1Token) && msg.value == l1TokenAmount) || msg.value == 0, \"Bad msg.value\");\n\n // Since _exchangeRateCurrent() reads this contract's balance and updates contract state using it, it must be\n // first before transferring any tokens to this contract to ensure synchronization.\n uint256 lpTokensToMint = (l1TokenAmount * 1e18) / _exchangeRateCurrent(l1Token);\n pooledTokens[l1Token].liquidReserves += l1TokenAmount;\n ExpandedIERC20(pooledTokens[l1Token].lpToken).mint(msg.sender, lpTokensToMint);\n\n if (address(weth) == l1Token && msg.value > 0) WETH9(address(l1Token)).deposit{ value: msg.value }();\n else IERC20(l1Token).safeTransferFrom(msg.sender, address(this), l1TokenAmount);\n\n emit LiquidityAdded(l1Token, l1TokenAmount, lpTokensToMint, msg.sender);\n }\n\n /**\n * @notice Burns LP share to redeem for underlying l1Token original deposit amount plus fees.\n * @param l1Token Token to redeem LP share for.\n * @param lpTokenAmount Amount of LP tokens to burn. Exchange rate between L1 token and LP token can be queried\n * via public exchangeRateCurrent method.\n * @param sendEth Set to True if L1 token is WETH and user wants to receive ETH. Note that if caller\n * is a contract, then the contract should have a way to receive ETH if this value is set to True. Similarly,\n * if this value is set to False, then the calling contract should have a way to handle WETH.\n */\n function removeLiquidity(\n address l1Token,\n uint256 lpTokenAmount,\n bool sendEth\n ) public override nonReentrant {\n require(address(weth) == l1Token || !sendEth, \"Cant send eth\");\n uint256 l1TokensToReturn = (lpTokenAmount * _exchangeRateCurrent(l1Token)) / 1e18;\n\n ExpandedIERC20(pooledTokens[l1Token].lpToken).burnFrom(msg.sender, lpTokenAmount);\n // Note this method does not make any liquidity utilization checks before letting the LP redeem their LP tokens.\n // If they try access more funds than available (i.e l1TokensToReturn > liquidReserves) this will underflow.\n pooledTokens[l1Token].liquidReserves -= l1TokensToReturn;\n\n if (sendEth) {\n weth.withdraw(l1TokensToReturn);\n payable(msg.sender).transfer(l1TokensToReturn); // This will revert if the caller is a contract that does not implement a fallback function.\n } else {\n IERC20(address(l1Token)).safeTransfer(msg.sender, l1TokensToReturn);\n }\n emit LiquidityRemoved(l1Token, l1TokensToReturn, lpTokenAmount, msg.sender);\n }\n\n /**\n * @notice Returns exchange rate of L1 token to LP token.\n * @param l1Token L1 token redeemable by burning LP token.\n * @return Amount of L1 tokens redeemable for 1 unit LP token.\n */\n function exchangeRateCurrent(address l1Token) public override nonReentrant returns (uint256) {\n return _exchangeRateCurrent(l1Token);\n }\n\n /**\n * @notice Returns % of liquid reserves currently being \"used\" and sitting in SpokePools.\n * @param l1Token L1 token to query utilization for.\n * @return % of liquid reserves currently being \"used\" and sitting in SpokePools.\n */\n function liquidityUtilizationCurrent(address l1Token) public override nonReentrant returns (uint256) {\n return _liquidityUtilizationPostRelay(l1Token, 0);\n }\n\n /**\n * @notice Returns % of liquid reserves currently being \"used\" and sitting in SpokePools and accounting for\n * relayedAmount of tokens to be withdrawn from the pool.\n * @param l1Token L1 token to query utilization for.\n * @param relayedAmount The higher this amount, the higher the utilization.\n * @return % of liquid reserves currently being \"used\" and sitting in SpokePools plus the relayedAmount.\n */\n function liquidityUtilizationPostRelay(address l1Token, uint256 relayedAmount)\n public\n nonReentrant\n returns (uint256)\n {\n return _liquidityUtilizationPostRelay(l1Token, relayedAmount);\n }\n\n /**\n * @notice Synchronize any balance changes in this contract with the utilized & liquid reserves. This should be done\n * at the conclusion of a L2->L1 token transfer via the canonical token bridge, when this contract's reserves do not\n * reflect its true balance due to new tokens being dropped onto the contract at the conclusion of a bridging action.\n */\n function sync(address l1Token) public override nonReentrant {\n _sync(l1Token);\n }\n\n /*************************************************\n * DATA WORKER FUNCTIONS *\n *************************************************/\n\n /**\n * @notice Publish a new root bundle along with all of the block numbers that the merkle roots are relevant for.\n * This is used to aid off-chain validators in evaluating the correctness of this bundle. Caller stakes a bond that\n * can be slashed if the root bundle proposal is invalid, and they will receive it back if accepted.\n * @notice After proposeRootBundle is called, if the any props are wrong then this proposal can be challenged.\n * Once the challenge period passes, then the roots are no longer disputable, and only executeRootBundle can be\n * called; moreover, this method can't be called again until all leaves are executed.\n * @param bundleEvaluationBlockNumbers should contain the latest block number for all chains, even if there are no\n * relays contained on some of them. The usage of this variable should be defined in an off chain UMIP.\n * @notice The caller of this function must approve this contract to spend bondAmount of bondToken.\n * @param poolRebalanceLeafCount Number of leaves contained in pool rebalance root. Max is # of whitelisted chains.\n * @param poolRebalanceRoot Pool rebalance root containing leaves that sends tokens from this contract to SpokePool.\n * @param relayerRefundRoot Relayer refund root to publish to SpokePool where a data worker can execute leaves to\n * refund relayers on their chosen refund chainId.\n * @param slowRelayRoot Slow relay root to publish to Spoke Pool where a data worker can execute leaves to\n * fulfill slow relays.\n */\n function proposeRootBundle(\n uint256[] memory bundleEvaluationBlockNumbers,\n uint8 poolRebalanceLeafCount,\n bytes32 poolRebalanceRoot,\n bytes32 relayerRefundRoot,\n bytes32 slowRelayRoot\n ) public override nonReentrant noActiveRequests unpaused {\n // Note: this is to prevent \"empty block\" style attacks where someone can make empty proposals that are\n // technically valid but not useful. This could also potentially be enforced at the UMIP-level.\n require(poolRebalanceLeafCount > 0, \"Bundle must have at least 1 leaf\");\n\n uint32 requestExpirationTimestamp = uint32(getCurrentTime()) + liveness;\n\n delete rootBundleProposal; // Only one bundle of roots can be executed at a time.\n\n rootBundleProposal.requestExpirationTimestamp = requestExpirationTimestamp;\n rootBundleProposal.unclaimedPoolRebalanceLeafCount = poolRebalanceLeafCount;\n rootBundleProposal.poolRebalanceRoot = poolRebalanceRoot;\n rootBundleProposal.relayerRefundRoot = relayerRefundRoot;\n rootBundleProposal.slowRelayRoot = slowRelayRoot;\n rootBundleProposal.proposer = msg.sender;\n\n // Pull bondAmount of bondToken from the caller.\n bondToken.safeTransferFrom(msg.sender, address(this), bondAmount);\n\n emit ProposeRootBundle(\n requestExpirationTimestamp,\n poolRebalanceLeafCount,\n bundleEvaluationBlockNumbers,\n poolRebalanceRoot,\n relayerRefundRoot,\n slowRelayRoot,\n msg.sender\n );\n }\n\n /**\n * @notice Executes a pool rebalance leaf as part of the currently published root bundle. Will bridge any tokens\n * from this contract to the SpokePool designated in the leaf, and will also publish relayer refund and slow\n * relay roots to the SpokePool on the network specified in the leaf.\n * @dev In some cases, will instruct spokePool to send funds back to L1.\n * @notice Deletes the published root bundle if this is the last leaf to be executed in the root bundle.\n * @param chainId ChainId number of the target spoke pool on which the bundle is executed.\n * @param groupIndex If set to 0, then relay roots to SpokePool via cross chain bridge. Used by off-chain validator\n * to organize leaves with the same chain ID and also set which leaves should result in relayed messages.\n * @param bundleLpFees Array representing the total LP fee amount per token in this bundle for all bundled relays.\n * @param netSendAmounts Array representing the amount of tokens to send to the SpokePool on the target chainId.\n * @param runningBalances Array used to track any unsent tokens that are not included in the netSendAmounts.\n * @param leafId Index of this executed leaf within the poolRebalance tree.\n * @param l1Tokens Array of all the tokens associated with the bundleLpFees, nedSendAmounts and runningBalances.\n * @param proof Inclusion proof for this leaf in pool rebalance root in root bundle.\n */\n\n function executeRootBundle(\n uint256 chainId,\n uint256 groupIndex,\n uint256[] memory bundleLpFees,\n int256[] memory netSendAmounts,\n int256[] memory runningBalances,\n uint8 leafId,\n address[] memory l1Tokens,\n bytes32[] memory proof\n ) public nonReentrant unpaused {\n require(getCurrentTime() > rootBundleProposal.requestExpirationTimestamp, \"Not passed liveness\");\n\n // Verify the leafId in the poolRebalanceLeaf has not yet been claimed.\n require(!MerkleLib.isClaimed1D(rootBundleProposal.claimedBitMap, leafId), \"Already claimed\");\n\n // Verify the props provided generate a leaf that, along with the proof, are included in the merkle root.\n require(\n MerkleLib.verifyPoolRebalance(\n rootBundleProposal.poolRebalanceRoot,\n PoolRebalanceLeaf({\n chainId: chainId,\n groupIndex: groupIndex,\n bundleLpFees: bundleLpFees,\n netSendAmounts: netSendAmounts,\n runningBalances: runningBalances,\n leafId: leafId,\n l1Tokens: l1Tokens\n }),\n proof\n ),\n \"Bad Proof\"\n );\n\n // Get cross chain helpers for leaf's destination chain ID. This internal method will revert if either helper\n // is set improperly.\n (address adapter, address spokePool) = _getInitializedCrossChainContracts(chainId);\n\n // Set the leafId in the claimed bitmap.\n rootBundleProposal.claimedBitMap = MerkleLib.setClaimed1D(rootBundleProposal.claimedBitMap, leafId);\n\n // Decrement the unclaimedPoolRebalanceLeafCount.\n rootBundleProposal.unclaimedPoolRebalanceLeafCount--;\n\n // Relay each L1 token to destination chain.\n\n // Note: if any of the keccak256(l1Tokens, chainId) combinations are not mapped to a destination token address,\n // then this internal method will revert. In this case the admin will have to associate a destination token\n // with each l1 token. If the destination token mapping was missing at the time of the proposal, we assume\n // that the root bundle would have been disputed because the off-chain data worker would have been unable to\n // determine if the relayers used the correct destination token for a given origin token.\n _sendTokensToChainAndUpdatePooledTokenTrackers(\n adapter,\n spokePool,\n chainId,\n l1Tokens,\n netSendAmounts,\n bundleLpFees\n );\n\n // Check bool used by data worker to prevent relaying redundant roots to SpokePool.\n if (groupIndex == 0) {\n // Relay root bundles to spoke pool on destination chain by\n // performing delegatecall to use the adapter's code with this contract's context.\n (bool success, ) = adapter.delegatecall(\n abi.encodeWithSignature(\n \"relayMessage(address,bytes)\",\n spokePool, // target. This should be the spokePool on the L2.\n abi.encodeWithSignature(\n \"relayRootBundle(bytes32,bytes32)\",\n rootBundleProposal.relayerRefundRoot,\n rootBundleProposal.slowRelayRoot\n ) // message\n )\n );\n require(success, \"delegatecall failed\");\n }\n\n // Transfer the bondAmount back to the proposer, if this the last executed leaf. Only sending this once all\n // leaves have been executed acts to force the data worker to execute all bundles or they won't receive their bond.\n if (rootBundleProposal.unclaimedPoolRebalanceLeafCount == 0)\n bondToken.safeTransfer(rootBundleProposal.proposer, bondAmount);\n\n emit RootBundleExecuted(\n groupIndex,\n leafId,\n chainId,\n l1Tokens,\n bundleLpFees,\n netSendAmounts,\n runningBalances,\n msg.sender\n );\n }\n\n /**\n * @notice Caller stakes a bond to dispute the current root bundle proposal assuming it has not passed liveness\n * yet. The proposal is deleted, allowing a follow-up proposal to be submitted, and the dispute is sent to the\n * optimistic oracle to be adjudicated. Can only be called within the liveness period of the current proposal.\n * @notice The caller of this function must approve this contract to spend bondAmount of l1Token.\n */\n function disputeRootBundle() public nonReentrant zeroOptimisticOracleApproval {\n uint32 currentTime = uint32(getCurrentTime());\n require(currentTime <= rootBundleProposal.requestExpirationTimestamp, \"Request passed liveness\");\n\n // Request price from OO and dispute it.\n uint256 finalFee = _getBondTokenFinalFee();\n\n // This method will request a price from the OO and dispute it. Note that we set the ancillary data to\n // the empty string (\"\"). The root bundle that is being disputed was the most recently proposed one with a\n // block number less than or equal to the dispute block time. All of this root bundle data can be found in\n // the ProposeRootBundle event params. Moreover, the optimistic oracle will stamp the requester's address\n // (i.e. this contract address) meaning that ancillary data for a dispute originating from another HubPool\n // will always be distinct from a dispute originating from this HubPool. Moreover, since\n // bundleEvaluationNumbers for a root bundle proposal are not stored in this contract, DVM voters will always\n // have to look up the ProposeRootBundle event to evaluate a dispute, therefore there is no point emitting extra\n // data in this ancillary data that is already included in the ProposeRootBundle event.\n\n // If the finalFee is larger than the bond amount, the bond amount needs to be reset before a request can go\n // through. Cancel to avoid a revert. Similarly, if the final fee == bond amount, then the proposer bond\n // set in the optimistic oracle would be 0. The optimistic oracle would then default the bond to be equal\n // to the final fee, which would mean that the allowance set to the bondAmount would be insufficient and the\n // requestAndProposePriceFor() call would revert. Source: https://github.com/UMAprotocol/protocol/blob/5b37ea818a28479c01e458389a83c3e736306b17/packages/core/contracts/oracle/implementation/SkinnyOptimisticOracle.sol#L321\n if (finalFee >= bondAmount) {\n _cancelBundle();\n return;\n }\n\n SkinnyOptimisticOracleInterface optimisticOracle = _getOptimisticOracle();\n\n // Only approve exact tokens to avoid more tokens than expected being pulled into the OptimisticOracle.\n bondToken.safeIncreaseAllowance(address(optimisticOracle), bondAmount);\n try\n optimisticOracle.requestAndProposePriceFor(\n identifier,\n currentTime,\n \"\",\n bondToken,\n // Set reward to 0, since we'll settle proposer reward payouts directly from this contract after a root\n // proposal has passed the challenge period.\n 0,\n // Set the Optimistic oracle proposer bond for the request. We can assume that bondAmount > finalFee.\n bondAmount - finalFee,\n // Set the Optimistic oracle liveness for the price request.\n liveness,\n rootBundleProposal.proposer,\n // Canonical value representing \"True\"; i.e. the proposed relay is valid.\n int256(1e18)\n )\n returns (uint256) {\n // Ensure that approval == 0 after the call so the increaseAllowance call below doesn't allow more tokens\n // to transfer than intended.\n bondToken.safeApprove(address(optimisticOracle), 0);\n } catch {\n // Cancel the bundle since the proposal failed.\n _cancelBundle();\n return;\n }\n\n // Dispute the request that we just sent.\n SkinnyOptimisticOracleInterface.Request memory ooPriceRequest = SkinnyOptimisticOracleInterface.Request({\n proposer: rootBundleProposal.proposer,\n disputer: address(0),\n currency: bondToken,\n settled: false,\n proposedPrice: int256(1e18),\n resolvedPrice: 0,\n expirationTime: currentTime + liveness,\n reward: 0,\n finalFee: finalFee,\n bond: bondAmount - finalFee,\n customLiveness: liveness\n });\n\n // Finally, delete the state pertaining to the active proposal so that another proposer can submit a new bundle.\n delete rootBundleProposal;\n\n bondToken.safeTransferFrom(msg.sender, address(this), bondAmount);\n bondToken.safeIncreaseAllowance(address(optimisticOracle), bondAmount);\n optimisticOracle.disputePriceFor(identifier, currentTime, \"\", ooPriceRequest, msg.sender, address(this));\n\n emit RootBundleDisputed(msg.sender, currentTime);\n }\n\n /**\n * @notice Send unclaimed accumulated protocol fees to fee capture address.\n * @param l1Token Token whose protocol fees the caller wants to disburse.\n */\n function claimProtocolFeesCaptured(address l1Token) public override nonReentrant {\n uint256 _unclaimedAccumulatedProtocolFees = unclaimedAccumulatedProtocolFees[l1Token];\n unclaimedAccumulatedProtocolFees[l1Token] = 0;\n IERC20(l1Token).safeTransfer(protocolFeeCaptureAddress, _unclaimedAccumulatedProtocolFees);\n emit ProtocolFeesCapturedClaimed(l1Token, _unclaimedAccumulatedProtocolFees);\n }\n\n /**\n * @notice Conveniently queries which destination token is mapped to the hash of an l1 token + destination chain ID.\n * @param destinationChainId Where destination token is deployed.\n * @param l1Token Ethereum version token.\n * @return destinationToken address The destination token that is sent to spoke pools after this contract bridges\n * the l1Token to the destination chain.\n */\n function poolRebalanceRoute(uint256 destinationChainId, address l1Token)\n external\n view\n override\n returns (address destinationToken)\n {\n return poolRebalanceRoutes[_poolRebalanceRouteKey(l1Token, destinationChainId)];\n }\n\n /**\n * @notice This function allows a caller to load the contract with raw ETH to perform L2 calls. This is needed for\n * Arbitrum calls, but may also be needed for others.\n * @dev This function cannot be included in a multicall transaction call because it is payable. A realistic\n * situation where this might be an issue is if the caller is executing a PoolRebalanceLeaf that needs to relay\n * messages to Arbitrum. Relaying messages to Arbitrum requires that this contract has an ETH balance, so in this\n * case the caller would need to pre-load this contract with ETH before multicall-executing the leaf.\n */\n function loadEthForL2Calls() public payable override {}\n\n /*************************************************\n * INTERNAL FUNCTIONS *\n *************************************************/\n\n // Called when a dispute fails due to parameter changes. This effectively resets the state and cancels the request\n // with no loss of funds, thereby enabling a new bundle to be added.\n function _cancelBundle() internal {\n bondToken.transfer(rootBundleProposal.proposer, bondAmount);\n delete rootBundleProposal;\n emit RootBundleCanceled(msg.sender, getCurrentTime());\n }\n\n function _getOptimisticOracle() internal view returns (SkinnyOptimisticOracleInterface) {\n return\n SkinnyOptimisticOracleInterface(finder.getImplementationAddress(OracleInterfaces.SkinnyOptimisticOracle));\n }\n\n function _getBondTokenFinalFee() internal view returns (uint256) {\n return\n StoreInterface(finder.getImplementationAddress(OracleInterfaces.Store))\n .computeFinalFee(address(bondToken))\n .rawValue;\n }\n\n // Note this method does a lot and wraps together the sending of tokens and updating the pooled token trackers. This\n // is done as a gas saving so we don't need to iterate over the l1Tokens multiple times.\n function _sendTokensToChainAndUpdatePooledTokenTrackers(\n address adapter,\n address spokePool,\n uint256 chainId,\n address[] memory l1Tokens,\n int256[] memory netSendAmounts,\n uint256[] memory bundleLpFees\n ) internal {\n for (uint32 i = 0; i < l1Tokens.length; i++) {\n address l1Token = l1Tokens[i];\n // Validate the L1 -> L2 token route is stored. If it is not then the output of the bridging action\n // could send tokens to the 0x0 address on the L2.\n address l2Token = poolRebalanceRoutes[_poolRebalanceRouteKey(l1Token, chainId)];\n require(l2Token != address(0), \"Route not whitelisted\");\n\n // If the net send amount for this token is positive then: 1) send tokens from L1->L2 to facilitate the L2\n // relayer refund, 2) Update the liquidity trackers for the associated pooled tokens.\n if (netSendAmounts[i] > 0) {\n // Perform delegatecall to use the adapter's code with this contract's context. Opt for delegatecall's\n // complexity in exchange for lower gas costs.\n (bool success, ) = adapter.delegatecall(\n abi.encodeWithSignature(\n \"relayTokens(address,address,uint256,address)\",\n l1Token, // l1Token.\n l2Token, // l2Token.\n uint256(netSendAmounts[i]), // amount.\n spokePool // to. This should be the spokePool.\n )\n );\n require(success, \"delegatecall failed\");\n\n // Liquid reserves is decreased by the amount sent. utilizedReserves is increased by the amount sent.\n pooledTokens[l1Token].utilizedReserves += netSendAmounts[i];\n pooledTokens[l1Token].liquidReserves -= uint256(netSendAmounts[i]);\n }\n\n // Allocate LP fees and protocol fees from the bundle to the associated pooled token trackers.\n _allocateLpAndProtocolFees(l1Token, bundleLpFees[i]);\n }\n }\n\n function _exchangeRateCurrent(address l1Token) internal returns (uint256) {\n PooledToken storage pooledToken = pooledTokens[l1Token]; // Note this is storage so the state can be modified.\n uint256 lpTokenTotalSupply = IERC20(pooledToken.lpToken).totalSupply();\n if (lpTokenTotalSupply == 0) return 1e18; // initial rate is 1:1 between LP tokens and collateral.\n\n // First, update fee counters and local accounting of finalized transfers from L2 -> L1.\n _updateAccumulatedLpFees(pooledToken); // Accumulate all allocated fees from the last time this method was called.\n _sync(l1Token); // Fetch any balance changes due to token bridging finalization and factor them in.\n\n // ExchangeRate := (liquidReserves + utilizedReserves - undistributedLpFees) / lpTokenSupply\n // Both utilizedReserves and undistributedLpFees contain assigned LP fees. UndistributedLpFees is gradually\n // decreased over the smear duration using _updateAccumulatedLpFees. This means that the exchange rate will\n // gradually increase over time as undistributedLpFees goes to zero.\n // utilizedReserves can be negative. If this is the case, then liquidReserves is offset by an equal\n // and opposite size. LiquidReserves + utilizedReserves will always be larger than undistributedLpFees so this\n // int will always be positive so there is no risk in underflow in type casting in the return line.\n int256 numerator = int256(pooledToken.liquidReserves) +\n pooledToken.utilizedReserves -\n int256(pooledToken.undistributedLpFees);\n return (uint256(numerator) * 1e18) / lpTokenTotalSupply;\n }\n\n // Update internal fee counters by adding in any accumulated fees from the last time this logic was called.\n function _updateAccumulatedLpFees(PooledToken storage pooledToken) internal {\n uint256 accumulatedFees = _getAccumulatedFees(pooledToken.undistributedLpFees, pooledToken.lastLpFeeUpdate);\n pooledToken.undistributedLpFees -= accumulatedFees;\n pooledToken.lastLpFeeUpdate = uint32(getCurrentTime());\n }\n\n // Calculate the unallocated accumulatedFees from the last time the contract was called.\n function _getAccumulatedFees(uint256 undistributedLpFees, uint256 lastLpFeeUpdate) internal view returns (uint256) {\n // accumulatedFees := min(undistributedLpFees * lpFeeRatePerSecond * timeFromLastInteraction, undistributedLpFees)\n // The min acts to pay out all fees in the case the equation returns more than the remaining fees.\n uint256 timeFromLastInteraction = getCurrentTime() - lastLpFeeUpdate;\n uint256 maxUndistributedLpFees = (undistributedLpFees * lpFeeRatePerSecond * timeFromLastInteraction) / (1e18);\n return maxUndistributedLpFees < undistributedLpFees ? maxUndistributedLpFees : undistributedLpFees;\n }\n\n function _sync(address l1Token) internal {\n // Check if the l1Token balance of the contract is greater than the liquidReserves. If it is then the bridging\n // action from L2 -> L1 has concluded and the local accounting can be updated.\n // Note: this calculation must take into account the bond when it's acting on the bond token and there's an\n // active request.\n uint256 balance = IERC20(l1Token).balanceOf(address(this));\n uint256 balanceSansBond = l1Token == address(bondToken) && _activeRequest() ? balance - bondAmount : balance;\n if (balanceSansBond > pooledTokens[l1Token].liquidReserves) {\n // Note the numerical operation below can send utilizedReserves to negative. This can occur when tokens are\n // dropped onto the contract, exceeding the liquidReserves.\n pooledTokens[l1Token].utilizedReserves -= int256(balanceSansBond - pooledTokens[l1Token].liquidReserves);\n pooledTokens[l1Token].liquidReserves = balanceSansBond;\n }\n }\n\n function _liquidityUtilizationPostRelay(address l1Token, uint256 relayedAmount) internal returns (uint256) {\n _sync(l1Token); // Fetch any balance changes due to token bridging finalization and factor them in.\n\n // liquidityUtilizationRatio := (relayedAmount + max(utilizedReserves,0)) / (liquidReserves + max(utilizedReserves,0))\n // UtilizedReserves has a dual meaning: if it's greater than zero then it represents funds pending in the bridge\n // that will flow from L2 to L1. In this case, we can use it normally in the equation. However, if it is\n // negative, then it is already counted in liquidReserves. This occurs if tokens are transferred directly to the\n // contract. In this case, ignore it as it is captured in liquid reserves and has no meaning in the numerator.\n PooledToken memory pooledToken = pooledTokens[l1Token]; // Note this is storage so the state can be modified.\n uint256 flooredUtilizedReserves = pooledToken.utilizedReserves > 0 ? uint256(pooledToken.utilizedReserves) : 0;\n uint256 numerator = relayedAmount + flooredUtilizedReserves;\n uint256 denominator = pooledToken.liquidReserves + flooredUtilizedReserves;\n\n // If the denominator equals zero, return 1e18 (max utilization).\n if (denominator == 0) return 1e18;\n\n // In all other cases, return the utilization ratio.\n return (numerator * 1e18) / denominator;\n }\n\n function _allocateLpAndProtocolFees(address l1Token, uint256 bundleLpFees) internal {\n // Calculate the fraction of bundledLpFees that are allocated to the protocol and to the LPs.\n uint256 protocolFeesCaptured = (bundleLpFees * protocolFeeCapturePct) / 1e18;\n uint256 lpFeesCaptured = bundleLpFees - protocolFeesCaptured;\n\n // Assign any LP fees included into the bundle to the pooled token. These LP fees are tracked in the\n // undistributedLpFees and within the utilizedReserves. undistributedLpFees is gradually decreased\n // over the smear duration to give the LPs their rewards over a period of time. Adding to utilizedReserves\n // acts to track these rewards after the smear duration. See _exchangeRateCurrent for more details.\n if (lpFeesCaptured > 0) {\n pooledTokens[l1Token].undistributedLpFees += lpFeesCaptured;\n pooledTokens[l1Token].utilizedReserves += int256(lpFeesCaptured);\n }\n\n // If there are any protocol fees, allocate them to the unclaimed protocol tracker amount.\n if (protocolFeesCaptured > 0) unclaimedAccumulatedProtocolFees[l1Token] += protocolFeesCaptured;\n }\n\n function _relaySpokePoolAdminFunction(uint256 chainId, bytes memory functionData) internal {\n (address adapter, address spokePool) = _getInitializedCrossChainContracts(chainId);\n\n // Perform delegatecall to use the adapter's code with this contract's context.\n (bool success, ) = adapter.delegatecall(\n abi.encodeWithSignature(\n \"relayMessage(address,bytes)\",\n spokePool, // target. This should be the spokePool on the L2.\n functionData\n )\n );\n require(success, \"delegatecall failed\");\n emit SpokePoolAdminFunctionTriggered(chainId, functionData);\n }\n\n function _poolRebalanceRouteKey(address l1Token, uint256 destinationChainId) internal pure returns (bytes32) {\n return keccak256(abi.encode(l1Token, destinationChainId));\n }\n\n function _getInitializedCrossChainContracts(uint256 chainId)\n internal\n view\n returns (address adapter, address spokePool)\n {\n adapter = crossChainContracts[chainId].adapter;\n spokePool = crossChainContracts[chainId].spokePool;\n require(spokePool != address(0), \"SpokePool not initialized\");\n require(adapter.isContract(), \"Adapter not initialized\");\n }\n\n function _activeRequest() internal view returns (bool) {\n return rootBundleProposal.unclaimedPoolRebalanceLeafCount != 0;\n }\n\n // If functionCallStackOriginatesFromOutsideThisContract is true then this was called by the callback function\n // by dropping ETH onto the contract. In this case, deposit the ETH into WETH. This would happen if ETH was sent\n // over the optimism bridge, for example. If false then this was set as a result of unwinding LP tokens, with the\n // intention of sending ETH to the LP. In this case, do nothing as we intend on sending the ETH to the LP.\n function _depositEthToWeth() internal {\n if (functionCallStackOriginatesFromOutsideThisContract()) weth.deposit{ value: msg.value }();\n }\n\n // Added to enable the HubPool to receive ETH. This will occur both when the HubPool unwraps WETH to send to LPs and\n // when ETH is sent over the canonical Optimism bridge, which sends ETH.\n fallback() external payable {\n _depositEthToWeth();\n }\n\n receive() external payable {\n _depositEthToWeth();\n }\n}\n" }, "contracts/MerkleLib.sol": { - "content": "// SPDX-License-Identifier: GPL-3.0-only\r\npragma solidity ^0.8.0;\r\n\r\nimport \"@openzeppelin/contracts/utils/cryptography/MerkleProof.sol\";\r\nimport \"./SpokePoolInterface.sol\";\r\nimport \"./HubPoolInterface.sol\";\r\n\r\n/**\r\n * @notice Library to help with merkle roots, proofs, and claims.\r\n */\r\nlibrary MerkleLib {\r\n /**\r\n * @notice Verifies that a repayment is contained within a merkle root.\r\n * @param root the merkle root.\r\n * @param rebalance the rebalance struct.\r\n * @param proof the merkle proof.\r\n */\r\n function verifyPoolRebalance(\r\n bytes32 root,\r\n HubPoolInterface.PoolRebalanceLeaf memory rebalance,\r\n bytes32[] memory proof\r\n ) internal pure returns (bool) {\r\n return MerkleProof.verify(proof, root, keccak256(abi.encode(rebalance)));\r\n }\r\n\r\n /**\r\n * @notice Verifies that a relayer refund is contained within a merkle root.\r\n * @param root the merkle root.\r\n * @param refund the refund struct.\r\n * @param proof the merkle proof.\r\n */\r\n function verifyRelayerRefund(\r\n bytes32 root,\r\n SpokePoolInterface.RelayerRefundLeaf memory refund,\r\n bytes32[] memory proof\r\n ) internal pure returns (bool) {\r\n return MerkleProof.verify(proof, root, keccak256(abi.encode(refund)));\r\n }\r\n\r\n /**\r\n * @notice Verifies that a distribution is contained within a merkle root.\r\n * @param root the merkle root.\r\n * @param slowRelayFulfillment the relayData fulfullment struct.\r\n * @param proof the merkle proof.\r\n */\r\n function verifySlowRelayFulfillment(\r\n bytes32 root,\r\n SpokePoolInterface.RelayData memory slowRelayFulfillment,\r\n bytes32[] memory proof\r\n ) internal pure returns (bool) {\r\n return MerkleProof.verify(proof, root, keccak256(abi.encode(slowRelayFulfillment)));\r\n }\r\n\r\n // The following functions are primarily copied from\r\n // https://github.com/Uniswap/merkle-distributor/blob/master/contracts/MerkleDistributor.sol with minor changes.\r\n\r\n /**\r\n * @notice Tests whether a claim is contained within a claimedBitMap mapping.\r\n * @param claimedBitMap a simple uint256 mapping in storage used as a bitmap.\r\n * @param index the index to check in the bitmap.\r\n * @return bool indicating if the index within the claimedBitMap has been marked as claimed.\r\n */\r\n function isClaimed(mapping(uint256 => uint256) storage claimedBitMap, uint256 index) internal view returns (bool) {\r\n uint256 claimedWordIndex = index / 256;\r\n uint256 claimedBitIndex = index % 256;\r\n uint256 claimedWord = claimedBitMap[claimedWordIndex];\r\n uint256 mask = (1 << claimedBitIndex);\r\n return claimedWord & mask == mask;\r\n }\r\n\r\n /**\r\n * @notice Marks an index in a claimedBitMap as claimed.\r\n * @param claimedBitMap a simple uint256 mapping in storage used as a bitmap.\r\n * @param index the index to mark in the bitmap.\r\n */\r\n function setClaimed(mapping(uint256 => uint256) storage claimedBitMap, uint256 index) internal {\r\n uint256 claimedWordIndex = index / 256;\r\n uint256 claimedBitIndex = index % 256;\r\n claimedBitMap[claimedWordIndex] = claimedBitMap[claimedWordIndex] | (1 << claimedBitIndex);\r\n }\r\n\r\n /**\r\n * @notice Tests whether a claim is contained within a 1D claimedBitMap mapping.\r\n * @param claimedBitMap a simple uint256 value, encoding a 1D bitmap.\r\n * @param index the index to check in the bitmap.\r\n \\* @return bool indicating if the index within the claimedBitMap has been marked as claimed.\r\n */\r\n function isClaimed1D(uint256 claimedBitMap, uint256 index) internal pure returns (bool) {\r\n uint256 mask = (1 << index);\r\n return claimedBitMap & mask == mask;\r\n }\r\n\r\n /**\r\n * @notice Marks an index in a claimedBitMap as claimed.\r\n * @param claimedBitMap a simple uint256 mapping in storage used as a bitmap.\r\n * @param index the index to mark in the bitmap.\r\n */\r\n function setClaimed1D(uint256 claimedBitMap, uint256 index) internal pure returns (uint256) {\r\n require(index <= 255, \"Index out of bounds\");\r\n return claimedBitMap | (1 << index % 256);\r\n }\r\n}\r\n" + "content": "// SPDX-License-Identifier: GPL-3.0-only\npragma solidity ^0.8.0;\n\nimport \"./SpokePoolInterface.sol\";\nimport \"./HubPoolInterface.sol\";\n\nimport \"@openzeppelin/contracts/utils/cryptography/MerkleProof.sol\";\n\n/**\n * @notice Library to help with merkle roots, proofs, and claims.\n */\nlibrary MerkleLib {\n /**\n * @notice Verifies that a repayment is contained within a merkle root.\n * @param root the merkle root.\n * @param rebalance the rebalance struct.\n * @param proof the merkle proof.\n * @return bool to signal if the pool rebalance proof correctly shows inclusion of the rebalance within the tree.\n */\n function verifyPoolRebalance(\n bytes32 root,\n HubPoolInterface.PoolRebalanceLeaf memory rebalance,\n bytes32[] memory proof\n ) internal pure returns (bool) {\n return MerkleProof.verify(proof, root, keccak256(abi.encode(rebalance)));\n }\n\n /**\n * @notice Verifies that a relayer refund is contained within a merkle root.\n * @param root the merkle root.\n * @param refund the refund struct.\n * @param proof the merkle proof.\n * @return bool to signal if the relayer refund proof correctly shows inclusion of the refund within the tree.\n */\n function verifyRelayerRefund(\n bytes32 root,\n SpokePoolInterface.RelayerRefundLeaf memory refund,\n bytes32[] memory proof\n ) internal pure returns (bool) {\n return MerkleProof.verify(proof, root, keccak256(abi.encode(refund)));\n }\n\n /**\n * @notice Verifies that a distribution is contained within a merkle root.\n * @param root the merkle root.\n * @param slowRelayFulfillment the relayData fulfillment struct.\n * @param proof the merkle proof.\n * @return bool to signal if the slow relay's proof correctly shows inclusion of the slow relay within the tree.\n */\n function verifySlowRelayFulfillment(\n bytes32 root,\n SpokePoolInterface.RelayData memory slowRelayFulfillment,\n bytes32[] memory proof\n ) internal pure returns (bool) {\n return MerkleProof.verify(proof, root, keccak256(abi.encode(slowRelayFulfillment)));\n }\n\n // The following functions are primarily copied from\n // https://github.com/Uniswap/merkle-distributor/blob/master/contracts/MerkleDistributor.sol with minor changes.\n\n /**\n * @notice Tests whether a claim is contained within a claimedBitMap mapping.\n * @param claimedBitMap a simple uint256 mapping in storage used as a bitmap.\n * @param index the index to check in the bitmap.\n * @return bool indicating if the index within the claimedBitMap has been marked as claimed.\n */\n function isClaimed(mapping(uint256 => uint256) storage claimedBitMap, uint256 index) internal view returns (bool) {\n uint256 claimedWordIndex = index / 256;\n uint256 claimedBitIndex = index % 256;\n uint256 claimedWord = claimedBitMap[claimedWordIndex];\n uint256 mask = (1 << claimedBitIndex);\n return claimedWord & mask == mask;\n }\n\n /**\n * @notice Marks an index in a claimedBitMap as claimed.\n * @param claimedBitMap a simple uint256 mapping in storage used as a bitmap.\n * @param index the index to mark in the bitmap.\n */\n function setClaimed(mapping(uint256 => uint256) storage claimedBitMap, uint256 index) internal {\n uint256 claimedWordIndex = index / 256;\n uint256 claimedBitIndex = index % 256;\n claimedBitMap[claimedWordIndex] = claimedBitMap[claimedWordIndex] | (1 << claimedBitIndex);\n }\n\n /**\n * @notice Tests whether a claim is contained within a 1D claimedBitMap mapping.\n * @param claimedBitMap a simple uint256 value, encoding a 1D bitmap.\n * @param index the index to check in the bitmap. Uint8 type enforces that index can't be > 255.\n * @return bool indicating if the index within the claimedBitMap has been marked as claimed.\n */\n function isClaimed1D(uint256 claimedBitMap, uint8 index) internal pure returns (bool) {\n uint256 mask = (1 << index);\n return claimedBitMap & mask == mask;\n }\n\n /**\n * @notice Marks an index in a claimedBitMap as claimed.\n * @param claimedBitMap a simple uint256 mapping in storage used as a bitmap. Uint8 type enforces that index\n * can't be > 255.\n * @param index the index to mark in the bitmap.\n * @return uint256 representing the modified input claimedBitMap with the index set to true.\n */\n function setClaimed1D(uint256 claimedBitMap, uint8 index) internal pure returns (uint256) {\n return claimedBitMap | (1 << index % 256);\n }\n}\n" }, "contracts/HubPoolInterface.sol": { - "content": "// SPDX-License-Identifier: GPL-3.0-only\r\npragma solidity ^0.8.0;\r\n\r\nimport \"@openzeppelin/contracts/token/ERC20/IERC20.sol\";\r\nimport \"./interfaces/AdapterInterface.sol\";\r\n\r\ninterface HubPoolInterface {\r\n struct PoolRebalanceLeaf {\r\n // This is used to know which chain to send cross-chain transactions to (and which SpokePool to sent to).\r\n uint256 chainId;\r\n uint256[] bundleLpFees; // Total LP fee amount per token in this bundle, encompassing all associated bundled relays.\r\n // This array is grouped with the two above, and it represents the amount to send or request back from the\r\n // SpokePool. If positive, the pool will pay the SpokePool. If negative the SpokePool will pay the HubPool.\r\n // There can be arbitrarily complex rebalancing rules defined offchain. This number is only nonzero\r\n // when the rules indicate that a rebalancing action should occur. When a rebalance does not occur,\r\n // runningBalances for this token should change by the total relays - deposits in this bundle. When a rebalance\r\n // does occur, runningBalances should be set to zero for this token and the netSendAmounts should be set to the\r\n // previous runningBalances + relays - deposits in this bundle.\r\n int256[] netSendAmounts;\r\n // This is only here to be emitted in an event to track a running unpaid balance between the L2 pool and the L1 pool.\r\n // A positive number indicates that the HubPool owes the SpokePool funds. A negative number indicates that the\r\n // SpokePool owes the HubPool funds. See the comment above for the dynamics of this and netSendAmounts\r\n int256[] runningBalances;\r\n // Used as the index in the bitmap to track whether this leaf has been executed or not.\r\n uint8 leafId;\r\n // The following arrays are required to be the same length. They are parallel arrays for the given chainId and should be ordered by the `l1Tokens` field.\r\n // All whitelisted tokens with nonzero relays on this chain in this bundle in the order of whitelisting.\r\n address[] l1Tokens;\r\n }\r\n\r\n function setBond(IERC20 newBondToken, uint256 newBondAmount) external;\r\n\r\n function setCrossChainContracts(\r\n uint256 l2ChainId,\r\n address adapter,\r\n address spokePool\r\n ) external;\r\n\r\n function whitelistRoute(\r\n uint256 originChainId,\r\n uint256 destinationChainId,\r\n address originToken,\r\n address destinationToken\r\n ) external;\r\n\r\n function enableL1TokenForLiquidityProvision(address l1Token) external;\r\n\r\n function disableL1TokenForLiquidityProvision(address l1Token) external;\r\n\r\n function addLiquidity(address l1Token, uint256 l1TokenAmount) external payable;\r\n\r\n function removeLiquidity(\r\n address l1Token,\r\n uint256 lpTokenAmount,\r\n bool sendEth\r\n ) external;\r\n\r\n function exchangeRateCurrent(address l1Token) external returns (uint256);\r\n\r\n function liquidityUtilizationPostRelay(address token, uint256 relayedAmount) external returns (uint256);\r\n\r\n function proposeRootBundle(\r\n uint256[] memory bundleEvaluationBlockNumbers,\r\n uint8 poolRebalanceLeafCount,\r\n bytes32 poolRebalanceRoot,\r\n bytes32 relayerRefundRoot,\r\n bytes32 slowRelayFulfillmentRoot\r\n ) external;\r\n\r\n function executeRootBundle(PoolRebalanceLeaf memory poolRebalanceLeaf, bytes32[] memory proof) external;\r\n\r\n function disputeRootBundle() external;\r\n}\r\n" + "content": "// SPDX-License-Identifier: GPL-3.0-only\npragma solidity ^0.8.0;\n\nimport \"./interfaces/AdapterInterface.sol\";\n\nimport \"@openzeppelin/contracts/token/ERC20/IERC20.sol\";\n\n/**\n * @notice Concise list of functions in HubPool implementation.\n */\ninterface HubPoolInterface {\n // This leaf is meant to be decoded in the HubPool to rebalance tokens between HubPool and SpokePool.\n struct PoolRebalanceLeaf {\n // This is used to know which chain to send cross-chain transactions to (and which SpokePool to send to).\n uint256 chainId;\n // Total LP fee amount per token in this bundle, encompassing all associated bundled relays.\n uint256[] bundleLpFees;\n // This array is grouped with the two above, and it represents the amount to send or request back from the\n // SpokePool. If positive, the pool will pay the SpokePool. If negative the SpokePool will pay the HubPool.\n // There can be arbitrarily complex rebalancing rules defined offchain. This number is only nonzero when the\n // rules indicate that a rebalancing action should occur. When a rebalance does occur, runningBalances should be\n // set to zero for this token and the netSendAmounts should be set to the previous runningBalances + relays -\n // deposits in this bundle. If non-zero then it must be set on the SpokePool's RelayerRefundLeaf amountToReturn\n // as -1 * this value to indicate if funds are being sent from or to the SpokePool.\n int256[] netSendAmounts;\n // This is only here to be emitted in an event to track a running unpaid balance between the L2 pool and the L1\n // pool. A positive number indicates that the HubPool owes the SpokePool funds. A negative number indicates that\n // the SpokePool owes the HubPool funds. See the comment above for the dynamics of this and netSendAmounts.\n int256[] runningBalances;\n // Used by data worker to mark which leaves should relay roots to SpokePools, and to otherwise organize leaves.\n // For example, each leaf should contain all the rebalance information for a single chain, but in the case where\n // the list of l1Tokens is very large such that they all can't fit into a single leaf that can be executed under\n // the block gas limit, then the data worker can use this groupIndex to organize them. Any leaves with\n // a groupIndex equal to 0 will relay roots to the SpokePool, so the data worker should ensure that only one\n // leaf for a specific chainId should have a groupIndex equal to 0.\n uint256 groupIndex;\n // Used as the index in the bitmap to track whether this leaf has been executed or not.\n uint8 leafId;\n // The following arrays are required to be the same length. They are parallel arrays for the given chainId and\n // should be ordered by the l1Tokens field. All whitelisted tokens with nonzero relays on this chain in this\n // bundle in the order of whitelisting.\n address[] l1Tokens;\n }\n\n // A data worker can optimistically store several merkle roots on this contract by staking a bond and calling\n // proposeRootBundle. By staking a bond, the data worker is alleging that the merkle roots all contain valid leaves\n // that can be executed later to:\n // - Send funds from this contract to a SpokePool or vice versa\n // - Send funds from a SpokePool to Relayer as a refund for a relayed deposit\n // - Send funds from a SpokePool to a deposit recipient to fulfill a \"slow\" relay\n // Anyone can dispute this struct if the merkle roots contain invalid leaves before the\n // requestExpirationTimestamp. Once the expiration timestamp is passed, executeRootBundle to execute a leaf\n // from the poolRebalanceRoot on this contract and it will simultaneously publish the relayerRefundRoot and\n // slowRelayRoot to a SpokePool. The latter two roots, once published to the SpokePool, contain\n // leaves that can be executed on the SpokePool to pay relayers or recipients.\n struct RootBundle {\n // Contains leaves instructing this contract to send funds to SpokePools.\n bytes32 poolRebalanceRoot;\n // Relayer refund merkle root to be published to a SpokePool.\n bytes32 relayerRefundRoot;\n // Slow relay merkle root to be published to a SpokePool.\n bytes32 slowRelayRoot;\n // This is a 1D bitmap, with max size of 256 elements, limiting us to 256 chainsIds.\n uint256 claimedBitMap;\n // Proposer of this root bundle.\n address proposer;\n // Number of pool rebalance leaves to execute in the poolRebalanceRoot. After this number\n // of leaves are executed, a new root bundle can be proposed\n uint8 unclaimedPoolRebalanceLeafCount;\n // When root bundle challenge period passes and this root bundle becomes executable.\n uint32 requestExpirationTimestamp;\n }\n\n // Each whitelisted L1 token has an associated pooledToken struct that contains all information used to track the\n // cumulative LP positions and if this token is enabled for deposits.\n struct PooledToken {\n // LP token given to LPs of a specific L1 token.\n address lpToken;\n // True if accepting new LP's.\n bool isEnabled;\n // Timestamp of last LP fee update.\n uint32 lastLpFeeUpdate;\n // Number of LP funds sent via pool rebalances to SpokePools and are expected to be sent\n // back later.\n int256 utilizedReserves;\n // Number of LP funds held in contract less utilized reserves.\n uint256 liquidReserves;\n // Number of LP funds reserved to pay out to LPs as fees.\n uint256 undistributedLpFees;\n }\n\n // Helper contracts to facilitate cross chain actions between HubPool and SpokePool for a specific network.\n struct CrossChainContract {\n address adapter;\n address spokePool;\n }\n\n function setPaused(bool pause) external;\n\n function emergencyDeleteProposal() external;\n\n function relaySpokePoolAdminFunction(uint256 chainId, bytes memory functionData) external;\n\n function setProtocolFeeCapture(address newProtocolFeeCaptureAddress, uint256 newProtocolFeeCapturePct) external;\n\n function setBond(IERC20 newBondToken, uint256 newBondAmount) external;\n\n function setLiveness(uint32 newLiveness) external;\n\n function setIdentifier(bytes32 newIdentifier) external;\n\n function setCrossChainContracts(\n uint256 l2ChainId,\n address adapter,\n address spokePool\n ) external;\n\n function enableL1TokenForLiquidityProvision(address l1Token) external;\n\n function disableL1TokenForLiquidityProvision(address l1Token) external;\n\n function addLiquidity(address l1Token, uint256 l1TokenAmount) external payable;\n\n function removeLiquidity(\n address l1Token,\n uint256 lpTokenAmount,\n bool sendEth\n ) external;\n\n function exchangeRateCurrent(address l1Token) external returns (uint256);\n\n function liquidityUtilizationCurrent(address l1Token) external returns (uint256);\n\n function liquidityUtilizationPostRelay(address token, uint256 relayedAmount) external returns (uint256);\n\n function sync(address l1Token) external;\n\n function proposeRootBundle(\n uint256[] memory bundleEvaluationBlockNumbers,\n uint8 poolRebalanceLeafCount,\n bytes32 poolRebalanceRoot,\n bytes32 relayerRefundRoot,\n bytes32 slowRelayRoot\n ) external;\n\n function executeRootBundle(\n uint256 chainId,\n uint256 groupIndex,\n uint256[] memory bundleLpFees,\n int256[] memory netSendAmounts,\n int256[] memory runningBalances,\n uint8 leafId,\n address[] memory l1Tokens,\n bytes32[] memory proof\n ) external;\n\n function disputeRootBundle() external;\n\n function claimProtocolFeesCaptured(address l1Token) external;\n\n function setPoolRebalanceRoute(\n uint256 destinationChainId,\n address l1Token,\n address destinationToken\n ) external;\n\n function setDepositRoute(\n uint256 originChainId,\n uint256 destinationChainId,\n address originToken,\n bool depositsEnabled\n ) external;\n\n function poolRebalanceRoute(uint256 destinationChainId, address l1Token)\n external\n view\n returns (address destinationToken);\n\n function loadEthForL2Calls() external payable;\n}\n" }, "contracts/Lockable.sol": { - "content": "// SPDX-License-Identifier: AGPL-3.0-only\r\npragma solidity ^0.8.0;\r\n\r\n/**\r\n * @title A contract that provides modifiers to prevent reentrancy to state-changing and view-only methods. This contract\r\n * is inspired by https://github.com/OpenZeppelin/openzeppelin-contracts/blob/master/contracts/utils/ReentrancyGuard.sol\r\n * and https://github.com/balancer-labs/balancer-core/blob/master/contracts/BPool.sol.\r\n */\r\ncontract Lockable {\r\n bool internal _notEntered;\r\n\r\n constructor() {\r\n // Storing an initial non-zero value makes deployment a bit more expensive, but in exchange the refund on every\r\n // call to nonReentrant will be lower in amount. Since refunds are capped to a percentage of the total\r\n // transaction's gas, it is best to keep them low in cases like this one, to increase the likelihood of the full\r\n // refund coming into effect.\r\n _notEntered = true;\r\n }\r\n\r\n /**\r\n * @dev Prevents a contract from calling itself, directly or indirectly.\r\n * Calling a `nonReentrant` function from another `nonReentrant` function is not supported. It is possible to\r\n * prevent this from happening by making the `nonReentrant` function external, and making it call a `private`\r\n * function that does the actual state modification.\r\n */\r\n modifier nonReentrant() {\r\n _preEntranceCheck();\r\n _preEntranceSet();\r\n _;\r\n _postEntranceReset();\r\n }\r\n\r\n /**\r\n * @dev Designed to prevent a view-only method from being re-entered during a call to a `nonReentrant()` state-changing method.\r\n */\r\n modifier nonReentrantView() {\r\n _preEntranceCheck();\r\n _;\r\n }\r\n\r\n /**\r\n * @dev Returns true if the contract is currently in a non-entered state, meaning that the origination of the call\r\n * came from outside the contract. This is relevant with fallback/receive methods to see if the call came from ETH\r\n * being dropped onto the contract externally or due to ETH dropped on the the contract from within a method in this\r\n * contract, such as unwrapping WETH to ETH within the contract.\r\n */\r\n function functionCallStackOriginatesFromOutsideThisContract() internal view returns (bool) {\r\n return _notEntered;\r\n }\r\n\r\n // Internal methods are used to avoid copying the require statement's bytecode to every `nonReentrant()` method.\r\n // On entry into a function, `_preEntranceCheck()` should always be called to check if the function is being\r\n // re-entered. Then, if the function modifies state, it should call `_postEntranceSet()`, perform its logic, and\r\n // then call `_postEntranceReset()`.\r\n // View-only methods can simply call `_preEntranceCheck()` to make sure that it is not being re-entered.\r\n function _preEntranceCheck() internal view {\r\n // On the first call to nonReentrant, _notEntered will be true\r\n require(_notEntered, \"ReentrancyGuard: reentrant call\");\r\n }\r\n\r\n function _preEntranceSet() internal {\r\n // Any calls to nonReentrant after this point will fail\r\n _notEntered = false;\r\n }\r\n\r\n function _postEntranceReset() internal {\r\n // By storing the original value once again, a refund is triggered (see\r\n // https://eips.ethereum.org/EIPS/eip-2200)\r\n _notEntered = true;\r\n }\r\n}\r\n" - }, - "contracts/interfaces/AdapterInterface.sol": { - "content": "// SPDX-License-Identifier: AGPL-3.0-only\npragma solidity ^0.8.0;\n\n/**\n * @notice Sends cross chain messages and tokens to contracts on a specific L2 network.\n */\n\ninterface AdapterInterface {\n event HubPoolChanged(address newHubPool);\n\n event MessageRelayed(address target, bytes message);\n\n event TokensRelayed(address l1Token, address l2Token, uint256 amount, address to);\n\n function relayMessage(address target, bytes memory message) external payable;\n\n function relayTokens(\n address l1Token,\n address l2Token,\n uint256 amount,\n address to\n ) external payable;\n}\n" + "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 * @dev The reason why we use this local contract instead of importing from uma/contracts is because of the addition\n * of the internal method `functionCallStackOriginatesFromOutsideThisContract` which doesn't exist in the one exported\n * by uma/contracts.\n */\ncontract Lockable {\n bool internal _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 /**\n * @dev Returns true if the contract is currently in a non-entered state, meaning that the origination of the call\n * came from outside the contract. This is relevant with fallback/receive methods to see if the call came from ETH\n * being dropped onto the contract externally or due to ETH dropped on the the contract from within a method in this\n * contract, such as unwrapping WETH to ETH within the contract.\n */\n function functionCallStackOriginatesFromOutsideThisContract() internal view returns (bool) {\n return _notEntered;\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" }, "contracts/interfaces/LpTokenFactoryInterface.sol": { - "content": "// SPDX-License-Identifier: AGPL-3.0-only\npragma solidity ^0.8.0;\n\nimport \"@openzeppelin/contracts/token/ERC20/IERC20.sol\";\n\ninterface LpTokenFactoryInterface {\n function createLpToken(address l1Token) external returns (address);\n}\n" + "content": "// SPDX-License-Identifier: AGPL-3.0-only\npragma solidity ^0.8.0;\n\ninterface LpTokenFactoryInterface {\n function createLpToken(address l1Token) external returns (address);\n}\n" }, "contracts/interfaces/WETH9.sol": { - "content": "// SPDX-License-Identifier: GPL-3.0-only\r\npragma solidity ^0.8.0;\r\n\r\ninterface WETH9 {\r\n function withdraw(uint256 wad) external;\r\n\r\n function deposit() external payable;\r\n\r\n function balanceOf(address guy) external view returns (uint256 wad);\r\n\r\n function transfer(address guy, uint256 wad) external;\r\n}\r\n" + "content": "// SPDX-License-Identifier: GPL-3.0-only\npragma solidity ^0.8.0;\n\ninterface WETH9 {\n function withdraw(uint256 wad) external;\n\n function deposit() external payable;\n\n function balanceOf(address guy) external view returns (uint256 wad);\n\n function transfer(address guy, uint256 wad) external;\n}\n" }, "@uma/core/contracts/common/implementation/Testable.sol": { "content": "// SPDX-License-Identifier: AGPL-3.0-only\npragma solidity ^0.8.0;\n\nimport \"./Timer.sol\";\n\n/**\n * @title Base class that provides time overrides, but only if being run in test mode.\n */\nabstract contract Testable {\n // If the contract is being run in production, then `timerAddress` will be the 0x0 address.\n // Note: this variable should be set on construction and never modified.\n address public timerAddress;\n\n /**\n * @notice Constructs the Testable contract. Called by child contracts.\n * @param _timerAddress Contract that stores the current time in a testing environment.\n * Must be set to 0x0 for production environments that use live time.\n */\n constructor(address _timerAddress) {\n timerAddress = _timerAddress;\n }\n\n /**\n * @notice Reverts if not running in test mode.\n */\n modifier onlyIfTest {\n require(timerAddress != address(0x0));\n _;\n }\n\n /**\n * @notice Sets the current time.\n * @dev Will revert if not running in test mode.\n * @param time timestamp to set current Testable time to.\n */\n function setCurrentTime(uint256 time) external onlyIfTest {\n Timer(timerAddress).setCurrentTime(time);\n }\n\n /**\n * @notice Gets the current time. Will return the last time set in `setCurrentTime` if running in test mode.\n * Otherwise, it will return the block timestamp.\n * @return uint for the current Testable timestamp.\n */\n function getCurrentTime() public view virtual returns (uint256) {\n if (timerAddress != address(0x0)) {\n return Timer(timerAddress).getCurrentTime();\n } else {\n return block.timestamp; // solhint-disable-line not-rely-on-time\n }\n }\n}\n" @@ -56,19 +53,22 @@ "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts v4.4.1 (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 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 called by any account other than the owner.\n */\n modifier onlyOwner() {\n require(owner() == _msgSender(), \"Ownable: caller is not the owner\");\n _;\n }\n\n /**\n * @dev Leaves the contract without owner. It will not be possible to call\n * `onlyOwner` functions anymore. Can only be called by the current owner.\n *\n * NOTE: Renouncing ownership will leave the contract without an owner,\n * thereby removing 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/IERC20.sol": { - "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts v4.4.1 (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 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 `recipient`.\n *\n * Returns a boolean value indicating whether the operation succeeded.\n *\n * Emits a {Transfer} event.\n */\n function transfer(address recipient, 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 `sender` to `recipient` 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(\n address sender,\n address recipient,\n uint256 amount\n ) external returns (bool);\n\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" + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.5.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 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(\n address from,\n address to,\n uint256 amount\n ) external returns (bool);\n\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" }, "@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol": { "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts v4.4.1 (token/ERC20/utils/SafeERC20.sol)\n\npragma solidity ^0.8.0;\n\nimport \"../IERC20.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 function safeTransfer(\n IERC20 token,\n address to,\n uint256 value\n ) internal {\n _callOptionalReturn(token, abi.encodeWithSelector(token.transfer.selector, to, value));\n }\n\n function safeTransferFrom(\n IERC20 token,\n address from,\n address to,\n uint256 value\n ) 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(\n IERC20 token,\n address spender,\n uint256 value\n ) 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 function safeIncreaseAllowance(\n IERC20 token,\n address spender,\n uint256 value\n ) internal {\n uint256 newAllowance = token.allowance(address(this), spender) + value;\n _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, newAllowance));\n }\n\n function safeDecreaseAllowance(\n IERC20 token,\n address spender,\n uint256 value\n ) internal {\n unchecked {\n uint256 oldAllowance = token.allowance(address(this), spender);\n require(oldAllowance >= value, \"SafeERC20: decreased allowance below zero\");\n uint256 newAllowance = oldAllowance - value;\n _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, newAllowance));\n }\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 if (returndata.length > 0) {\n // Return data is optional\n require(abi.decode(returndata, (bool)), \"SafeERC20: ERC20 operation did not succeed\");\n }\n }\n}\n" }, "@openzeppelin/contracts/utils/Address.sol": { - "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts v4.4.1 (utils/Address.sol)\n\npragma solidity ^0.8.0;\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 */\n function isContract(address account) internal view returns (bool) {\n // This method relies on extcodesize, which returns 0 for contracts in\n // construction, since the code is only stored at the end of the\n // constructor execution.\n\n uint256 size;\n assembly {\n size := extcodesize(account)\n }\n return size > 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://diligence.consensys.net/posts/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.5.11/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 functionCall(target, data, \"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(\n address target,\n bytes memory data,\n uint256 value\n ) 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 require(isContract(target), \"Address: call to non-contract\");\n\n (bool success, bytes memory returndata) = target.call{value: value}(data);\n return verifyCallResult(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 require(isContract(target), \"Address: static call to non-contract\");\n\n (bool success, bytes memory returndata) = target.staticcall(data);\n return verifyCallResult(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 require(isContract(target), \"Address: delegate call to non-contract\");\n\n (bool success, bytes memory returndata) = target.delegatecall(data);\n return verifyCallResult(success, returndata, errorMessage);\n }\n\n /**\n * @dev Tool to verifies that a low level call was successful, and revert if it wasn't, either by bubbling the\n * revert reason 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 // 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\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}\n" + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.5.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 *\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://diligence.consensys.net/posts/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.5.11/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 functionCall(target, data, \"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(\n address target,\n bytes memory data,\n uint256 value\n ) 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 require(isContract(target), \"Address: call to non-contract\");\n\n (bool success, bytes memory returndata) = target.call{value: value}(data);\n return verifyCallResult(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 require(isContract(target), \"Address: static call to non-contract\");\n\n (bool success, bytes memory returndata) = target.staticcall(data);\n return verifyCallResult(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 require(isContract(target), \"Address: delegate call to non-contract\");\n\n (bool success, bytes memory returndata) = target.delegatecall(data);\n return verifyCallResult(success, returndata, errorMessage);\n }\n\n /**\n * @dev Tool to verifies that a low level call was successful, and revert if it wasn't, either by bubbling the\n * revert reason 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 // 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\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}\n" + }, + "contracts/SpokePoolInterface.sol": { + "content": "// SPDX-License-Identifier: GPL-3.0-only\npragma solidity ^0.8.0;\n\n/**\n * @notice Contains common data structures and functions used by all SpokePool implementations.\n */\ninterface SpokePoolInterface {\n // This leaf is meant to be decoded in the SpokePool to pay out successful relayers.\n struct RelayerRefundLeaf {\n // This is the amount to return to the HubPool. This occurs when there is a PoolRebalanceLeaf netSendAmount that\n // is negative. This is just the negative of this value.\n uint256 amountToReturn;\n // Used to verify that this is being executed on the correct destination chainId.\n uint256 chainId;\n // This array designates how much each of those addresses should be refunded.\n uint256[] refundAmounts;\n // Used as the index in the bitmap to track whether this leaf has been executed or not.\n uint32 leafId;\n // The associated L2TokenAddress that these claims apply to.\n address l2TokenAddress;\n // Must be same length as refundAmounts and designates each address that must be refunded.\n address[] refundAddresses;\n }\n\n // This struct represents the data to fully specify a relay. If any portion of this data differs, the relay is\n // considered to be completely distinct. Only one relay for a particular depositId, chainId pair should be\n // considered valid and repaid. This data is hashed and inserted into the slow relay merkle root so that an off\n // chain validator can choose when to refund slow relayers.\n struct RelayData {\n // The address that made the deposit on the origin chain.\n address depositor;\n // The recipient address on the destination chain.\n address recipient;\n // The corresponding token address on the destination chain.\n address destinationToken;\n // The total relay amount before fees are taken out.\n uint256 amount;\n // Origin chain id.\n uint256 originChainId;\n // Destination chain id.\n uint256 destinationChainId;\n // The LP Fee percentage computed by the relayer based on the deposit's quote timestamp\n // and the HubPool's utilization.\n uint64 realizedLpFeePct;\n // The relayer fee percentage specified in the deposit.\n uint64 relayerFeePct;\n // The id uniquely identifying this deposit on the origin chain.\n uint32 depositId;\n }\n\n // Stores collection of merkle roots that can be published to this contract from the HubPool, which are referenced\n // by \"data workers\" via inclusion proofs to execute leaves in the roots.\n struct RootBundle {\n // Merkle root of slow relays that were not fully filled and whose recipient is still owed funds from the LP pool.\n bytes32 slowRelayRoot;\n // Merkle root of relayer refunds for successful relays.\n bytes32 relayerRefundRoot;\n // This is a 2D bitmap tracking which leaves in the relayer refund root have been claimed, with max size of\n // 256x256 leaves per root.\n mapping(uint256 => uint256) claimedBitmap;\n }\n\n function setCrossDomainAdmin(address newCrossDomainAdmin) external;\n\n function setHubPool(address newHubPool) external;\n\n function setEnableRoute(\n address originToken,\n uint256 destinationChainId,\n bool enable\n ) external;\n\n function setDepositQuoteTimeBuffer(uint32 buffer) external;\n\n function relayRootBundle(bytes32 relayerRefundRoot, bytes32 slowRelayRoot) external;\n\n function emergencyDeleteRootBundle(uint256 rootBundleId) external;\n\n function deposit(\n address recipient,\n address originToken,\n uint256 amount,\n uint256 destinationChainId,\n uint64 relayerFeePct,\n uint32 quoteTimestamp\n ) external payable;\n\n function speedUpDeposit(\n address depositor,\n uint64 newRelayerFeePct,\n uint32 depositId,\n bytes memory depositorSignature\n ) external;\n\n function fillRelay(\n address depositor,\n address recipient,\n address destinationToken,\n uint256 amount,\n uint256 maxTokensToSend,\n uint256 repaymentChainId,\n uint256 originChainId,\n uint64 realizedLpFeePct,\n uint64 relayerFeePct,\n uint32 depositId\n ) external;\n\n function fillRelayWithUpdatedFee(\n address depositor,\n address recipient,\n address destinationToken,\n uint256 amount,\n uint256 maxTokensToSend,\n uint256 repaymentChainId,\n uint256 originChainId,\n uint64 realizedLpFeePct,\n uint64 relayerFeePct,\n uint64 newRelayerFeePct,\n uint32 depositId,\n bytes memory depositorSignature\n ) external;\n\n function executeSlowRelayRoot(\n address depositor,\n address recipient,\n address destinationToken,\n uint256 amount,\n uint256 originChainId,\n uint64 realizedLpFeePct,\n uint64 relayerFeePct,\n uint32 depositId,\n uint32 rootBundleId,\n bytes32[] memory proof\n ) external;\n\n function executeRelayerRefundRoot(\n uint32 rootBundleId,\n SpokePoolInterface.RelayerRefundLeaf memory relayerRefundLeaf,\n bytes32[] memory proof\n ) external;\n\n function chainId() external view returns (uint256);\n}\n" }, "@openzeppelin/contracts/utils/cryptography/MerkleProof.sol": { - "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts v4.4.1 (utils/cryptography/MerkleProof.sol)\n\npragma solidity ^0.8.0;\n\n/**\n * @dev These functions deal with verification of Merkle Trees proofs.\n *\n * The proofs can be generated using the JavaScript library\n * https://github.com/miguelmota/merkletreejs[merkletreejs].\n * Note: the hashing algorithm should be keccak256 and pair sorting should be enabled.\n *\n * See `test/utils/cryptography/MerkleProof.test.js` for some examples.\n */\nlibrary MerkleProof {\n /**\n * @dev Returns true if a `leaf` can be proved to be a part of a Merkle tree\n * defined by `root`. For this, a `proof` must be provided, containing\n * sibling hashes on the branch from the leaf to the root of the tree. Each\n * pair of leaves and each pair of pre-images are assumed to be sorted.\n */\n function verify(\n bytes32[] memory proof,\n bytes32 root,\n bytes32 leaf\n ) internal pure returns (bool) {\n return processProof(proof, leaf) == root;\n }\n\n /**\n * @dev Returns the rebuilt hash obtained by traversing a Merklee tree up\n * from `leaf` using `proof`. A `proof` is valid if and only if the rebuilt\n * hash matches the root of the tree. When processing the proof, the pairs\n * of leafs & pre-images are assumed to be sorted.\n *\n * _Available since v4.4._\n */\n function processProof(bytes32[] memory proof, bytes32 leaf) internal pure returns (bytes32) {\n bytes32 computedHash = leaf;\n for (uint256 i = 0; i < proof.length; i++) {\n bytes32 proofElement = proof[i];\n if (computedHash <= proofElement) {\n // Hash(current computed hash + current element of the proof)\n computedHash = keccak256(abi.encodePacked(computedHash, proofElement));\n } else {\n // Hash(current element of the proof + current computed hash)\n computedHash = keccak256(abi.encodePacked(proofElement, computedHash));\n }\n }\n return computedHash;\n }\n}\n" + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.5.0) (utils/cryptography/MerkleProof.sol)\n\npragma solidity ^0.8.0;\n\n/**\n * @dev These functions deal with verification of Merkle Trees proofs.\n *\n * The proofs can be generated using the JavaScript library\n * https://github.com/miguelmota/merkletreejs[merkletreejs].\n * Note: the hashing algorithm should be keccak256 and pair sorting should be enabled.\n *\n * See `test/utils/cryptography/MerkleProof.test.js` for some examples.\n */\nlibrary MerkleProof {\n /**\n * @dev Returns true if a `leaf` can be proved to be a part of a Merkle tree\n * defined by `root`. For this, a `proof` must be provided, containing\n * sibling hashes on the branch from the leaf to the root of the tree. Each\n * pair of leaves and each pair of pre-images are assumed to be sorted.\n */\n function verify(\n bytes32[] memory proof,\n bytes32 root,\n bytes32 leaf\n ) internal pure returns (bool) {\n return processProof(proof, leaf) == root;\n }\n\n /**\n * @dev Returns the rebuilt hash obtained by traversing a Merklee tree up\n * from `leaf` using `proof`. A `proof` is valid if and only if the rebuilt\n * hash matches the root of the tree. When processing the proof, the pairs\n * of leafs & pre-images are assumed to be sorted.\n *\n * _Available since v4.4._\n */\n function processProof(bytes32[] memory proof, bytes32 leaf) internal pure returns (bytes32) {\n bytes32 computedHash = leaf;\n for (uint256 i = 0; i < proof.length; i++) {\n bytes32 proofElement = proof[i];\n if (computedHash <= proofElement) {\n // Hash(current computed hash + current element of the proof)\n computedHash = _efficientHash(computedHash, proofElement);\n } else {\n // Hash(current element of the proof + current computed hash)\n computedHash = _efficientHash(proofElement, computedHash);\n }\n }\n return computedHash;\n }\n\n function _efficientHash(bytes32 a, bytes32 b) private pure returns (bytes32 value) {\n assembly {\n mstore(0x00, a)\n mstore(0x20, b)\n value := keccak256(0x00, 0x40)\n }\n }\n}\n" }, - "contracts/SpokePoolInterface.sol": { - "content": "//SPDX-License-Identifier: Unlicense\r\npragma solidity ^0.8.0;\r\n\r\ninterface SpokePoolInterface {\r\n // This leaf is meant to be decoded in the SpokePool in order to pay out individual relayers for this bundle.\r\n struct RelayerRefundLeaf {\r\n // This is the amount to return to the HubPool. This occurs when there is a PoolRebalanceLeaf netSendAmount that is\r\n // negative. This is just that value inverted.\r\n uint256 amountToReturn;\r\n // Used to verify that this is being decoded on the correct chainId.\r\n uint256 chainId;\r\n // This array designates how much each of those addresses should be refunded.\r\n uint256[] refundAmounts;\r\n // Used as the index in the bitmap to track whether this leaf has been executed or not.\r\n uint32 leafId;\r\n // The associated L2TokenAddress that these claims apply to.\r\n address l2TokenAddress;\r\n // These two arrays must be the same length and are parallel arrays. They should be order by refundAddresses.\r\n // This array designates each address that must be refunded.\r\n address[] refundAddresses;\r\n }\r\n\r\n // This struct represents the data to fully-specify a relay. If any portion of this data differs, the relay is\r\n // considered to be completely distinct. Only one relay for a particular depositId, chainId pair should be\r\n // considered valid and repaid.\r\n struct RelayData {\r\n // The address that made the deposit on the origin chain.\r\n address depositor;\r\n // The recipient address on the destination chain.\r\n address recipient;\r\n // The corresponding token address on the destination chain.\r\n address destinationToken;\r\n // The total relay amount before fees are taken out.\r\n uint256 relayAmount;\r\n // Origin chain id.\r\n uint256 originChainId;\r\n // The LP Fee percentage computed by the relayer based on the deposit's quote timestamp\r\n // and the HubPool's utilization.\r\n uint64 realizedLpFeePct;\r\n // The relayer fee percentage specified in the deposit.\r\n uint64 relayerFeePct;\r\n // The id uniquely identifying this deposit on the origin chain.\r\n uint32 depositId;\r\n }\r\n\r\n function setCrossDomainAdmin(address newCrossDomainAdmin) external;\r\n\r\n function setHubPool(address newHubPool) external;\r\n\r\n function setEnableRoute(\r\n address originToken,\r\n uint256 destinationChainId,\r\n bool enable\r\n ) external;\r\n\r\n function setDepositQuoteTimeBuffer(uint32 buffer) external;\r\n\r\n function relayRootBundle(bytes32 relayerRefundRoot, bytes32 slowRelayRoot) external;\r\n}\r\n" + "contracts/interfaces/AdapterInterface.sol": { + "content": "// SPDX-License-Identifier: AGPL-3.0-only\npragma solidity ^0.8.0;\n\n/**\n * @notice Sends cross chain messages and tokens to contracts on a specific L2 network.\n */\n\ninterface AdapterInterface {\n event MessageRelayed(address target, bytes message);\n\n event TokensRelayed(address l1Token, address l2Token, uint256 amount, address to);\n\n function relayMessage(address target, bytes memory message) external payable;\n\n function relayTokens(\n address l1Token,\n address l2Token,\n uint256 amount,\n address to\n ) external payable;\n}\n" }, "@uma/core/contracts/common/implementation/Timer.sol": { "content": "// SPDX-License-Identifier: AGPL-3.0-only\npragma solidity ^0.8.0;\n\n/**\n * @title Universal store of current contract time for testing environments.\n */\ncontract Timer {\n uint256 private currentTime;\n\n constructor() {\n currentTime = block.timestamp; // solhint-disable-line not-rely-on-time\n }\n\n /**\n * @notice Sets the current time.\n * @dev Will revert if not running in test mode.\n * @param time timestamp to set `currentTime` to.\n */\n function setCurrentTime(uint256 time) external {\n currentTime = time;\n }\n\n /**\n * @notice Gets the currentTime variable set in the Timer.\n * @return uint256 for the current Testable timestamp.\n */\n function getCurrentTime() public view returns (uint256) {\n return currentTime;\n }\n}\n" diff --git a/deployments/rinkeby/solcInputs/a1881af3726e467ac35772874a89bba0.json b/deployments/rinkeby/solcInputs/a1881af3726e467ac35772874a89bba0.json deleted file mode 100644 index 9d0c51bba..000000000 --- a/deployments/rinkeby/solcInputs/a1881af3726e467ac35772874a89bba0.json +++ /dev/null @@ -1,195 +0,0 @@ -{ - "language": "Solidity", - "sources": { - "contracts/Arbitrum_SpokePool.sol": { - "content": "//SPDX-License-Identifier: Unlicense\r\npragma solidity ^0.8.0;\r\n\r\nimport \"./SpokePool.sol\";\r\nimport \"./SpokePoolInterface.sol\";\r\n\r\ninterface StandardBridgeLike {\r\n function outboundTransfer(\r\n address _l1Token,\r\n address _to,\r\n uint256 _amount,\r\n bytes calldata _data\r\n ) external payable returns (bytes memory);\r\n}\r\n\r\n/**\r\n * @notice AVM specific SpokePool.\r\n * @dev Uses AVM cross-domain-enabled logic for access control.\r\n */\r\n\r\ncontract Arbitrum_SpokePool is SpokePoolInterface, SpokePool {\r\n // Address of the Arbitrum L2 token gateway.\r\n address public l2GatewayRouter;\r\n\r\n // Admin controlled mapping of arbitrum tokens to L1 counterpart. L1 counterpart addresses\r\n // are neccessary to bridge tokens to L1.\r\n mapping(address => address) public whitelistedTokens;\r\n\r\n event ArbitrumTokensBridged(address indexed l1Token, address target, uint256 numberOfTokensBridged);\r\n event SetL2GatewayRouter(address indexed newL2GatewayRouter);\r\n event WhitelistedTokens(address indexed l2Token, address indexed l1Token);\r\n\r\n constructor(\r\n address _l2GatewayRouter,\r\n address _crossDomainAdmin,\r\n address _hubPool,\r\n address _wethAddress,\r\n address timerAddress\r\n ) SpokePool(_crossDomainAdmin, _hubPool, _wethAddress, timerAddress) {\r\n _setL2GatewayRouter(_l2GatewayRouter);\r\n }\r\n\r\n modifier onlyFromCrossDomainAdmin() {\r\n require(msg.sender == _applyL1ToL2Alias(crossDomainAdmin), \"ONLY_COUNTERPART_GATEWAY\");\r\n _;\r\n }\r\n\r\n /**************************************\r\n * CROSS-CHAIN ADMIN FUNCTIONS *\r\n **************************************/\r\n\r\n function setL2GatewayRouter(address newL2GatewayRouter) public onlyFromCrossDomainAdmin nonReentrant {\r\n _setL2GatewayRouter(newL2GatewayRouter);\r\n }\r\n\r\n function whitelistToken(address l2Token, address l1Token) public onlyFromCrossDomainAdmin nonReentrant {\r\n _whitelistToken(l2Token, l1Token);\r\n }\r\n\r\n function setCrossDomainAdmin(address newCrossDomainAdmin) public override onlyFromCrossDomainAdmin nonReentrant {\r\n _setCrossDomainAdmin(newCrossDomainAdmin);\r\n }\r\n\r\n function setHubPool(address newHubPool) public override onlyFromCrossDomainAdmin nonReentrant {\r\n _setHubPool(newHubPool);\r\n }\r\n\r\n function setEnableRoute(\r\n address originToken,\r\n uint256 destinationChainId,\r\n bool enable\r\n ) public override onlyFromCrossDomainAdmin nonReentrant {\r\n _setEnableRoute(originToken, destinationChainId, enable);\r\n }\r\n\r\n function setDepositQuoteTimeBuffer(uint32 buffer) public override onlyFromCrossDomainAdmin nonReentrant {\r\n _setDepositQuoteTimeBuffer(buffer);\r\n }\r\n\r\n function relayRootBundle(bytes32 relayerRefundRoot, bytes32 slowRelayFulfillmentRoot)\r\n public\r\n override\r\n onlyFromCrossDomainAdmin\r\n nonReentrant\r\n {\r\n _relayRootBundle(relayerRefundRoot, slowRelayFulfillmentRoot);\r\n }\r\n\r\n /**************************************\r\n * INTERNAL FUNCTIONS *\r\n **************************************/\r\n\r\n function _bridgeTokensToHubPool(RelayerRefundLeaf memory relayerRefundLeaf) internal override {\r\n StandardBridgeLike(l2GatewayRouter).outboundTransfer(\r\n whitelistedTokens[relayerRefundLeaf.l2TokenAddress], // _l1Token. Address of the L1 token to bridge over.\r\n hubPool, // _to. Withdraw, over the bridge, to the l1 hub pool contract.\r\n relayerRefundLeaf.amountToReturn, // _amount.\r\n \"\" // _data. We don't need to send any data for the bridging action.\r\n );\r\n emit ArbitrumTokensBridged(address(0), hubPool, relayerRefundLeaf.amountToReturn);\r\n }\r\n\r\n function _setL2GatewayRouter(address _l2GatewayRouter) internal {\r\n l2GatewayRouter = _l2GatewayRouter;\r\n emit SetL2GatewayRouter(l2GatewayRouter);\r\n }\r\n\r\n function _whitelistToken(address _l2Token, address _l1Token) internal {\r\n whitelistedTokens[_l2Token] = _l1Token;\r\n emit WhitelistedTokens(_l2Token, _l1Token);\r\n }\r\n\r\n // l1 addresses are transformed during l1->l2 calls. See https://developer.offchainlabs.com/docs/l1_l2_messages#address-aliasing for more information.\r\n function _applyL1ToL2Alias(address l1Address) internal pure returns (address l2Address) {\r\n unchecked {\r\n l2Address = address(uint160(l1Address) + uint160(0x1111000000000000000000000000000000001111));\r\n }\r\n }\r\n}\r\n" - }, - "contracts/SpokePool.sol": { - "content": "// SPDX-License-Identifier: GPL-3.0-only\r\npragma solidity ^0.8.0;\r\n\r\nimport \"./MerkleLib.sol\";\r\nimport \"./interfaces/WETH9.sol\";\r\n\r\nimport \"@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol\";\r\nimport \"@openzeppelin/contracts/token/ERC20/IERC20.sol\";\r\nimport \"@openzeppelin/contracts/utils/Address.sol\";\r\n\r\nimport \"@openzeppelin/contracts/utils/cryptography/SignatureChecker.sol\";\r\nimport \"@openzeppelin/contracts/utils/cryptography/ECDSA.sol\";\r\n\r\nimport \"@uma/core/contracts/common/implementation/Testable.sol\";\r\nimport \"@uma/core/contracts/common/implementation/Lockable.sol\";\r\nimport \"@uma/core/contracts/common/implementation/MultiCaller.sol\";\r\nimport \"./MerkleLib.sol\";\r\nimport \"./SpokePoolInterface.sol\";\r\n\r\n/**\r\n * @title SpokePool\r\n * @notice Contract deployed on source and destination chains enabling depositors to transfer assets from source to\r\n * destination. Deposit orders are fulfilled by off-chain relayers who also interact with this contract. Deposited\r\n * tokens are locked on the source chain and relayers send the recipient the desired token currency and amount\r\n * on the destination chain. Locked source chain tokens are later sent over the canonical token bridge to L1.\r\n * @dev This contract is designed to be deployed to L2's, not mainnet.\r\n */\r\nabstract contract SpokePool is SpokePoolInterface, Testable, Lockable, MultiCaller {\r\n using SafeERC20 for IERC20;\r\n using Address for address;\r\n\r\n // Address of the L1 contract that acts as the owner of this SpokePool.\r\n address public crossDomainAdmin;\r\n\r\n // Address of the L1 contract that will send tokens to and receive tokens from this contract.\r\n address public hubPool;\r\n\r\n // Address of WETH contract for this network. If an origin token matches this, then the caller can optionally\r\n // instruct this contract to wrap ETH when depositing.\r\n WETH9 public weth;\r\n\r\n // Timestamp when contract was constructed. Relays cannot have a quote time before this.\r\n uint32 public deploymentTime;\r\n\r\n // Any deposit quote times greater than or less than this value to the current contract time is blocked. Forces\r\n // caller to use an up to date realized fee. Defaults to 10 minutes.\r\n uint32 public depositQuoteTimeBuffer = 600;\r\n\r\n // Use count of deposits as unique deposit identifier.\r\n uint32 public numberOfDeposits;\r\n\r\n // Origin token to destination token routings can be turned on or off.\r\n mapping(address => mapping(uint256 => bool)) public enabledDepositRoutes;\r\n\r\n struct RootBundle {\r\n // Merkle root of slow relays that were not fully filled and whose recipient is still owed funds from the LP pool.\r\n bytes32 slowRelayFulfillmentRoot;\r\n // Merkle root of relayer refunds.\r\n bytes32 relayerRefundRoot;\r\n // This is a 2D bitmap tracking which leafs in the relayer refund root have been claimed, with max size of\r\n // 256x256 leaves per root.\r\n mapping(uint256 => uint256) claimedBitmap;\r\n }\r\n RootBundle[] public rootBundles;\r\n\r\n // Each relay is associated with the hash of parameters that uniquely identify the original deposit and a relay\r\n // attempt for that deposit. The relay itself is just represented as the amount filled so far. The total amount to\r\n // relay, the fees, and the agents are all parameters included in the hash key.\r\n mapping(bytes32 => uint256) public relayFills;\r\n\r\n /****************************************\r\n * EVENTS *\r\n ****************************************/\r\n event SetXDomainAdmin(address indexed newAdmin);\r\n event SetHubPool(address indexed newHubPool);\r\n event EnabledDepositRoute(address indexed originToken, uint256 indexed destinationChainId, bool enabled);\r\n event SetDepositQuoteTimeBuffer(uint32 newBuffer);\r\n event FundsDeposited(\r\n uint256 amount,\r\n uint256 destinationChainId,\r\n uint64 relayerFeePct,\r\n uint32 indexed depositId,\r\n uint32 quoteTimestamp,\r\n address indexed originToken,\r\n address recipient,\r\n address indexed depositor\r\n );\r\n event FilledRelay(\r\n bytes32 indexed relayHash,\r\n uint256 totalRelayAmount,\r\n uint256 totalFilledAmount,\r\n uint256 fillAmount,\r\n uint256 indexed repaymentChain,\r\n uint256 originChainId,\r\n uint64 relayerFeePct,\r\n uint64 realizedLpFeePct,\r\n uint32 depositId,\r\n address destinationToken,\r\n address indexed relayer,\r\n address depositor,\r\n address recipient\r\n );\r\n event ExecutedSlowRelayFulfillmentRoot(\r\n bytes32 indexed relayHash,\r\n uint256 totalRelayAmount,\r\n uint256 totalFilledAmount,\r\n uint256 fillAmount,\r\n uint256 originChainId,\r\n uint64 relayerFeePct,\r\n uint64 realizedLpFeePct,\r\n uint32 depositId,\r\n address destinationToken,\r\n address indexed caller,\r\n address depositor,\r\n address recipient\r\n );\r\n event RelayedRootBundle(uint32 indexed rootBundleId, bytes32 relayerRefundRoot, bytes32 slowRelayFulfillmentRoot);\r\n event ExecutedRelayerRefundRoot(\r\n uint256 amountToReturn,\r\n uint256 chainId,\r\n uint256[] refundAmounts,\r\n uint32 indexed rootBundleId,\r\n uint32 indexed leafId,\r\n address l2TokenAddress,\r\n address[] refundAddresses,\r\n address indexed caller\r\n );\r\n event TokensBridged(\r\n uint256 amountToReturn,\r\n uint256 indexed chainId,\r\n uint32 indexed leafId,\r\n address indexed l2TokenAddress,\r\n address caller\r\n );\r\n\r\n constructor(\r\n address _crossDomainAdmin,\r\n address _hubPool,\r\n address _wethAddress,\r\n address timerAddress\r\n ) Testable(timerAddress) {\r\n _setCrossDomainAdmin(_crossDomainAdmin);\r\n _setHubPool(_hubPool);\r\n deploymentTime = uint32(getCurrentTime());\r\n weth = WETH9(_wethAddress);\r\n }\r\n\r\n /****************************************\r\n * MODIFIERS *\r\n ****************************************/\r\n\r\n modifier onlyEnabledRoute(address originToken, uint256 destinationId) {\r\n require(enabledDepositRoutes[originToken][destinationId], \"Disabled route\");\r\n _;\r\n }\r\n\r\n /**************************************\r\n * ADMIN FUNCTIONS *\r\n **************************************/\r\n\r\n function _setCrossDomainAdmin(address newCrossDomainAdmin) internal {\r\n require(newCrossDomainAdmin != address(0), \"Bad bridge router address\");\r\n crossDomainAdmin = newCrossDomainAdmin;\r\n emit SetXDomainAdmin(crossDomainAdmin);\r\n }\r\n\r\n function _setHubPool(address newHubPool) internal {\r\n require(newHubPool != address(0), \"Bad hub pool address\");\r\n hubPool = newHubPool;\r\n emit SetHubPool(hubPool);\r\n }\r\n\r\n function _setEnableRoute(\r\n address originToken,\r\n uint256 destinationChainId,\r\n bool enabled\r\n ) internal {\r\n enabledDepositRoutes[originToken][destinationChainId] = enabled;\r\n emit EnabledDepositRoute(originToken, destinationChainId, enabled);\r\n }\r\n\r\n function _setDepositQuoteTimeBuffer(uint32 _depositQuoteTimeBuffer) internal {\r\n depositQuoteTimeBuffer = _depositQuoteTimeBuffer;\r\n emit SetDepositQuoteTimeBuffer(_depositQuoteTimeBuffer);\r\n }\r\n\r\n /**************************************\r\n * DEPOSITOR FUNCTIONS *\r\n **************************************/\r\n\r\n /**\r\n * @notice Called by user to bridge funds from origin to destination chain.\r\n * @dev The caller must first approve this contract to spend `amount` of `originToken`.\r\n */\r\n function deposit(\r\n address recipient,\r\n address originToken,\r\n uint256 amount,\r\n uint256 destinationChainId,\r\n uint64 relayerFeePct,\r\n uint32 quoteTimestamp\r\n ) public payable onlyEnabledRoute(originToken, destinationChainId) nonReentrant {\r\n // We limit the relay fees to prevent the user spending all their funds on fees.\r\n require(relayerFeePct <= 0.5e18, \"invalid relayer fee\");\r\n // Note We assume that L2 timing cannot be compared accurately and consistently to L1 timing. Therefore,\r\n // `block.timestamp` is different from the L1 EVM's. Therefore, the quoteTimestamp must be within a configurable\r\n // buffer to allow for this variance.\r\n // Note also that `quoteTimestamp` cannot be less than the buffer otherwise the following arithmetic can result\r\n // in underflow. This isn't a problem as the deposit will revert, but the error might be unexpected for clients.\r\n require(\r\n getCurrentTime() >= quoteTimestamp - depositQuoteTimeBuffer &&\r\n getCurrentTime() <= quoteTimestamp + depositQuoteTimeBuffer,\r\n \"invalid quote time\"\r\n );\r\n // If the address of the origin token is a WETH contract and there is a msg.value with the transaction\r\n // then the user is sending ETH. In this case, the ETH should be deposited to WETH.\r\n if (originToken == address(weth) && msg.value > 0) {\r\n require(msg.value == amount, \"msg.value must match amount\");\r\n weth.deposit{ value: msg.value }();\r\n } else {\r\n // Else, it is a normal ERC20. In this case pull the token from the users wallet as per normal.\r\n // Note: this includes the case where the L2 user has WETH (already wrapped ETH) and wants to bridge them. In\r\n // this case the msg.value will be set to 0, indicating a \"normal\" ERC20 bridging action.\r\n IERC20(originToken).safeTransferFrom(msg.sender, address(this), amount);\r\n }\r\n\r\n emit FundsDeposited(\r\n amount,\r\n destinationChainId,\r\n relayerFeePct,\r\n numberOfDeposits,\r\n quoteTimestamp,\r\n originToken,\r\n recipient,\r\n msg.sender\r\n );\r\n\r\n numberOfDeposits += 1;\r\n }\r\n\r\n /**************************************\r\n * RELAYER FUNCTIONS *\r\n **************************************/\r\n\r\n function fillRelay(\r\n address depositor,\r\n address recipient,\r\n address destinationToken,\r\n uint256 totalRelayAmount,\r\n uint256 maxTokensToSend,\r\n uint256 repaymentChain,\r\n uint256 originChainId,\r\n uint64 realizedLpFeePct,\r\n uint64 relayerFeePct,\r\n uint32 depositId\r\n ) public nonReentrant {\r\n // Each relay attempt is mapped to the hash of data uniquely identifying it, which includes the deposit data\r\n // such as the origin chain ID and the deposit ID, and the data in a relay attempt such as who the recipient\r\n // is, which chain and currency the recipient wants to receive funds on, and the relay fees.\r\n SpokePoolInterface.RelayData memory relayData = SpokePoolInterface.RelayData({\r\n depositor: depositor,\r\n recipient: recipient,\r\n destinationToken: destinationToken,\r\n relayAmount: totalRelayAmount,\r\n realizedLpFeePct: realizedLpFeePct,\r\n relayerFeePct: relayerFeePct,\r\n depositId: depositId,\r\n originChainId: originChainId\r\n });\r\n bytes32 relayHash = _getRelayHash(relayData);\r\n\r\n uint256 fillAmountPreFees = _fillRelay(relayHash, relayData, maxTokensToSend, relayerFeePct, false);\r\n\r\n _emitFillRelay(relayHash, fillAmountPreFees, repaymentChain, relayerFeePct, relayData);\r\n }\r\n\r\n function fillRelayWithUpdatedFee(\r\n address depositor,\r\n address recipient,\r\n address destinationToken,\r\n uint256 totalRelayAmount,\r\n uint256 maxTokensToSend,\r\n uint256 repaymentChain,\r\n uint256 originChainId,\r\n uint64 realizedLpFeePct,\r\n uint64 relayerFeePct,\r\n uint64 newRelayerFeePct,\r\n uint32 depositId,\r\n bytes memory depositorSignature\r\n ) public nonReentrant {\r\n // Grouping the signature validation logic into brackets to address stack too deep error.\r\n {\r\n // Depositor should have signed a hash of the relayer fee % to update to and information uniquely identifying\r\n // the deposit to relay. This ensures that this signature cannot be re-used for other deposits. The version\r\n // string is included as a precaution in case this contract is upgraded.\r\n // Note: we use encode instead of encodePacked because it is more secure, more in the \"warning\" section\r\n // here: https://docs.soliditylang.org/en/v0.8.11/abi-spec.html#non-standard-packed-mode\r\n bytes32 expectedDepositorMessageHash = keccak256(\r\n abi.encode(\"ACROSS-V2-FEE-1.0\", newRelayerFeePct, depositId, originChainId)\r\n );\r\n\r\n // Check the hash corresponding to the https://eth.wiki/json-rpc/API#eth_sign[`eth_sign`]\r\n // JSON-RPC method as part of EIP-191. We use OZ's signature checker library with adds support for\r\n // EIP-1271 which can verify messages signed by smart contract wallets like Argent and Gnosis safes.\r\n // If the depositor signed a message with a different updated fee (or any other param included in the\r\n // above keccak156 hash), then this will revert.\r\n bytes32 ethSignedMessageHash = ECDSA.toEthSignedMessageHash(expectedDepositorMessageHash);\r\n\r\n _verifyDepositorUpdateFeeMessage(depositor, ethSignedMessageHash, depositorSignature);\r\n }\r\n\r\n // Now follow the default `fillRelay` flow with the updated fee and the original relay hash.\r\n RelayData memory relayData = RelayData({\r\n depositor: depositor,\r\n recipient: recipient,\r\n destinationToken: destinationToken,\r\n relayAmount: totalRelayAmount,\r\n realizedLpFeePct: realizedLpFeePct,\r\n relayerFeePct: relayerFeePct,\r\n depositId: depositId,\r\n originChainId: originChainId\r\n });\r\n bytes32 relayHash = _getRelayHash(relayData);\r\n uint256 fillAmountPreFees = _fillRelay(relayHash, relayData, maxTokensToSend, newRelayerFeePct, false);\r\n\r\n _emitFillRelay(relayHash, fillAmountPreFees, repaymentChain, newRelayerFeePct, relayData);\r\n }\r\n\r\n /**************************************\r\n * DATA WORKER FUNCTIONS *\r\n **************************************/\r\n function executeSlowRelayFulfillmentRoot(\r\n address depositor,\r\n address recipient,\r\n address destinationToken,\r\n uint256 totalRelayAmount,\r\n uint256 originChainId,\r\n uint64 realizedLpFeePct,\r\n uint64 relayerFeePct,\r\n uint32 depositId,\r\n uint32 rootBundleId,\r\n bytes32[] memory proof\r\n ) public nonReentrant {\r\n RelayData memory relayData = RelayData({\r\n depositor: depositor,\r\n recipient: recipient,\r\n destinationToken: destinationToken,\r\n relayAmount: totalRelayAmount,\r\n originChainId: originChainId,\r\n realizedLpFeePct: realizedLpFeePct,\r\n relayerFeePct: relayerFeePct,\r\n depositId: depositId\r\n });\r\n\r\n require(\r\n MerkleLib.verifySlowRelayFulfillment(rootBundles[rootBundleId].slowRelayFulfillmentRoot, relayData, proof),\r\n \"Invalid proof\"\r\n );\r\n\r\n bytes32 relayHash = _getRelayHash(relayData);\r\n\r\n // Wrap any ETH owned by this contract so we can send expected L2 token to recipient. This is neccessary because\r\n // some SpokePools will receive ETH from the canonical token bridge instead of WETH so this contract\r\n // might have built up an ETH balance.\r\n if (address(this).balance > 0) weth.deposit{ value: address(this).balance }();\r\n\r\n // Note: use relayAmount as the max amount to send, so the relay is always completely filled by the contract's\r\n // funds in all cases.\r\n uint256 fillAmountPreFees = _fillRelay(relayHash, relayData, relayData.relayAmount, relayerFeePct, true);\r\n\r\n _emitExecutedSlowRelayFulfillmentRoot(relayHash, fillAmountPreFees, relayData);\r\n }\r\n\r\n function executeRelayerRefundRoot(\r\n uint32 rootBundleId,\r\n SpokePoolInterface.RelayerRefundLeaf memory relayerRefundLeaf,\r\n bytes32[] memory proof\r\n ) public nonReentrant {\r\n // Check integrity of leaf structure:\r\n require(relayerRefundLeaf.chainId == chainId(), \"Invalid chainId\");\r\n require(relayerRefundLeaf.refundAddresses.length == relayerRefundLeaf.refundAmounts.length, \"invalid leaf\");\r\n\r\n RootBundle storage rootBundle = rootBundles[rootBundleId];\r\n\r\n // Check that `inclusionProof` proves that `relayerRefundLeaf` is contained within the relayer refund root.\r\n // Note: This should revert if the `relayerRefundRoot` is uninitialized.\r\n require(MerkleLib.verifyRelayerRefund(rootBundle.relayerRefundRoot, relayerRefundLeaf, proof), \"Bad Proof\");\r\n\r\n // Verify the leafId in the leaf has not yet been claimed.\r\n require(!MerkleLib.isClaimed(rootBundle.claimedBitmap, relayerRefundLeaf.leafId), \"Already claimed\");\r\n\r\n // Set leaf as claimed in bitmap.\r\n MerkleLib.setClaimed(rootBundle.claimedBitmap, relayerRefundLeaf.leafId);\r\n\r\n // Wrap any ETH owned by this contract so we can send expected L2 token to recipient. This is neccessary because\r\n // some SpokePools will receive ETH from the canonical token bridge instead of WETH.\r\n if (address(this).balance > 0) weth.deposit{ value: address(this).balance }();\r\n\r\n // Send each relayer refund address the associated refundAmount for the L2 token address.\r\n // Note: Even if the L2 token is not enabled on this spoke pool, we should still refund relayers.\r\n for (uint32 i = 0; i < relayerRefundLeaf.refundAmounts.length; i++) {\r\n uint256 amount = relayerRefundLeaf.refundAmounts[i];\r\n if (amount > 0)\r\n IERC20(relayerRefundLeaf.l2TokenAddress).safeTransfer(relayerRefundLeaf.refundAddresses[i], amount);\r\n }\r\n\r\n // If leaf's `amountToReturn` is positive, then send L2 --> L1 message to bridge tokens back via\r\n // chain-specific bridging method.\r\n if (relayerRefundLeaf.amountToReturn > 0) {\r\n _bridgeTokensToHubPool(relayerRefundLeaf);\r\n\r\n emit TokensBridged(\r\n relayerRefundLeaf.amountToReturn,\r\n relayerRefundLeaf.chainId,\r\n relayerRefundLeaf.leafId,\r\n relayerRefundLeaf.l2TokenAddress,\r\n msg.sender\r\n );\r\n }\r\n\r\n emit ExecutedRelayerRefundRoot(\r\n relayerRefundLeaf.amountToReturn,\r\n relayerRefundLeaf.chainId,\r\n relayerRefundLeaf.refundAmounts,\r\n rootBundleId,\r\n relayerRefundLeaf.leafId,\r\n relayerRefundLeaf.l2TokenAddress,\r\n relayerRefundLeaf.refundAddresses,\r\n msg.sender\r\n );\r\n }\r\n\r\n /**************************************\r\n * VIEW FUNCTIONS *\r\n **************************************/\r\n\r\n // Some L2s like ZKSync don't support the CHAIN_ID opcode so we allow the caller to manually set this.\r\n function chainId() public view virtual returns (uint256) {\r\n return block.chainid;\r\n }\r\n\r\n /**************************************\r\n * INTERNAL FUNCTIONS *\r\n **************************************/\r\n\r\n function _bridgeTokensToHubPool(SpokePoolInterface.RelayerRefundLeaf memory relayerRefundLeaf) internal virtual;\r\n\r\n // Allow L2 to implement chain specific recovering of signers from signatures because some L2s might not support\r\n // ecrecover, such as those with account abstraction like ZKSync.\r\n function _verifyDepositorUpdateFeeMessage(\r\n address depositor,\r\n bytes32 ethSignedMessageHash,\r\n bytes memory depositorSignature\r\n ) internal view virtual {\r\n // Note: no need to worry about reentrancy from contract deployed at `depositor` address since\r\n // `SignatureChecker.isValidSignatureNow` is a non state-modifying STATICCALL:\r\n // - https://github.com/OpenZeppelin/openzeppelin-contracts/blob/63b466901fb015538913f811c5112a2775042177/contracts/utils/cryptography/SignatureChecker.sol#L35\r\n // - https://github.com/ethereum/EIPs/pull/214\r\n require(\r\n SignatureChecker.isValidSignatureNow(depositor, ethSignedMessageHash, depositorSignature),\r\n \"invalid signature\"\r\n );\r\n }\r\n\r\n function _computeAmountPreFees(uint256 amount, uint64 feesPct) private pure returns (uint256) {\r\n return (1e18 * amount) / (1e18 - feesPct);\r\n }\r\n\r\n function _computeAmountPostFees(uint256 amount, uint64 feesPct) private pure returns (uint256) {\r\n return (amount * (1e18 - feesPct)) / 1e18;\r\n }\r\n\r\n // Should we make this public for the relayer's convenience?\r\n function _getRelayHash(SpokePoolInterface.RelayData memory relayData) private pure returns (bytes32) {\r\n return keccak256(abi.encode(relayData));\r\n }\r\n\r\n // Unwraps ETH and does a transfer to a recipient address. If the recipient is a smart contract then sends WETH.\r\n function _unwrapWETHTo(address payable to, uint256 amount) internal {\r\n if (address(to).isContract()) {\r\n IERC20(address(weth)).safeTransfer(to, amount);\r\n } else {\r\n weth.withdraw(amount);\r\n to.transfer(amount);\r\n }\r\n }\r\n\r\n // This internal method should be called by an external \"relayRootBundle\" function that validates the\r\n // cross domain sender is the HubPool. This validation step differs for each L2, which is why the implementation\r\n // specifics are left to the implementor of this abstract contract.\r\n // Once this method is executed and a distribution root is stored in this contract, then `distributeRootBundle`\r\n // can be called to execute each leaf in the root.\r\n function _relayRootBundle(bytes32 relayerRefundRoot, bytes32 slowRelayFulfillmentRoot) internal {\r\n uint32 rootBundleId = uint32(rootBundles.length);\r\n RootBundle storage rootBundle = rootBundles.push();\r\n rootBundle.relayerRefundRoot = relayerRefundRoot;\r\n rootBundle.slowRelayFulfillmentRoot = slowRelayFulfillmentRoot;\r\n emit RelayedRootBundle(rootBundleId, relayerRefundRoot, slowRelayFulfillmentRoot);\r\n }\r\n\r\n function _fillRelay(\r\n bytes32 relayHash,\r\n RelayData memory relayData,\r\n uint256 maxTokensToSend,\r\n uint64 updatableRelayerFeePct,\r\n bool isSlowRelay\r\n ) internal returns (uint256 fillAmountPreFees) {\r\n // We limit the relay fees to prevent the user spending all their funds on fees. Note that 0.5e18 (i.e. 50%)\r\n // fees are just magic numbers. The important point is to prevent the total fee from being 100%, otherwise\r\n // computing the amount pre fees runs into divide-by-0 issues.\r\n require(updatableRelayerFeePct < 0.5e18 && relayData.realizedLpFeePct < 0.5e18, \"invalid fees\");\r\n\r\n // Check that the relay has not already been completely filled. Note that the `relays` mapping will point to\r\n // the amount filled so far for a particular `relayHash`, so this will start at 0 and increment with each fill.\r\n require(relayFills[relayHash] < relayData.relayAmount, \"relay filled\");\r\n\r\n // Stores the equivalent amount to be sent by the relayer before fees have been taken out.\r\n fillAmountPreFees = 0;\r\n\r\n // Adding brackets \"stack too deep\" solidity error.\r\n if (maxTokensToSend > 0) {\r\n fillAmountPreFees = _computeAmountPreFees(\r\n maxTokensToSend,\r\n (relayData.realizedLpFeePct + updatableRelayerFeePct)\r\n );\r\n // If user's specified max amount to send is greater than the amount of the relay remaining pre-fees,\r\n // we'll pull exactly enough tokens to complete the relay.\r\n uint256 amountToSend = maxTokensToSend;\r\n if (relayData.relayAmount - relayFills[relayHash] < fillAmountPreFees) {\r\n fillAmountPreFees = relayData.relayAmount - relayFills[relayHash];\r\n amountToSend = _computeAmountPostFees(\r\n fillAmountPreFees,\r\n relayData.realizedLpFeePct + updatableRelayerFeePct\r\n );\r\n }\r\n relayFills[relayHash] += fillAmountPreFees;\r\n // If relay token is weth then unwrap and send eth.\r\n if (relayData.destinationToken == address(weth)) {\r\n // Note: WETH is already in the contract in the slow relay case.\r\n if (!isSlowRelay)\r\n IERC20(relayData.destinationToken).safeTransferFrom(msg.sender, address(this), amountToSend);\r\n _unwrapWETHTo(payable(relayData.recipient), amountToSend);\r\n // Else, this is a normal ERC20 token. Send to recipient.\r\n } else {\r\n // Note: send token directly from the contract to the user in the slow relay case.\r\n if (!isSlowRelay)\r\n IERC20(relayData.destinationToken).safeTransferFrom(msg.sender, relayData.recipient, amountToSend);\r\n else IERC20(relayData.destinationToken).safeTransfer(relayData.recipient, amountToSend);\r\n }\r\n }\r\n }\r\n\r\n function _emitFillRelay(\r\n bytes32 relayHash,\r\n uint256 fillAmount,\r\n uint256 repaymentChain,\r\n uint64 relayerFeePct,\r\n RelayData memory relayData\r\n ) internal {\r\n emit FilledRelay(\r\n relayHash,\r\n relayData.relayAmount,\r\n relayFills[relayHash],\r\n fillAmount,\r\n repaymentChain,\r\n relayData.originChainId,\r\n relayerFeePct,\r\n relayData.realizedLpFeePct,\r\n relayData.depositId,\r\n relayData.destinationToken,\r\n msg.sender,\r\n relayData.depositor,\r\n relayData.recipient\r\n );\r\n }\r\n\r\n function _emitExecutedSlowRelayFulfillmentRoot(\r\n bytes32 relayHash,\r\n uint256 fillAmount,\r\n RelayData memory relayData\r\n ) internal {\r\n emit ExecutedSlowRelayFulfillmentRoot(\r\n relayHash,\r\n relayData.relayAmount,\r\n relayFills[relayHash],\r\n fillAmount,\r\n relayData.originChainId,\r\n relayData.relayerFeePct,\r\n relayData.realizedLpFeePct,\r\n relayData.depositId,\r\n relayData.destinationToken,\r\n msg.sender,\r\n relayData.depositor,\r\n relayData.recipient\r\n );\r\n }\r\n\r\n // Added to enable the this contract to receive ETH. Used when unwrapping Weth.\r\n receive() external payable {}\r\n}\r\n" - }, - "contracts/SpokePoolInterface.sol": { - "content": "//SPDX-License-Identifier: Unlicense\r\npragma solidity ^0.8.0;\r\n\r\ninterface SpokePoolInterface {\r\n // This leaf is meant to be decoded in the SpokePool in order to pay out individual relayers for this bundle.\r\n struct RelayerRefundLeaf {\r\n // This is the amount to return to the HubPool. This occurs when there is a PoolRebalanceLeaf netSendAmount that is\r\n // negative. This is just that value inverted.\r\n uint256 amountToReturn;\r\n // Used to verify that this is being decoded on the correct chainId.\r\n uint256 chainId;\r\n // This array designates how much each of those addresses should be refunded.\r\n uint256[] refundAmounts;\r\n // Used as the index in the bitmap to track whether this leaf has been executed or not.\r\n uint32 leafId;\r\n // The associated L2TokenAddress that these claims apply to.\r\n address l2TokenAddress;\r\n // These two arrays must be the same length and are parallel arrays. They should be order by refundAddresses.\r\n // This array designates each address that must be refunded.\r\n address[] refundAddresses;\r\n }\r\n\r\n // This struct represents the data to fully-specify a relay. If any portion of this data differs, the relay is\r\n // considered to be completely distinct. Only one relay for a particular depositId, chainId pair should be\r\n // considered valid and repaid.\r\n struct RelayData {\r\n // The address that made the deposit on the origin chain.\r\n address depositor;\r\n // The recipient address on the destination chain.\r\n address recipient;\r\n // The corresponding token address on the destination chain.\r\n address destinationToken;\r\n // The total relay amount before fees are taken out.\r\n uint256 relayAmount;\r\n // Origin chain id.\r\n uint256 originChainId;\r\n // The LP Fee percentage computed by the relayer based on the deposit's quote timestamp\r\n // and the HubPool's utilization.\r\n uint64 realizedLpFeePct;\r\n // The relayer fee percentage specified in the deposit.\r\n uint64 relayerFeePct;\r\n // The id uniquely identifying this deposit on the origin chain.\r\n uint32 depositId;\r\n }\r\n\r\n function setCrossDomainAdmin(address newCrossDomainAdmin) external;\r\n\r\n function setHubPool(address newHubPool) external;\r\n\r\n function setEnableRoute(\r\n address originToken,\r\n uint256 destinationChainId,\r\n bool enable\r\n ) external;\r\n\r\n function setDepositQuoteTimeBuffer(uint32 buffer) external;\r\n\r\n function relayRootBundle(bytes32 relayerRefundRoot, bytes32 slowRelayRoot) external;\r\n}\r\n" - }, - "contracts/MerkleLib.sol": { - "content": "// SPDX-License-Identifier: GPL-3.0-only\r\npragma solidity ^0.8.0;\r\n\r\nimport \"@openzeppelin/contracts/utils/cryptography/MerkleProof.sol\";\r\nimport \"./SpokePoolInterface.sol\";\r\nimport \"./HubPoolInterface.sol\";\r\n\r\n/**\r\n * @notice Library to help with merkle roots, proofs, and claims.\r\n */\r\nlibrary MerkleLib {\r\n /**\r\n * @notice Verifies that a repayment is contained within a merkle root.\r\n * @param root the merkle root.\r\n * @param rebalance the rebalance struct.\r\n * @param proof the merkle proof.\r\n */\r\n function verifyPoolRebalance(\r\n bytes32 root,\r\n HubPoolInterface.PoolRebalanceLeaf memory rebalance,\r\n bytes32[] memory proof\r\n ) internal pure returns (bool) {\r\n return MerkleProof.verify(proof, root, keccak256(abi.encode(rebalance)));\r\n }\r\n\r\n /**\r\n * @notice Verifies that a relayer refund is contained within a merkle root.\r\n * @param root the merkle root.\r\n * @param refund the refund struct.\r\n * @param proof the merkle proof.\r\n */\r\n function verifyRelayerRefund(\r\n bytes32 root,\r\n SpokePoolInterface.RelayerRefundLeaf memory refund,\r\n bytes32[] memory proof\r\n ) internal pure returns (bool) {\r\n return MerkleProof.verify(proof, root, keccak256(abi.encode(refund)));\r\n }\r\n\r\n /**\r\n * @notice Verifies that a distribution is contained within a merkle root.\r\n * @param root the merkle root.\r\n * @param slowRelayFulfillment the relayData fulfullment struct.\r\n * @param proof the merkle proof.\r\n */\r\n function verifySlowRelayFulfillment(\r\n bytes32 root,\r\n SpokePoolInterface.RelayData memory slowRelayFulfillment,\r\n bytes32[] memory proof\r\n ) internal pure returns (bool) {\r\n return MerkleProof.verify(proof, root, keccak256(abi.encode(slowRelayFulfillment)));\r\n }\r\n\r\n // The following functions are primarily copied from\r\n // https://github.com/Uniswap/merkle-distributor/blob/master/contracts/MerkleDistributor.sol with minor changes.\r\n\r\n /**\r\n * @notice Tests whether a claim is contained within a claimedBitMap mapping.\r\n * @param claimedBitMap a simple uint256 mapping in storage used as a bitmap.\r\n * @param index the index to check in the bitmap.\r\n * @return bool indicating if the index within the claimedBitMap has been marked as claimed.\r\n */\r\n function isClaimed(mapping(uint256 => uint256) storage claimedBitMap, uint256 index) internal view returns (bool) {\r\n uint256 claimedWordIndex = index / 256;\r\n uint256 claimedBitIndex = index % 256;\r\n uint256 claimedWord = claimedBitMap[claimedWordIndex];\r\n uint256 mask = (1 << claimedBitIndex);\r\n return claimedWord & mask == mask;\r\n }\r\n\r\n /**\r\n * @notice Marks an index in a claimedBitMap as claimed.\r\n * @param claimedBitMap a simple uint256 mapping in storage used as a bitmap.\r\n * @param index the index to mark in the bitmap.\r\n */\r\n function setClaimed(mapping(uint256 => uint256) storage claimedBitMap, uint256 index) internal {\r\n uint256 claimedWordIndex = index / 256;\r\n uint256 claimedBitIndex = index % 256;\r\n claimedBitMap[claimedWordIndex] = claimedBitMap[claimedWordIndex] | (1 << claimedBitIndex);\r\n }\r\n\r\n /**\r\n * @notice Tests whether a claim is contained within a 1D claimedBitMap mapping.\r\n * @param claimedBitMap a simple uint256 value, encoding a 1D bitmap.\r\n * @param index the index to check in the bitmap.\r\n \\* @return bool indicating if the index within the claimedBitMap has been marked as claimed.\r\n */\r\n function isClaimed1D(uint256 claimedBitMap, uint256 index) internal pure returns (bool) {\r\n uint256 mask = (1 << index);\r\n return claimedBitMap & mask == mask;\r\n }\r\n\r\n /**\r\n * @notice Marks an index in a claimedBitMap as claimed.\r\n * @param claimedBitMap a simple uint256 mapping in storage used as a bitmap.\r\n * @param index the index to mark in the bitmap.\r\n */\r\n function setClaimed1D(uint256 claimedBitMap, uint256 index) internal pure returns (uint256) {\r\n require(index <= 255, \"Index out of bounds\");\r\n return claimedBitMap | (1 << index % 256);\r\n }\r\n}\r\n" - }, - "contracts/interfaces/WETH9.sol": { - "content": "// SPDX-License-Identifier: GPL-3.0-only\r\npragma solidity ^0.8.0;\r\n\r\ninterface WETH9 {\r\n function withdraw(uint256 wad) external;\r\n\r\n function deposit() external payable;\r\n\r\n function balanceOf(address guy) external view returns (uint256 wad);\r\n\r\n function transfer(address guy, uint256 wad) external;\r\n}\r\n" - }, - "@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol": { - "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts v4.4.1 (token/ERC20/utils/SafeERC20.sol)\n\npragma solidity ^0.8.0;\n\nimport \"../IERC20.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 function safeTransfer(\n IERC20 token,\n address to,\n uint256 value\n ) internal {\n _callOptionalReturn(token, abi.encodeWithSelector(token.transfer.selector, to, value));\n }\n\n function safeTransferFrom(\n IERC20 token,\n address from,\n address to,\n uint256 value\n ) 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(\n IERC20 token,\n address spender,\n uint256 value\n ) 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 function safeIncreaseAllowance(\n IERC20 token,\n address spender,\n uint256 value\n ) internal {\n uint256 newAllowance = token.allowance(address(this), spender) + value;\n _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, newAllowance));\n }\n\n function safeDecreaseAllowance(\n IERC20 token,\n address spender,\n uint256 value\n ) internal {\n unchecked {\n uint256 oldAllowance = token.allowance(address(this), spender);\n require(oldAllowance >= value, \"SafeERC20: decreased allowance below zero\");\n uint256 newAllowance = oldAllowance - value;\n _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, newAllowance));\n }\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 if (returndata.length > 0) {\n // Return data is optional\n require(abi.decode(returndata, (bool)), \"SafeERC20: ERC20 operation did not succeed\");\n }\n }\n}\n" - }, - "@openzeppelin/contracts/token/ERC20/IERC20.sol": { - "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts v4.4.1 (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 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 `recipient`.\n *\n * Returns a boolean value indicating whether the operation succeeded.\n *\n * Emits a {Transfer} event.\n */\n function transfer(address recipient, 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 `sender` to `recipient` 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(\n address sender,\n address recipient,\n uint256 amount\n ) external returns (bool);\n\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" - }, - "@openzeppelin/contracts/utils/Address.sol": { - "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts v4.4.1 (utils/Address.sol)\n\npragma solidity ^0.8.0;\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 */\n function isContract(address account) internal view returns (bool) {\n // This method relies on extcodesize, which returns 0 for contracts in\n // construction, since the code is only stored at the end of the\n // constructor execution.\n\n uint256 size;\n assembly {\n size := extcodesize(account)\n }\n return size > 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://diligence.consensys.net/posts/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.5.11/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 functionCall(target, data, \"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(\n address target,\n bytes memory data,\n uint256 value\n ) 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 require(isContract(target), \"Address: call to non-contract\");\n\n (bool success, bytes memory returndata) = target.call{value: value}(data);\n return verifyCallResult(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 require(isContract(target), \"Address: static call to non-contract\");\n\n (bool success, bytes memory returndata) = target.staticcall(data);\n return verifyCallResult(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 require(isContract(target), \"Address: delegate call to non-contract\");\n\n (bool success, bytes memory returndata) = target.delegatecall(data);\n return verifyCallResult(success, returndata, errorMessage);\n }\n\n /**\n * @dev Tool to verifies that a low level call was successful, and revert if it wasn't, either by bubbling the\n * revert reason 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 // 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\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}\n" - }, - "@openzeppelin/contracts/utils/cryptography/SignatureChecker.sol": { - "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts v4.4.1 (utils/cryptography/SignatureChecker.sol)\n\npragma solidity ^0.8.0;\n\nimport \"./ECDSA.sol\";\nimport \"../Address.sol\";\nimport \"../../interfaces/IERC1271.sol\";\n\n/**\n * @dev Signature verification helper: Provide a single mechanism to verify both private-key (EOA) ECDSA signature and\n * ERC1271 contract signatures. Using this instead of ECDSA.recover in your contract will make them compatible with\n * smart contract wallets such as Argent and Gnosis.\n *\n * Note: unlike ECDSA signatures, contract signature's are revocable, and the outcome of this function can thus change\n * through time. It could return true at block N and false at block N+1 (or the opposite).\n *\n * _Available since v4.1._\n */\nlibrary SignatureChecker {\n function isValidSignatureNow(\n address signer,\n bytes32 hash,\n bytes memory signature\n ) internal view returns (bool) {\n (address recovered, ECDSA.RecoverError error) = ECDSA.tryRecover(hash, signature);\n if (error == ECDSA.RecoverError.NoError && recovered == signer) {\n return true;\n }\n\n (bool success, bytes memory result) = signer.staticcall(\n abi.encodeWithSelector(IERC1271.isValidSignature.selector, hash, signature)\n );\n return (success && result.length == 32 && abi.decode(result, (bytes4)) == IERC1271.isValidSignature.selector);\n }\n}\n" - }, - "@openzeppelin/contracts/utils/cryptography/ECDSA.sol": { - "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts v4.4.1 (utils/cryptography/ECDSA.sol)\n\npragma solidity ^0.8.0;\n\nimport \"../Strings.sol\";\n\n/**\n * @dev Elliptic Curve Digital Signature Algorithm (ECDSA) operations.\n *\n * These functions can be used to verify that a message was signed by the holder\n * of the private keys of a given address.\n */\nlibrary ECDSA {\n enum RecoverError {\n NoError,\n InvalidSignature,\n InvalidSignatureLength,\n InvalidSignatureS,\n InvalidSignatureV\n }\n\n function _throwError(RecoverError error) private pure {\n if (error == RecoverError.NoError) {\n return; // no error: do nothing\n } else if (error == RecoverError.InvalidSignature) {\n revert(\"ECDSA: invalid signature\");\n } else if (error == RecoverError.InvalidSignatureLength) {\n revert(\"ECDSA: invalid signature length\");\n } else if (error == RecoverError.InvalidSignatureS) {\n revert(\"ECDSA: invalid signature 's' value\");\n } else if (error == RecoverError.InvalidSignatureV) {\n revert(\"ECDSA: invalid signature 'v' value\");\n }\n }\n\n /**\n * @dev Returns the address that signed a hashed message (`hash`) with\n * `signature` or error string. This address can then be used for verification purposes.\n *\n * The `ecrecover` EVM opcode allows for malleable (non-unique) signatures:\n * this function rejects them by requiring the `s` value to be in the lower\n * half order, and the `v` value to be either 27 or 28.\n *\n * IMPORTANT: `hash` _must_ be the result of a hash operation for the\n * verification to be secure: it is possible to craft signatures that\n * recover to arbitrary addresses for non-hashed data. A safe way to ensure\n * this is by receiving a hash of the original message (which may otherwise\n * be too long), and then calling {toEthSignedMessageHash} on it.\n *\n * Documentation for signature generation:\n * - with https://web3js.readthedocs.io/en/v1.3.4/web3-eth-accounts.html#sign[Web3.js]\n * - with https://docs.ethers.io/v5/api/signer/#Signer-signMessage[ethers]\n *\n * _Available since v4.3._\n */\n function tryRecover(bytes32 hash, bytes memory signature) internal pure returns (address, RecoverError) {\n // Check the signature length\n // - case 65: r,s,v signature (standard)\n // - case 64: r,vs signature (cf https://eips.ethereum.org/EIPS/eip-2098) _Available since v4.1._\n if (signature.length == 65) {\n bytes32 r;\n bytes32 s;\n uint8 v;\n // ecrecover takes the signature parameters, and the only way to get them\n // currently is to use assembly.\n assembly {\n r := mload(add(signature, 0x20))\n s := mload(add(signature, 0x40))\n v := byte(0, mload(add(signature, 0x60)))\n }\n return tryRecover(hash, v, r, s);\n } else if (signature.length == 64) {\n bytes32 r;\n bytes32 vs;\n // ecrecover takes the signature parameters, and the only way to get them\n // currently is to use assembly.\n assembly {\n r := mload(add(signature, 0x20))\n vs := mload(add(signature, 0x40))\n }\n return tryRecover(hash, r, vs);\n } else {\n return (address(0), RecoverError.InvalidSignatureLength);\n }\n }\n\n /**\n * @dev Returns the address that signed a hashed message (`hash`) with\n * `signature`. This address can then be used for verification purposes.\n *\n * The `ecrecover` EVM opcode allows for malleable (non-unique) signatures:\n * this function rejects them by requiring the `s` value to be in the lower\n * half order, and the `v` value to be either 27 or 28.\n *\n * IMPORTANT: `hash` _must_ be the result of a hash operation for the\n * verification to be secure: it is possible to craft signatures that\n * recover to arbitrary addresses for non-hashed data. A safe way to ensure\n * this is by receiving a hash of the original message (which may otherwise\n * be too long), and then calling {toEthSignedMessageHash} on it.\n */\n function recover(bytes32 hash, bytes memory signature) internal pure returns (address) {\n (address recovered, RecoverError error) = tryRecover(hash, signature);\n _throwError(error);\n return recovered;\n }\n\n /**\n * @dev Overload of {ECDSA-tryRecover} that receives the `r` and `vs` short-signature fields separately.\n *\n * See https://eips.ethereum.org/EIPS/eip-2098[EIP-2098 short signatures]\n *\n * _Available since v4.3._\n */\n function tryRecover(\n bytes32 hash,\n bytes32 r,\n bytes32 vs\n ) internal pure returns (address, RecoverError) {\n bytes32 s;\n uint8 v;\n assembly {\n s := and(vs, 0x7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff)\n v := add(shr(255, vs), 27)\n }\n return tryRecover(hash, v, r, s);\n }\n\n /**\n * @dev Overload of {ECDSA-recover} that receives the `r and `vs` short-signature fields separately.\n *\n * _Available since v4.2._\n */\n function recover(\n bytes32 hash,\n bytes32 r,\n bytes32 vs\n ) internal pure returns (address) {\n (address recovered, RecoverError error) = tryRecover(hash, r, vs);\n _throwError(error);\n return recovered;\n }\n\n /**\n * @dev Overload of {ECDSA-tryRecover} that receives the `v`,\n * `r` and `s` signature fields separately.\n *\n * _Available since v4.3._\n */\n function tryRecover(\n bytes32 hash,\n uint8 v,\n bytes32 r,\n bytes32 s\n ) internal pure returns (address, RecoverError) {\n // EIP-2 still allows signature malleability for ecrecover(). Remove this possibility and make the signature\n // unique. Appendix F in the Ethereum Yellow paper (https://ethereum.github.io/yellowpaper/paper.pdf), defines\n // the valid range for s in (301): 0 < s < secp256k1n ÷ 2 + 1, and for v in (302): v ∈ {27, 28}. Most\n // signatures from current libraries generate a unique signature with an s-value in the lower half order.\n //\n // If your library generates malleable signatures, such as s-values in the upper range, calculate a new s-value\n // with 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFEBAAEDCE6AF48A03BBFD25E8CD0364141 - s1 and flip v from 27 to 28 or\n // vice versa. If your library also generates signatures with 0/1 for v instead 27/28, add 27 to v to accept\n // these malleable signatures as well.\n if (uint256(s) > 0x7FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF5D576E7357A4501DDFE92F46681B20A0) {\n return (address(0), RecoverError.InvalidSignatureS);\n }\n if (v != 27 && v != 28) {\n return (address(0), RecoverError.InvalidSignatureV);\n }\n\n // If the signature is valid (and not malleable), return the signer address\n address signer = ecrecover(hash, v, r, s);\n if (signer == address(0)) {\n return (address(0), RecoverError.InvalidSignature);\n }\n\n return (signer, RecoverError.NoError);\n }\n\n /**\n * @dev Overload of {ECDSA-recover} that receives the `v`,\n * `r` and `s` signature fields separately.\n */\n function recover(\n bytes32 hash,\n uint8 v,\n bytes32 r,\n bytes32 s\n ) internal pure returns (address) {\n (address recovered, RecoverError error) = tryRecover(hash, v, r, s);\n _throwError(error);\n return recovered;\n }\n\n /**\n * @dev Returns an Ethereum Signed Message, created from a `hash`. This\n * produces hash corresponding to the one signed with the\n * https://eth.wiki/json-rpc/API#eth_sign[`eth_sign`]\n * JSON-RPC method as part of EIP-191.\n *\n * See {recover}.\n */\n function toEthSignedMessageHash(bytes32 hash) internal pure returns (bytes32) {\n // 32 is the length in bytes of hash,\n // enforced by the type signature above\n return keccak256(abi.encodePacked(\"\\x19Ethereum Signed Message:\\n32\", hash));\n }\n\n /**\n * @dev Returns an Ethereum Signed Message, created from `s`. This\n * produces hash corresponding to the one signed with the\n * https://eth.wiki/json-rpc/API#eth_sign[`eth_sign`]\n * JSON-RPC method as part of EIP-191.\n *\n * See {recover}.\n */\n function toEthSignedMessageHash(bytes memory s) internal pure returns (bytes32) {\n return keccak256(abi.encodePacked(\"\\x19Ethereum Signed Message:\\n\", Strings.toString(s.length), s));\n }\n\n /**\n * @dev Returns an Ethereum Signed Typed Data, created from a\n * `domainSeparator` and a `structHash`. This produces hash corresponding\n * to the one signed with the\n * https://eips.ethereum.org/EIPS/eip-712[`eth_signTypedData`]\n * JSON-RPC method as part of EIP-712.\n *\n * See {recover}.\n */\n function toTypedDataHash(bytes32 domainSeparator, bytes32 structHash) internal pure returns (bytes32) {\n return keccak256(abi.encodePacked(\"\\x19\\x01\", domainSeparator, structHash));\n }\n}\n" - }, - "@uma/core/contracts/common/implementation/Testable.sol": { - "content": "// SPDX-License-Identifier: AGPL-3.0-only\npragma solidity ^0.8.0;\n\nimport \"./Timer.sol\";\n\n/**\n * @title Base class that provides time overrides, but only if being run in test mode.\n */\nabstract contract Testable {\n // If the contract is being run in production, then `timerAddress` will be the 0x0 address.\n // Note: this variable should be set on construction and never modified.\n address public timerAddress;\n\n /**\n * @notice Constructs the Testable contract. Called by child contracts.\n * @param _timerAddress Contract that stores the current time in a testing environment.\n * Must be set to 0x0 for production environments that use live time.\n */\n constructor(address _timerAddress) {\n timerAddress = _timerAddress;\n }\n\n /**\n * @notice Reverts if not running in test mode.\n */\n modifier onlyIfTest {\n require(timerAddress != address(0x0));\n _;\n }\n\n /**\n * @notice Sets the current time.\n * @dev Will revert if not running in test mode.\n * @param time timestamp to set current Testable time to.\n */\n function setCurrentTime(uint256 time) external onlyIfTest {\n Timer(timerAddress).setCurrentTime(time);\n }\n\n /**\n * @notice Gets the current time. Will return the last time set in `setCurrentTime` if running in test mode.\n * Otherwise, it will return the block timestamp.\n * @return uint for the current Testable timestamp.\n */\n function getCurrentTime() public view virtual returns (uint256) {\n if (timerAddress != address(0x0)) {\n return Timer(timerAddress).getCurrentTime();\n } else {\n return block.timestamp; // solhint-disable-line not-rely-on-time\n }\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" - }, - "@uma/core/contracts/common/implementation/MultiCaller.sol": { - "content": "// This contract is taken from Uniswaps'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.\npragma solidity ^0.8.0;\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 payable returns (bytes[] memory results) {\n require(msg.value == 0, \"Only multicall with 0 value\");\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" - }, - "@openzeppelin/contracts/utils/cryptography/MerkleProof.sol": { - "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts v4.4.1 (utils/cryptography/MerkleProof.sol)\n\npragma solidity ^0.8.0;\n\n/**\n * @dev These functions deal with verification of Merkle Trees proofs.\n *\n * The proofs can be generated using the JavaScript library\n * https://github.com/miguelmota/merkletreejs[merkletreejs].\n * Note: the hashing algorithm should be keccak256 and pair sorting should be enabled.\n *\n * See `test/utils/cryptography/MerkleProof.test.js` for some examples.\n */\nlibrary MerkleProof {\n /**\n * @dev Returns true if a `leaf` can be proved to be a part of a Merkle tree\n * defined by `root`. For this, a `proof` must be provided, containing\n * sibling hashes on the branch from the leaf to the root of the tree. Each\n * pair of leaves and each pair of pre-images are assumed to be sorted.\n */\n function verify(\n bytes32[] memory proof,\n bytes32 root,\n bytes32 leaf\n ) internal pure returns (bool) {\n return processProof(proof, leaf) == root;\n }\n\n /**\n * @dev Returns the rebuilt hash obtained by traversing a Merklee tree up\n * from `leaf` using `proof`. A `proof` is valid if and only if the rebuilt\n * hash matches the root of the tree. When processing the proof, the pairs\n * of leafs & pre-images are assumed to be sorted.\n *\n * _Available since v4.4._\n */\n function processProof(bytes32[] memory proof, bytes32 leaf) internal pure returns (bytes32) {\n bytes32 computedHash = leaf;\n for (uint256 i = 0; i < proof.length; i++) {\n bytes32 proofElement = proof[i];\n if (computedHash <= proofElement) {\n // Hash(current computed hash + current element of the proof)\n computedHash = keccak256(abi.encodePacked(computedHash, proofElement));\n } else {\n // Hash(current element of the proof + current computed hash)\n computedHash = keccak256(abi.encodePacked(proofElement, computedHash));\n }\n }\n return computedHash;\n }\n}\n" - }, - "contracts/HubPoolInterface.sol": { - "content": "// SPDX-License-Identifier: GPL-3.0-only\r\npragma solidity ^0.8.0;\r\n\r\nimport \"@openzeppelin/contracts/token/ERC20/IERC20.sol\";\r\nimport \"./interfaces/AdapterInterface.sol\";\r\n\r\ninterface HubPoolInterface {\r\n struct PoolRebalanceLeaf {\r\n // This is used to know which chain to send cross-chain transactions to (and which SpokePool to sent to).\r\n uint256 chainId;\r\n uint256[] bundleLpFees; // Total LP fee amount per token in this bundle, encompassing all associated bundled relays.\r\n // This array is grouped with the two above, and it represents the amount to send or request back from the\r\n // SpokePool. If positive, the pool will pay the SpokePool. If negative the SpokePool will pay the HubPool.\r\n // There can be arbitrarily complex rebalancing rules defined offchain. This number is only nonzero\r\n // when the rules indicate that a rebalancing action should occur. When a rebalance does not occur,\r\n // runningBalances for this token should change by the total relays - deposits in this bundle. When a rebalance\r\n // does occur, runningBalances should be set to zero for this token and the netSendAmounts should be set to the\r\n // previous runningBalances + relays - deposits in this bundle.\r\n int256[] netSendAmounts;\r\n // This is only here to be emitted in an event to track a running unpaid balance between the L2 pool and the L1 pool.\r\n // A positive number indicates that the HubPool owes the SpokePool funds. A negative number indicates that the\r\n // SpokePool owes the HubPool funds. See the comment above for the dynamics of this and netSendAmounts\r\n int256[] runningBalances;\r\n // Used as the index in the bitmap to track whether this leaf has been executed or not.\r\n uint8 leafId;\r\n // The following arrays are required to be the same length. They are parallel arrays for the given chainId and should be ordered by the `l1Tokens` field.\r\n // All whitelisted tokens with nonzero relays on this chain in this bundle in the order of whitelisting.\r\n address[] l1Tokens;\r\n }\r\n\r\n function setBond(IERC20 newBondToken, uint256 newBondAmount) external;\r\n\r\n function setCrossChainContracts(\r\n uint256 l2ChainId,\r\n address adapter,\r\n address spokePool\r\n ) external;\r\n\r\n function whitelistRoute(\r\n uint256 originChainId,\r\n uint256 destinationChainId,\r\n address originToken,\r\n address destinationToken\r\n ) external;\r\n\r\n function enableL1TokenForLiquidityProvision(address l1Token) external;\r\n\r\n function disableL1TokenForLiquidityProvision(address l1Token) external;\r\n\r\n function addLiquidity(address l1Token, uint256 l1TokenAmount) external payable;\r\n\r\n function removeLiquidity(\r\n address l1Token,\r\n uint256 lpTokenAmount,\r\n bool sendEth\r\n ) external;\r\n\r\n function exchangeRateCurrent(address l1Token) external returns (uint256);\r\n\r\n function liquidityUtilizationPostRelay(address token, uint256 relayedAmount) external returns (uint256);\r\n\r\n function proposeRootBundle(\r\n uint256[] memory bundleEvaluationBlockNumbers,\r\n uint8 poolRebalanceLeafCount,\r\n bytes32 poolRebalanceRoot,\r\n bytes32 relayerRefundRoot,\r\n bytes32 slowRelayFulfillmentRoot\r\n ) external;\r\n\r\n function executeRootBundle(PoolRebalanceLeaf memory poolRebalanceLeaf, bytes32[] memory proof) external;\r\n\r\n function disputeRootBundle() external;\r\n}\r\n" - }, - "contracts/interfaces/AdapterInterface.sol": { - "content": "// SPDX-License-Identifier: AGPL-3.0-only\npragma solidity ^0.8.0;\n\n/**\n * @notice Sends cross chain messages and tokens to contracts on a specific L2 network.\n */\n\ninterface AdapterInterface {\n event HubPoolChanged(address newHubPool);\n\n event MessageRelayed(address target, bytes message);\n\n event TokensRelayed(address l1Token, address l2Token, uint256 amount, address to);\n\n function relayMessage(address target, bytes memory message) external payable;\n\n function relayTokens(\n address l1Token,\n address l2Token,\n uint256 amount,\n address to\n ) external payable;\n}\n" - }, - "@openzeppelin/contracts/interfaces/IERC1271.sol": { - "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts v4.4.1 (interfaces/IERC1271.sol)\n\npragma solidity ^0.8.0;\n\n/**\n * @dev Interface of the ERC1271 standard signature validation method for\n * contracts as defined in https://eips.ethereum.org/EIPS/eip-1271[ERC-1271].\n *\n * _Available since v4.1._\n */\ninterface IERC1271 {\n /**\n * @dev Should return whether the signature provided is valid for the provided data\n * @param hash Hash of the data to be signed\n * @param signature Signature byte array associated with _data\n */\n function isValidSignature(bytes32 hash, bytes memory signature) external view returns (bytes4 magicValue);\n}\n" - }, - "@openzeppelin/contracts/utils/Strings.sol": { - "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts v4.4.1 (utils/Strings.sol)\n\npragma solidity ^0.8.0;\n\n/**\n * @dev String operations.\n */\nlibrary Strings {\n bytes16 private constant _HEX_SYMBOLS = \"0123456789abcdef\";\n\n /**\n * @dev Converts a `uint256` to its ASCII `string` decimal representation.\n */\n function toString(uint256 value) internal pure returns (string memory) {\n // Inspired by OraclizeAPI's implementation - MIT licence\n // https://github.com/oraclize/ethereum-api/blob/b42146b063c7d6ee1358846c198246239e9360e8/oraclizeAPI_0.4.25.sol\n\n if (value == 0) {\n return \"0\";\n }\n uint256 temp = value;\n uint256 digits;\n while (temp != 0) {\n digits++;\n temp /= 10;\n }\n bytes memory buffer = new bytes(digits);\n while (value != 0) {\n digits -= 1;\n buffer[digits] = bytes1(uint8(48 + uint256(value % 10)));\n value /= 10;\n }\n return string(buffer);\n }\n\n /**\n * @dev Converts a `uint256` to its ASCII `string` hexadecimal representation.\n */\n function toHexString(uint256 value) internal pure returns (string memory) {\n if (value == 0) {\n return \"0x00\";\n }\n uint256 temp = value;\n uint256 length = 0;\n while (temp != 0) {\n length++;\n temp >>= 8;\n }\n return toHexString(value, length);\n }\n\n /**\n * @dev Converts a `uint256` to its ASCII `string` hexadecimal representation with fixed length.\n */\n function toHexString(uint256 value, uint256 length) internal pure returns (string memory) {\n bytes memory buffer = new bytes(2 * length + 2);\n buffer[0] = \"0\";\n buffer[1] = \"x\";\n for (uint256 i = 2 * length + 1; i > 1; --i) {\n buffer[i] = _HEX_SYMBOLS[value & 0xf];\n value >>= 4;\n }\n require(value == 0, \"Strings: hex length insufficient\");\n return string(buffer);\n }\n}\n" - }, - "@uma/core/contracts/common/implementation/Timer.sol": { - "content": "// SPDX-License-Identifier: AGPL-3.0-only\npragma solidity ^0.8.0;\n\n/**\n * @title Universal store of current contract time for testing environments.\n */\ncontract Timer {\n uint256 private currentTime;\n\n constructor() {\n currentTime = block.timestamp; // solhint-disable-line not-rely-on-time\n }\n\n /**\n * @notice Sets the current time.\n * @dev Will revert if not running in test mode.\n * @param time timestamp to set `currentTime` to.\n */\n function setCurrentTime(uint256 time) external {\n currentTime = time;\n }\n\n /**\n * @notice Gets the currentTime variable set in the Timer.\n * @return uint256 for the current Testable timestamp.\n */\n function getCurrentTime() public view returns (uint256) {\n return currentTime;\n }\n}\n" - }, - "contracts/test/MockSpokePool.sol": { - "content": "//SPDX-License-Identifier: Unlicense\r\npragma solidity ^0.8.0;\r\n\r\nimport \"../SpokePool.sol\";\r\nimport \"../SpokePoolInterface.sol\";\r\n\r\n/**\r\n * @title MockSpokePool\r\n * @notice Implements admin internal methods to test internal logic.\r\n */\r\ncontract MockSpokePool is SpokePoolInterface, SpokePool {\r\n constructor(\r\n address _crossDomainAdmin,\r\n address _hubPool,\r\n address _wethAddress,\r\n address timerAddress\r\n ) SpokePool(_crossDomainAdmin, _hubPool, _wethAddress, timerAddress) {}\r\n\r\n function setCrossDomainAdmin(address newCrossDomainAdmin) public override {\r\n _setCrossDomainAdmin(newCrossDomainAdmin);\r\n }\r\n\r\n function setHubPool(address newHubPool) public override {\r\n _setHubPool(newHubPool);\r\n }\r\n\r\n function setEnableRoute(\r\n address originToken,\r\n uint256 destinationChainId,\r\n bool enable\r\n ) public override {\r\n _setEnableRoute(originToken, destinationChainId, enable);\r\n }\r\n\r\n function setDepositQuoteTimeBuffer(uint32 buffer) public override {\r\n _setDepositQuoteTimeBuffer(buffer);\r\n }\r\n\r\n function relayRootBundle(bytes32 relayerRefundRoot, bytes32 slowRelayFulfillmentRoot) public override {\r\n _relayRootBundle(relayerRefundRoot, slowRelayFulfillmentRoot);\r\n }\r\n\r\n function _bridgeTokensToHubPool(RelayerRefundLeaf memory relayerRefundLeaf) internal override {}\r\n}\r\n" - }, - "contracts/Optimism_SpokePool.sol": { - "content": "//SPDX-License-Identifier: Unlicense\r\npragma solidity ^0.8.0;\r\n\r\nimport \"./interfaces/WETH9.sol\";\r\n\r\nimport \"@eth-optimism/contracts/libraries/bridge/CrossDomainEnabled.sol\";\r\nimport \"@eth-optimism/contracts/libraries/constants/Lib_PredeployAddresses.sol\";\r\nimport \"@eth-optimism/contracts/L2/messaging/IL2ERC20Bridge.sol\";\r\nimport \"./SpokePool.sol\";\r\nimport \"./SpokePoolInterface.sol\";\r\n\r\n/**\r\n * @notice OVM specific SpokePool.\r\n * @dev Uses OVM cross-domain-enabled logic for access control.\r\n */\r\n\r\ncontract Optimism_SpokePool is CrossDomainEnabled, SpokePoolInterface, SpokePool {\r\n // \"l1Gas\" parameter used in call to bridge tokens from this contract back to L1 via `IL2ERC20Bridge`.\r\n uint32 public l1Gas = 5_000_000;\r\n\r\n address public l2Eth = address(Lib_PredeployAddresses.OVM_ETH);\r\n\r\n event OptimismTokensBridged(address indexed l2Token, address target, uint256 numberOfTokensBridged, uint256 l1Gas);\r\n event SetL1Gas(uint32 indexed newL1Gas);\r\n\r\n constructor(\r\n address _crossDomainAdmin,\r\n address _hubPool,\r\n address timerAddress\r\n )\r\n CrossDomainEnabled(Lib_PredeployAddresses.L2_CROSS_DOMAIN_MESSENGER)\r\n SpokePool(_crossDomainAdmin, _hubPool, 0x4200000000000000000000000000000000000006, timerAddress)\r\n {}\r\n\r\n /**************************************\r\n * CROSS-CHAIN ADMIN FUNCTIONS *\r\n **************************************/\r\n\r\n function setL1GasLimit(uint32 newl1Gas) public onlyFromCrossDomainAccount(crossDomainAdmin) {\r\n _setL1GasLimit(newl1Gas);\r\n }\r\n\r\n function setCrossDomainAdmin(address newCrossDomainAdmin)\r\n public\r\n override\r\n onlyFromCrossDomainAccount(crossDomainAdmin)\r\n nonReentrant\r\n {\r\n _setCrossDomainAdmin(newCrossDomainAdmin);\r\n }\r\n\r\n function setHubPool(address newHubPool) public override onlyFromCrossDomainAccount(crossDomainAdmin) nonReentrant {\r\n _setHubPool(newHubPool);\r\n }\r\n\r\n function setEnableRoute(\r\n address originToken,\r\n uint256 destinationChainId,\r\n bool enable\r\n ) public override onlyFromCrossDomainAccount(crossDomainAdmin) nonReentrant {\r\n _setEnableRoute(originToken, destinationChainId, enable);\r\n }\r\n\r\n function setDepositQuoteTimeBuffer(uint32 buffer)\r\n public\r\n override\r\n onlyFromCrossDomainAccount(crossDomainAdmin)\r\n nonReentrant\r\n {\r\n _setDepositQuoteTimeBuffer(buffer);\r\n }\r\n\r\n function relayRootBundle(bytes32 relayerRefundRoot, bytes32 slowRelayFulfillmentRoot)\r\n public\r\n override\r\n onlyFromCrossDomainAccount(crossDomainAdmin)\r\n nonReentrant\r\n {\r\n _relayRootBundle(relayerRefundRoot, slowRelayFulfillmentRoot);\r\n }\r\n\r\n /**************************************\r\n * INTERNAL FUNCTIONS *\r\n **************************************/\r\n\r\n function _setL1GasLimit(uint32 _l1Gas) internal {\r\n l1Gas = _l1Gas;\r\n emit SetL1Gas(l1Gas);\r\n }\r\n\r\n function _bridgeTokensToHubPool(RelayerRefundLeaf memory relayerRefundLeaf) internal override {\r\n // If the token being bridged is WETH then we need to first unwrap it to ETH and then send ETH over the\r\n // canonical bridge. On Optimism, this is address 0xDeadDeAddeAddEAddeadDEaDDEAdDeaDDeAD0000.\r\n if (relayerRefundLeaf.l2TokenAddress == address(weth)) {\r\n WETH9(relayerRefundLeaf.l2TokenAddress).withdraw(relayerRefundLeaf.amountToReturn); // Unwrap ETH.\r\n relayerRefundLeaf.l2TokenAddress = l2Eth; // Set the l2TokenAddress to ETH.\r\n }\r\n IL2ERC20Bridge(Lib_PredeployAddresses.L2_STANDARD_BRIDGE).withdrawTo(\r\n relayerRefundLeaf.l2TokenAddress, // _l2Token. Address of the L2 token to bridge over.\r\n hubPool, // _to. Withdraw, over the bridge, to the l1 pool contract.\r\n relayerRefundLeaf.amountToReturn, // _amount.\r\n l1Gas, // _l1Gas. Unused, but included for potential forward compatibility considerations\r\n \"\" // _data. We don't need to send any data for the bridging action.\r\n );\r\n\r\n emit OptimismTokensBridged(relayerRefundLeaf.l2TokenAddress, hubPool, relayerRefundLeaf.amountToReturn, l1Gas);\r\n }\r\n}\r\n" - }, - "@eth-optimism/contracts/libraries/bridge/CrossDomainEnabled.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma solidity >0.5.0 <0.9.0;\n\n/* Interface Imports */\nimport { ICrossDomainMessenger } from \"./ICrossDomainMessenger.sol\";\n\n/**\n * @title CrossDomainEnabled\n * @dev Helper contract for contracts performing cross-domain communications\n *\n * Compiler used: defined by inheriting contract\n */\ncontract CrossDomainEnabled {\n /*************\n * Variables *\n *************/\n\n // Messenger contract used to send and recieve messages from the other domain.\n address public messenger;\n\n /***************\n * Constructor *\n ***************/\n\n /**\n * @param _messenger Address of the CrossDomainMessenger on the current layer.\n */\n constructor(address _messenger) {\n messenger = _messenger;\n }\n\n /**********************\n * Function Modifiers *\n **********************/\n\n /**\n * Enforces that the modified function is only callable by a specific cross-domain account.\n * @param _sourceDomainAccount The only account on the originating domain which is\n * authenticated to call this function.\n */\n modifier onlyFromCrossDomainAccount(address _sourceDomainAccount) {\n require(\n msg.sender == address(getCrossDomainMessenger()),\n \"OVM_XCHAIN: messenger contract unauthenticated\"\n );\n\n require(\n getCrossDomainMessenger().xDomainMessageSender() == _sourceDomainAccount,\n \"OVM_XCHAIN: wrong sender of cross-domain message\"\n );\n\n _;\n }\n\n /**********************\n * Internal Functions *\n **********************/\n\n /**\n * Gets the messenger, usually from storage. This function is exposed in case a child contract\n * needs to override.\n * @return The address of the cross-domain messenger contract which should be used.\n */\n function getCrossDomainMessenger() internal virtual returns (ICrossDomainMessenger) {\n return ICrossDomainMessenger(messenger);\n }\n\n /**q\n * Sends a message to an account on another domain\n * @param _crossDomainTarget The intended recipient on the destination domain\n * @param _message The data to send to the target (usually calldata to a function with\n * `onlyFromCrossDomainAccount()`)\n * @param _gasLimit The gasLimit for the receipt of the message on the target domain.\n */\n function sendCrossDomainMessage(\n address _crossDomainTarget,\n uint32 _gasLimit,\n bytes memory _message\n ) internal {\n // slither-disable-next-line reentrancy-events, reentrancy-benign\n getCrossDomainMessenger().sendMessage(_crossDomainTarget, _message, _gasLimit);\n }\n}\n" - }, - "@eth-optimism/contracts/libraries/constants/Lib_PredeployAddresses.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.9;\n\n/**\n * @title Lib_PredeployAddresses\n */\nlibrary Lib_PredeployAddresses {\n address internal constant L2_TO_L1_MESSAGE_PASSER = 0x4200000000000000000000000000000000000000;\n address internal constant L1_MESSAGE_SENDER = 0x4200000000000000000000000000000000000001;\n address internal constant DEPLOYER_WHITELIST = 0x4200000000000000000000000000000000000002;\n address payable internal constant OVM_ETH = payable(0xDeadDeAddeAddEAddeadDEaDDEAdDeaDDeAD0000);\n address internal constant L2_CROSS_DOMAIN_MESSENGER =\n 0x4200000000000000000000000000000000000007;\n address internal constant LIB_ADDRESS_MANAGER = 0x4200000000000000000000000000000000000008;\n address internal constant PROXY_EOA = 0x4200000000000000000000000000000000000009;\n address internal constant L2_STANDARD_BRIDGE = 0x4200000000000000000000000000000000000010;\n address internal constant SEQUENCER_FEE_WALLET = 0x4200000000000000000000000000000000000011;\n address internal constant L2_STANDARD_TOKEN_FACTORY =\n 0x4200000000000000000000000000000000000012;\n address internal constant L1_BLOCK_NUMBER = 0x4200000000000000000000000000000000000013;\n}\n" - }, - "@eth-optimism/contracts/L2/messaging/IL2ERC20Bridge.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.9;\n\n/**\n * @title IL2ERC20Bridge\n */\ninterface IL2ERC20Bridge {\n /**********\n * Events *\n **********/\n\n event WithdrawalInitiated(\n address indexed _l1Token,\n address indexed _l2Token,\n address indexed _from,\n address _to,\n uint256 _amount,\n bytes _data\n );\n\n event DepositFinalized(\n address indexed _l1Token,\n address indexed _l2Token,\n address indexed _from,\n address _to,\n uint256 _amount,\n bytes _data\n );\n\n event DepositFailed(\n address indexed _l1Token,\n address indexed _l2Token,\n address indexed _from,\n address _to,\n uint256 _amount,\n bytes _data\n );\n\n /********************\n * Public Functions *\n ********************/\n\n /**\n * @dev get the address of the corresponding L1 bridge contract.\n * @return Address of the corresponding L1 bridge contract.\n */\n function l1TokenBridge() external returns (address);\n\n /**\n * @dev initiate a withdraw of some tokens to the caller's account on L1\n * @param _l2Token Address of L2 token where withdrawal was initiated.\n * @param _amount Amount of the token to withdraw.\n * param _l1Gas Unused, but included for potential forward compatibility considerations.\n * @param _data Optional data to forward to L1. This data is provided\n * solely as a convenience for external contracts. Aside from enforcing a maximum\n * length, these contracts provide no guarantees about its content.\n */\n function withdraw(\n address _l2Token,\n uint256 _amount,\n uint32 _l1Gas,\n bytes calldata _data\n ) external;\n\n /**\n * @dev initiate a withdraw of some token to a recipient's account on L1.\n * @param _l2Token Address of L2 token where withdrawal is initiated.\n * @param _to L1 adress to credit the withdrawal to.\n * @param _amount Amount of the token to withdraw.\n * param _l1Gas Unused, but included for potential forward compatibility considerations.\n * @param _data Optional data to forward to L1. This data is provided\n * solely as a convenience for external contracts. Aside from enforcing a maximum\n * length, these contracts provide no guarantees about its content.\n */\n function withdrawTo(\n address _l2Token,\n address _to,\n uint256 _amount,\n uint32 _l1Gas,\n bytes calldata _data\n ) external;\n\n /*************************\n * Cross-chain Functions *\n *************************/\n\n /**\n * @dev Complete a deposit from L1 to L2, and credits funds to the recipient's balance of this\n * L2 token. This call will fail if it did not originate from a corresponding deposit in\n * L1StandardTokenBridge.\n * @param _l1Token Address for the l1 token this is called with\n * @param _l2Token Address for the l2 token this is called with\n * @param _from Account to pull the deposit from on L2.\n * @param _to Address to receive the withdrawal at\n * @param _amount Amount of the token to withdraw\n * @param _data Data provider by the sender on L1. This data is provided\n * solely as a convenience for external contracts. Aside from enforcing a maximum\n * length, these contracts provide no guarantees about its content.\n */\n function finalizeDeposit(\n address _l1Token,\n address _l2Token,\n address _from,\n address _to,\n uint256 _amount,\n bytes calldata _data\n ) external;\n}\n" - }, - "@eth-optimism/contracts/libraries/bridge/ICrossDomainMessenger.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma solidity >0.5.0 <0.9.0;\n\n/**\n * @title ICrossDomainMessenger\n */\ninterface ICrossDomainMessenger {\n /**********\n * Events *\n **********/\n\n event SentMessage(\n address indexed target,\n address sender,\n bytes message,\n uint256 messageNonce,\n uint256 gasLimit\n );\n event RelayedMessage(bytes32 indexed msgHash);\n event FailedRelayedMessage(bytes32 indexed msgHash);\n\n /*************\n * Variables *\n *************/\n\n function xDomainMessageSender() external view returns (address);\n\n /********************\n * Public Functions *\n ********************/\n\n /**\n * Sends a cross domain message to the target messenger.\n * @param _target Target contract address.\n * @param _message Message to send to the target.\n * @param _gasLimit Gas limit for the provided message.\n */\n function sendMessage(\n address _target,\n bytes calldata _message,\n uint32 _gasLimit\n ) external;\n}\n" - }, - "contracts/chain-adapters/Optimism_Adapter.sol": { - "content": "// SPDX-License-Identifier: AGPL-3.0-only\r\npragma solidity ^0.8.0;\r\n\r\nimport \"./Base_Adapter.sol\";\r\nimport \"../interfaces/AdapterInterface.sol\";\r\nimport \"../interfaces/WETH9.sol\";\r\n\r\nimport \"@eth-optimism/contracts/libraries/bridge/CrossDomainEnabled.sol\";\r\nimport \"@eth-optimism/contracts/L1/messaging/IL1StandardBridge.sol\";\r\n\r\nimport \"@uma/core/contracts/common/implementation/Lockable.sol\";\r\n\r\nimport \"@openzeppelin/contracts/token/ERC20/IERC20.sol\";\r\n\r\n/**\r\n * @notice Sends cross chain messages Optimism L2 network.\r\n * @dev This contract's owner should be set to the some multisig or admin contract. The Owner can simply set the L2 gas\r\n * and the HubPool. The HubPool is the only contract that can relay tokens and messages over the bridge.\r\n */\r\ncontract Optimism_Adapter is Base_Adapter, CrossDomainEnabled, Lockable {\r\n uint32 public l2GasLimit = 5_000_000;\r\n\r\n WETH9 public l1Weth;\r\n\r\n IL1StandardBridge public l1StandardBridge;\r\n\r\n event L2GasLimitSet(uint32 newGasLimit);\r\n\r\n constructor(\r\n WETH9 _l1Weth,\r\n address _hubPool,\r\n address _crossDomainMessenger,\r\n IL1StandardBridge _l1StandardBridge\r\n ) CrossDomainEnabled(_crossDomainMessenger) Base_Adapter(_hubPool) {\r\n l1Weth = _l1Weth;\r\n l1StandardBridge = _l1StandardBridge;\r\n }\r\n\r\n function setL2GasLimit(uint32 _l2GasLimit) public onlyOwner {\r\n l2GasLimit = _l2GasLimit;\r\n emit L2GasLimitSet(l2GasLimit);\r\n }\r\n\r\n function relayMessage(address target, bytes memory message) external payable override nonReentrant onlyHubPool {\r\n sendCrossDomainMessage(target, uint32(l2GasLimit), message);\r\n emit MessageRelayed(target, message);\r\n }\r\n\r\n function relayTokens(\r\n address l1Token,\r\n address l2Token,\r\n uint256 amount,\r\n address to\r\n ) external payable override nonReentrant onlyHubPool {\r\n // If the l1Token is weth then unwrap it to ETH then send the ETH to the standard bridge.\r\n if (l1Token == address(l1Weth)) {\r\n l1Weth.withdraw(amount);\r\n l1StandardBridge.depositETHTo{ value: amount }(to, l2GasLimit, \"\");\r\n } else {\r\n IERC20(l1Token).approve(address(l1StandardBridge), amount);\r\n l1StandardBridge.depositERC20To(l1Token, l2Token, to, amount, l2GasLimit, \"\");\r\n }\r\n emit TokensRelayed(l1Token, l2Token, amount, to);\r\n }\r\n\r\n // Added to enable the Optimism_Adapter to receive ETH. used when unwrapping WETH.\r\n receive() external payable {}\r\n}\r\n" - }, - "contracts/chain-adapters/Base_Adapter.sol": { - "content": "// SPDX-License-Identifier: AGPL-3.0-only\npragma solidity ^0.8.0;\nimport \"../interfaces/AdapterInterface.sol\";\n\nimport \"@openzeppelin/contracts/access/Ownable.sol\";\n\nabstract contract Base_Adapter is Ownable, AdapterInterface {\n address public hubPool;\n\n modifier onlyHubPool() {\n require(msg.sender == hubPool, \"Can only be called by hubPool\");\n _;\n }\n\n constructor(address _hubPool) {\n hubPool = _hubPool;\n }\n\n function setHubPool(address _hubPool) public onlyOwner {\n hubPool = _hubPool;\n emit HubPoolChanged(_hubPool);\n }\n}\n" - }, - "@eth-optimism/contracts/L1/messaging/IL1StandardBridge.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma solidity >0.5.0 <0.9.0;\n\nimport \"./IL1ERC20Bridge.sol\";\n\n/**\n * @title IL1StandardBridge\n */\ninterface IL1StandardBridge is IL1ERC20Bridge {\n /**********\n * Events *\n **********/\n event ETHDepositInitiated(\n address indexed _from,\n address indexed _to,\n uint256 _amount,\n bytes _data\n );\n\n event ETHWithdrawalFinalized(\n address indexed _from,\n address indexed _to,\n uint256 _amount,\n bytes _data\n );\n\n /********************\n * Public Functions *\n ********************/\n\n /**\n * @dev Deposit an amount of the ETH to the caller's balance on L2.\n * @param _l2Gas Gas limit required to complete the deposit on L2.\n * @param _data Optional data to forward to L2. This data is provided\n * solely as a convenience for external contracts. Aside from enforcing a maximum\n * length, these contracts provide no guarantees about its content.\n */\n function depositETH(uint32 _l2Gas, bytes calldata _data) external payable;\n\n /**\n * @dev Deposit an amount of ETH to a recipient's balance on L2.\n * @param _to L2 address to credit the withdrawal to.\n * @param _l2Gas Gas limit required to complete the deposit on L2.\n * @param _data Optional data to forward to L2. This data is provided\n * solely as a convenience for external contracts. Aside from enforcing a maximum\n * length, these contracts provide no guarantees about its content.\n */\n function depositETHTo(\n address _to,\n uint32 _l2Gas,\n bytes calldata _data\n ) external payable;\n\n /*************************\n * Cross-chain Functions *\n *************************/\n\n /**\n * @dev Complete a withdrawal from L2 to L1, and credit funds to the recipient's balance of the\n * L1 ETH token. Since only the xDomainMessenger can call this function, it will never be called\n * before the withdrawal is finalized.\n * @param _from L2 address initiating the transfer.\n * @param _to L1 address to credit the withdrawal to.\n * @param _amount Amount of the ERC20 to deposit.\n * @param _data Optional data to forward to L2. This data is provided\n * solely as a convenience for external contracts. Aside from enforcing a maximum\n * length, these contracts provide no guarantees about its content.\n */\n function finalizeETHWithdrawal(\n address _from,\n address _to,\n uint256 _amount,\n bytes calldata _data\n ) external;\n}\n" - }, - "@openzeppelin/contracts/access/Ownable.sol": { - "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts v4.4.1 (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 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 called by any account other than the owner.\n */\n modifier onlyOwner() {\n require(owner() == _msgSender(), \"Ownable: caller is not the owner\");\n _;\n }\n\n /**\n * @dev Leaves the contract without owner. It will not be possible to call\n * `onlyOwner` functions anymore. Can only be called by the current owner.\n *\n * NOTE: Renouncing ownership will leave the contract without an owner,\n * thereby removing 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/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" - }, - "@eth-optimism/contracts/L1/messaging/IL1ERC20Bridge.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma solidity >0.5.0 <0.9.0;\n\n/**\n * @title IL1ERC20Bridge\n */\ninterface IL1ERC20Bridge {\n /**********\n * Events *\n **********/\n\n event ERC20DepositInitiated(\n address indexed _l1Token,\n address indexed _l2Token,\n address indexed _from,\n address _to,\n uint256 _amount,\n bytes _data\n );\n\n event ERC20WithdrawalFinalized(\n address indexed _l1Token,\n address indexed _l2Token,\n address indexed _from,\n address _to,\n uint256 _amount,\n bytes _data\n );\n\n /********************\n * Public Functions *\n ********************/\n\n /**\n * @dev get the address of the corresponding L2 bridge contract.\n * @return Address of the corresponding L2 bridge contract.\n */\n function l2TokenBridge() external returns (address);\n\n /**\n * @dev deposit an amount of the ERC20 to the caller's balance on L2.\n * @param _l1Token Address of the L1 ERC20 we are depositing\n * @param _l2Token Address of the L1 respective L2 ERC20\n * @param _amount Amount of the ERC20 to deposit\n * @param _l2Gas Gas limit required to complete the deposit on L2.\n * @param _data Optional data to forward to L2. This data is provided\n * solely as a convenience for external contracts. Aside from enforcing a maximum\n * length, these contracts provide no guarantees about its content.\n */\n function depositERC20(\n address _l1Token,\n address _l2Token,\n uint256 _amount,\n uint32 _l2Gas,\n bytes calldata _data\n ) external;\n\n /**\n * @dev deposit an amount of ERC20 to a recipient's balance on L2.\n * @param _l1Token Address of the L1 ERC20 we are depositing\n * @param _l2Token Address of the L1 respective L2 ERC20\n * @param _to L2 address to credit the withdrawal to.\n * @param _amount Amount of the ERC20 to deposit.\n * @param _l2Gas Gas limit required to complete the deposit on L2.\n * @param _data Optional data to forward to L2. This data is provided\n * solely as a convenience for external contracts. Aside from enforcing a maximum\n * length, these contracts provide no guarantees about its content.\n */\n function depositERC20To(\n address _l1Token,\n address _l2Token,\n address _to,\n uint256 _amount,\n uint32 _l2Gas,\n bytes calldata _data\n ) external;\n\n /*************************\n * Cross-chain Functions *\n *************************/\n\n /**\n * @dev Complete a withdrawal from L2 to L1, and credit funds to the recipient's balance of the\n * L1 ERC20 token.\n * This call will fail if the initialized withdrawal from L2 has not been finalized.\n *\n * @param _l1Token Address of L1 token to finalizeWithdrawal for.\n * @param _l2Token Address of L2 token where withdrawal was initiated.\n * @param _from L2 address initiating the transfer.\n * @param _to L1 address to credit the withdrawal to.\n * @param _amount Amount of the ERC20 to deposit.\n * @param _data Data provided by the sender on L2. This data is provided\n * solely as a convenience for external contracts. Aside from enforcing a maximum\n * length, these contracts provide no guarantees about its content.\n */\n function finalizeERC20Withdrawal(\n address _l1Token,\n address _l2Token,\n address _from,\n address _to,\n uint256 _amount,\n bytes calldata _data\n ) external;\n}\n" - }, - "@openzeppelin/contracts/token/ERC20/extensions/IERC20Metadata.sol": { - "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts v4.4.1 (token/ERC20/extensions/IERC20Metadata.sol)\n\npragma solidity ^0.8.0;\n\nimport \"../IERC20.sol\";\n\n/**\n * @dev Interface for the optional metadata functions from the ERC20 standard.\n *\n * _Available since v4.1._\n */\ninterface IERC20Metadata is IERC20 {\n /**\n * @dev Returns the name of the token.\n */\n function name() external view returns (string memory);\n\n /**\n * @dev Returns the symbol of the token.\n */\n function symbol() external view returns (string memory);\n\n /**\n * @dev Returns the decimals places of the token.\n */\n function decimals() external view returns (uint8);\n}\n" - }, - "@openzeppelin/contracts/token/ERC20/ERC20.sol": { - "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts v4.4.1 (token/ERC20/ERC20.sol)\n\npragma solidity ^0.8.0;\n\nimport \"./IERC20.sol\";\nimport \"./extensions/IERC20Metadata.sol\";\nimport \"../../utils/Context.sol\";\n\n/**\n * @dev Implementation of the {IERC20} interface.\n *\n * This implementation is agnostic to the way tokens are created. This means\n * that a supply mechanism has to be added in a derived contract using {_mint}.\n * For a generic mechanism see {ERC20PresetMinterPauser}.\n *\n * TIP: For a detailed writeup see our guide\n * https://forum.zeppelin.solutions/t/how-to-implement-erc20-supply-mechanisms/226[How\n * to implement supply mechanisms].\n *\n * We have followed general OpenZeppelin Contracts guidelines: functions revert\n * instead returning `false` on failure. This behavior is nonetheless\n * conventional and does not conflict with the expectations of ERC20\n * applications.\n *\n * Additionally, an {Approval} event is emitted on calls to {transferFrom}.\n * This allows applications to reconstruct the allowance for all accounts just\n * by listening to said events. Other implementations of the EIP may not emit\n * these events, as it isn't required by the specification.\n *\n * Finally, the non-standard {decreaseAllowance} and {increaseAllowance}\n * functions have been added to mitigate the well-known issues around setting\n * allowances. See {IERC20-approve}.\n */\ncontract ERC20 is Context, IERC20, IERC20Metadata {\n mapping(address => uint256) private _balances;\n\n mapping(address => mapping(address => uint256)) private _allowances;\n\n uint256 private _totalSupply;\n\n string private _name;\n string private _symbol;\n\n /**\n * @dev Sets the values for {name} and {symbol}.\n *\n * The default value of {decimals} is 18. To select a different value for\n * {decimals} you should overload it.\n *\n * All two of these values are immutable: they can only be set once during\n * construction.\n */\n constructor(string memory name_, string memory symbol_) {\n _name = name_;\n _symbol = symbol_;\n }\n\n /**\n * @dev Returns the name of the token.\n */\n function name() public view virtual override returns (string memory) {\n return _name;\n }\n\n /**\n * @dev Returns the symbol of the token, usually a shorter version of the\n * name.\n */\n function symbol() public view virtual override returns (string memory) {\n return _symbol;\n }\n\n /**\n * @dev Returns the number of decimals used to get its user representation.\n * For example, if `decimals` equals `2`, a balance of `505` tokens should\n * be displayed to a user as `5.05` (`505 / 10 ** 2`).\n *\n * Tokens usually opt for a value of 18, imitating the relationship between\n * Ether and Wei. This is the value {ERC20} uses, unless this function is\n * overridden;\n *\n * NOTE: This information is only used for _display_ purposes: it in\n * no way affects any of the arithmetic of the contract, including\n * {IERC20-balanceOf} and {IERC20-transfer}.\n */\n function decimals() public view virtual override returns (uint8) {\n return 18;\n }\n\n /**\n * @dev See {IERC20-totalSupply}.\n */\n function totalSupply() public view virtual override returns (uint256) {\n return _totalSupply;\n }\n\n /**\n * @dev See {IERC20-balanceOf}.\n */\n function balanceOf(address account) public view virtual override returns (uint256) {\n return _balances[account];\n }\n\n /**\n * @dev See {IERC20-transfer}.\n *\n * Requirements:\n *\n * - `recipient` cannot be the zero address.\n * - the caller must have a balance of at least `amount`.\n */\n function transfer(address recipient, uint256 amount) public virtual override returns (bool) {\n _transfer(_msgSender(), recipient, amount);\n return true;\n }\n\n /**\n * @dev See {IERC20-allowance}.\n */\n function allowance(address owner, address spender) public view virtual override returns (uint256) {\n return _allowances[owner][spender];\n }\n\n /**\n * @dev See {IERC20-approve}.\n *\n * Requirements:\n *\n * - `spender` cannot be the zero address.\n */\n function approve(address spender, uint256 amount) public virtual override returns (bool) {\n _approve(_msgSender(), spender, amount);\n return true;\n }\n\n /**\n * @dev See {IERC20-transferFrom}.\n *\n * Emits an {Approval} event indicating the updated allowance. This is not\n * required by the EIP. See the note at the beginning of {ERC20}.\n *\n * Requirements:\n *\n * - `sender` and `recipient` cannot be the zero address.\n * - `sender` must have a balance of at least `amount`.\n * - the caller must have allowance for ``sender``'s tokens of at least\n * `amount`.\n */\n function transferFrom(\n address sender,\n address recipient,\n uint256 amount\n ) public virtual override returns (bool) {\n _transfer(sender, recipient, amount);\n\n uint256 currentAllowance = _allowances[sender][_msgSender()];\n require(currentAllowance >= amount, \"ERC20: transfer amount exceeds allowance\");\n unchecked {\n _approve(sender, _msgSender(), currentAllowance - amount);\n }\n\n return true;\n }\n\n /**\n * @dev Atomically increases the allowance granted to `spender` by the caller.\n *\n * This is an alternative to {approve} that can be used as a mitigation for\n * problems described in {IERC20-approve}.\n *\n * Emits an {Approval} event indicating the updated allowance.\n *\n * Requirements:\n *\n * - `spender` cannot be the zero address.\n */\n function increaseAllowance(address spender, uint256 addedValue) public virtual returns (bool) {\n _approve(_msgSender(), spender, _allowances[_msgSender()][spender] + addedValue);\n return true;\n }\n\n /**\n * @dev Atomically decreases the allowance granted to `spender` by the caller.\n *\n * This is an alternative to {approve} that can be used as a mitigation for\n * problems described in {IERC20-approve}.\n *\n * Emits an {Approval} event indicating the updated allowance.\n *\n * Requirements:\n *\n * - `spender` cannot be the zero address.\n * - `spender` must have allowance for the caller of at least\n * `subtractedValue`.\n */\n function decreaseAllowance(address spender, uint256 subtractedValue) public virtual returns (bool) {\n uint256 currentAllowance = _allowances[_msgSender()][spender];\n require(currentAllowance >= subtractedValue, \"ERC20: decreased allowance below zero\");\n unchecked {\n _approve(_msgSender(), spender, currentAllowance - subtractedValue);\n }\n\n return true;\n }\n\n /**\n * @dev Moves `amount` of tokens from `sender` to `recipient`.\n *\n * This internal function is equivalent to {transfer}, and can be used to\n * e.g. implement automatic token fees, slashing mechanisms, etc.\n *\n * Emits a {Transfer} event.\n *\n * Requirements:\n *\n * - `sender` cannot be the zero address.\n * - `recipient` cannot be the zero address.\n * - `sender` must have a balance of at least `amount`.\n */\n function _transfer(\n address sender,\n address recipient,\n uint256 amount\n ) internal virtual {\n require(sender != address(0), \"ERC20: transfer from the zero address\");\n require(recipient != address(0), \"ERC20: transfer to the zero address\");\n\n _beforeTokenTransfer(sender, recipient, amount);\n\n uint256 senderBalance = _balances[sender];\n require(senderBalance >= amount, \"ERC20: transfer amount exceeds balance\");\n unchecked {\n _balances[sender] = senderBalance - amount;\n }\n _balances[recipient] += amount;\n\n emit Transfer(sender, recipient, amount);\n\n _afterTokenTransfer(sender, recipient, amount);\n }\n\n /** @dev Creates `amount` tokens and assigns them to `account`, increasing\n * the total supply.\n *\n * Emits a {Transfer} event with `from` set to the zero address.\n *\n * Requirements:\n *\n * - `account` cannot be the zero address.\n */\n function _mint(address account, uint256 amount) internal virtual {\n require(account != address(0), \"ERC20: mint to the zero address\");\n\n _beforeTokenTransfer(address(0), account, amount);\n\n _totalSupply += amount;\n _balances[account] += amount;\n emit Transfer(address(0), account, amount);\n\n _afterTokenTransfer(address(0), account, amount);\n }\n\n /**\n * @dev Destroys `amount` tokens from `account`, reducing the\n * total supply.\n *\n * Emits a {Transfer} event with `to` set to the zero address.\n *\n * Requirements:\n *\n * - `account` cannot be the zero address.\n * - `account` must have at least `amount` tokens.\n */\n function _burn(address account, uint256 amount) internal virtual {\n require(account != address(0), \"ERC20: burn from the zero address\");\n\n _beforeTokenTransfer(account, address(0), amount);\n\n uint256 accountBalance = _balances[account];\n require(accountBalance >= amount, \"ERC20: burn amount exceeds balance\");\n unchecked {\n _balances[account] = accountBalance - amount;\n }\n _totalSupply -= amount;\n\n emit Transfer(account, address(0), amount);\n\n _afterTokenTransfer(account, address(0), amount);\n }\n\n /**\n * @dev Sets `amount` as the allowance of `spender` over the `owner` s tokens.\n *\n * This internal function is equivalent to `approve`, and can be used to\n * e.g. set automatic allowances for certain subsystems, etc.\n *\n * Emits an {Approval} event.\n *\n * Requirements:\n *\n * - `owner` cannot be the zero address.\n * - `spender` cannot be the zero address.\n */\n function _approve(\n address owner,\n address spender,\n uint256 amount\n ) internal virtual {\n require(owner != address(0), \"ERC20: approve from the zero address\");\n require(spender != address(0), \"ERC20: approve to the zero address\");\n\n _allowances[owner][spender] = amount;\n emit Approval(owner, spender, amount);\n }\n\n /**\n * @dev Hook that is called before any transfer of tokens. This includes\n * minting and burning.\n *\n * Calling conditions:\n *\n * - when `from` and `to` are both non-zero, `amount` of ``from``'s tokens\n * will be transferred to `to`.\n * - when `from` is zero, `amount` tokens will be minted for `to`.\n * - when `to` is zero, `amount` of ``from``'s tokens will be burned.\n * - `from` and `to` are never both zero.\n *\n * To learn more about hooks, head to xref:ROOT:extending-contracts.adoc#using-hooks[Using Hooks].\n */\n function _beforeTokenTransfer(\n address from,\n address to,\n uint256 amount\n ) internal virtual {}\n\n /**\n * @dev Hook that is called after any transfer of tokens. This includes\n * minting and burning.\n *\n * Calling conditions:\n *\n * - when `from` and `to` are both non-zero, `amount` of ``from``'s tokens\n * has been transferred to `to`.\n * - when `from` is zero, `amount` tokens have been minted for `to`.\n * - when `to` is zero, `amount` of ``from``'s tokens have been burned.\n * - `from` and `to` are never both zero.\n *\n * To learn more about hooks, head to xref:ROOT:extending-contracts.adoc#using-hooks[Using Hooks].\n */\n function _afterTokenTransfer(\n address from,\n address to,\n uint256 amount\n ) internal virtual {}\n}\n" - }, - "contracts/chain-adapters/Ethereum_Adapter.sol": { - "content": "// SPDX-License-Identifier: AGPL-3.0-only\r\npragma solidity ^0.8.0;\r\n\r\nimport \"./Base_Adapter.sol\";\r\nimport \"../interfaces/AdapterInterface.sol\";\r\nimport \"../interfaces/WETH9.sol\";\r\n\r\nimport \"@uma/core/contracts/common/implementation/Lockable.sol\";\r\n\r\nimport \"@openzeppelin/contracts/token/ERC20/IERC20.sol\";\r\nimport \"@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol\";\r\n\r\ncontract Ethereum_Adapter is Base_Adapter, Lockable {\r\n using SafeERC20 for IERC20;\r\n\r\n constructor(address _hubPool) Base_Adapter(_hubPool) {}\r\n\r\n function relayMessage(address target, bytes memory message) external payable override nonReentrant onlyHubPool {\r\n _executeCall(target, message);\r\n emit MessageRelayed(target, message);\r\n }\r\n\r\n function relayTokens(\r\n address l1Token,\r\n address l2Token, // l2Token is unused for L1.\r\n uint256 amount,\r\n address to\r\n ) external payable override nonReentrant onlyHubPool {\r\n IERC20(l1Token).safeTransfer(to, amount);\r\n emit TokensRelayed(l1Token, l2Token, amount, to);\r\n }\r\n\r\n // Note: this snippet of code is copied from Governor.sol.\r\n function _executeCall(address to, bytes memory data) private {\r\n // Note: this snippet of code is copied from Governor.sol and modified to not include any \"value\" field.\r\n // solhint-disable-next-line no-inline-assembly\r\n\r\n bool success;\r\n assembly {\r\n let inputData := add(data, 0x20)\r\n let inputDataSize := mload(data)\r\n // Hardcode value to be 0 for relayed governance calls in order to avoid addressing complexity of bridging\r\n // value cross-chain.\r\n success := call(gas(), to, 0, inputData, inputDataSize, 0, 0)\r\n }\r\n require(success, \"execute call failed\");\r\n }\r\n\r\n receive() external payable {}\r\n}\r\n" - }, - "contracts/chain-adapters/Arbitrum_Adapter.sol": { - "content": "// SPDX-License-Identifier: AGPL-3.0-only\r\npragma solidity ^0.8.0;\r\n\r\nimport \"./Base_Adapter.sol\";\r\nimport \"../interfaces/AdapterInterface.sol\";\r\nimport \"../interfaces/WETH9.sol\";\r\n\r\nimport \"@uma/core/contracts/common/implementation/Lockable.sol\";\r\n\r\nimport \"@openzeppelin/contracts/token/ERC20/IERC20.sol\";\r\n\r\ninterface ArbitrumL1InboxLike {\r\n function createRetryableTicket(\r\n address destAddr,\r\n uint256 arbTxCallValue,\r\n uint256 maxSubmissionCost,\r\n address submissionRefundAddress,\r\n address valueRefundAddress,\r\n uint256 maxGas,\r\n uint256 gasPriceBid,\r\n bytes calldata data\r\n ) external payable returns (uint256);\r\n}\r\n\r\ninterface ArbitrumL1ERC20GatewayLike {\r\n function outboundTransfer(\r\n address _token,\r\n address _to,\r\n uint256 _amount,\r\n uint256 _maxGas,\r\n uint256 _gasPriceBid,\r\n bytes calldata _data\r\n ) external payable returns (bytes memory);\r\n}\r\n\r\ncontract Arbitrum_Adapter is Base_Adapter, Lockable {\r\n // Gas limit for immediate L2 execution attempt (can be estimated via NodeInterface.estimateRetryableTicket).\r\n // NodeInterface precompile interface exists at L2 address 0x00000000000000000000000000000000000000C8\r\n uint32 public l2GasLimit = 5_000_000;\r\n\r\n // Amount of ETH allocated to pay for the base submission fee. The base submission fee is a parameter unique to\r\n // retryable transactions; the user is charged the base submission fee to cover the storage costs of keeping their\r\n // ticket’s calldata in the retry buffer. (current base submission fee is queryable via\r\n // ArbRetryableTx.getSubmissionPrice). ArbRetryableTicket precompile interface exists at L2 address\r\n // 0x000000000000000000000000000000000000006E.\r\n uint256 public l2MaxSubmissionCost = 0.1e18;\r\n\r\n // L2 Gas price bid for immediate L2 execution attempt (queryable via standard eth*gasPrice RPC)\r\n uint256 public l2GasPrice = 10e9; // 10 gWei\r\n\r\n // This address on L2 receives extra ETH that is left over after relaying a message via the inbox.\r\n address public l2RefundL2Address;\r\n\r\n ArbitrumL1InboxLike public l1Inbox;\r\n\r\n ArbitrumL1ERC20GatewayLike public l1ERC20Gateway;\r\n\r\n event L2GasLimitSet(uint32 newL2GasLimit);\r\n\r\n event L2MaxSubmissionCostSet(uint256 newL2MaxSubmissionCost);\r\n\r\n event L2GasPriceSet(uint256 newL2GasPrice);\r\n\r\n event L2RefundL2AddressSet(address newL2RefundL2Address);\r\n\r\n constructor(\r\n address _hubPool,\r\n ArbitrumL1InboxLike _l1ArbitrumInbox,\r\n ArbitrumL1ERC20GatewayLike _l1ERC20Gateway\r\n ) Base_Adapter(_hubPool) {\r\n l1Inbox = _l1ArbitrumInbox;\r\n l1ERC20Gateway = _l1ERC20Gateway;\r\n\r\n l2RefundL2Address = owner();\r\n }\r\n\r\n function setL2GasLimit(uint32 _l2GasLimit) public onlyOwner {\r\n l2GasLimit = _l2GasLimit;\r\n emit L2GasLimitSet(l2GasLimit);\r\n }\r\n\r\n function setL2MaxSubmissionCost(uint256 _l2MaxSubmissionCost) public onlyOwner {\r\n l2MaxSubmissionCost = _l2MaxSubmissionCost;\r\n emit L2MaxSubmissionCostSet(l2MaxSubmissionCost);\r\n }\r\n\r\n function setL2GasPrice(uint256 _l2GasPrice) public onlyOwner {\r\n l2GasPrice = _l2GasPrice;\r\n emit L2GasPriceSet(l2GasPrice);\r\n }\r\n\r\n function setL2RefundL2Address(address _l2RefundL2Address) public onlyOwner {\r\n l2RefundL2Address = _l2RefundL2Address;\r\n emit L2RefundL2AddressSet(l2RefundL2Address);\r\n }\r\n\r\n function relayMessage(address target, bytes memory message) external payable override nonReentrant onlyHubPool {\r\n uint256 requiredL1CallValue = getL1CallValue();\r\n require(address(this).balance >= requiredL1CallValue, \"Insufficient ETH balance\");\r\n\r\n l1Inbox.createRetryableTicket{ value: requiredL1CallValue }(\r\n target, // destAddr destination L2 contract address\r\n 0, // l2CallValue call value for retryable L2 message\r\n l2MaxSubmissionCost, // maxSubmissionCost Max gas deducted from user's L2 balance to cover base submission fee\r\n l2RefundL2Address, // excessFeeRefundAddress maxgas x gasprice - execution cost gets credited here on L2 balance\r\n l2RefundL2Address, // callValueRefundAddress l2Callvalue gets credited here on L2 if retryable txn times out or gets cancelled\r\n l2GasLimit, // maxGas Max gas deducted from user's L2 balance to cover L2 execution\r\n l2GasPrice, // gasPriceBid price bid for L2 execution\r\n message // data ABI encoded data of L2 message\r\n );\r\n\r\n emit MessageRelayed(target, message);\r\n }\r\n\r\n function relayTokens(\r\n address l1Token,\r\n address l2Token, // l2Token is unused for Arbitrum.\r\n uint256 amount,\r\n address to\r\n ) external payable override nonReentrant onlyHubPool {\r\n l1ERC20Gateway.outboundTransfer(l1Token, to, amount, l2GasLimit, l2GasPrice, \"\");\r\n emit TokensRelayed(l1Token, l2Token, amount, to);\r\n }\r\n\r\n function getL1CallValue() public view returns (uint256) {\r\n return l2MaxSubmissionCost + l2GasPrice * l2GasLimit;\r\n }\r\n\r\n receive() external payable {}\r\n}\r\n" - }, - "contracts/Ethereum_SpokePool.sol": { - "content": "//SPDX-License-Identifier: Unlicense\r\npragma solidity ^0.8.0;\r\n\r\nimport \"./interfaces/WETH9.sol\";\r\n\r\nimport \"@openzeppelin/contracts/access/Ownable.sol\";\r\nimport \"@openzeppelin/contracts/token/ERC20/IERC20.sol\";\r\n\r\nimport \"./SpokePool.sol\";\r\nimport \"./SpokePoolInterface.sol\";\r\n\r\n/**\r\n * @notice Ethereum L1 specific SpokePool.\r\n * @dev Used on Ethereum L1 to facilitate L2->L1 transfers.\r\n */\r\n\r\ncontract Ethereum_SpokePool is SpokePoolInterface, SpokePool, Ownable {\r\n constructor(\r\n address _crossDomainAdmin,\r\n address _hubPool,\r\n address _wethAddress,\r\n address timerAddress\r\n ) SpokePool(_crossDomainAdmin, _hubPool, _wethAddress, timerAddress) {}\r\n\r\n /**************************************\r\n * ADMIN FUNCTIONS *\r\n **************************************/\r\n\r\n function setCrossDomainAdmin(address newCrossDomainAdmin) public override onlyOwner nonReentrant {\r\n _setCrossDomainAdmin(newCrossDomainAdmin);\r\n }\r\n\r\n function setHubPool(address newHubPool) public override onlyOwner nonReentrant {\r\n _setHubPool(newHubPool);\r\n }\r\n\r\n function setEnableRoute(\r\n address originToken,\r\n uint256 destinationChainId,\r\n bool enable\r\n ) public override onlyOwner nonReentrant {\r\n _setEnableRoute(originToken, destinationChainId, enable);\r\n }\r\n\r\n function setDepositQuoteTimeBuffer(uint32 buffer) public override onlyOwner nonReentrant {\r\n _setDepositQuoteTimeBuffer(buffer);\r\n }\r\n\r\n function relayRootBundle(bytes32 relayerRefundRoot, bytes32 slowRelayFulfillmentRoot)\r\n public\r\n override\r\n onlyOwner\r\n nonReentrant\r\n {\r\n _relayRootBundle(relayerRefundRoot, slowRelayFulfillmentRoot);\r\n }\r\n\r\n function _bridgeTokensToHubPool(RelayerRefundLeaf memory relayerRefundLeaf) internal override {\r\n IERC20(relayerRefundLeaf.l2TokenAddress).transfer(hubPool, relayerRefundLeaf.amountToReturn);\r\n }\r\n}\r\n" - }, - "contracts/chain-adapters/Mock_Adapter.sol": { - "content": "// SPDX-License-Identifier: AGPL-3.0-only\npragma solidity ^0.8.0;\n\nimport \"./Base_Adapter.sol\";\nimport \"@openzeppelin/contracts/token/ERC20/IERC20.sol\";\n\n/**\n * @notice Sends cross chain messages Optimism L2 network.\n * @dev This contract's owner should be set to the BridgeAdmin deployed on the same L1 network so that only the\n * BridgeAdmin can call cross-chain administrative functions on the L2 SpokePool via this messenger.\n */\ncontract Mock_Adapter is Base_Adapter {\n event RelayMessageCalled(address target, bytes message, address caller);\n\n event RelayTokensCalled(address l1Token, address l2Token, uint256 amount, address to, address caller);\n\n function relayMessage(address target, bytes memory message) external payable override onlyHubPool {\n emit RelayMessageCalled(target, message, msg.sender);\n }\n\n constructor(address _hubPool) Base_Adapter(_hubPool) {}\n\n function relayTokens(\n address l1Token,\n address l2Token,\n uint256 amount,\n address to\n ) external payable override onlyHubPool {\n emit RelayTokensCalled(l1Token, l2Token, amount, to, msg.sender);\n }\n}\n" - }, - "contracts/test/MerkleLibTest.sol": { - "content": "// SPDX-License-Identifier: GPL-3.0-only\r\npragma solidity ^0.8.0;\r\n\r\nimport \"../MerkleLib.sol\";\r\nimport \"../HubPoolInterface.sol\";\r\nimport \"../SpokePoolInterface.sol\";\r\n\r\n/**\r\n * @notice Contract to test the MerkleLib.\r\n */\r\ncontract MerkleLibTest {\r\n mapping(uint256 => uint256) public claimedBitMap;\r\n\r\n uint256 public claimedBitMap1D;\r\n\r\n function verifyPoolRebalance(\r\n bytes32 root,\r\n HubPoolInterface.PoolRebalanceLeaf memory rebalance,\r\n bytes32[] memory proof\r\n ) public pure returns (bool) {\r\n return MerkleLib.verifyPoolRebalance(root, rebalance, proof);\r\n }\r\n\r\n function verifyRelayerRefund(\r\n bytes32 root,\r\n SpokePoolInterface.RelayerRefundLeaf memory refund,\r\n bytes32[] memory proof\r\n ) public pure returns (bool) {\r\n return MerkleLib.verifyRelayerRefund(root, refund, proof);\r\n }\r\n\r\n function verifySlowRelayFulfillment(\r\n bytes32 root,\r\n SpokePoolInterface.RelayData memory slowRelayFulfillment,\r\n bytes32[] memory proof\r\n ) public pure returns (bool) {\r\n return MerkleLib.verifySlowRelayFulfillment(root, slowRelayFulfillment, proof);\r\n }\r\n\r\n function isClaimed(uint256 index) public view returns (bool) {\r\n return MerkleLib.isClaimed(claimedBitMap, index);\r\n }\r\n\r\n function setClaimed(uint256 index) public {\r\n MerkleLib.setClaimed(claimedBitMap, index);\r\n }\r\n\r\n function isClaimed1D(uint256 index) public view returns (bool) {\r\n return MerkleLib.isClaimed1D(claimedBitMap1D, index);\r\n }\r\n\r\n function setClaimed1D(uint256 index) public {\r\n claimedBitMap1D = MerkleLib.setClaimed1D(claimedBitMap1D, index);\r\n }\r\n}\r\n" - }, - "@uma/core/contracts/common/interfaces/ExpandedIERC20.sol": { - "content": "// SPDX-License-Identifier: AGPL-3.0-only\npragma solidity ^0.8.0;\n\nimport \"@openzeppelin/contracts/token/ERC20/IERC20.sol\";\n\n/**\n * @title ERC20 interface that includes burn and mint methods.\n */\nabstract contract ExpandedIERC20 is IERC20 {\n /**\n * @notice Burns a specific amount of the caller's tokens.\n * @dev Only burns the caller's tokens, so it is safe to leave this method permissionless.\n */\n function burn(uint256 value) external virtual;\n\n /**\n * @dev Burns `value` tokens owned by `recipient`.\n * @param recipient address to burn tokens from.\n * @param value amount of tokens to burn.\n */\n function burnFrom(address recipient, uint256 value) external virtual returns (bool);\n\n /**\n * @notice Mints tokens and adds them to the balance of the `to` address.\n * @dev This method should be permissioned to only allow designated parties to mint tokens.\n */\n function mint(address to, uint256 value) external virtual returns (bool);\n\n function addMinter(address account) external virtual;\n\n function addBurner(address account) external virtual;\n\n function resetOwner(address account) external virtual;\n}\n" - }, - "@uma/core/contracts/common/implementation/ExpandedERC20.sol": { - "content": "// SPDX-License-Identifier: AGPL-3.0-only\npragma solidity ^0.8.0;\n\nimport \"@openzeppelin/contracts/token/ERC20/ERC20.sol\";\nimport \"./MultiRole.sol\";\nimport \"../interfaces/ExpandedIERC20.sol\";\n\n/**\n * @title An ERC20 with permissioned burning and minting. The contract deployer will initially\n * be the owner who is capable of adding new roles.\n */\ncontract ExpandedERC20 is ExpandedIERC20, ERC20, MultiRole {\n enum Roles {\n // Can set the minter and burner.\n Owner,\n // Addresses that can mint new tokens.\n Minter,\n // Addresses that can burn tokens that address owns.\n Burner\n }\n\n uint8 _decimals;\n\n /**\n * @notice Constructs the ExpandedERC20.\n * @param _tokenName The name which describes the new token.\n * @param _tokenSymbol The ticker abbreviation of the name. Ideally < 5 chars.\n * @param _tokenDecimals The number of decimals to define token precision.\n */\n constructor(\n string memory _tokenName,\n string memory _tokenSymbol,\n uint8 _tokenDecimals\n ) ERC20(_tokenName, _tokenSymbol) {\n _decimals = _tokenDecimals;\n _createExclusiveRole(uint256(Roles.Owner), uint256(Roles.Owner), msg.sender);\n _createSharedRole(uint256(Roles.Minter), uint256(Roles.Owner), new address[](0));\n _createSharedRole(uint256(Roles.Burner), uint256(Roles.Owner), new address[](0));\n }\n\n function decimals() public view virtual override(ERC20) returns (uint8) {\n return _decimals;\n }\n\n /**\n * @dev Mints `value` tokens to `recipient`, returning true on success.\n * @param recipient address to mint to.\n * @param value amount of tokens to mint.\n * @return True if the mint succeeded, or False.\n */\n function mint(address recipient, uint256 value)\n external\n override\n onlyRoleHolder(uint256(Roles.Minter))\n returns (bool)\n {\n _mint(recipient, value);\n return true;\n }\n\n /**\n * @dev Burns `value` tokens owned by `msg.sender`.\n * @param value amount of tokens to burn.\n */\n function burn(uint256 value) external override onlyRoleHolder(uint256(Roles.Burner)) {\n _burn(msg.sender, value);\n }\n\n /**\n * @dev Burns `value` tokens owned by `recipient`.\n * @param recipient address to burn tokens from.\n * @param value amount of tokens to burn.\n * @return True if the burn succeeded, or False.\n */\n function burnFrom(address recipient, uint256 value)\n external\n override\n onlyRoleHolder(uint256(Roles.Burner))\n returns (bool)\n {\n _burn(recipient, value);\n return true;\n }\n\n /**\n * @notice Add Minter role to account.\n * @dev The caller must have the Owner role.\n * @param account The address to which the Minter role is added.\n */\n function addMinter(address account) external virtual override {\n addMember(uint256(Roles.Minter), account);\n }\n\n /**\n * @notice Add Burner role to account.\n * @dev The caller must have the Owner role.\n * @param account The address to which the Burner role is added.\n */\n function addBurner(address account) external virtual override {\n addMember(uint256(Roles.Burner), account);\n }\n\n /**\n * @notice Reset Owner role to account.\n * @dev The caller must have the Owner role.\n * @param account The new holder of the Owner role.\n */\n function resetOwner(address account) external virtual override {\n resetMember(uint256(Roles.Owner), account);\n }\n}\n" - }, - "@uma/core/contracts/common/implementation/MultiRole.sol": { - "content": "// SPDX-License-Identifier: AGPL-3.0-only\npragma solidity ^0.8.0;\n\nlibrary Exclusive {\n struct RoleMembership {\n address member;\n }\n\n function isMember(RoleMembership storage roleMembership, address memberToCheck) internal view returns (bool) {\n return roleMembership.member == memberToCheck;\n }\n\n function resetMember(RoleMembership storage roleMembership, address newMember) internal {\n require(newMember != address(0x0), \"Cannot set an exclusive role to 0x0\");\n roleMembership.member = newMember;\n }\n\n function getMember(RoleMembership storage roleMembership) internal view returns (address) {\n return roleMembership.member;\n }\n\n function init(RoleMembership storage roleMembership, address initialMember) internal {\n resetMember(roleMembership, initialMember);\n }\n}\n\nlibrary Shared {\n struct RoleMembership {\n mapping(address => bool) members;\n }\n\n function isMember(RoleMembership storage roleMembership, address memberToCheck) internal view returns (bool) {\n return roleMembership.members[memberToCheck];\n }\n\n function addMember(RoleMembership storage roleMembership, address memberToAdd) internal {\n require(memberToAdd != address(0x0), \"Cannot add 0x0 to a shared role\");\n roleMembership.members[memberToAdd] = true;\n }\n\n function removeMember(RoleMembership storage roleMembership, address memberToRemove) internal {\n roleMembership.members[memberToRemove] = false;\n }\n\n function init(RoleMembership storage roleMembership, address[] memory initialMembers) internal {\n for (uint256 i = 0; i < initialMembers.length; i++) {\n addMember(roleMembership, initialMembers[i]);\n }\n }\n}\n\n/**\n * @title Base class to manage permissions for the derived class.\n */\nabstract contract MultiRole {\n using Exclusive for Exclusive.RoleMembership;\n using Shared for Shared.RoleMembership;\n\n enum RoleType { Invalid, Exclusive, Shared }\n\n struct Role {\n uint256 managingRole;\n RoleType roleType;\n Exclusive.RoleMembership exclusiveRoleMembership;\n Shared.RoleMembership sharedRoleMembership;\n }\n\n mapping(uint256 => Role) private roles;\n\n event ResetExclusiveMember(uint256 indexed roleId, address indexed newMember, address indexed manager);\n event AddedSharedMember(uint256 indexed roleId, address indexed newMember, address indexed manager);\n event RemovedSharedMember(uint256 indexed roleId, address indexed oldMember, address indexed manager);\n\n /**\n * @notice Reverts unless the caller is a member of the specified roleId.\n */\n modifier onlyRoleHolder(uint256 roleId) {\n require(holdsRole(roleId, msg.sender), \"Sender does not hold required role\");\n _;\n }\n\n /**\n * @notice Reverts unless the caller is a member of the manager role for the specified roleId.\n */\n modifier onlyRoleManager(uint256 roleId) {\n require(holdsRole(roles[roleId].managingRole, msg.sender), \"Can only be called by a role manager\");\n _;\n }\n\n /**\n * @notice Reverts unless the roleId represents an initialized, exclusive roleId.\n */\n modifier onlyExclusive(uint256 roleId) {\n require(roles[roleId].roleType == RoleType.Exclusive, \"Must be called on an initialized Exclusive role\");\n _;\n }\n\n /**\n * @notice Reverts unless the roleId represents an initialized, shared roleId.\n */\n modifier onlyShared(uint256 roleId) {\n require(roles[roleId].roleType == RoleType.Shared, \"Must be called on an initialized Shared role\");\n _;\n }\n\n /**\n * @notice Whether `memberToCheck` is a member of roleId.\n * @dev Reverts if roleId does not correspond to an initialized role.\n * @param roleId the Role to check.\n * @param memberToCheck the address to check.\n * @return True if `memberToCheck` is a member of `roleId`.\n */\n function holdsRole(uint256 roleId, address memberToCheck) public view returns (bool) {\n Role storage role = roles[roleId];\n if (role.roleType == RoleType.Exclusive) {\n return role.exclusiveRoleMembership.isMember(memberToCheck);\n } else if (role.roleType == RoleType.Shared) {\n return role.sharedRoleMembership.isMember(memberToCheck);\n }\n revert(\"Invalid roleId\");\n }\n\n /**\n * @notice Changes the exclusive role holder of `roleId` to `newMember`.\n * @dev Reverts if the caller is not a member of the managing role for `roleId` or if `roleId` is not an\n * initialized, ExclusiveRole.\n * @param roleId the ExclusiveRole membership to modify.\n * @param newMember the new ExclusiveRole member.\n */\n function resetMember(uint256 roleId, address newMember) public onlyExclusive(roleId) onlyRoleManager(roleId) {\n roles[roleId].exclusiveRoleMembership.resetMember(newMember);\n emit ResetExclusiveMember(roleId, newMember, msg.sender);\n }\n\n /**\n * @notice Gets the current holder of the exclusive role, `roleId`.\n * @dev Reverts if `roleId` does not represent an initialized, exclusive role.\n * @param roleId the ExclusiveRole membership to check.\n * @return the address of the current ExclusiveRole member.\n */\n function getMember(uint256 roleId) public view onlyExclusive(roleId) returns (address) {\n return roles[roleId].exclusiveRoleMembership.getMember();\n }\n\n /**\n * @notice Adds `newMember` to the shared role, `roleId`.\n * @dev Reverts if `roleId` does not represent an initialized, SharedRole or if the caller is not a member of the\n * managing role for `roleId`.\n * @param roleId the SharedRole membership to modify.\n * @param newMember the new SharedRole member.\n */\n function addMember(uint256 roleId, address newMember) public onlyShared(roleId) onlyRoleManager(roleId) {\n roles[roleId].sharedRoleMembership.addMember(newMember);\n emit AddedSharedMember(roleId, newMember, msg.sender);\n }\n\n /**\n * @notice Removes `memberToRemove` from the shared role, `roleId`.\n * @dev Reverts if `roleId` does not represent an initialized, SharedRole or if the caller is not a member of the\n * managing role for `roleId`.\n * @param roleId the SharedRole membership to modify.\n * @param memberToRemove the current SharedRole member to remove.\n */\n function removeMember(uint256 roleId, address memberToRemove) public onlyShared(roleId) onlyRoleManager(roleId) {\n roles[roleId].sharedRoleMembership.removeMember(memberToRemove);\n emit RemovedSharedMember(roleId, memberToRemove, msg.sender);\n }\n\n /**\n * @notice Removes caller from the role, `roleId`.\n * @dev Reverts if the caller is not a member of the role for `roleId` or if `roleId` is not an\n * initialized, SharedRole.\n * @param roleId the SharedRole membership to modify.\n */\n function renounceMembership(uint256 roleId) public onlyShared(roleId) onlyRoleHolder(roleId) {\n roles[roleId].sharedRoleMembership.removeMember(msg.sender);\n emit RemovedSharedMember(roleId, msg.sender, msg.sender);\n }\n\n /**\n * @notice Reverts if `roleId` is not initialized.\n */\n modifier onlyValidRole(uint256 roleId) {\n require(roles[roleId].roleType != RoleType.Invalid, \"Attempted to use an invalid roleId\");\n _;\n }\n\n /**\n * @notice Reverts if `roleId` is initialized.\n */\n modifier onlyInvalidRole(uint256 roleId) {\n require(roles[roleId].roleType == RoleType.Invalid, \"Cannot use a pre-existing role\");\n _;\n }\n\n /**\n * @notice Internal method to initialize a shared role, `roleId`, which will be managed by `managingRoleId`.\n * `initialMembers` will be immediately added to the role.\n * @dev Should be called by derived contracts, usually at construction time. Will revert if the role is already\n * initialized.\n */\n function _createSharedRole(\n uint256 roleId,\n uint256 managingRoleId,\n address[] memory initialMembers\n ) internal onlyInvalidRole(roleId) {\n Role storage role = roles[roleId];\n role.roleType = RoleType.Shared;\n role.managingRole = managingRoleId;\n role.sharedRoleMembership.init(initialMembers);\n require(\n roles[managingRoleId].roleType != RoleType.Invalid,\n \"Attempted to use an invalid role to manage a shared role\"\n );\n }\n\n /**\n * @notice Internal method to initialize an exclusive role, `roleId`, which will be managed by `managingRoleId`.\n * `initialMember` will be immediately added to the role.\n * @dev Should be called by derived contracts, usually at construction time. Will revert if the role is already\n * initialized.\n */\n function _createExclusiveRole(\n uint256 roleId,\n uint256 managingRoleId,\n address initialMember\n ) internal onlyInvalidRole(roleId) {\n Role storage role = roles[roleId];\n role.roleType = RoleType.Exclusive;\n role.managingRole = managingRoleId;\n role.exclusiveRoleMembership.init(initialMember);\n require(\n roles[managingRoleId].roleType != RoleType.Invalid,\n \"Attempted to use an invalid role to manage an exclusive role\"\n );\n }\n}\n" - }, - "contracts/LpTokenFactory.sol": { - "content": "// SPDX-License-Identifier: GPL-3.0-only\npragma solidity ^0.8.0;\n\nimport \"./interfaces/LpTokenFactoryInterface.sol\";\n\nimport \"@uma/core/contracts/common/implementation/ExpandedERC20.sol\";\n\ncontract LpTokenFactory is LpTokenFactoryInterface {\n function createLpToken(address l1Token) public returns (address) {\n ExpandedERC20 lpToken = new ExpandedERC20(\n _append(\"Across \", IERC20Metadata(l1Token).name(), \" LP Token\"), // LP Token Name\n _append(\"Av2-\", IERC20Metadata(l1Token).symbol(), \"-LP\"), // LP Token Symbol\n IERC20Metadata(l1Token).decimals() // LP Token Decimals\n );\n lpToken.addMember(1, msg.sender); // Set this contract as the LP Token's minter.\n lpToken.addMember(2, msg.sender); // Set this contract as the LP Token's burner.\n\n return address(lpToken);\n }\n\n function _append(\n string memory a,\n string memory b,\n string memory c\n ) internal pure returns (string memory) {\n return string(abi.encodePacked(a, b, c));\n }\n}\n" - }, - "contracts/interfaces/LpTokenFactoryInterface.sol": { - "content": "// SPDX-License-Identifier: AGPL-3.0-only\npragma solidity ^0.8.0;\n\nimport \"@openzeppelin/contracts/token/ERC20/IERC20.sol\";\n\ninterface LpTokenFactoryInterface {\n function createLpToken(address l1Token) external returns (address);\n}\n" - }, - "@uma/core/contracts/oracle/interfaces/SkinnyOptimisticOracleInterface.sol": { - "content": "// SPDX-License-Identifier: AGPL-3.0-only\npragma solidity ^0.8.0;\n\nimport \"@openzeppelin/contracts/token/ERC20/IERC20.sol\";\nimport \"../interfaces/OptimisticOracleInterface.sol\";\n\n/**\n * @title Interface for the gas-cost-reduced version of the OptimisticOracle.\n * @notice Differences from normal OptimisticOracle:\n * - refundOnDispute: flag is removed, by default there are no refunds on disputes.\n * - customizing request parameters: In the OptimisticOracle, parameters like `bond` and `customLiveness` can be reset\n * after a request is already made via `requestPrice`. In the SkinnyOptimisticOracle, these parameters can only be\n * set in `requestPrice`, which has an expanded input set.\n * - settleAndGetPrice: Replaced by `settle`, which can only be called once per settleable request. The resolved price\n * can be fetched via the `Settle` event or the return value of `settle`.\n * - general changes to interface: Functions that interact with existing requests all require the parameters of the\n * request to modify to be passed as input. These parameters must match with the existing request parameters or the\n * function will revert. This change reflects the internal refactor to store hashed request parameters instead of the\n * full request struct.\n * @dev Interface used by financial contracts to interact with the Oracle. Voters will use a different interface.\n */\nabstract contract SkinnyOptimisticOracleInterface {\n // Struct representing a price request. Note that this differs from the OptimisticOracleInterface's Request struct\n // in that refundOnDispute is removed.\n struct Request {\n address proposer; // Address of the proposer.\n address disputer; // Address of the disputer.\n IERC20 currency; // ERC20 token used to pay rewards and fees.\n bool settled; // True if the request is settled.\n int256 proposedPrice; // Price that the proposer submitted.\n int256 resolvedPrice; // Price resolved once the request is settled.\n uint256 expirationTime; // Time at which the request auto-settles without a dispute.\n uint256 reward; // Amount of the currency to pay to the proposer on settlement.\n uint256 finalFee; // Final fee to pay to the Store upon request to the DVM.\n uint256 bond; // Bond that the proposer and disputer must pay on top of the final fee.\n uint256 customLiveness; // Custom liveness value set by the requester.\n }\n\n // This value must be <= the Voting contract's `ancillaryBytesLimit` value otherwise it is possible\n // that a price can be requested to this contract successfully, but cannot be disputed because the DVM refuses\n // to accept a price request made with ancillary data length over a certain size.\n uint256 public constant ancillaryBytesLimit = 8192;\n\n /**\n * @notice Requests a new price.\n * @param identifier price identifier being requested.\n * @param timestamp timestamp of the price being requested.\n * @param ancillaryData ancillary data representing additional args being passed with the price request.\n * @param currency ERC20 token used for payment of rewards and fees. Must be approved for use with the DVM.\n * @param reward reward offered to a successful proposer. Will be pulled from the caller. Note: this can be 0,\n * which could make sense if the contract requests and proposes the value in the same call or\n * provides its own reward system.\n * @param bond custom proposal bond to set for request. If set to 0, defaults to the final fee.\n * @param customLiveness custom proposal liveness to set for request.\n * @return totalBond default bond + final fee that the proposer and disputer will be required to pay.\n */\n function requestPrice(\n bytes32 identifier,\n uint32 timestamp,\n bytes memory ancillaryData,\n IERC20 currency,\n uint256 reward,\n uint256 bond,\n uint256 customLiveness\n ) external virtual returns (uint256 totalBond);\n\n /**\n * @notice Proposes a price value on another address' behalf. Note: this address will receive any rewards that come\n * from this proposal. However, any bonds are pulled from the caller.\n * @param requester sender of the initial price request.\n * @param identifier price identifier to identify the existing request.\n * @param timestamp timestamp to identify the existing request.\n * @param ancillaryData ancillary data of the price being requested.\n * @param request price request parameters whose hash must match the request that the caller wants to\n * propose a price for.\n * @param proposer address to set as the proposer.\n * @param proposedPrice price being proposed.\n * @return totalBond the amount that's pulled from the caller's wallet as a bond. The bond will be returned to\n * the proposer once settled if the proposal is correct.\n */\n function proposePriceFor(\n address requester,\n bytes32 identifier,\n uint32 timestamp,\n bytes memory ancillaryData,\n Request memory request,\n address proposer,\n int256 proposedPrice\n ) public virtual returns (uint256 totalBond);\n\n /**\n * @notice Proposes a price value where caller is the proposer.\n * @param requester sender of the initial price request.\n * @param identifier price identifier to identify the existing request.\n * @param timestamp timestamp to identify the existing request.\n * @param ancillaryData ancillary data of the price being requested.\n * @param request price request parameters whose hash must match the request that the caller wants to\n * propose a price for.\n * @param proposedPrice price being proposed.\n * @return totalBond the amount that's pulled from the caller's wallet as a bond. The bond will be returned to\n * the proposer once settled if the proposal is correct.\n */\n function proposePrice(\n address requester,\n bytes32 identifier,\n uint32 timestamp,\n bytes memory ancillaryData,\n Request memory request,\n int256 proposedPrice\n ) external virtual returns (uint256 totalBond);\n\n /**\n * @notice Combines logic of requestPrice and proposePrice while taking advantage of gas savings from not having to\n * overwrite Request params that a normal requestPrice() => proposePrice() flow would entail. Note: The proposer\n * will receive any rewards that come from this proposal. However, any bonds are pulled from the caller.\n * @dev The caller is the requester, but the proposer can be customized.\n * @param identifier price identifier to identify the existing request.\n * @param timestamp timestamp to identify the existing request.\n * @param ancillaryData ancillary data of the price being requested.\n * @param currency ERC20 token used for payment of rewards and fees. Must be approved for use with the DVM.\n * @param reward reward offered to a successful proposer. Will be pulled from the caller. Note: this can be 0,\n * which could make sense if the contract requests and proposes the value in the same call or\n * provides its own reward system.\n * @param bond custom proposal bond to set for request. If set to 0, defaults to the final fee.\n * @param customLiveness custom proposal liveness to set for request.\n * @param proposer address to set as the proposer.\n * @param proposedPrice price being proposed.\n * @return totalBond the amount that's pulled from the caller's wallet as a bond. The bond will be returned to\n * the proposer once settled if the proposal is correct.\n */\n function requestAndProposePriceFor(\n bytes32 identifier,\n uint32 timestamp,\n bytes memory ancillaryData,\n IERC20 currency,\n uint256 reward,\n uint256 bond,\n uint256 customLiveness,\n address proposer,\n int256 proposedPrice\n ) external virtual returns (uint256 totalBond);\n\n /**\n * @notice Disputes a price request with an active proposal on another address' behalf. Note: this address will\n * receive any rewards that come from this dispute. However, any bonds are pulled from the caller.\n * @param identifier price identifier to identify the existing request.\n * @param timestamp timestamp to identify the existing request.\n * @param ancillaryData ancillary data of the price being requested.\n * @param request price request parameters whose hash must match the request that the caller wants to\n * dispute.\n * @param disputer address to set as the disputer.\n * @param requester sender of the initial price request.\n * @return totalBond the amount that's pulled from the caller's wallet as a bond. The bond will be returned to\n * the disputer once settled if the dispute was valid (the proposal was incorrect).\n */\n function disputePriceFor(\n bytes32 identifier,\n uint32 timestamp,\n bytes memory ancillaryData,\n Request memory request,\n address disputer,\n address requester\n ) public virtual returns (uint256 totalBond);\n\n /**\n * @notice Disputes a price request with an active proposal where caller is the disputer.\n * @param requester sender of the initial price request.\n * @param identifier price identifier to identify the existing request.\n * @param timestamp timestamp to identify the existing request.\n * @param ancillaryData ancillary data of the price being requested.\n * @param request price request parameters whose hash must match the request that the caller wants to\n * dispute.\n * @return totalBond the amount that's pulled from the caller's wallet as a bond. The bond will be returned to\n * the disputer once settled if the dispute was valid (the proposal was incorrect).\n */\n function disputePrice(\n address requester,\n bytes32 identifier,\n uint32 timestamp,\n bytes memory ancillaryData,\n Request memory request\n ) external virtual returns (uint256 totalBond);\n\n /**\n * @notice Attempts to settle an outstanding price request. Will revert if it isn't settleable.\n * @param requester sender of the initial price request.\n * @param identifier price identifier to identify the existing request.\n * @param timestamp timestamp to identify the existing request.\n * @param ancillaryData ancillary data of the price being requested.\n * @param request price request parameters whose hash must match the request that the caller wants to\n * settle.\n * @return payout the amount that the \"winner\" (proposer or disputer) receives on settlement. This amount includes\n * the returned bonds as well as additional rewards.\n * @return resolvedPrice the price that the request settled to.\n */\n function settle(\n address requester,\n bytes32 identifier,\n uint32 timestamp,\n bytes memory ancillaryData,\n Request memory request\n ) external virtual returns (uint256 payout, int256 resolvedPrice);\n\n /**\n * @notice Computes the current state of a price request. See the State enum for more details.\n * @param requester sender of the initial price request.\n * @param identifier price identifier to identify the existing request.\n * @param timestamp timestamp to identify the existing request.\n * @param ancillaryData ancillary data of the price being requested.\n * @param request price request parameters.\n * @return the State.\n */\n function getState(\n address requester,\n bytes32 identifier,\n uint32 timestamp,\n bytes memory ancillaryData,\n Request memory request\n ) external virtual returns (OptimisticOracleInterface.State);\n\n /**\n * @notice Checks if a given request has resolved, expired or been settled (i.e the optimistic oracle has a price).\n * @param requester sender of the initial price request.\n * @param identifier price identifier to identify the existing request.\n * @param timestamp timestamp to identify the existing request.\n * @param ancillaryData ancillary data of the price being requested.\n * @param request price request parameters. The hash of these parameters must match with the request hash that is\n * associated with the price request unique ID {requester, identifier, timestamp, ancillaryData}, or this method\n * will revert.\n * @return boolean indicating true if price exists and false if not.\n */\n function hasPrice(\n address requester,\n bytes32 identifier,\n uint32 timestamp,\n bytes memory ancillaryData,\n Request memory request\n ) public virtual returns (bool);\n\n /**\n * @notice Generates stamped ancillary data in the format that it would be used in the case of a price dispute.\n * @param ancillaryData ancillary data of the price being requested.\n * @param requester sender of the initial price request.\n * @return the stamped ancillary bytes.\n */\n function stampAncillaryData(bytes memory ancillaryData, address requester)\n public\n pure\n virtual\n returns (bytes memory);\n}\n" - }, - "@uma/core/contracts/oracle/interfaces/OptimisticOracleInterface.sol": { - "content": "// SPDX-License-Identifier: AGPL-3.0-only\npragma solidity ^0.8.0;\n\nimport \"@openzeppelin/contracts/token/ERC20/IERC20.sol\";\n\n/**\n * @title Financial contract facing Oracle interface.\n * @dev Interface used by financial contracts to interact with the Oracle. Voters will use a different interface.\n */\nabstract contract OptimisticOracleInterface {\n // Struct representing the state of a price request.\n enum State {\n Invalid, // Never requested.\n Requested, // Requested, no other actions taken.\n Proposed, // Proposed, but not expired or disputed yet.\n Expired, // Proposed, not disputed, past liveness.\n Disputed, // Disputed, but no DVM price returned yet.\n Resolved, // Disputed and DVM price is available.\n Settled // Final price has been set in the contract (can get here from Expired or Resolved).\n }\n\n // Struct representing a price request.\n struct Request {\n address proposer; // Address of the proposer.\n address disputer; // Address of the disputer.\n IERC20 currency; // ERC20 token used to pay rewards and fees.\n bool settled; // True if the request is settled.\n bool refundOnDispute; // True if the requester should be refunded their reward on dispute.\n int256 proposedPrice; // Price that the proposer submitted.\n int256 resolvedPrice; // Price resolved once the request is settled.\n uint256 expirationTime; // Time at which the request auto-settles without a dispute.\n uint256 reward; // Amount of the currency to pay to the proposer on settlement.\n uint256 finalFee; // Final fee to pay to the Store upon request to the DVM.\n uint256 bond; // Bond that the proposer and disputer must pay on top of the final fee.\n uint256 customLiveness; // Custom liveness value set by the requester.\n }\n\n // This value must be <= the Voting contract's `ancillaryBytesLimit` value otherwise it is possible\n // that a price can be requested to this contract successfully, but cannot be disputed because the DVM refuses\n // to accept a price request made with ancillary data length over a certain size.\n uint256 public constant ancillaryBytesLimit = 8192;\n\n /**\n * @notice Requests a new price.\n * @param identifier price identifier being requested.\n * @param timestamp timestamp of the price being requested.\n * @param ancillaryData ancillary data representing additional args being passed with the price request.\n * @param currency ERC20 token used for payment of rewards and fees. Must be approved for use with the DVM.\n * @param reward reward offered to a successful proposer. Will be pulled from the caller. Note: this can be 0,\n * which could make sense if the contract requests and proposes the value in the same call or\n * provides its own reward system.\n * @return totalBond default bond (final fee) + final fee that the proposer and disputer will be required to pay.\n * This can be changed with a subsequent call to setBond().\n */\n function requestPrice(\n bytes32 identifier,\n uint256 timestamp,\n bytes memory ancillaryData,\n IERC20 currency,\n uint256 reward\n ) external virtual returns (uint256 totalBond);\n\n /**\n * @notice Set the proposal bond associated with a price request.\n * @param identifier price identifier to identify the existing request.\n * @param timestamp timestamp to identify the existing request.\n * @param ancillaryData ancillary data of the price being requested.\n * @param bond custom bond amount to set.\n * @return totalBond new bond + final fee that the proposer and disputer will be required to pay. This can be\n * changed again with a subsequent call to setBond().\n */\n function setBond(\n bytes32 identifier,\n uint256 timestamp,\n bytes memory ancillaryData,\n uint256 bond\n ) external virtual returns (uint256 totalBond);\n\n /**\n * @notice Sets the request to refund the reward if the proposal is disputed. This can help to \"hedge\" the caller\n * in the event of a dispute-caused delay. Note: in the event of a dispute, the winner still receives the other's\n * bond, so there is still profit to be made even if the reward is refunded.\n * @param identifier price identifier to identify the existing request.\n * @param timestamp timestamp to identify the existing request.\n * @param ancillaryData ancillary data of the price being requested.\n */\n function setRefundOnDispute(\n bytes32 identifier,\n uint256 timestamp,\n bytes memory ancillaryData\n ) external virtual;\n\n /**\n * @notice Sets a custom liveness value for the request. Liveness is the amount of time a proposal must wait before\n * being auto-resolved.\n * @param identifier price identifier to identify the existing request.\n * @param timestamp timestamp to identify the existing request.\n * @param ancillaryData ancillary data of the price being requested.\n * @param customLiveness new custom liveness.\n */\n function setCustomLiveness(\n bytes32 identifier,\n uint256 timestamp,\n bytes memory ancillaryData,\n uint256 customLiveness\n ) external virtual;\n\n /**\n * @notice Proposes a price value on another address' behalf. Note: this address will receive any rewards that come\n * from this proposal. However, any bonds are pulled from the caller.\n * @param proposer address to set as the proposer.\n * @param requester sender of the initial price request.\n * @param identifier price identifier to identify the existing request.\n * @param timestamp timestamp to identify the existing request.\n * @param ancillaryData ancillary data of the price being requested.\n * @param proposedPrice price being proposed.\n * @return totalBond the amount that's pulled from the caller's wallet as a bond. The bond will be returned to\n * the proposer once settled if the proposal is correct.\n */\n function proposePriceFor(\n address proposer,\n address requester,\n bytes32 identifier,\n uint256 timestamp,\n bytes memory ancillaryData,\n int256 proposedPrice\n ) public virtual returns (uint256 totalBond);\n\n /**\n * @notice Proposes a price value for an existing price request.\n * @param requester sender of the initial price request.\n * @param identifier price identifier to identify the existing request.\n * @param timestamp timestamp to identify the existing request.\n * @param ancillaryData ancillary data of the price being requested.\n * @param proposedPrice price being proposed.\n * @return totalBond the amount that's pulled from the proposer's wallet as a bond. The bond will be returned to\n * the proposer once settled if the proposal is correct.\n */\n function proposePrice(\n address requester,\n bytes32 identifier,\n uint256 timestamp,\n bytes memory ancillaryData,\n int256 proposedPrice\n ) external virtual returns (uint256 totalBond);\n\n /**\n * @notice Disputes a price request with an active proposal on another address' behalf. Note: this address will\n * receive any rewards that come from this dispute. However, any bonds are pulled from the caller.\n * @param disputer address to set as the disputer.\n * @param requester sender of the initial price request.\n * @param identifier price identifier to identify the existing request.\n * @param timestamp timestamp to identify the existing request.\n * @param ancillaryData ancillary data of the price being requested.\n * @return totalBond the amount that's pulled from the caller's wallet as a bond. The bond will be returned to\n * the disputer once settled if the dispute was value (the proposal was incorrect).\n */\n function disputePriceFor(\n address disputer,\n address requester,\n bytes32 identifier,\n uint256 timestamp,\n bytes memory ancillaryData\n ) public virtual returns (uint256 totalBond);\n\n /**\n * @notice Disputes a price value for an existing price request with an active proposal.\n * @param requester sender of the initial price request.\n * @param identifier price identifier to identify the existing request.\n * @param timestamp timestamp to identify the existing request.\n * @param ancillaryData ancillary data of the price being requested.\n * @return totalBond the amount that's pulled from the disputer's wallet as a bond. The bond will be returned to\n * the disputer once settled if the dispute was valid (the proposal was incorrect).\n */\n function disputePrice(\n address requester,\n bytes32 identifier,\n uint256 timestamp,\n bytes memory ancillaryData\n ) external virtual returns (uint256 totalBond);\n\n /**\n * @notice Retrieves a price that was previously requested by a caller. Reverts if the request is not settled\n * or settleable. Note: this method is not view so that this call may actually settle the price request if it\n * hasn't been settled.\n * @param identifier price identifier to identify the existing request.\n * @param timestamp timestamp to identify the existing request.\n * @param ancillaryData ancillary data of the price being requested.\n * @return resolved price.\n */\n function settleAndGetPrice(\n bytes32 identifier,\n uint256 timestamp,\n bytes memory ancillaryData\n ) external virtual returns (int256);\n\n /**\n * @notice Attempts to settle an outstanding price request. Will revert if it isn't settleable.\n * @param requester sender of the initial price request.\n * @param identifier price identifier to identify the existing request.\n * @param timestamp timestamp to identify the existing request.\n * @param ancillaryData ancillary data of the price being requested.\n * @return payout the amount that the \"winner\" (proposer or disputer) receives on settlement. This amount includes\n * the returned bonds as well as additional rewards.\n */\n function settle(\n address requester,\n bytes32 identifier,\n uint256 timestamp,\n bytes memory ancillaryData\n ) external virtual returns (uint256 payout);\n\n /**\n * @notice Gets the current data structure containing all information about a price request.\n * @param requester sender of the initial price request.\n * @param identifier price identifier to identify the existing request.\n * @param timestamp timestamp to identify the existing request.\n * @param ancillaryData ancillary data of the price being requested.\n * @return the Request data structure.\n */\n function getRequest(\n address requester,\n bytes32 identifier,\n uint256 timestamp,\n bytes memory ancillaryData\n ) public view virtual returns (Request memory);\n\n /**\n * @notice Returns the state of a price request.\n * @param requester sender of the initial price request.\n * @param identifier price identifier to identify the existing request.\n * @param timestamp timestamp to identify the existing request.\n * @param ancillaryData ancillary data of the price being requested.\n * @return the State enum value.\n */\n function getState(\n address requester,\n bytes32 identifier,\n uint256 timestamp,\n bytes memory ancillaryData\n ) public view virtual returns (State);\n\n /**\n * @notice Checks if a given request has resolved or been settled (i.e the optimistic oracle has a price).\n * @param requester sender of the initial price request.\n * @param identifier price identifier to identify the existing request.\n * @param timestamp timestamp to identify the existing request.\n * @param ancillaryData ancillary data of the price being requested.\n * @return true if price has resolved or settled, false otherwise.\n */\n function hasPrice(\n address requester,\n bytes32 identifier,\n uint256 timestamp,\n bytes memory ancillaryData\n ) public view virtual returns (bool);\n\n function stampAncillaryData(bytes memory ancillaryData, address requester)\n public\n view\n virtual\n returns (bytes memory);\n}\n" - }, - "@uma/core/contracts/oracle/interfaces/StoreInterface.sol": { - "content": "// SPDX-License-Identifier: AGPL-3.0-only\npragma solidity ^0.8.0;\n\nimport \"@openzeppelin/contracts/token/ERC20/IERC20.sol\";\nimport \"../../common/implementation/FixedPoint.sol\";\n\n/**\n * @title Interface that allows financial contracts to pay oracle fees for their use of the system.\n */\ninterface StoreInterface {\n /**\n * @notice Pays Oracle fees in ETH to the store.\n * @dev To be used by contracts whose margin currency is ETH.\n */\n function payOracleFees() external payable;\n\n /**\n * @notice Pays oracle fees in the margin currency, erc20Address, to the store.\n * @dev To be used if the margin currency is an ERC20 token rather than ETH.\n * @param erc20Address address of the ERC20 token used to pay the fee.\n * @param amount number of tokens to transfer. An approval for at least this amount must exist.\n */\n function payOracleFeesErc20(address erc20Address, FixedPoint.Unsigned calldata amount) external;\n\n /**\n * @notice Computes the regular oracle fees that a contract should pay for a period.\n * @param startTime defines the beginning time from which the fee is paid.\n * @param endTime end time until which the fee is paid.\n * @param pfc \"profit from corruption\", or the maximum amount of margin currency that a\n * token sponsor could extract from the contract through corrupting the price feed in their favor.\n * @return regularFee amount owed for the duration from start to end time for the given pfc.\n * @return latePenalty for paying the fee after the deadline.\n */\n function computeRegularFee(\n uint256 startTime,\n uint256 endTime,\n FixedPoint.Unsigned calldata pfc\n ) external view returns (FixedPoint.Unsigned memory regularFee, FixedPoint.Unsigned memory latePenalty);\n\n /**\n * @notice Computes the final oracle fees that a contract should pay at settlement.\n * @param currency token used to pay the final fee.\n * @return finalFee amount due.\n */\n function computeFinalFee(address currency) external view returns (FixedPoint.Unsigned memory);\n}\n" - }, - "@uma/core/contracts/common/implementation/FixedPoint.sol": { - "content": "// SPDX-License-Identifier: AGPL-3.0-only\npragma solidity ^0.8.0;\n\nimport \"@openzeppelin/contracts/utils/math/SafeMath.sol\";\nimport \"@openzeppelin/contracts/utils/math/SignedSafeMath.sol\";\n\n/**\n * @title Library for fixed point arithmetic on uints\n */\nlibrary FixedPoint {\n using SafeMath for uint256;\n using SignedSafeMath for int256;\n\n // Supports 18 decimals. E.g., 1e18 represents \"1\", 5e17 represents \"0.5\".\n // For unsigned values:\n // This can represent a value up to (2^256 - 1)/10^18 = ~10^59. 10^59 will be stored internally as uint256 10^77.\n uint256 private constant FP_SCALING_FACTOR = 10**18;\n\n // --------------------------------------- UNSIGNED -----------------------------------------------------------------------------\n struct Unsigned {\n uint256 rawValue;\n }\n\n /**\n * @notice Constructs an `Unsigned` from an unscaled uint, e.g., `b=5` gets stored internally as `5*(10**18)`.\n * @param a uint to convert into a FixedPoint.\n * @return the converted FixedPoint.\n */\n function fromUnscaledUint(uint256 a) internal pure returns (Unsigned memory) {\n return Unsigned(a.mul(FP_SCALING_FACTOR));\n }\n\n /**\n * @notice Whether `a` is equal to `b`.\n * @param a a FixedPoint.\n * @param b a uint256.\n * @return True if equal, or False.\n */\n function isEqual(Unsigned memory a, uint256 b) internal pure returns (bool) {\n return a.rawValue == fromUnscaledUint(b).rawValue;\n }\n\n /**\n * @notice Whether `a` is equal to `b`.\n * @param a a FixedPoint.\n * @param b a FixedPoint.\n * @return True if equal, or False.\n */\n function isEqual(Unsigned memory a, Unsigned memory b) internal pure returns (bool) {\n return a.rawValue == b.rawValue;\n }\n\n /**\n * @notice Whether `a` is greater than `b`.\n * @param a a FixedPoint.\n * @param b a FixedPoint.\n * @return True if `a > b`, or False.\n */\n function isGreaterThan(Unsigned memory a, Unsigned memory b) internal pure returns (bool) {\n return a.rawValue > b.rawValue;\n }\n\n /**\n * @notice Whether `a` is greater than `b`.\n * @param a a FixedPoint.\n * @param b a uint256.\n * @return True if `a > b`, or False.\n */\n function isGreaterThan(Unsigned memory a, uint256 b) internal pure returns (bool) {\n return a.rawValue > fromUnscaledUint(b).rawValue;\n }\n\n /**\n * @notice Whether `a` is greater than `b`.\n * @param a a uint256.\n * @param b a FixedPoint.\n * @return True if `a > b`, or False.\n */\n function isGreaterThan(uint256 a, Unsigned memory b) internal pure returns (bool) {\n return fromUnscaledUint(a).rawValue > b.rawValue;\n }\n\n /**\n * @notice Whether `a` is greater than or equal to `b`.\n * @param a a FixedPoint.\n * @param b a FixedPoint.\n * @return True if `a >= b`, or False.\n */\n function isGreaterThanOrEqual(Unsigned memory a, Unsigned memory b) internal pure returns (bool) {\n return a.rawValue >= b.rawValue;\n }\n\n /**\n * @notice Whether `a` is greater than or equal to `b`.\n * @param a a FixedPoint.\n * @param b a uint256.\n * @return True if `a >= b`, or False.\n */\n function isGreaterThanOrEqual(Unsigned memory a, uint256 b) internal pure returns (bool) {\n return a.rawValue >= fromUnscaledUint(b).rawValue;\n }\n\n /**\n * @notice Whether `a` is greater than or equal to `b`.\n * @param a a uint256.\n * @param b a FixedPoint.\n * @return True if `a >= b`, or False.\n */\n function isGreaterThanOrEqual(uint256 a, Unsigned memory b) internal pure returns (bool) {\n return fromUnscaledUint(a).rawValue >= b.rawValue;\n }\n\n /**\n * @notice Whether `a` is less than `b`.\n * @param a a FixedPoint.\n * @param b a FixedPoint.\n * @return True if `a < b`, or False.\n */\n function isLessThan(Unsigned memory a, Unsigned memory b) internal pure returns (bool) {\n return a.rawValue < b.rawValue;\n }\n\n /**\n * @notice Whether `a` is less than `b`.\n * @param a a FixedPoint.\n * @param b a uint256.\n * @return True if `a < b`, or False.\n */\n function isLessThan(Unsigned memory a, uint256 b) internal pure returns (bool) {\n return a.rawValue < fromUnscaledUint(b).rawValue;\n }\n\n /**\n * @notice Whether `a` is less than `b`.\n * @param a a uint256.\n * @param b a FixedPoint.\n * @return True if `a < b`, or False.\n */\n function isLessThan(uint256 a, Unsigned memory b) internal pure returns (bool) {\n return fromUnscaledUint(a).rawValue < b.rawValue;\n }\n\n /**\n * @notice Whether `a` is less than or equal to `b`.\n * @param a a FixedPoint.\n * @param b a FixedPoint.\n * @return True if `a <= b`, or False.\n */\n function isLessThanOrEqual(Unsigned memory a, Unsigned memory b) internal pure returns (bool) {\n return a.rawValue <= b.rawValue;\n }\n\n /**\n * @notice Whether `a` is less than or equal to `b`.\n * @param a a FixedPoint.\n * @param b a uint256.\n * @return True if `a <= b`, or False.\n */\n function isLessThanOrEqual(Unsigned memory a, uint256 b) internal pure returns (bool) {\n return a.rawValue <= fromUnscaledUint(b).rawValue;\n }\n\n /**\n * @notice Whether `a` is less than or equal to `b`.\n * @param a a uint256.\n * @param b a FixedPoint.\n * @return True if `a <= b`, or False.\n */\n function isLessThanOrEqual(uint256 a, Unsigned memory b) internal pure returns (bool) {\n return fromUnscaledUint(a).rawValue <= b.rawValue;\n }\n\n /**\n * @notice The minimum of `a` and `b`.\n * @param a a FixedPoint.\n * @param b a FixedPoint.\n * @return the minimum of `a` and `b`.\n */\n function min(Unsigned memory a, Unsigned memory b) internal pure returns (Unsigned memory) {\n return a.rawValue < b.rawValue ? a : b;\n }\n\n /**\n * @notice The maximum of `a` and `b`.\n * @param a a FixedPoint.\n * @param b a FixedPoint.\n * @return the maximum of `a` and `b`.\n */\n function max(Unsigned memory a, Unsigned memory b) internal pure returns (Unsigned memory) {\n return a.rawValue > b.rawValue ? a : b;\n }\n\n /**\n * @notice Adds two `Unsigned`s, reverting on overflow.\n * @param a a FixedPoint.\n * @param b a FixedPoint.\n * @return the sum of `a` and `b`.\n */\n function add(Unsigned memory a, Unsigned memory b) internal pure returns (Unsigned memory) {\n return Unsigned(a.rawValue.add(b.rawValue));\n }\n\n /**\n * @notice Adds an `Unsigned` to an unscaled uint, reverting on overflow.\n * @param a a FixedPoint.\n * @param b a uint256.\n * @return the sum of `a` and `b`.\n */\n function add(Unsigned memory a, uint256 b) internal pure returns (Unsigned memory) {\n return add(a, fromUnscaledUint(b));\n }\n\n /**\n * @notice Subtracts two `Unsigned`s, reverting on overflow.\n * @param a a FixedPoint.\n * @param b a FixedPoint.\n * @return the difference of `a` and `b`.\n */\n function sub(Unsigned memory a, Unsigned memory b) internal pure returns (Unsigned memory) {\n return Unsigned(a.rawValue.sub(b.rawValue));\n }\n\n /**\n * @notice Subtracts an unscaled uint256 from an `Unsigned`, reverting on overflow.\n * @param a a FixedPoint.\n * @param b a uint256.\n * @return the difference of `a` and `b`.\n */\n function sub(Unsigned memory a, uint256 b) internal pure returns (Unsigned memory) {\n return sub(a, fromUnscaledUint(b));\n }\n\n /**\n * @notice Subtracts an `Unsigned` from an unscaled uint256, reverting on overflow.\n * @param a a uint256.\n * @param b a FixedPoint.\n * @return the difference of `a` and `b`.\n */\n function sub(uint256 a, Unsigned memory b) internal pure returns (Unsigned memory) {\n return sub(fromUnscaledUint(a), b);\n }\n\n /**\n * @notice Multiplies two `Unsigned`s, reverting on overflow.\n * @dev This will \"floor\" the product.\n * @param a a FixedPoint.\n * @param b a FixedPoint.\n * @return the product of `a` and `b`.\n */\n function mul(Unsigned memory a, Unsigned memory b) internal pure returns (Unsigned memory) {\n // There are two caveats with this computation:\n // 1. Max output for the represented number is ~10^41, otherwise an intermediate value overflows. 10^41 is\n // stored internally as a uint256 ~10^59.\n // 2. Results that can't be represented exactly are truncated not rounded. E.g., 1.4 * 2e-18 = 2.8e-18, which\n // would round to 3, but this computation produces the result 2.\n // No need to use SafeMath because FP_SCALING_FACTOR != 0.\n return Unsigned(a.rawValue.mul(b.rawValue) / FP_SCALING_FACTOR);\n }\n\n /**\n * @notice Multiplies an `Unsigned` and an unscaled uint256, reverting on overflow.\n * @dev This will \"floor\" the product.\n * @param a a FixedPoint.\n * @param b a uint256.\n * @return the product of `a` and `b`.\n */\n function mul(Unsigned memory a, uint256 b) internal pure returns (Unsigned memory) {\n return Unsigned(a.rawValue.mul(b));\n }\n\n /**\n * @notice Multiplies two `Unsigned`s and \"ceil's\" the product, reverting on overflow.\n * @param a a FixedPoint.\n * @param b a FixedPoint.\n * @return the product of `a` and `b`.\n */\n function mulCeil(Unsigned memory a, Unsigned memory b) internal pure returns (Unsigned memory) {\n uint256 mulRaw = a.rawValue.mul(b.rawValue);\n uint256 mulFloor = mulRaw / FP_SCALING_FACTOR;\n uint256 mod = mulRaw.mod(FP_SCALING_FACTOR);\n if (mod != 0) {\n return Unsigned(mulFloor.add(1));\n } else {\n return Unsigned(mulFloor);\n }\n }\n\n /**\n * @notice Multiplies an `Unsigned` and an unscaled uint256 and \"ceil's\" the product, reverting on overflow.\n * @param a a FixedPoint.\n * @param b a FixedPoint.\n * @return the product of `a` and `b`.\n */\n function mulCeil(Unsigned memory a, uint256 b) internal pure returns (Unsigned memory) {\n // Since b is an uint, there is no risk of truncation and we can just mul it normally\n return Unsigned(a.rawValue.mul(b));\n }\n\n /**\n * @notice Divides one `Unsigned` by an `Unsigned`, reverting on overflow or division by 0.\n * @dev This will \"floor\" the quotient.\n * @param a a FixedPoint numerator.\n * @param b a FixedPoint denominator.\n * @return the quotient of `a` divided by `b`.\n */\n function div(Unsigned memory a, Unsigned memory b) internal pure returns (Unsigned memory) {\n // There are two caveats with this computation:\n // 1. Max value for the number dividend `a` represents is ~10^41, otherwise an intermediate value overflows.\n // 10^41 is stored internally as a uint256 10^59.\n // 2. Results that can't be represented exactly are truncated not rounded. E.g., 2 / 3 = 0.6 repeating, which\n // would round to 0.666666666666666667, but this computation produces the result 0.666666666666666666.\n return Unsigned(a.rawValue.mul(FP_SCALING_FACTOR).div(b.rawValue));\n }\n\n /**\n * @notice Divides one `Unsigned` by an unscaled uint256, reverting on overflow or division by 0.\n * @dev This will \"floor\" the quotient.\n * @param a a FixedPoint numerator.\n * @param b a uint256 denominator.\n * @return the quotient of `a` divided by `b`.\n */\n function div(Unsigned memory a, uint256 b) internal pure returns (Unsigned memory) {\n return Unsigned(a.rawValue.div(b));\n }\n\n /**\n * @notice Divides one unscaled uint256 by an `Unsigned`, reverting on overflow or division by 0.\n * @dev This will \"floor\" the quotient.\n * @param a a uint256 numerator.\n * @param b a FixedPoint denominator.\n * @return the quotient of `a` divided by `b`.\n */\n function div(uint256 a, Unsigned memory b) internal pure returns (Unsigned memory) {\n return div(fromUnscaledUint(a), b);\n }\n\n /**\n * @notice Divides one `Unsigned` by an `Unsigned` and \"ceil's\" the quotient, reverting on overflow or division by 0.\n * @param a a FixedPoint numerator.\n * @param b a FixedPoint denominator.\n * @return the quotient of `a` divided by `b`.\n */\n function divCeil(Unsigned memory a, Unsigned memory b) internal pure returns (Unsigned memory) {\n uint256 aScaled = a.rawValue.mul(FP_SCALING_FACTOR);\n uint256 divFloor = aScaled.div(b.rawValue);\n uint256 mod = aScaled.mod(b.rawValue);\n if (mod != 0) {\n return Unsigned(divFloor.add(1));\n } else {\n return Unsigned(divFloor);\n }\n }\n\n /**\n * @notice Divides one `Unsigned` by an unscaled uint256 and \"ceil's\" the quotient, reverting on overflow or division by 0.\n * @param a a FixedPoint numerator.\n * @param b a uint256 denominator.\n * @return the quotient of `a` divided by `b`.\n */\n function divCeil(Unsigned memory a, uint256 b) internal pure returns (Unsigned memory) {\n // Because it is possible that a quotient gets truncated, we can't just call \"Unsigned(a.rawValue.div(b))\"\n // similarly to mulCeil with a uint256 as the second parameter. Therefore we need to convert b into an Unsigned.\n // This creates the possibility of overflow if b is very large.\n return divCeil(a, fromUnscaledUint(b));\n }\n\n /**\n * @notice Raises an `Unsigned` to the power of an unscaled uint256, reverting on overflow. E.g., `b=2` squares `a`.\n * @dev This will \"floor\" the result.\n * @param a a FixedPoint numerator.\n * @param b a uint256 denominator.\n * @return output is `a` to the power of `b`.\n */\n function pow(Unsigned memory a, uint256 b) internal pure returns (Unsigned memory output) {\n output = fromUnscaledUint(1);\n for (uint256 i = 0; i < b; i = i.add(1)) {\n output = mul(output, a);\n }\n }\n\n // ------------------------------------------------- SIGNED -------------------------------------------------------------\n // Supports 18 decimals. E.g., 1e18 represents \"1\", 5e17 represents \"0.5\".\n // For signed values:\n // This can represent a value up (or down) to +-(2^255 - 1)/10^18 = ~10^58. 10^58 will be stored internally as int256 10^76.\n int256 private constant SFP_SCALING_FACTOR = 10**18;\n\n struct Signed {\n int256 rawValue;\n }\n\n function fromSigned(Signed memory a) internal pure returns (Unsigned memory) {\n require(a.rawValue >= 0, \"Negative value provided\");\n return Unsigned(uint256(a.rawValue));\n }\n\n function fromUnsigned(Unsigned memory a) internal pure returns (Signed memory) {\n require(a.rawValue <= uint256(type(int256).max), \"Unsigned too large\");\n return Signed(int256(a.rawValue));\n }\n\n /**\n * @notice Constructs a `Signed` from an unscaled int, e.g., `b=5` gets stored internally as `5*(10**18)`.\n * @param a int to convert into a FixedPoint.Signed.\n * @return the converted FixedPoint.Signed.\n */\n function fromUnscaledInt(int256 a) internal pure returns (Signed memory) {\n return Signed(a.mul(SFP_SCALING_FACTOR));\n }\n\n /**\n * @notice Whether `a` is equal to `b`.\n * @param a a FixedPoint.Signed.\n * @param b a int256.\n * @return True if equal, or False.\n */\n function isEqual(Signed memory a, int256 b) internal pure returns (bool) {\n return a.rawValue == fromUnscaledInt(b).rawValue;\n }\n\n /**\n * @notice Whether `a` is equal to `b`.\n * @param a a FixedPoint.Signed.\n * @param b a FixedPoint.Signed.\n * @return True if equal, or False.\n */\n function isEqual(Signed memory a, Signed memory b) internal pure returns (bool) {\n return a.rawValue == b.rawValue;\n }\n\n /**\n * @notice Whether `a` is greater than `b`.\n * @param a a FixedPoint.Signed.\n * @param b a FixedPoint.Signed.\n * @return True if `a > b`, or False.\n */\n function isGreaterThan(Signed memory a, Signed memory b) internal pure returns (bool) {\n return a.rawValue > b.rawValue;\n }\n\n /**\n * @notice Whether `a` is greater than `b`.\n * @param a a FixedPoint.Signed.\n * @param b an int256.\n * @return True if `a > b`, or False.\n */\n function isGreaterThan(Signed memory a, int256 b) internal pure returns (bool) {\n return a.rawValue > fromUnscaledInt(b).rawValue;\n }\n\n /**\n * @notice Whether `a` is greater than `b`.\n * @param a an int256.\n * @param b a FixedPoint.Signed.\n * @return True if `a > b`, or False.\n */\n function isGreaterThan(int256 a, Signed memory b) internal pure returns (bool) {\n return fromUnscaledInt(a).rawValue > b.rawValue;\n }\n\n /**\n * @notice Whether `a` is greater than or equal to `b`.\n * @param a a FixedPoint.Signed.\n * @param b a FixedPoint.Signed.\n * @return True if `a >= b`, or False.\n */\n function isGreaterThanOrEqual(Signed memory a, Signed memory b) internal pure returns (bool) {\n return a.rawValue >= b.rawValue;\n }\n\n /**\n * @notice Whether `a` is greater than or equal to `b`.\n * @param a a FixedPoint.Signed.\n * @param b an int256.\n * @return True if `a >= b`, or False.\n */\n function isGreaterThanOrEqual(Signed memory a, int256 b) internal pure returns (bool) {\n return a.rawValue >= fromUnscaledInt(b).rawValue;\n }\n\n /**\n * @notice Whether `a` is greater than or equal to `b`.\n * @param a an int256.\n * @param b a FixedPoint.Signed.\n * @return True if `a >= b`, or False.\n */\n function isGreaterThanOrEqual(int256 a, Signed memory b) internal pure returns (bool) {\n return fromUnscaledInt(a).rawValue >= b.rawValue;\n }\n\n /**\n * @notice Whether `a` is less than `b`.\n * @param a a FixedPoint.Signed.\n * @param b a FixedPoint.Signed.\n * @return True if `a < b`, or False.\n */\n function isLessThan(Signed memory a, Signed memory b) internal pure returns (bool) {\n return a.rawValue < b.rawValue;\n }\n\n /**\n * @notice Whether `a` is less than `b`.\n * @param a a FixedPoint.Signed.\n * @param b an int256.\n * @return True if `a < b`, or False.\n */\n function isLessThan(Signed memory a, int256 b) internal pure returns (bool) {\n return a.rawValue < fromUnscaledInt(b).rawValue;\n }\n\n /**\n * @notice Whether `a` is less than `b`.\n * @param a an int256.\n * @param b a FixedPoint.Signed.\n * @return True if `a < b`, or False.\n */\n function isLessThan(int256 a, Signed memory b) internal pure returns (bool) {\n return fromUnscaledInt(a).rawValue < b.rawValue;\n }\n\n /**\n * @notice Whether `a` is less than or equal to `b`.\n * @param a a FixedPoint.Signed.\n * @param b a FixedPoint.Signed.\n * @return True if `a <= b`, or False.\n */\n function isLessThanOrEqual(Signed memory a, Signed memory b) internal pure returns (bool) {\n return a.rawValue <= b.rawValue;\n }\n\n /**\n * @notice Whether `a` is less than or equal to `b`.\n * @param a a FixedPoint.Signed.\n * @param b an int256.\n * @return True if `a <= b`, or False.\n */\n function isLessThanOrEqual(Signed memory a, int256 b) internal pure returns (bool) {\n return a.rawValue <= fromUnscaledInt(b).rawValue;\n }\n\n /**\n * @notice Whether `a` is less than or equal to `b`.\n * @param a an int256.\n * @param b a FixedPoint.Signed.\n * @return True if `a <= b`, or False.\n */\n function isLessThanOrEqual(int256 a, Signed memory b) internal pure returns (bool) {\n return fromUnscaledInt(a).rawValue <= b.rawValue;\n }\n\n /**\n * @notice The minimum of `a` and `b`.\n * @param a a FixedPoint.Signed.\n * @param b a FixedPoint.Signed.\n * @return the minimum of `a` and `b`.\n */\n function min(Signed memory a, Signed memory b) internal pure returns (Signed memory) {\n return a.rawValue < b.rawValue ? a : b;\n }\n\n /**\n * @notice The maximum of `a` and `b`.\n * @param a a FixedPoint.Signed.\n * @param b a FixedPoint.Signed.\n * @return the maximum of `a` and `b`.\n */\n function max(Signed memory a, Signed memory b) internal pure returns (Signed memory) {\n return a.rawValue > b.rawValue ? a : b;\n }\n\n /**\n * @notice Adds two `Signed`s, reverting on overflow.\n * @param a a FixedPoint.Signed.\n * @param b a FixedPoint.Signed.\n * @return the sum of `a` and `b`.\n */\n function add(Signed memory a, Signed memory b) internal pure returns (Signed memory) {\n return Signed(a.rawValue.add(b.rawValue));\n }\n\n /**\n * @notice Adds an `Signed` to an unscaled int, reverting on overflow.\n * @param a a FixedPoint.Signed.\n * @param b an int256.\n * @return the sum of `a` and `b`.\n */\n function add(Signed memory a, int256 b) internal pure returns (Signed memory) {\n return add(a, fromUnscaledInt(b));\n }\n\n /**\n * @notice Subtracts two `Signed`s, reverting on overflow.\n * @param a a FixedPoint.Signed.\n * @param b a FixedPoint.Signed.\n * @return the difference of `a` and `b`.\n */\n function sub(Signed memory a, Signed memory b) internal pure returns (Signed memory) {\n return Signed(a.rawValue.sub(b.rawValue));\n }\n\n /**\n * @notice Subtracts an unscaled int256 from an `Signed`, reverting on overflow.\n * @param a a FixedPoint.Signed.\n * @param b an int256.\n * @return the difference of `a` and `b`.\n */\n function sub(Signed memory a, int256 b) internal pure returns (Signed memory) {\n return sub(a, fromUnscaledInt(b));\n }\n\n /**\n * @notice Subtracts an `Signed` from an unscaled int256, reverting on overflow.\n * @param a an int256.\n * @param b a FixedPoint.Signed.\n * @return the difference of `a` and `b`.\n */\n function sub(int256 a, Signed memory b) internal pure returns (Signed memory) {\n return sub(fromUnscaledInt(a), b);\n }\n\n /**\n * @notice Multiplies two `Signed`s, reverting on overflow.\n * @dev This will \"floor\" the product.\n * @param a a FixedPoint.Signed.\n * @param b a FixedPoint.Signed.\n * @return the product of `a` and `b`.\n */\n function mul(Signed memory a, Signed memory b) internal pure returns (Signed memory) {\n // There are two caveats with this computation:\n // 1. Max output for the represented number is ~10^41, otherwise an intermediate value overflows. 10^41 is\n // stored internally as an int256 ~10^59.\n // 2. Results that can't be represented exactly are truncated not rounded. E.g., 1.4 * 2e-18 = 2.8e-18, which\n // would round to 3, but this computation produces the result 2.\n // No need to use SafeMath because SFP_SCALING_FACTOR != 0.\n return Signed(a.rawValue.mul(b.rawValue) / SFP_SCALING_FACTOR);\n }\n\n /**\n * @notice Multiplies an `Signed` and an unscaled int256, reverting on overflow.\n * @dev This will \"floor\" the product.\n * @param a a FixedPoint.Signed.\n * @param b an int256.\n * @return the product of `a` and `b`.\n */\n function mul(Signed memory a, int256 b) internal pure returns (Signed memory) {\n return Signed(a.rawValue.mul(b));\n }\n\n /**\n * @notice Multiplies two `Signed`s and \"ceil's\" the product, reverting on overflow.\n * @param a a FixedPoint.Signed.\n * @param b a FixedPoint.Signed.\n * @return the product of `a` and `b`.\n */\n function mulAwayFromZero(Signed memory a, Signed memory b) internal pure returns (Signed memory) {\n int256 mulRaw = a.rawValue.mul(b.rawValue);\n int256 mulTowardsZero = mulRaw / SFP_SCALING_FACTOR;\n // Manual mod because SignedSafeMath doesn't support it.\n int256 mod = mulRaw % SFP_SCALING_FACTOR;\n if (mod != 0) {\n bool isResultPositive = isLessThan(a, 0) == isLessThan(b, 0);\n int256 valueToAdd = isResultPositive ? int256(1) : int256(-1);\n return Signed(mulTowardsZero.add(valueToAdd));\n } else {\n return Signed(mulTowardsZero);\n }\n }\n\n /**\n * @notice Multiplies an `Signed` and an unscaled int256 and \"ceil's\" the product, reverting on overflow.\n * @param a a FixedPoint.Signed.\n * @param b a FixedPoint.Signed.\n * @return the product of `a` and `b`.\n */\n function mulAwayFromZero(Signed memory a, int256 b) internal pure returns (Signed memory) {\n // Since b is an int, there is no risk of truncation and we can just mul it normally\n return Signed(a.rawValue.mul(b));\n }\n\n /**\n * @notice Divides one `Signed` by an `Signed`, reverting on overflow or division by 0.\n * @dev This will \"floor\" the quotient.\n * @param a a FixedPoint numerator.\n * @param b a FixedPoint denominator.\n * @return the quotient of `a` divided by `b`.\n */\n function div(Signed memory a, Signed memory b) internal pure returns (Signed memory) {\n // There are two caveats with this computation:\n // 1. Max value for the number dividend `a` represents is ~10^41, otherwise an intermediate value overflows.\n // 10^41 is stored internally as an int256 10^59.\n // 2. Results that can't be represented exactly are truncated not rounded. E.g., 2 / 3 = 0.6 repeating, which\n // would round to 0.666666666666666667, but this computation produces the result 0.666666666666666666.\n return Signed(a.rawValue.mul(SFP_SCALING_FACTOR).div(b.rawValue));\n }\n\n /**\n * @notice Divides one `Signed` by an unscaled int256, reverting on overflow or division by 0.\n * @dev This will \"floor\" the quotient.\n * @param a a FixedPoint numerator.\n * @param b an int256 denominator.\n * @return the quotient of `a` divided by `b`.\n */\n function div(Signed memory a, int256 b) internal pure returns (Signed memory) {\n return Signed(a.rawValue.div(b));\n }\n\n /**\n * @notice Divides one unscaled int256 by an `Signed`, reverting on overflow or division by 0.\n * @dev This will \"floor\" the quotient.\n * @param a an int256 numerator.\n * @param b a FixedPoint denominator.\n * @return the quotient of `a` divided by `b`.\n */\n function div(int256 a, Signed memory b) internal pure returns (Signed memory) {\n return div(fromUnscaledInt(a), b);\n }\n\n /**\n * @notice Divides one `Signed` by an `Signed` and \"ceil's\" the quotient, reverting on overflow or division by 0.\n * @param a a FixedPoint numerator.\n * @param b a FixedPoint denominator.\n * @return the quotient of `a` divided by `b`.\n */\n function divAwayFromZero(Signed memory a, Signed memory b) internal pure returns (Signed memory) {\n int256 aScaled = a.rawValue.mul(SFP_SCALING_FACTOR);\n int256 divTowardsZero = aScaled.div(b.rawValue);\n // Manual mod because SignedSafeMath doesn't support it.\n int256 mod = aScaled % b.rawValue;\n if (mod != 0) {\n bool isResultPositive = isLessThan(a, 0) == isLessThan(b, 0);\n int256 valueToAdd = isResultPositive ? int256(1) : int256(-1);\n return Signed(divTowardsZero.add(valueToAdd));\n } else {\n return Signed(divTowardsZero);\n }\n }\n\n /**\n * @notice Divides one `Signed` by an unscaled int256 and \"ceil's\" the quotient, reverting on overflow or division by 0.\n * @param a a FixedPoint numerator.\n * @param b an int256 denominator.\n * @return the quotient of `a` divided by `b`.\n */\n function divAwayFromZero(Signed memory a, int256 b) internal pure returns (Signed memory) {\n // Because it is possible that a quotient gets truncated, we can't just call \"Signed(a.rawValue.div(b))\"\n // similarly to mulCeil with an int256 as the second parameter. Therefore we need to convert b into an Signed.\n // This creates the possibility of overflow if b is very large.\n return divAwayFromZero(a, fromUnscaledInt(b));\n }\n\n /**\n * @notice Raises an `Signed` to the power of an unscaled uint256, reverting on overflow. E.g., `b=2` squares `a`.\n * @dev This will \"floor\" the result.\n * @param a a FixedPoint.Signed.\n * @param b a uint256 (negative exponents are not allowed).\n * @return output is `a` to the power of `b`.\n */\n function pow(Signed memory a, uint256 b) internal pure returns (Signed memory output) {\n output = fromUnscaledInt(1);\n for (uint256 i = 0; i < b; i = i.add(1)) {\n output = mul(output, a);\n }\n }\n}\n" - }, - "@openzeppelin/contracts/utils/math/SafeMath.sol": { - "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts v4.4.1 (utils/math/SafeMath.sol)\n\npragma solidity ^0.8.0;\n\n// CAUTION\n// This version of SafeMath should only be used with Solidity 0.8 or later,\n// because it relies on the compiler's built in overflow checks.\n\n/**\n * @dev Wrappers over Solidity's arithmetic operations.\n *\n * NOTE: `SafeMath` is generally not needed starting with Solidity 0.8, since the compiler\n * now has built in overflow checking.\n */\nlibrary SafeMath {\n /**\n * @dev Returns the addition of two unsigned integers, with an overflow flag.\n *\n * _Available since v3.4._\n */\n function tryAdd(uint256 a, uint256 b) internal pure returns (bool, uint256) {\n unchecked {\n uint256 c = a + b;\n if (c < a) return (false, 0);\n return (true, c);\n }\n }\n\n /**\n * @dev Returns the substraction of two unsigned integers, with an overflow flag.\n *\n * _Available since v3.4._\n */\n function trySub(uint256 a, uint256 b) internal pure returns (bool, uint256) {\n unchecked {\n if (b > a) return (false, 0);\n return (true, a - b);\n }\n }\n\n /**\n * @dev Returns the multiplication of two unsigned integers, with an overflow flag.\n *\n * _Available since v3.4._\n */\n function tryMul(uint256 a, uint256 b) internal pure returns (bool, uint256) {\n unchecked {\n // Gas optimization: this is cheaper than requiring 'a' not being zero, but the\n // benefit is lost if 'b' is also tested.\n // See: https://github.com/OpenZeppelin/openzeppelin-contracts/pull/522\n if (a == 0) return (true, 0);\n uint256 c = a * b;\n if (c / a != b) return (false, 0);\n return (true, c);\n }\n }\n\n /**\n * @dev Returns the division of two unsigned integers, with a division by zero flag.\n *\n * _Available since v3.4._\n */\n function tryDiv(uint256 a, uint256 b) internal pure returns (bool, uint256) {\n unchecked {\n if (b == 0) return (false, 0);\n return (true, a / b);\n }\n }\n\n /**\n * @dev Returns the remainder of dividing two unsigned integers, with a division by zero flag.\n *\n * _Available since v3.4._\n */\n function tryMod(uint256 a, uint256 b) internal pure returns (bool, uint256) {\n unchecked {\n if (b == 0) return (false, 0);\n return (true, a % b);\n }\n }\n\n /**\n * @dev Returns the addition of two unsigned integers, reverting on\n * overflow.\n *\n * Counterpart to Solidity's `+` operator.\n *\n * Requirements:\n *\n * - Addition cannot overflow.\n */\n function add(uint256 a, uint256 b) internal pure returns (uint256) {\n return a + b;\n }\n\n /**\n * @dev Returns the subtraction of two unsigned integers, reverting on\n * overflow (when the result is negative).\n *\n * Counterpart to Solidity's `-` operator.\n *\n * Requirements:\n *\n * - Subtraction cannot overflow.\n */\n function sub(uint256 a, uint256 b) internal pure returns (uint256) {\n return a - b;\n }\n\n /**\n * @dev Returns the multiplication of two unsigned integers, reverting on\n * overflow.\n *\n * Counterpart to Solidity's `*` operator.\n *\n * Requirements:\n *\n * - Multiplication cannot overflow.\n */\n function mul(uint256 a, uint256 b) internal pure returns (uint256) {\n return a * b;\n }\n\n /**\n * @dev Returns the integer division of two unsigned integers, reverting on\n * division by zero. The result is rounded towards zero.\n *\n * Counterpart to Solidity's `/` operator.\n *\n * Requirements:\n *\n * - The divisor cannot be zero.\n */\n function div(uint256 a, uint256 b) internal pure returns (uint256) {\n return a / b;\n }\n\n /**\n * @dev Returns the remainder of dividing two unsigned integers. (unsigned integer modulo),\n * reverting when dividing by zero.\n *\n * Counterpart to Solidity's `%` operator. This function uses a `revert`\n * opcode (which leaves remaining gas untouched) while Solidity uses an\n * invalid opcode to revert (consuming all remaining gas).\n *\n * Requirements:\n *\n * - The divisor cannot be zero.\n */\n function mod(uint256 a, uint256 b) internal pure returns (uint256) {\n return a % b;\n }\n\n /**\n * @dev Returns the subtraction of two unsigned integers, reverting with custom message on\n * overflow (when the result is negative).\n *\n * CAUTION: This function is deprecated because it requires allocating memory for the error\n * message unnecessarily. For custom revert reasons use {trySub}.\n *\n * Counterpart to Solidity's `-` operator.\n *\n * Requirements:\n *\n * - Subtraction cannot overflow.\n */\n function sub(\n uint256 a,\n uint256 b,\n string memory errorMessage\n ) internal pure returns (uint256) {\n unchecked {\n require(b <= a, errorMessage);\n return a - b;\n }\n }\n\n /**\n * @dev Returns the integer division of two unsigned integers, reverting with custom message on\n * division by zero. The result is rounded towards zero.\n *\n * Counterpart to Solidity's `/` operator. Note: this function uses a\n * `revert` opcode (which leaves remaining gas untouched) while Solidity\n * uses an invalid opcode to revert (consuming all remaining gas).\n *\n * Requirements:\n *\n * - The divisor cannot be zero.\n */\n function div(\n uint256 a,\n uint256 b,\n string memory errorMessage\n ) internal pure returns (uint256) {\n unchecked {\n require(b > 0, errorMessage);\n return a / b;\n }\n }\n\n /**\n * @dev Returns the remainder of dividing two unsigned integers. (unsigned integer modulo),\n * reverting with custom message when dividing by zero.\n *\n * CAUTION: This function is deprecated because it requires allocating memory for the error\n * message unnecessarily. For custom revert reasons use {tryMod}.\n *\n * Counterpart to Solidity's `%` operator. This function uses a `revert`\n * opcode (which leaves remaining gas untouched) while Solidity uses an\n * invalid opcode to revert (consuming all remaining gas).\n *\n * Requirements:\n *\n * - The divisor cannot be zero.\n */\n function mod(\n uint256 a,\n uint256 b,\n string memory errorMessage\n ) internal pure returns (uint256) {\n unchecked {\n require(b > 0, errorMessage);\n return a % b;\n }\n }\n}\n" - }, - "@openzeppelin/contracts/utils/math/SignedSafeMath.sol": { - "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts v4.4.1 (utils/math/SignedSafeMath.sol)\n\npragma solidity ^0.8.0;\n\n/**\n * @dev Wrappers over Solidity's arithmetic operations.\n *\n * NOTE: `SignedSafeMath` is no longer needed starting with Solidity 0.8. The compiler\n * now has built in overflow checking.\n */\nlibrary SignedSafeMath {\n /**\n * @dev Returns the multiplication of two signed integers, reverting on\n * overflow.\n *\n * Counterpart to Solidity's `*` operator.\n *\n * Requirements:\n *\n * - Multiplication cannot overflow.\n */\n function mul(int256 a, int256 b) internal pure returns (int256) {\n return a * b;\n }\n\n /**\n * @dev Returns the integer division of two signed integers. Reverts on\n * division by zero. The result is rounded towards zero.\n *\n * Counterpart to Solidity's `/` operator.\n *\n * Requirements:\n *\n * - The divisor cannot be zero.\n */\n function div(int256 a, int256 b) internal pure returns (int256) {\n return a / b;\n }\n\n /**\n * @dev Returns the subtraction of two signed integers, reverting on\n * overflow.\n *\n * Counterpart to Solidity's `-` operator.\n *\n * Requirements:\n *\n * - Subtraction cannot overflow.\n */\n function sub(int256 a, int256 b) internal pure returns (int256) {\n return a - b;\n }\n\n /**\n * @dev Returns the addition of two signed integers, reverting on\n * overflow.\n *\n * Counterpart to Solidity's `+` operator.\n *\n * Requirements:\n *\n * - Addition cannot overflow.\n */\n function add(int256 a, int256 b) internal pure returns (int256) {\n return a + b;\n }\n}\n" - }, - "@uma/core/contracts/oracle/interfaces/FinderInterface.sol": { - "content": "// SPDX-License-Identifier: AGPL-3.0-only\npragma solidity ^0.8.0;\n\n/**\n * @title Provides addresses of the live contracts implementing certain interfaces.\n * @dev Examples are the Oracle or Store interfaces.\n */\ninterface FinderInterface {\n /**\n * @notice Updates the address of the contract that implements `interfaceName`.\n * @param interfaceName bytes32 encoding of the interface name that is either changed or registered.\n * @param implementationAddress address of the deployed contract that implements the interface.\n */\n function changeImplementationAddress(bytes32 interfaceName, address implementationAddress) external;\n\n /**\n * @notice Gets the address of the contract that implements the given `interfaceName`.\n * @param interfaceName queried interface.\n * @return implementationAddress address of the deployed contract that implements the interface.\n */\n function getImplementationAddress(bytes32 interfaceName) external view returns (address);\n}\n" - }, - "@uma/core/contracts/oracle/interfaces/IdentifierWhitelistInterface.sol": { - "content": "// SPDX-License-Identifier: AGPL-3.0-only\npragma solidity ^0.8.0;\n\n/**\n * @title Interface for whitelists of supported identifiers that the oracle can provide prices for.\n */\ninterface IdentifierWhitelistInterface {\n /**\n * @notice Adds the provided identifier as a supported identifier.\n * @dev Price requests using this identifier will succeed after this call.\n * @param identifier bytes32 encoding of the string identifier. Eg: BTC/USD.\n */\n function addSupportedIdentifier(bytes32 identifier) external;\n\n /**\n * @notice Removes the identifier from the whitelist.\n * @dev Price requests using this identifier will no longer succeed after this call.\n * @param identifier bytes32 encoding of the string identifier. Eg: BTC/USD.\n */\n function removeSupportedIdentifier(bytes32 identifier) external;\n\n /**\n * @notice Checks whether an identifier is on the whitelist.\n * @param identifier bytes32 encoding of the string identifier. Eg: BTC/USD.\n * @return bool if the identifier is supported (or not).\n */\n function isIdentifierSupported(bytes32 identifier) external view returns (bool);\n}\n" - }, - "@uma/core/contracts/common/interfaces/AddressWhitelistInterface.sol": { - "content": "// SPDX-License-Identifier: AGPL-3.0-only\npragma solidity ^0.8.0;\n\ninterface AddressWhitelistInterface {\n function addToWhitelist(address newElement) external;\n\n function removeFromWhitelist(address newElement) external;\n\n function isOnWhitelist(address newElement) external view returns (bool);\n\n function getWhitelist() external view returns (address[] memory);\n}\n" - }, - "@uma/core/contracts/common/implementation/AncillaryData.sol": { - "content": "// SPDX-License-Identifier: AGPL-3.0-only\npragma solidity ^0.8.0;\n\n/**\n * @title Library for encoding and decoding ancillary data for DVM price requests.\n * @notice We assume that on-chain ancillary data can be formatted directly from bytes to utf8 encoding via\n * web3.utils.hexToUtf8, and that clients will parse the utf8-encoded ancillary data as a comma-delimitted key-value\n * dictionary. Therefore, this library provides internal methods that aid appending to ancillary data from Solidity\n * smart contracts. More details on UMA's ancillary data guidelines below:\n * https://docs.google.com/document/d/1zhKKjgY1BupBGPPrY_WOJvui0B6DMcd-xDR8-9-SPDw/edit\n */\nlibrary AncillaryData {\n // This converts the bottom half of a bytes32 input to hex in a highly gas-optimized way.\n // Source: the brilliant implementation at https://gitter.im/ethereum/solidity?at=5840d23416207f7b0ed08c9b.\n function toUtf8Bytes32Bottom(bytes32 bytesIn) private pure returns (bytes32) {\n unchecked {\n uint256 x = uint256(bytesIn);\n\n // Nibble interleave\n x = x & 0x00000000000000000000000000000000ffffffffffffffffffffffffffffffff;\n x = (x | (x * 2**64)) & 0x0000000000000000ffffffffffffffff0000000000000000ffffffffffffffff;\n x = (x | (x * 2**32)) & 0x00000000ffffffff00000000ffffffff00000000ffffffff00000000ffffffff;\n x = (x | (x * 2**16)) & 0x0000ffff0000ffff0000ffff0000ffff0000ffff0000ffff0000ffff0000ffff;\n x = (x | (x * 2**8)) & 0x00ff00ff00ff00ff00ff00ff00ff00ff00ff00ff00ff00ff00ff00ff00ff00ff;\n x = (x | (x * 2**4)) & 0x0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f;\n\n // Hex encode\n uint256 h = (x & 0x0808080808080808080808080808080808080808080808080808080808080808) / 8;\n uint256 i = (x & 0x0404040404040404040404040404040404040404040404040404040404040404) / 4;\n uint256 j = (x & 0x0202020202020202020202020202020202020202020202020202020202020202) / 2;\n x = x + (h & (i | j)) * 0x27 + 0x3030303030303030303030303030303030303030303030303030303030303030;\n\n // Return the result.\n return bytes32(x);\n }\n }\n\n /**\n * @notice Returns utf8-encoded bytes32 string that can be read via web3.utils.hexToUtf8.\n * @dev Will return bytes32 in all lower case hex characters and without the leading 0x.\n * This has minor changes from the toUtf8BytesAddress to control for the size of the input.\n * @param bytesIn bytes32 to encode.\n * @return utf8 encoded bytes32.\n */\n function toUtf8Bytes(bytes32 bytesIn) internal pure returns (bytes memory) {\n return abi.encodePacked(toUtf8Bytes32Bottom(bytesIn >> 128), toUtf8Bytes32Bottom(bytesIn));\n }\n\n /**\n * @notice Returns utf8-encoded address that can be read via web3.utils.hexToUtf8.\n * Source: https://ethereum.stackexchange.com/questions/8346/convert-address-to-string/8447#8447\n * @dev Will return address in all lower case characters and without the leading 0x.\n * @param x address to encode.\n * @return utf8 encoded address bytes.\n */\n function toUtf8BytesAddress(address x) internal pure returns (bytes memory) {\n return\n abi.encodePacked(toUtf8Bytes32Bottom(bytes32(bytes20(x)) >> 128), bytes8(toUtf8Bytes32Bottom(bytes20(x))));\n }\n\n /**\n * @notice Converts a uint into a base-10, UTF-8 representation stored in a `string` type.\n * @dev This method is based off of this code: https://stackoverflow.com/a/65707309.\n */\n function toUtf8BytesUint(uint256 x) internal pure returns (bytes memory) {\n if (x == 0) {\n return \"0\";\n }\n uint256 j = x;\n uint256 len;\n while (j != 0) {\n len++;\n j /= 10;\n }\n bytes memory bstr = new bytes(len);\n uint256 k = len;\n while (x != 0) {\n k = k - 1;\n uint8 temp = (48 + uint8(x - (x / 10) * 10));\n bytes1 b1 = bytes1(temp);\n bstr[k] = b1;\n x /= 10;\n }\n return bstr;\n }\n\n function appendKeyValueBytes32(\n bytes memory currentAncillaryData,\n bytes memory key,\n bytes32 value\n ) internal pure returns (bytes memory) {\n bytes memory prefix = constructPrefix(currentAncillaryData, key);\n return abi.encodePacked(currentAncillaryData, prefix, toUtf8Bytes(value));\n }\n\n /**\n * @notice Adds \"key:value\" to `currentAncillaryData` where `value` is an address that first needs to be converted\n * to utf8 bytes. For example, if `utf8(currentAncillaryData)=\"k1:v1\"`, then this function will return\n * `utf8(k1:v1,key:value)`, and if `currentAncillaryData` is blank, then this will return `utf8(key:value)`.\n * @param currentAncillaryData This bytes data should ideally be able to be utf8-decoded, but its OK if not.\n * @param key Again, this bytes data should ideally be able to be utf8-decoded, but its OK if not.\n * @param value An address to set as the value in the key:value pair to append to `currentAncillaryData`.\n * @return Newly appended ancillary data.\n */\n function appendKeyValueAddress(\n bytes memory currentAncillaryData,\n bytes memory key,\n address value\n ) internal pure returns (bytes memory) {\n bytes memory prefix = constructPrefix(currentAncillaryData, key);\n return abi.encodePacked(currentAncillaryData, prefix, toUtf8BytesAddress(value));\n }\n\n /**\n * @notice Adds \"key:value\" to `currentAncillaryData` where `value` is a uint that first needs to be converted\n * to utf8 bytes. For example, if `utf8(currentAncillaryData)=\"k1:v1\"`, then this function will return\n * `utf8(k1:v1,key:value)`, and if `currentAncillaryData` is blank, then this will return `utf8(key:value)`.\n * @param currentAncillaryData This bytes data should ideally be able to be utf8-decoded, but its OK if not.\n * @param key Again, this bytes data should ideally be able to be utf8-decoded, but its OK if not.\n * @param value A uint to set as the value in the key:value pair to append to `currentAncillaryData`.\n * @return Newly appended ancillary data.\n */\n function appendKeyValueUint(\n bytes memory currentAncillaryData,\n bytes memory key,\n uint256 value\n ) internal pure returns (bytes memory) {\n bytes memory prefix = constructPrefix(currentAncillaryData, key);\n return abi.encodePacked(currentAncillaryData, prefix, toUtf8BytesUint(value));\n }\n\n /**\n * @notice Helper method that returns the left hand side of a \"key:value\" pair plus the colon \":\" and a leading\n * comma \",\" if the `currentAncillaryData` is not empty. The return value is intended to be prepended as a prefix to\n * some utf8 value that is ultimately added to a comma-delimited, key-value dictionary.\n */\n function constructPrefix(bytes memory currentAncillaryData, bytes memory key) internal pure returns (bytes memory) {\n if (currentAncillaryData.length > 0) {\n return abi.encodePacked(\",\", key, \":\");\n } else {\n return abi.encodePacked(key, \":\");\n }\n }\n}\n" - }, - "@uma/core/contracts/oracle/implementation/Constants.sol": { - "content": "// SPDX-License-Identifier: AGPL-3.0-only\npragma solidity ^0.8.0;\n\n/**\n * @title Stores common interface names used throughout the DVM by registration in the Finder.\n */\nlibrary OracleInterfaces {\n bytes32 public constant Oracle = \"Oracle\";\n bytes32 public constant IdentifierWhitelist = \"IdentifierWhitelist\";\n bytes32 public constant Store = \"Store\";\n bytes32 public constant FinancialContractsAdmin = \"FinancialContractsAdmin\";\n bytes32 public constant Registry = \"Registry\";\n bytes32 public constant CollateralWhitelist = \"CollateralWhitelist\";\n bytes32 public constant OptimisticOracle = \"OptimisticOracle\";\n bytes32 public constant Bridge = \"Bridge\";\n bytes32 public constant GenericHandler = \"GenericHandler\";\n bytes32 public constant SkinnyOptimisticOracle = \"SkinnyOptimisticOracle\";\n bytes32 public constant ChildMessenger = \"ChildMessenger\";\n bytes32 public constant OracleHub = \"OracleHub\";\n bytes32 public constant OracleSpoke = \"OracleSpoke\";\n}\n\n/**\n * @title Commonly re-used values for contracts associated with the OptimisticOracle.\n */\nlibrary OptimisticOracleConstraints {\n // Any price request submitted to the OptimisticOracle must contain ancillary data no larger than this value.\n // This value must be <= the Voting contract's `ancillaryBytesLimit` constant value otherwise it is possible\n // that a price can be requested to the OptimisticOracle successfully, but cannot be resolved by the DVM which\n // refuses to accept a price request made with ancillary data length over a certain size.\n uint256 public constant ancillaryBytesLimit = 8192;\n}\n" - }, - "contracts/Lockable.sol": { - "content": "// SPDX-License-Identifier: AGPL-3.0-only\r\npragma solidity ^0.8.0;\r\n\r\n/**\r\n * @title A contract that provides modifiers to prevent reentrancy to state-changing and view-only methods. This contract\r\n * is inspired by https://github.com/OpenZeppelin/openzeppelin-contracts/blob/master/contracts/utils/ReentrancyGuard.sol\r\n * and https://github.com/balancer-labs/balancer-core/blob/master/contracts/BPool.sol.\r\n */\r\ncontract Lockable {\r\n bool internal _notEntered;\r\n\r\n constructor() {\r\n // Storing an initial non-zero value makes deployment a bit more expensive, but in exchange the refund on every\r\n // call to nonReentrant will be lower in amount. Since refunds are capped to a percentage of the total\r\n // transaction's gas, it is best to keep them low in cases like this one, to increase the likelihood of the full\r\n // refund coming into effect.\r\n _notEntered = true;\r\n }\r\n\r\n /**\r\n * @dev Prevents a contract from calling itself, directly or indirectly.\r\n * Calling a `nonReentrant` function from another `nonReentrant` function is not supported. It is possible to\r\n * prevent this from happening by making the `nonReentrant` function external, and making it call a `private`\r\n * function that does the actual state modification.\r\n */\r\n modifier nonReentrant() {\r\n _preEntranceCheck();\r\n _preEntranceSet();\r\n _;\r\n _postEntranceReset();\r\n }\r\n\r\n /**\r\n * @dev Designed to prevent a view-only method from being re-entered during a call to a `nonReentrant()` state-changing method.\r\n */\r\n modifier nonReentrantView() {\r\n _preEntranceCheck();\r\n _;\r\n }\r\n\r\n /**\r\n * @dev Returns true if the contract is currently in a non-entered state, meaning that the origination of the call\r\n * came from outside the contract. This is relevant with fallback/receive methods to see if the call came from ETH\r\n * being dropped onto the contract externally or due to ETH dropped on the the contract from within a method in this\r\n * contract, such as unwrapping WETH to ETH within the contract.\r\n */\r\n function functionCallStackOriginatesFromOutsideThisContract() internal view returns (bool) {\r\n return _notEntered;\r\n }\r\n\r\n // Internal methods are used to avoid copying the require statement's bytecode to every `nonReentrant()` method.\r\n // On entry into a function, `_preEntranceCheck()` should always be called to check if the function is being\r\n // re-entered. Then, if the function modifies state, it should call `_postEntranceSet()`, perform its logic, and\r\n // then call `_postEntranceReset()`.\r\n // View-only methods can simply call `_preEntranceCheck()` to make sure that it is not being re-entered.\r\n function _preEntranceCheck() internal view {\r\n // On the first call to nonReentrant, _notEntered will be true\r\n require(_notEntered, \"ReentrancyGuard: reentrant call\");\r\n }\r\n\r\n function _preEntranceSet() internal {\r\n // Any calls to nonReentrant after this point will fail\r\n _notEntered = false;\r\n }\r\n\r\n function _postEntranceReset() internal {\r\n // By storing the original value once again, a refund is triggered (see\r\n // https://eips.ethereum.org/EIPS/eip-2200)\r\n _notEntered = true;\r\n }\r\n}\r\n" - } - }, - "settings": { - "optimizer": { - "enabled": true, - "runs": 1000000 - }, - "outputSelection": { - "*": { - "*": [ - "abi", - "evm.bytecode", - "evm.deployedBytecode", - "evm.methodIdentifiers", - "metadata", - "devdoc", - "userdoc", - "storageLayout", - "evm.gasEstimates" - ], - "": ["ast"] - } - }, - "metadata": { - "useLiteralContent": true - } - } -} diff --git a/deployments/rinkeby/solcInputs/a5765a49a3d11723dab4e70ab648f8a6.json b/deployments/rinkeby/solcInputs/a5765a49a3d11723dab4e70ab648f8a6.json deleted file mode 100644 index eee42cc00..000000000 --- a/deployments/rinkeby/solcInputs/a5765a49a3d11723dab4e70ab648f8a6.json +++ /dev/null @@ -1,195 +0,0 @@ -{ - "language": "Solidity", - "sources": { - "contracts/Arbitrum_SpokePool.sol": { - "content": "//SPDX-License-Identifier: Unlicense\r\npragma solidity ^0.8.0;\r\n\r\nimport \"./SpokePool.sol\";\r\nimport \"./SpokePoolInterface.sol\";\r\n\r\ninterface StandardBridgeLike {\r\n function outboundTransfer(\r\n address _l1Token,\r\n address _to,\r\n uint256 _amount,\r\n bytes calldata _data\r\n ) external payable returns (bytes memory);\r\n}\r\n\r\n/**\r\n * @notice AVM specific SpokePool.\r\n * @dev Uses AVM cross-domain-enabled logic for access control.\r\n */\r\n\r\ncontract Arbitrum_SpokePool is SpokePoolInterface, SpokePool {\r\n // Address of the Arbitrum L2 token gateway.\r\n address public l2GatewayRouter;\r\n\r\n // Admin controlled mapping of arbitrum tokens to L1 counterpart. L1 counterpart addresses\r\n // are neccessary to bridge tokens to L1.\r\n mapping(address => address) public whitelistedTokens;\r\n\r\n event ArbitrumTokensBridged(address indexed l1Token, address target, uint256 numberOfTokensBridged);\r\n event SetL2GatewayRouter(address indexed newL2GatewayRouter);\r\n event WhitelistedTokens(address indexed l2Token, address indexed l1Token);\r\n\r\n constructor(\r\n address _l2GatewayRouter,\r\n address _crossDomainAdmin,\r\n address _hubPool,\r\n address _wethAddress,\r\n address timerAddress\r\n ) SpokePool(_crossDomainAdmin, _hubPool, _wethAddress, timerAddress) {\r\n _setL2GatewayRouter(_l2GatewayRouter);\r\n }\r\n\r\n modifier onlyFromCrossDomainAdmin() {\r\n require(msg.sender == _applyL1ToL2Alias(crossDomainAdmin), \"ONLY_COUNTERPART_GATEWAY\");\r\n _;\r\n }\r\n\r\n /**************************************\r\n * CROSS-CHAIN ADMIN FUNCTIONS *\r\n **************************************/\r\n\r\n function setL2GatewayRouter(address newL2GatewayRouter) public onlyFromCrossDomainAdmin nonReentrant {\r\n _setL2GatewayRouter(newL2GatewayRouter);\r\n }\r\n\r\n function whitelistToken(address l2Token, address l1Token) public onlyFromCrossDomainAdmin nonReentrant {\r\n _whitelistToken(l2Token, l1Token);\r\n }\r\n\r\n function setCrossDomainAdmin(address newCrossDomainAdmin) public override onlyFromCrossDomainAdmin nonReentrant {\r\n _setCrossDomainAdmin(newCrossDomainAdmin);\r\n }\r\n\r\n function setHubPool(address newHubPool) public override onlyFromCrossDomainAdmin nonReentrant {\r\n _setHubPool(newHubPool);\r\n }\r\n\r\n function setEnableRoute(\r\n address originToken,\r\n uint256 destinationChainId,\r\n bool enable\r\n ) public override onlyFromCrossDomainAdmin nonReentrant {\r\n _setEnableRoute(originToken, destinationChainId, enable);\r\n }\r\n\r\n function setDepositQuoteTimeBuffer(uint32 buffer) public override onlyFromCrossDomainAdmin nonReentrant {\r\n _setDepositQuoteTimeBuffer(buffer);\r\n }\r\n\r\n function relayRootBundle(bytes32 relayerRefundRoot, bytes32 slowRelayFulfillmentRoot)\r\n public\r\n override\r\n onlyFromCrossDomainAdmin\r\n nonReentrant\r\n {\r\n _relayRootBundle(relayerRefundRoot, slowRelayFulfillmentRoot);\r\n }\r\n\r\n /**************************************\r\n * INTERNAL FUNCTIONS *\r\n **************************************/\r\n\r\n function _bridgeTokensToHubPool(RelayerRefundLeaf memory relayerRefundLeaf) internal override {\r\n StandardBridgeLike(l2GatewayRouter).outboundTransfer(\r\n whitelistedTokens[relayerRefundLeaf.l2TokenAddress], // _l1Token. Address of the L1 token to bridge over.\r\n hubPool, // _to. Withdraw, over the bridge, to the l1 hub pool contract.\r\n relayerRefundLeaf.amountToReturn, // _amount.\r\n \"\" // _data. We don't need to send any data for the bridging action.\r\n );\r\n emit ArbitrumTokensBridged(address(0), hubPool, relayerRefundLeaf.amountToReturn);\r\n }\r\n\r\n function _setL2GatewayRouter(address _l2GatewayRouter) internal {\r\n l2GatewayRouter = _l2GatewayRouter;\r\n emit SetL2GatewayRouter(l2GatewayRouter);\r\n }\r\n\r\n function _whitelistToken(address _l2Token, address _l1Token) internal {\r\n whitelistedTokens[_l2Token] = _l1Token;\r\n emit WhitelistedTokens(_l2Token, _l1Token);\r\n }\r\n\r\n // l1 addresses are transformed during l1->l2 calls. See https://developer.offchainlabs.com/docs/l1_l2_messages#address-aliasing for more information.\r\n function _applyL1ToL2Alias(address l1Address) internal pure returns (address l2Address) {\r\n unchecked {\r\n l2Address = address(uint160(l1Address) + uint160(0x1111000000000000000000000000000000001111));\r\n }\r\n }\r\n}\r\n" - }, - "contracts/SpokePool.sol": { - "content": "// SPDX-License-Identifier: GPL-3.0-only\r\npragma solidity ^0.8.0;\r\n\r\nimport \"./MerkleLib.sol\";\r\nimport \"./interfaces/WETH9.sol\";\r\n\r\nimport \"@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol\";\r\nimport \"@openzeppelin/contracts/token/ERC20/IERC20.sol\";\r\nimport \"@openzeppelin/contracts/utils/Address.sol\";\r\n\r\nimport \"@openzeppelin/contracts/utils/cryptography/SignatureChecker.sol\";\r\nimport \"@openzeppelin/contracts/utils/cryptography/ECDSA.sol\";\r\n\r\nimport \"@uma/core/contracts/common/implementation/Testable.sol\";\r\nimport \"@uma/core/contracts/common/implementation/Lockable.sol\";\r\nimport \"@uma/core/contracts/common/implementation/MultiCaller.sol\";\r\nimport \"./MerkleLib.sol\";\r\nimport \"./SpokePoolInterface.sol\";\r\n\r\n/**\r\n * @title SpokePool\r\n * @notice Contract deployed on source and destination chains enabling depositors to transfer assets from source to\r\n * destination. Deposit orders are fulfilled by off-chain relayers who also interact with this contract. Deposited\r\n * tokens are locked on the source chain and relayers send the recipient the desired token currency and amount\r\n * on the destination chain. Locked source chain tokens are later sent over the canonical token bridge to L1.\r\n * @dev This contract is designed to be deployed to L2's, not mainnet.\r\n */\r\nabstract contract SpokePool is SpokePoolInterface, Testable, Lockable, MultiCaller {\r\n using SafeERC20 for IERC20;\r\n using Address for address;\r\n\r\n // Address of the L1 contract that acts as the owner of this SpokePool.\r\n address public crossDomainAdmin;\r\n\r\n // Address of the L1 contract that will send tokens to and receive tokens from this contract.\r\n address public hubPool;\r\n\r\n // Address of WETH contract for this network. If an origin token matches this, then the caller can optionally\r\n // instruct this contract to wrap ETH when depositing.\r\n WETH9 public weth;\r\n\r\n // Timestamp when contract was constructed. Relays cannot have a quote time before this.\r\n uint32 public deploymentTime;\r\n\r\n // Any deposit quote times greater than or less than this value to the current contract time is blocked. Forces\r\n // caller to use an up to date realized fee. Defaults to 10 minutes.\r\n uint32 public depositQuoteTimeBuffer = 600;\r\n\r\n // Use count of deposits as unique deposit identifier.\r\n uint32 public numberOfDeposits;\r\n\r\n // Origin token to destination token routings can be turned on or off.\r\n mapping(address => mapping(uint256 => bool)) public enabledDepositRoutes;\r\n\r\n struct RootBundle {\r\n // Merkle root of slow relays that were not fully filled and whose recipient is still owed funds from the LP pool.\r\n bytes32 slowRelayFulfillmentRoot;\r\n // Merkle root of relayer refunds.\r\n bytes32 relayerRefundRoot;\r\n // This is a 2D bitmap tracking which leafs in the relayer refund root have been claimed, with max size of\r\n // 256x256 leaves per root.\r\n mapping(uint256 => uint256) claimedBitmap;\r\n }\r\n RootBundle[] public rootBundles;\r\n\r\n // Each relay is associated with the hash of parameters that uniquely identify the original deposit and a relay\r\n // attempt for that deposit. The relay itself is just represented as the amount filled so far. The total amount to\r\n // relay, the fees, and the agents are all parameters included in the hash key.\r\n mapping(bytes32 => uint256) public relayFills;\r\n\r\n /****************************************\r\n * EVENTS *\r\n ****************************************/\r\n event SetXDomainAdmin(address indexed newAdmin);\r\n event SetHubPool(address indexed newHubPool);\r\n event EnabledDepositRoute(address indexed originToken, uint256 indexed destinationChainId, bool enabled);\r\n event SetDepositQuoteTimeBuffer(uint32 newBuffer);\r\n event FundsDeposited(\r\n uint256 amount,\r\n uint256 destinationChainId,\r\n uint64 relayerFeePct,\r\n uint32 indexed depositId,\r\n uint32 quoteTimestamp,\r\n address indexed originToken,\r\n address recipient,\r\n address indexed depositor\r\n );\r\n event FilledRelay(\r\n bytes32 indexed relayHash,\r\n uint256 totalRelayAmount,\r\n uint256 totalFilledAmount,\r\n uint256 fillAmount,\r\n uint256 indexed repaymentChain,\r\n uint256 originChainId,\r\n uint64 relayerFeePct,\r\n uint64 realizedLpFeePct,\r\n uint32 depositId,\r\n address destinationToken,\r\n address indexed relayer,\r\n address depositor,\r\n address recipient\r\n );\r\n event ExecutedSlowRelayFulfillmentRoot(\r\n bytes32 indexed relayHash,\r\n uint256 totalRelayAmount,\r\n uint256 totalFilledAmount,\r\n uint256 fillAmount,\r\n uint256 originChainId,\r\n uint64 relayerFeePct,\r\n uint64 realizedLpFeePct,\r\n uint32 depositId,\r\n address destinationToken,\r\n address indexed caller,\r\n address depositor,\r\n address recipient\r\n );\r\n event RelayedRootBundle(uint32 indexed rootBundleId, bytes32 relayerRefundRoot, bytes32 slowRelayFulfillmentRoot);\r\n event ExecutedRelayerRefundRoot(\r\n uint256 amountToReturn,\r\n uint256 chainId,\r\n uint256[] refundAmounts,\r\n uint32 indexed rootBundleId,\r\n uint32 indexed leafId,\r\n address l2TokenAddress,\r\n address[] refundAddresses,\r\n address indexed caller\r\n );\r\n event TokensBridged(\r\n uint256 amountToReturn,\r\n uint256 indexed chainId,\r\n uint32 indexed leafId,\r\n address indexed l2TokenAddress,\r\n address caller\r\n );\r\n\r\n constructor(\r\n address _crossDomainAdmin,\r\n address _hubPool,\r\n address _wethAddress,\r\n address timerAddress\r\n ) Testable(timerAddress) {\r\n _setCrossDomainAdmin(_crossDomainAdmin);\r\n _setHubPool(_hubPool);\r\n deploymentTime = uint32(getCurrentTime());\r\n weth = WETH9(_wethAddress);\r\n }\r\n\r\n /****************************************\r\n * MODIFIERS *\r\n ****************************************/\r\n\r\n modifier onlyEnabledRoute(address originToken, uint256 destinationId) {\r\n require(enabledDepositRoutes[originToken][destinationId], \"Disabled route\");\r\n _;\r\n }\r\n\r\n /**************************************\r\n * ADMIN FUNCTIONS *\r\n **************************************/\r\n\r\n function _setCrossDomainAdmin(address newCrossDomainAdmin) internal {\r\n require(newCrossDomainAdmin != address(0), \"Bad bridge router address\");\r\n crossDomainAdmin = newCrossDomainAdmin;\r\n emit SetXDomainAdmin(crossDomainAdmin);\r\n }\r\n\r\n function _setHubPool(address newHubPool) internal {\r\n require(newHubPool != address(0), \"Bad hub pool address\");\r\n hubPool = newHubPool;\r\n emit SetHubPool(hubPool);\r\n }\r\n\r\n function _setEnableRoute(\r\n address originToken,\r\n uint256 destinationChainId,\r\n bool enabled\r\n ) internal {\r\n enabledDepositRoutes[originToken][destinationChainId] = enabled;\r\n emit EnabledDepositRoute(originToken, destinationChainId, enabled);\r\n }\r\n\r\n function _setDepositQuoteTimeBuffer(uint32 _depositQuoteTimeBuffer) internal {\r\n depositQuoteTimeBuffer = _depositQuoteTimeBuffer;\r\n emit SetDepositQuoteTimeBuffer(_depositQuoteTimeBuffer);\r\n }\r\n\r\n /**************************************\r\n * DEPOSITOR FUNCTIONS *\r\n **************************************/\r\n\r\n /**\r\n * @notice Called by user to bridge funds from origin to destination chain.\r\n * @dev The caller must first approve this contract to spend `amount` of `originToken`.\r\n */\r\n function deposit(\r\n address recipient,\r\n address originToken,\r\n uint256 amount,\r\n uint256 destinationChainId,\r\n uint64 relayerFeePct,\r\n uint32 quoteTimestamp\r\n ) public payable onlyEnabledRoute(originToken, destinationChainId) nonReentrant {\r\n // We limit the relay fees to prevent the user spending all their funds on fees.\r\n require(relayerFeePct <= 0.5e18, \"invalid relayer fee\");\r\n // Note We assume that L2 timing cannot be compared accurately and consistently to L1 timing. Therefore,\r\n // `block.timestamp` is different from the L1 EVM's. Therefore, the quoteTimestamp must be within a configurable\r\n // buffer to allow for this variance.\r\n // Note also that `quoteTimestamp` cannot be less than the buffer otherwise the following arithmetic can result\r\n // in underflow. This isn't a problem as the deposit will revert, but the error might be unexpected for clients.\r\n require(\r\n getCurrentTime() >= quoteTimestamp - depositQuoteTimeBuffer &&\r\n getCurrentTime() <= quoteTimestamp + depositQuoteTimeBuffer,\r\n \"invalid quote time\"\r\n );\r\n // If the address of the origin token is a WETH contract and there is a msg.value with the transaction\r\n // then the user is sending ETH. In this case, the ETH should be deposited to WETH.\r\n if (originToken == address(weth) && msg.value > 0) {\r\n require(msg.value == amount, \"msg.value must match amount\");\r\n weth.deposit{ value: msg.value }();\r\n } else {\r\n // Else, it is a normal ERC20. In this case pull the token from the users wallet as per normal.\r\n // Note: this includes the case where the L2 user has WETH (already wrapped ETH) and wants to bridge them. In\r\n // this case the msg.value will be set to 0, indicating a \"normal\" ERC20 bridging action.\r\n IERC20(originToken).safeTransferFrom(msg.sender, address(this), amount);\r\n }\r\n\r\n emit FundsDeposited(\r\n amount,\r\n destinationChainId,\r\n relayerFeePct,\r\n numberOfDeposits,\r\n quoteTimestamp,\r\n originToken,\r\n recipient,\r\n msg.sender\r\n );\r\n\r\n numberOfDeposits += 1;\r\n }\r\n\r\n /**************************************\r\n * RELAYER FUNCTIONS *\r\n **************************************/\r\n\r\n function fillRelay(\r\n address depositor,\r\n address recipient,\r\n address destinationToken,\r\n uint256 totalRelayAmount,\r\n uint256 maxTokensToSend,\r\n uint256 repaymentChain,\r\n uint256 originChainId,\r\n uint64 realizedLpFeePct,\r\n uint64 relayerFeePct,\r\n uint32 depositId\r\n ) public nonReentrant {\r\n // Each relay attempt is mapped to the hash of data uniquely identifying it, which includes the deposit data\r\n // such as the origin chain ID and the deposit ID, and the data in a relay attempt such as who the recipient\r\n // is, which chain and currency the recipient wants to receive funds on, and the relay fees.\r\n SpokePoolInterface.RelayData memory relayData = SpokePoolInterface.RelayData({\r\n depositor: depositor,\r\n recipient: recipient,\r\n destinationToken: destinationToken,\r\n relayAmount: totalRelayAmount,\r\n realizedLpFeePct: realizedLpFeePct,\r\n relayerFeePct: relayerFeePct,\r\n depositId: depositId,\r\n originChainId: originChainId\r\n });\r\n bytes32 relayHash = _getRelayHash(relayData);\r\n\r\n uint256 fillAmountPreFees = _fillRelay(relayHash, relayData, maxTokensToSend, relayerFeePct, false);\r\n\r\n _emitFillRelay(relayHash, fillAmountPreFees, repaymentChain, relayerFeePct, relayData);\r\n }\r\n\r\n function fillRelayWithUpdatedFee(\r\n address depositor,\r\n address recipient,\r\n address destinationToken,\r\n uint256 totalRelayAmount,\r\n uint256 maxTokensToSend,\r\n uint256 repaymentChain,\r\n uint256 originChainId,\r\n uint64 realizedLpFeePct,\r\n uint64 relayerFeePct,\r\n uint64 newRelayerFeePct,\r\n uint32 depositId,\r\n bytes memory depositorSignature\r\n ) public nonReentrant {\r\n // Grouping the signature validation logic into brackets to address stack too deep error.\r\n {\r\n // Depositor should have signed a hash of the relayer fee % to update to and information uniquely identifying\r\n // the deposit to relay. This ensures that this signature cannot be re-used for other deposits. The version\r\n // string is included as a precaution in case this contract is upgraded.\r\n // Note: we use encode instead of encodePacked because it is more secure, more in the \"warning\" section\r\n // here: https://docs.soliditylang.org/en/v0.8.11/abi-spec.html#non-standard-packed-mode\r\n bytes32 expectedDepositorMessageHash = keccak256(\r\n abi.encode(\"ACROSS-V2-FEE-1.0\", newRelayerFeePct, depositId, originChainId)\r\n );\r\n\r\n // Check the hash corresponding to the https://eth.wiki/json-rpc/API#eth_sign[`eth_sign`]\r\n // JSON-RPC method as part of EIP-191. We use OZ's signature checker library with adds support for\r\n // EIP-1271 which can verify messages signed by smart contract wallets like Argent and Gnosis safes.\r\n // If the depositor signed a message with a different updated fee (or any other param included in the\r\n // above keccak156 hash), then this will revert.\r\n bytes32 ethSignedMessageHash = ECDSA.toEthSignedMessageHash(expectedDepositorMessageHash);\r\n\r\n _verifyDepositorUpdateFeeMessage(depositor, ethSignedMessageHash, depositorSignature);\r\n }\r\n\r\n // Now follow the default `fillRelay` flow with the updated fee and the original relay hash.\r\n RelayData memory relayData = RelayData({\r\n depositor: depositor,\r\n recipient: recipient,\r\n destinationToken: destinationToken,\r\n relayAmount: totalRelayAmount,\r\n realizedLpFeePct: realizedLpFeePct,\r\n relayerFeePct: relayerFeePct,\r\n depositId: depositId,\r\n originChainId: originChainId\r\n });\r\n bytes32 relayHash = _getRelayHash(relayData);\r\n uint256 fillAmountPreFees = _fillRelay(relayHash, relayData, maxTokensToSend, newRelayerFeePct, false);\r\n\r\n _emitFillRelay(relayHash, fillAmountPreFees, repaymentChain, newRelayerFeePct, relayData);\r\n }\r\n\r\n /**************************************\r\n * DATA WORKER FUNCTIONS *\r\n **************************************/\r\n function executeSlowRelayFulfillmentRoot(\r\n address depositor,\r\n address recipient,\r\n address destinationToken,\r\n uint256 totalRelayAmount,\r\n uint256 originChainId,\r\n uint64 realizedLpFeePct,\r\n uint64 relayerFeePct,\r\n uint32 depositId,\r\n uint32 rootBundleId,\r\n bytes32[] memory proof\r\n ) public nonReentrant {\r\n RelayData memory relayData = RelayData({\r\n depositor: depositor,\r\n recipient: recipient,\r\n destinationToken: destinationToken,\r\n relayAmount: totalRelayAmount,\r\n originChainId: originChainId,\r\n realizedLpFeePct: realizedLpFeePct,\r\n relayerFeePct: relayerFeePct,\r\n depositId: depositId\r\n });\r\n\r\n require(\r\n MerkleLib.verifySlowRelayFulfillment(rootBundles[rootBundleId].slowRelayFulfillmentRoot, relayData, proof),\r\n \"Invalid proof\"\r\n );\r\n\r\n bytes32 relayHash = _getRelayHash(relayData);\r\n\r\n // Wrap any ETH owned by this contract so we can send expected L2 token to recipient. This is neccessary because\r\n // some SpokePools will receive ETH from the canonical token bridge instead of WETH so this contract\r\n // might have built up an ETH balance.\r\n if (address(this).balance > 0) weth.deposit{ value: address(this).balance }();\r\n\r\n // Note: use relayAmount as the max amount to send, so the relay is always completely filled by the contract's\r\n // funds in all cases.\r\n uint256 fillAmountPreFees = _fillRelay(relayHash, relayData, relayData.relayAmount, relayerFeePct, true);\r\n\r\n _emitExecutedSlowRelayFulfillmentRoot(relayHash, fillAmountPreFees, relayData);\r\n }\r\n\r\n function executeRelayerRefundRoot(\r\n uint32 rootBundleId,\r\n SpokePoolInterface.RelayerRefundLeaf memory relayerRefundLeaf,\r\n bytes32[] memory proof\r\n ) public nonReentrant {\r\n // Check integrity of leaf structure:\r\n require(relayerRefundLeaf.chainId == chainId(), \"Invalid chainId\");\r\n require(relayerRefundLeaf.refundAddresses.length == relayerRefundLeaf.refundAmounts.length, \"invalid leaf\");\r\n\r\n RootBundle storage rootBundle = rootBundles[rootBundleId];\r\n\r\n // Check that `inclusionProof` proves that `relayerRefundLeaf` is contained within the relayer refund root.\r\n // Note: This should revert if the `relayerRefundRoot` is uninitialized.\r\n require(MerkleLib.verifyRelayerRefund(rootBundle.relayerRefundRoot, relayerRefundLeaf, proof), \"Bad Proof\");\r\n\r\n // Verify the leafId in the leaf has not yet been claimed.\r\n require(!MerkleLib.isClaimed(rootBundle.claimedBitmap, relayerRefundLeaf.leafId), \"Already claimed\");\r\n\r\n // Set leaf as claimed in bitmap.\r\n MerkleLib.setClaimed(rootBundle.claimedBitmap, relayerRefundLeaf.leafId);\r\n\r\n // Wrap any ETH owned by this contract so we can send expected L2 token to recipient. This is neccessary because\r\n // some SpokePools will receive ETH from the canonical token bridge instead of WETH.\r\n if (address(this).balance > 0) weth.deposit{ value: address(this).balance }();\r\n\r\n // Send each relayer refund address the associated refundAmount for the L2 token address.\r\n // Note: Even if the L2 token is not enabled on this spoke pool, we should still refund relayers.\r\n for (uint32 i = 0; i < relayerRefundLeaf.refundAmounts.length; i++) {\r\n uint256 amount = relayerRefundLeaf.refundAmounts[i];\r\n if (amount > 0)\r\n IERC20(relayerRefundLeaf.l2TokenAddress).safeTransfer(relayerRefundLeaf.refundAddresses[i], amount);\r\n }\r\n\r\n // If leaf's `amountToReturn` is positive, then send L2 --> L1 message to bridge tokens back via\r\n // chain-specific bridging method.\r\n if (relayerRefundLeaf.amountToReturn > 0) {\r\n _bridgeTokensToHubPool(relayerRefundLeaf);\r\n\r\n emit TokensBridged(\r\n relayerRefundLeaf.amountToReturn,\r\n relayerRefundLeaf.chainId,\r\n relayerRefundLeaf.leafId,\r\n relayerRefundLeaf.l2TokenAddress,\r\n msg.sender\r\n );\r\n }\r\n\r\n emit ExecutedRelayerRefundRoot(\r\n relayerRefundLeaf.amountToReturn,\r\n relayerRefundLeaf.chainId,\r\n relayerRefundLeaf.refundAmounts,\r\n rootBundleId,\r\n relayerRefundLeaf.leafId,\r\n relayerRefundLeaf.l2TokenAddress,\r\n relayerRefundLeaf.refundAddresses,\r\n msg.sender\r\n );\r\n }\r\n\r\n /**************************************\r\n * VIEW FUNCTIONS *\r\n **************************************/\r\n\r\n // Some L2s like ZKSync don't support the CHAIN_ID opcode so we allow the caller to manually set this.\r\n function chainId() public view virtual returns (uint256) {\r\n return block.chainid;\r\n }\r\n\r\n /**************************************\r\n * INTERNAL FUNCTIONS *\r\n **************************************/\r\n\r\n function _bridgeTokensToHubPool(SpokePoolInterface.RelayerRefundLeaf memory relayerRefundLeaf) internal virtual;\r\n\r\n // Allow L2 to implement chain specific recovering of signers from signatures because some L2s might not support\r\n // ecrecover, such as those with account abstraction like ZKSync.\r\n function _verifyDepositorUpdateFeeMessage(\r\n address depositor,\r\n bytes32 ethSignedMessageHash,\r\n bytes memory depositorSignature\r\n ) internal view virtual {\r\n // Note: no need to worry about reentrancy from contract deployed at `depositor` address since\r\n // `SignatureChecker.isValidSignatureNow` is a non state-modifying STATICCALL:\r\n // - https://github.com/OpenZeppelin/openzeppelin-contracts/blob/63b466901fb015538913f811c5112a2775042177/contracts/utils/cryptography/SignatureChecker.sol#L35\r\n // - https://github.com/ethereum/EIPs/pull/214\r\n require(\r\n SignatureChecker.isValidSignatureNow(depositor, ethSignedMessageHash, depositorSignature),\r\n \"invalid signature\"\r\n );\r\n }\r\n\r\n function _computeAmountPreFees(uint256 amount, uint64 feesPct) private pure returns (uint256) {\r\n return (1e18 * amount) / (1e18 - feesPct);\r\n }\r\n\r\n function _computeAmountPostFees(uint256 amount, uint64 feesPct) private pure returns (uint256) {\r\n return (amount * (1e18 - feesPct)) / 1e18;\r\n }\r\n\r\n // Should we make this public for the relayer's convenience?\r\n function _getRelayHash(SpokePoolInterface.RelayData memory relayData) private pure returns (bytes32) {\r\n return keccak256(abi.encode(relayData));\r\n }\r\n\r\n // Unwraps ETH and does a transfer to a recipient address. If the recipient is a smart contract then sends WETH.\r\n function _unwrapWETHTo(address payable to, uint256 amount) internal {\r\n if (address(to).isContract()) {\r\n IERC20(address(weth)).safeTransfer(to, amount);\r\n } else {\r\n weth.withdraw(amount);\r\n to.transfer(amount);\r\n }\r\n }\r\n\r\n // This internal method should be called by an external \"relayRootBundle\" function that validates the\r\n // cross domain sender is the HubPool. This validation step differs for each L2, which is why the implementation\r\n // specifics are left to the implementor of this abstract contract.\r\n // Once this method is executed and a distribution root is stored in this contract, then `distributeRootBundle`\r\n // can be called to execute each leaf in the root.\r\n function _relayRootBundle(bytes32 relayerRefundRoot, bytes32 slowRelayFulfillmentRoot) internal {\r\n uint32 rootBundleId = uint32(rootBundles.length);\r\n RootBundle storage rootBundle = rootBundles.push();\r\n rootBundle.relayerRefundRoot = relayerRefundRoot;\r\n rootBundle.slowRelayFulfillmentRoot = slowRelayFulfillmentRoot;\r\n emit RelayedRootBundle(rootBundleId, relayerRefundRoot, slowRelayFulfillmentRoot);\r\n }\r\n\r\n function _fillRelay(\r\n bytes32 relayHash,\r\n RelayData memory relayData,\r\n uint256 maxTokensToSend,\r\n uint64 updatableRelayerFeePct,\r\n bool isSlowRelay\r\n ) internal returns (uint256 fillAmountPreFees) {\r\n // We limit the relay fees to prevent the user spending all their funds on fees. Note that 0.5e18 (i.e. 50%)\r\n // fees are just magic numbers. The important point is to prevent the total fee from being 100%, otherwise\r\n // computing the amount pre fees runs into divide-by-0 issues.\r\n require(updatableRelayerFeePct < 0.5e18 && relayData.realizedLpFeePct < 0.5e18, \"invalid fees\");\r\n\r\n // Check that the relay has not already been completely filled. Note that the `relays` mapping will point to\r\n // the amount filled so far for a particular `relayHash`, so this will start at 0 and increment with each fill.\r\n require(relayFills[relayHash] < relayData.relayAmount, \"relay filled\");\r\n\r\n // Stores the equivalent amount to be sent by the relayer before fees have been taken out.\r\n fillAmountPreFees = 0;\r\n\r\n // Adding brackets \"stack too deep\" solidity error.\r\n if (maxTokensToSend > 0) {\r\n fillAmountPreFees = _computeAmountPreFees(\r\n maxTokensToSend,\r\n (relayData.realizedLpFeePct + updatableRelayerFeePct)\r\n );\r\n // If user's specified max amount to send is greater than the amount of the relay remaining pre-fees,\r\n // we'll pull exactly enough tokens to complete the relay.\r\n uint256 amountToSend = maxTokensToSend;\r\n if (relayData.relayAmount - relayFills[relayHash] < fillAmountPreFees) {\r\n fillAmountPreFees = relayData.relayAmount - relayFills[relayHash];\r\n amountToSend = _computeAmountPostFees(\r\n fillAmountPreFees,\r\n relayData.realizedLpFeePct + updatableRelayerFeePct\r\n );\r\n }\r\n relayFills[relayHash] += fillAmountPreFees;\r\n // If relay token is weth then unwrap and send eth.\r\n if (relayData.destinationToken == address(weth)) {\r\n // Note: WETH is already in the contract in the slow relay case.\r\n if (!isSlowRelay)\r\n IERC20(relayData.destinationToken).safeTransferFrom(msg.sender, address(this), amountToSend);\r\n _unwrapWETHTo(payable(relayData.recipient), amountToSend);\r\n // Else, this is a normal ERC20 token. Send to recipient.\r\n } else {\r\n // Note: send token directly from the contract to the user in the slow relay case.\r\n if (!isSlowRelay)\r\n IERC20(relayData.destinationToken).safeTransferFrom(msg.sender, relayData.recipient, amountToSend);\r\n else IERC20(relayData.destinationToken).safeTransfer(relayData.recipient, amountToSend);\r\n }\r\n }\r\n }\r\n\r\n function _emitFillRelay(\r\n bytes32 relayHash,\r\n uint256 fillAmount,\r\n uint256 repaymentChain,\r\n uint64 relayerFeePct,\r\n RelayData memory relayData\r\n ) internal {\r\n emit FilledRelay(\r\n relayHash,\r\n relayData.relayAmount,\r\n relayFills[relayHash],\r\n fillAmount,\r\n repaymentChain,\r\n relayData.originChainId,\r\n relayerFeePct,\r\n relayData.realizedLpFeePct,\r\n relayData.depositId,\r\n relayData.destinationToken,\r\n msg.sender,\r\n relayData.depositor,\r\n relayData.recipient\r\n );\r\n }\r\n\r\n function _emitExecutedSlowRelayFulfillmentRoot(\r\n bytes32 relayHash,\r\n uint256 fillAmount,\r\n RelayData memory relayData\r\n ) internal {\r\n emit ExecutedSlowRelayFulfillmentRoot(\r\n relayHash,\r\n relayData.relayAmount,\r\n relayFills[relayHash],\r\n fillAmount,\r\n relayData.originChainId,\r\n relayData.relayerFeePct,\r\n relayData.realizedLpFeePct,\r\n relayData.depositId,\r\n relayData.destinationToken,\r\n msg.sender,\r\n relayData.depositor,\r\n relayData.recipient\r\n );\r\n }\r\n\r\n // Added to enable the this contract to receive ETH. Used when unwrapping Weth.\r\n receive() external payable {}\r\n}\r\n" - }, - "contracts/SpokePoolInterface.sol": { - "content": "//SPDX-License-Identifier: Unlicense\r\npragma solidity ^0.8.0;\r\n\r\ninterface SpokePoolInterface {\r\n // This leaf is meant to be decoded in the SpokePool in order to pay out individual relayers for this bundle.\r\n struct RelayerRefundLeaf {\r\n // This is the amount to return to the HubPool. This occurs when there is a PoolRebalanceLeaf netSendAmount that is\r\n // negative. This is just that value inverted.\r\n uint256 amountToReturn;\r\n // Used to verify that this is being decoded on the correct chainId.\r\n uint256 chainId;\r\n // This array designates how much each of those addresses should be refunded.\r\n uint256[] refundAmounts;\r\n // Used as the index in the bitmap to track whether this leaf has been executed or not.\r\n uint32 leafId;\r\n // The associated L2TokenAddress that these claims apply to.\r\n address l2TokenAddress;\r\n // These two arrays must be the same length and are parallel arrays. They should be order by refundAddresses.\r\n // This array designates each address that must be refunded.\r\n address[] refundAddresses;\r\n }\r\n\r\n // This struct represents the data to fully-specify a relay. If any portion of this data differs, the relay is\r\n // considered to be completely distinct. Only one relay for a particular depositId, chainId pair should be\r\n // considered valid and repaid.\r\n struct RelayData {\r\n // The address that made the deposit on the origin chain.\r\n address depositor;\r\n // The recipient address on the destination chain.\r\n address recipient;\r\n // The corresponding token address on the destination chain.\r\n address destinationToken;\r\n // The total relay amount before fees are taken out.\r\n uint256 relayAmount;\r\n // Origin chain id.\r\n uint256 originChainId;\r\n // The LP Fee percentage computed by the relayer based on the deposit's quote timestamp\r\n // and the HubPool's utilization.\r\n uint64 realizedLpFeePct;\r\n // The relayer fee percentage specified in the deposit.\r\n uint64 relayerFeePct;\r\n // The id uniquely identifying this deposit on the origin chain.\r\n uint32 depositId;\r\n }\r\n\r\n function setCrossDomainAdmin(address newCrossDomainAdmin) external;\r\n\r\n function setHubPool(address newHubPool) external;\r\n\r\n function setEnableRoute(\r\n address originToken,\r\n uint256 destinationChainId,\r\n bool enable\r\n ) external;\r\n\r\n function setDepositQuoteTimeBuffer(uint32 buffer) external;\r\n\r\n function relayRootBundle(bytes32 relayerRefundRoot, bytes32 slowRelayRoot) external;\r\n}\r\n" - }, - "contracts/MerkleLib.sol": { - "content": "// SPDX-License-Identifier: GPL-3.0-only\r\npragma solidity ^0.8.0;\r\n\r\nimport \"@openzeppelin/contracts/utils/cryptography/MerkleProof.sol\";\r\nimport \"./SpokePoolInterface.sol\";\r\nimport \"./HubPoolInterface.sol\";\r\n\r\n/**\r\n * @notice Library to help with merkle roots, proofs, and claims.\r\n */\r\nlibrary MerkleLib {\r\n /**\r\n * @notice Verifies that a repayment is contained within a merkle root.\r\n * @param root the merkle root.\r\n * @param rebalance the rebalance struct.\r\n * @param proof the merkle proof.\r\n */\r\n function verifyPoolRebalance(\r\n bytes32 root,\r\n HubPoolInterface.PoolRebalanceLeaf memory rebalance,\r\n bytes32[] memory proof\r\n ) internal pure returns (bool) {\r\n return MerkleProof.verify(proof, root, keccak256(abi.encode(rebalance)));\r\n }\r\n\r\n /**\r\n * @notice Verifies that a relayer refund is contained within a merkle root.\r\n * @param root the merkle root.\r\n * @param refund the refund struct.\r\n * @param proof the merkle proof.\r\n */\r\n function verifyRelayerRefund(\r\n bytes32 root,\r\n SpokePoolInterface.RelayerRefundLeaf memory refund,\r\n bytes32[] memory proof\r\n ) internal pure returns (bool) {\r\n return MerkleProof.verify(proof, root, keccak256(abi.encode(refund)));\r\n }\r\n\r\n /**\r\n * @notice Verifies that a distribution is contained within a merkle root.\r\n * @param root the merkle root.\r\n * @param slowRelayFulfillment the relayData fulfullment struct.\r\n * @param proof the merkle proof.\r\n */\r\n function verifySlowRelayFulfillment(\r\n bytes32 root,\r\n SpokePoolInterface.RelayData memory slowRelayFulfillment,\r\n bytes32[] memory proof\r\n ) internal pure returns (bool) {\r\n return MerkleProof.verify(proof, root, keccak256(abi.encode(slowRelayFulfillment)));\r\n }\r\n\r\n // The following functions are primarily copied from\r\n // https://github.com/Uniswap/merkle-distributor/blob/master/contracts/MerkleDistributor.sol with minor changes.\r\n\r\n /**\r\n * @notice Tests whether a claim is contained within a claimedBitMap mapping.\r\n * @param claimedBitMap a simple uint256 mapping in storage used as a bitmap.\r\n * @param index the index to check in the bitmap.\r\n * @return bool indicating if the index within the claimedBitMap has been marked as claimed.\r\n */\r\n function isClaimed(mapping(uint256 => uint256) storage claimedBitMap, uint256 index) internal view returns (bool) {\r\n uint256 claimedWordIndex = index / 256;\r\n uint256 claimedBitIndex = index % 256;\r\n uint256 claimedWord = claimedBitMap[claimedWordIndex];\r\n uint256 mask = (1 << claimedBitIndex);\r\n return claimedWord & mask == mask;\r\n }\r\n\r\n /**\r\n * @notice Marks an index in a claimedBitMap as claimed.\r\n * @param claimedBitMap a simple uint256 mapping in storage used as a bitmap.\r\n * @param index the index to mark in the bitmap.\r\n */\r\n function setClaimed(mapping(uint256 => uint256) storage claimedBitMap, uint256 index) internal {\r\n uint256 claimedWordIndex = index / 256;\r\n uint256 claimedBitIndex = index % 256;\r\n claimedBitMap[claimedWordIndex] = claimedBitMap[claimedWordIndex] | (1 << claimedBitIndex);\r\n }\r\n\r\n /**\r\n * @notice Tests whether a claim is contained within a 1D claimedBitMap mapping.\r\n * @param claimedBitMap a simple uint256 value, encoding a 1D bitmap.\r\n * @param index the index to check in the bitmap.\r\n \\* @return bool indicating if the index within the claimedBitMap has been marked as claimed.\r\n */\r\n function isClaimed1D(uint256 claimedBitMap, uint256 index) internal pure returns (bool) {\r\n uint256 mask = (1 << index);\r\n return claimedBitMap & mask == mask;\r\n }\r\n\r\n /**\r\n * @notice Marks an index in a claimedBitMap as claimed.\r\n * @param claimedBitMap a simple uint256 mapping in storage used as a bitmap.\r\n * @param index the index to mark in the bitmap.\r\n */\r\n function setClaimed1D(uint256 claimedBitMap, uint256 index) internal pure returns (uint256) {\r\n require(index <= 255, \"Index out of bounds\");\r\n return claimedBitMap | (1 << index % 256);\r\n }\r\n}\r\n" - }, - "contracts/interfaces/WETH9.sol": { - "content": "// SPDX-License-Identifier: GPL-3.0-only\r\npragma solidity ^0.8.0;\r\n\r\ninterface WETH9 {\r\n function withdraw(uint256 wad) external;\r\n\r\n function deposit() external payable;\r\n\r\n function balanceOf(address guy) external view returns (uint256 wad);\r\n\r\n function transfer(address guy, uint256 wad) external;\r\n}\r\n" - }, - "@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol": { - "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts v4.4.1 (token/ERC20/utils/SafeERC20.sol)\n\npragma solidity ^0.8.0;\n\nimport \"../IERC20.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 function safeTransfer(\n IERC20 token,\n address to,\n uint256 value\n ) internal {\n _callOptionalReturn(token, abi.encodeWithSelector(token.transfer.selector, to, value));\n }\n\n function safeTransferFrom(\n IERC20 token,\n address from,\n address to,\n uint256 value\n ) 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(\n IERC20 token,\n address spender,\n uint256 value\n ) 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 function safeIncreaseAllowance(\n IERC20 token,\n address spender,\n uint256 value\n ) internal {\n uint256 newAllowance = token.allowance(address(this), spender) + value;\n _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, newAllowance));\n }\n\n function safeDecreaseAllowance(\n IERC20 token,\n address spender,\n uint256 value\n ) internal {\n unchecked {\n uint256 oldAllowance = token.allowance(address(this), spender);\n require(oldAllowance >= value, \"SafeERC20: decreased allowance below zero\");\n uint256 newAllowance = oldAllowance - value;\n _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, newAllowance));\n }\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 if (returndata.length > 0) {\n // Return data is optional\n require(abi.decode(returndata, (bool)), \"SafeERC20: ERC20 operation did not succeed\");\n }\n }\n}\n" - }, - "@openzeppelin/contracts/token/ERC20/IERC20.sol": { - "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts v4.4.1 (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 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 `recipient`.\n *\n * Returns a boolean value indicating whether the operation succeeded.\n *\n * Emits a {Transfer} event.\n */\n function transfer(address recipient, 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 `sender` to `recipient` 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(\n address sender,\n address recipient,\n uint256 amount\n ) external returns (bool);\n\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" - }, - "@openzeppelin/contracts/utils/Address.sol": { - "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts v4.4.1 (utils/Address.sol)\n\npragma solidity ^0.8.0;\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 */\n function isContract(address account) internal view returns (bool) {\n // This method relies on extcodesize, which returns 0 for contracts in\n // construction, since the code is only stored at the end of the\n // constructor execution.\n\n uint256 size;\n assembly {\n size := extcodesize(account)\n }\n return size > 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://diligence.consensys.net/posts/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.5.11/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 functionCall(target, data, \"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(\n address target,\n bytes memory data,\n uint256 value\n ) 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 require(isContract(target), \"Address: call to non-contract\");\n\n (bool success, bytes memory returndata) = target.call{value: value}(data);\n return verifyCallResult(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 require(isContract(target), \"Address: static call to non-contract\");\n\n (bool success, bytes memory returndata) = target.staticcall(data);\n return verifyCallResult(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 require(isContract(target), \"Address: delegate call to non-contract\");\n\n (bool success, bytes memory returndata) = target.delegatecall(data);\n return verifyCallResult(success, returndata, errorMessage);\n }\n\n /**\n * @dev Tool to verifies that a low level call was successful, and revert if it wasn't, either by bubbling the\n * revert reason 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 // 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\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}\n" - }, - "@openzeppelin/contracts/utils/cryptography/SignatureChecker.sol": { - "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts v4.4.1 (utils/cryptography/SignatureChecker.sol)\n\npragma solidity ^0.8.0;\n\nimport \"./ECDSA.sol\";\nimport \"../Address.sol\";\nimport \"../../interfaces/IERC1271.sol\";\n\n/**\n * @dev Signature verification helper: Provide a single mechanism to verify both private-key (EOA) ECDSA signature and\n * ERC1271 contract signatures. Using this instead of ECDSA.recover in your contract will make them compatible with\n * smart contract wallets such as Argent and Gnosis.\n *\n * Note: unlike ECDSA signatures, contract signature's are revocable, and the outcome of this function can thus change\n * through time. It could return true at block N and false at block N+1 (or the opposite).\n *\n * _Available since v4.1._\n */\nlibrary SignatureChecker {\n function isValidSignatureNow(\n address signer,\n bytes32 hash,\n bytes memory signature\n ) internal view returns (bool) {\n (address recovered, ECDSA.RecoverError error) = ECDSA.tryRecover(hash, signature);\n if (error == ECDSA.RecoverError.NoError && recovered == signer) {\n return true;\n }\n\n (bool success, bytes memory result) = signer.staticcall(\n abi.encodeWithSelector(IERC1271.isValidSignature.selector, hash, signature)\n );\n return (success && result.length == 32 && abi.decode(result, (bytes4)) == IERC1271.isValidSignature.selector);\n }\n}\n" - }, - "@openzeppelin/contracts/utils/cryptography/ECDSA.sol": { - "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts v4.4.1 (utils/cryptography/ECDSA.sol)\n\npragma solidity ^0.8.0;\n\nimport \"../Strings.sol\";\n\n/**\n * @dev Elliptic Curve Digital Signature Algorithm (ECDSA) operations.\n *\n * These functions can be used to verify that a message was signed by the holder\n * of the private keys of a given address.\n */\nlibrary ECDSA {\n enum RecoverError {\n NoError,\n InvalidSignature,\n InvalidSignatureLength,\n InvalidSignatureS,\n InvalidSignatureV\n }\n\n function _throwError(RecoverError error) private pure {\n if (error == RecoverError.NoError) {\n return; // no error: do nothing\n } else if (error == RecoverError.InvalidSignature) {\n revert(\"ECDSA: invalid signature\");\n } else if (error == RecoverError.InvalidSignatureLength) {\n revert(\"ECDSA: invalid signature length\");\n } else if (error == RecoverError.InvalidSignatureS) {\n revert(\"ECDSA: invalid signature 's' value\");\n } else if (error == RecoverError.InvalidSignatureV) {\n revert(\"ECDSA: invalid signature 'v' value\");\n }\n }\n\n /**\n * @dev Returns the address that signed a hashed message (`hash`) with\n * `signature` or error string. This address can then be used for verification purposes.\n *\n * The `ecrecover` EVM opcode allows for malleable (non-unique) signatures:\n * this function rejects them by requiring the `s` value to be in the lower\n * half order, and the `v` value to be either 27 or 28.\n *\n * IMPORTANT: `hash` _must_ be the result of a hash operation for the\n * verification to be secure: it is possible to craft signatures that\n * recover to arbitrary addresses for non-hashed data. A safe way to ensure\n * this is by receiving a hash of the original message (which may otherwise\n * be too long), and then calling {toEthSignedMessageHash} on it.\n *\n * Documentation for signature generation:\n * - with https://web3js.readthedocs.io/en/v1.3.4/web3-eth-accounts.html#sign[Web3.js]\n * - with https://docs.ethers.io/v5/api/signer/#Signer-signMessage[ethers]\n *\n * _Available since v4.3._\n */\n function tryRecover(bytes32 hash, bytes memory signature) internal pure returns (address, RecoverError) {\n // Check the signature length\n // - case 65: r,s,v signature (standard)\n // - case 64: r,vs signature (cf https://eips.ethereum.org/EIPS/eip-2098) _Available since v4.1._\n if (signature.length == 65) {\n bytes32 r;\n bytes32 s;\n uint8 v;\n // ecrecover takes the signature parameters, and the only way to get them\n // currently is to use assembly.\n assembly {\n r := mload(add(signature, 0x20))\n s := mload(add(signature, 0x40))\n v := byte(0, mload(add(signature, 0x60)))\n }\n return tryRecover(hash, v, r, s);\n } else if (signature.length == 64) {\n bytes32 r;\n bytes32 vs;\n // ecrecover takes the signature parameters, and the only way to get them\n // currently is to use assembly.\n assembly {\n r := mload(add(signature, 0x20))\n vs := mload(add(signature, 0x40))\n }\n return tryRecover(hash, r, vs);\n } else {\n return (address(0), RecoverError.InvalidSignatureLength);\n }\n }\n\n /**\n * @dev Returns the address that signed a hashed message (`hash`) with\n * `signature`. This address can then be used for verification purposes.\n *\n * The `ecrecover` EVM opcode allows for malleable (non-unique) signatures:\n * this function rejects them by requiring the `s` value to be in the lower\n * half order, and the `v` value to be either 27 or 28.\n *\n * IMPORTANT: `hash` _must_ be the result of a hash operation for the\n * verification to be secure: it is possible to craft signatures that\n * recover to arbitrary addresses for non-hashed data. A safe way to ensure\n * this is by receiving a hash of the original message (which may otherwise\n * be too long), and then calling {toEthSignedMessageHash} on it.\n */\n function recover(bytes32 hash, bytes memory signature) internal pure returns (address) {\n (address recovered, RecoverError error) = tryRecover(hash, signature);\n _throwError(error);\n return recovered;\n }\n\n /**\n * @dev Overload of {ECDSA-tryRecover} that receives the `r` and `vs` short-signature fields separately.\n *\n * See https://eips.ethereum.org/EIPS/eip-2098[EIP-2098 short signatures]\n *\n * _Available since v4.3._\n */\n function tryRecover(\n bytes32 hash,\n bytes32 r,\n bytes32 vs\n ) internal pure returns (address, RecoverError) {\n bytes32 s;\n uint8 v;\n assembly {\n s := and(vs, 0x7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff)\n v := add(shr(255, vs), 27)\n }\n return tryRecover(hash, v, r, s);\n }\n\n /**\n * @dev Overload of {ECDSA-recover} that receives the `r and `vs` short-signature fields separately.\n *\n * _Available since v4.2._\n */\n function recover(\n bytes32 hash,\n bytes32 r,\n bytes32 vs\n ) internal pure returns (address) {\n (address recovered, RecoverError error) = tryRecover(hash, r, vs);\n _throwError(error);\n return recovered;\n }\n\n /**\n * @dev Overload of {ECDSA-tryRecover} that receives the `v`,\n * `r` and `s` signature fields separately.\n *\n * _Available since v4.3._\n */\n function tryRecover(\n bytes32 hash,\n uint8 v,\n bytes32 r,\n bytes32 s\n ) internal pure returns (address, RecoverError) {\n // EIP-2 still allows signature malleability for ecrecover(). Remove this possibility and make the signature\n // unique. Appendix F in the Ethereum Yellow paper (https://ethereum.github.io/yellowpaper/paper.pdf), defines\n // the valid range for s in (301): 0 < s < secp256k1n ÷ 2 + 1, and for v in (302): v ∈ {27, 28}. Most\n // signatures from current libraries generate a unique signature with an s-value in the lower half order.\n //\n // If your library generates malleable signatures, such as s-values in the upper range, calculate a new s-value\n // with 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFEBAAEDCE6AF48A03BBFD25E8CD0364141 - s1 and flip v from 27 to 28 or\n // vice versa. If your library also generates signatures with 0/1 for v instead 27/28, add 27 to v to accept\n // these malleable signatures as well.\n if (uint256(s) > 0x7FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF5D576E7357A4501DDFE92F46681B20A0) {\n return (address(0), RecoverError.InvalidSignatureS);\n }\n if (v != 27 && v != 28) {\n return (address(0), RecoverError.InvalidSignatureV);\n }\n\n // If the signature is valid (and not malleable), return the signer address\n address signer = ecrecover(hash, v, r, s);\n if (signer == address(0)) {\n return (address(0), RecoverError.InvalidSignature);\n }\n\n return (signer, RecoverError.NoError);\n }\n\n /**\n * @dev Overload of {ECDSA-recover} that receives the `v`,\n * `r` and `s` signature fields separately.\n */\n function recover(\n bytes32 hash,\n uint8 v,\n bytes32 r,\n bytes32 s\n ) internal pure returns (address) {\n (address recovered, RecoverError error) = tryRecover(hash, v, r, s);\n _throwError(error);\n return recovered;\n }\n\n /**\n * @dev Returns an Ethereum Signed Message, created from a `hash`. This\n * produces hash corresponding to the one signed with the\n * https://eth.wiki/json-rpc/API#eth_sign[`eth_sign`]\n * JSON-RPC method as part of EIP-191.\n *\n * See {recover}.\n */\n function toEthSignedMessageHash(bytes32 hash) internal pure returns (bytes32) {\n // 32 is the length in bytes of hash,\n // enforced by the type signature above\n return keccak256(abi.encodePacked(\"\\x19Ethereum Signed Message:\\n32\", hash));\n }\n\n /**\n * @dev Returns an Ethereum Signed Message, created from `s`. This\n * produces hash corresponding to the one signed with the\n * https://eth.wiki/json-rpc/API#eth_sign[`eth_sign`]\n * JSON-RPC method as part of EIP-191.\n *\n * See {recover}.\n */\n function toEthSignedMessageHash(bytes memory s) internal pure returns (bytes32) {\n return keccak256(abi.encodePacked(\"\\x19Ethereum Signed Message:\\n\", Strings.toString(s.length), s));\n }\n\n /**\n * @dev Returns an Ethereum Signed Typed Data, created from a\n * `domainSeparator` and a `structHash`. This produces hash corresponding\n * to the one signed with the\n * https://eips.ethereum.org/EIPS/eip-712[`eth_signTypedData`]\n * JSON-RPC method as part of EIP-712.\n *\n * See {recover}.\n */\n function toTypedDataHash(bytes32 domainSeparator, bytes32 structHash) internal pure returns (bytes32) {\n return keccak256(abi.encodePacked(\"\\x19\\x01\", domainSeparator, structHash));\n }\n}\n" - }, - "@uma/core/contracts/common/implementation/Testable.sol": { - "content": "// SPDX-License-Identifier: AGPL-3.0-only\npragma solidity ^0.8.0;\n\nimport \"./Timer.sol\";\n\n/**\n * @title Base class that provides time overrides, but only if being run in test mode.\n */\nabstract contract Testable {\n // If the contract is being run in production, then `timerAddress` will be the 0x0 address.\n // Note: this variable should be set on construction and never modified.\n address public timerAddress;\n\n /**\n * @notice Constructs the Testable contract. Called by child contracts.\n * @param _timerAddress Contract that stores the current time in a testing environment.\n * Must be set to 0x0 for production environments that use live time.\n */\n constructor(address _timerAddress) {\n timerAddress = _timerAddress;\n }\n\n /**\n * @notice Reverts if not running in test mode.\n */\n modifier onlyIfTest {\n require(timerAddress != address(0x0));\n _;\n }\n\n /**\n * @notice Sets the current time.\n * @dev Will revert if not running in test mode.\n * @param time timestamp to set current Testable time to.\n */\n function setCurrentTime(uint256 time) external onlyIfTest {\n Timer(timerAddress).setCurrentTime(time);\n }\n\n /**\n * @notice Gets the current time. Will return the last time set in `setCurrentTime` if running in test mode.\n * Otherwise, it will return the block timestamp.\n * @return uint for the current Testable timestamp.\n */\n function getCurrentTime() public view virtual returns (uint256) {\n if (timerAddress != address(0x0)) {\n return Timer(timerAddress).getCurrentTime();\n } else {\n return block.timestamp; // solhint-disable-line not-rely-on-time\n }\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" - }, - "@uma/core/contracts/common/implementation/MultiCaller.sol": { - "content": "// This contract is taken from Uniswaps'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.\npragma solidity ^0.8.0;\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 payable returns (bytes[] memory results) {\n require(msg.value == 0, \"Only multicall with 0 value\");\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" - }, - "@openzeppelin/contracts/utils/cryptography/MerkleProof.sol": { - "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts v4.4.1 (utils/cryptography/MerkleProof.sol)\n\npragma solidity ^0.8.0;\n\n/**\n * @dev These functions deal with verification of Merkle Trees proofs.\n *\n * The proofs can be generated using the JavaScript library\n * https://github.com/miguelmota/merkletreejs[merkletreejs].\n * Note: the hashing algorithm should be keccak256 and pair sorting should be enabled.\n *\n * See `test/utils/cryptography/MerkleProof.test.js` for some examples.\n */\nlibrary MerkleProof {\n /**\n * @dev Returns true if a `leaf` can be proved to be a part of a Merkle tree\n * defined by `root`. For this, a `proof` must be provided, containing\n * sibling hashes on the branch from the leaf to the root of the tree. Each\n * pair of leaves and each pair of pre-images are assumed to be sorted.\n */\n function verify(\n bytes32[] memory proof,\n bytes32 root,\n bytes32 leaf\n ) internal pure returns (bool) {\n return processProof(proof, leaf) == root;\n }\n\n /**\n * @dev Returns the rebuilt hash obtained by traversing a Merklee tree up\n * from `leaf` using `proof`. A `proof` is valid if and only if the rebuilt\n * hash matches the root of the tree. When processing the proof, the pairs\n * of leafs & pre-images are assumed to be sorted.\n *\n * _Available since v4.4._\n */\n function processProof(bytes32[] memory proof, bytes32 leaf) internal pure returns (bytes32) {\n bytes32 computedHash = leaf;\n for (uint256 i = 0; i < proof.length; i++) {\n bytes32 proofElement = proof[i];\n if (computedHash <= proofElement) {\n // Hash(current computed hash + current element of the proof)\n computedHash = keccak256(abi.encodePacked(computedHash, proofElement));\n } else {\n // Hash(current element of the proof + current computed hash)\n computedHash = keccak256(abi.encodePacked(proofElement, computedHash));\n }\n }\n return computedHash;\n }\n}\n" - }, - "contracts/HubPoolInterface.sol": { - "content": "// SPDX-License-Identifier: GPL-3.0-only\r\npragma solidity ^0.8.0;\r\n\r\nimport \"@openzeppelin/contracts/token/ERC20/IERC20.sol\";\r\nimport \"./interfaces/AdapterInterface.sol\";\r\n\r\ninterface HubPoolInterface {\r\n struct PoolRebalanceLeaf {\r\n // This is used to know which chain to send cross-chain transactions to (and which SpokePool to sent to).\r\n uint256 chainId;\r\n uint256[] bundleLpFees; // Total LP fee amount per token in this bundle, encompassing all associated bundled relays.\r\n // This array is grouped with the two above, and it represents the amount to send or request back from the\r\n // SpokePool. If positive, the pool will pay the SpokePool. If negative the SpokePool will pay the HubPool.\r\n // There can be arbitrarily complex rebalancing rules defined offchain. This number is only nonzero\r\n // when the rules indicate that a rebalancing action should occur. When a rebalance does not occur,\r\n // runningBalances for this token should change by the total relays - deposits in this bundle. When a rebalance\r\n // does occur, runningBalances should be set to zero for this token and the netSendAmounts should be set to the\r\n // previous runningBalances + relays - deposits in this bundle.\r\n int256[] netSendAmounts;\r\n // This is only here to be emitted in an event to track a running unpaid balance between the L2 pool and the L1 pool.\r\n // A positive number indicates that the HubPool owes the SpokePool funds. A negative number indicates that the\r\n // SpokePool owes the HubPool funds. See the comment above for the dynamics of this and netSendAmounts\r\n int256[] runningBalances;\r\n // Used as the index in the bitmap to track whether this leaf has been executed or not.\r\n uint8 leafId;\r\n // The following arrays are required to be the same length. They are parallel arrays for the given chainId and should be ordered by the `l1Tokens` field.\r\n // All whitelisted tokens with nonzero relays on this chain in this bundle in the order of whitelisting.\r\n address[] l1Tokens;\r\n }\r\n\r\n function setBond(IERC20 newBondToken, uint256 newBondAmount) external;\r\n\r\n function setCrossChainContracts(\r\n uint256 l2ChainId,\r\n address adapter,\r\n address spokePool\r\n ) external;\r\n\r\n function whitelistRoute(\r\n uint256 originChainId,\r\n uint256 destinationChainId,\r\n address originToken,\r\n address destinationToken\r\n ) external;\r\n\r\n function enableL1TokenForLiquidityProvision(address l1Token) external;\r\n\r\n function disableL1TokenForLiquidityProvision(address l1Token) external;\r\n\r\n function addLiquidity(address l1Token, uint256 l1TokenAmount) external payable;\r\n\r\n function removeLiquidity(\r\n address l1Token,\r\n uint256 lpTokenAmount,\r\n bool sendEth\r\n ) external;\r\n\r\n function exchangeRateCurrent(address l1Token) external returns (uint256);\r\n\r\n function liquidityUtilizationPostRelay(address token, uint256 relayedAmount) external returns (uint256);\r\n\r\n function proposeRootBundle(\r\n uint256[] memory bundleEvaluationBlockNumbers,\r\n uint8 poolRebalanceLeafCount,\r\n bytes32 poolRebalanceRoot,\r\n bytes32 relayerRefundRoot,\r\n bytes32 slowRelayFulfillmentRoot\r\n ) external;\r\n\r\n function executeRootBundle(PoolRebalanceLeaf memory poolRebalanceLeaf, bytes32[] memory proof) external;\r\n\r\n function disputeRootBundle() external;\r\n}\r\n" - }, - "contracts/interfaces/AdapterInterface.sol": { - "content": "// SPDX-License-Identifier: AGPL-3.0-only\npragma solidity ^0.8.0;\n\n/**\n * @notice Sends cross chain messages and tokens to contracts on a specific L2 network.\n */\n\ninterface AdapterInterface {\n event HubPoolChanged(address newHubPool);\n\n event MessageRelayed(address target, bytes message);\n\n event TokensRelayed(address l1Token, address l2Token, uint256 amount, address to);\n\n function relayMessage(address target, bytes memory message) external payable;\n\n function relayTokens(\n address l1Token,\n address l2Token,\n uint256 amount,\n address to\n ) external payable;\n}\n" - }, - "@openzeppelin/contracts/interfaces/IERC1271.sol": { - "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts v4.4.1 (interfaces/IERC1271.sol)\n\npragma solidity ^0.8.0;\n\n/**\n * @dev Interface of the ERC1271 standard signature validation method for\n * contracts as defined in https://eips.ethereum.org/EIPS/eip-1271[ERC-1271].\n *\n * _Available since v4.1._\n */\ninterface IERC1271 {\n /**\n * @dev Should return whether the signature provided is valid for the provided data\n * @param hash Hash of the data to be signed\n * @param signature Signature byte array associated with _data\n */\n function isValidSignature(bytes32 hash, bytes memory signature) external view returns (bytes4 magicValue);\n}\n" - }, - "@openzeppelin/contracts/utils/Strings.sol": { - "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts v4.4.1 (utils/Strings.sol)\n\npragma solidity ^0.8.0;\n\n/**\n * @dev String operations.\n */\nlibrary Strings {\n bytes16 private constant _HEX_SYMBOLS = \"0123456789abcdef\";\n\n /**\n * @dev Converts a `uint256` to its ASCII `string` decimal representation.\n */\n function toString(uint256 value) internal pure returns (string memory) {\n // Inspired by OraclizeAPI's implementation - MIT licence\n // https://github.com/oraclize/ethereum-api/blob/b42146b063c7d6ee1358846c198246239e9360e8/oraclizeAPI_0.4.25.sol\n\n if (value == 0) {\n return \"0\";\n }\n uint256 temp = value;\n uint256 digits;\n while (temp != 0) {\n digits++;\n temp /= 10;\n }\n bytes memory buffer = new bytes(digits);\n while (value != 0) {\n digits -= 1;\n buffer[digits] = bytes1(uint8(48 + uint256(value % 10)));\n value /= 10;\n }\n return string(buffer);\n }\n\n /**\n * @dev Converts a `uint256` to its ASCII `string` hexadecimal representation.\n */\n function toHexString(uint256 value) internal pure returns (string memory) {\n if (value == 0) {\n return \"0x00\";\n }\n uint256 temp = value;\n uint256 length = 0;\n while (temp != 0) {\n length++;\n temp >>= 8;\n }\n return toHexString(value, length);\n }\n\n /**\n * @dev Converts a `uint256` to its ASCII `string` hexadecimal representation with fixed length.\n */\n function toHexString(uint256 value, uint256 length) internal pure returns (string memory) {\n bytes memory buffer = new bytes(2 * length + 2);\n buffer[0] = \"0\";\n buffer[1] = \"x\";\n for (uint256 i = 2 * length + 1; i > 1; --i) {\n buffer[i] = _HEX_SYMBOLS[value & 0xf];\n value >>= 4;\n }\n require(value == 0, \"Strings: hex length insufficient\");\n return string(buffer);\n }\n}\n" - }, - "@uma/core/contracts/common/implementation/Timer.sol": { - "content": "// SPDX-License-Identifier: AGPL-3.0-only\npragma solidity ^0.8.0;\n\n/**\n * @title Universal store of current contract time for testing environments.\n */\ncontract Timer {\n uint256 private currentTime;\n\n constructor() {\n currentTime = block.timestamp; // solhint-disable-line not-rely-on-time\n }\n\n /**\n * @notice Sets the current time.\n * @dev Will revert if not running in test mode.\n * @param time timestamp to set `currentTime` to.\n */\n function setCurrentTime(uint256 time) external {\n currentTime = time;\n }\n\n /**\n * @notice Gets the currentTime variable set in the Timer.\n * @return uint256 for the current Testable timestamp.\n */\n function getCurrentTime() public view returns (uint256) {\n return currentTime;\n }\n}\n" - }, - "contracts/test/MockSpokePool.sol": { - "content": "//SPDX-License-Identifier: Unlicense\r\npragma solidity ^0.8.0;\r\n\r\nimport \"../SpokePool.sol\";\r\nimport \"../SpokePoolInterface.sol\";\r\n\r\n/**\r\n * @title MockSpokePool\r\n * @notice Implements admin internal methods to test internal logic.\r\n */\r\ncontract MockSpokePool is SpokePoolInterface, SpokePool {\r\n constructor(\r\n address _crossDomainAdmin,\r\n address _hubPool,\r\n address _wethAddress,\r\n address timerAddress\r\n ) SpokePool(_crossDomainAdmin, _hubPool, _wethAddress, timerAddress) {}\r\n\r\n function setCrossDomainAdmin(address newCrossDomainAdmin) public override {\r\n _setCrossDomainAdmin(newCrossDomainAdmin);\r\n }\r\n\r\n function setHubPool(address newHubPool) public override {\r\n _setHubPool(newHubPool);\r\n }\r\n\r\n function setEnableRoute(\r\n address originToken,\r\n uint256 destinationChainId,\r\n bool enable\r\n ) public override {\r\n _setEnableRoute(originToken, destinationChainId, enable);\r\n }\r\n\r\n function setDepositQuoteTimeBuffer(uint32 buffer) public override {\r\n _setDepositQuoteTimeBuffer(buffer);\r\n }\r\n\r\n function relayRootBundle(bytes32 relayerRefundRoot, bytes32 slowRelayFulfillmentRoot) public override {\r\n _relayRootBundle(relayerRefundRoot, slowRelayFulfillmentRoot);\r\n }\r\n\r\n function _bridgeTokensToHubPool(RelayerRefundLeaf memory relayerRefundLeaf) internal override {}\r\n}\r\n" - }, - "contracts/Optimism_SpokePool.sol": { - "content": "//SPDX-License-Identifier: Unlicense\r\npragma solidity ^0.8.0;\r\n\r\nimport \"./interfaces/WETH9.sol\";\r\n\r\nimport \"@eth-optimism/contracts/libraries/bridge/CrossDomainEnabled.sol\";\r\nimport \"@eth-optimism/contracts/libraries/constants/Lib_PredeployAddresses.sol\";\r\nimport \"@eth-optimism/contracts/L2/messaging/IL2ERC20Bridge.sol\";\r\nimport \"./SpokePool.sol\";\r\nimport \"./SpokePoolInterface.sol\";\r\n\r\n/**\r\n * @notice OVM specific SpokePool.\r\n * @dev Uses OVM cross-domain-enabled logic for access control.\r\n */\r\n\r\ncontract Optimism_SpokePool is CrossDomainEnabled, SpokePoolInterface, SpokePool {\r\n // \"l1Gas\" parameter used in call to bridge tokens from this contract back to L1 via `IL2ERC20Bridge`.\r\n uint32 public l1Gas = 5_000_000;\r\n\r\n address public l2Eth = address(Lib_PredeployAddresses.OVM_ETH);\r\n\r\n event OptimismTokensBridged(address indexed l2Token, address target, uint256 numberOfTokensBridged, uint256 l1Gas);\r\n event SetL1Gas(uint32 indexed newL1Gas);\r\n\r\n constructor(\r\n address _crossDomainAdmin,\r\n address _hubPool,\r\n address timerAddress\r\n )\r\n CrossDomainEnabled(Lib_PredeployAddresses.L2_CROSS_DOMAIN_MESSENGER)\r\n SpokePool(_crossDomainAdmin, _hubPool, 0x4200000000000000000000000000000000000006, timerAddress)\r\n {}\r\n\r\n /**************************************\r\n * CROSS-CHAIN ADMIN FUNCTIONS *\r\n **************************************/\r\n\r\n function setL1GasLimit(uint32 newl1Gas) public onlyFromCrossDomainAccount(crossDomainAdmin) {\r\n _setL1GasLimit(newl1Gas);\r\n }\r\n\r\n function setCrossDomainAdmin(address newCrossDomainAdmin)\r\n public\r\n override\r\n onlyFromCrossDomainAccount(crossDomainAdmin)\r\n nonReentrant\r\n {\r\n _setCrossDomainAdmin(newCrossDomainAdmin);\r\n }\r\n\r\n function setHubPool(address newHubPool) public override onlyFromCrossDomainAccount(crossDomainAdmin) nonReentrant {\r\n _setHubPool(newHubPool);\r\n }\r\n\r\n function setEnableRoute(\r\n address originToken,\r\n uint256 destinationChainId,\r\n bool enable\r\n ) public override onlyFromCrossDomainAccount(crossDomainAdmin) nonReentrant {\r\n _setEnableRoute(originToken, destinationChainId, enable);\r\n }\r\n\r\n function setDepositQuoteTimeBuffer(uint32 buffer)\r\n public\r\n override\r\n onlyFromCrossDomainAccount(crossDomainAdmin)\r\n nonReentrant\r\n {\r\n _setDepositQuoteTimeBuffer(buffer);\r\n }\r\n\r\n function relayRootBundle(bytes32 relayerRefundRoot, bytes32 slowRelayFulfillmentRoot)\r\n public\r\n override\r\n onlyFromCrossDomainAccount(crossDomainAdmin)\r\n nonReentrant\r\n {\r\n _relayRootBundle(relayerRefundRoot, slowRelayFulfillmentRoot);\r\n }\r\n\r\n /**************************************\r\n * INTERNAL FUNCTIONS *\r\n **************************************/\r\n\r\n function _setL1GasLimit(uint32 _l1Gas) internal {\r\n l1Gas = _l1Gas;\r\n emit SetL1Gas(l1Gas);\r\n }\r\n\r\n function _bridgeTokensToHubPool(RelayerRefundLeaf memory relayerRefundLeaf) internal override {\r\n // If the token being bridged is WETH then we need to first unwrap it to ETH and then send ETH over the\r\n // canonical bridge. On Optimism, this is address 0xDeadDeAddeAddEAddeadDEaDDEAdDeaDDeAD0000.\r\n if (relayerRefundLeaf.l2TokenAddress == address(weth)) {\r\n WETH9(relayerRefundLeaf.l2TokenAddress).withdraw(relayerRefundLeaf.amountToReturn); // Unwrap ETH.\r\n relayerRefundLeaf.l2TokenAddress = l2Eth; // Set the l2TokenAddress to ETH.\r\n }\r\n IL2ERC20Bridge(Lib_PredeployAddresses.L2_STANDARD_BRIDGE).withdrawTo(\r\n relayerRefundLeaf.l2TokenAddress, // _l2Token. Address of the L2 token to bridge over.\r\n hubPool, // _to. Withdraw, over the bridge, to the l1 pool contract.\r\n relayerRefundLeaf.amountToReturn, // _amount.\r\n l1Gas, // _l1Gas. Unused, but included for potential forward compatibility considerations\r\n \"\" // _data. We don't need to send any data for the bridging action.\r\n );\r\n\r\n emit OptimismTokensBridged(relayerRefundLeaf.l2TokenAddress, hubPool, relayerRefundLeaf.amountToReturn, l1Gas);\r\n }\r\n}\r\n" - }, - "@eth-optimism/contracts/libraries/bridge/CrossDomainEnabled.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma solidity >0.5.0 <0.9.0;\n\n/* Interface Imports */\nimport { ICrossDomainMessenger } from \"./ICrossDomainMessenger.sol\";\n\n/**\n * @title CrossDomainEnabled\n * @dev Helper contract for contracts performing cross-domain communications\n *\n * Compiler used: defined by inheriting contract\n */\ncontract CrossDomainEnabled {\n /*************\n * Variables *\n *************/\n\n // Messenger contract used to send and recieve messages from the other domain.\n address public messenger;\n\n /***************\n * Constructor *\n ***************/\n\n /**\n * @param _messenger Address of the CrossDomainMessenger on the current layer.\n */\n constructor(address _messenger) {\n messenger = _messenger;\n }\n\n /**********************\n * Function Modifiers *\n **********************/\n\n /**\n * Enforces that the modified function is only callable by a specific cross-domain account.\n * @param _sourceDomainAccount The only account on the originating domain which is\n * authenticated to call this function.\n */\n modifier onlyFromCrossDomainAccount(address _sourceDomainAccount) {\n require(\n msg.sender == address(getCrossDomainMessenger()),\n \"OVM_XCHAIN: messenger contract unauthenticated\"\n );\n\n require(\n getCrossDomainMessenger().xDomainMessageSender() == _sourceDomainAccount,\n \"OVM_XCHAIN: wrong sender of cross-domain message\"\n );\n\n _;\n }\n\n /**********************\n * Internal Functions *\n **********************/\n\n /**\n * Gets the messenger, usually from storage. This function is exposed in case a child contract\n * needs to override.\n * @return The address of the cross-domain messenger contract which should be used.\n */\n function getCrossDomainMessenger() internal virtual returns (ICrossDomainMessenger) {\n return ICrossDomainMessenger(messenger);\n }\n\n /**q\n * Sends a message to an account on another domain\n * @param _crossDomainTarget The intended recipient on the destination domain\n * @param _message The data to send to the target (usually calldata to a function with\n * `onlyFromCrossDomainAccount()`)\n * @param _gasLimit The gasLimit for the receipt of the message on the target domain.\n */\n function sendCrossDomainMessage(\n address _crossDomainTarget,\n uint32 _gasLimit,\n bytes memory _message\n ) internal {\n // slither-disable-next-line reentrancy-events, reentrancy-benign\n getCrossDomainMessenger().sendMessage(_crossDomainTarget, _message, _gasLimit);\n }\n}\n" - }, - "@eth-optimism/contracts/libraries/constants/Lib_PredeployAddresses.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.9;\n\n/**\n * @title Lib_PredeployAddresses\n */\nlibrary Lib_PredeployAddresses {\n address internal constant L2_TO_L1_MESSAGE_PASSER = 0x4200000000000000000000000000000000000000;\n address internal constant L1_MESSAGE_SENDER = 0x4200000000000000000000000000000000000001;\n address internal constant DEPLOYER_WHITELIST = 0x4200000000000000000000000000000000000002;\n address payable internal constant OVM_ETH = payable(0xDeadDeAddeAddEAddeadDEaDDEAdDeaDDeAD0000);\n address internal constant L2_CROSS_DOMAIN_MESSENGER =\n 0x4200000000000000000000000000000000000007;\n address internal constant LIB_ADDRESS_MANAGER = 0x4200000000000000000000000000000000000008;\n address internal constant PROXY_EOA = 0x4200000000000000000000000000000000000009;\n address internal constant L2_STANDARD_BRIDGE = 0x4200000000000000000000000000000000000010;\n address internal constant SEQUENCER_FEE_WALLET = 0x4200000000000000000000000000000000000011;\n address internal constant L2_STANDARD_TOKEN_FACTORY =\n 0x4200000000000000000000000000000000000012;\n address internal constant L1_BLOCK_NUMBER = 0x4200000000000000000000000000000000000013;\n}\n" - }, - "@eth-optimism/contracts/L2/messaging/IL2ERC20Bridge.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.9;\n\n/**\n * @title IL2ERC20Bridge\n */\ninterface IL2ERC20Bridge {\n /**********\n * Events *\n **********/\n\n event WithdrawalInitiated(\n address indexed _l1Token,\n address indexed _l2Token,\n address indexed _from,\n address _to,\n uint256 _amount,\n bytes _data\n );\n\n event DepositFinalized(\n address indexed _l1Token,\n address indexed _l2Token,\n address indexed _from,\n address _to,\n uint256 _amount,\n bytes _data\n );\n\n event DepositFailed(\n address indexed _l1Token,\n address indexed _l2Token,\n address indexed _from,\n address _to,\n uint256 _amount,\n bytes _data\n );\n\n /********************\n * Public Functions *\n ********************/\n\n /**\n * @dev get the address of the corresponding L1 bridge contract.\n * @return Address of the corresponding L1 bridge contract.\n */\n function l1TokenBridge() external returns (address);\n\n /**\n * @dev initiate a withdraw of some tokens to the caller's account on L1\n * @param _l2Token Address of L2 token where withdrawal was initiated.\n * @param _amount Amount of the token to withdraw.\n * param _l1Gas Unused, but included for potential forward compatibility considerations.\n * @param _data Optional data to forward to L1. This data is provided\n * solely as a convenience for external contracts. Aside from enforcing a maximum\n * length, these contracts provide no guarantees about its content.\n */\n function withdraw(\n address _l2Token,\n uint256 _amount,\n uint32 _l1Gas,\n bytes calldata _data\n ) external;\n\n /**\n * @dev initiate a withdraw of some token to a recipient's account on L1.\n * @param _l2Token Address of L2 token where withdrawal is initiated.\n * @param _to L1 adress to credit the withdrawal to.\n * @param _amount Amount of the token to withdraw.\n * param _l1Gas Unused, but included for potential forward compatibility considerations.\n * @param _data Optional data to forward to L1. This data is provided\n * solely as a convenience for external contracts. Aside from enforcing a maximum\n * length, these contracts provide no guarantees about its content.\n */\n function withdrawTo(\n address _l2Token,\n address _to,\n uint256 _amount,\n uint32 _l1Gas,\n bytes calldata _data\n ) external;\n\n /*************************\n * Cross-chain Functions *\n *************************/\n\n /**\n * @dev Complete a deposit from L1 to L2, and credits funds to the recipient's balance of this\n * L2 token. This call will fail if it did not originate from a corresponding deposit in\n * L1StandardTokenBridge.\n * @param _l1Token Address for the l1 token this is called with\n * @param _l2Token Address for the l2 token this is called with\n * @param _from Account to pull the deposit from on L2.\n * @param _to Address to receive the withdrawal at\n * @param _amount Amount of the token to withdraw\n * @param _data Data provider by the sender on L1. This data is provided\n * solely as a convenience for external contracts. Aside from enforcing a maximum\n * length, these contracts provide no guarantees about its content.\n */\n function finalizeDeposit(\n address _l1Token,\n address _l2Token,\n address _from,\n address _to,\n uint256 _amount,\n bytes calldata _data\n ) external;\n}\n" - }, - "@eth-optimism/contracts/libraries/bridge/ICrossDomainMessenger.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma solidity >0.5.0 <0.9.0;\n\n/**\n * @title ICrossDomainMessenger\n */\ninterface ICrossDomainMessenger {\n /**********\n * Events *\n **********/\n\n event SentMessage(\n address indexed target,\n address sender,\n bytes message,\n uint256 messageNonce,\n uint256 gasLimit\n );\n event RelayedMessage(bytes32 indexed msgHash);\n event FailedRelayedMessage(bytes32 indexed msgHash);\n\n /*************\n * Variables *\n *************/\n\n function xDomainMessageSender() external view returns (address);\n\n /********************\n * Public Functions *\n ********************/\n\n /**\n * Sends a cross domain message to the target messenger.\n * @param _target Target contract address.\n * @param _message Message to send to the target.\n * @param _gasLimit Gas limit for the provided message.\n */\n function sendMessage(\n address _target,\n bytes calldata _message,\n uint32 _gasLimit\n ) external;\n}\n" - }, - "contracts/chain-adapters/Optimism_Adapter.sol": { - "content": "// SPDX-License-Identifier: AGPL-3.0-only\r\npragma solidity ^0.8.0;\r\n\r\nimport \"./Base_Adapter.sol\";\r\nimport \"../interfaces/AdapterInterface.sol\";\r\nimport \"../interfaces/WETH9.sol\";\r\n\r\nimport \"@eth-optimism/contracts/libraries/bridge/CrossDomainEnabled.sol\";\r\nimport \"@eth-optimism/contracts/L1/messaging/IL1StandardBridge.sol\";\r\n\r\nimport \"@uma/core/contracts/common/implementation/Lockable.sol\";\r\n\r\nimport \"@openzeppelin/contracts/token/ERC20/IERC20.sol\";\r\n\r\n/**\r\n * @notice Sends cross chain messages Optimism L2 network.\r\n * @dev This contract's owner should be set to the some multisig or admin contract. The Owner can simply set the L2 gas\r\n * and the HubPool. The HubPool is the only contract that can relay tokens and messages over the bridge.\r\n */\r\ncontract Optimism_Adapter is Base_Adapter, CrossDomainEnabled, Lockable {\r\n uint32 public l2GasLimit = 5_000_000;\r\n\r\n WETH9 public l1Weth;\r\n\r\n IL1StandardBridge public l1StandardBridge;\r\n\r\n event L2GasLimitSet(uint32 newGasLimit);\r\n\r\n constructor(\r\n WETH9 _l1Weth,\r\n address _hubPool,\r\n address _crossDomainMessenger,\r\n IL1StandardBridge _l1StandardBridge\r\n ) CrossDomainEnabled(_crossDomainMessenger) Base_Adapter(_hubPool) {\r\n l1Weth = _l1Weth;\r\n l1StandardBridge = _l1StandardBridge;\r\n }\r\n\r\n function setL2GasLimit(uint32 _l2GasLimit) public onlyOwner {\r\n l2GasLimit = _l2GasLimit;\r\n emit L2GasLimitSet(l2GasLimit);\r\n }\r\n\r\n function relayMessage(address target, bytes memory message) external payable override nonReentrant onlyHubPool {\r\n sendCrossDomainMessage(target, uint32(l2GasLimit), message);\r\n emit MessageRelayed(target, message);\r\n }\r\n\r\n function relayTokens(\r\n address l1Token,\r\n address l2Token,\r\n uint256 amount,\r\n address to\r\n ) external payable override nonReentrant onlyHubPool {\r\n // If the l1Token is weth then unwrap it to ETH then send the ETH to the standard bridge.\r\n if (l1Token == address(l1Weth)) {\r\n l1Weth.withdraw(amount);\r\n l1StandardBridge.depositETHTo{ value: amount }(to, l2GasLimit, \"\");\r\n } else {\r\n IERC20(l1Token).approve(address(l1StandardBridge), amount);\r\n l1StandardBridge.depositERC20To(l1Token, l2Token, to, amount, l2GasLimit, \"\");\r\n }\r\n emit TokensRelayed(l1Token, l2Token, amount, to);\r\n }\r\n\r\n // Added to enable the Optimism_Adapter to receive ETH. used when unwrapping WETH.\r\n receive() external payable {}\r\n}\r\n" - }, - "contracts/chain-adapters/Base_Adapter.sol": { - "content": "// SPDX-License-Identifier: AGPL-3.0-only\npragma solidity ^0.8.0;\nimport \"../interfaces/AdapterInterface.sol\";\n\nimport \"@openzeppelin/contracts/access/Ownable.sol\";\n\nabstract contract Base_Adapter is Ownable, AdapterInterface {\n address public hubPool;\n\n modifier onlyHubPool() {\n require(msg.sender == hubPool, \"Can only be called by hubPool\");\n _;\n }\n\n constructor(address _hubPool) {\n hubPool = _hubPool;\n }\n\n function setHubPool(address _hubPool) public onlyOwner {\n hubPool = _hubPool;\n emit HubPoolChanged(_hubPool);\n }\n}\n" - }, - "@eth-optimism/contracts/L1/messaging/IL1StandardBridge.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma solidity >0.5.0 <0.9.0;\n\nimport \"./IL1ERC20Bridge.sol\";\n\n/**\n * @title IL1StandardBridge\n */\ninterface IL1StandardBridge is IL1ERC20Bridge {\n /**********\n * Events *\n **********/\n event ETHDepositInitiated(\n address indexed _from,\n address indexed _to,\n uint256 _amount,\n bytes _data\n );\n\n event ETHWithdrawalFinalized(\n address indexed _from,\n address indexed _to,\n uint256 _amount,\n bytes _data\n );\n\n /********************\n * Public Functions *\n ********************/\n\n /**\n * @dev Deposit an amount of the ETH to the caller's balance on L2.\n * @param _l2Gas Gas limit required to complete the deposit on L2.\n * @param _data Optional data to forward to L2. This data is provided\n * solely as a convenience for external contracts. Aside from enforcing a maximum\n * length, these contracts provide no guarantees about its content.\n */\n function depositETH(uint32 _l2Gas, bytes calldata _data) external payable;\n\n /**\n * @dev Deposit an amount of ETH to a recipient's balance on L2.\n * @param _to L2 address to credit the withdrawal to.\n * @param _l2Gas Gas limit required to complete the deposit on L2.\n * @param _data Optional data to forward to L2. This data is provided\n * solely as a convenience for external contracts. Aside from enforcing a maximum\n * length, these contracts provide no guarantees about its content.\n */\n function depositETHTo(\n address _to,\n uint32 _l2Gas,\n bytes calldata _data\n ) external payable;\n\n /*************************\n * Cross-chain Functions *\n *************************/\n\n /**\n * @dev Complete a withdrawal from L2 to L1, and credit funds to the recipient's balance of the\n * L1 ETH token. Since only the xDomainMessenger can call this function, it will never be called\n * before the withdrawal is finalized.\n * @param _from L2 address initiating the transfer.\n * @param _to L1 address to credit the withdrawal to.\n * @param _amount Amount of the ERC20 to deposit.\n * @param _data Optional data to forward to L2. This data is provided\n * solely as a convenience for external contracts. Aside from enforcing a maximum\n * length, these contracts provide no guarantees about its content.\n */\n function finalizeETHWithdrawal(\n address _from,\n address _to,\n uint256 _amount,\n bytes calldata _data\n ) external;\n}\n" - }, - "@openzeppelin/contracts/access/Ownable.sol": { - "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts v4.4.1 (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 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 called by any account other than the owner.\n */\n modifier onlyOwner() {\n require(owner() == _msgSender(), \"Ownable: caller is not the owner\");\n _;\n }\n\n /**\n * @dev Leaves the contract without owner. It will not be possible to call\n * `onlyOwner` functions anymore. Can only be called by the current owner.\n *\n * NOTE: Renouncing ownership will leave the contract without an owner,\n * thereby removing 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/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" - }, - "@eth-optimism/contracts/L1/messaging/IL1ERC20Bridge.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma solidity >0.5.0 <0.9.0;\n\n/**\n * @title IL1ERC20Bridge\n */\ninterface IL1ERC20Bridge {\n /**********\n * Events *\n **********/\n\n event ERC20DepositInitiated(\n address indexed _l1Token,\n address indexed _l2Token,\n address indexed _from,\n address _to,\n uint256 _amount,\n bytes _data\n );\n\n event ERC20WithdrawalFinalized(\n address indexed _l1Token,\n address indexed _l2Token,\n address indexed _from,\n address _to,\n uint256 _amount,\n bytes _data\n );\n\n /********************\n * Public Functions *\n ********************/\n\n /**\n * @dev get the address of the corresponding L2 bridge contract.\n * @return Address of the corresponding L2 bridge contract.\n */\n function l2TokenBridge() external returns (address);\n\n /**\n * @dev deposit an amount of the ERC20 to the caller's balance on L2.\n * @param _l1Token Address of the L1 ERC20 we are depositing\n * @param _l2Token Address of the L1 respective L2 ERC20\n * @param _amount Amount of the ERC20 to deposit\n * @param _l2Gas Gas limit required to complete the deposit on L2.\n * @param _data Optional data to forward to L2. This data is provided\n * solely as a convenience for external contracts. Aside from enforcing a maximum\n * length, these contracts provide no guarantees about its content.\n */\n function depositERC20(\n address _l1Token,\n address _l2Token,\n uint256 _amount,\n uint32 _l2Gas,\n bytes calldata _data\n ) external;\n\n /**\n * @dev deposit an amount of ERC20 to a recipient's balance on L2.\n * @param _l1Token Address of the L1 ERC20 we are depositing\n * @param _l2Token Address of the L1 respective L2 ERC20\n * @param _to L2 address to credit the withdrawal to.\n * @param _amount Amount of the ERC20 to deposit.\n * @param _l2Gas Gas limit required to complete the deposit on L2.\n * @param _data Optional data to forward to L2. This data is provided\n * solely as a convenience for external contracts. Aside from enforcing a maximum\n * length, these contracts provide no guarantees about its content.\n */\n function depositERC20To(\n address _l1Token,\n address _l2Token,\n address _to,\n uint256 _amount,\n uint32 _l2Gas,\n bytes calldata _data\n ) external;\n\n /*************************\n * Cross-chain Functions *\n *************************/\n\n /**\n * @dev Complete a withdrawal from L2 to L1, and credit funds to the recipient's balance of the\n * L1 ERC20 token.\n * This call will fail if the initialized withdrawal from L2 has not been finalized.\n *\n * @param _l1Token Address of L1 token to finalizeWithdrawal for.\n * @param _l2Token Address of L2 token where withdrawal was initiated.\n * @param _from L2 address initiating the transfer.\n * @param _to L1 address to credit the withdrawal to.\n * @param _amount Amount of the ERC20 to deposit.\n * @param _data Data provided by the sender on L2. This data is provided\n * solely as a convenience for external contracts. Aside from enforcing a maximum\n * length, these contracts provide no guarantees about its content.\n */\n function finalizeERC20Withdrawal(\n address _l1Token,\n address _l2Token,\n address _from,\n address _to,\n uint256 _amount,\n bytes calldata _data\n ) external;\n}\n" - }, - "@openzeppelin/contracts/token/ERC20/extensions/IERC20Metadata.sol": { - "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts v4.4.1 (token/ERC20/extensions/IERC20Metadata.sol)\n\npragma solidity ^0.8.0;\n\nimport \"../IERC20.sol\";\n\n/**\n * @dev Interface for the optional metadata functions from the ERC20 standard.\n *\n * _Available since v4.1._\n */\ninterface IERC20Metadata is IERC20 {\n /**\n * @dev Returns the name of the token.\n */\n function name() external view returns (string memory);\n\n /**\n * @dev Returns the symbol of the token.\n */\n function symbol() external view returns (string memory);\n\n /**\n * @dev Returns the decimals places of the token.\n */\n function decimals() external view returns (uint8);\n}\n" - }, - "@openzeppelin/contracts/token/ERC20/ERC20.sol": { - "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts v4.4.1 (token/ERC20/ERC20.sol)\n\npragma solidity ^0.8.0;\n\nimport \"./IERC20.sol\";\nimport \"./extensions/IERC20Metadata.sol\";\nimport \"../../utils/Context.sol\";\n\n/**\n * @dev Implementation of the {IERC20} interface.\n *\n * This implementation is agnostic to the way tokens are created. This means\n * that a supply mechanism has to be added in a derived contract using {_mint}.\n * For a generic mechanism see {ERC20PresetMinterPauser}.\n *\n * TIP: For a detailed writeup see our guide\n * https://forum.zeppelin.solutions/t/how-to-implement-erc20-supply-mechanisms/226[How\n * to implement supply mechanisms].\n *\n * We have followed general OpenZeppelin Contracts guidelines: functions revert\n * instead returning `false` on failure. This behavior is nonetheless\n * conventional and does not conflict with the expectations of ERC20\n * applications.\n *\n * Additionally, an {Approval} event is emitted on calls to {transferFrom}.\n * This allows applications to reconstruct the allowance for all accounts just\n * by listening to said events. Other implementations of the EIP may not emit\n * these events, as it isn't required by the specification.\n *\n * Finally, the non-standard {decreaseAllowance} and {increaseAllowance}\n * functions have been added to mitigate the well-known issues around setting\n * allowances. See {IERC20-approve}.\n */\ncontract ERC20 is Context, IERC20, IERC20Metadata {\n mapping(address => uint256) private _balances;\n\n mapping(address => mapping(address => uint256)) private _allowances;\n\n uint256 private _totalSupply;\n\n string private _name;\n string private _symbol;\n\n /**\n * @dev Sets the values for {name} and {symbol}.\n *\n * The default value of {decimals} is 18. To select a different value for\n * {decimals} you should overload it.\n *\n * All two of these values are immutable: they can only be set once during\n * construction.\n */\n constructor(string memory name_, string memory symbol_) {\n _name = name_;\n _symbol = symbol_;\n }\n\n /**\n * @dev Returns the name of the token.\n */\n function name() public view virtual override returns (string memory) {\n return _name;\n }\n\n /**\n * @dev Returns the symbol of the token, usually a shorter version of the\n * name.\n */\n function symbol() public view virtual override returns (string memory) {\n return _symbol;\n }\n\n /**\n * @dev Returns the number of decimals used to get its user representation.\n * For example, if `decimals` equals `2`, a balance of `505` tokens should\n * be displayed to a user as `5.05` (`505 / 10 ** 2`).\n *\n * Tokens usually opt for a value of 18, imitating the relationship between\n * Ether and Wei. This is the value {ERC20} uses, unless this function is\n * overridden;\n *\n * NOTE: This information is only used for _display_ purposes: it in\n * no way affects any of the arithmetic of the contract, including\n * {IERC20-balanceOf} and {IERC20-transfer}.\n */\n function decimals() public view virtual override returns (uint8) {\n return 18;\n }\n\n /**\n * @dev See {IERC20-totalSupply}.\n */\n function totalSupply() public view virtual override returns (uint256) {\n return _totalSupply;\n }\n\n /**\n * @dev See {IERC20-balanceOf}.\n */\n function balanceOf(address account) public view virtual override returns (uint256) {\n return _balances[account];\n }\n\n /**\n * @dev See {IERC20-transfer}.\n *\n * Requirements:\n *\n * - `recipient` cannot be the zero address.\n * - the caller must have a balance of at least `amount`.\n */\n function transfer(address recipient, uint256 amount) public virtual override returns (bool) {\n _transfer(_msgSender(), recipient, amount);\n return true;\n }\n\n /**\n * @dev See {IERC20-allowance}.\n */\n function allowance(address owner, address spender) public view virtual override returns (uint256) {\n return _allowances[owner][spender];\n }\n\n /**\n * @dev See {IERC20-approve}.\n *\n * Requirements:\n *\n * - `spender` cannot be the zero address.\n */\n function approve(address spender, uint256 amount) public virtual override returns (bool) {\n _approve(_msgSender(), spender, amount);\n return true;\n }\n\n /**\n * @dev See {IERC20-transferFrom}.\n *\n * Emits an {Approval} event indicating the updated allowance. This is not\n * required by the EIP. See the note at the beginning of {ERC20}.\n *\n * Requirements:\n *\n * - `sender` and `recipient` cannot be the zero address.\n * - `sender` must have a balance of at least `amount`.\n * - the caller must have allowance for ``sender``'s tokens of at least\n * `amount`.\n */\n function transferFrom(\n address sender,\n address recipient,\n uint256 amount\n ) public virtual override returns (bool) {\n _transfer(sender, recipient, amount);\n\n uint256 currentAllowance = _allowances[sender][_msgSender()];\n require(currentAllowance >= amount, \"ERC20: transfer amount exceeds allowance\");\n unchecked {\n _approve(sender, _msgSender(), currentAllowance - amount);\n }\n\n return true;\n }\n\n /**\n * @dev Atomically increases the allowance granted to `spender` by the caller.\n *\n * This is an alternative to {approve} that can be used as a mitigation for\n * problems described in {IERC20-approve}.\n *\n * Emits an {Approval} event indicating the updated allowance.\n *\n * Requirements:\n *\n * - `spender` cannot be the zero address.\n */\n function increaseAllowance(address spender, uint256 addedValue) public virtual returns (bool) {\n _approve(_msgSender(), spender, _allowances[_msgSender()][spender] + addedValue);\n return true;\n }\n\n /**\n * @dev Atomically decreases the allowance granted to `spender` by the caller.\n *\n * This is an alternative to {approve} that can be used as a mitigation for\n * problems described in {IERC20-approve}.\n *\n * Emits an {Approval} event indicating the updated allowance.\n *\n * Requirements:\n *\n * - `spender` cannot be the zero address.\n * - `spender` must have allowance for the caller of at least\n * `subtractedValue`.\n */\n function decreaseAllowance(address spender, uint256 subtractedValue) public virtual returns (bool) {\n uint256 currentAllowance = _allowances[_msgSender()][spender];\n require(currentAllowance >= subtractedValue, \"ERC20: decreased allowance below zero\");\n unchecked {\n _approve(_msgSender(), spender, currentAllowance - subtractedValue);\n }\n\n return true;\n }\n\n /**\n * @dev Moves `amount` of tokens from `sender` to `recipient`.\n *\n * This internal function is equivalent to {transfer}, and can be used to\n * e.g. implement automatic token fees, slashing mechanisms, etc.\n *\n * Emits a {Transfer} event.\n *\n * Requirements:\n *\n * - `sender` cannot be the zero address.\n * - `recipient` cannot be the zero address.\n * - `sender` must have a balance of at least `amount`.\n */\n function _transfer(\n address sender,\n address recipient,\n uint256 amount\n ) internal virtual {\n require(sender != address(0), \"ERC20: transfer from the zero address\");\n require(recipient != address(0), \"ERC20: transfer to the zero address\");\n\n _beforeTokenTransfer(sender, recipient, amount);\n\n uint256 senderBalance = _balances[sender];\n require(senderBalance >= amount, \"ERC20: transfer amount exceeds balance\");\n unchecked {\n _balances[sender] = senderBalance - amount;\n }\n _balances[recipient] += amount;\n\n emit Transfer(sender, recipient, amount);\n\n _afterTokenTransfer(sender, recipient, amount);\n }\n\n /** @dev Creates `amount` tokens and assigns them to `account`, increasing\n * the total supply.\n *\n * Emits a {Transfer} event with `from` set to the zero address.\n *\n * Requirements:\n *\n * - `account` cannot be the zero address.\n */\n function _mint(address account, uint256 amount) internal virtual {\n require(account != address(0), \"ERC20: mint to the zero address\");\n\n _beforeTokenTransfer(address(0), account, amount);\n\n _totalSupply += amount;\n _balances[account] += amount;\n emit Transfer(address(0), account, amount);\n\n _afterTokenTransfer(address(0), account, amount);\n }\n\n /**\n * @dev Destroys `amount` tokens from `account`, reducing the\n * total supply.\n *\n * Emits a {Transfer} event with `to` set to the zero address.\n *\n * Requirements:\n *\n * - `account` cannot be the zero address.\n * - `account` must have at least `amount` tokens.\n */\n function _burn(address account, uint256 amount) internal virtual {\n require(account != address(0), \"ERC20: burn from the zero address\");\n\n _beforeTokenTransfer(account, address(0), amount);\n\n uint256 accountBalance = _balances[account];\n require(accountBalance >= amount, \"ERC20: burn amount exceeds balance\");\n unchecked {\n _balances[account] = accountBalance - amount;\n }\n _totalSupply -= amount;\n\n emit Transfer(account, address(0), amount);\n\n _afterTokenTransfer(account, address(0), amount);\n }\n\n /**\n * @dev Sets `amount` as the allowance of `spender` over the `owner` s tokens.\n *\n * This internal function is equivalent to `approve`, and can be used to\n * e.g. set automatic allowances for certain subsystems, etc.\n *\n * Emits an {Approval} event.\n *\n * Requirements:\n *\n * - `owner` cannot be the zero address.\n * - `spender` cannot be the zero address.\n */\n function _approve(\n address owner,\n address spender,\n uint256 amount\n ) internal virtual {\n require(owner != address(0), \"ERC20: approve from the zero address\");\n require(spender != address(0), \"ERC20: approve to the zero address\");\n\n _allowances[owner][spender] = amount;\n emit Approval(owner, spender, amount);\n }\n\n /**\n * @dev Hook that is called before any transfer of tokens. This includes\n * minting and burning.\n *\n * Calling conditions:\n *\n * - when `from` and `to` are both non-zero, `amount` of ``from``'s tokens\n * will be transferred to `to`.\n * - when `from` is zero, `amount` tokens will be minted for `to`.\n * - when `to` is zero, `amount` of ``from``'s tokens will be burned.\n * - `from` and `to` are never both zero.\n *\n * To learn more about hooks, head to xref:ROOT:extending-contracts.adoc#using-hooks[Using Hooks].\n */\n function _beforeTokenTransfer(\n address from,\n address to,\n uint256 amount\n ) internal virtual {}\n\n /**\n * @dev Hook that is called after any transfer of tokens. This includes\n * minting and burning.\n *\n * Calling conditions:\n *\n * - when `from` and `to` are both non-zero, `amount` of ``from``'s tokens\n * has been transferred to `to`.\n * - when `from` is zero, `amount` tokens have been minted for `to`.\n * - when `to` is zero, `amount` of ``from``'s tokens have been burned.\n * - `from` and `to` are never both zero.\n *\n * To learn more about hooks, head to xref:ROOT:extending-contracts.adoc#using-hooks[Using Hooks].\n */\n function _afterTokenTransfer(\n address from,\n address to,\n uint256 amount\n ) internal virtual {}\n}\n" - }, - "contracts/chain-adapters/Ethereum_Adapter.sol": { - "content": "// SPDX-License-Identifier: AGPL-3.0-only\r\npragma solidity ^0.8.0;\r\n\r\nimport \"./Base_Adapter.sol\";\r\nimport \"../interfaces/AdapterInterface.sol\";\r\nimport \"../interfaces/WETH9.sol\";\r\n\r\nimport \"@uma/core/contracts/common/implementation/Lockable.sol\";\r\n\r\nimport \"@openzeppelin/contracts/token/ERC20/IERC20.sol\";\r\nimport \"@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol\";\r\n\r\ncontract Ethereum_Adapter is Base_Adapter, Lockable {\r\n using SafeERC20 for IERC20;\r\n\r\n constructor(address _hubPool) Base_Adapter(_hubPool) {}\r\n\r\n function relayMessage(address target, bytes memory message) external payable override nonReentrant onlyHubPool {\r\n _executeCall(target, message);\r\n emit MessageRelayed(target, message);\r\n }\r\n\r\n function relayTokens(\r\n address l1Token,\r\n address l2Token, // l2Token is unused for L1.\r\n uint256 amount,\r\n address to\r\n ) external payable override nonReentrant onlyHubPool {\r\n IERC20(l1Token).safeTransfer(to, amount);\r\n emit TokensRelayed(l1Token, l2Token, amount, to);\r\n }\r\n\r\n // Note: this snippet of code is copied from Governor.sol.\r\n function _executeCall(address to, bytes memory data) private {\r\n // Note: this snippet of code is copied from Governor.sol and modified to not include any \"value\" field.\r\n // solhint-disable-next-line no-inline-assembly\r\n\r\n bool success;\r\n assembly {\r\n let inputData := add(data, 0x20)\r\n let inputDataSize := mload(data)\r\n // Hardcode value to be 0 for relayed governance calls in order to avoid addressing complexity of bridging\r\n // value cross-chain.\r\n success := call(gas(), to, 0, inputData, inputDataSize, 0, 0)\r\n }\r\n require(success, \"execute call failed\");\r\n }\r\n\r\n receive() external payable {}\r\n}\r\n" - }, - "contracts/chain-adapters/Arbitrum_Adapter.sol": { - "content": "// SPDX-License-Identifier: AGPL-3.0-only\r\npragma solidity ^0.8.0;\r\n\r\nimport \"./Base_Adapter.sol\";\r\nimport \"../interfaces/AdapterInterface.sol\";\r\nimport \"../interfaces/WETH9.sol\";\r\n\r\nimport \"@uma/core/contracts/common/implementation/Lockable.sol\";\r\n\r\nimport \"@openzeppelin/contracts/token/ERC20/IERC20.sol\";\r\n\r\ninterface ArbitrumL1InboxLike {\r\n function createRetryableTicket(\r\n address destAddr,\r\n uint256 arbTxCallValue,\r\n uint256 maxSubmissionCost,\r\n address submissionRefundAddress,\r\n address valueRefundAddress,\r\n uint256 maxGas,\r\n uint256 gasPriceBid,\r\n bytes calldata data\r\n ) external payable returns (uint256);\r\n}\r\n\r\ninterface ArbitrumL1ERC20GatewayLike {\r\n function outboundTransfer(\r\n address _token,\r\n address _to,\r\n uint256 _amount,\r\n uint256 _maxGas,\r\n uint256 _gasPriceBid,\r\n bytes calldata _data\r\n ) external payable returns (bytes memory);\r\n}\r\n\r\ncontract Arbitrum_Adapter is Base_Adapter, Lockable {\r\n // Gas limit for immediate L2 execution attempt (can be estimated via NodeInterface.estimateRetryableTicket).\r\n // NodeInterface precompile interface exists at L2 address 0x00000000000000000000000000000000000000C8\r\n uint32 public l2GasLimit = 5_000_000;\r\n\r\n // Amount of ETH allocated to pay for the base submission fee. The base submission fee is a parameter unique to\r\n // retryable transactions; the user is charged the base submission fee to cover the storage costs of keeping their\r\n // ticket’s calldata in the retry buffer. (current base submission fee is queryable via\r\n // ArbRetryableTx.getSubmissionPrice). ArbRetryableTicket precompile interface exists at L2 address\r\n // 0x000000000000000000000000000000000000006E.\r\n uint256 public l2MaxSubmissionCost = 0.1e18;\r\n\r\n // L2 Gas price bid for immediate L2 execution attempt (queryable via standard eth*gasPrice RPC)\r\n uint256 public l2GasPrice = 10e9; // 10 gWei\r\n\r\n // This address on L2 receives extra ETH that is left over after relaying a message via the inbox.\r\n address public l2RefundL2Address;\r\n\r\n ArbitrumL1InboxLike public l1Inbox;\r\n\r\n ArbitrumL1ERC20GatewayLike public l1ERC20Gateway;\r\n\r\n event L2GasLimitSet(uint32 newL2GasLimit);\r\n\r\n event L2MaxSubmissionCostSet(uint256 newL2MaxSubmissionCost);\r\n\r\n event L2GasPriceSet(uint256 newL2GasPrice);\r\n\r\n event L2RefundL2AddressSet(address newL2RefundL2Address);\r\n\r\n constructor(\r\n address _hubPool,\r\n ArbitrumL1InboxLike _l1ArbitrumInbox,\r\n ArbitrumL1ERC20GatewayLike _l1ERC20Gateway\r\n ) Base_Adapter(_hubPool) {\r\n l1Inbox = _l1ArbitrumInbox;\r\n l1ERC20Gateway = _l1ERC20Gateway;\r\n\r\n l2RefundL2Address = owner();\r\n }\r\n\r\n function setL2GasLimit(uint32 _l2GasLimit) public onlyOwner {\r\n l2GasLimit = _l2GasLimit;\r\n emit L2GasLimitSet(l2GasLimit);\r\n }\r\n\r\n function setL2MaxSubmissionCost(uint256 _l2MaxSubmissionCost) public onlyOwner {\r\n l2MaxSubmissionCost = _l2MaxSubmissionCost;\r\n emit L2MaxSubmissionCostSet(l2MaxSubmissionCost);\r\n }\r\n\r\n function setL2GasPrice(uint256 _l2GasPrice) public onlyOwner {\r\n l2GasPrice = _l2GasPrice;\r\n emit L2GasPriceSet(l2GasPrice);\r\n }\r\n\r\n function setL2RefundL2Address(address _l2RefundL2Address) public onlyOwner {\r\n l2RefundL2Address = _l2RefundL2Address;\r\n emit L2RefundL2AddressSet(l2RefundL2Address);\r\n }\r\n\r\n function relayMessage(address target, bytes memory message) external payable override nonReentrant onlyHubPool {\r\n uint256 requiredL1CallValue = getL1CallValue();\r\n require(address(this).balance >= requiredL1CallValue, \"Insufficient ETH balance\");\r\n\r\n l1Inbox.createRetryableTicket{ value: requiredL1CallValue }(\r\n target, // destAddr destination L2 contract address\r\n 0, // l2CallValue call value for retryable L2 message\r\n l2MaxSubmissionCost, // maxSubmissionCost Max gas deducted from user's L2 balance to cover base submission fee\r\n l2RefundL2Address, // excessFeeRefundAddress maxgas x gasprice - execution cost gets credited here on L2 balance\r\n l2RefundL2Address, // callValueRefundAddress l2Callvalue gets credited here on L2 if retryable txn times out or gets cancelled\r\n l2GasLimit, // maxGas Max gas deducted from user's L2 balance to cover L2 execution\r\n l2GasPrice, // gasPriceBid price bid for L2 execution\r\n message // data ABI encoded data of L2 message\r\n );\r\n\r\n emit MessageRelayed(target, message);\r\n }\r\n\r\n function relayTokens(\r\n address l1Token,\r\n address l2Token, // l2Token is unused for Arbitrum.\r\n uint256 amount,\r\n address to\r\n ) external payable override nonReentrant onlyHubPool {\r\n l1ERC20Gateway.outboundTransfer(l1Token, to, amount, l2GasLimit, l2GasPrice, \"\");\r\n emit TokensRelayed(l1Token, l2Token, amount, to);\r\n }\r\n\r\n function getL1CallValue() public view returns (uint256) {\r\n return l2MaxSubmissionCost + l2GasPrice * l2GasLimit;\r\n }\r\n\r\n receive() external payable {}\r\n}\r\n" - }, - "contracts/Ethereum_SpokePool.sol": { - "content": "//SPDX-License-Identifier: Unlicense\r\npragma solidity ^0.8.0;\r\n\r\nimport \"./interfaces/WETH9.sol\";\r\n\r\nimport \"@openzeppelin/contracts/access/Ownable.sol\";\r\nimport \"@openzeppelin/contracts/token/ERC20/IERC20.sol\";\r\n\r\nimport \"./SpokePool.sol\";\r\nimport \"./SpokePoolInterface.sol\";\r\n\r\n/**\r\n * @notice Ethereum L1 specific SpokePool.\r\n * @dev Used on Ethereum L1 to facilitate L2->L1 transfers.\r\n */\r\n\r\ncontract Ethereum_SpokePool is SpokePoolInterface, SpokePool, Ownable {\r\n constructor(\r\n address _hubPool,\r\n address _wethAddress,\r\n address timerAddress\r\n ) SpokePool(msg.sender, _hubPool, _wethAddress, timerAddress) {}\r\n\r\n /**************************************\r\n * ADMIN FUNCTIONS *\r\n **************************************/\r\n\r\n function setCrossDomainAdmin(address newCrossDomainAdmin) public override onlyOwner nonReentrant {\r\n _setCrossDomainAdmin(newCrossDomainAdmin);\r\n }\r\n\r\n function setHubPool(address newHubPool) public override onlyOwner nonReentrant {\r\n _setHubPool(newHubPool);\r\n }\r\n\r\n function setEnableRoute(\r\n address originToken,\r\n uint256 destinationChainId,\r\n bool enable\r\n ) public override onlyOwner nonReentrant {\r\n _setEnableRoute(originToken, destinationChainId, enable);\r\n }\r\n\r\n function setDepositQuoteTimeBuffer(uint32 buffer) public override onlyOwner nonReentrant {\r\n _setDepositQuoteTimeBuffer(buffer);\r\n }\r\n\r\n function relayRootBundle(bytes32 relayerRefundRoot, bytes32 slowRelayRoot) public override onlyOwner nonReentrant {\r\n _relayRootBundle(relayerRefundRoot, slowRelayRoot);\r\n }\r\n\r\n function _bridgeTokensToHubPool(RelayerRefundLeaf memory relayerRefundLeaf) internal override {\r\n IERC20(relayerRefundLeaf.l2TokenAddress).transfer(hubPool, relayerRefundLeaf.amountToReturn);\r\n }\r\n}" - }, - "contracts/chain-adapters/Mock_Adapter.sol": { - "content": "// SPDX-License-Identifier: AGPL-3.0-only\npragma solidity ^0.8.0;\n\nimport \"./Base_Adapter.sol\";\nimport \"@openzeppelin/contracts/token/ERC20/IERC20.sol\";\n\n/**\n * @notice Sends cross chain messages Optimism L2 network.\n * @dev This contract's owner should be set to the BridgeAdmin deployed on the same L1 network so that only the\n * BridgeAdmin can call cross-chain administrative functions on the L2 SpokePool via this messenger.\n */\ncontract Mock_Adapter is Base_Adapter {\n event RelayMessageCalled(address target, bytes message, address caller);\n\n event RelayTokensCalled(address l1Token, address l2Token, uint256 amount, address to, address caller);\n\n function relayMessage(address target, bytes memory message) external payable override onlyHubPool {\n emit RelayMessageCalled(target, message, msg.sender);\n }\n\n constructor(address _hubPool) Base_Adapter(_hubPool) {}\n\n function relayTokens(\n address l1Token,\n address l2Token,\n uint256 amount,\n address to\n ) external payable override onlyHubPool {\n emit RelayTokensCalled(l1Token, l2Token, amount, to, msg.sender);\n }\n}\n" - }, - "contracts/test/MerkleLibTest.sol": { - "content": "// SPDX-License-Identifier: GPL-3.0-only\r\npragma solidity ^0.8.0;\r\n\r\nimport \"../MerkleLib.sol\";\r\nimport \"../HubPoolInterface.sol\";\r\nimport \"../SpokePoolInterface.sol\";\r\n\r\n/**\r\n * @notice Contract to test the MerkleLib.\r\n */\r\ncontract MerkleLibTest {\r\n mapping(uint256 => uint256) public claimedBitMap;\r\n\r\n uint256 public claimedBitMap1D;\r\n\r\n function verifyPoolRebalance(\r\n bytes32 root,\r\n HubPoolInterface.PoolRebalanceLeaf memory rebalance,\r\n bytes32[] memory proof\r\n ) public pure returns (bool) {\r\n return MerkleLib.verifyPoolRebalance(root, rebalance, proof);\r\n }\r\n\r\n function verifyRelayerRefund(\r\n bytes32 root,\r\n SpokePoolInterface.RelayerRefundLeaf memory refund,\r\n bytes32[] memory proof\r\n ) public pure returns (bool) {\r\n return MerkleLib.verifyRelayerRefund(root, refund, proof);\r\n }\r\n\r\n function verifySlowRelayFulfillment(\r\n bytes32 root,\r\n SpokePoolInterface.RelayData memory slowRelayFulfillment,\r\n bytes32[] memory proof\r\n ) public pure returns (bool) {\r\n return MerkleLib.verifySlowRelayFulfillment(root, slowRelayFulfillment, proof);\r\n }\r\n\r\n function isClaimed(uint256 index) public view returns (bool) {\r\n return MerkleLib.isClaimed(claimedBitMap, index);\r\n }\r\n\r\n function setClaimed(uint256 index) public {\r\n MerkleLib.setClaimed(claimedBitMap, index);\r\n }\r\n\r\n function isClaimed1D(uint256 index) public view returns (bool) {\r\n return MerkleLib.isClaimed1D(claimedBitMap1D, index);\r\n }\r\n\r\n function setClaimed1D(uint256 index) public {\r\n claimedBitMap1D = MerkleLib.setClaimed1D(claimedBitMap1D, index);\r\n }\r\n}\r\n" - }, - "@uma/core/contracts/common/interfaces/ExpandedIERC20.sol": { - "content": "// SPDX-License-Identifier: AGPL-3.0-only\npragma solidity ^0.8.0;\n\nimport \"@openzeppelin/contracts/token/ERC20/IERC20.sol\";\n\n/**\n * @title ERC20 interface that includes burn and mint methods.\n */\nabstract contract ExpandedIERC20 is IERC20 {\n /**\n * @notice Burns a specific amount of the caller's tokens.\n * @dev Only burns the caller's tokens, so it is safe to leave this method permissionless.\n */\n function burn(uint256 value) external virtual;\n\n /**\n * @dev Burns `value` tokens owned by `recipient`.\n * @param recipient address to burn tokens from.\n * @param value amount of tokens to burn.\n */\n function burnFrom(address recipient, uint256 value) external virtual returns (bool);\n\n /**\n * @notice Mints tokens and adds them to the balance of the `to` address.\n * @dev This method should be permissioned to only allow designated parties to mint tokens.\n */\n function mint(address to, uint256 value) external virtual returns (bool);\n\n function addMinter(address account) external virtual;\n\n function addBurner(address account) external virtual;\n\n function resetOwner(address account) external virtual;\n}\n" - }, - "@uma/core/contracts/common/implementation/ExpandedERC20.sol": { - "content": "// SPDX-License-Identifier: AGPL-3.0-only\npragma solidity ^0.8.0;\n\nimport \"@openzeppelin/contracts/token/ERC20/ERC20.sol\";\nimport \"./MultiRole.sol\";\nimport \"../interfaces/ExpandedIERC20.sol\";\n\n/**\n * @title An ERC20 with permissioned burning and minting. The contract deployer will initially\n * be the owner who is capable of adding new roles.\n */\ncontract ExpandedERC20 is ExpandedIERC20, ERC20, MultiRole {\n enum Roles {\n // Can set the minter and burner.\n Owner,\n // Addresses that can mint new tokens.\n Minter,\n // Addresses that can burn tokens that address owns.\n Burner\n }\n\n uint8 _decimals;\n\n /**\n * @notice Constructs the ExpandedERC20.\n * @param _tokenName The name which describes the new token.\n * @param _tokenSymbol The ticker abbreviation of the name. Ideally < 5 chars.\n * @param _tokenDecimals The number of decimals to define token precision.\n */\n constructor(\n string memory _tokenName,\n string memory _tokenSymbol,\n uint8 _tokenDecimals\n ) ERC20(_tokenName, _tokenSymbol) {\n _decimals = _tokenDecimals;\n _createExclusiveRole(uint256(Roles.Owner), uint256(Roles.Owner), msg.sender);\n _createSharedRole(uint256(Roles.Minter), uint256(Roles.Owner), new address[](0));\n _createSharedRole(uint256(Roles.Burner), uint256(Roles.Owner), new address[](0));\n }\n\n function decimals() public view virtual override(ERC20) returns (uint8) {\n return _decimals;\n }\n\n /**\n * @dev Mints `value` tokens to `recipient`, returning true on success.\n * @param recipient address to mint to.\n * @param value amount of tokens to mint.\n * @return True if the mint succeeded, or False.\n */\n function mint(address recipient, uint256 value)\n external\n override\n onlyRoleHolder(uint256(Roles.Minter))\n returns (bool)\n {\n _mint(recipient, value);\n return true;\n }\n\n /**\n * @dev Burns `value` tokens owned by `msg.sender`.\n * @param value amount of tokens to burn.\n */\n function burn(uint256 value) external override onlyRoleHolder(uint256(Roles.Burner)) {\n _burn(msg.sender, value);\n }\n\n /**\n * @dev Burns `value` tokens owned by `recipient`.\n * @param recipient address to burn tokens from.\n * @param value amount of tokens to burn.\n * @return True if the burn succeeded, or False.\n */\n function burnFrom(address recipient, uint256 value)\n external\n override\n onlyRoleHolder(uint256(Roles.Burner))\n returns (bool)\n {\n _burn(recipient, value);\n return true;\n }\n\n /**\n * @notice Add Minter role to account.\n * @dev The caller must have the Owner role.\n * @param account The address to which the Minter role is added.\n */\n function addMinter(address account) external virtual override {\n addMember(uint256(Roles.Minter), account);\n }\n\n /**\n * @notice Add Burner role to account.\n * @dev The caller must have the Owner role.\n * @param account The address to which the Burner role is added.\n */\n function addBurner(address account) external virtual override {\n addMember(uint256(Roles.Burner), account);\n }\n\n /**\n * @notice Reset Owner role to account.\n * @dev The caller must have the Owner role.\n * @param account The new holder of the Owner role.\n */\n function resetOwner(address account) external virtual override {\n resetMember(uint256(Roles.Owner), account);\n }\n}\n" - }, - "@uma/core/contracts/common/implementation/MultiRole.sol": { - "content": "// SPDX-License-Identifier: AGPL-3.0-only\npragma solidity ^0.8.0;\n\nlibrary Exclusive {\n struct RoleMembership {\n address member;\n }\n\n function isMember(RoleMembership storage roleMembership, address memberToCheck) internal view returns (bool) {\n return roleMembership.member == memberToCheck;\n }\n\n function resetMember(RoleMembership storage roleMembership, address newMember) internal {\n require(newMember != address(0x0), \"Cannot set an exclusive role to 0x0\");\n roleMembership.member = newMember;\n }\n\n function getMember(RoleMembership storage roleMembership) internal view returns (address) {\n return roleMembership.member;\n }\n\n function init(RoleMembership storage roleMembership, address initialMember) internal {\n resetMember(roleMembership, initialMember);\n }\n}\n\nlibrary Shared {\n struct RoleMembership {\n mapping(address => bool) members;\n }\n\n function isMember(RoleMembership storage roleMembership, address memberToCheck) internal view returns (bool) {\n return roleMembership.members[memberToCheck];\n }\n\n function addMember(RoleMembership storage roleMembership, address memberToAdd) internal {\n require(memberToAdd != address(0x0), \"Cannot add 0x0 to a shared role\");\n roleMembership.members[memberToAdd] = true;\n }\n\n function removeMember(RoleMembership storage roleMembership, address memberToRemove) internal {\n roleMembership.members[memberToRemove] = false;\n }\n\n function init(RoleMembership storage roleMembership, address[] memory initialMembers) internal {\n for (uint256 i = 0; i < initialMembers.length; i++) {\n addMember(roleMembership, initialMembers[i]);\n }\n }\n}\n\n/**\n * @title Base class to manage permissions for the derived class.\n */\nabstract contract MultiRole {\n using Exclusive for Exclusive.RoleMembership;\n using Shared for Shared.RoleMembership;\n\n enum RoleType { Invalid, Exclusive, Shared }\n\n struct Role {\n uint256 managingRole;\n RoleType roleType;\n Exclusive.RoleMembership exclusiveRoleMembership;\n Shared.RoleMembership sharedRoleMembership;\n }\n\n mapping(uint256 => Role) private roles;\n\n event ResetExclusiveMember(uint256 indexed roleId, address indexed newMember, address indexed manager);\n event AddedSharedMember(uint256 indexed roleId, address indexed newMember, address indexed manager);\n event RemovedSharedMember(uint256 indexed roleId, address indexed oldMember, address indexed manager);\n\n /**\n * @notice Reverts unless the caller is a member of the specified roleId.\n */\n modifier onlyRoleHolder(uint256 roleId) {\n require(holdsRole(roleId, msg.sender), \"Sender does not hold required role\");\n _;\n }\n\n /**\n * @notice Reverts unless the caller is a member of the manager role for the specified roleId.\n */\n modifier onlyRoleManager(uint256 roleId) {\n require(holdsRole(roles[roleId].managingRole, msg.sender), \"Can only be called by a role manager\");\n _;\n }\n\n /**\n * @notice Reverts unless the roleId represents an initialized, exclusive roleId.\n */\n modifier onlyExclusive(uint256 roleId) {\n require(roles[roleId].roleType == RoleType.Exclusive, \"Must be called on an initialized Exclusive role\");\n _;\n }\n\n /**\n * @notice Reverts unless the roleId represents an initialized, shared roleId.\n */\n modifier onlyShared(uint256 roleId) {\n require(roles[roleId].roleType == RoleType.Shared, \"Must be called on an initialized Shared role\");\n _;\n }\n\n /**\n * @notice Whether `memberToCheck` is a member of roleId.\n * @dev Reverts if roleId does not correspond to an initialized role.\n * @param roleId the Role to check.\n * @param memberToCheck the address to check.\n * @return True if `memberToCheck` is a member of `roleId`.\n */\n function holdsRole(uint256 roleId, address memberToCheck) public view returns (bool) {\n Role storage role = roles[roleId];\n if (role.roleType == RoleType.Exclusive) {\n return role.exclusiveRoleMembership.isMember(memberToCheck);\n } else if (role.roleType == RoleType.Shared) {\n return role.sharedRoleMembership.isMember(memberToCheck);\n }\n revert(\"Invalid roleId\");\n }\n\n /**\n * @notice Changes the exclusive role holder of `roleId` to `newMember`.\n * @dev Reverts if the caller is not a member of the managing role for `roleId` or if `roleId` is not an\n * initialized, ExclusiveRole.\n * @param roleId the ExclusiveRole membership to modify.\n * @param newMember the new ExclusiveRole member.\n */\n function resetMember(uint256 roleId, address newMember) public onlyExclusive(roleId) onlyRoleManager(roleId) {\n roles[roleId].exclusiveRoleMembership.resetMember(newMember);\n emit ResetExclusiveMember(roleId, newMember, msg.sender);\n }\n\n /**\n * @notice Gets the current holder of the exclusive role, `roleId`.\n * @dev Reverts if `roleId` does not represent an initialized, exclusive role.\n * @param roleId the ExclusiveRole membership to check.\n * @return the address of the current ExclusiveRole member.\n */\n function getMember(uint256 roleId) public view onlyExclusive(roleId) returns (address) {\n return roles[roleId].exclusiveRoleMembership.getMember();\n }\n\n /**\n * @notice Adds `newMember` to the shared role, `roleId`.\n * @dev Reverts if `roleId` does not represent an initialized, SharedRole or if the caller is not a member of the\n * managing role for `roleId`.\n * @param roleId the SharedRole membership to modify.\n * @param newMember the new SharedRole member.\n */\n function addMember(uint256 roleId, address newMember) public onlyShared(roleId) onlyRoleManager(roleId) {\n roles[roleId].sharedRoleMembership.addMember(newMember);\n emit AddedSharedMember(roleId, newMember, msg.sender);\n }\n\n /**\n * @notice Removes `memberToRemove` from the shared role, `roleId`.\n * @dev Reverts if `roleId` does not represent an initialized, SharedRole or if the caller is not a member of the\n * managing role for `roleId`.\n * @param roleId the SharedRole membership to modify.\n * @param memberToRemove the current SharedRole member to remove.\n */\n function removeMember(uint256 roleId, address memberToRemove) public onlyShared(roleId) onlyRoleManager(roleId) {\n roles[roleId].sharedRoleMembership.removeMember(memberToRemove);\n emit RemovedSharedMember(roleId, memberToRemove, msg.sender);\n }\n\n /**\n * @notice Removes caller from the role, `roleId`.\n * @dev Reverts if the caller is not a member of the role for `roleId` or if `roleId` is not an\n * initialized, SharedRole.\n * @param roleId the SharedRole membership to modify.\n */\n function renounceMembership(uint256 roleId) public onlyShared(roleId) onlyRoleHolder(roleId) {\n roles[roleId].sharedRoleMembership.removeMember(msg.sender);\n emit RemovedSharedMember(roleId, msg.sender, msg.sender);\n }\n\n /**\n * @notice Reverts if `roleId` is not initialized.\n */\n modifier onlyValidRole(uint256 roleId) {\n require(roles[roleId].roleType != RoleType.Invalid, \"Attempted to use an invalid roleId\");\n _;\n }\n\n /**\n * @notice Reverts if `roleId` is initialized.\n */\n modifier onlyInvalidRole(uint256 roleId) {\n require(roles[roleId].roleType == RoleType.Invalid, \"Cannot use a pre-existing role\");\n _;\n }\n\n /**\n * @notice Internal method to initialize a shared role, `roleId`, which will be managed by `managingRoleId`.\n * `initialMembers` will be immediately added to the role.\n * @dev Should be called by derived contracts, usually at construction time. Will revert if the role is already\n * initialized.\n */\n function _createSharedRole(\n uint256 roleId,\n uint256 managingRoleId,\n address[] memory initialMembers\n ) internal onlyInvalidRole(roleId) {\n Role storage role = roles[roleId];\n role.roleType = RoleType.Shared;\n role.managingRole = managingRoleId;\n role.sharedRoleMembership.init(initialMembers);\n require(\n roles[managingRoleId].roleType != RoleType.Invalid,\n \"Attempted to use an invalid role to manage a shared role\"\n );\n }\n\n /**\n * @notice Internal method to initialize an exclusive role, `roleId`, which will be managed by `managingRoleId`.\n * `initialMember` will be immediately added to the role.\n * @dev Should be called by derived contracts, usually at construction time. Will revert if the role is already\n * initialized.\n */\n function _createExclusiveRole(\n uint256 roleId,\n uint256 managingRoleId,\n address initialMember\n ) internal onlyInvalidRole(roleId) {\n Role storage role = roles[roleId];\n role.roleType = RoleType.Exclusive;\n role.managingRole = managingRoleId;\n role.exclusiveRoleMembership.init(initialMember);\n require(\n roles[managingRoleId].roleType != RoleType.Invalid,\n \"Attempted to use an invalid role to manage an exclusive role\"\n );\n }\n}\n" - }, - "contracts/LpTokenFactory.sol": { - "content": "// SPDX-License-Identifier: GPL-3.0-only\npragma solidity ^0.8.0;\n\nimport \"./interfaces/LpTokenFactoryInterface.sol\";\n\nimport \"@uma/core/contracts/common/implementation/ExpandedERC20.sol\";\n\ncontract LpTokenFactory is LpTokenFactoryInterface {\n function createLpToken(address l1Token) public returns (address) {\n ExpandedERC20 lpToken = new ExpandedERC20(\n _append(\"Across \", IERC20Metadata(l1Token).name(), \" LP Token\"), // LP Token Name\n _append(\"Av2-\", IERC20Metadata(l1Token).symbol(), \"-LP\"), // LP Token Symbol\n IERC20Metadata(l1Token).decimals() // LP Token Decimals\n );\n lpToken.addMember(1, msg.sender); // Set this contract as the LP Token's minter.\n lpToken.addMember(2, msg.sender); // Set this contract as the LP Token's burner.\n\n return address(lpToken);\n }\n\n function _append(\n string memory a,\n string memory b,\n string memory c\n ) internal pure returns (string memory) {\n return string(abi.encodePacked(a, b, c));\n }\n}\n" - }, - "contracts/interfaces/LpTokenFactoryInterface.sol": { - "content": "// SPDX-License-Identifier: AGPL-3.0-only\npragma solidity ^0.8.0;\n\nimport \"@openzeppelin/contracts/token/ERC20/IERC20.sol\";\n\ninterface LpTokenFactoryInterface {\n function createLpToken(address l1Token) external returns (address);\n}\n" - }, - "@uma/core/contracts/oracle/interfaces/SkinnyOptimisticOracleInterface.sol": { - "content": "// SPDX-License-Identifier: AGPL-3.0-only\npragma solidity ^0.8.0;\n\nimport \"@openzeppelin/contracts/token/ERC20/IERC20.sol\";\nimport \"../interfaces/OptimisticOracleInterface.sol\";\n\n/**\n * @title Interface for the gas-cost-reduced version of the OptimisticOracle.\n * @notice Differences from normal OptimisticOracle:\n * - refundOnDispute: flag is removed, by default there are no refunds on disputes.\n * - customizing request parameters: In the OptimisticOracle, parameters like `bond` and `customLiveness` can be reset\n * after a request is already made via `requestPrice`. In the SkinnyOptimisticOracle, these parameters can only be\n * set in `requestPrice`, which has an expanded input set.\n * - settleAndGetPrice: Replaced by `settle`, which can only be called once per settleable request. The resolved price\n * can be fetched via the `Settle` event or the return value of `settle`.\n * - general changes to interface: Functions that interact with existing requests all require the parameters of the\n * request to modify to be passed as input. These parameters must match with the existing request parameters or the\n * function will revert. This change reflects the internal refactor to store hashed request parameters instead of the\n * full request struct.\n * @dev Interface used by financial contracts to interact with the Oracle. Voters will use a different interface.\n */\nabstract contract SkinnyOptimisticOracleInterface {\n // Struct representing a price request. Note that this differs from the OptimisticOracleInterface's Request struct\n // in that refundOnDispute is removed.\n struct Request {\n address proposer; // Address of the proposer.\n address disputer; // Address of the disputer.\n IERC20 currency; // ERC20 token used to pay rewards and fees.\n bool settled; // True if the request is settled.\n int256 proposedPrice; // Price that the proposer submitted.\n int256 resolvedPrice; // Price resolved once the request is settled.\n uint256 expirationTime; // Time at which the request auto-settles without a dispute.\n uint256 reward; // Amount of the currency to pay to the proposer on settlement.\n uint256 finalFee; // Final fee to pay to the Store upon request to the DVM.\n uint256 bond; // Bond that the proposer and disputer must pay on top of the final fee.\n uint256 customLiveness; // Custom liveness value set by the requester.\n }\n\n // This value must be <= the Voting contract's `ancillaryBytesLimit` value otherwise it is possible\n // that a price can be requested to this contract successfully, but cannot be disputed because the DVM refuses\n // to accept a price request made with ancillary data length over a certain size.\n uint256 public constant ancillaryBytesLimit = 8192;\n\n /**\n * @notice Requests a new price.\n * @param identifier price identifier being requested.\n * @param timestamp timestamp of the price being requested.\n * @param ancillaryData ancillary data representing additional args being passed with the price request.\n * @param currency ERC20 token used for payment of rewards and fees. Must be approved for use with the DVM.\n * @param reward reward offered to a successful proposer. Will be pulled from the caller. Note: this can be 0,\n * which could make sense if the contract requests and proposes the value in the same call or\n * provides its own reward system.\n * @param bond custom proposal bond to set for request. If set to 0, defaults to the final fee.\n * @param customLiveness custom proposal liveness to set for request.\n * @return totalBond default bond + final fee that the proposer and disputer will be required to pay.\n */\n function requestPrice(\n bytes32 identifier,\n uint32 timestamp,\n bytes memory ancillaryData,\n IERC20 currency,\n uint256 reward,\n uint256 bond,\n uint256 customLiveness\n ) external virtual returns (uint256 totalBond);\n\n /**\n * @notice Proposes a price value on another address' behalf. Note: this address will receive any rewards that come\n * from this proposal. However, any bonds are pulled from the caller.\n * @param requester sender of the initial price request.\n * @param identifier price identifier to identify the existing request.\n * @param timestamp timestamp to identify the existing request.\n * @param ancillaryData ancillary data of the price being requested.\n * @param request price request parameters whose hash must match the request that the caller wants to\n * propose a price for.\n * @param proposer address to set as the proposer.\n * @param proposedPrice price being proposed.\n * @return totalBond the amount that's pulled from the caller's wallet as a bond. The bond will be returned to\n * the proposer once settled if the proposal is correct.\n */\n function proposePriceFor(\n address requester,\n bytes32 identifier,\n uint32 timestamp,\n bytes memory ancillaryData,\n Request memory request,\n address proposer,\n int256 proposedPrice\n ) public virtual returns (uint256 totalBond);\n\n /**\n * @notice Proposes a price value where caller is the proposer.\n * @param requester sender of the initial price request.\n * @param identifier price identifier to identify the existing request.\n * @param timestamp timestamp to identify the existing request.\n * @param ancillaryData ancillary data of the price being requested.\n * @param request price request parameters whose hash must match the request that the caller wants to\n * propose a price for.\n * @param proposedPrice price being proposed.\n * @return totalBond the amount that's pulled from the caller's wallet as a bond. The bond will be returned to\n * the proposer once settled if the proposal is correct.\n */\n function proposePrice(\n address requester,\n bytes32 identifier,\n uint32 timestamp,\n bytes memory ancillaryData,\n Request memory request,\n int256 proposedPrice\n ) external virtual returns (uint256 totalBond);\n\n /**\n * @notice Combines logic of requestPrice and proposePrice while taking advantage of gas savings from not having to\n * overwrite Request params that a normal requestPrice() => proposePrice() flow would entail. Note: The proposer\n * will receive any rewards that come from this proposal. However, any bonds are pulled from the caller.\n * @dev The caller is the requester, but the proposer can be customized.\n * @param identifier price identifier to identify the existing request.\n * @param timestamp timestamp to identify the existing request.\n * @param ancillaryData ancillary data of the price being requested.\n * @param currency ERC20 token used for payment of rewards and fees. Must be approved for use with the DVM.\n * @param reward reward offered to a successful proposer. Will be pulled from the caller. Note: this can be 0,\n * which could make sense if the contract requests and proposes the value in the same call or\n * provides its own reward system.\n * @param bond custom proposal bond to set for request. If set to 0, defaults to the final fee.\n * @param customLiveness custom proposal liveness to set for request.\n * @param proposer address to set as the proposer.\n * @param proposedPrice price being proposed.\n * @return totalBond the amount that's pulled from the caller's wallet as a bond. The bond will be returned to\n * the proposer once settled if the proposal is correct.\n */\n function requestAndProposePriceFor(\n bytes32 identifier,\n uint32 timestamp,\n bytes memory ancillaryData,\n IERC20 currency,\n uint256 reward,\n uint256 bond,\n uint256 customLiveness,\n address proposer,\n int256 proposedPrice\n ) external virtual returns (uint256 totalBond);\n\n /**\n * @notice Disputes a price request with an active proposal on another address' behalf. Note: this address will\n * receive any rewards that come from this dispute. However, any bonds are pulled from the caller.\n * @param identifier price identifier to identify the existing request.\n * @param timestamp timestamp to identify the existing request.\n * @param ancillaryData ancillary data of the price being requested.\n * @param request price request parameters whose hash must match the request that the caller wants to\n * dispute.\n * @param disputer address to set as the disputer.\n * @param requester sender of the initial price request.\n * @return totalBond the amount that's pulled from the caller's wallet as a bond. The bond will be returned to\n * the disputer once settled if the dispute was valid (the proposal was incorrect).\n */\n function disputePriceFor(\n bytes32 identifier,\n uint32 timestamp,\n bytes memory ancillaryData,\n Request memory request,\n address disputer,\n address requester\n ) public virtual returns (uint256 totalBond);\n\n /**\n * @notice Disputes a price request with an active proposal where caller is the disputer.\n * @param requester sender of the initial price request.\n * @param identifier price identifier to identify the existing request.\n * @param timestamp timestamp to identify the existing request.\n * @param ancillaryData ancillary data of the price being requested.\n * @param request price request parameters whose hash must match the request that the caller wants to\n * dispute.\n * @return totalBond the amount that's pulled from the caller's wallet as a bond. The bond will be returned to\n * the disputer once settled if the dispute was valid (the proposal was incorrect).\n */\n function disputePrice(\n address requester,\n bytes32 identifier,\n uint32 timestamp,\n bytes memory ancillaryData,\n Request memory request\n ) external virtual returns (uint256 totalBond);\n\n /**\n * @notice Attempts to settle an outstanding price request. Will revert if it isn't settleable.\n * @param requester sender of the initial price request.\n * @param identifier price identifier to identify the existing request.\n * @param timestamp timestamp to identify the existing request.\n * @param ancillaryData ancillary data of the price being requested.\n * @param request price request parameters whose hash must match the request that the caller wants to\n * settle.\n * @return payout the amount that the \"winner\" (proposer or disputer) receives on settlement. This amount includes\n * the returned bonds as well as additional rewards.\n * @return resolvedPrice the price that the request settled to.\n */\n function settle(\n address requester,\n bytes32 identifier,\n uint32 timestamp,\n bytes memory ancillaryData,\n Request memory request\n ) external virtual returns (uint256 payout, int256 resolvedPrice);\n\n /**\n * @notice Computes the current state of a price request. See the State enum for more details.\n * @param requester sender of the initial price request.\n * @param identifier price identifier to identify the existing request.\n * @param timestamp timestamp to identify the existing request.\n * @param ancillaryData ancillary data of the price being requested.\n * @param request price request parameters.\n * @return the State.\n */\n function getState(\n address requester,\n bytes32 identifier,\n uint32 timestamp,\n bytes memory ancillaryData,\n Request memory request\n ) external virtual returns (OptimisticOracleInterface.State);\n\n /**\n * @notice Checks if a given request has resolved, expired or been settled (i.e the optimistic oracle has a price).\n * @param requester sender of the initial price request.\n * @param identifier price identifier to identify the existing request.\n * @param timestamp timestamp to identify the existing request.\n * @param ancillaryData ancillary data of the price being requested.\n * @param request price request parameters. The hash of these parameters must match with the request hash that is\n * associated with the price request unique ID {requester, identifier, timestamp, ancillaryData}, or this method\n * will revert.\n * @return boolean indicating true if price exists and false if not.\n */\n function hasPrice(\n address requester,\n bytes32 identifier,\n uint32 timestamp,\n bytes memory ancillaryData,\n Request memory request\n ) public virtual returns (bool);\n\n /**\n * @notice Generates stamped ancillary data in the format that it would be used in the case of a price dispute.\n * @param ancillaryData ancillary data of the price being requested.\n * @param requester sender of the initial price request.\n * @return the stamped ancillary bytes.\n */\n function stampAncillaryData(bytes memory ancillaryData, address requester)\n public\n pure\n virtual\n returns (bytes memory);\n}\n" - }, - "@uma/core/contracts/oracle/interfaces/OptimisticOracleInterface.sol": { - "content": "// SPDX-License-Identifier: AGPL-3.0-only\npragma solidity ^0.8.0;\n\nimport \"@openzeppelin/contracts/token/ERC20/IERC20.sol\";\n\n/**\n * @title Financial contract facing Oracle interface.\n * @dev Interface used by financial contracts to interact with the Oracle. Voters will use a different interface.\n */\nabstract contract OptimisticOracleInterface {\n // Struct representing the state of a price request.\n enum State {\n Invalid, // Never requested.\n Requested, // Requested, no other actions taken.\n Proposed, // Proposed, but not expired or disputed yet.\n Expired, // Proposed, not disputed, past liveness.\n Disputed, // Disputed, but no DVM price returned yet.\n Resolved, // Disputed and DVM price is available.\n Settled // Final price has been set in the contract (can get here from Expired or Resolved).\n }\n\n // Struct representing a price request.\n struct Request {\n address proposer; // Address of the proposer.\n address disputer; // Address of the disputer.\n IERC20 currency; // ERC20 token used to pay rewards and fees.\n bool settled; // True if the request is settled.\n bool refundOnDispute; // True if the requester should be refunded their reward on dispute.\n int256 proposedPrice; // Price that the proposer submitted.\n int256 resolvedPrice; // Price resolved once the request is settled.\n uint256 expirationTime; // Time at which the request auto-settles without a dispute.\n uint256 reward; // Amount of the currency to pay to the proposer on settlement.\n uint256 finalFee; // Final fee to pay to the Store upon request to the DVM.\n uint256 bond; // Bond that the proposer and disputer must pay on top of the final fee.\n uint256 customLiveness; // Custom liveness value set by the requester.\n }\n\n // This value must be <= the Voting contract's `ancillaryBytesLimit` value otherwise it is possible\n // that a price can be requested to this contract successfully, but cannot be disputed because the DVM refuses\n // to accept a price request made with ancillary data length over a certain size.\n uint256 public constant ancillaryBytesLimit = 8192;\n\n /**\n * @notice Requests a new price.\n * @param identifier price identifier being requested.\n * @param timestamp timestamp of the price being requested.\n * @param ancillaryData ancillary data representing additional args being passed with the price request.\n * @param currency ERC20 token used for payment of rewards and fees. Must be approved for use with the DVM.\n * @param reward reward offered to a successful proposer. Will be pulled from the caller. Note: this can be 0,\n * which could make sense if the contract requests and proposes the value in the same call or\n * provides its own reward system.\n * @return totalBond default bond (final fee) + final fee that the proposer and disputer will be required to pay.\n * This can be changed with a subsequent call to setBond().\n */\n function requestPrice(\n bytes32 identifier,\n uint256 timestamp,\n bytes memory ancillaryData,\n IERC20 currency,\n uint256 reward\n ) external virtual returns (uint256 totalBond);\n\n /**\n * @notice Set the proposal bond associated with a price request.\n * @param identifier price identifier to identify the existing request.\n * @param timestamp timestamp to identify the existing request.\n * @param ancillaryData ancillary data of the price being requested.\n * @param bond custom bond amount to set.\n * @return totalBond new bond + final fee that the proposer and disputer will be required to pay. This can be\n * changed again with a subsequent call to setBond().\n */\n function setBond(\n bytes32 identifier,\n uint256 timestamp,\n bytes memory ancillaryData,\n uint256 bond\n ) external virtual returns (uint256 totalBond);\n\n /**\n * @notice Sets the request to refund the reward if the proposal is disputed. This can help to \"hedge\" the caller\n * in the event of a dispute-caused delay. Note: in the event of a dispute, the winner still receives the other's\n * bond, so there is still profit to be made even if the reward is refunded.\n * @param identifier price identifier to identify the existing request.\n * @param timestamp timestamp to identify the existing request.\n * @param ancillaryData ancillary data of the price being requested.\n */\n function setRefundOnDispute(\n bytes32 identifier,\n uint256 timestamp,\n bytes memory ancillaryData\n ) external virtual;\n\n /**\n * @notice Sets a custom liveness value for the request. Liveness is the amount of time a proposal must wait before\n * being auto-resolved.\n * @param identifier price identifier to identify the existing request.\n * @param timestamp timestamp to identify the existing request.\n * @param ancillaryData ancillary data of the price being requested.\n * @param customLiveness new custom liveness.\n */\n function setCustomLiveness(\n bytes32 identifier,\n uint256 timestamp,\n bytes memory ancillaryData,\n uint256 customLiveness\n ) external virtual;\n\n /**\n * @notice Proposes a price value on another address' behalf. Note: this address will receive any rewards that come\n * from this proposal. However, any bonds are pulled from the caller.\n * @param proposer address to set as the proposer.\n * @param requester sender of the initial price request.\n * @param identifier price identifier to identify the existing request.\n * @param timestamp timestamp to identify the existing request.\n * @param ancillaryData ancillary data of the price being requested.\n * @param proposedPrice price being proposed.\n * @return totalBond the amount that's pulled from the caller's wallet as a bond. The bond will be returned to\n * the proposer once settled if the proposal is correct.\n */\n function proposePriceFor(\n address proposer,\n address requester,\n bytes32 identifier,\n uint256 timestamp,\n bytes memory ancillaryData,\n int256 proposedPrice\n ) public virtual returns (uint256 totalBond);\n\n /**\n * @notice Proposes a price value for an existing price request.\n * @param requester sender of the initial price request.\n * @param identifier price identifier to identify the existing request.\n * @param timestamp timestamp to identify the existing request.\n * @param ancillaryData ancillary data of the price being requested.\n * @param proposedPrice price being proposed.\n * @return totalBond the amount that's pulled from the proposer's wallet as a bond. The bond will be returned to\n * the proposer once settled if the proposal is correct.\n */\n function proposePrice(\n address requester,\n bytes32 identifier,\n uint256 timestamp,\n bytes memory ancillaryData,\n int256 proposedPrice\n ) external virtual returns (uint256 totalBond);\n\n /**\n * @notice Disputes a price request with an active proposal on another address' behalf. Note: this address will\n * receive any rewards that come from this dispute. However, any bonds are pulled from the caller.\n * @param disputer address to set as the disputer.\n * @param requester sender of the initial price request.\n * @param identifier price identifier to identify the existing request.\n * @param timestamp timestamp to identify the existing request.\n * @param ancillaryData ancillary data of the price being requested.\n * @return totalBond the amount that's pulled from the caller's wallet as a bond. The bond will be returned to\n * the disputer once settled if the dispute was value (the proposal was incorrect).\n */\n function disputePriceFor(\n address disputer,\n address requester,\n bytes32 identifier,\n uint256 timestamp,\n bytes memory ancillaryData\n ) public virtual returns (uint256 totalBond);\n\n /**\n * @notice Disputes a price value for an existing price request with an active proposal.\n * @param requester sender of the initial price request.\n * @param identifier price identifier to identify the existing request.\n * @param timestamp timestamp to identify the existing request.\n * @param ancillaryData ancillary data of the price being requested.\n * @return totalBond the amount that's pulled from the disputer's wallet as a bond. The bond will be returned to\n * the disputer once settled if the dispute was valid (the proposal was incorrect).\n */\n function disputePrice(\n address requester,\n bytes32 identifier,\n uint256 timestamp,\n bytes memory ancillaryData\n ) external virtual returns (uint256 totalBond);\n\n /**\n * @notice Retrieves a price that was previously requested by a caller. Reverts if the request is not settled\n * or settleable. Note: this method is not view so that this call may actually settle the price request if it\n * hasn't been settled.\n * @param identifier price identifier to identify the existing request.\n * @param timestamp timestamp to identify the existing request.\n * @param ancillaryData ancillary data of the price being requested.\n * @return resolved price.\n */\n function settleAndGetPrice(\n bytes32 identifier,\n uint256 timestamp,\n bytes memory ancillaryData\n ) external virtual returns (int256);\n\n /**\n * @notice Attempts to settle an outstanding price request. Will revert if it isn't settleable.\n * @param requester sender of the initial price request.\n * @param identifier price identifier to identify the existing request.\n * @param timestamp timestamp to identify the existing request.\n * @param ancillaryData ancillary data of the price being requested.\n * @return payout the amount that the \"winner\" (proposer or disputer) receives on settlement. This amount includes\n * the returned bonds as well as additional rewards.\n */\n function settle(\n address requester,\n bytes32 identifier,\n uint256 timestamp,\n bytes memory ancillaryData\n ) external virtual returns (uint256 payout);\n\n /**\n * @notice Gets the current data structure containing all information about a price request.\n * @param requester sender of the initial price request.\n * @param identifier price identifier to identify the existing request.\n * @param timestamp timestamp to identify the existing request.\n * @param ancillaryData ancillary data of the price being requested.\n * @return the Request data structure.\n */\n function getRequest(\n address requester,\n bytes32 identifier,\n uint256 timestamp,\n bytes memory ancillaryData\n ) public view virtual returns (Request memory);\n\n /**\n * @notice Returns the state of a price request.\n * @param requester sender of the initial price request.\n * @param identifier price identifier to identify the existing request.\n * @param timestamp timestamp to identify the existing request.\n * @param ancillaryData ancillary data of the price being requested.\n * @return the State enum value.\n */\n function getState(\n address requester,\n bytes32 identifier,\n uint256 timestamp,\n bytes memory ancillaryData\n ) public view virtual returns (State);\n\n /**\n * @notice Checks if a given request has resolved or been settled (i.e the optimistic oracle has a price).\n * @param requester sender of the initial price request.\n * @param identifier price identifier to identify the existing request.\n * @param timestamp timestamp to identify the existing request.\n * @param ancillaryData ancillary data of the price being requested.\n * @return true if price has resolved or settled, false otherwise.\n */\n function hasPrice(\n address requester,\n bytes32 identifier,\n uint256 timestamp,\n bytes memory ancillaryData\n ) public view virtual returns (bool);\n\n function stampAncillaryData(bytes memory ancillaryData, address requester)\n public\n view\n virtual\n returns (bytes memory);\n}\n" - }, - "@uma/core/contracts/oracle/interfaces/StoreInterface.sol": { - "content": "// SPDX-License-Identifier: AGPL-3.0-only\npragma solidity ^0.8.0;\n\nimport \"@openzeppelin/contracts/token/ERC20/IERC20.sol\";\nimport \"../../common/implementation/FixedPoint.sol\";\n\n/**\n * @title Interface that allows financial contracts to pay oracle fees for their use of the system.\n */\ninterface StoreInterface {\n /**\n * @notice Pays Oracle fees in ETH to the store.\n * @dev To be used by contracts whose margin currency is ETH.\n */\n function payOracleFees() external payable;\n\n /**\n * @notice Pays oracle fees in the margin currency, erc20Address, to the store.\n * @dev To be used if the margin currency is an ERC20 token rather than ETH.\n * @param erc20Address address of the ERC20 token used to pay the fee.\n * @param amount number of tokens to transfer. An approval for at least this amount must exist.\n */\n function payOracleFeesErc20(address erc20Address, FixedPoint.Unsigned calldata amount) external;\n\n /**\n * @notice Computes the regular oracle fees that a contract should pay for a period.\n * @param startTime defines the beginning time from which the fee is paid.\n * @param endTime end time until which the fee is paid.\n * @param pfc \"profit from corruption\", or the maximum amount of margin currency that a\n * token sponsor could extract from the contract through corrupting the price feed in their favor.\n * @return regularFee amount owed for the duration from start to end time for the given pfc.\n * @return latePenalty for paying the fee after the deadline.\n */\n function computeRegularFee(\n uint256 startTime,\n uint256 endTime,\n FixedPoint.Unsigned calldata pfc\n ) external view returns (FixedPoint.Unsigned memory regularFee, FixedPoint.Unsigned memory latePenalty);\n\n /**\n * @notice Computes the final oracle fees that a contract should pay at settlement.\n * @param currency token used to pay the final fee.\n * @return finalFee amount due.\n */\n function computeFinalFee(address currency) external view returns (FixedPoint.Unsigned memory);\n}\n" - }, - "@uma/core/contracts/common/implementation/FixedPoint.sol": { - "content": "// SPDX-License-Identifier: AGPL-3.0-only\npragma solidity ^0.8.0;\n\nimport \"@openzeppelin/contracts/utils/math/SafeMath.sol\";\nimport \"@openzeppelin/contracts/utils/math/SignedSafeMath.sol\";\n\n/**\n * @title Library for fixed point arithmetic on uints\n */\nlibrary FixedPoint {\n using SafeMath for uint256;\n using SignedSafeMath for int256;\n\n // Supports 18 decimals. E.g., 1e18 represents \"1\", 5e17 represents \"0.5\".\n // For unsigned values:\n // This can represent a value up to (2^256 - 1)/10^18 = ~10^59. 10^59 will be stored internally as uint256 10^77.\n uint256 private constant FP_SCALING_FACTOR = 10**18;\n\n // --------------------------------------- UNSIGNED -----------------------------------------------------------------------------\n struct Unsigned {\n uint256 rawValue;\n }\n\n /**\n * @notice Constructs an `Unsigned` from an unscaled uint, e.g., `b=5` gets stored internally as `5*(10**18)`.\n * @param a uint to convert into a FixedPoint.\n * @return the converted FixedPoint.\n */\n function fromUnscaledUint(uint256 a) internal pure returns (Unsigned memory) {\n return Unsigned(a.mul(FP_SCALING_FACTOR));\n }\n\n /**\n * @notice Whether `a` is equal to `b`.\n * @param a a FixedPoint.\n * @param b a uint256.\n * @return True if equal, or False.\n */\n function isEqual(Unsigned memory a, uint256 b) internal pure returns (bool) {\n return a.rawValue == fromUnscaledUint(b).rawValue;\n }\n\n /**\n * @notice Whether `a` is equal to `b`.\n * @param a a FixedPoint.\n * @param b a FixedPoint.\n * @return True if equal, or False.\n */\n function isEqual(Unsigned memory a, Unsigned memory b) internal pure returns (bool) {\n return a.rawValue == b.rawValue;\n }\n\n /**\n * @notice Whether `a` is greater than `b`.\n * @param a a FixedPoint.\n * @param b a FixedPoint.\n * @return True if `a > b`, or False.\n */\n function isGreaterThan(Unsigned memory a, Unsigned memory b) internal pure returns (bool) {\n return a.rawValue > b.rawValue;\n }\n\n /**\n * @notice Whether `a` is greater than `b`.\n * @param a a FixedPoint.\n * @param b a uint256.\n * @return True if `a > b`, or False.\n */\n function isGreaterThan(Unsigned memory a, uint256 b) internal pure returns (bool) {\n return a.rawValue > fromUnscaledUint(b).rawValue;\n }\n\n /**\n * @notice Whether `a` is greater than `b`.\n * @param a a uint256.\n * @param b a FixedPoint.\n * @return True if `a > b`, or False.\n */\n function isGreaterThan(uint256 a, Unsigned memory b) internal pure returns (bool) {\n return fromUnscaledUint(a).rawValue > b.rawValue;\n }\n\n /**\n * @notice Whether `a` is greater than or equal to `b`.\n * @param a a FixedPoint.\n * @param b a FixedPoint.\n * @return True if `a >= b`, or False.\n */\n function isGreaterThanOrEqual(Unsigned memory a, Unsigned memory b) internal pure returns (bool) {\n return a.rawValue >= b.rawValue;\n }\n\n /**\n * @notice Whether `a` is greater than or equal to `b`.\n * @param a a FixedPoint.\n * @param b a uint256.\n * @return True if `a >= b`, or False.\n */\n function isGreaterThanOrEqual(Unsigned memory a, uint256 b) internal pure returns (bool) {\n return a.rawValue >= fromUnscaledUint(b).rawValue;\n }\n\n /**\n * @notice Whether `a` is greater than or equal to `b`.\n * @param a a uint256.\n * @param b a FixedPoint.\n * @return True if `a >= b`, or False.\n */\n function isGreaterThanOrEqual(uint256 a, Unsigned memory b) internal pure returns (bool) {\n return fromUnscaledUint(a).rawValue >= b.rawValue;\n }\n\n /**\n * @notice Whether `a` is less than `b`.\n * @param a a FixedPoint.\n * @param b a FixedPoint.\n * @return True if `a < b`, or False.\n */\n function isLessThan(Unsigned memory a, Unsigned memory b) internal pure returns (bool) {\n return a.rawValue < b.rawValue;\n }\n\n /**\n * @notice Whether `a` is less than `b`.\n * @param a a FixedPoint.\n * @param b a uint256.\n * @return True if `a < b`, or False.\n */\n function isLessThan(Unsigned memory a, uint256 b) internal pure returns (bool) {\n return a.rawValue < fromUnscaledUint(b).rawValue;\n }\n\n /**\n * @notice Whether `a` is less than `b`.\n * @param a a uint256.\n * @param b a FixedPoint.\n * @return True if `a < b`, or False.\n */\n function isLessThan(uint256 a, Unsigned memory b) internal pure returns (bool) {\n return fromUnscaledUint(a).rawValue < b.rawValue;\n }\n\n /**\n * @notice Whether `a` is less than or equal to `b`.\n * @param a a FixedPoint.\n * @param b a FixedPoint.\n * @return True if `a <= b`, or False.\n */\n function isLessThanOrEqual(Unsigned memory a, Unsigned memory b) internal pure returns (bool) {\n return a.rawValue <= b.rawValue;\n }\n\n /**\n * @notice Whether `a` is less than or equal to `b`.\n * @param a a FixedPoint.\n * @param b a uint256.\n * @return True if `a <= b`, or False.\n */\n function isLessThanOrEqual(Unsigned memory a, uint256 b) internal pure returns (bool) {\n return a.rawValue <= fromUnscaledUint(b).rawValue;\n }\n\n /**\n * @notice Whether `a` is less than or equal to `b`.\n * @param a a uint256.\n * @param b a FixedPoint.\n * @return True if `a <= b`, or False.\n */\n function isLessThanOrEqual(uint256 a, Unsigned memory b) internal pure returns (bool) {\n return fromUnscaledUint(a).rawValue <= b.rawValue;\n }\n\n /**\n * @notice The minimum of `a` and `b`.\n * @param a a FixedPoint.\n * @param b a FixedPoint.\n * @return the minimum of `a` and `b`.\n */\n function min(Unsigned memory a, Unsigned memory b) internal pure returns (Unsigned memory) {\n return a.rawValue < b.rawValue ? a : b;\n }\n\n /**\n * @notice The maximum of `a` and `b`.\n * @param a a FixedPoint.\n * @param b a FixedPoint.\n * @return the maximum of `a` and `b`.\n */\n function max(Unsigned memory a, Unsigned memory b) internal pure returns (Unsigned memory) {\n return a.rawValue > b.rawValue ? a : b;\n }\n\n /**\n * @notice Adds two `Unsigned`s, reverting on overflow.\n * @param a a FixedPoint.\n * @param b a FixedPoint.\n * @return the sum of `a` and `b`.\n */\n function add(Unsigned memory a, Unsigned memory b) internal pure returns (Unsigned memory) {\n return Unsigned(a.rawValue.add(b.rawValue));\n }\n\n /**\n * @notice Adds an `Unsigned` to an unscaled uint, reverting on overflow.\n * @param a a FixedPoint.\n * @param b a uint256.\n * @return the sum of `a` and `b`.\n */\n function add(Unsigned memory a, uint256 b) internal pure returns (Unsigned memory) {\n return add(a, fromUnscaledUint(b));\n }\n\n /**\n * @notice Subtracts two `Unsigned`s, reverting on overflow.\n * @param a a FixedPoint.\n * @param b a FixedPoint.\n * @return the difference of `a` and `b`.\n */\n function sub(Unsigned memory a, Unsigned memory b) internal pure returns (Unsigned memory) {\n return Unsigned(a.rawValue.sub(b.rawValue));\n }\n\n /**\n * @notice Subtracts an unscaled uint256 from an `Unsigned`, reverting on overflow.\n * @param a a FixedPoint.\n * @param b a uint256.\n * @return the difference of `a` and `b`.\n */\n function sub(Unsigned memory a, uint256 b) internal pure returns (Unsigned memory) {\n return sub(a, fromUnscaledUint(b));\n }\n\n /**\n * @notice Subtracts an `Unsigned` from an unscaled uint256, reverting on overflow.\n * @param a a uint256.\n * @param b a FixedPoint.\n * @return the difference of `a` and `b`.\n */\n function sub(uint256 a, Unsigned memory b) internal pure returns (Unsigned memory) {\n return sub(fromUnscaledUint(a), b);\n }\n\n /**\n * @notice Multiplies two `Unsigned`s, reverting on overflow.\n * @dev This will \"floor\" the product.\n * @param a a FixedPoint.\n * @param b a FixedPoint.\n * @return the product of `a` and `b`.\n */\n function mul(Unsigned memory a, Unsigned memory b) internal pure returns (Unsigned memory) {\n // There are two caveats with this computation:\n // 1. Max output for the represented number is ~10^41, otherwise an intermediate value overflows. 10^41 is\n // stored internally as a uint256 ~10^59.\n // 2. Results that can't be represented exactly are truncated not rounded. E.g., 1.4 * 2e-18 = 2.8e-18, which\n // would round to 3, but this computation produces the result 2.\n // No need to use SafeMath because FP_SCALING_FACTOR != 0.\n return Unsigned(a.rawValue.mul(b.rawValue) / FP_SCALING_FACTOR);\n }\n\n /**\n * @notice Multiplies an `Unsigned` and an unscaled uint256, reverting on overflow.\n * @dev This will \"floor\" the product.\n * @param a a FixedPoint.\n * @param b a uint256.\n * @return the product of `a` and `b`.\n */\n function mul(Unsigned memory a, uint256 b) internal pure returns (Unsigned memory) {\n return Unsigned(a.rawValue.mul(b));\n }\n\n /**\n * @notice Multiplies two `Unsigned`s and \"ceil's\" the product, reverting on overflow.\n * @param a a FixedPoint.\n * @param b a FixedPoint.\n * @return the product of `a` and `b`.\n */\n function mulCeil(Unsigned memory a, Unsigned memory b) internal pure returns (Unsigned memory) {\n uint256 mulRaw = a.rawValue.mul(b.rawValue);\n uint256 mulFloor = mulRaw / FP_SCALING_FACTOR;\n uint256 mod = mulRaw.mod(FP_SCALING_FACTOR);\n if (mod != 0) {\n return Unsigned(mulFloor.add(1));\n } else {\n return Unsigned(mulFloor);\n }\n }\n\n /**\n * @notice Multiplies an `Unsigned` and an unscaled uint256 and \"ceil's\" the product, reverting on overflow.\n * @param a a FixedPoint.\n * @param b a FixedPoint.\n * @return the product of `a` and `b`.\n */\n function mulCeil(Unsigned memory a, uint256 b) internal pure returns (Unsigned memory) {\n // Since b is an uint, there is no risk of truncation and we can just mul it normally\n return Unsigned(a.rawValue.mul(b));\n }\n\n /**\n * @notice Divides one `Unsigned` by an `Unsigned`, reverting on overflow or division by 0.\n * @dev This will \"floor\" the quotient.\n * @param a a FixedPoint numerator.\n * @param b a FixedPoint denominator.\n * @return the quotient of `a` divided by `b`.\n */\n function div(Unsigned memory a, Unsigned memory b) internal pure returns (Unsigned memory) {\n // There are two caveats with this computation:\n // 1. Max value for the number dividend `a` represents is ~10^41, otherwise an intermediate value overflows.\n // 10^41 is stored internally as a uint256 10^59.\n // 2. Results that can't be represented exactly are truncated not rounded. E.g., 2 / 3 = 0.6 repeating, which\n // would round to 0.666666666666666667, but this computation produces the result 0.666666666666666666.\n return Unsigned(a.rawValue.mul(FP_SCALING_FACTOR).div(b.rawValue));\n }\n\n /**\n * @notice Divides one `Unsigned` by an unscaled uint256, reverting on overflow or division by 0.\n * @dev This will \"floor\" the quotient.\n * @param a a FixedPoint numerator.\n * @param b a uint256 denominator.\n * @return the quotient of `a` divided by `b`.\n */\n function div(Unsigned memory a, uint256 b) internal pure returns (Unsigned memory) {\n return Unsigned(a.rawValue.div(b));\n }\n\n /**\n * @notice Divides one unscaled uint256 by an `Unsigned`, reverting on overflow or division by 0.\n * @dev This will \"floor\" the quotient.\n * @param a a uint256 numerator.\n * @param b a FixedPoint denominator.\n * @return the quotient of `a` divided by `b`.\n */\n function div(uint256 a, Unsigned memory b) internal pure returns (Unsigned memory) {\n return div(fromUnscaledUint(a), b);\n }\n\n /**\n * @notice Divides one `Unsigned` by an `Unsigned` and \"ceil's\" the quotient, reverting on overflow or division by 0.\n * @param a a FixedPoint numerator.\n * @param b a FixedPoint denominator.\n * @return the quotient of `a` divided by `b`.\n */\n function divCeil(Unsigned memory a, Unsigned memory b) internal pure returns (Unsigned memory) {\n uint256 aScaled = a.rawValue.mul(FP_SCALING_FACTOR);\n uint256 divFloor = aScaled.div(b.rawValue);\n uint256 mod = aScaled.mod(b.rawValue);\n if (mod != 0) {\n return Unsigned(divFloor.add(1));\n } else {\n return Unsigned(divFloor);\n }\n }\n\n /**\n * @notice Divides one `Unsigned` by an unscaled uint256 and \"ceil's\" the quotient, reverting on overflow or division by 0.\n * @param a a FixedPoint numerator.\n * @param b a uint256 denominator.\n * @return the quotient of `a` divided by `b`.\n */\n function divCeil(Unsigned memory a, uint256 b) internal pure returns (Unsigned memory) {\n // Because it is possible that a quotient gets truncated, we can't just call \"Unsigned(a.rawValue.div(b))\"\n // similarly to mulCeil with a uint256 as the second parameter. Therefore we need to convert b into an Unsigned.\n // This creates the possibility of overflow if b is very large.\n return divCeil(a, fromUnscaledUint(b));\n }\n\n /**\n * @notice Raises an `Unsigned` to the power of an unscaled uint256, reverting on overflow. E.g., `b=2` squares `a`.\n * @dev This will \"floor\" the result.\n * @param a a FixedPoint numerator.\n * @param b a uint256 denominator.\n * @return output is `a` to the power of `b`.\n */\n function pow(Unsigned memory a, uint256 b) internal pure returns (Unsigned memory output) {\n output = fromUnscaledUint(1);\n for (uint256 i = 0; i < b; i = i.add(1)) {\n output = mul(output, a);\n }\n }\n\n // ------------------------------------------------- SIGNED -------------------------------------------------------------\n // Supports 18 decimals. E.g., 1e18 represents \"1\", 5e17 represents \"0.5\".\n // For signed values:\n // This can represent a value up (or down) to +-(2^255 - 1)/10^18 = ~10^58. 10^58 will be stored internally as int256 10^76.\n int256 private constant SFP_SCALING_FACTOR = 10**18;\n\n struct Signed {\n int256 rawValue;\n }\n\n function fromSigned(Signed memory a) internal pure returns (Unsigned memory) {\n require(a.rawValue >= 0, \"Negative value provided\");\n return Unsigned(uint256(a.rawValue));\n }\n\n function fromUnsigned(Unsigned memory a) internal pure returns (Signed memory) {\n require(a.rawValue <= uint256(type(int256).max), \"Unsigned too large\");\n return Signed(int256(a.rawValue));\n }\n\n /**\n * @notice Constructs a `Signed` from an unscaled int, e.g., `b=5` gets stored internally as `5*(10**18)`.\n * @param a int to convert into a FixedPoint.Signed.\n * @return the converted FixedPoint.Signed.\n */\n function fromUnscaledInt(int256 a) internal pure returns (Signed memory) {\n return Signed(a.mul(SFP_SCALING_FACTOR));\n }\n\n /**\n * @notice Whether `a` is equal to `b`.\n * @param a a FixedPoint.Signed.\n * @param b a int256.\n * @return True if equal, or False.\n */\n function isEqual(Signed memory a, int256 b) internal pure returns (bool) {\n return a.rawValue == fromUnscaledInt(b).rawValue;\n }\n\n /**\n * @notice Whether `a` is equal to `b`.\n * @param a a FixedPoint.Signed.\n * @param b a FixedPoint.Signed.\n * @return True if equal, or False.\n */\n function isEqual(Signed memory a, Signed memory b) internal pure returns (bool) {\n return a.rawValue == b.rawValue;\n }\n\n /**\n * @notice Whether `a` is greater than `b`.\n * @param a a FixedPoint.Signed.\n * @param b a FixedPoint.Signed.\n * @return True if `a > b`, or False.\n */\n function isGreaterThan(Signed memory a, Signed memory b) internal pure returns (bool) {\n return a.rawValue > b.rawValue;\n }\n\n /**\n * @notice Whether `a` is greater than `b`.\n * @param a a FixedPoint.Signed.\n * @param b an int256.\n * @return True if `a > b`, or False.\n */\n function isGreaterThan(Signed memory a, int256 b) internal pure returns (bool) {\n return a.rawValue > fromUnscaledInt(b).rawValue;\n }\n\n /**\n * @notice Whether `a` is greater than `b`.\n * @param a an int256.\n * @param b a FixedPoint.Signed.\n * @return True if `a > b`, or False.\n */\n function isGreaterThan(int256 a, Signed memory b) internal pure returns (bool) {\n return fromUnscaledInt(a).rawValue > b.rawValue;\n }\n\n /**\n * @notice Whether `a` is greater than or equal to `b`.\n * @param a a FixedPoint.Signed.\n * @param b a FixedPoint.Signed.\n * @return True if `a >= b`, or False.\n */\n function isGreaterThanOrEqual(Signed memory a, Signed memory b) internal pure returns (bool) {\n return a.rawValue >= b.rawValue;\n }\n\n /**\n * @notice Whether `a` is greater than or equal to `b`.\n * @param a a FixedPoint.Signed.\n * @param b an int256.\n * @return True if `a >= b`, or False.\n */\n function isGreaterThanOrEqual(Signed memory a, int256 b) internal pure returns (bool) {\n return a.rawValue >= fromUnscaledInt(b).rawValue;\n }\n\n /**\n * @notice Whether `a` is greater than or equal to `b`.\n * @param a an int256.\n * @param b a FixedPoint.Signed.\n * @return True if `a >= b`, or False.\n */\n function isGreaterThanOrEqual(int256 a, Signed memory b) internal pure returns (bool) {\n return fromUnscaledInt(a).rawValue >= b.rawValue;\n }\n\n /**\n * @notice Whether `a` is less than `b`.\n * @param a a FixedPoint.Signed.\n * @param b a FixedPoint.Signed.\n * @return True if `a < b`, or False.\n */\n function isLessThan(Signed memory a, Signed memory b) internal pure returns (bool) {\n return a.rawValue < b.rawValue;\n }\n\n /**\n * @notice Whether `a` is less than `b`.\n * @param a a FixedPoint.Signed.\n * @param b an int256.\n * @return True if `a < b`, or False.\n */\n function isLessThan(Signed memory a, int256 b) internal pure returns (bool) {\n return a.rawValue < fromUnscaledInt(b).rawValue;\n }\n\n /**\n * @notice Whether `a` is less than `b`.\n * @param a an int256.\n * @param b a FixedPoint.Signed.\n * @return True if `a < b`, or False.\n */\n function isLessThan(int256 a, Signed memory b) internal pure returns (bool) {\n return fromUnscaledInt(a).rawValue < b.rawValue;\n }\n\n /**\n * @notice Whether `a` is less than or equal to `b`.\n * @param a a FixedPoint.Signed.\n * @param b a FixedPoint.Signed.\n * @return True if `a <= b`, or False.\n */\n function isLessThanOrEqual(Signed memory a, Signed memory b) internal pure returns (bool) {\n return a.rawValue <= b.rawValue;\n }\n\n /**\n * @notice Whether `a` is less than or equal to `b`.\n * @param a a FixedPoint.Signed.\n * @param b an int256.\n * @return True if `a <= b`, or False.\n */\n function isLessThanOrEqual(Signed memory a, int256 b) internal pure returns (bool) {\n return a.rawValue <= fromUnscaledInt(b).rawValue;\n }\n\n /**\n * @notice Whether `a` is less than or equal to `b`.\n * @param a an int256.\n * @param b a FixedPoint.Signed.\n * @return True if `a <= b`, or False.\n */\n function isLessThanOrEqual(int256 a, Signed memory b) internal pure returns (bool) {\n return fromUnscaledInt(a).rawValue <= b.rawValue;\n }\n\n /**\n * @notice The minimum of `a` and `b`.\n * @param a a FixedPoint.Signed.\n * @param b a FixedPoint.Signed.\n * @return the minimum of `a` and `b`.\n */\n function min(Signed memory a, Signed memory b) internal pure returns (Signed memory) {\n return a.rawValue < b.rawValue ? a : b;\n }\n\n /**\n * @notice The maximum of `a` and `b`.\n * @param a a FixedPoint.Signed.\n * @param b a FixedPoint.Signed.\n * @return the maximum of `a` and `b`.\n */\n function max(Signed memory a, Signed memory b) internal pure returns (Signed memory) {\n return a.rawValue > b.rawValue ? a : b;\n }\n\n /**\n * @notice Adds two `Signed`s, reverting on overflow.\n * @param a a FixedPoint.Signed.\n * @param b a FixedPoint.Signed.\n * @return the sum of `a` and `b`.\n */\n function add(Signed memory a, Signed memory b) internal pure returns (Signed memory) {\n return Signed(a.rawValue.add(b.rawValue));\n }\n\n /**\n * @notice Adds an `Signed` to an unscaled int, reverting on overflow.\n * @param a a FixedPoint.Signed.\n * @param b an int256.\n * @return the sum of `a` and `b`.\n */\n function add(Signed memory a, int256 b) internal pure returns (Signed memory) {\n return add(a, fromUnscaledInt(b));\n }\n\n /**\n * @notice Subtracts two `Signed`s, reverting on overflow.\n * @param a a FixedPoint.Signed.\n * @param b a FixedPoint.Signed.\n * @return the difference of `a` and `b`.\n */\n function sub(Signed memory a, Signed memory b) internal pure returns (Signed memory) {\n return Signed(a.rawValue.sub(b.rawValue));\n }\n\n /**\n * @notice Subtracts an unscaled int256 from an `Signed`, reverting on overflow.\n * @param a a FixedPoint.Signed.\n * @param b an int256.\n * @return the difference of `a` and `b`.\n */\n function sub(Signed memory a, int256 b) internal pure returns (Signed memory) {\n return sub(a, fromUnscaledInt(b));\n }\n\n /**\n * @notice Subtracts an `Signed` from an unscaled int256, reverting on overflow.\n * @param a an int256.\n * @param b a FixedPoint.Signed.\n * @return the difference of `a` and `b`.\n */\n function sub(int256 a, Signed memory b) internal pure returns (Signed memory) {\n return sub(fromUnscaledInt(a), b);\n }\n\n /**\n * @notice Multiplies two `Signed`s, reverting on overflow.\n * @dev This will \"floor\" the product.\n * @param a a FixedPoint.Signed.\n * @param b a FixedPoint.Signed.\n * @return the product of `a` and `b`.\n */\n function mul(Signed memory a, Signed memory b) internal pure returns (Signed memory) {\n // There are two caveats with this computation:\n // 1. Max output for the represented number is ~10^41, otherwise an intermediate value overflows. 10^41 is\n // stored internally as an int256 ~10^59.\n // 2. Results that can't be represented exactly are truncated not rounded. E.g., 1.4 * 2e-18 = 2.8e-18, which\n // would round to 3, but this computation produces the result 2.\n // No need to use SafeMath because SFP_SCALING_FACTOR != 0.\n return Signed(a.rawValue.mul(b.rawValue) / SFP_SCALING_FACTOR);\n }\n\n /**\n * @notice Multiplies an `Signed` and an unscaled int256, reverting on overflow.\n * @dev This will \"floor\" the product.\n * @param a a FixedPoint.Signed.\n * @param b an int256.\n * @return the product of `a` and `b`.\n */\n function mul(Signed memory a, int256 b) internal pure returns (Signed memory) {\n return Signed(a.rawValue.mul(b));\n }\n\n /**\n * @notice Multiplies two `Signed`s and \"ceil's\" the product, reverting on overflow.\n * @param a a FixedPoint.Signed.\n * @param b a FixedPoint.Signed.\n * @return the product of `a` and `b`.\n */\n function mulAwayFromZero(Signed memory a, Signed memory b) internal pure returns (Signed memory) {\n int256 mulRaw = a.rawValue.mul(b.rawValue);\n int256 mulTowardsZero = mulRaw / SFP_SCALING_FACTOR;\n // Manual mod because SignedSafeMath doesn't support it.\n int256 mod = mulRaw % SFP_SCALING_FACTOR;\n if (mod != 0) {\n bool isResultPositive = isLessThan(a, 0) == isLessThan(b, 0);\n int256 valueToAdd = isResultPositive ? int256(1) : int256(-1);\n return Signed(mulTowardsZero.add(valueToAdd));\n } else {\n return Signed(mulTowardsZero);\n }\n }\n\n /**\n * @notice Multiplies an `Signed` and an unscaled int256 and \"ceil's\" the product, reverting on overflow.\n * @param a a FixedPoint.Signed.\n * @param b a FixedPoint.Signed.\n * @return the product of `a` and `b`.\n */\n function mulAwayFromZero(Signed memory a, int256 b) internal pure returns (Signed memory) {\n // Since b is an int, there is no risk of truncation and we can just mul it normally\n return Signed(a.rawValue.mul(b));\n }\n\n /**\n * @notice Divides one `Signed` by an `Signed`, reverting on overflow or division by 0.\n * @dev This will \"floor\" the quotient.\n * @param a a FixedPoint numerator.\n * @param b a FixedPoint denominator.\n * @return the quotient of `a` divided by `b`.\n */\n function div(Signed memory a, Signed memory b) internal pure returns (Signed memory) {\n // There are two caveats with this computation:\n // 1. Max value for the number dividend `a` represents is ~10^41, otherwise an intermediate value overflows.\n // 10^41 is stored internally as an int256 10^59.\n // 2. Results that can't be represented exactly are truncated not rounded. E.g., 2 / 3 = 0.6 repeating, which\n // would round to 0.666666666666666667, but this computation produces the result 0.666666666666666666.\n return Signed(a.rawValue.mul(SFP_SCALING_FACTOR).div(b.rawValue));\n }\n\n /**\n * @notice Divides one `Signed` by an unscaled int256, reverting on overflow or division by 0.\n * @dev This will \"floor\" the quotient.\n * @param a a FixedPoint numerator.\n * @param b an int256 denominator.\n * @return the quotient of `a` divided by `b`.\n */\n function div(Signed memory a, int256 b) internal pure returns (Signed memory) {\n return Signed(a.rawValue.div(b));\n }\n\n /**\n * @notice Divides one unscaled int256 by an `Signed`, reverting on overflow or division by 0.\n * @dev This will \"floor\" the quotient.\n * @param a an int256 numerator.\n * @param b a FixedPoint denominator.\n * @return the quotient of `a` divided by `b`.\n */\n function div(int256 a, Signed memory b) internal pure returns (Signed memory) {\n return div(fromUnscaledInt(a), b);\n }\n\n /**\n * @notice Divides one `Signed` by an `Signed` and \"ceil's\" the quotient, reverting on overflow or division by 0.\n * @param a a FixedPoint numerator.\n * @param b a FixedPoint denominator.\n * @return the quotient of `a` divided by `b`.\n */\n function divAwayFromZero(Signed memory a, Signed memory b) internal pure returns (Signed memory) {\n int256 aScaled = a.rawValue.mul(SFP_SCALING_FACTOR);\n int256 divTowardsZero = aScaled.div(b.rawValue);\n // Manual mod because SignedSafeMath doesn't support it.\n int256 mod = aScaled % b.rawValue;\n if (mod != 0) {\n bool isResultPositive = isLessThan(a, 0) == isLessThan(b, 0);\n int256 valueToAdd = isResultPositive ? int256(1) : int256(-1);\n return Signed(divTowardsZero.add(valueToAdd));\n } else {\n return Signed(divTowardsZero);\n }\n }\n\n /**\n * @notice Divides one `Signed` by an unscaled int256 and \"ceil's\" the quotient, reverting on overflow or division by 0.\n * @param a a FixedPoint numerator.\n * @param b an int256 denominator.\n * @return the quotient of `a` divided by `b`.\n */\n function divAwayFromZero(Signed memory a, int256 b) internal pure returns (Signed memory) {\n // Because it is possible that a quotient gets truncated, we can't just call \"Signed(a.rawValue.div(b))\"\n // similarly to mulCeil with an int256 as the second parameter. Therefore we need to convert b into an Signed.\n // This creates the possibility of overflow if b is very large.\n return divAwayFromZero(a, fromUnscaledInt(b));\n }\n\n /**\n * @notice Raises an `Signed` to the power of an unscaled uint256, reverting on overflow. E.g., `b=2` squares `a`.\n * @dev This will \"floor\" the result.\n * @param a a FixedPoint.Signed.\n * @param b a uint256 (negative exponents are not allowed).\n * @return output is `a` to the power of `b`.\n */\n function pow(Signed memory a, uint256 b) internal pure returns (Signed memory output) {\n output = fromUnscaledInt(1);\n for (uint256 i = 0; i < b; i = i.add(1)) {\n output = mul(output, a);\n }\n }\n}\n" - }, - "@openzeppelin/contracts/utils/math/SafeMath.sol": { - "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts v4.4.1 (utils/math/SafeMath.sol)\n\npragma solidity ^0.8.0;\n\n// CAUTION\n// This version of SafeMath should only be used with Solidity 0.8 or later,\n// because it relies on the compiler's built in overflow checks.\n\n/**\n * @dev Wrappers over Solidity's arithmetic operations.\n *\n * NOTE: `SafeMath` is generally not needed starting with Solidity 0.8, since the compiler\n * now has built in overflow checking.\n */\nlibrary SafeMath {\n /**\n * @dev Returns the addition of two unsigned integers, with an overflow flag.\n *\n * _Available since v3.4._\n */\n function tryAdd(uint256 a, uint256 b) internal pure returns (bool, uint256) {\n unchecked {\n uint256 c = a + b;\n if (c < a) return (false, 0);\n return (true, c);\n }\n }\n\n /**\n * @dev Returns the substraction of two unsigned integers, with an overflow flag.\n *\n * _Available since v3.4._\n */\n function trySub(uint256 a, uint256 b) internal pure returns (bool, uint256) {\n unchecked {\n if (b > a) return (false, 0);\n return (true, a - b);\n }\n }\n\n /**\n * @dev Returns the multiplication of two unsigned integers, with an overflow flag.\n *\n * _Available since v3.4._\n */\n function tryMul(uint256 a, uint256 b) internal pure returns (bool, uint256) {\n unchecked {\n // Gas optimization: this is cheaper than requiring 'a' not being zero, but the\n // benefit is lost if 'b' is also tested.\n // See: https://github.com/OpenZeppelin/openzeppelin-contracts/pull/522\n if (a == 0) return (true, 0);\n uint256 c = a * b;\n if (c / a != b) return (false, 0);\n return (true, c);\n }\n }\n\n /**\n * @dev Returns the division of two unsigned integers, with a division by zero flag.\n *\n * _Available since v3.4._\n */\n function tryDiv(uint256 a, uint256 b) internal pure returns (bool, uint256) {\n unchecked {\n if (b == 0) return (false, 0);\n return (true, a / b);\n }\n }\n\n /**\n * @dev Returns the remainder of dividing two unsigned integers, with a division by zero flag.\n *\n * _Available since v3.4._\n */\n function tryMod(uint256 a, uint256 b) internal pure returns (bool, uint256) {\n unchecked {\n if (b == 0) return (false, 0);\n return (true, a % b);\n }\n }\n\n /**\n * @dev Returns the addition of two unsigned integers, reverting on\n * overflow.\n *\n * Counterpart to Solidity's `+` operator.\n *\n * Requirements:\n *\n * - Addition cannot overflow.\n */\n function add(uint256 a, uint256 b) internal pure returns (uint256) {\n return a + b;\n }\n\n /**\n * @dev Returns the subtraction of two unsigned integers, reverting on\n * overflow (when the result is negative).\n *\n * Counterpart to Solidity's `-` operator.\n *\n * Requirements:\n *\n * - Subtraction cannot overflow.\n */\n function sub(uint256 a, uint256 b) internal pure returns (uint256) {\n return a - b;\n }\n\n /**\n * @dev Returns the multiplication of two unsigned integers, reverting on\n * overflow.\n *\n * Counterpart to Solidity's `*` operator.\n *\n * Requirements:\n *\n * - Multiplication cannot overflow.\n */\n function mul(uint256 a, uint256 b) internal pure returns (uint256) {\n return a * b;\n }\n\n /**\n * @dev Returns the integer division of two unsigned integers, reverting on\n * division by zero. The result is rounded towards zero.\n *\n * Counterpart to Solidity's `/` operator.\n *\n * Requirements:\n *\n * - The divisor cannot be zero.\n */\n function div(uint256 a, uint256 b) internal pure returns (uint256) {\n return a / b;\n }\n\n /**\n * @dev Returns the remainder of dividing two unsigned integers. (unsigned integer modulo),\n * reverting when dividing by zero.\n *\n * Counterpart to Solidity's `%` operator. This function uses a `revert`\n * opcode (which leaves remaining gas untouched) while Solidity uses an\n * invalid opcode to revert (consuming all remaining gas).\n *\n * Requirements:\n *\n * - The divisor cannot be zero.\n */\n function mod(uint256 a, uint256 b) internal pure returns (uint256) {\n return a % b;\n }\n\n /**\n * @dev Returns the subtraction of two unsigned integers, reverting with custom message on\n * overflow (when the result is negative).\n *\n * CAUTION: This function is deprecated because it requires allocating memory for the error\n * message unnecessarily. For custom revert reasons use {trySub}.\n *\n * Counterpart to Solidity's `-` operator.\n *\n * Requirements:\n *\n * - Subtraction cannot overflow.\n */\n function sub(\n uint256 a,\n uint256 b,\n string memory errorMessage\n ) internal pure returns (uint256) {\n unchecked {\n require(b <= a, errorMessage);\n return a - b;\n }\n }\n\n /**\n * @dev Returns the integer division of two unsigned integers, reverting with custom message on\n * division by zero. The result is rounded towards zero.\n *\n * Counterpart to Solidity's `/` operator. Note: this function uses a\n * `revert` opcode (which leaves remaining gas untouched) while Solidity\n * uses an invalid opcode to revert (consuming all remaining gas).\n *\n * Requirements:\n *\n * - The divisor cannot be zero.\n */\n function div(\n uint256 a,\n uint256 b,\n string memory errorMessage\n ) internal pure returns (uint256) {\n unchecked {\n require(b > 0, errorMessage);\n return a / b;\n }\n }\n\n /**\n * @dev Returns the remainder of dividing two unsigned integers. (unsigned integer modulo),\n * reverting with custom message when dividing by zero.\n *\n * CAUTION: This function is deprecated because it requires allocating memory for the error\n * message unnecessarily. For custom revert reasons use {tryMod}.\n *\n * Counterpart to Solidity's `%` operator. This function uses a `revert`\n * opcode (which leaves remaining gas untouched) while Solidity uses an\n * invalid opcode to revert (consuming all remaining gas).\n *\n * Requirements:\n *\n * - The divisor cannot be zero.\n */\n function mod(\n uint256 a,\n uint256 b,\n string memory errorMessage\n ) internal pure returns (uint256) {\n unchecked {\n require(b > 0, errorMessage);\n return a % b;\n }\n }\n}\n" - }, - "@openzeppelin/contracts/utils/math/SignedSafeMath.sol": { - "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts v4.4.1 (utils/math/SignedSafeMath.sol)\n\npragma solidity ^0.8.0;\n\n/**\n * @dev Wrappers over Solidity's arithmetic operations.\n *\n * NOTE: `SignedSafeMath` is no longer needed starting with Solidity 0.8. The compiler\n * now has built in overflow checking.\n */\nlibrary SignedSafeMath {\n /**\n * @dev Returns the multiplication of two signed integers, reverting on\n * overflow.\n *\n * Counterpart to Solidity's `*` operator.\n *\n * Requirements:\n *\n * - Multiplication cannot overflow.\n */\n function mul(int256 a, int256 b) internal pure returns (int256) {\n return a * b;\n }\n\n /**\n * @dev Returns the integer division of two signed integers. Reverts on\n * division by zero. The result is rounded towards zero.\n *\n * Counterpart to Solidity's `/` operator.\n *\n * Requirements:\n *\n * - The divisor cannot be zero.\n */\n function div(int256 a, int256 b) internal pure returns (int256) {\n return a / b;\n }\n\n /**\n * @dev Returns the subtraction of two signed integers, reverting on\n * overflow.\n *\n * Counterpart to Solidity's `-` operator.\n *\n * Requirements:\n *\n * - Subtraction cannot overflow.\n */\n function sub(int256 a, int256 b) internal pure returns (int256) {\n return a - b;\n }\n\n /**\n * @dev Returns the addition of two signed integers, reverting on\n * overflow.\n *\n * Counterpart to Solidity's `+` operator.\n *\n * Requirements:\n *\n * - Addition cannot overflow.\n */\n function add(int256 a, int256 b) internal pure returns (int256) {\n return a + b;\n }\n}\n" - }, - "@uma/core/contracts/oracle/interfaces/FinderInterface.sol": { - "content": "// SPDX-License-Identifier: AGPL-3.0-only\npragma solidity ^0.8.0;\n\n/**\n * @title Provides addresses of the live contracts implementing certain interfaces.\n * @dev Examples are the Oracle or Store interfaces.\n */\ninterface FinderInterface {\n /**\n * @notice Updates the address of the contract that implements `interfaceName`.\n * @param interfaceName bytes32 encoding of the interface name that is either changed or registered.\n * @param implementationAddress address of the deployed contract that implements the interface.\n */\n function changeImplementationAddress(bytes32 interfaceName, address implementationAddress) external;\n\n /**\n * @notice Gets the address of the contract that implements the given `interfaceName`.\n * @param interfaceName queried interface.\n * @return implementationAddress address of the deployed contract that implements the interface.\n */\n function getImplementationAddress(bytes32 interfaceName) external view returns (address);\n}\n" - }, - "@uma/core/contracts/oracle/interfaces/IdentifierWhitelistInterface.sol": { - "content": "// SPDX-License-Identifier: AGPL-3.0-only\npragma solidity ^0.8.0;\n\n/**\n * @title Interface for whitelists of supported identifiers that the oracle can provide prices for.\n */\ninterface IdentifierWhitelistInterface {\n /**\n * @notice Adds the provided identifier as a supported identifier.\n * @dev Price requests using this identifier will succeed after this call.\n * @param identifier bytes32 encoding of the string identifier. Eg: BTC/USD.\n */\n function addSupportedIdentifier(bytes32 identifier) external;\n\n /**\n * @notice Removes the identifier from the whitelist.\n * @dev Price requests using this identifier will no longer succeed after this call.\n * @param identifier bytes32 encoding of the string identifier. Eg: BTC/USD.\n */\n function removeSupportedIdentifier(bytes32 identifier) external;\n\n /**\n * @notice Checks whether an identifier is on the whitelist.\n * @param identifier bytes32 encoding of the string identifier. Eg: BTC/USD.\n * @return bool if the identifier is supported (or not).\n */\n function isIdentifierSupported(bytes32 identifier) external view returns (bool);\n}\n" - }, - "@uma/core/contracts/common/interfaces/AddressWhitelistInterface.sol": { - "content": "// SPDX-License-Identifier: AGPL-3.0-only\npragma solidity ^0.8.0;\n\ninterface AddressWhitelistInterface {\n function addToWhitelist(address newElement) external;\n\n function removeFromWhitelist(address newElement) external;\n\n function isOnWhitelist(address newElement) external view returns (bool);\n\n function getWhitelist() external view returns (address[] memory);\n}\n" - }, - "@uma/core/contracts/common/implementation/AncillaryData.sol": { - "content": "// SPDX-License-Identifier: AGPL-3.0-only\npragma solidity ^0.8.0;\n\n/**\n * @title Library for encoding and decoding ancillary data for DVM price requests.\n * @notice We assume that on-chain ancillary data can be formatted directly from bytes to utf8 encoding via\n * web3.utils.hexToUtf8, and that clients will parse the utf8-encoded ancillary data as a comma-delimitted key-value\n * dictionary. Therefore, this library provides internal methods that aid appending to ancillary data from Solidity\n * smart contracts. More details on UMA's ancillary data guidelines below:\n * https://docs.google.com/document/d/1zhKKjgY1BupBGPPrY_WOJvui0B6DMcd-xDR8-9-SPDw/edit\n */\nlibrary AncillaryData {\n // This converts the bottom half of a bytes32 input to hex in a highly gas-optimized way.\n // Source: the brilliant implementation at https://gitter.im/ethereum/solidity?at=5840d23416207f7b0ed08c9b.\n function toUtf8Bytes32Bottom(bytes32 bytesIn) private pure returns (bytes32) {\n unchecked {\n uint256 x = uint256(bytesIn);\n\n // Nibble interleave\n x = x & 0x00000000000000000000000000000000ffffffffffffffffffffffffffffffff;\n x = (x | (x * 2**64)) & 0x0000000000000000ffffffffffffffff0000000000000000ffffffffffffffff;\n x = (x | (x * 2**32)) & 0x00000000ffffffff00000000ffffffff00000000ffffffff00000000ffffffff;\n x = (x | (x * 2**16)) & 0x0000ffff0000ffff0000ffff0000ffff0000ffff0000ffff0000ffff0000ffff;\n x = (x | (x * 2**8)) & 0x00ff00ff00ff00ff00ff00ff00ff00ff00ff00ff00ff00ff00ff00ff00ff00ff;\n x = (x | (x * 2**4)) & 0x0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f;\n\n // Hex encode\n uint256 h = (x & 0x0808080808080808080808080808080808080808080808080808080808080808) / 8;\n uint256 i = (x & 0x0404040404040404040404040404040404040404040404040404040404040404) / 4;\n uint256 j = (x & 0x0202020202020202020202020202020202020202020202020202020202020202) / 2;\n x = x + (h & (i | j)) * 0x27 + 0x3030303030303030303030303030303030303030303030303030303030303030;\n\n // Return the result.\n return bytes32(x);\n }\n }\n\n /**\n * @notice Returns utf8-encoded bytes32 string that can be read via web3.utils.hexToUtf8.\n * @dev Will return bytes32 in all lower case hex characters and without the leading 0x.\n * This has minor changes from the toUtf8BytesAddress to control for the size of the input.\n * @param bytesIn bytes32 to encode.\n * @return utf8 encoded bytes32.\n */\n function toUtf8Bytes(bytes32 bytesIn) internal pure returns (bytes memory) {\n return abi.encodePacked(toUtf8Bytes32Bottom(bytesIn >> 128), toUtf8Bytes32Bottom(bytesIn));\n }\n\n /**\n * @notice Returns utf8-encoded address that can be read via web3.utils.hexToUtf8.\n * Source: https://ethereum.stackexchange.com/questions/8346/convert-address-to-string/8447#8447\n * @dev Will return address in all lower case characters and without the leading 0x.\n * @param x address to encode.\n * @return utf8 encoded address bytes.\n */\n function toUtf8BytesAddress(address x) internal pure returns (bytes memory) {\n return\n abi.encodePacked(toUtf8Bytes32Bottom(bytes32(bytes20(x)) >> 128), bytes8(toUtf8Bytes32Bottom(bytes20(x))));\n }\n\n /**\n * @notice Converts a uint into a base-10, UTF-8 representation stored in a `string` type.\n * @dev This method is based off of this code: https://stackoverflow.com/a/65707309.\n */\n function toUtf8BytesUint(uint256 x) internal pure returns (bytes memory) {\n if (x == 0) {\n return \"0\";\n }\n uint256 j = x;\n uint256 len;\n while (j != 0) {\n len++;\n j /= 10;\n }\n bytes memory bstr = new bytes(len);\n uint256 k = len;\n while (x != 0) {\n k = k - 1;\n uint8 temp = (48 + uint8(x - (x / 10) * 10));\n bytes1 b1 = bytes1(temp);\n bstr[k] = b1;\n x /= 10;\n }\n return bstr;\n }\n\n function appendKeyValueBytes32(\n bytes memory currentAncillaryData,\n bytes memory key,\n bytes32 value\n ) internal pure returns (bytes memory) {\n bytes memory prefix = constructPrefix(currentAncillaryData, key);\n return abi.encodePacked(currentAncillaryData, prefix, toUtf8Bytes(value));\n }\n\n /**\n * @notice Adds \"key:value\" to `currentAncillaryData` where `value` is an address that first needs to be converted\n * to utf8 bytes. For example, if `utf8(currentAncillaryData)=\"k1:v1\"`, then this function will return\n * `utf8(k1:v1,key:value)`, and if `currentAncillaryData` is blank, then this will return `utf8(key:value)`.\n * @param currentAncillaryData This bytes data should ideally be able to be utf8-decoded, but its OK if not.\n * @param key Again, this bytes data should ideally be able to be utf8-decoded, but its OK if not.\n * @param value An address to set as the value in the key:value pair to append to `currentAncillaryData`.\n * @return Newly appended ancillary data.\n */\n function appendKeyValueAddress(\n bytes memory currentAncillaryData,\n bytes memory key,\n address value\n ) internal pure returns (bytes memory) {\n bytes memory prefix = constructPrefix(currentAncillaryData, key);\n return abi.encodePacked(currentAncillaryData, prefix, toUtf8BytesAddress(value));\n }\n\n /**\n * @notice Adds \"key:value\" to `currentAncillaryData` where `value` is a uint that first needs to be converted\n * to utf8 bytes. For example, if `utf8(currentAncillaryData)=\"k1:v1\"`, then this function will return\n * `utf8(k1:v1,key:value)`, and if `currentAncillaryData` is blank, then this will return `utf8(key:value)`.\n * @param currentAncillaryData This bytes data should ideally be able to be utf8-decoded, but its OK if not.\n * @param key Again, this bytes data should ideally be able to be utf8-decoded, but its OK if not.\n * @param value A uint to set as the value in the key:value pair to append to `currentAncillaryData`.\n * @return Newly appended ancillary data.\n */\n function appendKeyValueUint(\n bytes memory currentAncillaryData,\n bytes memory key,\n uint256 value\n ) internal pure returns (bytes memory) {\n bytes memory prefix = constructPrefix(currentAncillaryData, key);\n return abi.encodePacked(currentAncillaryData, prefix, toUtf8BytesUint(value));\n }\n\n /**\n * @notice Helper method that returns the left hand side of a \"key:value\" pair plus the colon \":\" and a leading\n * comma \",\" if the `currentAncillaryData` is not empty. The return value is intended to be prepended as a prefix to\n * some utf8 value that is ultimately added to a comma-delimited, key-value dictionary.\n */\n function constructPrefix(bytes memory currentAncillaryData, bytes memory key) internal pure returns (bytes memory) {\n if (currentAncillaryData.length > 0) {\n return abi.encodePacked(\",\", key, \":\");\n } else {\n return abi.encodePacked(key, \":\");\n }\n }\n}\n" - }, - "@uma/core/contracts/oracle/implementation/Constants.sol": { - "content": "// SPDX-License-Identifier: AGPL-3.0-only\npragma solidity ^0.8.0;\n\n/**\n * @title Stores common interface names used throughout the DVM by registration in the Finder.\n */\nlibrary OracleInterfaces {\n bytes32 public constant Oracle = \"Oracle\";\n bytes32 public constant IdentifierWhitelist = \"IdentifierWhitelist\";\n bytes32 public constant Store = \"Store\";\n bytes32 public constant FinancialContractsAdmin = \"FinancialContractsAdmin\";\n bytes32 public constant Registry = \"Registry\";\n bytes32 public constant CollateralWhitelist = \"CollateralWhitelist\";\n bytes32 public constant OptimisticOracle = \"OptimisticOracle\";\n bytes32 public constant Bridge = \"Bridge\";\n bytes32 public constant GenericHandler = \"GenericHandler\";\n bytes32 public constant SkinnyOptimisticOracle = \"SkinnyOptimisticOracle\";\n bytes32 public constant ChildMessenger = \"ChildMessenger\";\n bytes32 public constant OracleHub = \"OracleHub\";\n bytes32 public constant OracleSpoke = \"OracleSpoke\";\n}\n\n/**\n * @title Commonly re-used values for contracts associated with the OptimisticOracle.\n */\nlibrary OptimisticOracleConstraints {\n // Any price request submitted to the OptimisticOracle must contain ancillary data no larger than this value.\n // This value must be <= the Voting contract's `ancillaryBytesLimit` constant value otherwise it is possible\n // that a price can be requested to the OptimisticOracle successfully, but cannot be resolved by the DVM which\n // refuses to accept a price request made with ancillary data length over a certain size.\n uint256 public constant ancillaryBytesLimit = 8192;\n}\n" - }, - "contracts/Lockable.sol": { - "content": "// SPDX-License-Identifier: AGPL-3.0-only\r\npragma solidity ^0.8.0;\r\n\r\n/**\r\n * @title A contract that provides modifiers to prevent reentrancy to state-changing and view-only methods. This contract\r\n * is inspired by https://github.com/OpenZeppelin/openzeppelin-contracts/blob/master/contracts/utils/ReentrancyGuard.sol\r\n * and https://github.com/balancer-labs/balancer-core/blob/master/contracts/BPool.sol.\r\n */\r\ncontract Lockable {\r\n bool internal _notEntered;\r\n\r\n constructor() {\r\n // Storing an initial non-zero value makes deployment a bit more expensive, but in exchange the refund on every\r\n // call to nonReentrant will be lower in amount. Since refunds are capped to a percentage of the total\r\n // transaction's gas, it is best to keep them low in cases like this one, to increase the likelihood of the full\r\n // refund coming into effect.\r\n _notEntered = true;\r\n }\r\n\r\n /**\r\n * @dev Prevents a contract from calling itself, directly or indirectly.\r\n * Calling a `nonReentrant` function from another `nonReentrant` function is not supported. It is possible to\r\n * prevent this from happening by making the `nonReentrant` function external, and making it call a `private`\r\n * function that does the actual state modification.\r\n */\r\n modifier nonReentrant() {\r\n _preEntranceCheck();\r\n _preEntranceSet();\r\n _;\r\n _postEntranceReset();\r\n }\r\n\r\n /**\r\n * @dev Designed to prevent a view-only method from being re-entered during a call to a `nonReentrant()` state-changing method.\r\n */\r\n modifier nonReentrantView() {\r\n _preEntranceCheck();\r\n _;\r\n }\r\n\r\n /**\r\n * @dev Returns true if the contract is currently in a non-entered state, meaning that the origination of the call\r\n * came from outside the contract. This is relevant with fallback/receive methods to see if the call came from ETH\r\n * being dropped onto the contract externally or due to ETH dropped on the the contract from within a method in this\r\n * contract, such as unwrapping WETH to ETH within the contract.\r\n */\r\n function functionCallStackOriginatesFromOutsideThisContract() internal view returns (bool) {\r\n return _notEntered;\r\n }\r\n\r\n // Internal methods are used to avoid copying the require statement's bytecode to every `nonReentrant()` method.\r\n // On entry into a function, `_preEntranceCheck()` should always be called to check if the function is being\r\n // re-entered. Then, if the function modifies state, it should call `_postEntranceSet()`, perform its logic, and\r\n // then call `_postEntranceReset()`.\r\n // View-only methods can simply call `_preEntranceCheck()` to make sure that it is not being re-entered.\r\n function _preEntranceCheck() internal view {\r\n // On the first call to nonReentrant, _notEntered will be true\r\n require(_notEntered, \"ReentrancyGuard: reentrant call\");\r\n }\r\n\r\n function _preEntranceSet() internal {\r\n // Any calls to nonReentrant after this point will fail\r\n _notEntered = false;\r\n }\r\n\r\n function _postEntranceReset() internal {\r\n // By storing the original value once again, a refund is triggered (see\r\n // https://eips.ethereum.org/EIPS/eip-2200)\r\n _notEntered = true;\r\n }\r\n}\r\n" - } - }, - "settings": { - "optimizer": { - "enabled": true, - "runs": 1000000 - }, - "outputSelection": { - "*": { - "*": [ - "abi", - "evm.bytecode", - "evm.deployedBytecode", - "evm.methodIdentifiers", - "metadata", - "devdoc", - "userdoc", - "storageLayout", - "evm.gasEstimates" - ], - "": ["ast"] - } - }, - "metadata": { - "useLiteralContent": true - } - } -} diff --git a/deployments/rinkeby/solcInputs/c8b9349311d8b5049b613ac98eb998d0.json b/deployments/rinkeby/solcInputs/c8b9349311d8b5049b613ac98eb998d0.json new file mode 100644 index 000000000..dfb09219e --- /dev/null +++ b/deployments/rinkeby/solcInputs/c8b9349311d8b5049b613ac98eb998d0.json @@ -0,0 +1,198 @@ +{ + "language": "Solidity", + "sources": { + "contracts/Arbitrum_SpokePool.sol": { + "content": "// SPDX-License-Identifier: GPL-3.0-only\npragma solidity ^0.8.0;\n\nimport \"./SpokePool.sol\";\n\ninterface StandardBridgeLike {\n function outboundTransfer(\n address _l1Token,\n address _to,\n uint256 _amount,\n bytes calldata _data\n ) external payable returns (bytes memory);\n}\n\n/**\n * @notice AVM specific SpokePool. Uses AVM cross-domain-enabled logic to implement admin only access to functions.\n */\ncontract Arbitrum_SpokePool is SpokePool {\n // Address of the Arbitrum L2 token gateway to send funds to L1.\n address public l2GatewayRouter;\n\n // Admin controlled mapping of arbitrum tokens to L1 counterpart. L1 counterpart addresses\n // are necessary params used when bridging tokens to L1.\n mapping(address => address) public whitelistedTokens;\n\n event ArbitrumTokensBridged(address indexed l1Token, address target, uint256 numberOfTokensBridged);\n event SetL2GatewayRouter(address indexed newL2GatewayRouter);\n event WhitelistedTokens(address indexed l2Token, address indexed l1Token);\n\n /**\n * @notice Construct the AVM SpokePool.\n * @param _l2GatewayRouter Address of L2 token gateway. Can be reset by admin.\n * @param _crossDomainAdmin Cross domain admin to set. Can be changed by admin.\n * @param _hubPool Hub pool address to set. Can be changed by admin.\n * @param _wethAddress Weth address for this network to set.\n * @param timerAddress Timer address to set.\n */\n constructor(\n address _l2GatewayRouter,\n address _crossDomainAdmin,\n address _hubPool,\n address _wethAddress,\n address timerAddress\n ) SpokePool(_crossDomainAdmin, _hubPool, _wethAddress, timerAddress) {\n _setL2GatewayRouter(_l2GatewayRouter);\n }\n\n modifier onlyFromCrossDomainAdmin() {\n require(msg.sender == _applyL1ToL2Alias(crossDomainAdmin), \"ONLY_COUNTERPART_GATEWAY\");\n _;\n }\n\n /********************************************************\n * ARBITRUM-SPECIFIC CROSS-CHAIN ADMIN FUNCTIONS *\n ********************************************************/\n\n /**\n * @notice Change L2 gateway router. Callable only by admin.\n * @param newL2GatewayRouter New L2 gateway router.\n */\n function setL2GatewayRouter(address newL2GatewayRouter) public onlyAdmin nonReentrant {\n _setL2GatewayRouter(newL2GatewayRouter);\n }\n\n /**\n * @notice Add L2 -> L1 token mapping. Callable only by admin.\n * @param l2Token Arbitrum token.\n * @param l1Token Ethereum version of l2Token.\n */\n function whitelistToken(address l2Token, address l1Token) public onlyAdmin nonReentrant {\n _whitelistToken(l2Token, l1Token);\n }\n\n /**************************************\n * INTERNAL FUNCTIONS *\n **************************************/\n\n function _bridgeTokensToHubPool(RelayerRefundLeaf memory relayerRefundLeaf) internal override {\n // Check that the Ethereum counterpart of the L2 token is stored on this contract.\n address ethereumTokenToBridge = whitelistedTokens[relayerRefundLeaf.l2TokenAddress];\n require(ethereumTokenToBridge != address(0), \"Uninitialized mainnet token\");\n StandardBridgeLike(l2GatewayRouter).outboundTransfer(\n ethereumTokenToBridge, // _l1Token. Address of the L1 token to bridge over.\n hubPool, // _to. Withdraw, over the bridge, to the l1 hub pool contract.\n relayerRefundLeaf.amountToReturn, // _amount.\n \"\" // _data. We don't need to send any data for the bridging action.\n );\n emit ArbitrumTokensBridged(address(0), hubPool, relayerRefundLeaf.amountToReturn);\n }\n\n function _setL2GatewayRouter(address _l2GatewayRouter) internal {\n l2GatewayRouter = _l2GatewayRouter;\n emit SetL2GatewayRouter(l2GatewayRouter);\n }\n\n function _whitelistToken(address _l2Token, address _l1Token) internal {\n whitelistedTokens[_l2Token] = _l1Token;\n emit WhitelistedTokens(_l2Token, _l1Token);\n }\n\n // L1 addresses are transformed during l1->l2 calls.\n // See https://developer.offchainlabs.com/docs/l1_l2_messages#address-aliasing for more information.\n // This cannot be pulled directly from Arbitrum contracts because their contracts are not 0.8.X compatible and\n // this operation takes advantage of overflows, whose behavior changed in 0.8.0.\n function _applyL1ToL2Alias(address l1Address) internal pure returns (address l2Address) {\n // Allows overflows as explained above.\n unchecked {\n l2Address = address(uint160(l1Address) + uint160(0x1111000000000000000000000000000000001111));\n }\n }\n\n // Apply AVM-specific transformation to cross domain admin address on L1.\n function _requireAdminSender() internal override onlyFromCrossDomainAdmin {}\n}\n" + }, + "contracts/SpokePool.sol": { + "content": "// SPDX-License-Identifier: GPL-3.0-only\npragma solidity ^0.8.0;\n\nimport \"./MerkleLib.sol\";\nimport \"./interfaces/WETH9.sol\";\nimport \"./Lockable.sol\";\nimport \"./SpokePoolInterface.sol\";\n\nimport \"@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol\";\nimport \"@openzeppelin/contracts/token/ERC20/IERC20.sol\";\nimport \"@openzeppelin/contracts/utils/Address.sol\";\n\nimport \"@openzeppelin/contracts/utils/cryptography/ECDSA.sol\";\nimport \"@uma/core/contracts/common/implementation/Testable.sol\";\nimport \"@uma/core/contracts/common/implementation/MultiCaller.sol\";\n\n/**\n * @title SpokePool\n * @notice Base contract deployed on source and destination chains enabling depositors to transfer assets from source to\n * destination. Deposit orders are fulfilled by off-chain relayers who also interact with this contract. Deposited\n * tokens are locked on the source chain and relayers send the recipient the desired token currency and amount\n * on the destination chain. Locked source chain tokens are later sent over the canonical token bridge to L1 HubPool.\n * Relayers are refunded with destination tokens out of this contract after another off-chain actor, a \"data worker\",\n * submits a proof that the relayer correctly submitted a relay on this SpokePool.\n */\nabstract contract SpokePool is SpokePoolInterface, Testable, Lockable, MultiCaller {\n using SafeERC20 for IERC20;\n using Address for address;\n\n // Address of the L1 contract that acts as the owner of this SpokePool. If this contract is deployed on Ethereum,\n // then this address should be set to the same owner as the HubPool and the whole system.\n address public crossDomainAdmin;\n\n // Address of the L1 contract that will send tokens to and receive tokens from this contract to fund relayer\n // refunds and slow relays.\n address public hubPool;\n\n // Address of WETH contract for this network. If an origin token matches this, then the caller can optionally\n // instruct this contract to wrap ETH when depositing.\n WETH9 public immutable weth;\n\n // Any deposit quote times greater than or less than this value to the current contract time is blocked. Forces\n // caller to use an approximately \"current\" realized fee. Defaults to 10 minutes.\n uint32 public depositQuoteTimeBuffer = 600;\n\n // Count of deposits is used to construct a unique deposit identifier for this spoke pool.\n uint32 public numberOfDeposits;\n\n // Origin token to destination token routings can be turned on or off, which can enable or disable deposits.\n\n mapping(address => mapping(uint256 => bool)) public enabledDepositRoutes;\n\n // This contract can store as many root bundles as the HubPool chooses to publish here.\n RootBundle[] public rootBundles;\n\n // Each relay is associated with the hash of parameters that uniquely identify the original deposit and a relay\n // attempt for that deposit. The relay itself is just represented as the amount filled so far. The total amount to\n // relay, the fees, and the agents are all parameters included in the hash key.\n mapping(bytes32 => uint256) public relayFills;\n\n /****************************************\n * EVENTS *\n ****************************************/\n event SetXDomainAdmin(address indexed newAdmin);\n event SetHubPool(address indexed newHubPool);\n event EnabledDepositRoute(address indexed originToken, uint256 indexed destinationChainId, bool enabled);\n event SetDepositQuoteTimeBuffer(uint32 newBuffer);\n event FundsDeposited(\n uint256 amount,\n uint256 originChainId,\n uint256 destinationChainId,\n uint64 relayerFeePct,\n uint32 indexed depositId,\n uint32 quoteTimestamp,\n address indexed originToken,\n address recipient,\n address indexed depositor\n );\n event RequestedSpeedUpDeposit(\n uint64 newRelayerFeePct,\n uint32 indexed depositId,\n address indexed depositor,\n bytes depositorSignature\n );\n event FilledRelay(\n bytes32 indexed relayHash,\n uint256 amount,\n uint256 totalFilledAmount,\n uint256 fillAmount,\n uint256 repaymentChainId,\n uint256 originChainId,\n uint256 destinationChainId,\n uint64 relayerFeePct,\n uint64 realizedLpFeePct,\n uint32 depositId,\n address destinationToken,\n address indexed relayer,\n address indexed depositor,\n address recipient,\n bool isSlowRelay\n );\n event RelayedRootBundle(uint32 indexed rootBundleId, bytes32 relayerRefundRoot, bytes32 slowRelayRoot);\n event ExecutedRelayerRefundRoot(\n uint256 amountToReturn,\n uint256 indexed chainId,\n uint256[] refundAmounts,\n uint32 indexed rootBundleId,\n uint32 indexed leafId,\n address l2TokenAddress,\n address[] refundAddresses,\n address caller\n );\n event TokensBridged(\n uint256 amountToReturn,\n uint256 indexed chainId,\n uint32 indexed leafId,\n address indexed l2TokenAddress,\n address caller\n );\n event EmergencyDeleteRootBundle(uint256 indexed rootBundleId);\n\n /**\n * @notice Construct the base SpokePool.\n * @param _crossDomainAdmin Cross domain admin to set. Can be changed by admin.\n * @param _hubPool Hub pool address to set. Can be changed by admin.\n * @param _wethAddress Weth address for this network to set.\n * @param timerAddress Timer address to set.\n */\n constructor(\n address _crossDomainAdmin,\n address _hubPool,\n address _wethAddress,\n address timerAddress\n ) Testable(timerAddress) {\n _setCrossDomainAdmin(_crossDomainAdmin);\n _setHubPool(_hubPool);\n weth = WETH9(_wethAddress);\n }\n\n /****************************************\n * MODIFIERS *\n ****************************************/\n\n // Implementing contract needs to override _requireAdminSender() to ensure that admin functions are protected\n // appropriately.\n modifier onlyAdmin() {\n _requireAdminSender();\n _;\n }\n\n /**************************************\n * ADMIN FUNCTIONS *\n **************************************/\n\n /**\n * @notice Change cross domain admin address. Callable by admin only.\n * @param newCrossDomainAdmin New cross domain admin.\n */\n function setCrossDomainAdmin(address newCrossDomainAdmin) public override onlyAdmin nonReentrant {\n _setCrossDomainAdmin(newCrossDomainAdmin);\n }\n\n /**\n * @notice Change L1 hub pool address. Callable by admin only.\n * @param newHubPool New hub pool.\n */\n function setHubPool(address newHubPool) public override onlyAdmin nonReentrant {\n _setHubPool(newHubPool);\n }\n\n /**\n * @notice Enable/Disable an origin token => destination chain ID route for deposits. Callable by admin only.\n * @param originToken Token that depositor can deposit to this contract.\n * @param destinationChainId Chain ID for where depositor wants to receive funds.\n * @param enabled True to enable deposits, False otherwise.\n */\n function setEnableRoute(\n address originToken,\n uint256 destinationChainId,\n bool enabled\n ) public override onlyAdmin nonReentrant {\n enabledDepositRoutes[originToken][destinationChainId] = enabled;\n emit EnabledDepositRoute(originToken, destinationChainId, enabled);\n }\n\n /**\n * @notice Change allowance for deposit quote time to differ from current block time. Callable by admin only.\n * @param newDepositQuoteTimeBuffer New quote time buffer.\n */\n function setDepositQuoteTimeBuffer(uint32 newDepositQuoteTimeBuffer) public override onlyAdmin nonReentrant {\n depositQuoteTimeBuffer = newDepositQuoteTimeBuffer;\n emit SetDepositQuoteTimeBuffer(newDepositQuoteTimeBuffer);\n }\n\n /**\n * @notice This method stores a new root bundle in this contract that can be executed to refund relayers, fulfill\n * slow relays, and send funds back to the HubPool on L1. This method can only be called by the admin and is\n * designed to be called as part of a cross-chain message from the HubPool's executeRootBundle method.\n * @param relayerRefundRoot Merkle root containing relayer refund leaves that can be individually executed via\n * executeRelayerRefundRoot().\n * @param slowRelayRoot Merkle root containing slow relay fulfillment leaves that can be individually executed via\n * executeSlowRelayRoot().\n */\n function relayRootBundle(bytes32 relayerRefundRoot, bytes32 slowRelayRoot) public override onlyAdmin nonReentrant {\n uint32 rootBundleId = uint32(rootBundles.length);\n RootBundle storage rootBundle = rootBundles.push();\n rootBundle.relayerRefundRoot = relayerRefundRoot;\n rootBundle.slowRelayRoot = slowRelayRoot;\n emit RelayedRootBundle(rootBundleId, relayerRefundRoot, slowRelayRoot);\n }\n\n /**\n * @notice This method is intended to only be used in emergencies where a bad root bundle has reached the\n * SpokePool.\n * @param rootBundleId Index of the root bundle that needs to be deleted. Note: this is intentionally a uint256\n * to ensure that a small input range doesn't limit which indices this method is able to reach.\n */\n function emergencyDeleteRootBundle(uint256 rootBundleId) public override onlyAdmin nonReentrant {\n delete rootBundles[rootBundleId];\n emit EmergencyDeleteRootBundle(rootBundleId);\n }\n\n /**************************************\n * DEPOSITOR FUNCTIONS *\n **************************************/\n\n /**\n * @notice Called by user to bridge funds from origin to destination chain. Depositor will effectively lock\n * tokens in this contract and receive a destination token on the destination chain. The origin => destination\n * token mapping is stored on the L1 HubPool.\n * @notice The caller must first approve this contract to spend amount of originToken.\n * @notice The originToken => destinationChainId must be enabled.\n * @notice This method is payable because the caller is able to deposit ETH if the originToken is WETH and this\n * function will handle wrapping ETH.\n * @param recipient Address to receive funds at on destination chain.\n * @param originToken Token to lock into this contract to initiate deposit.\n * @param amount Amount of tokens to deposit. Will be amount of tokens to receive less fees.\n * @param destinationChainId Denotes network where user will receive funds from SpokePool by a relayer.\n * @param relayerFeePct % of deposit amount taken out to incentivize a fast relayer.\n * @param quoteTimestamp Timestamp used by relayers to compute this deposit's realizedLPFeePct which is paid\n * to LP pool on HubPool.\n */\n function deposit(\n address recipient,\n address originToken,\n uint256 amount,\n uint256 destinationChainId,\n uint64 relayerFeePct,\n uint32 quoteTimestamp\n ) public payable override nonReentrant {\n // Check that deposit route is enabled.\n require(enabledDepositRoutes[originToken][destinationChainId], \"Disabled route\");\n\n // We limit the relay fees to prevent the user spending all their funds on fees.\n require(relayerFeePct < 0.5e18, \"invalid relayer fee\");\n // This function assumes that L2 timing cannot be compared accurately and consistently to L1 timing. Therefore,\n // block.timestamp is different from the L1 EVM's. Therefore, the quoteTimestamp must be within a configurable\n // buffer of this contract's block time to allow for this variance.\n // Note also that quoteTimestamp cannot be less than the buffer otherwise the following arithmetic can result\n // in underflow. This isn't a problem as the deposit will revert, but the error might be unexpected for clients.\n require(\n getCurrentTime() >= quoteTimestamp - depositQuoteTimeBuffer &&\n getCurrentTime() <= quoteTimestamp + depositQuoteTimeBuffer,\n \"invalid quote time\"\n );\n // If the address of the origin token is a WETH contract and there is a msg.value with the transaction\n // then the user is sending ETH. In this case, the ETH should be deposited to WETH.\n if (originToken == address(weth) && msg.value > 0) {\n require(msg.value == amount, \"msg.value must match amount\");\n weth.deposit{ value: msg.value }();\n // Else, it is a normal ERC20. In this case pull the token from the user's wallet as per normal.\n // Note: this includes the case where the L2 user has WETH (already wrapped ETH) and wants to bridge them.\n // In this case the msg.value will be set to 0, indicating a \"normal\" ERC20 bridging action.\n } else IERC20(originToken).safeTransferFrom(msg.sender, address(this), amount);\n\n _emitDeposit(\n amount,\n chainId(),\n destinationChainId,\n relayerFeePct,\n numberOfDeposits,\n quoteTimestamp,\n originToken,\n recipient,\n msg.sender\n );\n\n // Increment count of deposits so that deposit ID for this spoke pool is unique.\n numberOfDeposits += 1;\n }\n\n /**\n * @notice Convenience method that depositor can use to signal to relayer to use updated fee.\n * @notice Relayer should only use events emitted by this function to submit fills with updated fees, otherwise they\n * risk their fills getting disputed for being invalid, for example if the depositor never actually signed the\n * update fee message.\n * @notice This function will revert if the depositor did not sign a message containing the updated fee for the\n * deposit ID stored in this contract. If the deposit ID is for another contract, or the depositor address is\n * incorrect, or the updated fee is incorrect, then the signature will not match and this function will revert.\n * @param depositor Signer of the update fee message who originally submitted the deposit. If the deposit doesn't\n * exist, then the relayer will not be able to fill any relay, so the caller should validate that the depositor\n * did in fact submit a relay.\n * @param newRelayerFeePct New relayer fee that relayers can use.\n * @param depositId Deposit to update fee for that originated in this contract.\n * @param depositorSignature Signed message containing the depositor address, this contract chain ID, the updated\n * relayer fee %, and the deposit ID. This signature is produced by signing a hash of data according to the\n * EIP-191 standard. See more in the _verifyUpdateRelayerFeeMessage() comments.\n */\n function speedUpDeposit(\n address depositor,\n uint64 newRelayerFeePct,\n uint32 depositId,\n bytes memory depositorSignature\n ) public override nonReentrant {\n require(newRelayerFeePct < 0.5e18, \"invalid relayer fee\");\n\n _verifyUpdateRelayerFeeMessage(depositor, chainId(), newRelayerFeePct, depositId, depositorSignature);\n\n // Assuming the above checks passed, a relayer can take the signature and the updated relayer fee information\n // from the following event to submit a fill with an updated fee %.\n emit RequestedSpeedUpDeposit(newRelayerFeePct, depositId, depositor, depositorSignature);\n }\n\n /**************************************\n * RELAYER FUNCTIONS *\n **************************************/\n\n /**\n * @notice Called by relayer to fulfill part of a deposit by sending destination tokens to the recipient.\n * Relayer is expected to pass in unique identifying information for deposit that they want to fulfill, and this\n * relay submission will be validated by off-chain data workers who can dispute this relay if any part is invalid.\n * If the relay is valid, then the relayer will be refunded on their desired repayment chain. If relay is invalid,\n * then relayer will not receive any refund.\n * @notice All of the deposit data can be found via on-chain events from the origin SpokePool, except for the\n * realizedLpFeePct which is a function of the HubPool's utilization at the deposit quote time. This fee %\n * is deterministic based on the quote time, so the relayer should just compute it using the canonical algorithm\n * as described in a UMIP linked to the HubPool's identifier.\n * @param depositor Depositor on origin chain who set this chain as the destination chain.\n * @param recipient Specified recipient on this chain.\n * @param destinationToken Token to send to recipient. Should be mapped to the origin token, origin chain ID\n * and this chain ID via a mapping on the HubPool.\n * @param amount Full size of the deposit.\n * @param maxTokensToSend Max amount of tokens to send recipient. If higher than amount, then caller will\n * send recipient the full relay amount.\n * @param repaymentChainId Chain of SpokePool where relayer wants to be refunded after the challenge window has\n * passed.\n * @param originChainId Chain of SpokePool where deposit originated.\n * @param realizedLpFeePct Fee % based on L1 HubPool utilization at deposit quote time. Deterministic based on\n * quote time.\n * @param relayerFeePct Fee % to keep as relayer, specified by depositor.\n * @param depositId Unique deposit ID on origin spoke pool.\n */\n function fillRelay(\n address depositor,\n address recipient,\n address destinationToken,\n uint256 amount,\n uint256 maxTokensToSend,\n uint256 repaymentChainId,\n uint256 originChainId,\n uint64 realizedLpFeePct,\n uint64 relayerFeePct,\n uint32 depositId\n ) public nonReentrant {\n // Each relay attempt is mapped to the hash of data uniquely identifying it, which includes the deposit data\n // such as the origin chain ID and the deposit ID, and the data in a relay attempt such as who the recipient\n // is, which chain and currency the recipient wants to receive funds on, and the relay fees.\n SpokePoolInterface.RelayData memory relayData = SpokePoolInterface.RelayData({\n depositor: depositor,\n recipient: recipient,\n destinationToken: destinationToken,\n amount: amount,\n realizedLpFeePct: realizedLpFeePct,\n relayerFeePct: relayerFeePct,\n depositId: depositId,\n originChainId: originChainId,\n destinationChainId: chainId()\n });\n bytes32 relayHash = _getRelayHash(relayData);\n\n uint256 fillAmountPreFees = _fillRelay(relayHash, relayData, maxTokensToSend, relayerFeePct, false);\n\n _emitFillRelay(relayHash, fillAmountPreFees, repaymentChainId, relayerFeePct, relayData, false);\n }\n\n /**\n * @notice Called by relayer to execute same logic as calling fillRelay except that relayer is using an updated\n * relayer fee %. The fee % must have been emitted in a message cryptographically signed by the depositor.\n * @notice By design, the depositor probably emitted the message with the updated fee by calling speedUpRelay().\n * @param depositor Depositor on origin chain who set this chain as the destination chain.\n * @param recipient Specified recipient on this chain.\n * @param destinationToken Token to send to recipient. Should be mapped to the origin token, origin chain ID\n * and this chain ID via a mapping on the HubPool.\n * @param amount Full size of the deposit.\n * @param maxTokensToSend Max amount of tokens to send recipient. If higher than amount, then caller will\n * send recipient the full relay amount.\n * @param repaymentChainId Chain of SpokePool where relayer wants to be refunded after the challenge window has\n * passed.\n * @param originChainId Chain of SpokePool where deposit originated.\n * @param realizedLpFeePct Fee % based on L1 HubPool utilization at deposit quote time. Deterministic based on\n * quote time.\n * @param relayerFeePct Original fee % to keep as relayer set by depositor.\n * @param newRelayerFeePct New fee % to keep as relayer also specified by depositor.\n * @param depositId Unique deposit ID on origin spoke pool.\n * @param depositorSignature Depositor-signed message containing updated fee %.\n */\n function fillRelayWithUpdatedFee(\n address depositor,\n address recipient,\n address destinationToken,\n uint256 amount,\n uint256 maxTokensToSend,\n uint256 repaymentChainId,\n uint256 originChainId,\n uint64 realizedLpFeePct,\n uint64 relayerFeePct,\n uint64 newRelayerFeePct,\n uint32 depositId,\n bytes memory depositorSignature\n ) public override nonReentrant {\n _verifyUpdateRelayerFeeMessage(depositor, originChainId, newRelayerFeePct, depositId, depositorSignature);\n\n // Now follow the default fillRelay flow with the updated fee and the original relay hash.\n RelayData memory relayData = RelayData({\n depositor: depositor,\n recipient: recipient,\n destinationToken: destinationToken,\n amount: amount,\n realizedLpFeePct: realizedLpFeePct,\n relayerFeePct: relayerFeePct,\n depositId: depositId,\n originChainId: originChainId,\n destinationChainId: chainId()\n });\n bytes32 relayHash = _getRelayHash(relayData);\n uint256 fillAmountPreFees = _fillRelay(relayHash, relayData, maxTokensToSend, newRelayerFeePct, false);\n\n _emitFillRelay(relayHash, fillAmountPreFees, repaymentChainId, newRelayerFeePct, relayData, false);\n }\n\n /**************************************\n * DATA WORKER FUNCTIONS *\n **************************************/\n\n /**\n * @notice Executes a slow relay leaf stored as part of a root bundle. Will send the full amount remaining in the\n * relay to the recipient, less fees.\n * @dev This function assumes that the relay's destination chain ID is the current chain ID, which prevents\n * the caller from executing a slow relay intended for another chain on this chain.\n * @param depositor Depositor on origin chain who set this chain as the destination chain.\n * @param recipient Specified recipient on this chain.\n * @param destinationToken Token to send to recipient. Should be mapped to the origin token, origin chain ID\n * and this chain ID via a mapping on the HubPool.\n * @param amount Full size of the deposit.\n * @param originChainId Chain of SpokePool where deposit originated.\n * @param realizedLpFeePct Fee % based on L1 HubPool utilization at deposit quote time. Deterministic based on\n * quote time.\n * @param relayerFeePct Original fee % to keep as relayer set by depositor.\n * @param depositId Unique deposit ID on origin spoke pool.\n * @param rootBundleId Unique ID of root bundle containing slow relay root that this leaf is contained in.\n * @param proof Inclusion proof for this leaf in slow relay root in root bundle.\n */\n function executeSlowRelayRoot(\n address depositor,\n address recipient,\n address destinationToken,\n uint256 amount,\n uint256 originChainId,\n uint64 realizedLpFeePct,\n uint64 relayerFeePct,\n uint32 depositId,\n uint32 rootBundleId,\n bytes32[] memory proof\n ) public virtual override nonReentrant {\n _executeSlowRelayRoot(\n depositor,\n recipient,\n destinationToken,\n amount,\n originChainId,\n chainId(),\n realizedLpFeePct,\n relayerFeePct,\n depositId,\n rootBundleId,\n proof\n );\n }\n\n /**\n * @notice Executes a relayer refund leaf stored as part of a root bundle. Will send the relayer the amount they\n * sent to the recipient plus a relayer fee.\n * @param rootBundleId Unique ID of root bundle containing relayer refund root that this leaf is contained in.\n * @param relayerRefundLeaf Contains all data necessary to reconstruct leaf contained in root bundle and to\n * refund relayer. This data structure is explained in detail in the SpokePoolInterface.\n * @param proof Inclusion proof for this leaf in relayer refund root in root bundle.\n */\n function executeRelayerRefundRoot(\n uint32 rootBundleId,\n SpokePoolInterface.RelayerRefundLeaf memory relayerRefundLeaf,\n bytes32[] memory proof\n ) public virtual override nonReentrant {\n _executeRelayerRefundRoot(rootBundleId, relayerRefundLeaf, proof);\n }\n\n /**************************************\n * VIEW FUNCTIONS *\n **************************************/\n\n /**\n * @notice Returns chain ID for this network.\n * @dev Some L2s like ZKSync don't support the CHAIN_ID opcode so we allow the implementer to override this.\n */\n function chainId() public view virtual override returns (uint256) {\n return block.chainid;\n }\n\n /**************************************\n * INTERNAL FUNCTIONS *\n **************************************/\n\n // Verifies inclusion proof of leaf in root, sends relayer their refund, and sends to HubPool any rebalance\n // transfers.\n function _executeRelayerRefundRoot(\n uint32 rootBundleId,\n SpokePoolInterface.RelayerRefundLeaf memory relayerRefundLeaf,\n bytes32[] memory proof\n ) internal {\n // Check integrity of leaf structure:\n require(relayerRefundLeaf.chainId == chainId(), \"Invalid chainId\");\n require(relayerRefundLeaf.refundAddresses.length == relayerRefundLeaf.refundAmounts.length, \"invalid leaf\");\n\n RootBundle storage rootBundle = rootBundles[rootBundleId];\n\n // Check that inclusionProof proves that relayerRefundLeaf is contained within the relayer refund root.\n // Note: This should revert if the relayerRefundRoot is uninitialized.\n require(MerkleLib.verifyRelayerRefund(rootBundle.relayerRefundRoot, relayerRefundLeaf, proof), \"Bad Proof\");\n\n // Verify the leafId in the leaf has not yet been claimed.\n require(!MerkleLib.isClaimed(rootBundle.claimedBitmap, relayerRefundLeaf.leafId), \"Already claimed\");\n\n // Set leaf as claimed in bitmap. This is passed by reference to the storage rootBundle.\n MerkleLib.setClaimed(rootBundle.claimedBitmap, relayerRefundLeaf.leafId);\n\n // Send each relayer refund address the associated refundAmount for the L2 token address.\n // Note: Even if the L2 token is not enabled on this spoke pool, we should still refund relayers.\n for (uint32 i = 0; i < relayerRefundLeaf.refundAmounts.length; i++) {\n uint256 amount = relayerRefundLeaf.refundAmounts[i];\n if (amount > 0)\n IERC20(relayerRefundLeaf.l2TokenAddress).safeTransfer(relayerRefundLeaf.refundAddresses[i], amount);\n }\n\n // If leaf's amountToReturn is positive, then send L2 --> L1 message to bridge tokens back via\n // chain-specific bridging method.\n if (relayerRefundLeaf.amountToReturn > 0) {\n _bridgeTokensToHubPool(relayerRefundLeaf);\n\n emit TokensBridged(\n relayerRefundLeaf.amountToReturn,\n relayerRefundLeaf.chainId,\n relayerRefundLeaf.leafId,\n relayerRefundLeaf.l2TokenAddress,\n msg.sender\n );\n }\n\n emit ExecutedRelayerRefundRoot(\n relayerRefundLeaf.amountToReturn,\n relayerRefundLeaf.chainId,\n relayerRefundLeaf.refundAmounts,\n rootBundleId,\n relayerRefundLeaf.leafId,\n relayerRefundLeaf.l2TokenAddress,\n relayerRefundLeaf.refundAddresses,\n msg.sender\n );\n }\n\n // Verifies inclusion proof of leaf in root and sends recipient remainder of relay. Marks relay as filled.\n function _executeSlowRelayRoot(\n address depositor,\n address recipient,\n address destinationToken,\n uint256 amount,\n uint256 originChainId,\n uint256 destinationChainId,\n uint64 realizedLpFeePct,\n uint64 relayerFeePct,\n uint32 depositId,\n uint32 rootBundleId,\n bytes32[] memory proof\n ) internal {\n RelayData memory relayData = RelayData({\n depositor: depositor,\n recipient: recipient,\n destinationToken: destinationToken,\n amount: amount,\n originChainId: originChainId,\n destinationChainId: destinationChainId,\n realizedLpFeePct: realizedLpFeePct,\n relayerFeePct: relayerFeePct,\n depositId: depositId\n });\n\n require(\n MerkleLib.verifySlowRelayFulfillment(rootBundles[rootBundleId].slowRelayRoot, relayData, proof),\n \"Invalid proof\"\n );\n\n bytes32 relayHash = _getRelayHash(relayData);\n\n // Note: use relayAmount as the max amount to send, so the relay is always completely filled by the contract's\n // funds in all cases. As this is a slow relay we set the relayerFeePct to 0. This effectively refunds the\n // relayer component of the relayerFee thereby only charging the depositor the LpFee.\n uint256 fillAmountPreFees = _fillRelay(relayHash, relayData, relayData.amount, 0, true);\n\n // Note: Set repayment chain ID to 0 to indicate that there is no repayment to be made. The off-chain data\n // worker can use repaymentChainId=0 as a signal to ignore such relays for refunds. Also, set the relayerFeePct\n // to 0 as slow relays do not pay the caller of this method (depositor is refunded this fee).\n _emitFillRelay(relayHash, fillAmountPreFees, 0, 0, relayData, true);\n }\n\n function _setCrossDomainAdmin(address newCrossDomainAdmin) internal {\n require(newCrossDomainAdmin != address(0), \"Bad bridge router address\");\n crossDomainAdmin = newCrossDomainAdmin;\n emit SetXDomainAdmin(crossDomainAdmin);\n }\n\n function _setHubPool(address newHubPool) internal {\n require(newHubPool != address(0), \"Bad hub pool address\");\n hubPool = newHubPool;\n emit SetHubPool(hubPool);\n }\n\n // Should be overriden by implementing contract depending on how L2 handles sending tokens to L1.\n function _bridgeTokensToHubPool(SpokePoolInterface.RelayerRefundLeaf memory relayerRefundLeaf) internal virtual;\n\n function _verifyUpdateRelayerFeeMessage(\n address depositor,\n uint256 originChainId,\n uint64 newRelayerFeePct,\n uint32 depositId,\n bytes memory depositorSignature\n ) internal view {\n // A depositor can request to speed up an un-relayed deposit by signing a hash containing the relayer\n // fee % to update to and information uniquely identifying the deposit to relay. This information ensures\n // that this signature cannot be re-used for other deposits. The version string is included as a precaution\n // in case this contract is upgraded.\n // Note: we use encode instead of encodePacked because it is more secure, more in the \"warning\" section\n // here: https://docs.soliditylang.org/en/v0.8.11/abi-spec.html#non-standard-packed-mode\n bytes32 expectedDepositorMessageHash = keccak256(\n abi.encode(\"ACROSS-V2-FEE-1.0\", newRelayerFeePct, depositId, originChainId)\n );\n\n // Check the hash corresponding to the https://eth.wiki/json-rpc/API#eth_sign[eth_sign]\n // If the depositor signed a message with a different updated fee (or any other param included in the\n // above keccak156 hash), then this will revert.\n bytes32 ethSignedMessageHash = ECDSA.toEthSignedMessageHash(expectedDepositorMessageHash);\n\n _verifyDepositorUpdateFeeMessage(depositor, ethSignedMessageHash, depositorSignature);\n }\n\n // This function is isolated and made virtual to allow different L2's to implement chain specific recovery of\n // signers from signatures because some L2s might not support ecrecover. To be safe, consider always reverting\n // this function for L2s where ecrecover is different from how it works on Ethereum, otherwise there is the\n // potential to forge a signature from the depositor using a different private key than the original depositor's.\n function _verifyDepositorUpdateFeeMessage(\n address depositor,\n bytes32 ethSignedMessageHash,\n bytes memory depositorSignature\n ) internal view virtual {\n // Note: We purposefully do not support EIP-191 signatures (meaning that multisigs and smart contract wallets\n // like Argent are not supported) because of the possibility that a multisig that signed a message on the origin\n // chain does not have a parallel on this destination chain.\n require(depositor == ECDSA.recover(ethSignedMessageHash, depositorSignature), \"invalid signature\");\n }\n\n function _computeAmountPreFees(uint256 amount, uint64 feesPct) private pure returns (uint256) {\n return (1e18 * amount) / (1e18 - feesPct);\n }\n\n function _computeAmountPostFees(uint256 amount, uint64 feesPct) private pure returns (uint256) {\n return (amount * (1e18 - feesPct)) / 1e18;\n }\n\n function _getRelayHash(SpokePoolInterface.RelayData memory relayData) private pure returns (bytes32) {\n return keccak256(abi.encode(relayData));\n }\n\n // Unwraps ETH and does a transfer to a recipient address. If the recipient is a smart contract then sends WETH.\n function _unwrapWETHTo(address payable to, uint256 amount) internal {\n if (address(to).isContract()) {\n IERC20(address(weth)).safeTransfer(to, amount);\n } else {\n weth.withdraw(amount);\n to.transfer(amount);\n }\n }\n\n /**\n * @notice Caller specifies the max amount of tokens to send to user. Based on this amount and the amount of the\n * relay remaining (as stored in the relayFills mapping), pull the amount of tokens from the caller\n * and send to the recipient.\n * @dev relayFills keeps track of pre-fee fill amounts as a convenience to relayers who want to specify round\n * numbers for the maxTokensToSend parameter or convenient numbers like 100 (i.e. relayers who will fully\n * fill any relay up to 100 tokens, and partial fill with 100 tokens for larger relays).\n * @dev Caller must approve this contract to transfer up to maxTokensToSend of the relayData.destinationToken.\n * The amount to be sent might end up less if there is insufficient relay amount remaining to be sent.\n */\n function _fillRelay(\n bytes32 relayHash,\n RelayData memory relayData,\n uint256 maxTokensToSend,\n uint64 updatableRelayerFeePct,\n bool useContractFunds\n ) internal returns (uint256 fillAmountPreFees) {\n // We limit the relay fees to prevent the user spending all their funds on fees. Note that 0.5e18 (i.e. 50%)\n // fees are just magic numbers. The important point is to prevent the total fee from being 100%, otherwise\n // computing the amount pre fees runs into divide-by-0 issues.\n require(updatableRelayerFeePct < 0.5e18 && relayData.realizedLpFeePct < 0.5e18, \"invalid fees\");\n\n // Check that the relay has not already been completely filled. Note that the relays mapping will point to\n // the amount filled so far for a particular relayHash, so this will start at 0 and increment with each fill.\n require(relayFills[relayHash] < relayData.amount, \"relay filled\");\n\n // Stores the equivalent amount to be sent by the relayer before fees have been taken out.\n if (maxTokensToSend == 0) return 0;\n\n // Derive the amount of the relay filled if the caller wants to send exactly maxTokensToSend tokens to\n // the recipient. For example, if the user wants to send 10 tokens to the recipient, the full relay amount\n // is 100, and the fee %'s total 5%, then this computation would return ~10.5, meaning that to fill 10.5/100\n // of the full relay size, the caller would need to send 10 tokens to the user.\n fillAmountPreFees = _computeAmountPreFees(\n maxTokensToSend,\n (relayData.realizedLpFeePct + updatableRelayerFeePct)\n );\n // If user's specified max amount to send is greater than the amount of the relay remaining pre-fees,\n // we'll pull exactly enough tokens to complete the relay.\n uint256 amountToSend = maxTokensToSend;\n uint256 amountRemainingInRelay = relayData.amount - relayFills[relayHash];\n if (amountRemainingInRelay < fillAmountPreFees) {\n fillAmountPreFees = amountRemainingInRelay;\n\n // The user will fulfill the remainder of the relay, so we need to compute exactly how many tokens post-fees\n // that they need to send to the recipient. Note that if the relayer is filled using contract funds then\n // this is a slow relay.\n amountToSend = _computeAmountPostFees(\n fillAmountPreFees,\n relayData.realizedLpFeePct + updatableRelayerFeePct\n );\n }\n\n // relayFills keeps track of pre-fee fill amounts as a convenience to relayers who want to specify round\n // numbers for the maxTokensToSend parameter or convenient numbers like 100 (i.e. relayers who will fully\n // fill any relay up to 100 tokens, and partial fill with 100 tokens for larger relays).\n relayFills[relayHash] += fillAmountPreFees;\n\n // If relay token is weth then unwrap and send eth.\n if (relayData.destinationToken == address(weth)) {\n // Note: useContractFunds is True if we want to send funds to the recipient directly out of this contract,\n // otherwise we expect the caller to send funds to the recipient. If useContractFunds is True and the\n // recipient wants WETH, then we can assume that WETH is already in the contract, otherwise we'll need the\n // the user to send WETH to this contract. Regardless, we'll need to unwrap it before sending to the user.\n if (!useContractFunds)\n IERC20(relayData.destinationToken).safeTransferFrom(msg.sender, address(this), amountToSend);\n _unwrapWETHTo(payable(relayData.recipient), amountToSend);\n // Else, this is a normal ERC20 token. Send to recipient.\n } else {\n // Note: Similar to note above, send token directly from the contract to the user in the slow relay case.\n if (!useContractFunds)\n IERC20(relayData.destinationToken).safeTransferFrom(msg.sender, relayData.recipient, amountToSend);\n else IERC20(relayData.destinationToken).safeTransfer(relayData.recipient, amountToSend);\n }\n }\n\n // The following internal methods emit events with many params to overcome solidity stack too deep issues.\n function _emitFillRelay(\n bytes32 relayHash,\n uint256 fillAmount,\n uint256 repaymentChainId,\n uint64 relayerFeePct,\n RelayData memory relayData,\n bool isSlowRelay\n ) internal {\n emit FilledRelay(\n relayHash,\n relayData.amount,\n relayFills[relayHash],\n fillAmount,\n repaymentChainId,\n relayData.originChainId,\n relayData.destinationChainId,\n relayerFeePct,\n relayData.realizedLpFeePct,\n relayData.depositId,\n relayData.destinationToken,\n msg.sender,\n relayData.depositor,\n relayData.recipient,\n isSlowRelay\n );\n }\n\n function _emitDeposit(\n uint256 amount,\n uint256 originChainId,\n uint256 destinationChainId,\n uint64 relayerFeePct,\n uint32 depositId,\n uint32 quoteTimestamp,\n address originToken,\n address recipient,\n address depositor\n ) internal {\n emit FundsDeposited(\n amount,\n originChainId,\n destinationChainId,\n relayerFeePct,\n depositId,\n quoteTimestamp,\n originToken,\n recipient,\n depositor\n );\n }\n\n // Implementing contract needs to override this to ensure that only the appropriate cross chain admin can execute\n // certain admin functions. For L2 contracts, the cross chain admin refers to some L1 address or contract, and for\n // L1, this would just be the same admin of the HubPool.\n function _requireAdminSender() internal virtual;\n\n // Added to enable the this contract to receive ETH. Used when unwrapping Weth.\n receive() external payable {}\n}\n" + }, + "contracts/MerkleLib.sol": { + "content": "// SPDX-License-Identifier: GPL-3.0-only\npragma solidity ^0.8.0;\n\nimport \"./SpokePoolInterface.sol\";\nimport \"./HubPoolInterface.sol\";\n\nimport \"@openzeppelin/contracts/utils/cryptography/MerkleProof.sol\";\n\n/**\n * @notice Library to help with merkle roots, proofs, and claims.\n */\nlibrary MerkleLib {\n /**\n * @notice Verifies that a repayment is contained within a merkle root.\n * @param root the merkle root.\n * @param rebalance the rebalance struct.\n * @param proof the merkle proof.\n * @return bool to signal if the pool rebalance proof correctly shows inclusion of the rebalance within the tree.\n */\n function verifyPoolRebalance(\n bytes32 root,\n HubPoolInterface.PoolRebalanceLeaf memory rebalance,\n bytes32[] memory proof\n ) internal pure returns (bool) {\n return MerkleProof.verify(proof, root, keccak256(abi.encode(rebalance)));\n }\n\n /**\n * @notice Verifies that a relayer refund is contained within a merkle root.\n * @param root the merkle root.\n * @param refund the refund struct.\n * @param proof the merkle proof.\n * @return bool to signal if the relayer refund proof correctly shows inclusion of the refund within the tree.\n */\n function verifyRelayerRefund(\n bytes32 root,\n SpokePoolInterface.RelayerRefundLeaf memory refund,\n bytes32[] memory proof\n ) internal pure returns (bool) {\n return MerkleProof.verify(proof, root, keccak256(abi.encode(refund)));\n }\n\n /**\n * @notice Verifies that a distribution is contained within a merkle root.\n * @param root the merkle root.\n * @param slowRelayFulfillment the relayData fulfillment struct.\n * @param proof the merkle proof.\n * @return bool to signal if the slow relay's proof correctly shows inclusion of the slow relay within the tree.\n */\n function verifySlowRelayFulfillment(\n bytes32 root,\n SpokePoolInterface.RelayData memory slowRelayFulfillment,\n bytes32[] memory proof\n ) internal pure returns (bool) {\n return MerkleProof.verify(proof, root, keccak256(abi.encode(slowRelayFulfillment)));\n }\n\n // The following functions are primarily copied from\n // https://github.com/Uniswap/merkle-distributor/blob/master/contracts/MerkleDistributor.sol with minor changes.\n\n /**\n * @notice Tests whether a claim is contained within a claimedBitMap mapping.\n * @param claimedBitMap a simple uint256 mapping in storage used as a bitmap.\n * @param index the index to check in the bitmap.\n * @return bool indicating if the index within the claimedBitMap has been marked as claimed.\n */\n function isClaimed(mapping(uint256 => uint256) storage claimedBitMap, uint256 index) internal view returns (bool) {\n uint256 claimedWordIndex = index / 256;\n uint256 claimedBitIndex = index % 256;\n uint256 claimedWord = claimedBitMap[claimedWordIndex];\n uint256 mask = (1 << claimedBitIndex);\n return claimedWord & mask == mask;\n }\n\n /**\n * @notice Marks an index in a claimedBitMap as claimed.\n * @param claimedBitMap a simple uint256 mapping in storage used as a bitmap.\n * @param index the index to mark in the bitmap.\n */\n function setClaimed(mapping(uint256 => uint256) storage claimedBitMap, uint256 index) internal {\n uint256 claimedWordIndex = index / 256;\n uint256 claimedBitIndex = index % 256;\n claimedBitMap[claimedWordIndex] = claimedBitMap[claimedWordIndex] | (1 << claimedBitIndex);\n }\n\n /**\n * @notice Tests whether a claim is contained within a 1D claimedBitMap mapping.\n * @param claimedBitMap a simple uint256 value, encoding a 1D bitmap.\n * @param index the index to check in the bitmap. Uint8 type enforces that index can't be > 255.\n * @return bool indicating if the index within the claimedBitMap has been marked as claimed.\n */\n function isClaimed1D(uint256 claimedBitMap, uint8 index) internal pure returns (bool) {\n uint256 mask = (1 << index);\n return claimedBitMap & mask == mask;\n }\n\n /**\n * @notice Marks an index in a claimedBitMap as claimed.\n * @param claimedBitMap a simple uint256 mapping in storage used as a bitmap. Uint8 type enforces that index\n * can't be > 255.\n * @param index the index to mark in the bitmap.\n * @return uint256 representing the modified input claimedBitMap with the index set to true.\n */\n function setClaimed1D(uint256 claimedBitMap, uint8 index) internal pure returns (uint256) {\n return claimedBitMap | (1 << index % 256);\n }\n}\n" + }, + "contracts/interfaces/WETH9.sol": { + "content": "// SPDX-License-Identifier: GPL-3.0-only\npragma solidity ^0.8.0;\n\ninterface WETH9 {\n function withdraw(uint256 wad) external;\n\n function deposit() external payable;\n\n function balanceOf(address guy) external view returns (uint256 wad);\n\n function transfer(address guy, uint256 wad) external;\n}\n" + }, + "contracts/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 * @dev The reason why we use this local contract instead of importing from uma/contracts is because of the addition\n * of the internal method `functionCallStackOriginatesFromOutsideThisContract` which doesn't exist in the one exported\n * by uma/contracts.\n */\ncontract Lockable {\n bool internal _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 /**\n * @dev Returns true if the contract is currently in a non-entered state, meaning that the origination of the call\n * came from outside the contract. This is relevant with fallback/receive methods to see if the call came from ETH\n * being dropped onto the contract externally or due to ETH dropped on the the contract from within a method in this\n * contract, such as unwrapping WETH to ETH within the contract.\n */\n function functionCallStackOriginatesFromOutsideThisContract() internal view returns (bool) {\n return _notEntered;\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" + }, + "contracts/SpokePoolInterface.sol": { + "content": "// SPDX-License-Identifier: GPL-3.0-only\npragma solidity ^0.8.0;\n\n/**\n * @notice Contains common data structures and functions used by all SpokePool implementations.\n */\ninterface SpokePoolInterface {\n // This leaf is meant to be decoded in the SpokePool to pay out successful relayers.\n struct RelayerRefundLeaf {\n // This is the amount to return to the HubPool. This occurs when there is a PoolRebalanceLeaf netSendAmount that\n // is negative. This is just the negative of this value.\n uint256 amountToReturn;\n // Used to verify that this is being executed on the correct destination chainId.\n uint256 chainId;\n // This array designates how much each of those addresses should be refunded.\n uint256[] refundAmounts;\n // Used as the index in the bitmap to track whether this leaf has been executed or not.\n uint32 leafId;\n // The associated L2TokenAddress that these claims apply to.\n address l2TokenAddress;\n // Must be same length as refundAmounts and designates each address that must be refunded.\n address[] refundAddresses;\n }\n\n // This struct represents the data to fully specify a relay. If any portion of this data differs, the relay is\n // considered to be completely distinct. Only one relay for a particular depositId, chainId pair should be\n // considered valid and repaid. This data is hashed and inserted into the slow relay merkle root so that an off\n // chain validator can choose when to refund slow relayers.\n struct RelayData {\n // The address that made the deposit on the origin chain.\n address depositor;\n // The recipient address on the destination chain.\n address recipient;\n // The corresponding token address on the destination chain.\n address destinationToken;\n // The total relay amount before fees are taken out.\n uint256 amount;\n // Origin chain id.\n uint256 originChainId;\n // Destination chain id.\n uint256 destinationChainId;\n // The LP Fee percentage computed by the relayer based on the deposit's quote timestamp\n // and the HubPool's utilization.\n uint64 realizedLpFeePct;\n // The relayer fee percentage specified in the deposit.\n uint64 relayerFeePct;\n // The id uniquely identifying this deposit on the origin chain.\n uint32 depositId;\n }\n\n // Stores collection of merkle roots that can be published to this contract from the HubPool, which are referenced\n // by \"data workers\" via inclusion proofs to execute leaves in the roots.\n struct RootBundle {\n // Merkle root of slow relays that were not fully filled and whose recipient is still owed funds from the LP pool.\n bytes32 slowRelayRoot;\n // Merkle root of relayer refunds for successful relays.\n bytes32 relayerRefundRoot;\n // This is a 2D bitmap tracking which leaves in the relayer refund root have been claimed, with max size of\n // 256x256 leaves per root.\n mapping(uint256 => uint256) claimedBitmap;\n }\n\n function setCrossDomainAdmin(address newCrossDomainAdmin) external;\n\n function setHubPool(address newHubPool) external;\n\n function setEnableRoute(\n address originToken,\n uint256 destinationChainId,\n bool enable\n ) external;\n\n function setDepositQuoteTimeBuffer(uint32 buffer) external;\n\n function relayRootBundle(bytes32 relayerRefundRoot, bytes32 slowRelayRoot) external;\n\n function emergencyDeleteRootBundle(uint256 rootBundleId) external;\n\n function deposit(\n address recipient,\n address originToken,\n uint256 amount,\n uint256 destinationChainId,\n uint64 relayerFeePct,\n uint32 quoteTimestamp\n ) external payable;\n\n function speedUpDeposit(\n address depositor,\n uint64 newRelayerFeePct,\n uint32 depositId,\n bytes memory depositorSignature\n ) external;\n\n function fillRelay(\n address depositor,\n address recipient,\n address destinationToken,\n uint256 amount,\n uint256 maxTokensToSend,\n uint256 repaymentChainId,\n uint256 originChainId,\n uint64 realizedLpFeePct,\n uint64 relayerFeePct,\n uint32 depositId\n ) external;\n\n function fillRelayWithUpdatedFee(\n address depositor,\n address recipient,\n address destinationToken,\n uint256 amount,\n uint256 maxTokensToSend,\n uint256 repaymentChainId,\n uint256 originChainId,\n uint64 realizedLpFeePct,\n uint64 relayerFeePct,\n uint64 newRelayerFeePct,\n uint32 depositId,\n bytes memory depositorSignature\n ) external;\n\n function executeSlowRelayRoot(\n address depositor,\n address recipient,\n address destinationToken,\n uint256 amount,\n uint256 originChainId,\n uint64 realizedLpFeePct,\n uint64 relayerFeePct,\n uint32 depositId,\n uint32 rootBundleId,\n bytes32[] memory proof\n ) external;\n\n function executeRelayerRefundRoot(\n uint32 rootBundleId,\n SpokePoolInterface.RelayerRefundLeaf memory relayerRefundLeaf,\n bytes32[] memory proof\n ) external;\n\n function chainId() external view returns (uint256);\n}\n" + }, + "@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts v4.4.1 (token/ERC20/utils/SafeERC20.sol)\n\npragma solidity ^0.8.0;\n\nimport \"../IERC20.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 function safeTransfer(\n IERC20 token,\n address to,\n uint256 value\n ) internal {\n _callOptionalReturn(token, abi.encodeWithSelector(token.transfer.selector, to, value));\n }\n\n function safeTransferFrom(\n IERC20 token,\n address from,\n address to,\n uint256 value\n ) 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(\n IERC20 token,\n address spender,\n uint256 value\n ) 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 function safeIncreaseAllowance(\n IERC20 token,\n address spender,\n uint256 value\n ) internal {\n uint256 newAllowance = token.allowance(address(this), spender) + value;\n _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, newAllowance));\n }\n\n function safeDecreaseAllowance(\n IERC20 token,\n address spender,\n uint256 value\n ) internal {\n unchecked {\n uint256 oldAllowance = token.allowance(address(this), spender);\n require(oldAllowance >= value, \"SafeERC20: decreased allowance below zero\");\n uint256 newAllowance = oldAllowance - value;\n _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, newAllowance));\n }\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 if (returndata.length > 0) {\n // Return data is optional\n require(abi.decode(returndata, (bool)), \"SafeERC20: ERC20 operation did not succeed\");\n }\n }\n}\n" + }, + "@openzeppelin/contracts/token/ERC20/IERC20.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.5.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 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(\n address from,\n address to,\n uint256 amount\n ) external returns (bool);\n\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" + }, + "@openzeppelin/contracts/utils/Address.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.5.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 *\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://diligence.consensys.net/posts/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.5.11/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 functionCall(target, data, \"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(\n address target,\n bytes memory data,\n uint256 value\n ) 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 require(isContract(target), \"Address: call to non-contract\");\n\n (bool success, bytes memory returndata) = target.call{value: value}(data);\n return verifyCallResult(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 require(isContract(target), \"Address: static call to non-contract\");\n\n (bool success, bytes memory returndata) = target.staticcall(data);\n return verifyCallResult(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 require(isContract(target), \"Address: delegate call to non-contract\");\n\n (bool success, bytes memory returndata) = target.delegatecall(data);\n return verifyCallResult(success, returndata, errorMessage);\n }\n\n /**\n * @dev Tool to verifies that a low level call was successful, and revert if it wasn't, either by bubbling the\n * revert reason 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 // 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\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}\n" + }, + "@openzeppelin/contracts/utils/cryptography/ECDSA.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.5.0) (utils/cryptography/ECDSA.sol)\n\npragma solidity ^0.8.0;\n\nimport \"../Strings.sol\";\n\n/**\n * @dev Elliptic Curve Digital Signature Algorithm (ECDSA) operations.\n *\n * These functions can be used to verify that a message was signed by the holder\n * of the private keys of a given address.\n */\nlibrary ECDSA {\n enum RecoverError {\n NoError,\n InvalidSignature,\n InvalidSignatureLength,\n InvalidSignatureS,\n InvalidSignatureV\n }\n\n function _throwError(RecoverError error) private pure {\n if (error == RecoverError.NoError) {\n return; // no error: do nothing\n } else if (error == RecoverError.InvalidSignature) {\n revert(\"ECDSA: invalid signature\");\n } else if (error == RecoverError.InvalidSignatureLength) {\n revert(\"ECDSA: invalid signature length\");\n } else if (error == RecoverError.InvalidSignatureS) {\n revert(\"ECDSA: invalid signature 's' value\");\n } else if (error == RecoverError.InvalidSignatureV) {\n revert(\"ECDSA: invalid signature 'v' value\");\n }\n }\n\n /**\n * @dev Returns the address that signed a hashed message (`hash`) with\n * `signature` or error string. This address can then be used for verification purposes.\n *\n * The `ecrecover` EVM opcode allows for malleable (non-unique) signatures:\n * this function rejects them by requiring the `s` value to be in the lower\n * half order, and the `v` value to be either 27 or 28.\n *\n * IMPORTANT: `hash` _must_ be the result of a hash operation for the\n * verification to be secure: it is possible to craft signatures that\n * recover to arbitrary addresses for non-hashed data. A safe way to ensure\n * this is by receiving a hash of the original message (which may otherwise\n * be too long), and then calling {toEthSignedMessageHash} on it.\n *\n * Documentation for signature generation:\n * - with https://web3js.readthedocs.io/en/v1.3.4/web3-eth-accounts.html#sign[Web3.js]\n * - with https://docs.ethers.io/v5/api/signer/#Signer-signMessage[ethers]\n *\n * _Available since v4.3._\n */\n function tryRecover(bytes32 hash, bytes memory signature) internal pure returns (address, RecoverError) {\n // Check the signature length\n // - case 65: r,s,v signature (standard)\n // - case 64: r,vs signature (cf https://eips.ethereum.org/EIPS/eip-2098) _Available since v4.1._\n if (signature.length == 65) {\n bytes32 r;\n bytes32 s;\n uint8 v;\n // ecrecover takes the signature parameters, and the only way to get them\n // currently is to use assembly.\n assembly {\n r := mload(add(signature, 0x20))\n s := mload(add(signature, 0x40))\n v := byte(0, mload(add(signature, 0x60)))\n }\n return tryRecover(hash, v, r, s);\n } else if (signature.length == 64) {\n bytes32 r;\n bytes32 vs;\n // ecrecover takes the signature parameters, and the only way to get them\n // currently is to use assembly.\n assembly {\n r := mload(add(signature, 0x20))\n vs := mload(add(signature, 0x40))\n }\n return tryRecover(hash, r, vs);\n } else {\n return (address(0), RecoverError.InvalidSignatureLength);\n }\n }\n\n /**\n * @dev Returns the address that signed a hashed message (`hash`) with\n * `signature`. This address can then be used for verification purposes.\n *\n * The `ecrecover` EVM opcode allows for malleable (non-unique) signatures:\n * this function rejects them by requiring the `s` value to be in the lower\n * half order, and the `v` value to be either 27 or 28.\n *\n * IMPORTANT: `hash` _must_ be the result of a hash operation for the\n * verification to be secure: it is possible to craft signatures that\n * recover to arbitrary addresses for non-hashed data. A safe way to ensure\n * this is by receiving a hash of the original message (which may otherwise\n * be too long), and then calling {toEthSignedMessageHash} on it.\n */\n function recover(bytes32 hash, bytes memory signature) internal pure returns (address) {\n (address recovered, RecoverError error) = tryRecover(hash, signature);\n _throwError(error);\n return recovered;\n }\n\n /**\n * @dev Overload of {ECDSA-tryRecover} that receives the `r` and `vs` short-signature fields separately.\n *\n * See https://eips.ethereum.org/EIPS/eip-2098[EIP-2098 short signatures]\n *\n * _Available since v4.3._\n */\n function tryRecover(\n bytes32 hash,\n bytes32 r,\n bytes32 vs\n ) internal pure returns (address, RecoverError) {\n bytes32 s = vs & bytes32(0x7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff);\n uint8 v = uint8((uint256(vs) >> 255) + 27);\n return tryRecover(hash, v, r, s);\n }\n\n /**\n * @dev Overload of {ECDSA-recover} that receives the `r and `vs` short-signature fields separately.\n *\n * _Available since v4.2._\n */\n function recover(\n bytes32 hash,\n bytes32 r,\n bytes32 vs\n ) internal pure returns (address) {\n (address recovered, RecoverError error) = tryRecover(hash, r, vs);\n _throwError(error);\n return recovered;\n }\n\n /**\n * @dev Overload of {ECDSA-tryRecover} that receives the `v`,\n * `r` and `s` signature fields separately.\n *\n * _Available since v4.3._\n */\n function tryRecover(\n bytes32 hash,\n uint8 v,\n bytes32 r,\n bytes32 s\n ) internal pure returns (address, RecoverError) {\n // EIP-2 still allows signature malleability for ecrecover(). Remove this possibility and make the signature\n // unique. Appendix F in the Ethereum Yellow paper (https://ethereum.github.io/yellowpaper/paper.pdf), defines\n // the valid range for s in (301): 0 < s < secp256k1n ÷ 2 + 1, and for v in (302): v ∈ {27, 28}. Most\n // signatures from current libraries generate a unique signature with an s-value in the lower half order.\n //\n // If your library generates malleable signatures, such as s-values in the upper range, calculate a new s-value\n // with 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFEBAAEDCE6AF48A03BBFD25E8CD0364141 - s1 and flip v from 27 to 28 or\n // vice versa. If your library also generates signatures with 0/1 for v instead 27/28, add 27 to v to accept\n // these malleable signatures as well.\n if (uint256(s) > 0x7FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF5D576E7357A4501DDFE92F46681B20A0) {\n return (address(0), RecoverError.InvalidSignatureS);\n }\n if (v != 27 && v != 28) {\n return (address(0), RecoverError.InvalidSignatureV);\n }\n\n // If the signature is valid (and not malleable), return the signer address\n address signer = ecrecover(hash, v, r, s);\n if (signer == address(0)) {\n return (address(0), RecoverError.InvalidSignature);\n }\n\n return (signer, RecoverError.NoError);\n }\n\n /**\n * @dev Overload of {ECDSA-recover} that receives the `v`,\n * `r` and `s` signature fields separately.\n */\n function recover(\n bytes32 hash,\n uint8 v,\n bytes32 r,\n bytes32 s\n ) internal pure returns (address) {\n (address recovered, RecoverError error) = tryRecover(hash, v, r, s);\n _throwError(error);\n return recovered;\n }\n\n /**\n * @dev Returns an Ethereum Signed Message, created from a `hash`. This\n * produces hash corresponding to the one signed with the\n * https://eth.wiki/json-rpc/API#eth_sign[`eth_sign`]\n * JSON-RPC method as part of EIP-191.\n *\n * See {recover}.\n */\n function toEthSignedMessageHash(bytes32 hash) internal pure returns (bytes32) {\n // 32 is the length in bytes of hash,\n // enforced by the type signature above\n return keccak256(abi.encodePacked(\"\\x19Ethereum Signed Message:\\n32\", hash));\n }\n\n /**\n * @dev Returns an Ethereum Signed Message, created from `s`. This\n * produces hash corresponding to the one signed with the\n * https://eth.wiki/json-rpc/API#eth_sign[`eth_sign`]\n * JSON-RPC method as part of EIP-191.\n *\n * See {recover}.\n */\n function toEthSignedMessageHash(bytes memory s) internal pure returns (bytes32) {\n return keccak256(abi.encodePacked(\"\\x19Ethereum Signed Message:\\n\", Strings.toString(s.length), s));\n }\n\n /**\n * @dev Returns an Ethereum Signed Typed Data, created from a\n * `domainSeparator` and a `structHash`. This produces hash corresponding\n * to the one signed with the\n * https://eips.ethereum.org/EIPS/eip-712[`eth_signTypedData`]\n * JSON-RPC method as part of EIP-712.\n *\n * See {recover}.\n */\n function toTypedDataHash(bytes32 domainSeparator, bytes32 structHash) internal pure returns (bytes32) {\n return keccak256(abi.encodePacked(\"\\x19\\x01\", domainSeparator, structHash));\n }\n}\n" + }, + "@uma/core/contracts/common/implementation/Testable.sol": { + "content": "// SPDX-License-Identifier: AGPL-3.0-only\npragma solidity ^0.8.0;\n\nimport \"./Timer.sol\";\n\n/**\n * @title Base class that provides time overrides, but only if being run in test mode.\n */\nabstract contract Testable {\n // If the contract is being run in production, then `timerAddress` will be the 0x0 address.\n // Note: this variable should be set on construction and never modified.\n address public timerAddress;\n\n /**\n * @notice Constructs the Testable contract. Called by child contracts.\n * @param _timerAddress Contract that stores the current time in a testing environment.\n * Must be set to 0x0 for production environments that use live time.\n */\n constructor(address _timerAddress) {\n timerAddress = _timerAddress;\n }\n\n /**\n * @notice Reverts if not running in test mode.\n */\n modifier onlyIfTest {\n require(timerAddress != address(0x0));\n _;\n }\n\n /**\n * @notice Sets the current time.\n * @dev Will revert if not running in test mode.\n * @param time timestamp to set current Testable time to.\n */\n function setCurrentTime(uint256 time) external onlyIfTest {\n Timer(timerAddress).setCurrentTime(time);\n }\n\n /**\n * @notice Gets the current time. Will return the last time set in `setCurrentTime` if running in test mode.\n * Otherwise, it will return the block timestamp.\n * @return uint for the current Testable timestamp.\n */\n function getCurrentTime() public view virtual returns (uint256) {\n if (timerAddress != address(0x0)) {\n return Timer(timerAddress).getCurrentTime();\n } else {\n return block.timestamp; // solhint-disable-line not-rely-on-time\n }\n }\n}\n" + }, + "@uma/core/contracts/common/implementation/MultiCaller.sol": { + "content": "// This contract is taken from Uniswaps'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.\npragma solidity ^0.8.0;\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 payable returns (bytes[] memory results) {\n require(msg.value == 0, \"Only multicall with 0 value\");\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/HubPoolInterface.sol": { + "content": "// SPDX-License-Identifier: GPL-3.0-only\npragma solidity ^0.8.0;\n\nimport \"./interfaces/AdapterInterface.sol\";\n\nimport \"@openzeppelin/contracts/token/ERC20/IERC20.sol\";\n\n/**\n * @notice Concise list of functions in HubPool implementation.\n */\ninterface HubPoolInterface {\n // This leaf is meant to be decoded in the HubPool to rebalance tokens between HubPool and SpokePool.\n struct PoolRebalanceLeaf {\n // This is used to know which chain to send cross-chain transactions to (and which SpokePool to send to).\n uint256 chainId;\n // Total LP fee amount per token in this bundle, encompassing all associated bundled relays.\n uint256[] bundleLpFees;\n // This array is grouped with the two above, and it represents the amount to send or request back from the\n // SpokePool. If positive, the pool will pay the SpokePool. If negative the SpokePool will pay the HubPool.\n // There can be arbitrarily complex rebalancing rules defined offchain. This number is only nonzero when the\n // rules indicate that a rebalancing action should occur. When a rebalance does occur, runningBalances should be\n // set to zero for this token and the netSendAmounts should be set to the previous runningBalances + relays -\n // deposits in this bundle. If non-zero then it must be set on the SpokePool's RelayerRefundLeaf amountToReturn\n // as -1 * this value to indicate if funds are being sent from or to the SpokePool.\n int256[] netSendAmounts;\n // This is only here to be emitted in an event to track a running unpaid balance between the L2 pool and the L1\n // pool. A positive number indicates that the HubPool owes the SpokePool funds. A negative number indicates that\n // the SpokePool owes the HubPool funds. See the comment above for the dynamics of this and netSendAmounts.\n int256[] runningBalances;\n // Used by data worker to mark which leaves should relay roots to SpokePools, and to otherwise organize leaves.\n // For example, each leaf should contain all the rebalance information for a single chain, but in the case where\n // the list of l1Tokens is very large such that they all can't fit into a single leaf that can be executed under\n // the block gas limit, then the data worker can use this groupIndex to organize them. Any leaves with\n // a groupIndex equal to 0 will relay roots to the SpokePool, so the data worker should ensure that only one\n // leaf for a specific chainId should have a groupIndex equal to 0.\n uint256 groupIndex;\n // Used as the index in the bitmap to track whether this leaf has been executed or not.\n uint8 leafId;\n // The following arrays are required to be the same length. They are parallel arrays for the given chainId and\n // should be ordered by the l1Tokens field. All whitelisted tokens with nonzero relays on this chain in this\n // bundle in the order of whitelisting.\n address[] l1Tokens;\n }\n\n // A data worker can optimistically store several merkle roots on this contract by staking a bond and calling\n // proposeRootBundle. By staking a bond, the data worker is alleging that the merkle roots all contain valid leaves\n // that can be executed later to:\n // - Send funds from this contract to a SpokePool or vice versa\n // - Send funds from a SpokePool to Relayer as a refund for a relayed deposit\n // - Send funds from a SpokePool to a deposit recipient to fulfill a \"slow\" relay\n // Anyone can dispute this struct if the merkle roots contain invalid leaves before the\n // requestExpirationTimestamp. Once the expiration timestamp is passed, executeRootBundle to execute a leaf\n // from the poolRebalanceRoot on this contract and it will simultaneously publish the relayerRefundRoot and\n // slowRelayRoot to a SpokePool. The latter two roots, once published to the SpokePool, contain\n // leaves that can be executed on the SpokePool to pay relayers or recipients.\n struct RootBundle {\n // Contains leaves instructing this contract to send funds to SpokePools.\n bytes32 poolRebalanceRoot;\n // Relayer refund merkle root to be published to a SpokePool.\n bytes32 relayerRefundRoot;\n // Slow relay merkle root to be published to a SpokePool.\n bytes32 slowRelayRoot;\n // This is a 1D bitmap, with max size of 256 elements, limiting us to 256 chainsIds.\n uint256 claimedBitMap;\n // Proposer of this root bundle.\n address proposer;\n // Number of pool rebalance leaves to execute in the poolRebalanceRoot. After this number\n // of leaves are executed, a new root bundle can be proposed\n uint8 unclaimedPoolRebalanceLeafCount;\n // When root bundle challenge period passes and this root bundle becomes executable.\n uint32 requestExpirationTimestamp;\n }\n\n // Each whitelisted L1 token has an associated pooledToken struct that contains all information used to track the\n // cumulative LP positions and if this token is enabled for deposits.\n struct PooledToken {\n // LP token given to LPs of a specific L1 token.\n address lpToken;\n // True if accepting new LP's.\n bool isEnabled;\n // Timestamp of last LP fee update.\n uint32 lastLpFeeUpdate;\n // Number of LP funds sent via pool rebalances to SpokePools and are expected to be sent\n // back later.\n int256 utilizedReserves;\n // Number of LP funds held in contract less utilized reserves.\n uint256 liquidReserves;\n // Number of LP funds reserved to pay out to LPs as fees.\n uint256 undistributedLpFees;\n }\n\n // Helper contracts to facilitate cross chain actions between HubPool and SpokePool for a specific network.\n struct CrossChainContract {\n address adapter;\n address spokePool;\n }\n\n function setPaused(bool pause) external;\n\n function emergencyDeleteProposal() external;\n\n function relaySpokePoolAdminFunction(uint256 chainId, bytes memory functionData) external;\n\n function setProtocolFeeCapture(address newProtocolFeeCaptureAddress, uint256 newProtocolFeeCapturePct) external;\n\n function setBond(IERC20 newBondToken, uint256 newBondAmount) external;\n\n function setLiveness(uint32 newLiveness) external;\n\n function setIdentifier(bytes32 newIdentifier) external;\n\n function setCrossChainContracts(\n uint256 l2ChainId,\n address adapter,\n address spokePool\n ) external;\n\n function enableL1TokenForLiquidityProvision(address l1Token) external;\n\n function disableL1TokenForLiquidityProvision(address l1Token) external;\n\n function addLiquidity(address l1Token, uint256 l1TokenAmount) external payable;\n\n function removeLiquidity(\n address l1Token,\n uint256 lpTokenAmount,\n bool sendEth\n ) external;\n\n function exchangeRateCurrent(address l1Token) external returns (uint256);\n\n function liquidityUtilizationCurrent(address l1Token) external returns (uint256);\n\n function liquidityUtilizationPostRelay(address token, uint256 relayedAmount) external returns (uint256);\n\n function sync(address l1Token) external;\n\n function proposeRootBundle(\n uint256[] memory bundleEvaluationBlockNumbers,\n uint8 poolRebalanceLeafCount,\n bytes32 poolRebalanceRoot,\n bytes32 relayerRefundRoot,\n bytes32 slowRelayRoot\n ) external;\n\n function executeRootBundle(\n uint256 chainId,\n uint256 groupIndex,\n uint256[] memory bundleLpFees,\n int256[] memory netSendAmounts,\n int256[] memory runningBalances,\n uint8 leafId,\n address[] memory l1Tokens,\n bytes32[] memory proof\n ) external;\n\n function disputeRootBundle() external;\n\n function claimProtocolFeesCaptured(address l1Token) external;\n\n function setPoolRebalanceRoute(\n uint256 destinationChainId,\n address l1Token,\n address destinationToken\n ) external;\n\n function setDepositRoute(\n uint256 originChainId,\n uint256 destinationChainId,\n address originToken,\n bool depositsEnabled\n ) external;\n\n function poolRebalanceRoute(uint256 destinationChainId, address l1Token)\n external\n view\n returns (address destinationToken);\n\n function loadEthForL2Calls() external payable;\n}\n" + }, + "@openzeppelin/contracts/utils/cryptography/MerkleProof.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.5.0) (utils/cryptography/MerkleProof.sol)\n\npragma solidity ^0.8.0;\n\n/**\n * @dev These functions deal with verification of Merkle Trees proofs.\n *\n * The proofs can be generated using the JavaScript library\n * https://github.com/miguelmota/merkletreejs[merkletreejs].\n * Note: the hashing algorithm should be keccak256 and pair sorting should be enabled.\n *\n * See `test/utils/cryptography/MerkleProof.test.js` for some examples.\n */\nlibrary MerkleProof {\n /**\n * @dev Returns true if a `leaf` can be proved to be a part of a Merkle tree\n * defined by `root`. For this, a `proof` must be provided, containing\n * sibling hashes on the branch from the leaf to the root of the tree. Each\n * pair of leaves and each pair of pre-images are assumed to be sorted.\n */\n function verify(\n bytes32[] memory proof,\n bytes32 root,\n bytes32 leaf\n ) internal pure returns (bool) {\n return processProof(proof, leaf) == root;\n }\n\n /**\n * @dev Returns the rebuilt hash obtained by traversing a Merklee tree up\n * from `leaf` using `proof`. A `proof` is valid if and only if the rebuilt\n * hash matches the root of the tree. When processing the proof, the pairs\n * of leafs & pre-images are assumed to be sorted.\n *\n * _Available since v4.4._\n */\n function processProof(bytes32[] memory proof, bytes32 leaf) internal pure returns (bytes32) {\n bytes32 computedHash = leaf;\n for (uint256 i = 0; i < proof.length; i++) {\n bytes32 proofElement = proof[i];\n if (computedHash <= proofElement) {\n // Hash(current computed hash + current element of the proof)\n computedHash = _efficientHash(computedHash, proofElement);\n } else {\n // Hash(current element of the proof + current computed hash)\n computedHash = _efficientHash(proofElement, computedHash);\n }\n }\n return computedHash;\n }\n\n function _efficientHash(bytes32 a, bytes32 b) private pure returns (bytes32 value) {\n assembly {\n mstore(0x00, a)\n mstore(0x20, b)\n value := keccak256(0x00, 0x40)\n }\n }\n}\n" + }, + "contracts/interfaces/AdapterInterface.sol": { + "content": "// SPDX-License-Identifier: AGPL-3.0-only\npragma solidity ^0.8.0;\n\n/**\n * @notice Sends cross chain messages and tokens to contracts on a specific L2 network.\n */\n\ninterface AdapterInterface {\n event MessageRelayed(address target, bytes message);\n\n event TokensRelayed(address l1Token, address l2Token, uint256 amount, address to);\n\n function relayMessage(address target, bytes memory message) external payable;\n\n function relayTokens(\n address l1Token,\n address l2Token,\n uint256 amount,\n address to\n ) external payable;\n}\n" + }, + "@openzeppelin/contracts/utils/Strings.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts v4.4.1 (utils/Strings.sol)\n\npragma solidity ^0.8.0;\n\n/**\n * @dev String operations.\n */\nlibrary Strings {\n bytes16 private constant _HEX_SYMBOLS = \"0123456789abcdef\";\n\n /**\n * @dev Converts a `uint256` to its ASCII `string` decimal representation.\n */\n function toString(uint256 value) internal pure returns (string memory) {\n // Inspired by OraclizeAPI's implementation - MIT licence\n // https://github.com/oraclize/ethereum-api/blob/b42146b063c7d6ee1358846c198246239e9360e8/oraclizeAPI_0.4.25.sol\n\n if (value == 0) {\n return \"0\";\n }\n uint256 temp = value;\n uint256 digits;\n while (temp != 0) {\n digits++;\n temp /= 10;\n }\n bytes memory buffer = new bytes(digits);\n while (value != 0) {\n digits -= 1;\n buffer[digits] = bytes1(uint8(48 + uint256(value % 10)));\n value /= 10;\n }\n return string(buffer);\n }\n\n /**\n * @dev Converts a `uint256` to its ASCII `string` hexadecimal representation.\n */\n function toHexString(uint256 value) internal pure returns (string memory) {\n if (value == 0) {\n return \"0x00\";\n }\n uint256 temp = value;\n uint256 length = 0;\n while (temp != 0) {\n length++;\n temp >>= 8;\n }\n return toHexString(value, length);\n }\n\n /**\n * @dev Converts a `uint256` to its ASCII `string` hexadecimal representation with fixed length.\n */\n function toHexString(uint256 value, uint256 length) internal pure returns (string memory) {\n bytes memory buffer = new bytes(2 * length + 2);\n buffer[0] = \"0\";\n buffer[1] = \"x\";\n for (uint256 i = 2 * length + 1; i > 1; --i) {\n buffer[i] = _HEX_SYMBOLS[value & 0xf];\n value >>= 4;\n }\n require(value == 0, \"Strings: hex length insufficient\");\n return string(buffer);\n }\n}\n" + }, + "@uma/core/contracts/common/implementation/Timer.sol": { + "content": "// SPDX-License-Identifier: AGPL-3.0-only\npragma solidity ^0.8.0;\n\n/**\n * @title Universal store of current contract time for testing environments.\n */\ncontract Timer {\n uint256 private currentTime;\n\n constructor() {\n currentTime = block.timestamp; // solhint-disable-line not-rely-on-time\n }\n\n /**\n * @notice Sets the current time.\n * @dev Will revert if not running in test mode.\n * @param time timestamp to set `currentTime` to.\n */\n function setCurrentTime(uint256 time) external {\n currentTime = time;\n }\n\n /**\n * @notice Gets the currentTime variable set in the Timer.\n * @return uint256 for the current Testable timestamp.\n */\n function getCurrentTime() public view returns (uint256) {\n return currentTime;\n }\n}\n" + }, + "contracts/test/MockSpokePool.sol": { + "content": "//SPDX-License-Identifier: Unlicense\npragma solidity ^0.8.0;\n\nimport \"../SpokePool.sol\";\nimport \"../SpokePoolInterface.sol\";\n\n/**\n * @title MockSpokePool\n * @notice Implements abstract contract for testing.\n */\ncontract MockSpokePool is SpokePool {\n uint256 chainId_;\n\n constructor(\n address _crossDomainAdmin,\n address _hubPool,\n address _wethAddress,\n address timerAddress\n ) SpokePool(_crossDomainAdmin, _hubPool, _wethAddress, timerAddress) {}\n\n function _bridgeTokensToHubPool(RelayerRefundLeaf memory relayerRefundLeaf) internal override {}\n\n function _requireAdminSender() internal override {}\n\n function chainId() public view override(SpokePool) returns (uint256) {\n // If chainId_ is set then return it, else do nothing and return the parent chainId().\n return chainId_ == 0 ? super.chainId() : chainId_;\n }\n\n function setChainId(uint256 _chainId) public {\n chainId_ = _chainId;\n }\n}\n" + }, + "contracts/test/MerkleLibTest.sol": { + "content": "// SPDX-License-Identifier: GPL-3.0-only\npragma solidity ^0.8.0;\n\nimport \"../MerkleLib.sol\";\nimport \"../HubPoolInterface.sol\";\nimport \"../SpokePoolInterface.sol\";\n\n/**\n * @notice Contract to test the MerkleLib.\n */\ncontract MerkleLibTest {\n mapping(uint256 => uint256) public claimedBitMap;\n\n uint256 public claimedBitMap1D;\n\n function verifyPoolRebalance(\n bytes32 root,\n HubPoolInterface.PoolRebalanceLeaf memory rebalance,\n bytes32[] memory proof\n ) public pure returns (bool) {\n return MerkleLib.verifyPoolRebalance(root, rebalance, proof);\n }\n\n function verifyRelayerRefund(\n bytes32 root,\n SpokePoolInterface.RelayerRefundLeaf memory refund,\n bytes32[] memory proof\n ) public pure returns (bool) {\n return MerkleLib.verifyRelayerRefund(root, refund, proof);\n }\n\n function verifySlowRelayFulfillment(\n bytes32 root,\n SpokePoolInterface.RelayData memory slowRelayFulfillment,\n bytes32[] memory proof\n ) public pure returns (bool) {\n return MerkleLib.verifySlowRelayFulfillment(root, slowRelayFulfillment, proof);\n }\n\n function isClaimed(uint256 index) public view returns (bool) {\n return MerkleLib.isClaimed(claimedBitMap, index);\n }\n\n function setClaimed(uint256 index) public {\n MerkleLib.setClaimed(claimedBitMap, index);\n }\n\n function isClaimed1D(uint8 index) public view returns (bool) {\n return MerkleLib.isClaimed1D(claimedBitMap1D, index);\n }\n\n function setClaimed1D(uint8 index) public {\n claimedBitMap1D = MerkleLib.setClaimed1D(claimedBitMap1D, index);\n }\n}\n" + }, + "contracts/PolygonTokenBridger.sol": { + "content": "// SPDX-License-Identifier: AGPL-3.0-only\npragma solidity ^0.8.0;\n\nimport \"./Lockable.sol\";\nimport \"./interfaces/WETH9.sol\";\n\nimport \"@openzeppelin/contracts/token/ERC20/IERC20.sol\";\nimport \"@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol\";\n\n// ERC20s (on polygon) compatible with polygon's bridge have a withdraw method.\ninterface PolygonIERC20 is IERC20 {\n function withdraw(uint256 amount) external;\n}\n\ninterface MaticToken {\n function withdraw(uint256 amount) external payable;\n}\n\n/**\n * @notice Contract deployed on Ethereum and Polygon to facilitate token transfers from Polygon to the HubPool and back.\n * @dev Because Polygon only allows withdrawals from a particular address to go to that same address on mainnet, we need to\n * have some sort of contract that can guarantee identical addresses on Polygon and Ethereum. This contract is intended\n * to be completely immutable, so it's guaranteed that the contract on each side is configured identically as long as\n * it is created via create2. create2 is an alternative creation method that uses a different address determination\n * mechanism from normal create.\n * Normal create: address = hash(deployer_address, deployer_nonce)\n * create2: address = hash(0xFF, sender, salt, bytecode)\n * This ultimately allows create2 to generate deterministic addresses that don't depend on the transaction count of the\n * sender.\n */\ncontract PolygonTokenBridger is Lockable {\n using SafeERC20 for PolygonIERC20;\n using SafeERC20 for IERC20;\n\n // Gas token for Polygon.\n MaticToken public constant maticToken = MaticToken(0x0000000000000000000000000000000000001010);\n\n // Should be set to HubPool on Ethereum, or unused on Polygon.\n address public immutable destination;\n\n // WETH contract on Ethereum.\n WETH9 public immutable l1Weth;\n\n /**\n * @notice Constructs Token Bridger contract.\n * @param _destination Where to send tokens to for this network.\n * @param _l1Weth Ethereum WETH address.\n */\n constructor(address _destination, WETH9 _l1Weth) {\n destination = _destination;\n l1Weth = _l1Weth;\n }\n\n /**\n * @notice Called by Polygon SpokePool to send tokens over bridge to contract with the same address as this.\n * @notice The caller of this function must approve this contract to spend amount of token.\n * @param token Token to bridge.\n * @param amount Amount to bridge.\n * @param isWrappedMatic True if token is WMATIC.\n */\n function send(\n PolygonIERC20 token,\n uint256 amount,\n bool isWrappedMatic\n ) public nonReentrant {\n token.safeTransferFrom(msg.sender, address(this), amount);\n\n // In the wMatic case, this unwraps. For other ERC20s, this is the burn/send action.\n token.withdraw(amount);\n\n // This takes the token that was withdrawn and calls withdraw on the \"native\" ERC20.\n if (isWrappedMatic) maticToken.withdraw{ value: amount }(amount);\n }\n\n /**\n * @notice Called by someone to send tokens to the destination, which should be set to the HubPool.\n * @param token Token to send to destination.\n */\n function retrieve(IERC20 token) public nonReentrant {\n token.safeTransfer(destination, token.balanceOf(address(this)));\n }\n\n receive() external payable {\n // Note: this should only happen on the mainnet side where ETH is sent to the contract directly by the bridge.\n if (functionCallStackOriginatesFromOutsideThisContract()) l1Weth.deposit{ value: address(this).balance }();\n }\n}\n" + }, + "contracts/test/PolygonERC20Test.sol": { + "content": "// SPDX-License-Identifier: AGPL-3.0-only\npragma solidity ^0.8.0;\n\nimport \"@uma/core/contracts/common/implementation/ExpandedERC20.sol\";\nimport \"../PolygonTokenBridger.sol\";\n\n/**\n * @notice Simulated Polygon ERC20 for use in testing PolygonTokenBridger.\n */\ncontract PolygonERC20Test is ExpandedERC20, PolygonIERC20 {\n constructor() ExpandedERC20(\"Polygon Test\", \"POLY_TEST\", 18) {}\n\n function withdraw(uint256 amount) public {\n _burn(msg.sender, amount);\n }\n}\n" + }, + "@uma/core/contracts/common/implementation/ExpandedERC20.sol": { + "content": "// SPDX-License-Identifier: AGPL-3.0-only\npragma solidity ^0.8.0;\n\nimport \"@openzeppelin/contracts/token/ERC20/ERC20.sol\";\nimport \"./MultiRole.sol\";\nimport \"../interfaces/ExpandedIERC20.sol\";\n\n/**\n * @title An ERC20 with permissioned burning and minting. The contract deployer will initially\n * be the owner who is capable of adding new roles.\n */\ncontract ExpandedERC20 is ExpandedIERC20, ERC20, MultiRole {\n enum Roles {\n // Can set the minter and burner.\n Owner,\n // Addresses that can mint new tokens.\n Minter,\n // Addresses that can burn tokens that address owns.\n Burner\n }\n\n uint8 _decimals;\n\n /**\n * @notice Constructs the ExpandedERC20.\n * @param _tokenName The name which describes the new token.\n * @param _tokenSymbol The ticker abbreviation of the name. Ideally < 5 chars.\n * @param _tokenDecimals The number of decimals to define token precision.\n */\n constructor(\n string memory _tokenName,\n string memory _tokenSymbol,\n uint8 _tokenDecimals\n ) ERC20(_tokenName, _tokenSymbol) {\n _decimals = _tokenDecimals;\n _createExclusiveRole(uint256(Roles.Owner), uint256(Roles.Owner), msg.sender);\n _createSharedRole(uint256(Roles.Minter), uint256(Roles.Owner), new address[](0));\n _createSharedRole(uint256(Roles.Burner), uint256(Roles.Owner), new address[](0));\n }\n\n function decimals() public view virtual override(ERC20) returns (uint8) {\n return _decimals;\n }\n\n /**\n * @dev Mints `value` tokens to `recipient`, returning true on success.\n * @param recipient address to mint to.\n * @param value amount of tokens to mint.\n * @return True if the mint succeeded, or False.\n */\n function mint(address recipient, uint256 value)\n external\n override\n onlyRoleHolder(uint256(Roles.Minter))\n returns (bool)\n {\n _mint(recipient, value);\n return true;\n }\n\n /**\n * @dev Burns `value` tokens owned by `msg.sender`.\n * @param value amount of tokens to burn.\n */\n function burn(uint256 value) external override onlyRoleHolder(uint256(Roles.Burner)) {\n _burn(msg.sender, value);\n }\n\n /**\n * @dev Burns `value` tokens owned by `recipient`.\n * @param recipient address to burn tokens from.\n * @param value amount of tokens to burn.\n * @return True if the burn succeeded, or False.\n */\n function burnFrom(address recipient, uint256 value)\n external\n override\n onlyRoleHolder(uint256(Roles.Burner))\n returns (bool)\n {\n _burn(recipient, value);\n return true;\n }\n\n /**\n * @notice Add Minter role to account.\n * @dev The caller must have the Owner role.\n * @param account The address to which the Minter role is added.\n */\n function addMinter(address account) external virtual override {\n addMember(uint256(Roles.Minter), account);\n }\n\n /**\n * @notice Add Burner role to account.\n * @dev The caller must have the Owner role.\n * @param account The address to which the Burner role is added.\n */\n function addBurner(address account) external virtual override {\n addMember(uint256(Roles.Burner), account);\n }\n\n /**\n * @notice Reset Owner role to account.\n * @dev The caller must have the Owner role.\n * @param account The new holder of the Owner role.\n */\n function resetOwner(address account) external virtual override {\n resetMember(uint256(Roles.Owner), account);\n }\n}\n" + }, + "@openzeppelin/contracts/token/ERC20/ERC20.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.5.0) (token/ERC20/ERC20.sol)\n\npragma solidity ^0.8.0;\n\nimport \"./IERC20.sol\";\nimport \"./extensions/IERC20Metadata.sol\";\nimport \"../../utils/Context.sol\";\n\n/**\n * @dev Implementation of the {IERC20} interface.\n *\n * This implementation is agnostic to the way tokens are created. This means\n * that a supply mechanism has to be added in a derived contract using {_mint}.\n * For a generic mechanism see {ERC20PresetMinterPauser}.\n *\n * TIP: For a detailed writeup see our guide\n * https://forum.zeppelin.solutions/t/how-to-implement-erc20-supply-mechanisms/226[How\n * to implement supply mechanisms].\n *\n * We have followed general OpenZeppelin Contracts guidelines: functions revert\n * instead returning `false` on failure. This behavior is nonetheless\n * conventional and does not conflict with the expectations of ERC20\n * applications.\n *\n * Additionally, an {Approval} event is emitted on calls to {transferFrom}.\n * This allows applications to reconstruct the allowance for all accounts just\n * by listening to said events. Other implementations of the EIP may not emit\n * these events, as it isn't required by the specification.\n *\n * Finally, the non-standard {decreaseAllowance} and {increaseAllowance}\n * functions have been added to mitigate the well-known issues around setting\n * allowances. See {IERC20-approve}.\n */\ncontract ERC20 is Context, IERC20, IERC20Metadata {\n mapping(address => uint256) private _balances;\n\n mapping(address => mapping(address => uint256)) private _allowances;\n\n uint256 private _totalSupply;\n\n string private _name;\n string private _symbol;\n\n /**\n * @dev Sets the values for {name} and {symbol}.\n *\n * The default value of {decimals} is 18. To select a different value for\n * {decimals} you should overload it.\n *\n * All two of these values are immutable: they can only be set once during\n * construction.\n */\n constructor(string memory name_, string memory symbol_) {\n _name = name_;\n _symbol = symbol_;\n }\n\n /**\n * @dev Returns the name of the token.\n */\n function name() public view virtual override returns (string memory) {\n return _name;\n }\n\n /**\n * @dev Returns the symbol of the token, usually a shorter version of the\n * name.\n */\n function symbol() public view virtual override returns (string memory) {\n return _symbol;\n }\n\n /**\n * @dev Returns the number of decimals used to get its user representation.\n * For example, if `decimals` equals `2`, a balance of `505` tokens should\n * be displayed to a user as `5.05` (`505 / 10 ** 2`).\n *\n * Tokens usually opt for a value of 18, imitating the relationship between\n * Ether and Wei. This is the value {ERC20} uses, unless this function is\n * overridden;\n *\n * NOTE: This information is only used for _display_ purposes: it in\n * no way affects any of the arithmetic of the contract, including\n * {IERC20-balanceOf} and {IERC20-transfer}.\n */\n function decimals() public view virtual override returns (uint8) {\n return 18;\n }\n\n /**\n * @dev See {IERC20-totalSupply}.\n */\n function totalSupply() public view virtual override returns (uint256) {\n return _totalSupply;\n }\n\n /**\n * @dev See {IERC20-balanceOf}.\n */\n function balanceOf(address account) public view virtual override returns (uint256) {\n return _balances[account];\n }\n\n /**\n * @dev See {IERC20-transfer}.\n *\n * Requirements:\n *\n * - `to` cannot be the zero address.\n * - the caller must have a balance of at least `amount`.\n */\n function transfer(address to, uint256 amount) public virtual override returns (bool) {\n address owner = _msgSender();\n _transfer(owner, to, amount);\n return true;\n }\n\n /**\n * @dev See {IERC20-allowance}.\n */\n function allowance(address owner, address spender) public view virtual override returns (uint256) {\n return _allowances[owner][spender];\n }\n\n /**\n * @dev See {IERC20-approve}.\n *\n * NOTE: If `amount` is the maximum `uint256`, the allowance is not updated on\n * `transferFrom`. This is semantically equivalent to an infinite approval.\n *\n * Requirements:\n *\n * - `spender` cannot be the zero address.\n */\n function approve(address spender, uint256 amount) public virtual override returns (bool) {\n address owner = _msgSender();\n _approve(owner, spender, amount);\n return true;\n }\n\n /**\n * @dev See {IERC20-transferFrom}.\n *\n * Emits an {Approval} event indicating the updated allowance. This is not\n * required by the EIP. See the note at the beginning of {ERC20}.\n *\n * NOTE: Does not update the allowance if the current allowance\n * is the maximum `uint256`.\n *\n * Requirements:\n *\n * - `from` and `to` cannot be the zero address.\n * - `from` must have a balance of at least `amount`.\n * - the caller must have allowance for ``from``'s tokens of at least\n * `amount`.\n */\n function transferFrom(\n address from,\n address to,\n uint256 amount\n ) public virtual override returns (bool) {\n address spender = _msgSender();\n _spendAllowance(from, spender, amount);\n _transfer(from, to, amount);\n return true;\n }\n\n /**\n * @dev Atomically increases the allowance granted to `spender` by the caller.\n *\n * This is an alternative to {approve} that can be used as a mitigation for\n * problems described in {IERC20-approve}.\n *\n * Emits an {Approval} event indicating the updated allowance.\n *\n * Requirements:\n *\n * - `spender` cannot be the zero address.\n */\n function increaseAllowance(address spender, uint256 addedValue) public virtual returns (bool) {\n address owner = _msgSender();\n _approve(owner, spender, _allowances[owner][spender] + addedValue);\n return true;\n }\n\n /**\n * @dev Atomically decreases the allowance granted to `spender` by the caller.\n *\n * This is an alternative to {approve} that can be used as a mitigation for\n * problems described in {IERC20-approve}.\n *\n * Emits an {Approval} event indicating the updated allowance.\n *\n * Requirements:\n *\n * - `spender` cannot be the zero address.\n * - `spender` must have allowance for the caller of at least\n * `subtractedValue`.\n */\n function decreaseAllowance(address spender, uint256 subtractedValue) public virtual returns (bool) {\n address owner = _msgSender();\n uint256 currentAllowance = _allowances[owner][spender];\n require(currentAllowance >= subtractedValue, \"ERC20: decreased allowance below zero\");\n unchecked {\n _approve(owner, spender, currentAllowance - subtractedValue);\n }\n\n return true;\n }\n\n /**\n * @dev Moves `amount` of tokens from `sender` to `recipient`.\n *\n * This internal function is equivalent to {transfer}, and can be used to\n * e.g. implement automatic token fees, slashing mechanisms, etc.\n *\n * Emits a {Transfer} event.\n *\n * Requirements:\n *\n * - `from` cannot be the zero address.\n * - `to` cannot be the zero address.\n * - `from` must have a balance of at least `amount`.\n */\n function _transfer(\n address from,\n address to,\n uint256 amount\n ) internal virtual {\n require(from != address(0), \"ERC20: transfer from the zero address\");\n require(to != address(0), \"ERC20: transfer to the zero address\");\n\n _beforeTokenTransfer(from, to, amount);\n\n uint256 fromBalance = _balances[from];\n require(fromBalance >= amount, \"ERC20: transfer amount exceeds balance\");\n unchecked {\n _balances[from] = fromBalance - amount;\n }\n _balances[to] += amount;\n\n emit Transfer(from, to, amount);\n\n _afterTokenTransfer(from, to, amount);\n }\n\n /** @dev Creates `amount` tokens and assigns them to `account`, increasing\n * the total supply.\n *\n * Emits a {Transfer} event with `from` set to the zero address.\n *\n * Requirements:\n *\n * - `account` cannot be the zero address.\n */\n function _mint(address account, uint256 amount) internal virtual {\n require(account != address(0), \"ERC20: mint to the zero address\");\n\n _beforeTokenTransfer(address(0), account, amount);\n\n _totalSupply += amount;\n _balances[account] += amount;\n emit Transfer(address(0), account, amount);\n\n _afterTokenTransfer(address(0), account, amount);\n }\n\n /**\n * @dev Destroys `amount` tokens from `account`, reducing the\n * total supply.\n *\n * Emits a {Transfer} event with `to` set to the zero address.\n *\n * Requirements:\n *\n * - `account` cannot be the zero address.\n * - `account` must have at least `amount` tokens.\n */\n function _burn(address account, uint256 amount) internal virtual {\n require(account != address(0), \"ERC20: burn from the zero address\");\n\n _beforeTokenTransfer(account, address(0), amount);\n\n uint256 accountBalance = _balances[account];\n require(accountBalance >= amount, \"ERC20: burn amount exceeds balance\");\n unchecked {\n _balances[account] = accountBalance - amount;\n }\n _totalSupply -= amount;\n\n emit Transfer(account, address(0), amount);\n\n _afterTokenTransfer(account, address(0), amount);\n }\n\n /**\n * @dev Sets `amount` as the allowance of `spender` over the `owner` s tokens.\n *\n * This internal function is equivalent to `approve`, and can be used to\n * e.g. set automatic allowances for certain subsystems, etc.\n *\n * Emits an {Approval} event.\n *\n * Requirements:\n *\n * - `owner` cannot be the zero address.\n * - `spender` cannot be the zero address.\n */\n function _approve(\n address owner,\n address spender,\n uint256 amount\n ) internal virtual {\n require(owner != address(0), \"ERC20: approve from the zero address\");\n require(spender != address(0), \"ERC20: approve to the zero address\");\n\n _allowances[owner][spender] = amount;\n emit Approval(owner, spender, amount);\n }\n\n /**\n * @dev Spend `amount` form the allowance of `owner` toward `spender`.\n *\n * Does not update the allowance amount in case of infinite allowance.\n * Revert if not enough allowance is available.\n *\n * Might emit an {Approval} event.\n */\n function _spendAllowance(\n address owner,\n address spender,\n uint256 amount\n ) internal virtual {\n uint256 currentAllowance = allowance(owner, spender);\n if (currentAllowance != type(uint256).max) {\n require(currentAllowance >= amount, \"ERC20: insufficient allowance\");\n unchecked {\n _approve(owner, spender, currentAllowance - amount);\n }\n }\n }\n\n /**\n * @dev Hook that is called before any transfer of tokens. This includes\n * minting and burning.\n *\n * Calling conditions:\n *\n * - when `from` and `to` are both non-zero, `amount` of ``from``'s tokens\n * will be transferred to `to`.\n * - when `from` is zero, `amount` tokens will be minted for `to`.\n * - when `to` is zero, `amount` of ``from``'s tokens will be burned.\n * - `from` and `to` are never both zero.\n *\n * To learn more about hooks, head to xref:ROOT:extending-contracts.adoc#using-hooks[Using Hooks].\n */\n function _beforeTokenTransfer(\n address from,\n address to,\n uint256 amount\n ) internal virtual {}\n\n /**\n * @dev Hook that is called after any transfer of tokens. This includes\n * minting and burning.\n *\n * Calling conditions:\n *\n * - when `from` and `to` are both non-zero, `amount` of ``from``'s tokens\n * has been transferred to `to`.\n * - when `from` is zero, `amount` tokens have been minted for `to`.\n * - when `to` is zero, `amount` of ``from``'s tokens have been burned.\n * - `from` and `to` are never both zero.\n *\n * To learn more about hooks, head to xref:ROOT:extending-contracts.adoc#using-hooks[Using Hooks].\n */\n function _afterTokenTransfer(\n address from,\n address to,\n uint256 amount\n ) internal virtual {}\n}\n" + }, + "@uma/core/contracts/common/implementation/MultiRole.sol": { + "content": "// SPDX-License-Identifier: AGPL-3.0-only\npragma solidity ^0.8.0;\n\nlibrary Exclusive {\n struct RoleMembership {\n address member;\n }\n\n function isMember(RoleMembership storage roleMembership, address memberToCheck) internal view returns (bool) {\n return roleMembership.member == memberToCheck;\n }\n\n function resetMember(RoleMembership storage roleMembership, address newMember) internal {\n require(newMember != address(0x0), \"Cannot set an exclusive role to 0x0\");\n roleMembership.member = newMember;\n }\n\n function getMember(RoleMembership storage roleMembership) internal view returns (address) {\n return roleMembership.member;\n }\n\n function init(RoleMembership storage roleMembership, address initialMember) internal {\n resetMember(roleMembership, initialMember);\n }\n}\n\nlibrary Shared {\n struct RoleMembership {\n mapping(address => bool) members;\n }\n\n function isMember(RoleMembership storage roleMembership, address memberToCheck) internal view returns (bool) {\n return roleMembership.members[memberToCheck];\n }\n\n function addMember(RoleMembership storage roleMembership, address memberToAdd) internal {\n require(memberToAdd != address(0x0), \"Cannot add 0x0 to a shared role\");\n roleMembership.members[memberToAdd] = true;\n }\n\n function removeMember(RoleMembership storage roleMembership, address memberToRemove) internal {\n roleMembership.members[memberToRemove] = false;\n }\n\n function init(RoleMembership storage roleMembership, address[] memory initialMembers) internal {\n for (uint256 i = 0; i < initialMembers.length; i++) {\n addMember(roleMembership, initialMembers[i]);\n }\n }\n}\n\n/**\n * @title Base class to manage permissions for the derived class.\n */\nabstract contract MultiRole {\n using Exclusive for Exclusive.RoleMembership;\n using Shared for Shared.RoleMembership;\n\n enum RoleType { Invalid, Exclusive, Shared }\n\n struct Role {\n uint256 managingRole;\n RoleType roleType;\n Exclusive.RoleMembership exclusiveRoleMembership;\n Shared.RoleMembership sharedRoleMembership;\n }\n\n mapping(uint256 => Role) private roles;\n\n event ResetExclusiveMember(uint256 indexed roleId, address indexed newMember, address indexed manager);\n event AddedSharedMember(uint256 indexed roleId, address indexed newMember, address indexed manager);\n event RemovedSharedMember(uint256 indexed roleId, address indexed oldMember, address indexed manager);\n\n /**\n * @notice Reverts unless the caller is a member of the specified roleId.\n */\n modifier onlyRoleHolder(uint256 roleId) {\n require(holdsRole(roleId, msg.sender), \"Sender does not hold required role\");\n _;\n }\n\n /**\n * @notice Reverts unless the caller is a member of the manager role for the specified roleId.\n */\n modifier onlyRoleManager(uint256 roleId) {\n require(holdsRole(roles[roleId].managingRole, msg.sender), \"Can only be called by a role manager\");\n _;\n }\n\n /**\n * @notice Reverts unless the roleId represents an initialized, exclusive roleId.\n */\n modifier onlyExclusive(uint256 roleId) {\n require(roles[roleId].roleType == RoleType.Exclusive, \"Must be called on an initialized Exclusive role\");\n _;\n }\n\n /**\n * @notice Reverts unless the roleId represents an initialized, shared roleId.\n */\n modifier onlyShared(uint256 roleId) {\n require(roles[roleId].roleType == RoleType.Shared, \"Must be called on an initialized Shared role\");\n _;\n }\n\n /**\n * @notice Whether `memberToCheck` is a member of roleId.\n * @dev Reverts if roleId does not correspond to an initialized role.\n * @param roleId the Role to check.\n * @param memberToCheck the address to check.\n * @return True if `memberToCheck` is a member of `roleId`.\n */\n function holdsRole(uint256 roleId, address memberToCheck) public view returns (bool) {\n Role storage role = roles[roleId];\n if (role.roleType == RoleType.Exclusive) {\n return role.exclusiveRoleMembership.isMember(memberToCheck);\n } else if (role.roleType == RoleType.Shared) {\n return role.sharedRoleMembership.isMember(memberToCheck);\n }\n revert(\"Invalid roleId\");\n }\n\n /**\n * @notice Changes the exclusive role holder of `roleId` to `newMember`.\n * @dev Reverts if the caller is not a member of the managing role for `roleId` or if `roleId` is not an\n * initialized, ExclusiveRole.\n * @param roleId the ExclusiveRole membership to modify.\n * @param newMember the new ExclusiveRole member.\n */\n function resetMember(uint256 roleId, address newMember) public onlyExclusive(roleId) onlyRoleManager(roleId) {\n roles[roleId].exclusiveRoleMembership.resetMember(newMember);\n emit ResetExclusiveMember(roleId, newMember, msg.sender);\n }\n\n /**\n * @notice Gets the current holder of the exclusive role, `roleId`.\n * @dev Reverts if `roleId` does not represent an initialized, exclusive role.\n * @param roleId the ExclusiveRole membership to check.\n * @return the address of the current ExclusiveRole member.\n */\n function getMember(uint256 roleId) public view onlyExclusive(roleId) returns (address) {\n return roles[roleId].exclusiveRoleMembership.getMember();\n }\n\n /**\n * @notice Adds `newMember` to the shared role, `roleId`.\n * @dev Reverts if `roleId` does not represent an initialized, SharedRole or if the caller is not a member of the\n * managing role for `roleId`.\n * @param roleId the SharedRole membership to modify.\n * @param newMember the new SharedRole member.\n */\n function addMember(uint256 roleId, address newMember) public onlyShared(roleId) onlyRoleManager(roleId) {\n roles[roleId].sharedRoleMembership.addMember(newMember);\n emit AddedSharedMember(roleId, newMember, msg.sender);\n }\n\n /**\n * @notice Removes `memberToRemove` from the shared role, `roleId`.\n * @dev Reverts if `roleId` does not represent an initialized, SharedRole or if the caller is not a member of the\n * managing role for `roleId`.\n * @param roleId the SharedRole membership to modify.\n * @param memberToRemove the current SharedRole member to remove.\n */\n function removeMember(uint256 roleId, address memberToRemove) public onlyShared(roleId) onlyRoleManager(roleId) {\n roles[roleId].sharedRoleMembership.removeMember(memberToRemove);\n emit RemovedSharedMember(roleId, memberToRemove, msg.sender);\n }\n\n /**\n * @notice Removes caller from the role, `roleId`.\n * @dev Reverts if the caller is not a member of the role for `roleId` or if `roleId` is not an\n * initialized, SharedRole.\n * @param roleId the SharedRole membership to modify.\n */\n function renounceMembership(uint256 roleId) public onlyShared(roleId) onlyRoleHolder(roleId) {\n roles[roleId].sharedRoleMembership.removeMember(msg.sender);\n emit RemovedSharedMember(roleId, msg.sender, msg.sender);\n }\n\n /**\n * @notice Reverts if `roleId` is not initialized.\n */\n modifier onlyValidRole(uint256 roleId) {\n require(roles[roleId].roleType != RoleType.Invalid, \"Attempted to use an invalid roleId\");\n _;\n }\n\n /**\n * @notice Reverts if `roleId` is initialized.\n */\n modifier onlyInvalidRole(uint256 roleId) {\n require(roles[roleId].roleType == RoleType.Invalid, \"Cannot use a pre-existing role\");\n _;\n }\n\n /**\n * @notice Internal method to initialize a shared role, `roleId`, which will be managed by `managingRoleId`.\n * `initialMembers` will be immediately added to the role.\n * @dev Should be called by derived contracts, usually at construction time. Will revert if the role is already\n * initialized.\n */\n function _createSharedRole(\n uint256 roleId,\n uint256 managingRoleId,\n address[] memory initialMembers\n ) internal onlyInvalidRole(roleId) {\n Role storage role = roles[roleId];\n role.roleType = RoleType.Shared;\n role.managingRole = managingRoleId;\n role.sharedRoleMembership.init(initialMembers);\n require(\n roles[managingRoleId].roleType != RoleType.Invalid,\n \"Attempted to use an invalid role to manage a shared role\"\n );\n }\n\n /**\n * @notice Internal method to initialize an exclusive role, `roleId`, which will be managed by `managingRoleId`.\n * `initialMember` will be immediately added to the role.\n * @dev Should be called by derived contracts, usually at construction time. Will revert if the role is already\n * initialized.\n */\n function _createExclusiveRole(\n uint256 roleId,\n uint256 managingRoleId,\n address initialMember\n ) internal onlyInvalidRole(roleId) {\n Role storage role = roles[roleId];\n role.roleType = RoleType.Exclusive;\n role.managingRole = managingRoleId;\n role.exclusiveRoleMembership.init(initialMember);\n require(\n roles[managingRoleId].roleType != RoleType.Invalid,\n \"Attempted to use an invalid role to manage an exclusive role\"\n );\n }\n}\n" + }, + "@uma/core/contracts/common/interfaces/ExpandedIERC20.sol": { + "content": "// SPDX-License-Identifier: AGPL-3.0-only\npragma solidity ^0.8.0;\n\nimport \"@openzeppelin/contracts/token/ERC20/IERC20.sol\";\n\n/**\n * @title ERC20 interface that includes burn and mint methods.\n */\nabstract contract ExpandedIERC20 is IERC20 {\n /**\n * @notice Burns a specific amount of the caller's tokens.\n * @dev Only burns the caller's tokens, so it is safe to leave this method permissionless.\n */\n function burn(uint256 value) external virtual;\n\n /**\n * @dev Burns `value` tokens owned by `recipient`.\n * @param recipient address to burn tokens from.\n * @param value amount of tokens to burn.\n */\n function burnFrom(address recipient, uint256 value) external virtual returns (bool);\n\n /**\n * @notice Mints tokens and adds them to the balance of the `to` address.\n * @dev This method should be permissioned to only allow designated parties to mint tokens.\n */\n function mint(address to, uint256 value) external virtual returns (bool);\n\n function addMinter(address account) external virtual;\n\n function addBurner(address account) external virtual;\n\n function resetOwner(address account) external virtual;\n}\n" + }, + "@openzeppelin/contracts/token/ERC20/extensions/IERC20Metadata.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts v4.4.1 (token/ERC20/extensions/IERC20Metadata.sol)\n\npragma solidity ^0.8.0;\n\nimport \"../IERC20.sol\";\n\n/**\n * @dev Interface for the optional metadata functions from the ERC20 standard.\n *\n * _Available since v4.1._\n */\ninterface IERC20Metadata is IERC20 {\n /**\n * @dev Returns the name of the token.\n */\n function name() external view returns (string memory);\n\n /**\n * @dev Returns the symbol of the token.\n */\n function symbol() external view returns (string memory);\n\n /**\n * @dev Returns the decimals places of the token.\n */\n function decimals() external view returns (uint8);\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" + }, + "contracts/Polygon_SpokePool.sol": { + "content": "// SPDX-License-Identifier: GPL-3.0-only\npragma solidity ^0.8.0;\n\nimport \"./SpokePool.sol\";\nimport \"./PolygonTokenBridger.sol\";\nimport \"./interfaces/WETH9.sol\";\nimport \"./SpokePoolInterface.sol\";\n\nimport \"@openzeppelin/contracts/token/ERC20/IERC20.sol\";\nimport \"@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol\";\n\n// IFxMessageProcessor represents interface to process messages.\ninterface IFxMessageProcessor {\n function processMessageFromRoot(\n uint256 stateId,\n address rootMessageSender,\n bytes calldata data\n ) external;\n}\n\n/**\n * @notice Polygon specific SpokePool.\n */\ncontract Polygon_SpokePool is IFxMessageProcessor, SpokePool {\n using SafeERC20 for PolygonIERC20;\n\n // Address of FxChild which sends and receives messages to and from L1.\n address public fxChild;\n\n // Contract deployed on L1 and L2 processes all cross-chain transfers between this contract and the the HubPool.\n // Required because bridging tokens from Polygon to Ethereum has special constraints.\n PolygonTokenBridger public polygonTokenBridger;\n\n // Internal variable that only flips temporarily to true upon receiving messages from L1. Used to authenticate that\n // the caller is the fxChild AND that the fxChild called processMessageFromRoot\n bool private callValidated = false;\n\n event PolygonTokensBridged(address indexed token, address indexed receiver, uint256 amount);\n event SetFxChild(address indexed newFxChild);\n event SetPolygonTokenBridger(address indexed polygonTokenBridger);\n\n // Note: validating calls this way ensures that strange calls coming from the fxChild won't be misinterpreted.\n // Put differently, just checking that msg.sender == fxChild is not sufficient.\n // All calls that have admin privileges must be fired from within the processMessageFromRoot method that's gone\n // through validation where the sender is checked and the root (mainnet) sender is also validated.\n // This modifier sets the callValidated variable so this condition can be checked in _requireAdminSender().\n modifier validateInternalCalls() {\n // Make sure callValidated is set to True only once at beginning of processMessageFromRoot, which prevents\n // processMessageFromRoot from being re-entered.\n require(!callValidated, \"callValidated already set\");\n\n // This sets a variable indicating that we're now inside a validated call.\n // Note: this is used by other methods to ensure that this call has been validated by this method and is not\n // spoofed. See\n callValidated = true;\n\n _;\n\n // Reset callValidated to false to disallow admin calls after this method exits.\n callValidated = false;\n }\n\n /**\n * @notice Construct the Polygon SpokePool.\n * @param _polygonTokenBridger Token routing contract that sends tokens from here to HubPool. Changeable by Admin.\n * @param _crossDomainAdmin Cross domain admin to set. Can be changed by admin.\n * @param _hubPool Hub pool address to set. Can be changed by admin.\n * @param _wmaticAddress Replaces _wethAddress for this network since MATIC is the gas token and sent via msg.value\n * on Polygon.\n * @param _fxChild FxChild contract, changeable by Admin.\n * @param timerAddress Timer address to set.\n */\n constructor(\n PolygonTokenBridger _polygonTokenBridger,\n address _crossDomainAdmin,\n address _hubPool,\n address _wmaticAddress, // Note: wmatic is used here since it is the token sent via msg.value on polygon.\n address _fxChild,\n address timerAddress\n ) SpokePool(_crossDomainAdmin, _hubPool, _wmaticAddress, timerAddress) {\n polygonTokenBridger = _polygonTokenBridger;\n fxChild = _fxChild;\n }\n\n /********************************************************\n * ARBITRUM-SPECIFIC CROSS-CHAIN ADMIN FUNCTIONS *\n ********************************************************/\n\n /**\n * @notice Change FxChild address. Callable only by admin via processMessageFromRoot.\n * @param newFxChild New FxChild.\n */\n function setFxChild(address newFxChild) public onlyAdmin nonReentrant {\n fxChild = newFxChild;\n emit SetFxChild(fxChild);\n }\n\n /**\n * @notice Change polygonTokenBridger address. Callable only by admin via processMessageFromRoot.\n * @param newPolygonTokenBridger New Polygon Token Bridger contract.\n */\n function setPolygonTokenBridger(address payable newPolygonTokenBridger) public onlyAdmin nonReentrant {\n polygonTokenBridger = PolygonTokenBridger(newPolygonTokenBridger);\n emit SetPolygonTokenBridger(address(polygonTokenBridger));\n }\n\n /**\n * @notice Called by FxChild upon receiving L1 message that targets this contract. Performs an additional check\n * that the L1 caller was the expected cross domain admin, and then delegate calls.\n * @notice Polygon bridge only executes this external function on the target Polygon contract when relaying\n * messages from L1, so all functions on this SpokePool are expected to originate via this call.\n * @dev stateId value isn't used because it isn't relevant for this method. It doesn't care what state sync\n * triggered this call.\n * @param rootMessageSender Original L1 sender of data.\n * @param data ABI encoded function call to execute on this contract.\n */\n function processMessageFromRoot(\n uint256, /*stateId*/\n address rootMessageSender,\n bytes calldata data\n ) public validateInternalCalls {\n // Validation logic.\n require(msg.sender == fxChild, \"Not from fxChild\");\n require(rootMessageSender == crossDomainAdmin, \"Not from mainnet admin\");\n\n // This uses delegatecall to take the information in the message and process it as a function call on this contract.\n (bool success, ) = address(this).delegatecall(data);\n require(success, \"delegatecall failed\");\n }\n\n /**************************************\n * INTERNAL FUNCTIONS *\n **************************************/\n\n function _bridgeTokensToHubPool(RelayerRefundLeaf memory relayerRefundLeaf) internal override {\n PolygonIERC20(relayerRefundLeaf.l2TokenAddress).safeIncreaseAllowance(\n address(polygonTokenBridger),\n relayerRefundLeaf.amountToReturn\n );\n\n // Note: WETH is WMATIC on matic, so this tells the tokenbridger that this is an unwrappable native token.\n polygonTokenBridger.send(\n PolygonIERC20(relayerRefundLeaf.l2TokenAddress),\n relayerRefundLeaf.amountToReturn,\n address(weth) == relayerRefundLeaf.l2TokenAddress\n );\n\n emit PolygonTokensBridged(relayerRefundLeaf.l2TokenAddress, address(this), relayerRefundLeaf.amountToReturn);\n }\n\n // @dev: This contract will trigger admin functions internally via the `processMessageFromRoot`, which is why\n // the `callValidated` check is made below and why we use the `validateInternalCalls` modifier on\n // `processMessageFromRoot`. This prevents calling the admin functions from any other method besides\n // `processMessageFromRoot`.\n function _requireAdminSender() internal view override {\n require(callValidated, \"Must call processMessageFromRoot\");\n }\n}\n" + }, + "contracts/Optimism_SpokePool.sol": { + "content": "// SPDX-License-Identifier: GPL-3.0-only\npragma solidity ^0.8.0;\n\nimport \"./SpokePool.sol\";\nimport \"./interfaces/WETH9.sol\";\n\nimport \"@eth-optimism/contracts/libraries/bridge/CrossDomainEnabled.sol\";\nimport \"@eth-optimism/contracts/libraries/constants/Lib_PredeployAddresses.sol\";\nimport \"@eth-optimism/contracts/L2/messaging/IL2ERC20Bridge.sol\";\n\n/**\n * @notice OVM specific SpokePool. Uses OVM cross-domain-enabled logic to implement admin only access to functions.\n */\ncontract Optimism_SpokePool is CrossDomainEnabled, SpokePool {\n // \"l1Gas\" parameter used in call to bridge tokens from this contract back to L1 via IL2ERC20Bridge. Currently\n // unused by bridge but included for future compatibility.\n uint32 public l1Gas = 5_000_000;\n\n // ETH is an ERC20 on OVM.\n address public immutable l2Eth = address(Lib_PredeployAddresses.OVM_ETH);\n\n // Stores alternative token bridges to use for L2 tokens that don't go over the standard bridge. This is needed\n // to support non-standard ERC20 tokens on Optimism, such as DIA and SNX which both use custom bridges.\n mapping(address => address) public tokenBridges;\n\n event OptimismTokensBridged(address indexed l2Token, address target, uint256 numberOfTokensBridged, uint256 l1Gas);\n event SetL1Gas(uint32 indexed newL1Gas);\n event SetL2TokenBridge(address indexed l2Token, address indexed tokenBridge);\n\n /**\n * @notice Construct the OVM SpokePool.\n * @param _crossDomainAdmin Cross domain admin to set. Can be changed by admin.\n * @param _hubPool Hub pool address to set. Can be changed by admin.\n * @param timerAddress Timer address to set.\n */\n constructor(\n address _crossDomainAdmin,\n address _hubPool,\n address timerAddress\n )\n CrossDomainEnabled(Lib_PredeployAddresses.L2_CROSS_DOMAIN_MESSENGER)\n SpokePool(_crossDomainAdmin, _hubPool, 0x4200000000000000000000000000000000000006, timerAddress)\n {}\n\n /*******************************************\n * OPTIMISM-SPECIFIC ADMIN FUNCTIONS *\n *******************************************/\n\n /**\n * @notice Change L1 gas limit. Callable only by admin.\n * @param newl1Gas New L1 gas limit to set.\n */\n function setL1GasLimit(uint32 newl1Gas) public onlyAdmin nonReentrant {\n l1Gas = newl1Gas;\n emit SetL1Gas(newl1Gas);\n }\n\n /**\n * @notice Set bridge contract for L2 token used to withdraw back to L1.\n * @dev If this mapping isn't set for an L2 token, then the standard bridge will be used to bridge this token.\n * @param tokenBridge Address of token bridge\n */\n function setTokenBridge(address l2Token, address tokenBridge) public onlyAdmin nonReentrant {\n tokenBridges[l2Token] = tokenBridge;\n emit SetL2TokenBridge(l2Token, tokenBridge);\n }\n\n /**************************************\n * DATA WORKER FUNCTIONS *\n **************************************/\n\n /**\n * @notice Wraps any ETH into WETH before executing base function. This is necessary because SpokePool receives\n * ETH over the canonical token bridge instead of WETH.\n * @inheritdoc SpokePool\n */\n function executeSlowRelayRoot(\n address depositor,\n address recipient,\n address destinationToken,\n uint256 totalRelayAmount,\n uint256 originChainId,\n uint64 realizedLpFeePct,\n uint64 relayerFeePct,\n uint32 depositId,\n uint32 rootBundleId,\n bytes32[] memory proof\n ) public override(SpokePool) nonReentrant {\n if (destinationToken == address(weth)) _depositEthToWeth();\n\n _executeSlowRelayRoot(\n depositor,\n recipient,\n destinationToken,\n totalRelayAmount,\n originChainId,\n chainId(),\n realizedLpFeePct,\n relayerFeePct,\n depositId,\n rootBundleId,\n proof\n );\n }\n\n /**\n * @notice Wraps any ETH into WETH before executing base function. This is necessary because SpokePool receives\n * ETH over the canonical token bridge instead of WETH.\n * @inheritdoc SpokePool\n */\n function executeRelayerRefundRoot(\n uint32 rootBundleId,\n SpokePoolInterface.RelayerRefundLeaf memory relayerRefundLeaf,\n bytes32[] memory proof\n ) public override(SpokePool) nonReentrant {\n if (relayerRefundLeaf.l2TokenAddress == address(weth)) _depositEthToWeth();\n\n _executeRelayerRefundRoot(rootBundleId, relayerRefundLeaf, proof);\n }\n\n /**************************************\n * INTERNAL FUNCTIONS *\n **************************************/\n\n // Wrap any ETH owned by this contract so we can send expected L2 token to recipient. This is necessary because\n // this SpokePool will receive ETH from the canonical token bridge instead of WETH. Its not sufficient to execute\n // this logic inside a fallback method that executes when this contract receives ETH because ETH is an ERC20\n // on the OVM.\n function _depositEthToWeth() internal {\n if (address(this).balance > 0) weth.deposit{ value: address(this).balance }();\n }\n\n function _bridgeTokensToHubPool(RelayerRefundLeaf memory relayerRefundLeaf) internal override {\n // If the token being bridged is WETH then we need to first unwrap it to ETH and then send ETH over the\n // canonical bridge. On Optimism, this is address 0xDeadDeAddeAddEAddeadDEaDDEAdDeaDDeAD0000.\n if (relayerRefundLeaf.l2TokenAddress == address(weth)) {\n WETH9(relayerRefundLeaf.l2TokenAddress).withdraw(relayerRefundLeaf.amountToReturn); // Unwrap into ETH.\n relayerRefundLeaf.l2TokenAddress = l2Eth; // Set the l2TokenAddress to ETH.\n }\n IL2ERC20Bridge(\n tokenBridges[relayerRefundLeaf.l2TokenAddress] == address(0)\n ? Lib_PredeployAddresses.L2_STANDARD_BRIDGE\n : tokenBridges[relayerRefundLeaf.l2TokenAddress]\n ).withdrawTo(\n relayerRefundLeaf.l2TokenAddress, // _l2Token. Address of the L2 token to bridge over.\n hubPool, // _to. Withdraw, over the bridge, to the l1 pool contract.\n relayerRefundLeaf.amountToReturn, // _amount.\n l1Gas, // _l1Gas. Unused, but included for potential forward compatibility considerations\n \"\" // _data. We don't need to send any data for the bridging action.\n );\n\n emit OptimismTokensBridged(relayerRefundLeaf.l2TokenAddress, hubPool, relayerRefundLeaf.amountToReturn, l1Gas);\n }\n\n // Apply OVM-specific transformation to cross domain admin address on L1.\n function _requireAdminSender() internal override onlyFromCrossDomainAccount(crossDomainAdmin) {}\n}\n" + }, + "@eth-optimism/contracts/libraries/bridge/CrossDomainEnabled.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity >0.5.0 <0.9.0;\n\n/* Interface Imports */\nimport { ICrossDomainMessenger } from \"./ICrossDomainMessenger.sol\";\n\n/**\n * @title CrossDomainEnabled\n * @dev Helper contract for contracts performing cross-domain communications\n *\n * Compiler used: defined by inheriting contract\n */\ncontract CrossDomainEnabled {\n /*************\n * Variables *\n *************/\n\n // Messenger contract used to send and recieve messages from the other domain.\n address public messenger;\n\n /***************\n * Constructor *\n ***************/\n\n /**\n * @param _messenger Address of the CrossDomainMessenger on the current layer.\n */\n constructor(address _messenger) {\n messenger = _messenger;\n }\n\n /**********************\n * Function Modifiers *\n **********************/\n\n /**\n * Enforces that the modified function is only callable by a specific cross-domain account.\n * @param _sourceDomainAccount The only account on the originating domain which is\n * authenticated to call this function.\n */\n modifier onlyFromCrossDomainAccount(address _sourceDomainAccount) {\n require(\n msg.sender == address(getCrossDomainMessenger()),\n \"OVM_XCHAIN: messenger contract unauthenticated\"\n );\n\n require(\n getCrossDomainMessenger().xDomainMessageSender() == _sourceDomainAccount,\n \"OVM_XCHAIN: wrong sender of cross-domain message\"\n );\n\n _;\n }\n\n /**********************\n * Internal Functions *\n **********************/\n\n /**\n * Gets the messenger, usually from storage. This function is exposed in case a child contract\n * needs to override.\n * @return The address of the cross-domain messenger contract which should be used.\n */\n function getCrossDomainMessenger() internal virtual returns (ICrossDomainMessenger) {\n return ICrossDomainMessenger(messenger);\n }\n\n /**q\n * Sends a message to an account on another domain\n * @param _crossDomainTarget The intended recipient on the destination domain\n * @param _message The data to send to the target (usually calldata to a function with\n * `onlyFromCrossDomainAccount()`)\n * @param _gasLimit The gasLimit for the receipt of the message on the target domain.\n */\n function sendCrossDomainMessage(\n address _crossDomainTarget,\n uint32 _gasLimit,\n bytes memory _message\n ) internal {\n // slither-disable-next-line reentrancy-events, reentrancy-benign\n getCrossDomainMessenger().sendMessage(_crossDomainTarget, _message, _gasLimit);\n }\n}\n" + }, + "@eth-optimism/contracts/libraries/constants/Lib_PredeployAddresses.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.9;\n\n/**\n * @title Lib_PredeployAddresses\n */\nlibrary Lib_PredeployAddresses {\n address internal constant L2_TO_L1_MESSAGE_PASSER = 0x4200000000000000000000000000000000000000;\n address internal constant L1_MESSAGE_SENDER = 0x4200000000000000000000000000000000000001;\n address internal constant DEPLOYER_WHITELIST = 0x4200000000000000000000000000000000000002;\n address payable internal constant OVM_ETH = payable(0xDeadDeAddeAddEAddeadDEaDDEAdDeaDDeAD0000);\n address internal constant L2_CROSS_DOMAIN_MESSENGER =\n 0x4200000000000000000000000000000000000007;\n address internal constant LIB_ADDRESS_MANAGER = 0x4200000000000000000000000000000000000008;\n address internal constant PROXY_EOA = 0x4200000000000000000000000000000000000009;\n address internal constant L2_STANDARD_BRIDGE = 0x4200000000000000000000000000000000000010;\n address internal constant SEQUENCER_FEE_WALLET = 0x4200000000000000000000000000000000000011;\n address internal constant L2_STANDARD_TOKEN_FACTORY =\n 0x4200000000000000000000000000000000000012;\n address internal constant L1_BLOCK_NUMBER = 0x4200000000000000000000000000000000000013;\n}\n" + }, + "@eth-optimism/contracts/L2/messaging/IL2ERC20Bridge.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.9;\n\n/**\n * @title IL2ERC20Bridge\n */\ninterface IL2ERC20Bridge {\n /**********\n * Events *\n **********/\n\n event WithdrawalInitiated(\n address indexed _l1Token,\n address indexed _l2Token,\n address indexed _from,\n address _to,\n uint256 _amount,\n bytes _data\n );\n\n event DepositFinalized(\n address indexed _l1Token,\n address indexed _l2Token,\n address indexed _from,\n address _to,\n uint256 _amount,\n bytes _data\n );\n\n event DepositFailed(\n address indexed _l1Token,\n address indexed _l2Token,\n address indexed _from,\n address _to,\n uint256 _amount,\n bytes _data\n );\n\n /********************\n * Public Functions *\n ********************/\n\n /**\n * @dev get the address of the corresponding L1 bridge contract.\n * @return Address of the corresponding L1 bridge contract.\n */\n function l1TokenBridge() external returns (address);\n\n /**\n * @dev initiate a withdraw of some tokens to the caller's account on L1\n * @param _l2Token Address of L2 token where withdrawal was initiated.\n * @param _amount Amount of the token to withdraw.\n * param _l1Gas Unused, but included for potential forward compatibility considerations.\n * @param _data Optional data to forward to L1. This data is provided\n * solely as a convenience for external contracts. Aside from enforcing a maximum\n * length, these contracts provide no guarantees about its content.\n */\n function withdraw(\n address _l2Token,\n uint256 _amount,\n uint32 _l1Gas,\n bytes calldata _data\n ) external;\n\n /**\n * @dev initiate a withdraw of some token to a recipient's account on L1.\n * @param _l2Token Address of L2 token where withdrawal is initiated.\n * @param _to L1 adress to credit the withdrawal to.\n * @param _amount Amount of the token to withdraw.\n * param _l1Gas Unused, but included for potential forward compatibility considerations.\n * @param _data Optional data to forward to L1. This data is provided\n * solely as a convenience for external contracts. Aside from enforcing a maximum\n * length, these contracts provide no guarantees about its content.\n */\n function withdrawTo(\n address _l2Token,\n address _to,\n uint256 _amount,\n uint32 _l1Gas,\n bytes calldata _data\n ) external;\n\n /*************************\n * Cross-chain Functions *\n *************************/\n\n /**\n * @dev Complete a deposit from L1 to L2, and credits funds to the recipient's balance of this\n * L2 token. This call will fail if it did not originate from a corresponding deposit in\n * L1StandardTokenBridge.\n * @param _l1Token Address for the l1 token this is called with\n * @param _l2Token Address for the l2 token this is called with\n * @param _from Account to pull the deposit from on L2.\n * @param _to Address to receive the withdrawal at\n * @param _amount Amount of the token to withdraw\n * @param _data Data provider by the sender on L1. This data is provided\n * solely as a convenience for external contracts. Aside from enforcing a maximum\n * length, these contracts provide no guarantees about its content.\n */\n function finalizeDeposit(\n address _l1Token,\n address _l2Token,\n address _from,\n address _to,\n uint256 _amount,\n bytes calldata _data\n ) external;\n}\n" + }, + "@eth-optimism/contracts/libraries/bridge/ICrossDomainMessenger.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity >0.5.0 <0.9.0;\n\n/**\n * @title ICrossDomainMessenger\n */\ninterface ICrossDomainMessenger {\n /**********\n * Events *\n **********/\n\n event SentMessage(\n address indexed target,\n address sender,\n bytes message,\n uint256 messageNonce,\n uint256 gasLimit\n );\n event RelayedMessage(bytes32 indexed msgHash);\n event FailedRelayedMessage(bytes32 indexed msgHash);\n\n /*************\n * Variables *\n *************/\n\n function xDomainMessageSender() external view returns (address);\n\n /********************\n * Public Functions *\n ********************/\n\n /**\n * Sends a cross domain message to the target messenger.\n * @param _target Target contract address.\n * @param _message Message to send to the target.\n * @param _gasLimit Gas limit for the provided message.\n */\n function sendMessage(\n address _target,\n bytes calldata _message,\n uint32 _gasLimit\n ) external;\n}\n" + }, + "contracts/chain-adapters/CrossDomainEnabled.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity >0.5.0 <0.9.0;\n\n/* Interface Imports */\nimport { ICrossDomainMessenger } from \"@eth-optimism/contracts/libraries/bridge/ICrossDomainMessenger.sol\";\n\n/**\n * @title CrossDomainEnabled\n * @dev Helper contract for contracts performing cross-domain communications between L1 and Optimism.\n * @dev This modifies the eth-optimism/CrossDomainEnabled contract only by changing state variables to be\n * immutable for use in contracts like the Optimism_Adapter which use delegateCall().\n */\ncontract CrossDomainEnabled {\n // Messenger contract used to send and recieve messages from the other domain.\n address public immutable messenger;\n\n /**\n * @param _messenger Address of the CrossDomainMessenger on the current layer.\n */\n constructor(address _messenger) {\n messenger = _messenger;\n }\n\n /**\n * Enforces that the modified function is only callable by a specific cross-domain account.\n * @param _sourceDomainAccount The only account on the originating domain which is\n * authenticated to call this function.\n */\n modifier onlyFromCrossDomainAccount(address _sourceDomainAccount) {\n require(msg.sender == address(getCrossDomainMessenger()), \"OVM_XCHAIN: messenger contract unauthenticated\");\n\n require(\n getCrossDomainMessenger().xDomainMessageSender() == _sourceDomainAccount,\n \"OVM_XCHAIN: wrong sender of cross-domain message\"\n );\n\n _;\n }\n\n /**\n * Gets the messenger, usually from storage. This function is exposed in case a child contract\n * needs to override.\n * @return The address of the cross-domain messenger contract which should be used.\n */\n function getCrossDomainMessenger() internal virtual returns (ICrossDomainMessenger) {\n return ICrossDomainMessenger(messenger);\n }\n\n /**\n * Sends a message to an account on another domain\n * @param _crossDomainTarget The intended recipient on the destination domain\n * @param _message The data to send to the target (usually calldata to a function with\n * onlyFromCrossDomainAccount())\n * @param _gasLimit The gasLimit for the receipt of the message on the target domain.\n */\n function sendCrossDomainMessage(\n address _crossDomainTarget,\n uint32 _gasLimit,\n bytes memory _message\n ) internal {\n // slither-disable-next-line reentrancy-events, reentrancy-benign\n getCrossDomainMessenger().sendMessage(_crossDomainTarget, _message, _gasLimit);\n }\n}\n" + }, + "contracts/chain-adapters/Optimism_Adapter.sol": { + "content": "// SPDX-License-Identifier: AGPL-3.0-only\npragma solidity ^0.8.0;\n\nimport \"../interfaces/AdapterInterface.sol\";\nimport \"../interfaces/WETH9.sol\";\n\n// @dev Use local modified CrossDomainEnabled contract instead of one exported by eth-optimism because we need\n// this contract's state variables to be `immutable` because of the delegateCall call.\nimport \"./CrossDomainEnabled.sol\";\nimport \"@eth-optimism/contracts/L1/messaging/IL1StandardBridge.sol\";\n\nimport \"@openzeppelin/contracts/token/ERC20/IERC20.sol\";\nimport \"@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol\";\n\n/**\n * @notice Contract containing logic to send messages from L1 to Optimism.\n * @dev Public functions calling external contracts do not guard against reentrancy because they are expected to be\n * called via delegatecall, which will execute this contract's logic within the context of the originating contract.\n * For example, the HubPool will delegatecall these functions, therefore its only necessary that the HubPool's methods\n * that call this contract's logic guard against reentrancy.\n */\ncontract Optimism_Adapter is CrossDomainEnabled, AdapterInterface {\n using SafeERC20 for IERC20;\n uint32 public immutable l2GasLimit = 5_000_000;\n\n WETH9 public immutable l1Weth;\n\n IL1StandardBridge public immutable l1StandardBridge;\n\n // Optimism has the ability to support \"custom\" bridges. These bridges are not supported by the canonical bridge\n // and so we need to store the address of the custom token and the associated bridge. In the event we want to\n // support a new token that is not supported by Optimism, we can add a new custom bridge for it and re-deploy the\n // adapter. A full list of custom optimism tokens and their associated bridges can be found here:\n // https://github.com/ethereum-optimism/ethereum-optimism.github.io/blob/master/optimism.tokenlist.json\n address public immutable dai = 0x6B175474E89094C44Da98b954EedeAC495271d0F;\n address public immutable daiOptimismBridge = 0x10E6593CDda8c58a1d0f14C5164B376352a55f2F;\n address public immutable snx = 0xC011a73ee8576Fb46F5E1c5751cA3B9Fe0af2a6F;\n address public immutable snxOptimismBridge = 0xCd9D4988C0AE61887B075bA77f08cbFAd2b65068;\n\n /**\n * @notice Constructs new Adapter.\n * @param _l1Weth WETH address on L1.\n * @param _crossDomainMessenger XDomainMessenger Optimism system contract.\n * @param _l1StandardBridge Standard bridge contract.\n */\n constructor(\n WETH9 _l1Weth,\n address _crossDomainMessenger,\n IL1StandardBridge _l1StandardBridge\n ) CrossDomainEnabled(_crossDomainMessenger) {\n l1Weth = _l1Weth;\n l1StandardBridge = _l1StandardBridge;\n }\n\n /**\n * @notice Send cross-chain message to target on Optimism.\n * @param target Contract on Optimism that will receive message.\n * @param message Data to send to target.\n */\n function relayMessage(address target, bytes memory message) external payable override {\n sendCrossDomainMessage(target, uint32(l2GasLimit), message);\n emit MessageRelayed(target, message);\n }\n\n /**\n * @notice Bridge tokens to Optimism.\n * @param l1Token L1 token to deposit.\n * @param l2Token L2 token to receive.\n * @param amount Amount of L1 tokens to deposit and L2 tokens to receive.\n * @param to Bridge recipient.\n */\n function relayTokens(\n address l1Token,\n address l2Token,\n uint256 amount,\n address to\n ) external payable override {\n // If the l1Token is weth then unwrap it to ETH then send the ETH to the standard bridge.\n if (l1Token == address(l1Weth)) {\n l1Weth.withdraw(amount);\n l1StandardBridge.depositETHTo{ value: amount }(to, l2GasLimit, \"\");\n } else {\n IL1StandardBridge _l1StandardBridge = l1StandardBridge;\n\n // Check if the L1 token requires a custom bridge. If so, use that bridge over the standard bridge.\n if (l1Token == dai) _l1StandardBridge = IL1StandardBridge(daiOptimismBridge); // 1. DAI\n if (l1Token == snx) _l1StandardBridge = IL1StandardBridge(snxOptimismBridge); // 2. SNX\n\n IERC20(l1Token).safeIncreaseAllowance(address(_l1StandardBridge), amount);\n _l1StandardBridge.depositERC20To(l1Token, l2Token, to, amount, l2GasLimit, \"\");\n }\n emit TokensRelayed(l1Token, l2Token, amount, to);\n }\n}\n" + }, + "@eth-optimism/contracts/L1/messaging/IL1StandardBridge.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity >0.5.0 <0.9.0;\n\nimport \"./IL1ERC20Bridge.sol\";\n\n/**\n * @title IL1StandardBridge\n */\ninterface IL1StandardBridge is IL1ERC20Bridge {\n /**********\n * Events *\n **********/\n event ETHDepositInitiated(\n address indexed _from,\n address indexed _to,\n uint256 _amount,\n bytes _data\n );\n\n event ETHWithdrawalFinalized(\n address indexed _from,\n address indexed _to,\n uint256 _amount,\n bytes _data\n );\n\n /********************\n * Public Functions *\n ********************/\n\n /**\n * @dev Deposit an amount of the ETH to the caller's balance on L2.\n * @param _l2Gas Gas limit required to complete the deposit on L2.\n * @param _data Optional data to forward to L2. This data is provided\n * solely as a convenience for external contracts. Aside from enforcing a maximum\n * length, these contracts provide no guarantees about its content.\n */\n function depositETH(uint32 _l2Gas, bytes calldata _data) external payable;\n\n /**\n * @dev Deposit an amount of ETH to a recipient's balance on L2.\n * @param _to L2 address to credit the withdrawal to.\n * @param _l2Gas Gas limit required to complete the deposit on L2.\n * @param _data Optional data to forward to L2. This data is provided\n * solely as a convenience for external contracts. Aside from enforcing a maximum\n * length, these contracts provide no guarantees about its content.\n */\n function depositETHTo(\n address _to,\n uint32 _l2Gas,\n bytes calldata _data\n ) external payable;\n\n /*************************\n * Cross-chain Functions *\n *************************/\n\n /**\n * @dev Complete a withdrawal from L2 to L1, and credit funds to the recipient's balance of the\n * L1 ETH token. Since only the xDomainMessenger can call this function, it will never be called\n * before the withdrawal is finalized.\n * @param _from L2 address initiating the transfer.\n * @param _to L1 address to credit the withdrawal to.\n * @param _amount Amount of the ERC20 to deposit.\n * @param _data Optional data to forward to L2. This data is provided\n * solely as a convenience for external contracts. Aside from enforcing a maximum\n * length, these contracts provide no guarantees about its content.\n */\n function finalizeETHWithdrawal(\n address _from,\n address _to,\n uint256 _amount,\n bytes calldata _data\n ) external;\n}\n" + }, + "@eth-optimism/contracts/L1/messaging/IL1ERC20Bridge.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity >0.5.0 <0.9.0;\n\n/**\n * @title IL1ERC20Bridge\n */\ninterface IL1ERC20Bridge {\n /**********\n * Events *\n **********/\n\n event ERC20DepositInitiated(\n address indexed _l1Token,\n address indexed _l2Token,\n address indexed _from,\n address _to,\n uint256 _amount,\n bytes _data\n );\n\n event ERC20WithdrawalFinalized(\n address indexed _l1Token,\n address indexed _l2Token,\n address indexed _from,\n address _to,\n uint256 _amount,\n bytes _data\n );\n\n /********************\n * Public Functions *\n ********************/\n\n /**\n * @dev get the address of the corresponding L2 bridge contract.\n * @return Address of the corresponding L2 bridge contract.\n */\n function l2TokenBridge() external returns (address);\n\n /**\n * @dev deposit an amount of the ERC20 to the caller's balance on L2.\n * @param _l1Token Address of the L1 ERC20 we are depositing\n * @param _l2Token Address of the L1 respective L2 ERC20\n * @param _amount Amount of the ERC20 to deposit\n * @param _l2Gas Gas limit required to complete the deposit on L2.\n * @param _data Optional data to forward to L2. This data is provided\n * solely as a convenience for external contracts. Aside from enforcing a maximum\n * length, these contracts provide no guarantees about its content.\n */\n function depositERC20(\n address _l1Token,\n address _l2Token,\n uint256 _amount,\n uint32 _l2Gas,\n bytes calldata _data\n ) external;\n\n /**\n * @dev deposit an amount of ERC20 to a recipient's balance on L2.\n * @param _l1Token Address of the L1 ERC20 we are depositing\n * @param _l2Token Address of the L1 respective L2 ERC20\n * @param _to L2 address to credit the withdrawal to.\n * @param _amount Amount of the ERC20 to deposit.\n * @param _l2Gas Gas limit required to complete the deposit on L2.\n * @param _data Optional data to forward to L2. This data is provided\n * solely as a convenience for external contracts. Aside from enforcing a maximum\n * length, these contracts provide no guarantees about its content.\n */\n function depositERC20To(\n address _l1Token,\n address _l2Token,\n address _to,\n uint256 _amount,\n uint32 _l2Gas,\n bytes calldata _data\n ) external;\n\n /*************************\n * Cross-chain Functions *\n *************************/\n\n /**\n * @dev Complete a withdrawal from L2 to L1, and credit funds to the recipient's balance of the\n * L1 ERC20 token.\n * This call will fail if the initialized withdrawal from L2 has not been finalized.\n *\n * @param _l1Token Address of L1 token to finalizeWithdrawal for.\n * @param _l2Token Address of L2 token where withdrawal was initiated.\n * @param _from L2 address initiating the transfer.\n * @param _to L1 address to credit the withdrawal to.\n * @param _amount Amount of the ERC20 to deposit.\n * @param _data Data provided by the sender on L2. This data is provided\n * solely as a convenience for external contracts. Aside from enforcing a maximum\n * length, these contracts provide no guarantees about its content.\n */\n function finalizeERC20Withdrawal(\n address _l1Token,\n address _l2Token,\n address _from,\n address _to,\n uint256 _amount,\n bytes calldata _data\n ) external;\n}\n" + }, + "contracts/chain-adapters/Polygon_Adapter.sol": { + "content": "// SPDX-License-Identifier: AGPL-3.0-only\npragma solidity ^0.8.0;\n\nimport \"../interfaces/AdapterInterface.sol\";\nimport \"../interfaces/WETH9.sol\";\n\nimport \"@openzeppelin/contracts/token/ERC20/IERC20.sol\";\nimport \"@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol\";\n\ninterface IRootChainManager {\n function depositEtherFor(address user) external payable;\n\n function depositFor(\n address user,\n address rootToken,\n bytes calldata depositData\n ) external;\n}\n\ninterface IFxStateSender {\n function sendMessageToChild(address _receiver, bytes calldata _data) external;\n}\n\n/**\n * @notice Sends cross chain messages Polygon L2 network.\n * @dev Public functions calling external contracts do not guard against reentrancy because they are expected to be\n * called via delegatecall, which will execute this contract's logic within the context of the originating contract.\n * For example, the HubPool will delegatecall these functions, therefore its only necessary that the HubPool's methods\n * that call this contract's logic guard against reentrancy.\n */\ncontract Polygon_Adapter is AdapterInterface {\n using SafeERC20 for IERC20;\n IRootChainManager public immutable rootChainManager;\n IFxStateSender public immutable fxStateSender;\n WETH9 public immutable l1Weth;\n\n /**\n * @notice Constructs new Adapter.\n * @param _rootChainManager RootChainManager Polygon system helper contract.\n * @param _fxStateSender FxStateSender Polygon system helper contract.\n * @param _l1Weth WETH address on L1.\n */\n constructor(\n IRootChainManager _rootChainManager,\n IFxStateSender _fxStateSender,\n WETH9 _l1Weth\n ) {\n rootChainManager = _rootChainManager;\n fxStateSender = _fxStateSender;\n l1Weth = _l1Weth;\n }\n\n /**\n * @notice Send cross-chain message to target on Polygon.\n * @param target Contract on Polygon that will receive message.\n * @param message Data to send to target.\n */\n\n function relayMessage(address target, bytes memory message) external payable override {\n fxStateSender.sendMessageToChild(target, message);\n emit MessageRelayed(target, message);\n }\n\n /**\n * @notice Bridge tokens to Polygon.\n * @param l1Token L1 token to deposit.\n * @param l2Token L2 token to receive.\n * @param amount Amount of L1 tokens to deposit and L2 tokens to receive.\n * @param to Bridge recipient.\n */\n function relayTokens(\n address l1Token,\n address l2Token,\n uint256 amount,\n address to\n ) external payable override {\n // If the l1Token is weth then unwrap it to ETH then send the ETH to the standard bridge.\n if (l1Token == address(l1Weth)) {\n l1Weth.withdraw(amount);\n rootChainManager.depositEtherFor{ value: amount }(to);\n } else {\n IERC20(l1Token).safeIncreaseAllowance(address(rootChainManager), amount);\n rootChainManager.depositFor(to, l1Token, abi.encode(amount));\n }\n emit TokensRelayed(l1Token, l2Token, amount, to);\n }\n}\n" + }, + "contracts/chain-adapters/Mock_Adapter.sol": { + "content": "// SPDX-License-Identifier: AGPL-3.0-only\npragma solidity ^0.8.0;\n\nimport \"../interfaces/AdapterInterface.sol\";\nimport \"@openzeppelin/contracts/token/ERC20/IERC20.sol\";\n\n/**\n * @notice Contract used for testing communication between HubPool and Adapter.\n */\ncontract Mock_Adapter is AdapterInterface {\n event RelayMessageCalled(address target, bytes message, address caller);\n\n event RelayTokensCalled(address l1Token, address l2Token, uint256 amount, address to, address caller);\n\n Mock_Bridge public immutable bridge;\n\n constructor() {\n bridge = new Mock_Bridge();\n }\n\n function relayMessage(address target, bytes memory message) external payable override {\n bridge.bridgeMessage(target, message);\n emit RelayMessageCalled(target, message, msg.sender);\n }\n\n function relayTokens(\n address l1Token,\n address l2Token,\n uint256 amount,\n address to\n ) external payable override {\n IERC20(l1Token).approve(address(bridge), amount);\n bridge.bridgeTokens(l1Token, amount);\n emit RelayTokensCalled(l1Token, l2Token, amount, to, msg.sender);\n }\n}\n\n// This contract is intended to \"act like\" a simple version of an L2 bridge.\n// It's primarily meant to better reflect how a true L2 bridge interaction might work to give better gas estimates.\ncontract Mock_Bridge {\n event BridgedTokens(address token, uint256 amount);\n event BridgedMessage(address target, bytes message);\n\n mapping(address => uint256) deposits;\n\n function bridgeTokens(address token, uint256 amount) public {\n IERC20(token).transferFrom(msg.sender, address(this), amount);\n deposits[token] += amount;\n emit BridgedTokens(token, amount);\n }\n\n function bridgeMessage(address target, bytes memory message) public {\n emit BridgedMessage(target, message);\n }\n}\n" + }, + "contracts/chain-adapters/Ethereum_Adapter.sol": { + "content": "// SPDX-License-Identifier: AGPL-3.0-only\npragma solidity ^0.8.0;\n\nimport \"../interfaces/AdapterInterface.sol\";\n\nimport \"@openzeppelin/contracts/token/ERC20/IERC20.sol\";\nimport \"@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol\";\n\n/**\n * @notice Contract containing logic to send messages from L1 to Ethereum SpokePool.\n * @notice This contract should always be deployed on the same chain as the HubPool, as it acts as a pass-through\n * contract between HubPool and SpokePool on the same chain. Its named \"Ethereum_Adapter\" because a core assumption\n * is that the HubPool will be deployed on Ethereum, so this adapter will be used to communicate between HubPool\n * and the Ethereum_SpokePool.\n * @dev Public functions calling external contracts do not guard against reentrancy because they are expected to be\n * called via delegatecall, which will execute this contract's logic within the context of the originating contract.\n * For example, the HubPool will delegatecall these functions, therefore its only necessary that the HubPool's methods\n * that call this contract's logic guard against reentrancy.\n */\ncontract Ethereum_Adapter is AdapterInterface {\n using SafeERC20 for IERC20;\n\n /**\n * @notice Send message to target on Ethereum.\n * @notice This function, and contract overall, is not useful in practice except that the HubPool\n * expects to interact with the SpokePool via an Adapter, so when communicating to the Ethereum_SpokePool, it must\n * send messages via this pass-through contract.\n * @param target Contract that will receive message.\n * @param message Data to send to target.\n */\n function relayMessage(address target, bytes memory message) external payable override {\n _executeCall(target, message);\n emit MessageRelayed(target, message);\n }\n\n /**\n * @notice Send tokens to target.\n * @param l1Token L1 token to send.\n * @param l2Token Unused parameter in this contract.\n * @param amount Amount of L1 tokens to send.\n * @param to recipient.\n */\n function relayTokens(\n address l1Token,\n address l2Token, // l2Token is unused for ethereum since we are assuming that the HubPool is only deployed\n // on this network.\n uint256 amount,\n address to\n ) external payable override {\n IERC20(l1Token).safeTransfer(to, amount);\n emit TokensRelayed(l1Token, l2Token, amount, to);\n }\n\n // Note: this snippet of code is copied from Governor.sol. Source: https://github.com/UMAprotocol/protocol/blob/5b37ea818a28479c01e458389a83c3e736306b17/packages/core/contracts/oracle/implementation/Governor.sol#L190-L207\n function _executeCall(address to, bytes memory data) private {\n // Note: this snippet of code is copied from Governor.sol and modified to not include any \"value\" field.\n // solhint-disable-next-line no-inline-assembly\n\n bool success;\n assembly {\n let inputData := add(data, 0x20)\n let inputDataSize := mload(data)\n // Hardcode value to be 0 for relayed governance calls in order to avoid addressing complexity of bridging\n // value cross-chain.\n success := call(gas(), to, 0, inputData, inputDataSize, 0, 0)\n }\n require(success, \"execute call failed\");\n }\n}\n" + }, + "contracts/chain-adapters/Arbitrum_Adapter.sol": { + "content": "// SPDX-License-Identifier: AGPL-3.0-only\npragma solidity ^0.8.0;\n\nimport \"../interfaces/AdapterInterface.sol\";\n\ninterface ArbitrumL1InboxLike {\n function createRetryableTicket(\n address destAddr,\n uint256 arbTxCallValue,\n uint256 maxSubmissionCost,\n address submissionRefundAddress,\n address valueRefundAddress,\n uint256 maxGas,\n uint256 gasPriceBid,\n bytes calldata data\n ) external payable returns (uint256);\n}\n\ninterface ArbitrumL1ERC20GatewayLike {\n function outboundTransfer(\n address _token,\n address _to,\n uint256 _amount,\n uint256 _maxGas,\n uint256 _gasPriceBid,\n bytes calldata _data\n ) external payable returns (bytes memory);\n}\n\n/**\n * @notice Contract containing logic to send messages from L1 to Arbitrum.\n * @dev Public functions calling external contracts do not guard against reentrancy because they are expected to be\n * called via delegatecall, which will execute this contract's logic within the context of the originating contract.\n * For example, the HubPool will delegatecall these functions, therefore its only necessary that the HubPool's methods\n * that call this contract's logic guard against reentrancy.\n */\ncontract Arbitrum_Adapter is AdapterInterface {\n // Gas limit for immediate L2 execution attempt (can be estimated via NodeInterface.estimateRetryableTicket).\n // NodeInterface precompile interface exists at L2 address 0x00000000000000000000000000000000000000C8\n uint32 public immutable l2GasLimit = 5_000_000;\n\n // Amount of ETH allocated to pay for the base submission fee. The base submission fee is a parameter unique to\n // retryable transactions; the user is charged the base submission fee to cover the storage costs of keeping their\n // ticket’s calldata in the retry buffer. (current base submission fee is queryable via\n // ArbRetryableTx.getSubmissionPrice). ArbRetryableTicket precompile interface exists at L2 address\n // 0x000000000000000000000000000000000000006E.\n uint256 public immutable l2MaxSubmissionCost = 0.1e18;\n\n // L2 Gas price bid for immediate L2 execution attempt (queryable via standard eth*gasPrice RPC)\n uint256 public immutable l2GasPrice = 10e9; // 10 gWei\n\n // This address on L2 receives extra ETH that is left over after relaying a message via the inbox.\n address public immutable l2RefundL2Address;\n\n ArbitrumL1InboxLike public immutable l1Inbox;\n\n ArbitrumL1ERC20GatewayLike public immutable l1ERC20Gateway;\n\n /**\n * @notice Constructs new Adapter.\n * @param _l1ArbitrumInbox Inbox helper contract to send messages to Arbitrum.\n * @param _l1ERC20Gateway ERC20 gateway contract to send tokens to Arbitrum.\n */\n constructor(ArbitrumL1InboxLike _l1ArbitrumInbox, ArbitrumL1ERC20GatewayLike _l1ERC20Gateway) {\n l1Inbox = _l1ArbitrumInbox;\n l1ERC20Gateway = _l1ERC20Gateway;\n\n l2RefundL2Address = msg.sender;\n }\n\n /**\n * @notice Send cross-chain message to target on Arbitrum.\n * @notice This contract must hold at least getL1CallValue() amount of ETH to send a message via the Inbox\n * successfully, or the message will get stuck.\n * @param target Contract on Arbitrum that will receive message.\n * @param message Data to send to target.\n */\n function relayMessage(address target, bytes memory message) external payable override {\n uint256 requiredL1CallValue = getL1CallValue();\n require(address(this).balance >= requiredL1CallValue, \"Insufficient ETH balance\");\n\n l1Inbox.createRetryableTicket{ value: requiredL1CallValue }(\n target, // destAddr destination L2 contract address\n 0, // l2CallValue call value for retryable L2 message\n l2MaxSubmissionCost, // maxSubmissionCost Max gas deducted from user's L2 balance to cover base fee\n l2RefundL2Address, // excessFeeRefundAddress maxgas * gasprice - execution cost gets credited here on L2\n l2RefundL2Address, // callValueRefundAddress l2Callvalue gets credited here on L2 if retryable txn times out or gets cancelled\n l2GasLimit, // maxGas Max gas deducted from user's L2 balance to cover L2 execution\n l2GasPrice, // gasPriceBid price bid for L2 execution\n message // data ABI encoded data of L2 message\n );\n\n emit MessageRelayed(target, message);\n }\n\n /**\n * @notice Bridge tokens to Arbitrum.\n * @param l1Token L1 token to deposit.\n * @param l2Token L2 token to receive.\n * @param amount Amount of L1 tokens to deposit and L2 tokens to receive.\n * @param to Bridge recipient.\n */\n function relayTokens(\n address l1Token,\n address l2Token, // l2Token is unused for Arbitrum.\n uint256 amount,\n address to\n ) external payable override {\n l1ERC20Gateway.outboundTransfer(l1Token, to, amount, l2GasLimit, l2GasPrice, \"\");\n emit TokensRelayed(l1Token, l2Token, amount, to);\n }\n\n /**\n * @notice Returns required amount of ETH to send a message via the Inbox.\n * @return amount of ETH that this contract needs to hold in order for relayMessage to succeed.\n */\n function getL1CallValue() public pure returns (uint256) {\n return l2MaxSubmissionCost + l2GasPrice * l2GasLimit;\n }\n}\n" + }, + "@openzeppelin/contracts/access/Ownable.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts v4.4.1 (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 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 called by any account other than the owner.\n */\n modifier onlyOwner() {\n require(owner() == _msgSender(), \"Ownable: caller is not the owner\");\n _;\n }\n\n /**\n * @dev Leaves the contract without owner. It will not be possible to call\n * `onlyOwner` functions anymore. Can only be called by the current owner.\n *\n * NOTE: Renouncing ownership will leave the contract without an owner,\n * thereby removing 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" + }, + "contracts/Ethereum_SpokePool.sol": { + "content": "// SPDX-License-Identifier: GPL-3.0-only\npragma solidity ^0.8.0;\n\nimport \"./SpokePool.sol\";\nimport \"@openzeppelin/contracts/access/Ownable.sol\";\n\n/**\n * @notice Ethereum L1 specific SpokePool. Used on Ethereum L1 to facilitate L2->L1 transfers.\n */\ncontract Ethereum_SpokePool is SpokePool, Ownable {\n /**\n * @notice Construct the Ethereum SpokePool.\n * @param _hubPool Hub pool address to set. Can be changed by admin.\n * @param _wethAddress Weth address for this network to set.\n * @param timerAddress Timer address to set.\n */\n constructor(\n address _hubPool,\n address _wethAddress,\n address timerAddress\n ) SpokePool(msg.sender, _hubPool, _wethAddress, timerAddress) {}\n\n /**************************************\n * INTERNAL FUNCTIONS *\n **************************************/\n\n function _bridgeTokensToHubPool(RelayerRefundLeaf memory relayerRefundLeaf) internal override {\n IERC20(relayerRefundLeaf.l2TokenAddress).transfer(hubPool, relayerRefundLeaf.amountToReturn);\n }\n\n // Admin is simply owner which should be same account that owns the HubPool deployed on this network. A core\n // assumption of this contract system is that the HubPool is deployed on Ethereum.\n function _requireAdminSender() internal override onlyOwner {}\n}\n" + }, + "@uma/core/contracts/oracle/interfaces/OptimisticOracleInterface.sol": { + "content": "// SPDX-License-Identifier: AGPL-3.0-only\npragma solidity ^0.8.0;\n\nimport \"@openzeppelin/contracts/token/ERC20/IERC20.sol\";\n\n/**\n * @title Financial contract facing Oracle interface.\n * @dev Interface used by financial contracts to interact with the Oracle. Voters will use a different interface.\n */\nabstract contract OptimisticOracleInterface {\n // Struct representing the state of a price request.\n enum State {\n Invalid, // Never requested.\n Requested, // Requested, no other actions taken.\n Proposed, // Proposed, but not expired or disputed yet.\n Expired, // Proposed, not disputed, past liveness.\n Disputed, // Disputed, but no DVM price returned yet.\n Resolved, // Disputed and DVM price is available.\n Settled // Final price has been set in the contract (can get here from Expired or Resolved).\n }\n\n // Struct representing a price request.\n struct Request {\n address proposer; // Address of the proposer.\n address disputer; // Address of the disputer.\n IERC20 currency; // ERC20 token used to pay rewards and fees.\n bool settled; // True if the request is settled.\n bool refundOnDispute; // True if the requester should be refunded their reward on dispute.\n int256 proposedPrice; // Price that the proposer submitted.\n int256 resolvedPrice; // Price resolved once the request is settled.\n uint256 expirationTime; // Time at which the request auto-settles without a dispute.\n uint256 reward; // Amount of the currency to pay to the proposer on settlement.\n uint256 finalFee; // Final fee to pay to the Store upon request to the DVM.\n uint256 bond; // Bond that the proposer and disputer must pay on top of the final fee.\n uint256 customLiveness; // Custom liveness value set by the requester.\n }\n\n // This value must be <= the Voting contract's `ancillaryBytesLimit` value otherwise it is possible\n // that a price can be requested to this contract successfully, but cannot be disputed because the DVM refuses\n // to accept a price request made with ancillary data length over a certain size.\n uint256 public constant ancillaryBytesLimit = 8192;\n\n /**\n * @notice Requests a new price.\n * @param identifier price identifier being requested.\n * @param timestamp timestamp of the price being requested.\n * @param ancillaryData ancillary data representing additional args being passed with the price request.\n * @param currency ERC20 token used for payment of rewards and fees. Must be approved for use with the DVM.\n * @param reward reward offered to a successful proposer. Will be pulled from the caller. Note: this can be 0,\n * which could make sense if the contract requests and proposes the value in the same call or\n * provides its own reward system.\n * @return totalBond default bond (final fee) + final fee that the proposer and disputer will be required to pay.\n * This can be changed with a subsequent call to setBond().\n */\n function requestPrice(\n bytes32 identifier,\n uint256 timestamp,\n bytes memory ancillaryData,\n IERC20 currency,\n uint256 reward\n ) external virtual returns (uint256 totalBond);\n\n /**\n * @notice Set the proposal bond associated with a price request.\n * @param identifier price identifier to identify the existing request.\n * @param timestamp timestamp to identify the existing request.\n * @param ancillaryData ancillary data of the price being requested.\n * @param bond custom bond amount to set.\n * @return totalBond new bond + final fee that the proposer and disputer will be required to pay. This can be\n * changed again with a subsequent call to setBond().\n */\n function setBond(\n bytes32 identifier,\n uint256 timestamp,\n bytes memory ancillaryData,\n uint256 bond\n ) external virtual returns (uint256 totalBond);\n\n /**\n * @notice Sets the request to refund the reward if the proposal is disputed. This can help to \"hedge\" the caller\n * in the event of a dispute-caused delay. Note: in the event of a dispute, the winner still receives the other's\n * bond, so there is still profit to be made even if the reward is refunded.\n * @param identifier price identifier to identify the existing request.\n * @param timestamp timestamp to identify the existing request.\n * @param ancillaryData ancillary data of the price being requested.\n */\n function setRefundOnDispute(\n bytes32 identifier,\n uint256 timestamp,\n bytes memory ancillaryData\n ) external virtual;\n\n /**\n * @notice Sets a custom liveness value for the request. Liveness is the amount of time a proposal must wait before\n * being auto-resolved.\n * @param identifier price identifier to identify the existing request.\n * @param timestamp timestamp to identify the existing request.\n * @param ancillaryData ancillary data of the price being requested.\n * @param customLiveness new custom liveness.\n */\n function setCustomLiveness(\n bytes32 identifier,\n uint256 timestamp,\n bytes memory ancillaryData,\n uint256 customLiveness\n ) external virtual;\n\n /**\n * @notice Proposes a price value on another address' behalf. Note: this address will receive any rewards that come\n * from this proposal. However, any bonds are pulled from the caller.\n * @param proposer address to set as the proposer.\n * @param requester sender of the initial price request.\n * @param identifier price identifier to identify the existing request.\n * @param timestamp timestamp to identify the existing request.\n * @param ancillaryData ancillary data of the price being requested.\n * @param proposedPrice price being proposed.\n * @return totalBond the amount that's pulled from the caller's wallet as a bond. The bond will be returned to\n * the proposer once settled if the proposal is correct.\n */\n function proposePriceFor(\n address proposer,\n address requester,\n bytes32 identifier,\n uint256 timestamp,\n bytes memory ancillaryData,\n int256 proposedPrice\n ) public virtual returns (uint256 totalBond);\n\n /**\n * @notice Proposes a price value for an existing price request.\n * @param requester sender of the initial price request.\n * @param identifier price identifier to identify the existing request.\n * @param timestamp timestamp to identify the existing request.\n * @param ancillaryData ancillary data of the price being requested.\n * @param proposedPrice price being proposed.\n * @return totalBond the amount that's pulled from the proposer's wallet as a bond. The bond will be returned to\n * the proposer once settled if the proposal is correct.\n */\n function proposePrice(\n address requester,\n bytes32 identifier,\n uint256 timestamp,\n bytes memory ancillaryData,\n int256 proposedPrice\n ) external virtual returns (uint256 totalBond);\n\n /**\n * @notice Disputes a price request with an active proposal on another address' behalf. Note: this address will\n * receive any rewards that come from this dispute. However, any bonds are pulled from the caller.\n * @param disputer address to set as the disputer.\n * @param requester sender of the initial price request.\n * @param identifier price identifier to identify the existing request.\n * @param timestamp timestamp to identify the existing request.\n * @param ancillaryData ancillary data of the price being requested.\n * @return totalBond the amount that's pulled from the caller's wallet as a bond. The bond will be returned to\n * the disputer once settled if the dispute was value (the proposal was incorrect).\n */\n function disputePriceFor(\n address disputer,\n address requester,\n bytes32 identifier,\n uint256 timestamp,\n bytes memory ancillaryData\n ) public virtual returns (uint256 totalBond);\n\n /**\n * @notice Disputes a price value for an existing price request with an active proposal.\n * @param requester sender of the initial price request.\n * @param identifier price identifier to identify the existing request.\n * @param timestamp timestamp to identify the existing request.\n * @param ancillaryData ancillary data of the price being requested.\n * @return totalBond the amount that's pulled from the disputer's wallet as a bond. The bond will be returned to\n * the disputer once settled if the dispute was valid (the proposal was incorrect).\n */\n function disputePrice(\n address requester,\n bytes32 identifier,\n uint256 timestamp,\n bytes memory ancillaryData\n ) external virtual returns (uint256 totalBond);\n\n /**\n * @notice Retrieves a price that was previously requested by a caller. Reverts if the request is not settled\n * or settleable. Note: this method is not view so that this call may actually settle the price request if it\n * hasn't been settled.\n * @param identifier price identifier to identify the existing request.\n * @param timestamp timestamp to identify the existing request.\n * @param ancillaryData ancillary data of the price being requested.\n * @return resolved price.\n */\n function settleAndGetPrice(\n bytes32 identifier,\n uint256 timestamp,\n bytes memory ancillaryData\n ) external virtual returns (int256);\n\n /**\n * @notice Attempts to settle an outstanding price request. Will revert if it isn't settleable.\n * @param requester sender of the initial price request.\n * @param identifier price identifier to identify the existing request.\n * @param timestamp timestamp to identify the existing request.\n * @param ancillaryData ancillary data of the price being requested.\n * @return payout the amount that the \"winner\" (proposer or disputer) receives on settlement. This amount includes\n * the returned bonds as well as additional rewards.\n */\n function settle(\n address requester,\n bytes32 identifier,\n uint256 timestamp,\n bytes memory ancillaryData\n ) external virtual returns (uint256 payout);\n\n /**\n * @notice Gets the current data structure containing all information about a price request.\n * @param requester sender of the initial price request.\n * @param identifier price identifier to identify the existing request.\n * @param timestamp timestamp to identify the existing request.\n * @param ancillaryData ancillary data of the price being requested.\n * @return the Request data structure.\n */\n function getRequest(\n address requester,\n bytes32 identifier,\n uint256 timestamp,\n bytes memory ancillaryData\n ) public view virtual returns (Request memory);\n\n /**\n * @notice Returns the state of a price request.\n * @param requester sender of the initial price request.\n * @param identifier price identifier to identify the existing request.\n * @param timestamp timestamp to identify the existing request.\n * @param ancillaryData ancillary data of the price being requested.\n * @return the State enum value.\n */\n function getState(\n address requester,\n bytes32 identifier,\n uint256 timestamp,\n bytes memory ancillaryData\n ) public view virtual returns (State);\n\n /**\n * @notice Checks if a given request has resolved or been settled (i.e the optimistic oracle has a price).\n * @param requester sender of the initial price request.\n * @param identifier price identifier to identify the existing request.\n * @param timestamp timestamp to identify the existing request.\n * @param ancillaryData ancillary data of the price being requested.\n * @return true if price has resolved or settled, false otherwise.\n */\n function hasPrice(\n address requester,\n bytes32 identifier,\n uint256 timestamp,\n bytes memory ancillaryData\n ) public view virtual returns (bool);\n\n function stampAncillaryData(bytes memory ancillaryData, address requester)\n public\n view\n virtual\n returns (bytes memory);\n}\n" + }, + "@uma/core/contracts/oracle/interfaces/SkinnyOptimisticOracleInterface.sol": { + "content": "// SPDX-License-Identifier: AGPL-3.0-only\npragma solidity ^0.8.0;\n\nimport \"@openzeppelin/contracts/token/ERC20/IERC20.sol\";\nimport \"../interfaces/OptimisticOracleInterface.sol\";\n\n/**\n * @title Interface for the gas-cost-reduced version of the OptimisticOracle.\n * @notice Differences from normal OptimisticOracle:\n * - refundOnDispute: flag is removed, by default there are no refunds on disputes.\n * - customizing request parameters: In the OptimisticOracle, parameters like `bond` and `customLiveness` can be reset\n * after a request is already made via `requestPrice`. In the SkinnyOptimisticOracle, these parameters can only be\n * set in `requestPrice`, which has an expanded input set.\n * - settleAndGetPrice: Replaced by `settle`, which can only be called once per settleable request. The resolved price\n * can be fetched via the `Settle` event or the return value of `settle`.\n * - general changes to interface: Functions that interact with existing requests all require the parameters of the\n * request to modify to be passed as input. These parameters must match with the existing request parameters or the\n * function will revert. This change reflects the internal refactor to store hashed request parameters instead of the\n * full request struct.\n * @dev Interface used by financial contracts to interact with the Oracle. Voters will use a different interface.\n */\nabstract contract SkinnyOptimisticOracleInterface {\n // Struct representing a price request. Note that this differs from the OptimisticOracleInterface's Request struct\n // in that refundOnDispute is removed.\n struct Request {\n address proposer; // Address of the proposer.\n address disputer; // Address of the disputer.\n IERC20 currency; // ERC20 token used to pay rewards and fees.\n bool settled; // True if the request is settled.\n int256 proposedPrice; // Price that the proposer submitted.\n int256 resolvedPrice; // Price resolved once the request is settled.\n uint256 expirationTime; // Time at which the request auto-settles without a dispute.\n uint256 reward; // Amount of the currency to pay to the proposer on settlement.\n uint256 finalFee; // Final fee to pay to the Store upon request to the DVM.\n uint256 bond; // Bond that the proposer and disputer must pay on top of the final fee.\n uint256 customLiveness; // Custom liveness value set by the requester.\n }\n\n // This value must be <= the Voting contract's `ancillaryBytesLimit` value otherwise it is possible\n // that a price can be requested to this contract successfully, but cannot be disputed because the DVM refuses\n // to accept a price request made with ancillary data length over a certain size.\n uint256 public constant ancillaryBytesLimit = 8192;\n\n /**\n * @notice Requests a new price.\n * @param identifier price identifier being requested.\n * @param timestamp timestamp of the price being requested.\n * @param ancillaryData ancillary data representing additional args being passed with the price request.\n * @param currency ERC20 token used for payment of rewards and fees. Must be approved for use with the DVM.\n * @param reward reward offered to a successful proposer. Will be pulled from the caller. Note: this can be 0,\n * which could make sense if the contract requests and proposes the value in the same call or\n * provides its own reward system.\n * @param bond custom proposal bond to set for request. If set to 0, defaults to the final fee.\n * @param customLiveness custom proposal liveness to set for request.\n * @return totalBond default bond + final fee that the proposer and disputer will be required to pay.\n */\n function requestPrice(\n bytes32 identifier,\n uint32 timestamp,\n bytes memory ancillaryData,\n IERC20 currency,\n uint256 reward,\n uint256 bond,\n uint256 customLiveness\n ) external virtual returns (uint256 totalBond);\n\n /**\n * @notice Proposes a price value on another address' behalf. Note: this address will receive any rewards that come\n * from this proposal. However, any bonds are pulled from the caller.\n * @param requester sender of the initial price request.\n * @param identifier price identifier to identify the existing request.\n * @param timestamp timestamp to identify the existing request.\n * @param ancillaryData ancillary data of the price being requested.\n * @param request price request parameters whose hash must match the request that the caller wants to\n * propose a price for.\n * @param proposer address to set as the proposer.\n * @param proposedPrice price being proposed.\n * @return totalBond the amount that's pulled from the caller's wallet as a bond. The bond will be returned to\n * the proposer once settled if the proposal is correct.\n */\n function proposePriceFor(\n address requester,\n bytes32 identifier,\n uint32 timestamp,\n bytes memory ancillaryData,\n Request memory request,\n address proposer,\n int256 proposedPrice\n ) public virtual returns (uint256 totalBond);\n\n /**\n * @notice Proposes a price value where caller is the proposer.\n * @param requester sender of the initial price request.\n * @param identifier price identifier to identify the existing request.\n * @param timestamp timestamp to identify the existing request.\n * @param ancillaryData ancillary data of the price being requested.\n * @param request price request parameters whose hash must match the request that the caller wants to\n * propose a price for.\n * @param proposedPrice price being proposed.\n * @return totalBond the amount that's pulled from the caller's wallet as a bond. The bond will be returned to\n * the proposer once settled if the proposal is correct.\n */\n function proposePrice(\n address requester,\n bytes32 identifier,\n uint32 timestamp,\n bytes memory ancillaryData,\n Request memory request,\n int256 proposedPrice\n ) external virtual returns (uint256 totalBond);\n\n /**\n * @notice Combines logic of requestPrice and proposePrice while taking advantage of gas savings from not having to\n * overwrite Request params that a normal requestPrice() => proposePrice() flow would entail. Note: The proposer\n * will receive any rewards that come from this proposal. However, any bonds are pulled from the caller.\n * @dev The caller is the requester, but the proposer can be customized.\n * @param identifier price identifier to identify the existing request.\n * @param timestamp timestamp to identify the existing request.\n * @param ancillaryData ancillary data of the price being requested.\n * @param currency ERC20 token used for payment of rewards and fees. Must be approved for use with the DVM.\n * @param reward reward offered to a successful proposer. Will be pulled from the caller. Note: this can be 0,\n * which could make sense if the contract requests and proposes the value in the same call or\n * provides its own reward system.\n * @param bond custom proposal bond to set for request. If set to 0, defaults to the final fee.\n * @param customLiveness custom proposal liveness to set for request.\n * @param proposer address to set as the proposer.\n * @param proposedPrice price being proposed.\n * @return totalBond the amount that's pulled from the caller's wallet as a bond. The bond will be returned to\n * the proposer once settled if the proposal is correct.\n */\n function requestAndProposePriceFor(\n bytes32 identifier,\n uint32 timestamp,\n bytes memory ancillaryData,\n IERC20 currency,\n uint256 reward,\n uint256 bond,\n uint256 customLiveness,\n address proposer,\n int256 proposedPrice\n ) external virtual returns (uint256 totalBond);\n\n /**\n * @notice Disputes a price request with an active proposal on another address' behalf. Note: this address will\n * receive any rewards that come from this dispute. However, any bonds are pulled from the caller.\n * @param identifier price identifier to identify the existing request.\n * @param timestamp timestamp to identify the existing request.\n * @param ancillaryData ancillary data of the price being requested.\n * @param request price request parameters whose hash must match the request that the caller wants to\n * dispute.\n * @param disputer address to set as the disputer.\n * @param requester sender of the initial price request.\n * @return totalBond the amount that's pulled from the caller's wallet as a bond. The bond will be returned to\n * the disputer once settled if the dispute was valid (the proposal was incorrect).\n */\n function disputePriceFor(\n bytes32 identifier,\n uint32 timestamp,\n bytes memory ancillaryData,\n Request memory request,\n address disputer,\n address requester\n ) public virtual returns (uint256 totalBond);\n\n /**\n * @notice Disputes a price request with an active proposal where caller is the disputer.\n * @param requester sender of the initial price request.\n * @param identifier price identifier to identify the existing request.\n * @param timestamp timestamp to identify the existing request.\n * @param ancillaryData ancillary data of the price being requested.\n * @param request price request parameters whose hash must match the request that the caller wants to\n * dispute.\n * @return totalBond the amount that's pulled from the caller's wallet as a bond. The bond will be returned to\n * the disputer once settled if the dispute was valid (the proposal was incorrect).\n */\n function disputePrice(\n address requester,\n bytes32 identifier,\n uint32 timestamp,\n bytes memory ancillaryData,\n Request memory request\n ) external virtual returns (uint256 totalBond);\n\n /**\n * @notice Attempts to settle an outstanding price request. Will revert if it isn't settleable.\n * @param requester sender of the initial price request.\n * @param identifier price identifier to identify the existing request.\n * @param timestamp timestamp to identify the existing request.\n * @param ancillaryData ancillary data of the price being requested.\n * @param request price request parameters whose hash must match the request that the caller wants to\n * settle.\n * @return payout the amount that the \"winner\" (proposer or disputer) receives on settlement. This amount includes\n * the returned bonds as well as additional rewards.\n * @return resolvedPrice the price that the request settled to.\n */\n function settle(\n address requester,\n bytes32 identifier,\n uint32 timestamp,\n bytes memory ancillaryData,\n Request memory request\n ) external virtual returns (uint256 payout, int256 resolvedPrice);\n\n /**\n * @notice Computes the current state of a price request. See the State enum for more details.\n * @param requester sender of the initial price request.\n * @param identifier price identifier to identify the existing request.\n * @param timestamp timestamp to identify the existing request.\n * @param ancillaryData ancillary data of the price being requested.\n * @param request price request parameters.\n * @return the State.\n */\n function getState(\n address requester,\n bytes32 identifier,\n uint32 timestamp,\n bytes memory ancillaryData,\n Request memory request\n ) external virtual returns (OptimisticOracleInterface.State);\n\n /**\n * @notice Checks if a given request has resolved, expired or been settled (i.e the optimistic oracle has a price).\n * @param requester sender of the initial price request.\n * @param identifier price identifier to identify the existing request.\n * @param timestamp timestamp to identify the existing request.\n * @param ancillaryData ancillary data of the price being requested.\n * @param request price request parameters. The hash of these parameters must match with the request hash that is\n * associated with the price request unique ID {requester, identifier, timestamp, ancillaryData}, or this method\n * will revert.\n * @return boolean indicating true if price exists and false if not.\n */\n function hasPrice(\n address requester,\n bytes32 identifier,\n uint32 timestamp,\n bytes memory ancillaryData,\n Request memory request\n ) public virtual returns (bool);\n\n /**\n * @notice Generates stamped ancillary data in the format that it would be used in the case of a price dispute.\n * @param ancillaryData ancillary data of the price being requested.\n * @param requester sender of the initial price request.\n * @return the stamped ancillary bytes.\n */\n function stampAncillaryData(bytes memory ancillaryData, address requester)\n public\n pure\n virtual\n returns (bytes memory);\n}\n" + }, + "@uma/core/contracts/oracle/interfaces/StoreInterface.sol": { + "content": "// SPDX-License-Identifier: AGPL-3.0-only\npragma solidity ^0.8.0;\n\nimport \"@openzeppelin/contracts/token/ERC20/IERC20.sol\";\nimport \"../../common/implementation/FixedPoint.sol\";\n\n/**\n * @title Interface that allows financial contracts to pay oracle fees for their use of the system.\n */\ninterface StoreInterface {\n /**\n * @notice Pays Oracle fees in ETH to the store.\n * @dev To be used by contracts whose margin currency is ETH.\n */\n function payOracleFees() external payable;\n\n /**\n * @notice Pays oracle fees in the margin currency, erc20Address, to the store.\n * @dev To be used if the margin currency is an ERC20 token rather than ETH.\n * @param erc20Address address of the ERC20 token used to pay the fee.\n * @param amount number of tokens to transfer. An approval for at least this amount must exist.\n */\n function payOracleFeesErc20(address erc20Address, FixedPoint.Unsigned calldata amount) external;\n\n /**\n * @notice Computes the regular oracle fees that a contract should pay for a period.\n * @param startTime defines the beginning time from which the fee is paid.\n * @param endTime end time until which the fee is paid.\n * @param pfc \"profit from corruption\", or the maximum amount of margin currency that a\n * token sponsor could extract from the contract through corrupting the price feed in their favor.\n * @return regularFee amount owed for the duration from start to end time for the given pfc.\n * @return latePenalty for paying the fee after the deadline.\n */\n function computeRegularFee(\n uint256 startTime,\n uint256 endTime,\n FixedPoint.Unsigned calldata pfc\n ) external view returns (FixedPoint.Unsigned memory regularFee, FixedPoint.Unsigned memory latePenalty);\n\n /**\n * @notice Computes the final oracle fees that a contract should pay at settlement.\n * @param currency token used to pay the final fee.\n * @return finalFee amount due.\n */\n function computeFinalFee(address currency) external view returns (FixedPoint.Unsigned memory);\n}\n" + }, + "@uma/core/contracts/common/implementation/FixedPoint.sol": { + "content": "// SPDX-License-Identifier: AGPL-3.0-only\npragma solidity ^0.8.0;\n\nimport \"@openzeppelin/contracts/utils/math/SafeMath.sol\";\nimport \"@openzeppelin/contracts/utils/math/SignedSafeMath.sol\";\n\n/**\n * @title Library for fixed point arithmetic on uints\n */\nlibrary FixedPoint {\n using SafeMath for uint256;\n using SignedSafeMath for int256;\n\n // Supports 18 decimals. E.g., 1e18 represents \"1\", 5e17 represents \"0.5\".\n // For unsigned values:\n // This can represent a value up to (2^256 - 1)/10^18 = ~10^59. 10^59 will be stored internally as uint256 10^77.\n uint256 private constant FP_SCALING_FACTOR = 10**18;\n\n // --------------------------------------- UNSIGNED -----------------------------------------------------------------------------\n struct Unsigned {\n uint256 rawValue;\n }\n\n /**\n * @notice Constructs an `Unsigned` from an unscaled uint, e.g., `b=5` gets stored internally as `5*(10**18)`.\n * @param a uint to convert into a FixedPoint.\n * @return the converted FixedPoint.\n */\n function fromUnscaledUint(uint256 a) internal pure returns (Unsigned memory) {\n return Unsigned(a.mul(FP_SCALING_FACTOR));\n }\n\n /**\n * @notice Whether `a` is equal to `b`.\n * @param a a FixedPoint.\n * @param b a uint256.\n * @return True if equal, or False.\n */\n function isEqual(Unsigned memory a, uint256 b) internal pure returns (bool) {\n return a.rawValue == fromUnscaledUint(b).rawValue;\n }\n\n /**\n * @notice Whether `a` is equal to `b`.\n * @param a a FixedPoint.\n * @param b a FixedPoint.\n * @return True if equal, or False.\n */\n function isEqual(Unsigned memory a, Unsigned memory b) internal pure returns (bool) {\n return a.rawValue == b.rawValue;\n }\n\n /**\n * @notice Whether `a` is greater than `b`.\n * @param a a FixedPoint.\n * @param b a FixedPoint.\n * @return True if `a > b`, or False.\n */\n function isGreaterThan(Unsigned memory a, Unsigned memory b) internal pure returns (bool) {\n return a.rawValue > b.rawValue;\n }\n\n /**\n * @notice Whether `a` is greater than `b`.\n * @param a a FixedPoint.\n * @param b a uint256.\n * @return True if `a > b`, or False.\n */\n function isGreaterThan(Unsigned memory a, uint256 b) internal pure returns (bool) {\n return a.rawValue > fromUnscaledUint(b).rawValue;\n }\n\n /**\n * @notice Whether `a` is greater than `b`.\n * @param a a uint256.\n * @param b a FixedPoint.\n * @return True if `a > b`, or False.\n */\n function isGreaterThan(uint256 a, Unsigned memory b) internal pure returns (bool) {\n return fromUnscaledUint(a).rawValue > b.rawValue;\n }\n\n /**\n * @notice Whether `a` is greater than or equal to `b`.\n * @param a a FixedPoint.\n * @param b a FixedPoint.\n * @return True if `a >= b`, or False.\n */\n function isGreaterThanOrEqual(Unsigned memory a, Unsigned memory b) internal pure returns (bool) {\n return a.rawValue >= b.rawValue;\n }\n\n /**\n * @notice Whether `a` is greater than or equal to `b`.\n * @param a a FixedPoint.\n * @param b a uint256.\n * @return True if `a >= b`, or False.\n */\n function isGreaterThanOrEqual(Unsigned memory a, uint256 b) internal pure returns (bool) {\n return a.rawValue >= fromUnscaledUint(b).rawValue;\n }\n\n /**\n * @notice Whether `a` is greater than or equal to `b`.\n * @param a a uint256.\n * @param b a FixedPoint.\n * @return True if `a >= b`, or False.\n */\n function isGreaterThanOrEqual(uint256 a, Unsigned memory b) internal pure returns (bool) {\n return fromUnscaledUint(a).rawValue >= b.rawValue;\n }\n\n /**\n * @notice Whether `a` is less than `b`.\n * @param a a FixedPoint.\n * @param b a FixedPoint.\n * @return True if `a < b`, or False.\n */\n function isLessThan(Unsigned memory a, Unsigned memory b) internal pure returns (bool) {\n return a.rawValue < b.rawValue;\n }\n\n /**\n * @notice Whether `a` is less than `b`.\n * @param a a FixedPoint.\n * @param b a uint256.\n * @return True if `a < b`, or False.\n */\n function isLessThan(Unsigned memory a, uint256 b) internal pure returns (bool) {\n return a.rawValue < fromUnscaledUint(b).rawValue;\n }\n\n /**\n * @notice Whether `a` is less than `b`.\n * @param a a uint256.\n * @param b a FixedPoint.\n * @return True if `a < b`, or False.\n */\n function isLessThan(uint256 a, Unsigned memory b) internal pure returns (bool) {\n return fromUnscaledUint(a).rawValue < b.rawValue;\n }\n\n /**\n * @notice Whether `a` is less than or equal to `b`.\n * @param a a FixedPoint.\n * @param b a FixedPoint.\n * @return True if `a <= b`, or False.\n */\n function isLessThanOrEqual(Unsigned memory a, Unsigned memory b) internal pure returns (bool) {\n return a.rawValue <= b.rawValue;\n }\n\n /**\n * @notice Whether `a` is less than or equal to `b`.\n * @param a a FixedPoint.\n * @param b a uint256.\n * @return True if `a <= b`, or False.\n */\n function isLessThanOrEqual(Unsigned memory a, uint256 b) internal pure returns (bool) {\n return a.rawValue <= fromUnscaledUint(b).rawValue;\n }\n\n /**\n * @notice Whether `a` is less than or equal to `b`.\n * @param a a uint256.\n * @param b a FixedPoint.\n * @return True if `a <= b`, or False.\n */\n function isLessThanOrEqual(uint256 a, Unsigned memory b) internal pure returns (bool) {\n return fromUnscaledUint(a).rawValue <= b.rawValue;\n }\n\n /**\n * @notice The minimum of `a` and `b`.\n * @param a a FixedPoint.\n * @param b a FixedPoint.\n * @return the minimum of `a` and `b`.\n */\n function min(Unsigned memory a, Unsigned memory b) internal pure returns (Unsigned memory) {\n return a.rawValue < b.rawValue ? a : b;\n }\n\n /**\n * @notice The maximum of `a` and `b`.\n * @param a a FixedPoint.\n * @param b a FixedPoint.\n * @return the maximum of `a` and `b`.\n */\n function max(Unsigned memory a, Unsigned memory b) internal pure returns (Unsigned memory) {\n return a.rawValue > b.rawValue ? a : b;\n }\n\n /**\n * @notice Adds two `Unsigned`s, reverting on overflow.\n * @param a a FixedPoint.\n * @param b a FixedPoint.\n * @return the sum of `a` and `b`.\n */\n function add(Unsigned memory a, Unsigned memory b) internal pure returns (Unsigned memory) {\n return Unsigned(a.rawValue.add(b.rawValue));\n }\n\n /**\n * @notice Adds an `Unsigned` to an unscaled uint, reverting on overflow.\n * @param a a FixedPoint.\n * @param b a uint256.\n * @return the sum of `a` and `b`.\n */\n function add(Unsigned memory a, uint256 b) internal pure returns (Unsigned memory) {\n return add(a, fromUnscaledUint(b));\n }\n\n /**\n * @notice Subtracts two `Unsigned`s, reverting on overflow.\n * @param a a FixedPoint.\n * @param b a FixedPoint.\n * @return the difference of `a` and `b`.\n */\n function sub(Unsigned memory a, Unsigned memory b) internal pure returns (Unsigned memory) {\n return Unsigned(a.rawValue.sub(b.rawValue));\n }\n\n /**\n * @notice Subtracts an unscaled uint256 from an `Unsigned`, reverting on overflow.\n * @param a a FixedPoint.\n * @param b a uint256.\n * @return the difference of `a` and `b`.\n */\n function sub(Unsigned memory a, uint256 b) internal pure returns (Unsigned memory) {\n return sub(a, fromUnscaledUint(b));\n }\n\n /**\n * @notice Subtracts an `Unsigned` from an unscaled uint256, reverting on overflow.\n * @param a a uint256.\n * @param b a FixedPoint.\n * @return the difference of `a` and `b`.\n */\n function sub(uint256 a, Unsigned memory b) internal pure returns (Unsigned memory) {\n return sub(fromUnscaledUint(a), b);\n }\n\n /**\n * @notice Multiplies two `Unsigned`s, reverting on overflow.\n * @dev This will \"floor\" the product.\n * @param a a FixedPoint.\n * @param b a FixedPoint.\n * @return the product of `a` and `b`.\n */\n function mul(Unsigned memory a, Unsigned memory b) internal pure returns (Unsigned memory) {\n // There are two caveats with this computation:\n // 1. Max output for the represented number is ~10^41, otherwise an intermediate value overflows. 10^41 is\n // stored internally as a uint256 ~10^59.\n // 2. Results that can't be represented exactly are truncated not rounded. E.g., 1.4 * 2e-18 = 2.8e-18, which\n // would round to 3, but this computation produces the result 2.\n // No need to use SafeMath because FP_SCALING_FACTOR != 0.\n return Unsigned(a.rawValue.mul(b.rawValue) / FP_SCALING_FACTOR);\n }\n\n /**\n * @notice Multiplies an `Unsigned` and an unscaled uint256, reverting on overflow.\n * @dev This will \"floor\" the product.\n * @param a a FixedPoint.\n * @param b a uint256.\n * @return the product of `a` and `b`.\n */\n function mul(Unsigned memory a, uint256 b) internal pure returns (Unsigned memory) {\n return Unsigned(a.rawValue.mul(b));\n }\n\n /**\n * @notice Multiplies two `Unsigned`s and \"ceil's\" the product, reverting on overflow.\n * @param a a FixedPoint.\n * @param b a FixedPoint.\n * @return the product of `a` and `b`.\n */\n function mulCeil(Unsigned memory a, Unsigned memory b) internal pure returns (Unsigned memory) {\n uint256 mulRaw = a.rawValue.mul(b.rawValue);\n uint256 mulFloor = mulRaw / FP_SCALING_FACTOR;\n uint256 mod = mulRaw.mod(FP_SCALING_FACTOR);\n if (mod != 0) {\n return Unsigned(mulFloor.add(1));\n } else {\n return Unsigned(mulFloor);\n }\n }\n\n /**\n * @notice Multiplies an `Unsigned` and an unscaled uint256 and \"ceil's\" the product, reverting on overflow.\n * @param a a FixedPoint.\n * @param b a FixedPoint.\n * @return the product of `a` and `b`.\n */\n function mulCeil(Unsigned memory a, uint256 b) internal pure returns (Unsigned memory) {\n // Since b is an uint, there is no risk of truncation and we can just mul it normally\n return Unsigned(a.rawValue.mul(b));\n }\n\n /**\n * @notice Divides one `Unsigned` by an `Unsigned`, reverting on overflow or division by 0.\n * @dev This will \"floor\" the quotient.\n * @param a a FixedPoint numerator.\n * @param b a FixedPoint denominator.\n * @return the quotient of `a` divided by `b`.\n */\n function div(Unsigned memory a, Unsigned memory b) internal pure returns (Unsigned memory) {\n // There are two caveats with this computation:\n // 1. Max value for the number dividend `a` represents is ~10^41, otherwise an intermediate value overflows.\n // 10^41 is stored internally as a uint256 10^59.\n // 2. Results that can't be represented exactly are truncated not rounded. E.g., 2 / 3 = 0.6 repeating, which\n // would round to 0.666666666666666667, but this computation produces the result 0.666666666666666666.\n return Unsigned(a.rawValue.mul(FP_SCALING_FACTOR).div(b.rawValue));\n }\n\n /**\n * @notice Divides one `Unsigned` by an unscaled uint256, reverting on overflow or division by 0.\n * @dev This will \"floor\" the quotient.\n * @param a a FixedPoint numerator.\n * @param b a uint256 denominator.\n * @return the quotient of `a` divided by `b`.\n */\n function div(Unsigned memory a, uint256 b) internal pure returns (Unsigned memory) {\n return Unsigned(a.rawValue.div(b));\n }\n\n /**\n * @notice Divides one unscaled uint256 by an `Unsigned`, reverting on overflow or division by 0.\n * @dev This will \"floor\" the quotient.\n * @param a a uint256 numerator.\n * @param b a FixedPoint denominator.\n * @return the quotient of `a` divided by `b`.\n */\n function div(uint256 a, Unsigned memory b) internal pure returns (Unsigned memory) {\n return div(fromUnscaledUint(a), b);\n }\n\n /**\n * @notice Divides one `Unsigned` by an `Unsigned` and \"ceil's\" the quotient, reverting on overflow or division by 0.\n * @param a a FixedPoint numerator.\n * @param b a FixedPoint denominator.\n * @return the quotient of `a` divided by `b`.\n */\n function divCeil(Unsigned memory a, Unsigned memory b) internal pure returns (Unsigned memory) {\n uint256 aScaled = a.rawValue.mul(FP_SCALING_FACTOR);\n uint256 divFloor = aScaled.div(b.rawValue);\n uint256 mod = aScaled.mod(b.rawValue);\n if (mod != 0) {\n return Unsigned(divFloor.add(1));\n } else {\n return Unsigned(divFloor);\n }\n }\n\n /**\n * @notice Divides one `Unsigned` by an unscaled uint256 and \"ceil's\" the quotient, reverting on overflow or division by 0.\n * @param a a FixedPoint numerator.\n * @param b a uint256 denominator.\n * @return the quotient of `a` divided by `b`.\n */\n function divCeil(Unsigned memory a, uint256 b) internal pure returns (Unsigned memory) {\n // Because it is possible that a quotient gets truncated, we can't just call \"Unsigned(a.rawValue.div(b))\"\n // similarly to mulCeil with a uint256 as the second parameter. Therefore we need to convert b into an Unsigned.\n // This creates the possibility of overflow if b is very large.\n return divCeil(a, fromUnscaledUint(b));\n }\n\n /**\n * @notice Raises an `Unsigned` to the power of an unscaled uint256, reverting on overflow. E.g., `b=2` squares `a`.\n * @dev This will \"floor\" the result.\n * @param a a FixedPoint numerator.\n * @param b a uint256 denominator.\n * @return output is `a` to the power of `b`.\n */\n function pow(Unsigned memory a, uint256 b) internal pure returns (Unsigned memory output) {\n output = fromUnscaledUint(1);\n for (uint256 i = 0; i < b; i = i.add(1)) {\n output = mul(output, a);\n }\n }\n\n // ------------------------------------------------- SIGNED -------------------------------------------------------------\n // Supports 18 decimals. E.g., 1e18 represents \"1\", 5e17 represents \"0.5\".\n // For signed values:\n // This can represent a value up (or down) to +-(2^255 - 1)/10^18 = ~10^58. 10^58 will be stored internally as int256 10^76.\n int256 private constant SFP_SCALING_FACTOR = 10**18;\n\n struct Signed {\n int256 rawValue;\n }\n\n function fromSigned(Signed memory a) internal pure returns (Unsigned memory) {\n require(a.rawValue >= 0, \"Negative value provided\");\n return Unsigned(uint256(a.rawValue));\n }\n\n function fromUnsigned(Unsigned memory a) internal pure returns (Signed memory) {\n require(a.rawValue <= uint256(type(int256).max), \"Unsigned too large\");\n return Signed(int256(a.rawValue));\n }\n\n /**\n * @notice Constructs a `Signed` from an unscaled int, e.g., `b=5` gets stored internally as `5*(10**18)`.\n * @param a int to convert into a FixedPoint.Signed.\n * @return the converted FixedPoint.Signed.\n */\n function fromUnscaledInt(int256 a) internal pure returns (Signed memory) {\n return Signed(a.mul(SFP_SCALING_FACTOR));\n }\n\n /**\n * @notice Whether `a` is equal to `b`.\n * @param a a FixedPoint.Signed.\n * @param b a int256.\n * @return True if equal, or False.\n */\n function isEqual(Signed memory a, int256 b) internal pure returns (bool) {\n return a.rawValue == fromUnscaledInt(b).rawValue;\n }\n\n /**\n * @notice Whether `a` is equal to `b`.\n * @param a a FixedPoint.Signed.\n * @param b a FixedPoint.Signed.\n * @return True if equal, or False.\n */\n function isEqual(Signed memory a, Signed memory b) internal pure returns (bool) {\n return a.rawValue == b.rawValue;\n }\n\n /**\n * @notice Whether `a` is greater than `b`.\n * @param a a FixedPoint.Signed.\n * @param b a FixedPoint.Signed.\n * @return True if `a > b`, or False.\n */\n function isGreaterThan(Signed memory a, Signed memory b) internal pure returns (bool) {\n return a.rawValue > b.rawValue;\n }\n\n /**\n * @notice Whether `a` is greater than `b`.\n * @param a a FixedPoint.Signed.\n * @param b an int256.\n * @return True if `a > b`, or False.\n */\n function isGreaterThan(Signed memory a, int256 b) internal pure returns (bool) {\n return a.rawValue > fromUnscaledInt(b).rawValue;\n }\n\n /**\n * @notice Whether `a` is greater than `b`.\n * @param a an int256.\n * @param b a FixedPoint.Signed.\n * @return True if `a > b`, or False.\n */\n function isGreaterThan(int256 a, Signed memory b) internal pure returns (bool) {\n return fromUnscaledInt(a).rawValue > b.rawValue;\n }\n\n /**\n * @notice Whether `a` is greater than or equal to `b`.\n * @param a a FixedPoint.Signed.\n * @param b a FixedPoint.Signed.\n * @return True if `a >= b`, or False.\n */\n function isGreaterThanOrEqual(Signed memory a, Signed memory b) internal pure returns (bool) {\n return a.rawValue >= b.rawValue;\n }\n\n /**\n * @notice Whether `a` is greater than or equal to `b`.\n * @param a a FixedPoint.Signed.\n * @param b an int256.\n * @return True if `a >= b`, or False.\n */\n function isGreaterThanOrEqual(Signed memory a, int256 b) internal pure returns (bool) {\n return a.rawValue >= fromUnscaledInt(b).rawValue;\n }\n\n /**\n * @notice Whether `a` is greater than or equal to `b`.\n * @param a an int256.\n * @param b a FixedPoint.Signed.\n * @return True if `a >= b`, or False.\n */\n function isGreaterThanOrEqual(int256 a, Signed memory b) internal pure returns (bool) {\n return fromUnscaledInt(a).rawValue >= b.rawValue;\n }\n\n /**\n * @notice Whether `a` is less than `b`.\n * @param a a FixedPoint.Signed.\n * @param b a FixedPoint.Signed.\n * @return True if `a < b`, or False.\n */\n function isLessThan(Signed memory a, Signed memory b) internal pure returns (bool) {\n return a.rawValue < b.rawValue;\n }\n\n /**\n * @notice Whether `a` is less than `b`.\n * @param a a FixedPoint.Signed.\n * @param b an int256.\n * @return True if `a < b`, or False.\n */\n function isLessThan(Signed memory a, int256 b) internal pure returns (bool) {\n return a.rawValue < fromUnscaledInt(b).rawValue;\n }\n\n /**\n * @notice Whether `a` is less than `b`.\n * @param a an int256.\n * @param b a FixedPoint.Signed.\n * @return True if `a < b`, or False.\n */\n function isLessThan(int256 a, Signed memory b) internal pure returns (bool) {\n return fromUnscaledInt(a).rawValue < b.rawValue;\n }\n\n /**\n * @notice Whether `a` is less than or equal to `b`.\n * @param a a FixedPoint.Signed.\n * @param b a FixedPoint.Signed.\n * @return True if `a <= b`, or False.\n */\n function isLessThanOrEqual(Signed memory a, Signed memory b) internal pure returns (bool) {\n return a.rawValue <= b.rawValue;\n }\n\n /**\n * @notice Whether `a` is less than or equal to `b`.\n * @param a a FixedPoint.Signed.\n * @param b an int256.\n * @return True if `a <= b`, or False.\n */\n function isLessThanOrEqual(Signed memory a, int256 b) internal pure returns (bool) {\n return a.rawValue <= fromUnscaledInt(b).rawValue;\n }\n\n /**\n * @notice Whether `a` is less than or equal to `b`.\n * @param a an int256.\n * @param b a FixedPoint.Signed.\n * @return True if `a <= b`, or False.\n */\n function isLessThanOrEqual(int256 a, Signed memory b) internal pure returns (bool) {\n return fromUnscaledInt(a).rawValue <= b.rawValue;\n }\n\n /**\n * @notice The minimum of `a` and `b`.\n * @param a a FixedPoint.Signed.\n * @param b a FixedPoint.Signed.\n * @return the minimum of `a` and `b`.\n */\n function min(Signed memory a, Signed memory b) internal pure returns (Signed memory) {\n return a.rawValue < b.rawValue ? a : b;\n }\n\n /**\n * @notice The maximum of `a` and `b`.\n * @param a a FixedPoint.Signed.\n * @param b a FixedPoint.Signed.\n * @return the maximum of `a` and `b`.\n */\n function max(Signed memory a, Signed memory b) internal pure returns (Signed memory) {\n return a.rawValue > b.rawValue ? a : b;\n }\n\n /**\n * @notice Adds two `Signed`s, reverting on overflow.\n * @param a a FixedPoint.Signed.\n * @param b a FixedPoint.Signed.\n * @return the sum of `a` and `b`.\n */\n function add(Signed memory a, Signed memory b) internal pure returns (Signed memory) {\n return Signed(a.rawValue.add(b.rawValue));\n }\n\n /**\n * @notice Adds an `Signed` to an unscaled int, reverting on overflow.\n * @param a a FixedPoint.Signed.\n * @param b an int256.\n * @return the sum of `a` and `b`.\n */\n function add(Signed memory a, int256 b) internal pure returns (Signed memory) {\n return add(a, fromUnscaledInt(b));\n }\n\n /**\n * @notice Subtracts two `Signed`s, reverting on overflow.\n * @param a a FixedPoint.Signed.\n * @param b a FixedPoint.Signed.\n * @return the difference of `a` and `b`.\n */\n function sub(Signed memory a, Signed memory b) internal pure returns (Signed memory) {\n return Signed(a.rawValue.sub(b.rawValue));\n }\n\n /**\n * @notice Subtracts an unscaled int256 from an `Signed`, reverting on overflow.\n * @param a a FixedPoint.Signed.\n * @param b an int256.\n * @return the difference of `a` and `b`.\n */\n function sub(Signed memory a, int256 b) internal pure returns (Signed memory) {\n return sub(a, fromUnscaledInt(b));\n }\n\n /**\n * @notice Subtracts an `Signed` from an unscaled int256, reverting on overflow.\n * @param a an int256.\n * @param b a FixedPoint.Signed.\n * @return the difference of `a` and `b`.\n */\n function sub(int256 a, Signed memory b) internal pure returns (Signed memory) {\n return sub(fromUnscaledInt(a), b);\n }\n\n /**\n * @notice Multiplies two `Signed`s, reverting on overflow.\n * @dev This will \"floor\" the product.\n * @param a a FixedPoint.Signed.\n * @param b a FixedPoint.Signed.\n * @return the product of `a` and `b`.\n */\n function mul(Signed memory a, Signed memory b) internal pure returns (Signed memory) {\n // There are two caveats with this computation:\n // 1. Max output for the represented number is ~10^41, otherwise an intermediate value overflows. 10^41 is\n // stored internally as an int256 ~10^59.\n // 2. Results that can't be represented exactly are truncated not rounded. E.g., 1.4 * 2e-18 = 2.8e-18, which\n // would round to 3, but this computation produces the result 2.\n // No need to use SafeMath because SFP_SCALING_FACTOR != 0.\n return Signed(a.rawValue.mul(b.rawValue) / SFP_SCALING_FACTOR);\n }\n\n /**\n * @notice Multiplies an `Signed` and an unscaled int256, reverting on overflow.\n * @dev This will \"floor\" the product.\n * @param a a FixedPoint.Signed.\n * @param b an int256.\n * @return the product of `a` and `b`.\n */\n function mul(Signed memory a, int256 b) internal pure returns (Signed memory) {\n return Signed(a.rawValue.mul(b));\n }\n\n /**\n * @notice Multiplies two `Signed`s and \"ceil's\" the product, reverting on overflow.\n * @param a a FixedPoint.Signed.\n * @param b a FixedPoint.Signed.\n * @return the product of `a` and `b`.\n */\n function mulAwayFromZero(Signed memory a, Signed memory b) internal pure returns (Signed memory) {\n int256 mulRaw = a.rawValue.mul(b.rawValue);\n int256 mulTowardsZero = mulRaw / SFP_SCALING_FACTOR;\n // Manual mod because SignedSafeMath doesn't support it.\n int256 mod = mulRaw % SFP_SCALING_FACTOR;\n if (mod != 0) {\n bool isResultPositive = isLessThan(a, 0) == isLessThan(b, 0);\n int256 valueToAdd = isResultPositive ? int256(1) : int256(-1);\n return Signed(mulTowardsZero.add(valueToAdd));\n } else {\n return Signed(mulTowardsZero);\n }\n }\n\n /**\n * @notice Multiplies an `Signed` and an unscaled int256 and \"ceil's\" the product, reverting on overflow.\n * @param a a FixedPoint.Signed.\n * @param b a FixedPoint.Signed.\n * @return the product of `a` and `b`.\n */\n function mulAwayFromZero(Signed memory a, int256 b) internal pure returns (Signed memory) {\n // Since b is an int, there is no risk of truncation and we can just mul it normally\n return Signed(a.rawValue.mul(b));\n }\n\n /**\n * @notice Divides one `Signed` by an `Signed`, reverting on overflow or division by 0.\n * @dev This will \"floor\" the quotient.\n * @param a a FixedPoint numerator.\n * @param b a FixedPoint denominator.\n * @return the quotient of `a` divided by `b`.\n */\n function div(Signed memory a, Signed memory b) internal pure returns (Signed memory) {\n // There are two caveats with this computation:\n // 1. Max value for the number dividend `a` represents is ~10^41, otherwise an intermediate value overflows.\n // 10^41 is stored internally as an int256 10^59.\n // 2. Results that can't be represented exactly are truncated not rounded. E.g., 2 / 3 = 0.6 repeating, which\n // would round to 0.666666666666666667, but this computation produces the result 0.666666666666666666.\n return Signed(a.rawValue.mul(SFP_SCALING_FACTOR).div(b.rawValue));\n }\n\n /**\n * @notice Divides one `Signed` by an unscaled int256, reverting on overflow or division by 0.\n * @dev This will \"floor\" the quotient.\n * @param a a FixedPoint numerator.\n * @param b an int256 denominator.\n * @return the quotient of `a` divided by `b`.\n */\n function div(Signed memory a, int256 b) internal pure returns (Signed memory) {\n return Signed(a.rawValue.div(b));\n }\n\n /**\n * @notice Divides one unscaled int256 by an `Signed`, reverting on overflow or division by 0.\n * @dev This will \"floor\" the quotient.\n * @param a an int256 numerator.\n * @param b a FixedPoint denominator.\n * @return the quotient of `a` divided by `b`.\n */\n function div(int256 a, Signed memory b) internal pure returns (Signed memory) {\n return div(fromUnscaledInt(a), b);\n }\n\n /**\n * @notice Divides one `Signed` by an `Signed` and \"ceil's\" the quotient, reverting on overflow or division by 0.\n * @param a a FixedPoint numerator.\n * @param b a FixedPoint denominator.\n * @return the quotient of `a` divided by `b`.\n */\n function divAwayFromZero(Signed memory a, Signed memory b) internal pure returns (Signed memory) {\n int256 aScaled = a.rawValue.mul(SFP_SCALING_FACTOR);\n int256 divTowardsZero = aScaled.div(b.rawValue);\n // Manual mod because SignedSafeMath doesn't support it.\n int256 mod = aScaled % b.rawValue;\n if (mod != 0) {\n bool isResultPositive = isLessThan(a, 0) == isLessThan(b, 0);\n int256 valueToAdd = isResultPositive ? int256(1) : int256(-1);\n return Signed(divTowardsZero.add(valueToAdd));\n } else {\n return Signed(divTowardsZero);\n }\n }\n\n /**\n * @notice Divides one `Signed` by an unscaled int256 and \"ceil's\" the quotient, reverting on overflow or division by 0.\n * @param a a FixedPoint numerator.\n * @param b an int256 denominator.\n * @return the quotient of `a` divided by `b`.\n */\n function divAwayFromZero(Signed memory a, int256 b) internal pure returns (Signed memory) {\n // Because it is possible that a quotient gets truncated, we can't just call \"Signed(a.rawValue.div(b))\"\n // similarly to mulCeil with an int256 as the second parameter. Therefore we need to convert b into an Signed.\n // This creates the possibility of overflow if b is very large.\n return divAwayFromZero(a, fromUnscaledInt(b));\n }\n\n /**\n * @notice Raises an `Signed` to the power of an unscaled uint256, reverting on overflow. E.g., `b=2` squares `a`.\n * @dev This will \"floor\" the result.\n * @param a a FixedPoint.Signed.\n * @param b a uint256 (negative exponents are not allowed).\n * @return output is `a` to the power of `b`.\n */\n function pow(Signed memory a, uint256 b) internal pure returns (Signed memory output) {\n output = fromUnscaledInt(1);\n for (uint256 i = 0; i < b; i = i.add(1)) {\n output = mul(output, a);\n }\n }\n}\n" + }, + "@openzeppelin/contracts/utils/math/SafeMath.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts v4.4.1 (utils/math/SafeMath.sol)\n\npragma solidity ^0.8.0;\n\n// CAUTION\n// This version of SafeMath should only be used with Solidity 0.8 or later,\n// because it relies on the compiler's built in overflow checks.\n\n/**\n * @dev Wrappers over Solidity's arithmetic operations.\n *\n * NOTE: `SafeMath` is generally not needed starting with Solidity 0.8, since the compiler\n * now has built in overflow checking.\n */\nlibrary SafeMath {\n /**\n * @dev Returns the addition of two unsigned integers, with an overflow flag.\n *\n * _Available since v3.4._\n */\n function tryAdd(uint256 a, uint256 b) internal pure returns (bool, uint256) {\n unchecked {\n uint256 c = a + b;\n if (c < a) return (false, 0);\n return (true, c);\n }\n }\n\n /**\n * @dev Returns the substraction of two unsigned integers, with an overflow flag.\n *\n * _Available since v3.4._\n */\n function trySub(uint256 a, uint256 b) internal pure returns (bool, uint256) {\n unchecked {\n if (b > a) return (false, 0);\n return (true, a - b);\n }\n }\n\n /**\n * @dev Returns the multiplication of two unsigned integers, with an overflow flag.\n *\n * _Available since v3.4._\n */\n function tryMul(uint256 a, uint256 b) internal pure returns (bool, uint256) {\n unchecked {\n // Gas optimization: this is cheaper than requiring 'a' not being zero, but the\n // benefit is lost if 'b' is also tested.\n // See: https://github.com/OpenZeppelin/openzeppelin-contracts/pull/522\n if (a == 0) return (true, 0);\n uint256 c = a * b;\n if (c / a != b) return (false, 0);\n return (true, c);\n }\n }\n\n /**\n * @dev Returns the division of two unsigned integers, with a division by zero flag.\n *\n * _Available since v3.4._\n */\n function tryDiv(uint256 a, uint256 b) internal pure returns (bool, uint256) {\n unchecked {\n if (b == 0) return (false, 0);\n return (true, a / b);\n }\n }\n\n /**\n * @dev Returns the remainder of dividing two unsigned integers, with a division by zero flag.\n *\n * _Available since v3.4._\n */\n function tryMod(uint256 a, uint256 b) internal pure returns (bool, uint256) {\n unchecked {\n if (b == 0) return (false, 0);\n return (true, a % b);\n }\n }\n\n /**\n * @dev Returns the addition of two unsigned integers, reverting on\n * overflow.\n *\n * Counterpart to Solidity's `+` operator.\n *\n * Requirements:\n *\n * - Addition cannot overflow.\n */\n function add(uint256 a, uint256 b) internal pure returns (uint256) {\n return a + b;\n }\n\n /**\n * @dev Returns the subtraction of two unsigned integers, reverting on\n * overflow (when the result is negative).\n *\n * Counterpart to Solidity's `-` operator.\n *\n * Requirements:\n *\n * - Subtraction cannot overflow.\n */\n function sub(uint256 a, uint256 b) internal pure returns (uint256) {\n return a - b;\n }\n\n /**\n * @dev Returns the multiplication of two unsigned integers, reverting on\n * overflow.\n *\n * Counterpart to Solidity's `*` operator.\n *\n * Requirements:\n *\n * - Multiplication cannot overflow.\n */\n function mul(uint256 a, uint256 b) internal pure returns (uint256) {\n return a * b;\n }\n\n /**\n * @dev Returns the integer division of two unsigned integers, reverting on\n * division by zero. The result is rounded towards zero.\n *\n * Counterpart to Solidity's `/` operator.\n *\n * Requirements:\n *\n * - The divisor cannot be zero.\n */\n function div(uint256 a, uint256 b) internal pure returns (uint256) {\n return a / b;\n }\n\n /**\n * @dev Returns the remainder of dividing two unsigned integers. (unsigned integer modulo),\n * reverting when dividing by zero.\n *\n * Counterpart to Solidity's `%` operator. This function uses a `revert`\n * opcode (which leaves remaining gas untouched) while Solidity uses an\n * invalid opcode to revert (consuming all remaining gas).\n *\n * Requirements:\n *\n * - The divisor cannot be zero.\n */\n function mod(uint256 a, uint256 b) internal pure returns (uint256) {\n return a % b;\n }\n\n /**\n * @dev Returns the subtraction of two unsigned integers, reverting with custom message on\n * overflow (when the result is negative).\n *\n * CAUTION: This function is deprecated because it requires allocating memory for the error\n * message unnecessarily. For custom revert reasons use {trySub}.\n *\n * Counterpart to Solidity's `-` operator.\n *\n * Requirements:\n *\n * - Subtraction cannot overflow.\n */\n function sub(\n uint256 a,\n uint256 b,\n string memory errorMessage\n ) internal pure returns (uint256) {\n unchecked {\n require(b <= a, errorMessage);\n return a - b;\n }\n }\n\n /**\n * @dev Returns the integer division of two unsigned integers, reverting with custom message on\n * division by zero. The result is rounded towards zero.\n *\n * Counterpart to Solidity's `/` operator. Note: this function uses a\n * `revert` opcode (which leaves remaining gas untouched) while Solidity\n * uses an invalid opcode to revert (consuming all remaining gas).\n *\n * Requirements:\n *\n * - The divisor cannot be zero.\n */\n function div(\n uint256 a,\n uint256 b,\n string memory errorMessage\n ) internal pure returns (uint256) {\n unchecked {\n require(b > 0, errorMessage);\n return a / b;\n }\n }\n\n /**\n * @dev Returns the remainder of dividing two unsigned integers. (unsigned integer modulo),\n * reverting with custom message when dividing by zero.\n *\n * CAUTION: This function is deprecated because it requires allocating memory for the error\n * message unnecessarily. For custom revert reasons use {tryMod}.\n *\n * Counterpart to Solidity's `%` operator. This function uses a `revert`\n * opcode (which leaves remaining gas untouched) while Solidity uses an\n * invalid opcode to revert (consuming all remaining gas).\n *\n * Requirements:\n *\n * - The divisor cannot be zero.\n */\n function mod(\n uint256 a,\n uint256 b,\n string memory errorMessage\n ) internal pure returns (uint256) {\n unchecked {\n require(b > 0, errorMessage);\n return a % b;\n }\n }\n}\n" + }, + "@openzeppelin/contracts/utils/math/SignedSafeMath.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts v4.4.1 (utils/math/SignedSafeMath.sol)\n\npragma solidity ^0.8.0;\n\n/**\n * @dev Wrappers over Solidity's arithmetic operations.\n *\n * NOTE: `SignedSafeMath` is no longer needed starting with Solidity 0.8. The compiler\n * now has built in overflow checking.\n */\nlibrary SignedSafeMath {\n /**\n * @dev Returns the multiplication of two signed integers, reverting on\n * overflow.\n *\n * Counterpart to Solidity's `*` operator.\n *\n * Requirements:\n *\n * - Multiplication cannot overflow.\n */\n function mul(int256 a, int256 b) internal pure returns (int256) {\n return a * b;\n }\n\n /**\n * @dev Returns the integer division of two signed integers. Reverts on\n * division by zero. The result is rounded towards zero.\n *\n * Counterpart to Solidity's `/` operator.\n *\n * Requirements:\n *\n * - The divisor cannot be zero.\n */\n function div(int256 a, int256 b) internal pure returns (int256) {\n return a / b;\n }\n\n /**\n * @dev Returns the subtraction of two signed integers, reverting on\n * overflow.\n *\n * Counterpart to Solidity's `-` operator.\n *\n * Requirements:\n *\n * - Subtraction cannot overflow.\n */\n function sub(int256 a, int256 b) internal pure returns (int256) {\n return a - b;\n }\n\n /**\n * @dev Returns the addition of two signed integers, reverting on\n * overflow.\n *\n * Counterpart to Solidity's `+` operator.\n *\n * Requirements:\n *\n * - Addition cannot overflow.\n */\n function add(int256 a, int256 b) internal pure returns (int256) {\n return a + b;\n }\n}\n" + }, + "contracts/LpTokenFactory.sol": { + "content": "// SPDX-License-Identifier: GPL-3.0-only\npragma solidity ^0.8.0;\n\nimport \"./interfaces/LpTokenFactoryInterface.sol\";\n\nimport \"@uma/core/contracts/common/implementation/ExpandedERC20.sol\";\n\n/**\n * @notice Factory to create new LP ERC20 tokens that represent a liquidity provider's position. HubPool is the\n * intended client of this contract.\n */\ncontract LpTokenFactory is LpTokenFactoryInterface {\n /**\n * @notice Deploys new LP token for L1 token. Sets caller as minter and burner of token.\n * @param l1Token L1 token to name in LP token name.\n * @return address of new LP token.\n */\n function createLpToken(address l1Token) public returns (address) {\n ExpandedERC20 lpToken = new ExpandedERC20(\n _append(\"Across V2 \", IERC20Metadata(l1Token).name(), \" LP Token\"), // LP Token Name\n _append(\"Av2-\", IERC20Metadata(l1Token).symbol(), \"-LP\"), // LP Token Symbol\n IERC20Metadata(l1Token).decimals() // LP Token Decimals\n );\n lpToken.addMinter(msg.sender); // Set the caller as the LP Token's minter.\n lpToken.addBurner(msg.sender); // Set the caller as the LP Token's burner.\n lpToken.resetOwner(msg.sender); // Set the caller as the LP Token's owner.\n\n return address(lpToken);\n }\n\n function _append(\n string memory a,\n string memory b,\n string memory c\n ) internal pure returns (string memory) {\n return string(abi.encodePacked(a, b, c));\n }\n}\n" + }, + "contracts/interfaces/LpTokenFactoryInterface.sol": { + "content": "// SPDX-License-Identifier: AGPL-3.0-only\npragma solidity ^0.8.0;\n\ninterface LpTokenFactoryInterface {\n function createLpToken(address l1Token) external returns (address);\n}\n" + }, + "@uma/core/contracts/oracle/interfaces/FinderInterface.sol": { + "content": "// SPDX-License-Identifier: AGPL-3.0-only\npragma solidity ^0.8.0;\n\n/**\n * @title Provides addresses of the live contracts implementing certain interfaces.\n * @dev Examples are the Oracle or Store interfaces.\n */\ninterface FinderInterface {\n /**\n * @notice Updates the address of the contract that implements `interfaceName`.\n * @param interfaceName bytes32 encoding of the interface name that is either changed or registered.\n * @param implementationAddress address of the deployed contract that implements the interface.\n */\n function changeImplementationAddress(bytes32 interfaceName, address implementationAddress) external;\n\n /**\n * @notice Gets the address of the contract that implements the given `interfaceName`.\n * @param interfaceName queried interface.\n * @return implementationAddress address of the deployed contract that implements the interface.\n */\n function getImplementationAddress(bytes32 interfaceName) external view returns (address);\n}\n" + }, + "@uma/core/contracts/oracle/interfaces/IdentifierWhitelistInterface.sol": { + "content": "// SPDX-License-Identifier: AGPL-3.0-only\npragma solidity ^0.8.0;\n\n/**\n * @title Interface for whitelists of supported identifiers that the oracle can provide prices for.\n */\ninterface IdentifierWhitelistInterface {\n /**\n * @notice Adds the provided identifier as a supported identifier.\n * @dev Price requests using this identifier will succeed after this call.\n * @param identifier bytes32 encoding of the string identifier. Eg: BTC/USD.\n */\n function addSupportedIdentifier(bytes32 identifier) external;\n\n /**\n * @notice Removes the identifier from the whitelist.\n * @dev Price requests using this identifier will no longer succeed after this call.\n * @param identifier bytes32 encoding of the string identifier. Eg: BTC/USD.\n */\n function removeSupportedIdentifier(bytes32 identifier) external;\n\n /**\n * @notice Checks whether an identifier is on the whitelist.\n * @param identifier bytes32 encoding of the string identifier. Eg: BTC/USD.\n * @return bool if the identifier is supported (or not).\n */\n function isIdentifierSupported(bytes32 identifier) external view returns (bool);\n}\n" + }, + "@uma/core/contracts/common/interfaces/AddressWhitelistInterface.sol": { + "content": "// SPDX-License-Identifier: AGPL-3.0-only\npragma solidity ^0.8.0;\n\ninterface AddressWhitelistInterface {\n function addToWhitelist(address newElement) external;\n\n function removeFromWhitelist(address newElement) external;\n\n function isOnWhitelist(address newElement) external view returns (bool);\n\n function getWhitelist() external view returns (address[] memory);\n}\n" + }, + "@uma/core/contracts/common/implementation/AncillaryData.sol": { + "content": "// SPDX-License-Identifier: AGPL-3.0-only\npragma solidity ^0.8.0;\n\n/**\n * @title Library for encoding and decoding ancillary data for DVM price requests.\n * @notice We assume that on-chain ancillary data can be formatted directly from bytes to utf8 encoding via\n * web3.utils.hexToUtf8, and that clients will parse the utf8-encoded ancillary data as a comma-delimitted key-value\n * dictionary. Therefore, this library provides internal methods that aid appending to ancillary data from Solidity\n * smart contracts. More details on UMA's ancillary data guidelines below:\n * https://docs.google.com/document/d/1zhKKjgY1BupBGPPrY_WOJvui0B6DMcd-xDR8-9-SPDw/edit\n */\nlibrary AncillaryData {\n // This converts the bottom half of a bytes32 input to hex in a highly gas-optimized way.\n // Source: the brilliant implementation at https://gitter.im/ethereum/solidity?at=5840d23416207f7b0ed08c9b.\n function toUtf8Bytes32Bottom(bytes32 bytesIn) private pure returns (bytes32) {\n unchecked {\n uint256 x = uint256(bytesIn);\n\n // Nibble interleave\n x = x & 0x00000000000000000000000000000000ffffffffffffffffffffffffffffffff;\n x = (x | (x * 2**64)) & 0x0000000000000000ffffffffffffffff0000000000000000ffffffffffffffff;\n x = (x | (x * 2**32)) & 0x00000000ffffffff00000000ffffffff00000000ffffffff00000000ffffffff;\n x = (x | (x * 2**16)) & 0x0000ffff0000ffff0000ffff0000ffff0000ffff0000ffff0000ffff0000ffff;\n x = (x | (x * 2**8)) & 0x00ff00ff00ff00ff00ff00ff00ff00ff00ff00ff00ff00ff00ff00ff00ff00ff;\n x = (x | (x * 2**4)) & 0x0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f;\n\n // Hex encode\n uint256 h = (x & 0x0808080808080808080808080808080808080808080808080808080808080808) / 8;\n uint256 i = (x & 0x0404040404040404040404040404040404040404040404040404040404040404) / 4;\n uint256 j = (x & 0x0202020202020202020202020202020202020202020202020202020202020202) / 2;\n x = x + (h & (i | j)) * 0x27 + 0x3030303030303030303030303030303030303030303030303030303030303030;\n\n // Return the result.\n return bytes32(x);\n }\n }\n\n /**\n * @notice Returns utf8-encoded bytes32 string that can be read via web3.utils.hexToUtf8.\n * @dev Will return bytes32 in all lower case hex characters and without the leading 0x.\n * This has minor changes from the toUtf8BytesAddress to control for the size of the input.\n * @param bytesIn bytes32 to encode.\n * @return utf8 encoded bytes32.\n */\n function toUtf8Bytes(bytes32 bytesIn) internal pure returns (bytes memory) {\n return abi.encodePacked(toUtf8Bytes32Bottom(bytesIn >> 128), toUtf8Bytes32Bottom(bytesIn));\n }\n\n /**\n * @notice Returns utf8-encoded address that can be read via web3.utils.hexToUtf8.\n * Source: https://ethereum.stackexchange.com/questions/8346/convert-address-to-string/8447#8447\n * @dev Will return address in all lower case characters and without the leading 0x.\n * @param x address to encode.\n * @return utf8 encoded address bytes.\n */\n function toUtf8BytesAddress(address x) internal pure returns (bytes memory) {\n return\n abi.encodePacked(toUtf8Bytes32Bottom(bytes32(bytes20(x)) >> 128), bytes8(toUtf8Bytes32Bottom(bytes20(x))));\n }\n\n /**\n * @notice Converts a uint into a base-10, UTF-8 representation stored in a `string` type.\n * @dev This method is based off of this code: https://stackoverflow.com/a/65707309.\n */\n function toUtf8BytesUint(uint256 x) internal pure returns (bytes memory) {\n if (x == 0) {\n return \"0\";\n }\n uint256 j = x;\n uint256 len;\n while (j != 0) {\n len++;\n j /= 10;\n }\n bytes memory bstr = new bytes(len);\n uint256 k = len;\n while (x != 0) {\n k = k - 1;\n uint8 temp = (48 + uint8(x - (x / 10) * 10));\n bytes1 b1 = bytes1(temp);\n bstr[k] = b1;\n x /= 10;\n }\n return bstr;\n }\n\n function appendKeyValueBytes32(\n bytes memory currentAncillaryData,\n bytes memory key,\n bytes32 value\n ) internal pure returns (bytes memory) {\n bytes memory prefix = constructPrefix(currentAncillaryData, key);\n return abi.encodePacked(currentAncillaryData, prefix, toUtf8Bytes(value));\n }\n\n /**\n * @notice Adds \"key:value\" to `currentAncillaryData` where `value` is an address that first needs to be converted\n * to utf8 bytes. For example, if `utf8(currentAncillaryData)=\"k1:v1\"`, then this function will return\n * `utf8(k1:v1,key:value)`, and if `currentAncillaryData` is blank, then this will return `utf8(key:value)`.\n * @param currentAncillaryData This bytes data should ideally be able to be utf8-decoded, but its OK if not.\n * @param key Again, this bytes data should ideally be able to be utf8-decoded, but its OK if not.\n * @param value An address to set as the value in the key:value pair to append to `currentAncillaryData`.\n * @return Newly appended ancillary data.\n */\n function appendKeyValueAddress(\n bytes memory currentAncillaryData,\n bytes memory key,\n address value\n ) internal pure returns (bytes memory) {\n bytes memory prefix = constructPrefix(currentAncillaryData, key);\n return abi.encodePacked(currentAncillaryData, prefix, toUtf8BytesAddress(value));\n }\n\n /**\n * @notice Adds \"key:value\" to `currentAncillaryData` where `value` is a uint that first needs to be converted\n * to utf8 bytes. For example, if `utf8(currentAncillaryData)=\"k1:v1\"`, then this function will return\n * `utf8(k1:v1,key:value)`, and if `currentAncillaryData` is blank, then this will return `utf8(key:value)`.\n * @param currentAncillaryData This bytes data should ideally be able to be utf8-decoded, but its OK if not.\n * @param key Again, this bytes data should ideally be able to be utf8-decoded, but its OK if not.\n * @param value A uint to set as the value in the key:value pair to append to `currentAncillaryData`.\n * @return Newly appended ancillary data.\n */\n function appendKeyValueUint(\n bytes memory currentAncillaryData,\n bytes memory key,\n uint256 value\n ) internal pure returns (bytes memory) {\n bytes memory prefix = constructPrefix(currentAncillaryData, key);\n return abi.encodePacked(currentAncillaryData, prefix, toUtf8BytesUint(value));\n }\n\n /**\n * @notice Helper method that returns the left hand side of a \"key:value\" pair plus the colon \":\" and a leading\n * comma \",\" if the `currentAncillaryData` is not empty. The return value is intended to be prepended as a prefix to\n * some utf8 value that is ultimately added to a comma-delimited, key-value dictionary.\n */\n function constructPrefix(bytes memory currentAncillaryData, bytes memory key) internal pure returns (bytes memory) {\n if (currentAncillaryData.length > 0) {\n return abi.encodePacked(\",\", key, \":\");\n } else {\n return abi.encodePacked(key, \":\");\n }\n }\n}\n" + }, + "@uma/core/contracts/oracle/implementation/Constants.sol": { + "content": "// SPDX-License-Identifier: AGPL-3.0-only\npragma solidity ^0.8.0;\n\n/**\n * @title Stores common interface names used throughout the DVM by registration in the Finder.\n */\nlibrary OracleInterfaces {\n bytes32 public constant Oracle = \"Oracle\";\n bytes32 public constant IdentifierWhitelist = \"IdentifierWhitelist\";\n bytes32 public constant Store = \"Store\";\n bytes32 public constant FinancialContractsAdmin = \"FinancialContractsAdmin\";\n bytes32 public constant Registry = \"Registry\";\n bytes32 public constant CollateralWhitelist = \"CollateralWhitelist\";\n bytes32 public constant OptimisticOracle = \"OptimisticOracle\";\n bytes32 public constant Bridge = \"Bridge\";\n bytes32 public constant GenericHandler = \"GenericHandler\";\n bytes32 public constant SkinnyOptimisticOracle = \"SkinnyOptimisticOracle\";\n bytes32 public constant ChildMessenger = \"ChildMessenger\";\n bytes32 public constant OracleHub = \"OracleHub\";\n bytes32 public constant OracleSpoke = \"OracleSpoke\";\n}\n\n/**\n * @title Commonly re-used values for contracts associated with the OptimisticOracle.\n */\nlibrary OptimisticOracleConstraints {\n // Any price request submitted to the OptimisticOracle must contain ancillary data no larger than this value.\n // This value must be <= the Voting contract's `ancillaryBytesLimit` constant value otherwise it is possible\n // that a price can be requested to the OptimisticOracle successfully, but cannot be resolved by the DVM which\n // refuses to accept a price request made with ancillary data length over a certain size.\n uint256 public constant ancillaryBytesLimit = 8192;\n}\n" + } + }, + "settings": { + "optimizer": { + "enabled": true, + "runs": 1000000 + }, + "outputSelection": { + "*": { + "*": [ + "abi", + "evm.bytecode", + "evm.deployedBytecode", + "evm.methodIdentifiers", + "metadata", + "devdoc", + "userdoc", + "storageLayout", + "evm.gasEstimates" + ], + "": ["ast"] + } + }, + "metadata": { + "useLiteralContent": true + } + } +} diff --git a/deployments/rinkeby/solcInputs/cee77d8f3a5225b985a9cf3439956316.json b/deployments/rinkeby/solcInputs/cee77d8f3a5225b985a9cf3439956316.json deleted file mode 100644 index 33c087308..000000000 --- a/deployments/rinkeby/solcInputs/cee77d8f3a5225b985a9cf3439956316.json +++ /dev/null @@ -1,195 +0,0 @@ -{ - "language": "Solidity", - "sources": { - "contracts/Arbitrum_SpokePool.sol": { - "content": "//SPDX-License-Identifier: Unlicense\r\npragma solidity ^0.8.0;\r\n\r\nimport \"./SpokePool.sol\";\r\nimport \"./SpokePoolInterface.sol\";\r\n\r\ninterface StandardBridgeLike {\r\n function outboundTransfer(\r\n address _l1Token,\r\n address _to,\r\n uint256 _amount,\r\n bytes calldata _data\r\n ) external payable returns (bytes memory);\r\n}\r\n\r\n/**\r\n * @notice AVM specific SpokePool.\r\n * @dev Uses AVM cross-domain-enabled logic for access control.\r\n */\r\n\r\ncontract Arbitrum_SpokePool is SpokePoolInterface, SpokePool {\r\n // Address of the Arbitrum L2 token gateway.\r\n address public l2GatewayRouter;\r\n\r\n // Admin controlled mapping of arbitrum tokens to L1 counterpart. L1 counterpart addresses\r\n // are neccessary to bridge tokens to L1.\r\n mapping(address => address) public whitelistedTokens;\r\n\r\n event ArbitrumTokensBridged(address indexed l1Token, address target, uint256 numberOfTokensBridged);\r\n event SetL2GatewayRouter(address indexed newL2GatewayRouter);\r\n event WhitelistedTokens(address indexed l2Token, address indexed l1Token);\r\n\r\n constructor(\r\n address _l2GatewayRouter,\r\n address _crossDomainAdmin,\r\n address _hubPool,\r\n address _wethAddress,\r\n address timerAddress\r\n ) SpokePool(_crossDomainAdmin, _hubPool, _wethAddress, timerAddress) {\r\n _setL2GatewayRouter(_l2GatewayRouter);\r\n }\r\n\r\n modifier onlyFromCrossDomainAdmin() {\r\n require(msg.sender == _applyL1ToL2Alias(crossDomainAdmin), \"ONLY_COUNTERPART_GATEWAY\");\r\n _;\r\n }\r\n\r\n /**************************************\r\n * CROSS-CHAIN ADMIN FUNCTIONS *\r\n **************************************/\r\n\r\n function setL2GatewayRouter(address newL2GatewayRouter) public onlyFromCrossDomainAdmin nonReentrant {\r\n _setL2GatewayRouter(newL2GatewayRouter);\r\n }\r\n\r\n function whitelistToken(address l2Token, address l1Token) public onlyFromCrossDomainAdmin nonReentrant {\r\n _whitelistToken(l2Token, l1Token);\r\n }\r\n\r\n function setCrossDomainAdmin(address newCrossDomainAdmin) public override onlyFromCrossDomainAdmin nonReentrant {\r\n _setCrossDomainAdmin(newCrossDomainAdmin);\r\n }\r\n\r\n function setHubPool(address newHubPool) public override onlyFromCrossDomainAdmin nonReentrant {\r\n _setHubPool(newHubPool);\r\n }\r\n\r\n function setEnableRoute(\r\n address originToken,\r\n uint256 destinationChainId,\r\n bool enable\r\n ) public override onlyFromCrossDomainAdmin nonReentrant {\r\n _setEnableRoute(originToken, destinationChainId, enable);\r\n }\r\n\r\n function setDepositQuoteTimeBuffer(uint32 buffer) public override onlyFromCrossDomainAdmin nonReentrant {\r\n _setDepositQuoteTimeBuffer(buffer);\r\n }\r\n\r\n function relayRootBundle(bytes32 relayerRefundRoot, bytes32 slowRelayFulfillmentRoot)\r\n public\r\n override\r\n onlyFromCrossDomainAdmin\r\n nonReentrant\r\n {\r\n _relayRootBundle(relayerRefundRoot, slowRelayFulfillmentRoot);\r\n }\r\n\r\n /**************************************\r\n * INTERNAL FUNCTIONS *\r\n **************************************/\r\n\r\n function _bridgeTokensToHubPool(RelayerRefundLeaf memory relayerRefundLeaf) internal override {\r\n StandardBridgeLike(l2GatewayRouter).outboundTransfer(\r\n whitelistedTokens[relayerRefundLeaf.l2TokenAddress], // _l1Token. Address of the L1 token to bridge over.\r\n hubPool, // _to. Withdraw, over the bridge, to the l1 hub pool contract.\r\n relayerRefundLeaf.amountToReturn, // _amount.\r\n \"\" // _data. We don't need to send any data for the bridging action.\r\n );\r\n emit ArbitrumTokensBridged(address(0), hubPool, relayerRefundLeaf.amountToReturn);\r\n }\r\n\r\n function _setL2GatewayRouter(address _l2GatewayRouter) internal {\r\n l2GatewayRouter = _l2GatewayRouter;\r\n emit SetL2GatewayRouter(l2GatewayRouter);\r\n }\r\n\r\n function _whitelistToken(address _l2Token, address _l1Token) internal {\r\n whitelistedTokens[_l2Token] = _l1Token;\r\n emit WhitelistedTokens(_l2Token, _l1Token);\r\n }\r\n\r\n // l1 addresses are transformed during l1->l2 calls. See https://developer.offchainlabs.com/docs/l1_l2_messages#address-aliasing for more information.\r\n function _applyL1ToL2Alias(address l1Address) internal pure returns (address l2Address) {\r\n unchecked {\r\n l2Address = address(uint160(l1Address) + uint160(0x1111000000000000000000000000000000001111));\r\n }\r\n }\r\n}\r\n" - }, - "contracts/SpokePool.sol": { - "content": "// SPDX-License-Identifier: GPL-3.0-only\r\npragma solidity ^0.8.0;\r\n\r\nimport \"./MerkleLib.sol\";\r\nimport \"./interfaces/WETH9.sol\";\r\n\r\nimport \"@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol\";\r\nimport \"@openzeppelin/contracts/token/ERC20/IERC20.sol\";\r\nimport \"@openzeppelin/contracts/utils/Address.sol\";\r\n\r\nimport \"@openzeppelin/contracts/utils/cryptography/SignatureChecker.sol\";\r\nimport \"@openzeppelin/contracts/utils/cryptography/ECDSA.sol\";\r\n\r\nimport \"@uma/core/contracts/common/implementation/Testable.sol\";\r\nimport \"@uma/core/contracts/common/implementation/Lockable.sol\";\r\nimport \"@uma/core/contracts/common/implementation/MultiCaller.sol\";\r\nimport \"./MerkleLib.sol\";\r\nimport \"./SpokePoolInterface.sol\";\r\n\r\n/**\r\n * @title SpokePool\r\n * @notice Contract deployed on source and destination chains enabling depositors to transfer assets from source to\r\n * destination. Deposit orders are fulfilled by off-chain relayers who also interact with this contract. Deposited\r\n * tokens are locked on the source chain and relayers send the recipient the desired token currency and amount\r\n * on the destination chain. Locked source chain tokens are later sent over the canonical token bridge to L1.\r\n * @dev This contract is designed to be deployed to L2's, not mainnet.\r\n */\r\nabstract contract SpokePool is SpokePoolInterface, Testable, Lockable, MultiCaller {\r\n using SafeERC20 for IERC20;\r\n using Address for address;\r\n\r\n // Address of the L1 contract that acts as the owner of this SpokePool.\r\n address public crossDomainAdmin;\r\n\r\n // Address of the L1 contract that will send tokens to and receive tokens from this contract.\r\n address public hubPool;\r\n\r\n // Address of WETH contract for this network. If an origin token matches this, then the caller can optionally\r\n // instruct this contract to wrap ETH when depositing.\r\n WETH9 public weth;\r\n\r\n // Timestamp when contract was constructed. Relays cannot have a quote time before this.\r\n uint32 public deploymentTime;\r\n\r\n // Any deposit quote times greater than or less than this value to the current contract time is blocked. Forces\r\n // caller to use an up to date realized fee. Defaults to 10 minutes.\r\n uint32 public depositQuoteTimeBuffer = 600;\r\n\r\n // Use count of deposits as unique deposit identifier.\r\n uint32 public numberOfDeposits;\r\n\r\n // Origin token to destination token routings can be turned on or off.\r\n mapping(address => mapping(uint256 => bool)) public enabledDepositRoutes;\r\n\r\n struct RootBundle {\r\n // Merkle root of slow relays that were not fully filled and whose recipient is still owed funds from the LP pool.\r\n bytes32 slowRelayFulfillmentRoot;\r\n // Merkle root of relayer refunds.\r\n bytes32 relayerRefundRoot;\r\n // This is a 2D bitmap tracking which leafs in the relayer refund root have been claimed, with max size of\r\n // 256x256 leaves per root.\r\n mapping(uint256 => uint256) claimedBitmap;\r\n }\r\n RootBundle[] public rootBundles;\r\n\r\n // Each relay is associated with the hash of parameters that uniquely identify the original deposit and a relay\r\n // attempt for that deposit. The relay itself is just represented as the amount filled so far. The total amount to\r\n // relay, the fees, and the agents are all parameters included in the hash key.\r\n mapping(bytes32 => uint256) public relayFills;\r\n\r\n /****************************************\r\n * EVENTS *\r\n ****************************************/\r\n event SetXDomainAdmin(address indexed newAdmin);\r\n event SetHubPool(address indexed newHubPool);\r\n event EnabledDepositRoute(address indexed originToken, uint256 indexed destinationChainId, bool enabled);\r\n event SetDepositQuoteTimeBuffer(uint32 newBuffer);\r\n event FundsDeposited(\r\n uint256 amount,\r\n uint256 destinationChainId,\r\n uint64 relayerFeePct,\r\n uint32 indexed depositId,\r\n uint32 quoteTimestamp,\r\n address indexed originToken,\r\n address recipient,\r\n address indexed depositor\r\n );\r\n event FilledRelay(\r\n bytes32 indexed relayHash,\r\n uint256 totalRelayAmount,\r\n uint256 totalFilledAmount,\r\n uint256 fillAmount,\r\n uint256 indexed repaymentChain,\r\n uint256 originChainId,\r\n uint64 relayerFeePct,\r\n uint64 realizedLpFeePct,\r\n uint32 depositId,\r\n address destinationToken,\r\n address indexed relayer,\r\n address depositor,\r\n address recipient\r\n );\r\n event ExecutedSlowRelayFulfillmentRoot(\r\n bytes32 indexed relayHash,\r\n uint256 totalRelayAmount,\r\n uint256 totalFilledAmount,\r\n uint256 fillAmount,\r\n uint256 originChainId,\r\n uint64 relayerFeePct,\r\n uint64 realizedLpFeePct,\r\n uint32 depositId,\r\n address destinationToken,\r\n address indexed caller,\r\n address depositor,\r\n address recipient\r\n );\r\n event RelayedRootBundle(uint32 indexed rootBundleId, bytes32 relayerRefundRoot, bytes32 slowRelayFulfillmentRoot);\r\n event ExecutedRelayerRefundRoot(\r\n uint256 amountToReturn,\r\n uint256 chainId,\r\n uint256[] refundAmounts,\r\n uint32 indexed rootBundleId,\r\n uint32 indexed leafId,\r\n address l2TokenAddress,\r\n address[] refundAddresses,\r\n address indexed caller\r\n );\r\n event TokensBridged(\r\n uint256 amountToReturn,\r\n uint256 indexed chainId,\r\n uint32 indexed leafId,\r\n address indexed l2TokenAddress,\r\n address caller\r\n );\r\n\r\n constructor(\r\n address _crossDomainAdmin,\r\n address _hubPool,\r\n address _wethAddress,\r\n address timerAddress\r\n ) Testable(timerAddress) {\r\n _setCrossDomainAdmin(_crossDomainAdmin);\r\n _setHubPool(_hubPool);\r\n deploymentTime = uint32(getCurrentTime());\r\n weth = WETH9(_wethAddress);\r\n }\r\n\r\n /****************************************\r\n * MODIFIERS *\r\n ****************************************/\r\n\r\n modifier onlyEnabledRoute(address originToken, uint256 destinationId) {\r\n require(enabledDepositRoutes[originToken][destinationId], \"Disabled route\");\r\n _;\r\n }\r\n\r\n /**************************************\r\n * ADMIN FUNCTIONS *\r\n **************************************/\r\n\r\n function _setCrossDomainAdmin(address newCrossDomainAdmin) internal {\r\n require(newCrossDomainAdmin != address(0), \"Bad bridge router address\");\r\n crossDomainAdmin = newCrossDomainAdmin;\r\n emit SetXDomainAdmin(crossDomainAdmin);\r\n }\r\n\r\n function _setHubPool(address newHubPool) internal {\r\n require(newHubPool != address(0), \"Bad hub pool address\");\r\n hubPool = newHubPool;\r\n emit SetHubPool(hubPool);\r\n }\r\n\r\n function _setEnableRoute(\r\n address originToken,\r\n uint256 destinationChainId,\r\n bool enabled\r\n ) internal {\r\n enabledDepositRoutes[originToken][destinationChainId] = enabled;\r\n emit EnabledDepositRoute(originToken, destinationChainId, enabled);\r\n }\r\n\r\n function _setDepositQuoteTimeBuffer(uint32 _depositQuoteTimeBuffer) internal {\r\n depositQuoteTimeBuffer = _depositQuoteTimeBuffer;\r\n emit SetDepositQuoteTimeBuffer(_depositQuoteTimeBuffer);\r\n }\r\n\r\n /**************************************\r\n * DEPOSITOR FUNCTIONS *\r\n **************************************/\r\n\r\n /**\r\n * @notice Called by user to bridge funds from origin to destination chain.\r\n * @dev The caller must first approve this contract to spend `amount` of `originToken`.\r\n */\r\n function deposit(\r\n address recipient,\r\n address originToken,\r\n uint256 amount,\r\n uint256 destinationChainId,\r\n uint64 relayerFeePct,\r\n uint32 quoteTimestamp\r\n ) public payable onlyEnabledRoute(originToken, destinationChainId) nonReentrant {\r\n // We limit the relay fees to prevent the user spending all their funds on fees.\r\n require(relayerFeePct <= 0.5e18, \"invalid relayer fee\");\r\n // Note We assume that L2 timing cannot be compared accurately and consistently to L1 timing. Therefore,\r\n // `block.timestamp` is different from the L1 EVM's. Therefore, the quoteTimestamp must be within a configurable\r\n // buffer to allow for this variance.\r\n // Note also that `quoteTimestamp` cannot be less than the buffer otherwise the following arithmetic can result\r\n // in underflow. This isn't a problem as the deposit will revert, but the error might be unexpected for clients.\r\n require(\r\n getCurrentTime() >= quoteTimestamp - depositQuoteTimeBuffer &&\r\n getCurrentTime() <= quoteTimestamp + depositQuoteTimeBuffer,\r\n \"invalid quote time\"\r\n );\r\n // If the address of the origin token is a WETH contract and there is a msg.value with the transaction\r\n // then the user is sending ETH. In this case, the ETH should be deposited to WETH.\r\n if (originToken == address(weth) && msg.value > 0) {\r\n require(msg.value == amount, \"msg.value must match amount\");\r\n weth.deposit{ value: msg.value }();\r\n } else {\r\n // Else, it is a normal ERC20. In this case pull the token from the users wallet as per normal.\r\n // Note: this includes the case where the L2 user has WETH (already wrapped ETH) and wants to bridge them. In\r\n // this case the msg.value will be set to 0, indicating a \"normal\" ERC20 bridging action.\r\n IERC20(originToken).safeTransferFrom(msg.sender, address(this), amount);\r\n }\r\n\r\n emit FundsDeposited(\r\n amount,\r\n destinationChainId,\r\n relayerFeePct,\r\n numberOfDeposits,\r\n quoteTimestamp,\r\n originToken,\r\n recipient,\r\n msg.sender\r\n );\r\n\r\n numberOfDeposits += 1;\r\n }\r\n\r\n /**************************************\r\n * RELAYER FUNCTIONS *\r\n **************************************/\r\n\r\n function fillRelay(\r\n address depositor,\r\n address recipient,\r\n address destinationToken,\r\n uint256 totalRelayAmount,\r\n uint256 maxTokensToSend,\r\n uint256 repaymentChain,\r\n uint256 originChainId,\r\n uint64 realizedLpFeePct,\r\n uint64 relayerFeePct,\r\n uint32 depositId\r\n ) public nonReentrant {\r\n // Each relay attempt is mapped to the hash of data uniquely identifying it, which includes the deposit data\r\n // such as the origin chain ID and the deposit ID, and the data in a relay attempt such as who the recipient\r\n // is, which chain and currency the recipient wants to receive funds on, and the relay fees.\r\n SpokePoolInterface.RelayData memory relayData = SpokePoolInterface.RelayData({\r\n depositor: depositor,\r\n recipient: recipient,\r\n destinationToken: destinationToken,\r\n relayAmount: totalRelayAmount,\r\n realizedLpFeePct: realizedLpFeePct,\r\n relayerFeePct: relayerFeePct,\r\n depositId: depositId,\r\n originChainId: originChainId\r\n });\r\n bytes32 relayHash = _getRelayHash(relayData);\r\n\r\n uint256 fillAmountPreFees = _fillRelay(relayHash, relayData, maxTokensToSend, relayerFeePct, false);\r\n\r\n _emitFillRelay(relayHash, fillAmountPreFees, repaymentChain, relayerFeePct, relayData);\r\n }\r\n\r\n function fillRelayWithUpdatedFee(\r\n address depositor,\r\n address recipient,\r\n address destinationToken,\r\n uint256 totalRelayAmount,\r\n uint256 maxTokensToSend,\r\n uint256 repaymentChain,\r\n uint256 originChainId,\r\n uint64 realizedLpFeePct,\r\n uint64 relayerFeePct,\r\n uint64 newRelayerFeePct,\r\n uint32 depositId,\r\n bytes memory depositorSignature\r\n ) public nonReentrant {\r\n // Grouping the signature validation logic into brackets to address stack too deep error.\r\n {\r\n // Depositor should have signed a hash of the relayer fee % to update to and information uniquely identifying\r\n // the deposit to relay. This ensures that this signature cannot be re-used for other deposits. The version\r\n // string is included as a precaution in case this contract is upgraded.\r\n // Note: we use encode instead of encodePacked because it is more secure, more in the \"warning\" section\r\n // here: https://docs.soliditylang.org/en/v0.8.11/abi-spec.html#non-standard-packed-mode\r\n bytes32 expectedDepositorMessageHash = keccak256(\r\n abi.encode(\"ACROSS-V2-FEE-1.0\", newRelayerFeePct, depositId, originChainId)\r\n );\r\n\r\n // Check the hash corresponding to the https://eth.wiki/json-rpc/API#eth_sign[`eth_sign`]\r\n // JSON-RPC method as part of EIP-191. We use OZ's signature checker library with adds support for\r\n // EIP-1271 which can verify messages signed by smart contract wallets like Argent and Gnosis safes.\r\n // If the depositor signed a message with a different updated fee (or any other param included in the\r\n // above keccak156 hash), then this will revert.\r\n bytes32 ethSignedMessageHash = ECDSA.toEthSignedMessageHash(expectedDepositorMessageHash);\r\n\r\n _verifyDepositorUpdateFeeMessage(depositor, ethSignedMessageHash, depositorSignature);\r\n }\r\n\r\n // Now follow the default `fillRelay` flow with the updated fee and the original relay hash.\r\n RelayData memory relayData = RelayData({\r\n depositor: depositor,\r\n recipient: recipient,\r\n destinationToken: destinationToken,\r\n relayAmount: totalRelayAmount,\r\n realizedLpFeePct: realizedLpFeePct,\r\n relayerFeePct: relayerFeePct,\r\n depositId: depositId,\r\n originChainId: originChainId\r\n });\r\n bytes32 relayHash = _getRelayHash(relayData);\r\n uint256 fillAmountPreFees = _fillRelay(relayHash, relayData, maxTokensToSend, newRelayerFeePct, false);\r\n\r\n _emitFillRelay(relayHash, fillAmountPreFees, repaymentChain, newRelayerFeePct, relayData);\r\n }\r\n\r\n /**************************************\r\n * DATA WORKER FUNCTIONS *\r\n **************************************/\r\n function executeSlowRelayFulfillmentRoot(\r\n address depositor,\r\n address recipient,\r\n address destinationToken,\r\n uint256 totalRelayAmount,\r\n uint256 originChainId,\r\n uint64 realizedLpFeePct,\r\n uint64 relayerFeePct,\r\n uint32 depositId,\r\n uint32 rootBundleId,\r\n bytes32[] memory proof\r\n ) public nonReentrant {\r\n RelayData memory relayData = RelayData({\r\n depositor: depositor,\r\n recipient: recipient,\r\n destinationToken: destinationToken,\r\n relayAmount: totalRelayAmount,\r\n originChainId: originChainId,\r\n realizedLpFeePct: realizedLpFeePct,\r\n relayerFeePct: relayerFeePct,\r\n depositId: depositId\r\n });\r\n\r\n require(\r\n MerkleLib.verifySlowRelayFulfillment(rootBundles[rootBundleId].slowRelayFulfillmentRoot, relayData, proof),\r\n \"Invalid proof\"\r\n );\r\n\r\n bytes32 relayHash = _getRelayHash(relayData);\r\n\r\n // Wrap any ETH owned by this contract so we can send expected L2 token to recipient. This is neccessary because\r\n // some SpokePools will receive ETH from the canonical token bridge instead of WETH so this contract\r\n // might have built up an ETH balance.\r\n if (address(this).balance > 0) weth.deposit{ value: address(this).balance }();\r\n\r\n // Note: use relayAmount as the max amount to send, so the relay is always completely filled by the contract's\r\n // funds in all cases.\r\n uint256 fillAmountPreFees = _fillRelay(relayHash, relayData, relayData.relayAmount, relayerFeePct, true);\r\n\r\n _emitExecutedSlowRelayFulfillmentRoot(relayHash, fillAmountPreFees, relayData);\r\n }\r\n\r\n function executeRelayerRefundRoot(\r\n uint32 rootBundleId,\r\n SpokePoolInterface.RelayerRefundLeaf memory relayerRefundLeaf,\r\n bytes32[] memory proof\r\n ) public nonReentrant {\r\n // Check integrity of leaf structure:\r\n require(relayerRefundLeaf.chainId == chainId(), \"Invalid chainId\");\r\n require(relayerRefundLeaf.refundAddresses.length == relayerRefundLeaf.refundAmounts.length, \"invalid leaf\");\r\n\r\n RootBundle storage rootBundle = rootBundles[rootBundleId];\r\n\r\n // Check that `inclusionProof` proves that `relayerRefundLeaf` is contained within the relayer refund root.\r\n // Note: This should revert if the `relayerRefundRoot` is uninitialized.\r\n require(MerkleLib.verifyRelayerRefund(rootBundle.relayerRefundRoot, relayerRefundLeaf, proof), \"Bad Proof\");\r\n\r\n // Verify the leafId in the leaf has not yet been claimed.\r\n require(!MerkleLib.isClaimed(rootBundle.claimedBitmap, relayerRefundLeaf.leafId), \"Already claimed\");\r\n\r\n // Set leaf as claimed in bitmap.\r\n MerkleLib.setClaimed(rootBundle.claimedBitmap, relayerRefundLeaf.leafId);\r\n\r\n // Wrap any ETH owned by this contract so we can send expected L2 token to recipient. This is neccessary because\r\n // some SpokePools will receive ETH from the canonical token bridge instead of WETH.\r\n if (address(this).balance > 0) weth.deposit{ value: address(this).balance }();\r\n\r\n // Send each relayer refund address the associated refundAmount for the L2 token address.\r\n // Note: Even if the L2 token is not enabled on this spoke pool, we should still refund relayers.\r\n for (uint32 i = 0; i < relayerRefundLeaf.refundAmounts.length; i++) {\r\n uint256 amount = relayerRefundLeaf.refundAmounts[i];\r\n if (amount > 0)\r\n IERC20(relayerRefundLeaf.l2TokenAddress).safeTransfer(relayerRefundLeaf.refundAddresses[i], amount);\r\n }\r\n\r\n // If leaf's `amountToReturn` is positive, then send L2 --> L1 message to bridge tokens back via\r\n // chain-specific bridging method.\r\n if (relayerRefundLeaf.amountToReturn > 0) {\r\n _bridgeTokensToHubPool(relayerRefundLeaf);\r\n\r\n emit TokensBridged(\r\n relayerRefundLeaf.amountToReturn,\r\n relayerRefundLeaf.chainId,\r\n relayerRefundLeaf.leafId,\r\n relayerRefundLeaf.l2TokenAddress,\r\n msg.sender\r\n );\r\n }\r\n\r\n emit ExecutedRelayerRefundRoot(\r\n relayerRefundLeaf.amountToReturn,\r\n relayerRefundLeaf.chainId,\r\n relayerRefundLeaf.refundAmounts,\r\n rootBundleId,\r\n relayerRefundLeaf.leafId,\r\n relayerRefundLeaf.l2TokenAddress,\r\n relayerRefundLeaf.refundAddresses,\r\n msg.sender\r\n );\r\n }\r\n\r\n /**************************************\r\n * VIEW FUNCTIONS *\r\n **************************************/\r\n\r\n // Some L2s like ZKSync don't support the CHAIN_ID opcode so we allow the caller to manually set this.\r\n function chainId() public view virtual returns (uint256) {\r\n return block.chainid;\r\n }\r\n\r\n /**************************************\r\n * INTERNAL FUNCTIONS *\r\n **************************************/\r\n\r\n function _bridgeTokensToHubPool(SpokePoolInterface.RelayerRefundLeaf memory relayerRefundLeaf) internal virtual;\r\n\r\n // Allow L2 to implement chain specific recovering of signers from signatures because some L2s might not support\r\n // ecrecover, such as those with account abstraction like ZKSync.\r\n function _verifyDepositorUpdateFeeMessage(\r\n address depositor,\r\n bytes32 ethSignedMessageHash,\r\n bytes memory depositorSignature\r\n ) internal view virtual {\r\n // Note: no need to worry about reentrancy from contract deployed at `depositor` address since\r\n // `SignatureChecker.isValidSignatureNow` is a non state-modifying STATICCALL:\r\n // - https://github.com/OpenZeppelin/openzeppelin-contracts/blob/63b466901fb015538913f811c5112a2775042177/contracts/utils/cryptography/SignatureChecker.sol#L35\r\n // - https://github.com/ethereum/EIPs/pull/214\r\n require(\r\n SignatureChecker.isValidSignatureNow(depositor, ethSignedMessageHash, depositorSignature),\r\n \"invalid signature\"\r\n );\r\n }\r\n\r\n function _computeAmountPreFees(uint256 amount, uint64 feesPct) private pure returns (uint256) {\r\n return (1e18 * amount) / (1e18 - feesPct);\r\n }\r\n\r\n function _computeAmountPostFees(uint256 amount, uint64 feesPct) private pure returns (uint256) {\r\n return (amount * (1e18 - feesPct)) / 1e18;\r\n }\r\n\r\n // Should we make this public for the relayer's convenience?\r\n function _getRelayHash(SpokePoolInterface.RelayData memory relayData) private pure returns (bytes32) {\r\n return keccak256(abi.encode(relayData));\r\n }\r\n\r\n // Unwraps ETH and does a transfer to a recipient address. If the recipient is a smart contract then sends WETH.\r\n function _unwrapWETHTo(address payable to, uint256 amount) internal {\r\n if (address(to).isContract()) {\r\n IERC20(address(weth)).safeTransfer(to, amount);\r\n } else {\r\n weth.withdraw(amount);\r\n to.transfer(amount);\r\n }\r\n }\r\n\r\n // This internal method should be called by an external \"relayRootBundle\" function that validates the\r\n // cross domain sender is the HubPool. This validation step differs for each L2, which is why the implementation\r\n // specifics are left to the implementor of this abstract contract.\r\n // Once this method is executed and a distribution root is stored in this contract, then `distributeRootBundle`\r\n // can be called to execute each leaf in the root.\r\n function _relayRootBundle(bytes32 relayerRefundRoot, bytes32 slowRelayFulfillmentRoot) internal {\r\n uint32 rootBundleId = uint32(rootBundles.length);\r\n RootBundle storage rootBundle = rootBundles.push();\r\n rootBundle.relayerRefundRoot = relayerRefundRoot;\r\n rootBundle.slowRelayFulfillmentRoot = slowRelayFulfillmentRoot;\r\n emit RelayedRootBundle(rootBundleId, relayerRefundRoot, slowRelayFulfillmentRoot);\r\n }\r\n\r\n function _fillRelay(\r\n bytes32 relayHash,\r\n RelayData memory relayData,\r\n uint256 maxTokensToSend,\r\n uint64 updatableRelayerFeePct,\r\n bool isSlowRelay\r\n ) internal returns (uint256 fillAmountPreFees) {\r\n // We limit the relay fees to prevent the user spending all their funds on fees. Note that 0.5e18 (i.e. 50%)\r\n // fees are just magic numbers. The important point is to prevent the total fee from being 100%, otherwise\r\n // computing the amount pre fees runs into divide-by-0 issues.\r\n require(updatableRelayerFeePct < 0.5e18 && relayData.realizedLpFeePct < 0.5e18, \"invalid fees\");\r\n\r\n // Check that the relay has not already been completely filled. Note that the `relays` mapping will point to\r\n // the amount filled so far for a particular `relayHash`, so this will start at 0 and increment with each fill.\r\n require(relayFills[relayHash] < relayData.relayAmount, \"relay filled\");\r\n\r\n // Stores the equivalent amount to be sent by the relayer before fees have been taken out.\r\n fillAmountPreFees = 0;\r\n\r\n // Adding brackets \"stack too deep\" solidity error.\r\n if (maxTokensToSend > 0) {\r\n fillAmountPreFees = _computeAmountPreFees(\r\n maxTokensToSend,\r\n (relayData.realizedLpFeePct + updatableRelayerFeePct)\r\n );\r\n // If user's specified max amount to send is greater than the amount of the relay remaining pre-fees,\r\n // we'll pull exactly enough tokens to complete the relay.\r\n uint256 amountToSend = maxTokensToSend;\r\n if (relayData.relayAmount - relayFills[relayHash] < fillAmountPreFees) {\r\n fillAmountPreFees = relayData.relayAmount - relayFills[relayHash];\r\n amountToSend = _computeAmountPostFees(\r\n fillAmountPreFees,\r\n relayData.realizedLpFeePct + updatableRelayerFeePct\r\n );\r\n }\r\n relayFills[relayHash] += fillAmountPreFees;\r\n // If relay token is weth then unwrap and send eth.\r\n if (relayData.destinationToken == address(weth)) {\r\n // Note: WETH is already in the contract in the slow relay case.\r\n if (!isSlowRelay)\r\n IERC20(relayData.destinationToken).safeTransferFrom(msg.sender, address(this), amountToSend);\r\n _unwrapWETHTo(payable(relayData.recipient), amountToSend);\r\n // Else, this is a normal ERC20 token. Send to recipient.\r\n } else {\r\n // Note: send token directly from the contract to the user in the slow relay case.\r\n if (!isSlowRelay)\r\n IERC20(relayData.destinationToken).safeTransferFrom(msg.sender, relayData.recipient, amountToSend);\r\n else IERC20(relayData.destinationToken).safeTransfer(relayData.recipient, amountToSend);\r\n }\r\n }\r\n }\r\n\r\n function _emitFillRelay(\r\n bytes32 relayHash,\r\n uint256 fillAmount,\r\n uint256 repaymentChain,\r\n uint64 relayerFeePct,\r\n RelayData memory relayData\r\n ) internal {\r\n emit FilledRelay(\r\n relayHash,\r\n relayData.relayAmount,\r\n relayFills[relayHash],\r\n fillAmount,\r\n repaymentChain,\r\n relayData.originChainId,\r\n relayerFeePct,\r\n relayData.realizedLpFeePct,\r\n relayData.depositId,\r\n relayData.destinationToken,\r\n msg.sender,\r\n relayData.depositor,\r\n relayData.recipient\r\n );\r\n }\r\n\r\n function _emitExecutedSlowRelayFulfillmentRoot(\r\n bytes32 relayHash,\r\n uint256 fillAmount,\r\n RelayData memory relayData\r\n ) internal {\r\n emit ExecutedSlowRelayFulfillmentRoot(\r\n relayHash,\r\n relayData.relayAmount,\r\n relayFills[relayHash],\r\n fillAmount,\r\n relayData.originChainId,\r\n relayData.relayerFeePct,\r\n relayData.realizedLpFeePct,\r\n relayData.depositId,\r\n relayData.destinationToken,\r\n msg.sender,\r\n relayData.depositor,\r\n relayData.recipient\r\n );\r\n }\r\n\r\n // Added to enable the this contract to receive ETH. Used when unwrapping Weth.\r\n receive() external payable {}\r\n}\r\n" - }, - "contracts/SpokePoolInterface.sol": { - "content": "//SPDX-License-Identifier: Unlicense\r\npragma solidity ^0.8.0;\r\n\r\ninterface SpokePoolInterface {\r\n // This leaf is meant to be decoded in the SpokePool in order to pay out individual relayers for this bundle.\r\n struct RelayerRefundLeaf {\r\n // This is the amount to return to the HubPool. This occurs when there is a PoolRebalanceLeaf netSendAmount that is\r\n // negative. This is just that value inverted.\r\n uint256 amountToReturn;\r\n // Used to verify that this is being decoded on the correct chainId.\r\n uint256 chainId;\r\n // This array designates how much each of those addresses should be refunded.\r\n uint256[] refundAmounts;\r\n // Used as the index in the bitmap to track whether this leaf has been executed or not.\r\n uint32 leafId;\r\n // The associated L2TokenAddress that these claims apply to.\r\n address l2TokenAddress;\r\n // These two arrays must be the same length and are parallel arrays. They should be order by refundAddresses.\r\n // This array designates each address that must be refunded.\r\n address[] refundAddresses;\r\n }\r\n\r\n // This struct represents the data to fully-specify a relay. If any portion of this data differs, the relay is\r\n // considered to be completely distinct. Only one relay for a particular depositId, chainId pair should be\r\n // considered valid and repaid.\r\n struct RelayData {\r\n // The address that made the deposit on the origin chain.\r\n address depositor;\r\n // The recipient address on the destination chain.\r\n address recipient;\r\n // The corresponding token address on the destination chain.\r\n address destinationToken;\r\n // The total relay amount before fees are taken out.\r\n uint256 relayAmount;\r\n // Origin chain id.\r\n uint256 originChainId;\r\n // The LP Fee percentage computed by the relayer based on the deposit's quote timestamp\r\n // and the HubPool's utilization.\r\n uint64 realizedLpFeePct;\r\n // The relayer fee percentage specified in the deposit.\r\n uint64 relayerFeePct;\r\n // The id uniquely identifying this deposit on the origin chain.\r\n uint32 depositId;\r\n }\r\n\r\n function setCrossDomainAdmin(address newCrossDomainAdmin) external;\r\n\r\n function setHubPool(address newHubPool) external;\r\n\r\n function setEnableRoute(\r\n address originToken,\r\n uint256 destinationChainId,\r\n bool enable\r\n ) external;\r\n\r\n function setDepositQuoteTimeBuffer(uint32 buffer) external;\r\n\r\n function relayRootBundle(bytes32 relayerRefundRoot, bytes32 slowRelayRoot) external;\r\n}\r\n" - }, - "contracts/MerkleLib.sol": { - "content": "// SPDX-License-Identifier: GPL-3.0-only\r\npragma solidity ^0.8.0;\r\n\r\nimport \"@openzeppelin/contracts/utils/cryptography/MerkleProof.sol\";\r\nimport \"./SpokePoolInterface.sol\";\r\nimport \"./HubPoolInterface.sol\";\r\n\r\n/**\r\n * @notice Library to help with merkle roots, proofs, and claims.\r\n */\r\nlibrary MerkleLib {\r\n /**\r\n * @notice Verifies that a repayment is contained within a merkle root.\r\n * @param root the merkle root.\r\n * @param rebalance the rebalance struct.\r\n * @param proof the merkle proof.\r\n */\r\n function verifyPoolRebalance(\r\n bytes32 root,\r\n HubPoolInterface.PoolRebalanceLeaf memory rebalance,\r\n bytes32[] memory proof\r\n ) internal pure returns (bool) {\r\n return MerkleProof.verify(proof, root, keccak256(abi.encode(rebalance)));\r\n }\r\n\r\n /**\r\n * @notice Verifies that a relayer refund is contained within a merkle root.\r\n * @param root the merkle root.\r\n * @param refund the refund struct.\r\n * @param proof the merkle proof.\r\n */\r\n function verifyRelayerRefund(\r\n bytes32 root,\r\n SpokePoolInterface.RelayerRefundLeaf memory refund,\r\n bytes32[] memory proof\r\n ) internal pure returns (bool) {\r\n return MerkleProof.verify(proof, root, keccak256(abi.encode(refund)));\r\n }\r\n\r\n /**\r\n * @notice Verifies that a distribution is contained within a merkle root.\r\n * @param root the merkle root.\r\n * @param slowRelayFulfillment the relayData fulfullment struct.\r\n * @param proof the merkle proof.\r\n */\r\n function verifySlowRelayFulfillment(\r\n bytes32 root,\r\n SpokePoolInterface.RelayData memory slowRelayFulfillment,\r\n bytes32[] memory proof\r\n ) internal pure returns (bool) {\r\n return MerkleProof.verify(proof, root, keccak256(abi.encode(slowRelayFulfillment)));\r\n }\r\n\r\n // The following functions are primarily copied from\r\n // https://github.com/Uniswap/merkle-distributor/blob/master/contracts/MerkleDistributor.sol with minor changes.\r\n\r\n /**\r\n * @notice Tests whether a claim is contained within a claimedBitMap mapping.\r\n * @param claimedBitMap a simple uint256 mapping in storage used as a bitmap.\r\n * @param index the index to check in the bitmap.\r\n * @return bool indicating if the index within the claimedBitMap has been marked as claimed.\r\n */\r\n function isClaimed(mapping(uint256 => uint256) storage claimedBitMap, uint256 index) internal view returns (bool) {\r\n uint256 claimedWordIndex = index / 256;\r\n uint256 claimedBitIndex = index % 256;\r\n uint256 claimedWord = claimedBitMap[claimedWordIndex];\r\n uint256 mask = (1 << claimedBitIndex);\r\n return claimedWord & mask == mask;\r\n }\r\n\r\n /**\r\n * @notice Marks an index in a claimedBitMap as claimed.\r\n * @param claimedBitMap a simple uint256 mapping in storage used as a bitmap.\r\n * @param index the index to mark in the bitmap.\r\n */\r\n function setClaimed(mapping(uint256 => uint256) storage claimedBitMap, uint256 index) internal {\r\n uint256 claimedWordIndex = index / 256;\r\n uint256 claimedBitIndex = index % 256;\r\n claimedBitMap[claimedWordIndex] = claimedBitMap[claimedWordIndex] | (1 << claimedBitIndex);\r\n }\r\n\r\n /**\r\n * @notice Tests whether a claim is contained within a 1D claimedBitMap mapping.\r\n * @param claimedBitMap a simple uint256 value, encoding a 1D bitmap.\r\n * @param index the index to check in the bitmap.\r\n \\* @return bool indicating if the index within the claimedBitMap has been marked as claimed.\r\n */\r\n function isClaimed1D(uint256 claimedBitMap, uint256 index) internal pure returns (bool) {\r\n uint256 mask = (1 << index);\r\n return claimedBitMap & mask == mask;\r\n }\r\n\r\n /**\r\n * @notice Marks an index in a claimedBitMap as claimed.\r\n * @param claimedBitMap a simple uint256 mapping in storage used as a bitmap.\r\n * @param index the index to mark in the bitmap.\r\n */\r\n function setClaimed1D(uint256 claimedBitMap, uint256 index) internal pure returns (uint256) {\r\n require(index <= 255, \"Index out of bounds\");\r\n return claimedBitMap | (1 << index % 256);\r\n }\r\n}\r\n" - }, - "contracts/interfaces/WETH9.sol": { - "content": "// SPDX-License-Identifier: GPL-3.0-only\r\npragma solidity ^0.8.0;\r\n\r\ninterface WETH9 {\r\n function withdraw(uint256 wad) external;\r\n\r\n function deposit() external payable;\r\n\r\n function balanceOf(address guy) external view returns (uint256 wad);\r\n\r\n function transfer(address guy, uint256 wad) external;\r\n}\r\n" - }, - "@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol": { - "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts v4.4.1 (token/ERC20/utils/SafeERC20.sol)\n\npragma solidity ^0.8.0;\n\nimport \"../IERC20.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 function safeTransfer(\n IERC20 token,\n address to,\n uint256 value\n ) internal {\n _callOptionalReturn(token, abi.encodeWithSelector(token.transfer.selector, to, value));\n }\n\n function safeTransferFrom(\n IERC20 token,\n address from,\n address to,\n uint256 value\n ) 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(\n IERC20 token,\n address spender,\n uint256 value\n ) 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 function safeIncreaseAllowance(\n IERC20 token,\n address spender,\n uint256 value\n ) internal {\n uint256 newAllowance = token.allowance(address(this), spender) + value;\n _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, newAllowance));\n }\n\n function safeDecreaseAllowance(\n IERC20 token,\n address spender,\n uint256 value\n ) internal {\n unchecked {\n uint256 oldAllowance = token.allowance(address(this), spender);\n require(oldAllowance >= value, \"SafeERC20: decreased allowance below zero\");\n uint256 newAllowance = oldAllowance - value;\n _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, newAllowance));\n }\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 if (returndata.length > 0) {\n // Return data is optional\n require(abi.decode(returndata, (bool)), \"SafeERC20: ERC20 operation did not succeed\");\n }\n }\n}\n" - }, - "@openzeppelin/contracts/token/ERC20/IERC20.sol": { - "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts v4.4.1 (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 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 `recipient`.\n *\n * Returns a boolean value indicating whether the operation succeeded.\n *\n * Emits a {Transfer} event.\n */\n function transfer(address recipient, 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 `sender` to `recipient` 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(\n address sender,\n address recipient,\n uint256 amount\n ) external returns (bool);\n\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" - }, - "@openzeppelin/contracts/utils/Address.sol": { - "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts v4.4.1 (utils/Address.sol)\n\npragma solidity ^0.8.0;\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 */\n function isContract(address account) internal view returns (bool) {\n // This method relies on extcodesize, which returns 0 for contracts in\n // construction, since the code is only stored at the end of the\n // constructor execution.\n\n uint256 size;\n assembly {\n size := extcodesize(account)\n }\n return size > 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://diligence.consensys.net/posts/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.5.11/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 functionCall(target, data, \"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(\n address target,\n bytes memory data,\n uint256 value\n ) 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 require(isContract(target), \"Address: call to non-contract\");\n\n (bool success, bytes memory returndata) = target.call{value: value}(data);\n return verifyCallResult(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 require(isContract(target), \"Address: static call to non-contract\");\n\n (bool success, bytes memory returndata) = target.staticcall(data);\n return verifyCallResult(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 require(isContract(target), \"Address: delegate call to non-contract\");\n\n (bool success, bytes memory returndata) = target.delegatecall(data);\n return verifyCallResult(success, returndata, errorMessage);\n }\n\n /**\n * @dev Tool to verifies that a low level call was successful, and revert if it wasn't, either by bubbling the\n * revert reason 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 // 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\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}\n" - }, - "@openzeppelin/contracts/utils/cryptography/SignatureChecker.sol": { - "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts v4.4.1 (utils/cryptography/SignatureChecker.sol)\n\npragma solidity ^0.8.0;\n\nimport \"./ECDSA.sol\";\nimport \"../Address.sol\";\nimport \"../../interfaces/IERC1271.sol\";\n\n/**\n * @dev Signature verification helper: Provide a single mechanism to verify both private-key (EOA) ECDSA signature and\n * ERC1271 contract signatures. Using this instead of ECDSA.recover in your contract will make them compatible with\n * smart contract wallets such as Argent and Gnosis.\n *\n * Note: unlike ECDSA signatures, contract signature's are revocable, and the outcome of this function can thus change\n * through time. It could return true at block N and false at block N+1 (or the opposite).\n *\n * _Available since v4.1._\n */\nlibrary SignatureChecker {\n function isValidSignatureNow(\n address signer,\n bytes32 hash,\n bytes memory signature\n ) internal view returns (bool) {\n (address recovered, ECDSA.RecoverError error) = ECDSA.tryRecover(hash, signature);\n if (error == ECDSA.RecoverError.NoError && recovered == signer) {\n return true;\n }\n\n (bool success, bytes memory result) = signer.staticcall(\n abi.encodeWithSelector(IERC1271.isValidSignature.selector, hash, signature)\n );\n return (success && result.length == 32 && abi.decode(result, (bytes4)) == IERC1271.isValidSignature.selector);\n }\n}\n" - }, - "@openzeppelin/contracts/utils/cryptography/ECDSA.sol": { - "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts v4.4.1 (utils/cryptography/ECDSA.sol)\n\npragma solidity ^0.8.0;\n\nimport \"../Strings.sol\";\n\n/**\n * @dev Elliptic Curve Digital Signature Algorithm (ECDSA) operations.\n *\n * These functions can be used to verify that a message was signed by the holder\n * of the private keys of a given address.\n */\nlibrary ECDSA {\n enum RecoverError {\n NoError,\n InvalidSignature,\n InvalidSignatureLength,\n InvalidSignatureS,\n InvalidSignatureV\n }\n\n function _throwError(RecoverError error) private pure {\n if (error == RecoverError.NoError) {\n return; // no error: do nothing\n } else if (error == RecoverError.InvalidSignature) {\n revert(\"ECDSA: invalid signature\");\n } else if (error == RecoverError.InvalidSignatureLength) {\n revert(\"ECDSA: invalid signature length\");\n } else if (error == RecoverError.InvalidSignatureS) {\n revert(\"ECDSA: invalid signature 's' value\");\n } else if (error == RecoverError.InvalidSignatureV) {\n revert(\"ECDSA: invalid signature 'v' value\");\n }\n }\n\n /**\n * @dev Returns the address that signed a hashed message (`hash`) with\n * `signature` or error string. This address can then be used for verification purposes.\n *\n * The `ecrecover` EVM opcode allows for malleable (non-unique) signatures:\n * this function rejects them by requiring the `s` value to be in the lower\n * half order, and the `v` value to be either 27 or 28.\n *\n * IMPORTANT: `hash` _must_ be the result of a hash operation for the\n * verification to be secure: it is possible to craft signatures that\n * recover to arbitrary addresses for non-hashed data. A safe way to ensure\n * this is by receiving a hash of the original message (which may otherwise\n * be too long), and then calling {toEthSignedMessageHash} on it.\n *\n * Documentation for signature generation:\n * - with https://web3js.readthedocs.io/en/v1.3.4/web3-eth-accounts.html#sign[Web3.js]\n * - with https://docs.ethers.io/v5/api/signer/#Signer-signMessage[ethers]\n *\n * _Available since v4.3._\n */\n function tryRecover(bytes32 hash, bytes memory signature) internal pure returns (address, RecoverError) {\n // Check the signature length\n // - case 65: r,s,v signature (standard)\n // - case 64: r,vs signature (cf https://eips.ethereum.org/EIPS/eip-2098) _Available since v4.1._\n if (signature.length == 65) {\n bytes32 r;\n bytes32 s;\n uint8 v;\n // ecrecover takes the signature parameters, and the only way to get them\n // currently is to use assembly.\n assembly {\n r := mload(add(signature, 0x20))\n s := mload(add(signature, 0x40))\n v := byte(0, mload(add(signature, 0x60)))\n }\n return tryRecover(hash, v, r, s);\n } else if (signature.length == 64) {\n bytes32 r;\n bytes32 vs;\n // ecrecover takes the signature parameters, and the only way to get them\n // currently is to use assembly.\n assembly {\n r := mload(add(signature, 0x20))\n vs := mload(add(signature, 0x40))\n }\n return tryRecover(hash, r, vs);\n } else {\n return (address(0), RecoverError.InvalidSignatureLength);\n }\n }\n\n /**\n * @dev Returns the address that signed a hashed message (`hash`) with\n * `signature`. This address can then be used for verification purposes.\n *\n * The `ecrecover` EVM opcode allows for malleable (non-unique) signatures:\n * this function rejects them by requiring the `s` value to be in the lower\n * half order, and the `v` value to be either 27 or 28.\n *\n * IMPORTANT: `hash` _must_ be the result of a hash operation for the\n * verification to be secure: it is possible to craft signatures that\n * recover to arbitrary addresses for non-hashed data. A safe way to ensure\n * this is by receiving a hash of the original message (which may otherwise\n * be too long), and then calling {toEthSignedMessageHash} on it.\n */\n function recover(bytes32 hash, bytes memory signature) internal pure returns (address) {\n (address recovered, RecoverError error) = tryRecover(hash, signature);\n _throwError(error);\n return recovered;\n }\n\n /**\n * @dev Overload of {ECDSA-tryRecover} that receives the `r` and `vs` short-signature fields separately.\n *\n * See https://eips.ethereum.org/EIPS/eip-2098[EIP-2098 short signatures]\n *\n * _Available since v4.3._\n */\n function tryRecover(\n bytes32 hash,\n bytes32 r,\n bytes32 vs\n ) internal pure returns (address, RecoverError) {\n bytes32 s;\n uint8 v;\n assembly {\n s := and(vs, 0x7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff)\n v := add(shr(255, vs), 27)\n }\n return tryRecover(hash, v, r, s);\n }\n\n /**\n * @dev Overload of {ECDSA-recover} that receives the `r and `vs` short-signature fields separately.\n *\n * _Available since v4.2._\n */\n function recover(\n bytes32 hash,\n bytes32 r,\n bytes32 vs\n ) internal pure returns (address) {\n (address recovered, RecoverError error) = tryRecover(hash, r, vs);\n _throwError(error);\n return recovered;\n }\n\n /**\n * @dev Overload of {ECDSA-tryRecover} that receives the `v`,\n * `r` and `s` signature fields separately.\n *\n * _Available since v4.3._\n */\n function tryRecover(\n bytes32 hash,\n uint8 v,\n bytes32 r,\n bytes32 s\n ) internal pure returns (address, RecoverError) {\n // EIP-2 still allows signature malleability for ecrecover(). Remove this possibility and make the signature\n // unique. Appendix F in the Ethereum Yellow paper (https://ethereum.github.io/yellowpaper/paper.pdf), defines\n // the valid range for s in (301): 0 < s < secp256k1n ÷ 2 + 1, and for v in (302): v ∈ {27, 28}. Most\n // signatures from current libraries generate a unique signature with an s-value in the lower half order.\n //\n // If your library generates malleable signatures, such as s-values in the upper range, calculate a new s-value\n // with 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFEBAAEDCE6AF48A03BBFD25E8CD0364141 - s1 and flip v from 27 to 28 or\n // vice versa. If your library also generates signatures with 0/1 for v instead 27/28, add 27 to v to accept\n // these malleable signatures as well.\n if (uint256(s) > 0x7FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF5D576E7357A4501DDFE92F46681B20A0) {\n return (address(0), RecoverError.InvalidSignatureS);\n }\n if (v != 27 && v != 28) {\n return (address(0), RecoverError.InvalidSignatureV);\n }\n\n // If the signature is valid (and not malleable), return the signer address\n address signer = ecrecover(hash, v, r, s);\n if (signer == address(0)) {\n return (address(0), RecoverError.InvalidSignature);\n }\n\n return (signer, RecoverError.NoError);\n }\n\n /**\n * @dev Overload of {ECDSA-recover} that receives the `v`,\n * `r` and `s` signature fields separately.\n */\n function recover(\n bytes32 hash,\n uint8 v,\n bytes32 r,\n bytes32 s\n ) internal pure returns (address) {\n (address recovered, RecoverError error) = tryRecover(hash, v, r, s);\n _throwError(error);\n return recovered;\n }\n\n /**\n * @dev Returns an Ethereum Signed Message, created from a `hash`. This\n * produces hash corresponding to the one signed with the\n * https://eth.wiki/json-rpc/API#eth_sign[`eth_sign`]\n * JSON-RPC method as part of EIP-191.\n *\n * See {recover}.\n */\n function toEthSignedMessageHash(bytes32 hash) internal pure returns (bytes32) {\n // 32 is the length in bytes of hash,\n // enforced by the type signature above\n return keccak256(abi.encodePacked(\"\\x19Ethereum Signed Message:\\n32\", hash));\n }\n\n /**\n * @dev Returns an Ethereum Signed Message, created from `s`. This\n * produces hash corresponding to the one signed with the\n * https://eth.wiki/json-rpc/API#eth_sign[`eth_sign`]\n * JSON-RPC method as part of EIP-191.\n *\n * See {recover}.\n */\n function toEthSignedMessageHash(bytes memory s) internal pure returns (bytes32) {\n return keccak256(abi.encodePacked(\"\\x19Ethereum Signed Message:\\n\", Strings.toString(s.length), s));\n }\n\n /**\n * @dev Returns an Ethereum Signed Typed Data, created from a\n * `domainSeparator` and a `structHash`. This produces hash corresponding\n * to the one signed with the\n * https://eips.ethereum.org/EIPS/eip-712[`eth_signTypedData`]\n * JSON-RPC method as part of EIP-712.\n *\n * See {recover}.\n */\n function toTypedDataHash(bytes32 domainSeparator, bytes32 structHash) internal pure returns (bytes32) {\n return keccak256(abi.encodePacked(\"\\x19\\x01\", domainSeparator, structHash));\n }\n}\n" - }, - "@uma/core/contracts/common/implementation/Testable.sol": { - "content": "// SPDX-License-Identifier: AGPL-3.0-only\npragma solidity ^0.8.0;\n\nimport \"./Timer.sol\";\n\n/**\n * @title Base class that provides time overrides, but only if being run in test mode.\n */\nabstract contract Testable {\n // If the contract is being run in production, then `timerAddress` will be the 0x0 address.\n // Note: this variable should be set on construction and never modified.\n address public timerAddress;\n\n /**\n * @notice Constructs the Testable contract. Called by child contracts.\n * @param _timerAddress Contract that stores the current time in a testing environment.\n * Must be set to 0x0 for production environments that use live time.\n */\n constructor(address _timerAddress) {\n timerAddress = _timerAddress;\n }\n\n /**\n * @notice Reverts if not running in test mode.\n */\n modifier onlyIfTest {\n require(timerAddress != address(0x0));\n _;\n }\n\n /**\n * @notice Sets the current time.\n * @dev Will revert if not running in test mode.\n * @param time timestamp to set current Testable time to.\n */\n function setCurrentTime(uint256 time) external onlyIfTest {\n Timer(timerAddress).setCurrentTime(time);\n }\n\n /**\n * @notice Gets the current time. Will return the last time set in `setCurrentTime` if running in test mode.\n * Otherwise, it will return the block timestamp.\n * @return uint for the current Testable timestamp.\n */\n function getCurrentTime() public view virtual returns (uint256) {\n if (timerAddress != address(0x0)) {\n return Timer(timerAddress).getCurrentTime();\n } else {\n return block.timestamp; // solhint-disable-line not-rely-on-time\n }\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" - }, - "@uma/core/contracts/common/implementation/MultiCaller.sol": { - "content": "// This contract is taken from Uniswaps'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.\npragma solidity ^0.8.0;\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 payable returns (bytes[] memory results) {\n require(msg.value == 0, \"Only multicall with 0 value\");\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" - }, - "@openzeppelin/contracts/utils/cryptography/MerkleProof.sol": { - "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts v4.4.1 (utils/cryptography/MerkleProof.sol)\n\npragma solidity ^0.8.0;\n\n/**\n * @dev These functions deal with verification of Merkle Trees proofs.\n *\n * The proofs can be generated using the JavaScript library\n * https://github.com/miguelmota/merkletreejs[merkletreejs].\n * Note: the hashing algorithm should be keccak256 and pair sorting should be enabled.\n *\n * See `test/utils/cryptography/MerkleProof.test.js` for some examples.\n */\nlibrary MerkleProof {\n /**\n * @dev Returns true if a `leaf` can be proved to be a part of a Merkle tree\n * defined by `root`. For this, a `proof` must be provided, containing\n * sibling hashes on the branch from the leaf to the root of the tree. Each\n * pair of leaves and each pair of pre-images are assumed to be sorted.\n */\n function verify(\n bytes32[] memory proof,\n bytes32 root,\n bytes32 leaf\n ) internal pure returns (bool) {\n return processProof(proof, leaf) == root;\n }\n\n /**\n * @dev Returns the rebuilt hash obtained by traversing a Merklee tree up\n * from `leaf` using `proof`. A `proof` is valid if and only if the rebuilt\n * hash matches the root of the tree. When processing the proof, the pairs\n * of leafs & pre-images are assumed to be sorted.\n *\n * _Available since v4.4._\n */\n function processProof(bytes32[] memory proof, bytes32 leaf) internal pure returns (bytes32) {\n bytes32 computedHash = leaf;\n for (uint256 i = 0; i < proof.length; i++) {\n bytes32 proofElement = proof[i];\n if (computedHash <= proofElement) {\n // Hash(current computed hash + current element of the proof)\n computedHash = keccak256(abi.encodePacked(computedHash, proofElement));\n } else {\n // Hash(current element of the proof + current computed hash)\n computedHash = keccak256(abi.encodePacked(proofElement, computedHash));\n }\n }\n return computedHash;\n }\n}\n" - }, - "contracts/HubPoolInterface.sol": { - "content": "// SPDX-License-Identifier: GPL-3.0-only\r\npragma solidity ^0.8.0;\r\n\r\nimport \"@openzeppelin/contracts/token/ERC20/IERC20.sol\";\r\nimport \"./interfaces/AdapterInterface.sol\";\r\n\r\ninterface HubPoolInterface {\r\n struct PoolRebalanceLeaf {\r\n // This is used to know which chain to send cross-chain transactions to (and which SpokePool to sent to).\r\n uint256 chainId;\r\n uint256[] bundleLpFees; // Total LP fee amount per token in this bundle, encompassing all associated bundled relays.\r\n // This array is grouped with the two above, and it represents the amount to send or request back from the\r\n // SpokePool. If positive, the pool will pay the SpokePool. If negative the SpokePool will pay the HubPool.\r\n // There can be arbitrarily complex rebalancing rules defined offchain. This number is only nonzero\r\n // when the rules indicate that a rebalancing action should occur. When a rebalance does not occur,\r\n // runningBalances for this token should change by the total relays - deposits in this bundle. When a rebalance\r\n // does occur, runningBalances should be set to zero for this token and the netSendAmounts should be set to the\r\n // previous runningBalances + relays - deposits in this bundle.\r\n int256[] netSendAmounts;\r\n // This is only here to be emitted in an event to track a running unpaid balance between the L2 pool and the L1 pool.\r\n // A positive number indicates that the HubPool owes the SpokePool funds. A negative number indicates that the\r\n // SpokePool owes the HubPool funds. See the comment above for the dynamics of this and netSendAmounts\r\n int256[] runningBalances;\r\n // Used as the index in the bitmap to track whether this leaf has been executed or not.\r\n uint8 leafId;\r\n // The following arrays are required to be the same length. They are parallel arrays for the given chainId and should be ordered by the `l1Tokens` field.\r\n // All whitelisted tokens with nonzero relays on this chain in this bundle in the order of whitelisting.\r\n address[] l1Tokens;\r\n }\r\n\r\n function setBond(IERC20 newBondToken, uint256 newBondAmount) external;\r\n\r\n function setCrossChainContracts(\r\n uint256 l2ChainId,\r\n address adapter,\r\n address spokePool\r\n ) external;\r\n\r\n function whitelistRoute(\r\n uint256 originChainId,\r\n uint256 destinationChainId,\r\n address originToken,\r\n address destinationToken\r\n ) external;\r\n\r\n function enableL1TokenForLiquidityProvision(address l1Token) external;\r\n\r\n function disableL1TokenForLiquidityProvision(address l1Token) external;\r\n\r\n function addLiquidity(address l1Token, uint256 l1TokenAmount) external payable;\r\n\r\n function removeLiquidity(\r\n address l1Token,\r\n uint256 lpTokenAmount,\r\n bool sendEth\r\n ) external;\r\n\r\n function exchangeRateCurrent(address l1Token) external returns (uint256);\r\n\r\n function liquidityUtilizationPostRelay(address token, uint256 relayedAmount) external returns (uint256);\r\n\r\n function proposeRootBundle(\r\n uint256[] memory bundleEvaluationBlockNumbers,\r\n uint8 poolRebalanceLeafCount,\r\n bytes32 poolRebalanceRoot,\r\n bytes32 relayerRefundRoot,\r\n bytes32 slowRelayFulfillmentRoot\r\n ) external;\r\n\r\n function executeRootBundle(PoolRebalanceLeaf memory poolRebalanceLeaf, bytes32[] memory proof) external;\r\n\r\n function disputeRootBundle() external;\r\n}\r\n" - }, - "contracts/interfaces/AdapterInterface.sol": { - "content": "// SPDX-License-Identifier: AGPL-3.0-only\npragma solidity ^0.8.0;\n\n/**\n * @notice Sends cross chain messages and tokens to contracts on a specific L2 network.\n */\n\ninterface AdapterInterface {\n event HubPoolChanged(address newHubPool);\n\n event MessageRelayed(address target, bytes message);\n\n event TokensRelayed(address l1Token, address l2Token, uint256 amount, address to);\n\n function relayMessage(address target, bytes memory message) external payable;\n\n function relayTokens(\n address l1Token,\n address l2Token,\n uint256 amount,\n address to\n ) external payable;\n}\n" - }, - "@openzeppelin/contracts/interfaces/IERC1271.sol": { - "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts v4.4.1 (interfaces/IERC1271.sol)\n\npragma solidity ^0.8.0;\n\n/**\n * @dev Interface of the ERC1271 standard signature validation method for\n * contracts as defined in https://eips.ethereum.org/EIPS/eip-1271[ERC-1271].\n *\n * _Available since v4.1._\n */\ninterface IERC1271 {\n /**\n * @dev Should return whether the signature provided is valid for the provided data\n * @param hash Hash of the data to be signed\n * @param signature Signature byte array associated with _data\n */\n function isValidSignature(bytes32 hash, bytes memory signature) external view returns (bytes4 magicValue);\n}\n" - }, - "@openzeppelin/contracts/utils/Strings.sol": { - "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts v4.4.1 (utils/Strings.sol)\n\npragma solidity ^0.8.0;\n\n/**\n * @dev String operations.\n */\nlibrary Strings {\n bytes16 private constant _HEX_SYMBOLS = \"0123456789abcdef\";\n\n /**\n * @dev Converts a `uint256` to its ASCII `string` decimal representation.\n */\n function toString(uint256 value) internal pure returns (string memory) {\n // Inspired by OraclizeAPI's implementation - MIT licence\n // https://github.com/oraclize/ethereum-api/blob/b42146b063c7d6ee1358846c198246239e9360e8/oraclizeAPI_0.4.25.sol\n\n if (value == 0) {\n return \"0\";\n }\n uint256 temp = value;\n uint256 digits;\n while (temp != 0) {\n digits++;\n temp /= 10;\n }\n bytes memory buffer = new bytes(digits);\n while (value != 0) {\n digits -= 1;\n buffer[digits] = bytes1(uint8(48 + uint256(value % 10)));\n value /= 10;\n }\n return string(buffer);\n }\n\n /**\n * @dev Converts a `uint256` to its ASCII `string` hexadecimal representation.\n */\n function toHexString(uint256 value) internal pure returns (string memory) {\n if (value == 0) {\n return \"0x00\";\n }\n uint256 temp = value;\n uint256 length = 0;\n while (temp != 0) {\n length++;\n temp >>= 8;\n }\n return toHexString(value, length);\n }\n\n /**\n * @dev Converts a `uint256` to its ASCII `string` hexadecimal representation with fixed length.\n */\n function toHexString(uint256 value, uint256 length) internal pure returns (string memory) {\n bytes memory buffer = new bytes(2 * length + 2);\n buffer[0] = \"0\";\n buffer[1] = \"x\";\n for (uint256 i = 2 * length + 1; i > 1; --i) {\n buffer[i] = _HEX_SYMBOLS[value & 0xf];\n value >>= 4;\n }\n require(value == 0, \"Strings: hex length insufficient\");\n return string(buffer);\n }\n}\n" - }, - "@uma/core/contracts/common/implementation/Timer.sol": { - "content": "// SPDX-License-Identifier: AGPL-3.0-only\npragma solidity ^0.8.0;\n\n/**\n * @title Universal store of current contract time for testing environments.\n */\ncontract Timer {\n uint256 private currentTime;\n\n constructor() {\n currentTime = block.timestamp; // solhint-disable-line not-rely-on-time\n }\n\n /**\n * @notice Sets the current time.\n * @dev Will revert if not running in test mode.\n * @param time timestamp to set `currentTime` to.\n */\n function setCurrentTime(uint256 time) external {\n currentTime = time;\n }\n\n /**\n * @notice Gets the currentTime variable set in the Timer.\n * @return uint256 for the current Testable timestamp.\n */\n function getCurrentTime() public view returns (uint256) {\n return currentTime;\n }\n}\n" - }, - "contracts/test/MockSpokePool.sol": { - "content": "//SPDX-License-Identifier: Unlicense\r\npragma solidity ^0.8.0;\r\n\r\nimport \"../SpokePool.sol\";\r\nimport \"../SpokePoolInterface.sol\";\r\n\r\n/**\r\n * @title MockSpokePool\r\n * @notice Implements admin internal methods to test internal logic.\r\n */\r\ncontract MockSpokePool is SpokePoolInterface, SpokePool {\r\n constructor(\r\n address _crossDomainAdmin,\r\n address _hubPool,\r\n address _wethAddress,\r\n address timerAddress\r\n ) SpokePool(_crossDomainAdmin, _hubPool, _wethAddress, timerAddress) {}\r\n\r\n function setCrossDomainAdmin(address newCrossDomainAdmin) public override {\r\n _setCrossDomainAdmin(newCrossDomainAdmin);\r\n }\r\n\r\n function setHubPool(address newHubPool) public override {\r\n _setHubPool(newHubPool);\r\n }\r\n\r\n function setEnableRoute(\r\n address originToken,\r\n uint256 destinationChainId,\r\n bool enable\r\n ) public override {\r\n _setEnableRoute(originToken, destinationChainId, enable);\r\n }\r\n\r\n function setDepositQuoteTimeBuffer(uint32 buffer) public override {\r\n _setDepositQuoteTimeBuffer(buffer);\r\n }\r\n\r\n function relayRootBundle(bytes32 relayerRefundRoot, bytes32 slowRelayFulfillmentRoot) public override {\r\n _relayRootBundle(relayerRefundRoot, slowRelayFulfillmentRoot);\r\n }\r\n\r\n function _bridgeTokensToHubPool(RelayerRefundLeaf memory relayerRefundLeaf) internal override {}\r\n}\r\n" - }, - "contracts/Optimism_SpokePool.sol": { - "content": "//SPDX-License-Identifier: Unlicense\r\npragma solidity ^0.8.0;\r\n\r\nimport \"./interfaces/WETH9.sol\";\r\n\r\nimport \"@eth-optimism/contracts/libraries/bridge/CrossDomainEnabled.sol\";\r\nimport \"@eth-optimism/contracts/libraries/constants/Lib_PredeployAddresses.sol\";\r\nimport \"@eth-optimism/contracts/L2/messaging/IL2ERC20Bridge.sol\";\r\nimport \"./SpokePool.sol\";\r\nimport \"./SpokePoolInterface.sol\";\r\n\r\n/**\r\n * @notice OVM specific SpokePool.\r\n * @dev Uses OVM cross-domain-enabled logic for access control.\r\n */\r\n\r\ncontract Optimism_SpokePool is CrossDomainEnabled, SpokePoolInterface, SpokePool {\r\n // \"l1Gas\" parameter used in call to bridge tokens from this contract back to L1 via `IL2ERC20Bridge`.\r\n uint32 public l1Gas = 5_000_000;\r\n\r\n address public l2Eth = address(Lib_PredeployAddresses.OVM_ETH);\r\n\r\n event OptimismTokensBridged(address indexed l2Token, address target, uint256 numberOfTokensBridged, uint256 l1Gas);\r\n event SetL1Gas(uint32 indexed newL1Gas);\r\n\r\n constructor(\r\n address _crossDomainAdmin,\r\n address _hubPool,\r\n address timerAddress\r\n )\r\n CrossDomainEnabled(Lib_PredeployAddresses.L2_CROSS_DOMAIN_MESSENGER)\r\n SpokePool(_crossDomainAdmin, _hubPool, 0x4200000000000000000000000000000000000006, timerAddress)\r\n {}\r\n\r\n /**************************************\r\n * CROSS-CHAIN ADMIN FUNCTIONS *\r\n **************************************/\r\n\r\n function setL1GasLimit(uint32 newl1Gas) public onlyFromCrossDomainAccount(crossDomainAdmin) {\r\n _setL1GasLimit(newl1Gas);\r\n }\r\n\r\n function setCrossDomainAdmin(address newCrossDomainAdmin)\r\n public\r\n override\r\n onlyFromCrossDomainAccount(crossDomainAdmin)\r\n nonReentrant\r\n {\r\n _setCrossDomainAdmin(newCrossDomainAdmin);\r\n }\r\n\r\n function setHubPool(address newHubPool) public override onlyFromCrossDomainAccount(crossDomainAdmin) nonReentrant {\r\n _setHubPool(newHubPool);\r\n }\r\n\r\n function setEnableRoute(\r\n address originToken,\r\n uint256 destinationChainId,\r\n bool enable\r\n ) public override onlyFromCrossDomainAccount(crossDomainAdmin) nonReentrant {\r\n _setEnableRoute(originToken, destinationChainId, enable);\r\n }\r\n\r\n function setDepositQuoteTimeBuffer(uint32 buffer)\r\n public\r\n override\r\n onlyFromCrossDomainAccount(crossDomainAdmin)\r\n nonReentrant\r\n {\r\n _setDepositQuoteTimeBuffer(buffer);\r\n }\r\n\r\n function relayRootBundle(bytes32 relayerRefundRoot, bytes32 slowRelayFulfillmentRoot)\r\n public\r\n override\r\n onlyFromCrossDomainAccount(crossDomainAdmin)\r\n nonReentrant\r\n {\r\n _relayRootBundle(relayerRefundRoot, slowRelayFulfillmentRoot);\r\n }\r\n\r\n /**************************************\r\n * INTERNAL FUNCTIONS *\r\n **************************************/\r\n\r\n function _setL1GasLimit(uint32 _l1Gas) internal {\r\n l1Gas = _l1Gas;\r\n emit SetL1Gas(l1Gas);\r\n }\r\n\r\n function _bridgeTokensToHubPool(RelayerRefundLeaf memory relayerRefundLeaf) internal override {\r\n // If the token being bridged is WETH then we need to first unwrap it to ETH and then send ETH over the\r\n // canonical bridge. On Optimism, this is address 0xDeadDeAddeAddEAddeadDEaDDEAdDeaDDeAD0000.\r\n if (relayerRefundLeaf.l2TokenAddress == address(weth)) {\r\n WETH9(relayerRefundLeaf.l2TokenAddress).withdraw(relayerRefundLeaf.amountToReturn); // Unwrap ETH.\r\n relayerRefundLeaf.l2TokenAddress = l2Eth; // Set the l2TokenAddress to ETH.\r\n }\r\n IL2ERC20Bridge(Lib_PredeployAddresses.L2_STANDARD_BRIDGE).withdrawTo(\r\n relayerRefundLeaf.l2TokenAddress, // _l2Token. Address of the L2 token to bridge over.\r\n hubPool, // _to. Withdraw, over the bridge, to the l1 pool contract.\r\n relayerRefundLeaf.amountToReturn, // _amount.\r\n l1Gas, // _l1Gas. Unused, but included for potential forward compatibility considerations\r\n \"\" // _data. We don't need to send any data for the bridging action.\r\n );\r\n\r\n emit OptimismTokensBridged(relayerRefundLeaf.l2TokenAddress, hubPool, relayerRefundLeaf.amountToReturn, l1Gas);\r\n }\r\n}\r\n" - }, - "@eth-optimism/contracts/libraries/bridge/CrossDomainEnabled.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma solidity >0.5.0 <0.9.0;\n\n/* Interface Imports */\nimport { ICrossDomainMessenger } from \"./ICrossDomainMessenger.sol\";\n\n/**\n * @title CrossDomainEnabled\n * @dev Helper contract for contracts performing cross-domain communications\n *\n * Compiler used: defined by inheriting contract\n */\ncontract CrossDomainEnabled {\n /*************\n * Variables *\n *************/\n\n // Messenger contract used to send and recieve messages from the other domain.\n address public messenger;\n\n /***************\n * Constructor *\n ***************/\n\n /**\n * @param _messenger Address of the CrossDomainMessenger on the current layer.\n */\n constructor(address _messenger) {\n messenger = _messenger;\n }\n\n /**********************\n * Function Modifiers *\n **********************/\n\n /**\n * Enforces that the modified function is only callable by a specific cross-domain account.\n * @param _sourceDomainAccount The only account on the originating domain which is\n * authenticated to call this function.\n */\n modifier onlyFromCrossDomainAccount(address _sourceDomainAccount) {\n require(\n msg.sender == address(getCrossDomainMessenger()),\n \"OVM_XCHAIN: messenger contract unauthenticated\"\n );\n\n require(\n getCrossDomainMessenger().xDomainMessageSender() == _sourceDomainAccount,\n \"OVM_XCHAIN: wrong sender of cross-domain message\"\n );\n\n _;\n }\n\n /**********************\n * Internal Functions *\n **********************/\n\n /**\n * Gets the messenger, usually from storage. This function is exposed in case a child contract\n * needs to override.\n * @return The address of the cross-domain messenger contract which should be used.\n */\n function getCrossDomainMessenger() internal virtual returns (ICrossDomainMessenger) {\n return ICrossDomainMessenger(messenger);\n }\n\n /**q\n * Sends a message to an account on another domain\n * @param _crossDomainTarget The intended recipient on the destination domain\n * @param _message The data to send to the target (usually calldata to a function with\n * `onlyFromCrossDomainAccount()`)\n * @param _gasLimit The gasLimit for the receipt of the message on the target domain.\n */\n function sendCrossDomainMessage(\n address _crossDomainTarget,\n uint32 _gasLimit,\n bytes memory _message\n ) internal {\n // slither-disable-next-line reentrancy-events, reentrancy-benign\n getCrossDomainMessenger().sendMessage(_crossDomainTarget, _message, _gasLimit);\n }\n}\n" - }, - "@eth-optimism/contracts/libraries/constants/Lib_PredeployAddresses.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.9;\n\n/**\n * @title Lib_PredeployAddresses\n */\nlibrary Lib_PredeployAddresses {\n address internal constant L2_TO_L1_MESSAGE_PASSER = 0x4200000000000000000000000000000000000000;\n address internal constant L1_MESSAGE_SENDER = 0x4200000000000000000000000000000000000001;\n address internal constant DEPLOYER_WHITELIST = 0x4200000000000000000000000000000000000002;\n address payable internal constant OVM_ETH = payable(0xDeadDeAddeAddEAddeadDEaDDEAdDeaDDeAD0000);\n address internal constant L2_CROSS_DOMAIN_MESSENGER =\n 0x4200000000000000000000000000000000000007;\n address internal constant LIB_ADDRESS_MANAGER = 0x4200000000000000000000000000000000000008;\n address internal constant PROXY_EOA = 0x4200000000000000000000000000000000000009;\n address internal constant L2_STANDARD_BRIDGE = 0x4200000000000000000000000000000000000010;\n address internal constant SEQUENCER_FEE_WALLET = 0x4200000000000000000000000000000000000011;\n address internal constant L2_STANDARD_TOKEN_FACTORY =\n 0x4200000000000000000000000000000000000012;\n address internal constant L1_BLOCK_NUMBER = 0x4200000000000000000000000000000000000013;\n}\n" - }, - "@eth-optimism/contracts/L2/messaging/IL2ERC20Bridge.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.9;\n\n/**\n * @title IL2ERC20Bridge\n */\ninterface IL2ERC20Bridge {\n /**********\n * Events *\n **********/\n\n event WithdrawalInitiated(\n address indexed _l1Token,\n address indexed _l2Token,\n address indexed _from,\n address _to,\n uint256 _amount,\n bytes _data\n );\n\n event DepositFinalized(\n address indexed _l1Token,\n address indexed _l2Token,\n address indexed _from,\n address _to,\n uint256 _amount,\n bytes _data\n );\n\n event DepositFailed(\n address indexed _l1Token,\n address indexed _l2Token,\n address indexed _from,\n address _to,\n uint256 _amount,\n bytes _data\n );\n\n /********************\n * Public Functions *\n ********************/\n\n /**\n * @dev get the address of the corresponding L1 bridge contract.\n * @return Address of the corresponding L1 bridge contract.\n */\n function l1TokenBridge() external returns (address);\n\n /**\n * @dev initiate a withdraw of some tokens to the caller's account on L1\n * @param _l2Token Address of L2 token where withdrawal was initiated.\n * @param _amount Amount of the token to withdraw.\n * param _l1Gas Unused, but included for potential forward compatibility considerations.\n * @param _data Optional data to forward to L1. This data is provided\n * solely as a convenience for external contracts. Aside from enforcing a maximum\n * length, these contracts provide no guarantees about its content.\n */\n function withdraw(\n address _l2Token,\n uint256 _amount,\n uint32 _l1Gas,\n bytes calldata _data\n ) external;\n\n /**\n * @dev initiate a withdraw of some token to a recipient's account on L1.\n * @param _l2Token Address of L2 token where withdrawal is initiated.\n * @param _to L1 adress to credit the withdrawal to.\n * @param _amount Amount of the token to withdraw.\n * param _l1Gas Unused, but included for potential forward compatibility considerations.\n * @param _data Optional data to forward to L1. This data is provided\n * solely as a convenience for external contracts. Aside from enforcing a maximum\n * length, these contracts provide no guarantees about its content.\n */\n function withdrawTo(\n address _l2Token,\n address _to,\n uint256 _amount,\n uint32 _l1Gas,\n bytes calldata _data\n ) external;\n\n /*************************\n * Cross-chain Functions *\n *************************/\n\n /**\n * @dev Complete a deposit from L1 to L2, and credits funds to the recipient's balance of this\n * L2 token. This call will fail if it did not originate from a corresponding deposit in\n * L1StandardTokenBridge.\n * @param _l1Token Address for the l1 token this is called with\n * @param _l2Token Address for the l2 token this is called with\n * @param _from Account to pull the deposit from on L2.\n * @param _to Address to receive the withdrawal at\n * @param _amount Amount of the token to withdraw\n * @param _data Data provider by the sender on L1. This data is provided\n * solely as a convenience for external contracts. Aside from enforcing a maximum\n * length, these contracts provide no guarantees about its content.\n */\n function finalizeDeposit(\n address _l1Token,\n address _l2Token,\n address _from,\n address _to,\n uint256 _amount,\n bytes calldata _data\n ) external;\n}\n" - }, - "@eth-optimism/contracts/libraries/bridge/ICrossDomainMessenger.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma solidity >0.5.0 <0.9.0;\n\n/**\n * @title ICrossDomainMessenger\n */\ninterface ICrossDomainMessenger {\n /**********\n * Events *\n **********/\n\n event SentMessage(\n address indexed target,\n address sender,\n bytes message,\n uint256 messageNonce,\n uint256 gasLimit\n );\n event RelayedMessage(bytes32 indexed msgHash);\n event FailedRelayedMessage(bytes32 indexed msgHash);\n\n /*************\n * Variables *\n *************/\n\n function xDomainMessageSender() external view returns (address);\n\n /********************\n * Public Functions *\n ********************/\n\n /**\n * Sends a cross domain message to the target messenger.\n * @param _target Target contract address.\n * @param _message Message to send to the target.\n * @param _gasLimit Gas limit for the provided message.\n */\n function sendMessage(\n address _target,\n bytes calldata _message,\n uint32 _gasLimit\n ) external;\n}\n" - }, - "contracts/chain-adapters/Optimism_Adapter.sol": { - "content": "// SPDX-License-Identifier: AGPL-3.0-only\r\npragma solidity ^0.8.0;\r\n\r\nimport \"./Base_Adapter.sol\";\r\nimport \"../interfaces/AdapterInterface.sol\";\r\nimport \"../interfaces/WETH9.sol\";\r\n\r\nimport \"@eth-optimism/contracts/libraries/bridge/CrossDomainEnabled.sol\";\r\nimport \"@eth-optimism/contracts/L1/messaging/IL1StandardBridge.sol\";\r\n\r\nimport \"@uma/core/contracts/common/implementation/Lockable.sol\";\r\n\r\nimport \"@openzeppelin/contracts/token/ERC20/IERC20.sol\";\r\n\r\n/**\r\n * @notice Sends cross chain messages Optimism L2 network.\r\n * @dev This contract's owner should be set to the some multisig or admin contract. The Owner can simply set the L2 gas\r\n * and the HubPool. The HubPool is the only contract that can relay tokens and messages over the bridge.\r\n */\r\ncontract Optimism_Adapter is Base_Adapter, CrossDomainEnabled, Lockable {\r\n uint32 public l2GasLimit = 5_000_000;\r\n\r\n WETH9 public l1Weth;\r\n\r\n IL1StandardBridge public l1StandardBridge;\r\n\r\n event L2GasLimitSet(uint32 newGasLimit);\r\n\r\n constructor(\r\n WETH9 _l1Weth,\r\n address _hubPool,\r\n address _crossDomainMessenger,\r\n IL1StandardBridge _l1StandardBridge\r\n ) CrossDomainEnabled(_crossDomainMessenger) Base_Adapter(_hubPool) {\r\n l1Weth = _l1Weth;\r\n l1StandardBridge = _l1StandardBridge;\r\n }\r\n\r\n function setL2GasLimit(uint32 _l2GasLimit) public onlyOwner {\r\n l2GasLimit = _l2GasLimit;\r\n emit L2GasLimitSet(l2GasLimit);\r\n }\r\n\r\n function relayMessage(address target, bytes memory message) external payable override nonReentrant onlyHubPool {\r\n sendCrossDomainMessage(target, uint32(l2GasLimit), message);\r\n emit MessageRelayed(target, message);\r\n }\r\n\r\n function relayTokens(\r\n address l1Token,\r\n address l2Token,\r\n uint256 amount,\r\n address to\r\n ) external payable override nonReentrant onlyHubPool {\r\n // If the l1Token is weth then unwrap it to ETH then send the ETH to the standard bridge.\r\n if (l1Token == address(l1Weth)) {\r\n l1Weth.withdraw(amount);\r\n l1StandardBridge.depositETHTo{ value: amount }(to, l2GasLimit, \"\");\r\n } else {\r\n IERC20(l1Token).approve(address(l1StandardBridge), amount);\r\n l1StandardBridge.depositERC20To(l1Token, l2Token, to, amount, l2GasLimit, \"\");\r\n }\r\n emit TokensRelayed(l1Token, l2Token, amount, to);\r\n }\r\n\r\n // Added to enable the Optimism_Adapter to receive ETH. used when unwrapping WETH.\r\n receive() external payable {}\r\n}\r\n" - }, - "contracts/chain-adapters/Base_Adapter.sol": { - "content": "// SPDX-License-Identifier: AGPL-3.0-only\npragma solidity ^0.8.0;\nimport \"../interfaces/AdapterInterface.sol\";\n\nimport \"@openzeppelin/contracts/access/Ownable.sol\";\n\nabstract contract Base_Adapter is Ownable, AdapterInterface {\n address public hubPool;\n\n modifier onlyHubPool() {\n require(msg.sender == hubPool, \"Can only be called by hubPool\");\n _;\n }\n\n constructor(address _hubPool) {\n hubPool = _hubPool;\n }\n\n function setHubPool(address _hubPool) public onlyOwner {\n hubPool = _hubPool;\n emit HubPoolChanged(_hubPool);\n }\n}\n" - }, - "@eth-optimism/contracts/L1/messaging/IL1StandardBridge.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma solidity >0.5.0 <0.9.0;\n\nimport \"./IL1ERC20Bridge.sol\";\n\n/**\n * @title IL1StandardBridge\n */\ninterface IL1StandardBridge is IL1ERC20Bridge {\n /**********\n * Events *\n **********/\n event ETHDepositInitiated(\n address indexed _from,\n address indexed _to,\n uint256 _amount,\n bytes _data\n );\n\n event ETHWithdrawalFinalized(\n address indexed _from,\n address indexed _to,\n uint256 _amount,\n bytes _data\n );\n\n /********************\n * Public Functions *\n ********************/\n\n /**\n * @dev Deposit an amount of the ETH to the caller's balance on L2.\n * @param _l2Gas Gas limit required to complete the deposit on L2.\n * @param _data Optional data to forward to L2. This data is provided\n * solely as a convenience for external contracts. Aside from enforcing a maximum\n * length, these contracts provide no guarantees about its content.\n */\n function depositETH(uint32 _l2Gas, bytes calldata _data) external payable;\n\n /**\n * @dev Deposit an amount of ETH to a recipient's balance on L2.\n * @param _to L2 address to credit the withdrawal to.\n * @param _l2Gas Gas limit required to complete the deposit on L2.\n * @param _data Optional data to forward to L2. This data is provided\n * solely as a convenience for external contracts. Aside from enforcing a maximum\n * length, these contracts provide no guarantees about its content.\n */\n function depositETHTo(\n address _to,\n uint32 _l2Gas,\n bytes calldata _data\n ) external payable;\n\n /*************************\n * Cross-chain Functions *\n *************************/\n\n /**\n * @dev Complete a withdrawal from L2 to L1, and credit funds to the recipient's balance of the\n * L1 ETH token. Since only the xDomainMessenger can call this function, it will never be called\n * before the withdrawal is finalized.\n * @param _from L2 address initiating the transfer.\n * @param _to L1 address to credit the withdrawal to.\n * @param _amount Amount of the ERC20 to deposit.\n * @param _data Optional data to forward to L2. This data is provided\n * solely as a convenience for external contracts. Aside from enforcing a maximum\n * length, these contracts provide no guarantees about its content.\n */\n function finalizeETHWithdrawal(\n address _from,\n address _to,\n uint256 _amount,\n bytes calldata _data\n ) external;\n}\n" - }, - "@openzeppelin/contracts/access/Ownable.sol": { - "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts v4.4.1 (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 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 called by any account other than the owner.\n */\n modifier onlyOwner() {\n require(owner() == _msgSender(), \"Ownable: caller is not the owner\");\n _;\n }\n\n /**\n * @dev Leaves the contract without owner. It will not be possible to call\n * `onlyOwner` functions anymore. Can only be called by the current owner.\n *\n * NOTE: Renouncing ownership will leave the contract without an owner,\n * thereby removing 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/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" - }, - "@eth-optimism/contracts/L1/messaging/IL1ERC20Bridge.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma solidity >0.5.0 <0.9.0;\n\n/**\n * @title IL1ERC20Bridge\n */\ninterface IL1ERC20Bridge {\n /**********\n * Events *\n **********/\n\n event ERC20DepositInitiated(\n address indexed _l1Token,\n address indexed _l2Token,\n address indexed _from,\n address _to,\n uint256 _amount,\n bytes _data\n );\n\n event ERC20WithdrawalFinalized(\n address indexed _l1Token,\n address indexed _l2Token,\n address indexed _from,\n address _to,\n uint256 _amount,\n bytes _data\n );\n\n /********************\n * Public Functions *\n ********************/\n\n /**\n * @dev get the address of the corresponding L2 bridge contract.\n * @return Address of the corresponding L2 bridge contract.\n */\n function l2TokenBridge() external returns (address);\n\n /**\n * @dev deposit an amount of the ERC20 to the caller's balance on L2.\n * @param _l1Token Address of the L1 ERC20 we are depositing\n * @param _l2Token Address of the L1 respective L2 ERC20\n * @param _amount Amount of the ERC20 to deposit\n * @param _l2Gas Gas limit required to complete the deposit on L2.\n * @param _data Optional data to forward to L2. This data is provided\n * solely as a convenience for external contracts. Aside from enforcing a maximum\n * length, these contracts provide no guarantees about its content.\n */\n function depositERC20(\n address _l1Token,\n address _l2Token,\n uint256 _amount,\n uint32 _l2Gas,\n bytes calldata _data\n ) external;\n\n /**\n * @dev deposit an amount of ERC20 to a recipient's balance on L2.\n * @param _l1Token Address of the L1 ERC20 we are depositing\n * @param _l2Token Address of the L1 respective L2 ERC20\n * @param _to L2 address to credit the withdrawal to.\n * @param _amount Amount of the ERC20 to deposit.\n * @param _l2Gas Gas limit required to complete the deposit on L2.\n * @param _data Optional data to forward to L2. This data is provided\n * solely as a convenience for external contracts. Aside from enforcing a maximum\n * length, these contracts provide no guarantees about its content.\n */\n function depositERC20To(\n address _l1Token,\n address _l2Token,\n address _to,\n uint256 _amount,\n uint32 _l2Gas,\n bytes calldata _data\n ) external;\n\n /*************************\n * Cross-chain Functions *\n *************************/\n\n /**\n * @dev Complete a withdrawal from L2 to L1, and credit funds to the recipient's balance of the\n * L1 ERC20 token.\n * This call will fail if the initialized withdrawal from L2 has not been finalized.\n *\n * @param _l1Token Address of L1 token to finalizeWithdrawal for.\n * @param _l2Token Address of L2 token where withdrawal was initiated.\n * @param _from L2 address initiating the transfer.\n * @param _to L1 address to credit the withdrawal to.\n * @param _amount Amount of the ERC20 to deposit.\n * @param _data Data provided by the sender on L2. This data is provided\n * solely as a convenience for external contracts. Aside from enforcing a maximum\n * length, these contracts provide no guarantees about its content.\n */\n function finalizeERC20Withdrawal(\n address _l1Token,\n address _l2Token,\n address _from,\n address _to,\n uint256 _amount,\n bytes calldata _data\n ) external;\n}\n" - }, - "@openzeppelin/contracts/token/ERC20/extensions/IERC20Metadata.sol": { - "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts v4.4.1 (token/ERC20/extensions/IERC20Metadata.sol)\n\npragma solidity ^0.8.0;\n\nimport \"../IERC20.sol\";\n\n/**\n * @dev Interface for the optional metadata functions from the ERC20 standard.\n *\n * _Available since v4.1._\n */\ninterface IERC20Metadata is IERC20 {\n /**\n * @dev Returns the name of the token.\n */\n function name() external view returns (string memory);\n\n /**\n * @dev Returns the symbol of the token.\n */\n function symbol() external view returns (string memory);\n\n /**\n * @dev Returns the decimals places of the token.\n */\n function decimals() external view returns (uint8);\n}\n" - }, - "@openzeppelin/contracts/token/ERC20/ERC20.sol": { - "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts v4.4.1 (token/ERC20/ERC20.sol)\n\npragma solidity ^0.8.0;\n\nimport \"./IERC20.sol\";\nimport \"./extensions/IERC20Metadata.sol\";\nimport \"../../utils/Context.sol\";\n\n/**\n * @dev Implementation of the {IERC20} interface.\n *\n * This implementation is agnostic to the way tokens are created. This means\n * that a supply mechanism has to be added in a derived contract using {_mint}.\n * For a generic mechanism see {ERC20PresetMinterPauser}.\n *\n * TIP: For a detailed writeup see our guide\n * https://forum.zeppelin.solutions/t/how-to-implement-erc20-supply-mechanisms/226[How\n * to implement supply mechanisms].\n *\n * We have followed general OpenZeppelin Contracts guidelines: functions revert\n * instead returning `false` on failure. This behavior is nonetheless\n * conventional and does not conflict with the expectations of ERC20\n * applications.\n *\n * Additionally, an {Approval} event is emitted on calls to {transferFrom}.\n * This allows applications to reconstruct the allowance for all accounts just\n * by listening to said events. Other implementations of the EIP may not emit\n * these events, as it isn't required by the specification.\n *\n * Finally, the non-standard {decreaseAllowance} and {increaseAllowance}\n * functions have been added to mitigate the well-known issues around setting\n * allowances. See {IERC20-approve}.\n */\ncontract ERC20 is Context, IERC20, IERC20Metadata {\n mapping(address => uint256) private _balances;\n\n mapping(address => mapping(address => uint256)) private _allowances;\n\n uint256 private _totalSupply;\n\n string private _name;\n string private _symbol;\n\n /**\n * @dev Sets the values for {name} and {symbol}.\n *\n * The default value of {decimals} is 18. To select a different value for\n * {decimals} you should overload it.\n *\n * All two of these values are immutable: they can only be set once during\n * construction.\n */\n constructor(string memory name_, string memory symbol_) {\n _name = name_;\n _symbol = symbol_;\n }\n\n /**\n * @dev Returns the name of the token.\n */\n function name() public view virtual override returns (string memory) {\n return _name;\n }\n\n /**\n * @dev Returns the symbol of the token, usually a shorter version of the\n * name.\n */\n function symbol() public view virtual override returns (string memory) {\n return _symbol;\n }\n\n /**\n * @dev Returns the number of decimals used to get its user representation.\n * For example, if `decimals` equals `2`, a balance of `505` tokens should\n * be displayed to a user as `5.05` (`505 / 10 ** 2`).\n *\n * Tokens usually opt for a value of 18, imitating the relationship between\n * Ether and Wei. This is the value {ERC20} uses, unless this function is\n * overridden;\n *\n * NOTE: This information is only used for _display_ purposes: it in\n * no way affects any of the arithmetic of the contract, including\n * {IERC20-balanceOf} and {IERC20-transfer}.\n */\n function decimals() public view virtual override returns (uint8) {\n return 18;\n }\n\n /**\n * @dev See {IERC20-totalSupply}.\n */\n function totalSupply() public view virtual override returns (uint256) {\n return _totalSupply;\n }\n\n /**\n * @dev See {IERC20-balanceOf}.\n */\n function balanceOf(address account) public view virtual override returns (uint256) {\n return _balances[account];\n }\n\n /**\n * @dev See {IERC20-transfer}.\n *\n * Requirements:\n *\n * - `recipient` cannot be the zero address.\n * - the caller must have a balance of at least `amount`.\n */\n function transfer(address recipient, uint256 amount) public virtual override returns (bool) {\n _transfer(_msgSender(), recipient, amount);\n return true;\n }\n\n /**\n * @dev See {IERC20-allowance}.\n */\n function allowance(address owner, address spender) public view virtual override returns (uint256) {\n return _allowances[owner][spender];\n }\n\n /**\n * @dev See {IERC20-approve}.\n *\n * Requirements:\n *\n * - `spender` cannot be the zero address.\n */\n function approve(address spender, uint256 amount) public virtual override returns (bool) {\n _approve(_msgSender(), spender, amount);\n return true;\n }\n\n /**\n * @dev See {IERC20-transferFrom}.\n *\n * Emits an {Approval} event indicating the updated allowance. This is not\n * required by the EIP. See the note at the beginning of {ERC20}.\n *\n * Requirements:\n *\n * - `sender` and `recipient` cannot be the zero address.\n * - `sender` must have a balance of at least `amount`.\n * - the caller must have allowance for ``sender``'s tokens of at least\n * `amount`.\n */\n function transferFrom(\n address sender,\n address recipient,\n uint256 amount\n ) public virtual override returns (bool) {\n _transfer(sender, recipient, amount);\n\n uint256 currentAllowance = _allowances[sender][_msgSender()];\n require(currentAllowance >= amount, \"ERC20: transfer amount exceeds allowance\");\n unchecked {\n _approve(sender, _msgSender(), currentAllowance - amount);\n }\n\n return true;\n }\n\n /**\n * @dev Atomically increases the allowance granted to `spender` by the caller.\n *\n * This is an alternative to {approve} that can be used as a mitigation for\n * problems described in {IERC20-approve}.\n *\n * Emits an {Approval} event indicating the updated allowance.\n *\n * Requirements:\n *\n * - `spender` cannot be the zero address.\n */\n function increaseAllowance(address spender, uint256 addedValue) public virtual returns (bool) {\n _approve(_msgSender(), spender, _allowances[_msgSender()][spender] + addedValue);\n return true;\n }\n\n /**\n * @dev Atomically decreases the allowance granted to `spender` by the caller.\n *\n * This is an alternative to {approve} that can be used as a mitigation for\n * problems described in {IERC20-approve}.\n *\n * Emits an {Approval} event indicating the updated allowance.\n *\n * Requirements:\n *\n * - `spender` cannot be the zero address.\n * - `spender` must have allowance for the caller of at least\n * `subtractedValue`.\n */\n function decreaseAllowance(address spender, uint256 subtractedValue) public virtual returns (bool) {\n uint256 currentAllowance = _allowances[_msgSender()][spender];\n require(currentAllowance >= subtractedValue, \"ERC20: decreased allowance below zero\");\n unchecked {\n _approve(_msgSender(), spender, currentAllowance - subtractedValue);\n }\n\n return true;\n }\n\n /**\n * @dev Moves `amount` of tokens from `sender` to `recipient`.\n *\n * This internal function is equivalent to {transfer}, and can be used to\n * e.g. implement automatic token fees, slashing mechanisms, etc.\n *\n * Emits a {Transfer} event.\n *\n * Requirements:\n *\n * - `sender` cannot be the zero address.\n * - `recipient` cannot be the zero address.\n * - `sender` must have a balance of at least `amount`.\n */\n function _transfer(\n address sender,\n address recipient,\n uint256 amount\n ) internal virtual {\n require(sender != address(0), \"ERC20: transfer from the zero address\");\n require(recipient != address(0), \"ERC20: transfer to the zero address\");\n\n _beforeTokenTransfer(sender, recipient, amount);\n\n uint256 senderBalance = _balances[sender];\n require(senderBalance >= amount, \"ERC20: transfer amount exceeds balance\");\n unchecked {\n _balances[sender] = senderBalance - amount;\n }\n _balances[recipient] += amount;\n\n emit Transfer(sender, recipient, amount);\n\n _afterTokenTransfer(sender, recipient, amount);\n }\n\n /** @dev Creates `amount` tokens and assigns them to `account`, increasing\n * the total supply.\n *\n * Emits a {Transfer} event with `from` set to the zero address.\n *\n * Requirements:\n *\n * - `account` cannot be the zero address.\n */\n function _mint(address account, uint256 amount) internal virtual {\n require(account != address(0), \"ERC20: mint to the zero address\");\n\n _beforeTokenTransfer(address(0), account, amount);\n\n _totalSupply += amount;\n _balances[account] += amount;\n emit Transfer(address(0), account, amount);\n\n _afterTokenTransfer(address(0), account, amount);\n }\n\n /**\n * @dev Destroys `amount` tokens from `account`, reducing the\n * total supply.\n *\n * Emits a {Transfer} event with `to` set to the zero address.\n *\n * Requirements:\n *\n * - `account` cannot be the zero address.\n * - `account` must have at least `amount` tokens.\n */\n function _burn(address account, uint256 amount) internal virtual {\n require(account != address(0), \"ERC20: burn from the zero address\");\n\n _beforeTokenTransfer(account, address(0), amount);\n\n uint256 accountBalance = _balances[account];\n require(accountBalance >= amount, \"ERC20: burn amount exceeds balance\");\n unchecked {\n _balances[account] = accountBalance - amount;\n }\n _totalSupply -= amount;\n\n emit Transfer(account, address(0), amount);\n\n _afterTokenTransfer(account, address(0), amount);\n }\n\n /**\n * @dev Sets `amount` as the allowance of `spender` over the `owner` s tokens.\n *\n * This internal function is equivalent to `approve`, and can be used to\n * e.g. set automatic allowances for certain subsystems, etc.\n *\n * Emits an {Approval} event.\n *\n * Requirements:\n *\n * - `owner` cannot be the zero address.\n * - `spender` cannot be the zero address.\n */\n function _approve(\n address owner,\n address spender,\n uint256 amount\n ) internal virtual {\n require(owner != address(0), \"ERC20: approve from the zero address\");\n require(spender != address(0), \"ERC20: approve to the zero address\");\n\n _allowances[owner][spender] = amount;\n emit Approval(owner, spender, amount);\n }\n\n /**\n * @dev Hook that is called before any transfer of tokens. This includes\n * minting and burning.\n *\n * Calling conditions:\n *\n * - when `from` and `to` are both non-zero, `amount` of ``from``'s tokens\n * will be transferred to `to`.\n * - when `from` is zero, `amount` tokens will be minted for `to`.\n * - when `to` is zero, `amount` of ``from``'s tokens will be burned.\n * - `from` and `to` are never both zero.\n *\n * To learn more about hooks, head to xref:ROOT:extending-contracts.adoc#using-hooks[Using Hooks].\n */\n function _beforeTokenTransfer(\n address from,\n address to,\n uint256 amount\n ) internal virtual {}\n\n /**\n * @dev Hook that is called after any transfer of tokens. This includes\n * minting and burning.\n *\n * Calling conditions:\n *\n * - when `from` and `to` are both non-zero, `amount` of ``from``'s tokens\n * has been transferred to `to`.\n * - when `from` is zero, `amount` tokens have been minted for `to`.\n * - when `to` is zero, `amount` of ``from``'s tokens have been burned.\n * - `from` and `to` are never both zero.\n *\n * To learn more about hooks, head to xref:ROOT:extending-contracts.adoc#using-hooks[Using Hooks].\n */\n function _afterTokenTransfer(\n address from,\n address to,\n uint256 amount\n ) internal virtual {}\n}\n" - }, - "contracts/chain-adapters/L1_Adapter.sol": { - "content": "// SPDX-License-Identifier: AGPL-3.0-only\r\npragma solidity ^0.8.0;\r\n\r\nimport \"./Base_Adapter.sol\";\r\nimport \"../interfaces/AdapterInterface.sol\";\r\nimport \"../interfaces/WETH9.sol\";\r\n\r\nimport \"@uma/core/contracts/common/implementation/Lockable.sol\";\r\n\r\nimport \"@openzeppelin/contracts/token/ERC20/IERC20.sol\";\r\nimport \"@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol\";\r\n\r\ncontract L1_Adapter is Base_Adapter, Lockable {\r\n using SafeERC20 for IERC20;\r\n\r\n constructor(address _hubPool) Base_Adapter(_hubPool) {}\r\n\r\n function relayMessage(address target, bytes memory message) external payable override nonReentrant onlyHubPool {\r\n _executeCall(target, message);\r\n emit MessageRelayed(target, message);\r\n }\r\n\r\n function relayTokens(\r\n address l1Token,\r\n address l2Token, // l2Token is unused for L1.\r\n uint256 amount,\r\n address to\r\n ) external payable override nonReentrant onlyHubPool {\r\n IERC20(l1Token).safeTransfer(to, amount);\r\n emit TokensRelayed(l1Token, l2Token, amount, to);\r\n }\r\n\r\n // Note: this snippet of code is copied from Governor.sol.\r\n function _executeCall(address to, bytes memory data) private {\r\n // Note: this snippet of code is copied from Governor.sol and modified to not include any \"value\" field.\r\n // solhint-disable-next-line no-inline-assembly\r\n\r\n bool success;\r\n assembly {\r\n let inputData := add(data, 0x20)\r\n let inputDataSize := mload(data)\r\n // Hardcode value to be 0 for relayed governance calls in order to avoid addressing complexity of bridging\r\n // value cross-chain.\r\n success := call(gas(), to, 0, inputData, inputDataSize, 0, 0)\r\n }\r\n require(success, \"execute call failed\");\r\n }\r\n\r\n receive() external payable {}\r\n}\r\n" - }, - "contracts/chain-adapters/Arbitrum_Adapter.sol": { - "content": "// SPDX-License-Identifier: AGPL-3.0-only\r\npragma solidity ^0.8.0;\r\n\r\nimport \"./Base_Adapter.sol\";\r\nimport \"../interfaces/AdapterInterface.sol\";\r\nimport \"../interfaces/WETH9.sol\";\r\n\r\nimport \"@uma/core/contracts/common/implementation/Lockable.sol\";\r\n\r\nimport \"@openzeppelin/contracts/token/ERC20/IERC20.sol\";\r\n\r\ninterface ArbitrumL1InboxLike {\r\n function createRetryableTicket(\r\n address destAddr,\r\n uint256 arbTxCallValue,\r\n uint256 maxSubmissionCost,\r\n address submissionRefundAddress,\r\n address valueRefundAddress,\r\n uint256 maxGas,\r\n uint256 gasPriceBid,\r\n bytes calldata data\r\n ) external payable returns (uint256);\r\n}\r\n\r\ninterface ArbitrumL1ERC20GatewayLike {\r\n function outboundTransfer(\r\n address _token,\r\n address _to,\r\n uint256 _amount,\r\n uint256 _maxGas,\r\n uint256 _gasPriceBid,\r\n bytes calldata _data\r\n ) external payable returns (bytes memory);\r\n}\r\n\r\ncontract Arbitrum_Adapter is Base_Adapter, Lockable {\r\n // Gas limit for immediate L2 execution attempt (can be estimated via NodeInterface.estimateRetryableTicket).\r\n // NodeInterface precompile interface exists at L2 address 0x00000000000000000000000000000000000000C8\r\n uint32 public l2GasLimit = 5_000_000;\r\n\r\n // Amount of ETH allocated to pay for the base submission fee. The base submission fee is a parameter unique to\r\n // retryable transactions; the user is charged the base submission fee to cover the storage costs of keeping their\r\n // ticket’s calldata in the retry buffer. (current base submission fee is queryable via\r\n // ArbRetryableTx.getSubmissionPrice). ArbRetryableTicket precompile interface exists at L2 address\r\n // 0x000000000000000000000000000000000000006E.\r\n uint256 public l2MaxSubmissionCost = 0.1e18;\r\n\r\n // L2 Gas price bid for immediate L2 execution attempt (queryable via standard eth*gasPrice RPC)\r\n uint256 public l2GasPrice = 10e9; // 10 gWei\r\n\r\n // This address on L2 receives extra ETH that is left over after relaying a message via the inbox.\r\n address public l2RefundL2Address;\r\n\r\n ArbitrumL1InboxLike public l1Inbox;\r\n\r\n ArbitrumL1ERC20GatewayLike public l1ERC20Gateway;\r\n\r\n event L2GasLimitSet(uint32 newL2GasLimit);\r\n\r\n event L2MaxSubmissionCostSet(uint256 newL2MaxSubmissionCost);\r\n\r\n event L2GasPriceSet(uint256 newL2GasPrice);\r\n\r\n event L2RefundL2AddressSet(address newL2RefundL2Address);\r\n\r\n constructor(\r\n address _hubPool,\r\n ArbitrumL1InboxLike _l1ArbitrumInbox,\r\n ArbitrumL1ERC20GatewayLike _l1ERC20Gateway\r\n ) Base_Adapter(_hubPool) {\r\n l1Inbox = _l1ArbitrumInbox;\r\n l1ERC20Gateway = _l1ERC20Gateway;\r\n\r\n l2RefundL2Address = owner();\r\n }\r\n\r\n function setL2GasLimit(uint32 _l2GasLimit) public onlyOwner {\r\n l2GasLimit = _l2GasLimit;\r\n emit L2GasLimitSet(l2GasLimit);\r\n }\r\n\r\n function setL2MaxSubmissionCost(uint256 _l2MaxSubmissionCost) public onlyOwner {\r\n l2MaxSubmissionCost = _l2MaxSubmissionCost;\r\n emit L2MaxSubmissionCostSet(l2MaxSubmissionCost);\r\n }\r\n\r\n function setL2GasPrice(uint256 _l2GasPrice) public onlyOwner {\r\n l2GasPrice = _l2GasPrice;\r\n emit L2GasPriceSet(l2GasPrice);\r\n }\r\n\r\n function setL2RefundL2Address(address _l2RefundL2Address) public onlyOwner {\r\n l2RefundL2Address = _l2RefundL2Address;\r\n emit L2RefundL2AddressSet(l2RefundL2Address);\r\n }\r\n\r\n function relayMessage(address target, bytes memory message) external payable override nonReentrant onlyHubPool {\r\n uint256 requiredL1CallValue = getL1CallValue();\r\n require(address(this).balance >= requiredL1CallValue, \"Insufficient ETH balance\");\r\n\r\n l1Inbox.createRetryableTicket{ value: requiredL1CallValue }(\r\n target, // destAddr destination L2 contract address\r\n 0, // l2CallValue call value for retryable L2 message\r\n l2MaxSubmissionCost, // maxSubmissionCost Max gas deducted from user's L2 balance to cover base submission fee\r\n l2RefundL2Address, // excessFeeRefundAddress maxgas x gasprice - execution cost gets credited here on L2 balance\r\n l2RefundL2Address, // callValueRefundAddress l2Callvalue gets credited here on L2 if retryable txn times out or gets cancelled\r\n l2GasLimit, // maxGas Max gas deducted from user's L2 balance to cover L2 execution\r\n l2GasPrice, // gasPriceBid price bid for L2 execution\r\n message // data ABI encoded data of L2 message\r\n );\r\n\r\n emit MessageRelayed(target, message);\r\n }\r\n\r\n function relayTokens(\r\n address l1Token,\r\n address l2Token, // l2Token is unused for Arbitrum.\r\n uint256 amount,\r\n address to\r\n ) external payable override nonReentrant onlyHubPool {\r\n l1ERC20Gateway.outboundTransfer(l1Token, to, amount, l2GasLimit, l2GasPrice, \"\");\r\n emit TokensRelayed(l1Token, l2Token, amount, to);\r\n }\r\n\r\n function getL1CallValue() public view returns (uint256) {\r\n return l2MaxSubmissionCost + l2GasPrice * l2GasLimit;\r\n }\r\n\r\n receive() external payable {}\r\n}\r\n" - }, - "contracts/Ethereum_SpokePool.sol": { - "content": "//SPDX-License-Identifier: Unlicense\r\npragma solidity ^0.8.0;\r\n\r\nimport \"./interfaces/WETH9.sol\";\r\n\r\nimport \"@openzeppelin/contracts/access/Ownable.sol\";\r\nimport \"@openzeppelin/contracts/token/ERC20/IERC20.sol\";\r\n\r\nimport \"./SpokePool.sol\";\r\nimport \"./SpokePoolInterface.sol\";\r\n\r\n/**\r\n * @notice Ethereum L1 specific SpokePool.\r\n * @dev Used on Ethereum L1 to facilitate L2->L1 transfers.\r\n */\r\n\r\ncontract Ethereum_SpokePool is SpokePoolInterface, SpokePool, Ownable {\r\n constructor(\r\n address _l1EthWrapper,\r\n address _l2Eth,\r\n address _crossDomainAdmin,\r\n address _hubPool,\r\n address _wethAddress,\r\n address timerAddress\r\n ) SpokePool(_crossDomainAdmin, _hubPool, _wethAddress, timerAddress) {}\r\n\r\n /**************************************\r\n * ADMIN FUNCTIONS *\r\n **************************************/\r\n\r\n function setCrossDomainAdmin(address newCrossDomainAdmin) public override onlyOwner nonReentrant {\r\n _setCrossDomainAdmin(newCrossDomainAdmin);\r\n }\r\n\r\n function setHubPool(address newHubPool) public override onlyOwner nonReentrant {\r\n _setHubPool(newHubPool);\r\n }\r\n\r\n function setEnableRoute(\r\n address originToken,\r\n uint256 destinationChainId,\r\n bool enable\r\n ) public override onlyOwner nonReentrant {\r\n _setEnableRoute(originToken, destinationChainId, enable);\r\n }\r\n\r\n function setDepositQuoteTimeBuffer(uint32 buffer) public override onlyOwner nonReentrant {\r\n _setDepositQuoteTimeBuffer(buffer);\r\n }\r\n\r\n function relayRootBundle(bytes32 relayerRefundRoot, bytes32 slowRelayFulfillmentRoot)\r\n public\r\n override\r\n onlyOwner\r\n nonReentrant\r\n {\r\n _relayRootBundle(relayerRefundRoot, slowRelayFulfillmentRoot);\r\n }\r\n\r\n function _bridgeTokensToHubPool(RelayerRefundLeaf memory relayerRefundLeaf) internal override {\r\n IERC20(relayerRefundLeaf.l2TokenAddress).transfer(hubPool, relayerRefundLeaf.amountToReturn);\r\n }\r\n}\r\n" - }, - "contracts/chain-adapters/Mock_Adapter.sol": { - "content": "// SPDX-License-Identifier: AGPL-3.0-only\npragma solidity ^0.8.0;\n\nimport \"./Base_Adapter.sol\";\nimport \"@openzeppelin/contracts/token/ERC20/IERC20.sol\";\n\n/**\n * @notice Sends cross chain messages Optimism L2 network.\n * @dev This contract's owner should be set to the BridgeAdmin deployed on the same L1 network so that only the\n * BridgeAdmin can call cross-chain administrative functions on the L2 SpokePool via this messenger.\n */\ncontract Mock_Adapter is Base_Adapter {\n event RelayMessageCalled(address target, bytes message, address caller);\n\n event RelayTokensCalled(address l1Token, address l2Token, uint256 amount, address to, address caller);\n\n function relayMessage(address target, bytes memory message) external payable override onlyHubPool {\n emit RelayMessageCalled(target, message, msg.sender);\n }\n\n constructor(address _hubPool) Base_Adapter(_hubPool) {}\n\n function relayTokens(\n address l1Token,\n address l2Token,\n uint256 amount,\n address to\n ) external payable override onlyHubPool {\n emit RelayTokensCalled(l1Token, l2Token, amount, to, msg.sender);\n }\n}\n" - }, - "contracts/test/MerkleLibTest.sol": { - "content": "// SPDX-License-Identifier: GPL-3.0-only\r\npragma solidity ^0.8.0;\r\n\r\nimport \"../MerkleLib.sol\";\r\nimport \"../HubPoolInterface.sol\";\r\nimport \"../SpokePoolInterface.sol\";\r\n\r\n/**\r\n * @notice Contract to test the MerkleLib.\r\n */\r\ncontract MerkleLibTest {\r\n mapping(uint256 => uint256) public claimedBitMap;\r\n\r\n uint256 public claimedBitMap1D;\r\n\r\n function verifyPoolRebalance(\r\n bytes32 root,\r\n HubPoolInterface.PoolRebalanceLeaf memory rebalance,\r\n bytes32[] memory proof\r\n ) public pure returns (bool) {\r\n return MerkleLib.verifyPoolRebalance(root, rebalance, proof);\r\n }\r\n\r\n function verifyRelayerRefund(\r\n bytes32 root,\r\n SpokePoolInterface.RelayerRefundLeaf memory refund,\r\n bytes32[] memory proof\r\n ) public pure returns (bool) {\r\n return MerkleLib.verifyRelayerRefund(root, refund, proof);\r\n }\r\n\r\n function verifySlowRelayFulfillment(\r\n bytes32 root,\r\n SpokePoolInterface.RelayData memory slowRelayFulfillment,\r\n bytes32[] memory proof\r\n ) public pure returns (bool) {\r\n return MerkleLib.verifySlowRelayFulfillment(root, slowRelayFulfillment, proof);\r\n }\r\n\r\n function isClaimed(uint256 index) public view returns (bool) {\r\n return MerkleLib.isClaimed(claimedBitMap, index);\r\n }\r\n\r\n function setClaimed(uint256 index) public {\r\n MerkleLib.setClaimed(claimedBitMap, index);\r\n }\r\n\r\n function isClaimed1D(uint256 index) public view returns (bool) {\r\n return MerkleLib.isClaimed1D(claimedBitMap1D, index);\r\n }\r\n\r\n function setClaimed1D(uint256 index) public {\r\n claimedBitMap1D = MerkleLib.setClaimed1D(claimedBitMap1D, index);\r\n }\r\n}\r\n" - }, - "@uma/core/contracts/common/interfaces/ExpandedIERC20.sol": { - "content": "// SPDX-License-Identifier: AGPL-3.0-only\npragma solidity ^0.8.0;\n\nimport \"@openzeppelin/contracts/token/ERC20/IERC20.sol\";\n\n/**\n * @title ERC20 interface that includes burn and mint methods.\n */\nabstract contract ExpandedIERC20 is IERC20 {\n /**\n * @notice Burns a specific amount of the caller's tokens.\n * @dev Only burns the caller's tokens, so it is safe to leave this method permissionless.\n */\n function burn(uint256 value) external virtual;\n\n /**\n * @dev Burns `value` tokens owned by `recipient`.\n * @param recipient address to burn tokens from.\n * @param value amount of tokens to burn.\n */\n function burnFrom(address recipient, uint256 value) external virtual returns (bool);\n\n /**\n * @notice Mints tokens and adds them to the balance of the `to` address.\n * @dev This method should be permissioned to only allow designated parties to mint tokens.\n */\n function mint(address to, uint256 value) external virtual returns (bool);\n\n function addMinter(address account) external virtual;\n\n function addBurner(address account) external virtual;\n\n function resetOwner(address account) external virtual;\n}\n" - }, - "@uma/core/contracts/common/implementation/ExpandedERC20.sol": { - "content": "// SPDX-License-Identifier: AGPL-3.0-only\npragma solidity ^0.8.0;\n\nimport \"@openzeppelin/contracts/token/ERC20/ERC20.sol\";\nimport \"./MultiRole.sol\";\nimport \"../interfaces/ExpandedIERC20.sol\";\n\n/**\n * @title An ERC20 with permissioned burning and minting. The contract deployer will initially\n * be the owner who is capable of adding new roles.\n */\ncontract ExpandedERC20 is ExpandedIERC20, ERC20, MultiRole {\n enum Roles {\n // Can set the minter and burner.\n Owner,\n // Addresses that can mint new tokens.\n Minter,\n // Addresses that can burn tokens that address owns.\n Burner\n }\n\n uint8 _decimals;\n\n /**\n * @notice Constructs the ExpandedERC20.\n * @param _tokenName The name which describes the new token.\n * @param _tokenSymbol The ticker abbreviation of the name. Ideally < 5 chars.\n * @param _tokenDecimals The number of decimals to define token precision.\n */\n constructor(\n string memory _tokenName,\n string memory _tokenSymbol,\n uint8 _tokenDecimals\n ) ERC20(_tokenName, _tokenSymbol) {\n _decimals = _tokenDecimals;\n _createExclusiveRole(uint256(Roles.Owner), uint256(Roles.Owner), msg.sender);\n _createSharedRole(uint256(Roles.Minter), uint256(Roles.Owner), new address[](0));\n _createSharedRole(uint256(Roles.Burner), uint256(Roles.Owner), new address[](0));\n }\n\n function decimals() public view virtual override(ERC20) returns (uint8) {\n return _decimals;\n }\n\n /**\n * @dev Mints `value` tokens to `recipient`, returning true on success.\n * @param recipient address to mint to.\n * @param value amount of tokens to mint.\n * @return True if the mint succeeded, or False.\n */\n function mint(address recipient, uint256 value)\n external\n override\n onlyRoleHolder(uint256(Roles.Minter))\n returns (bool)\n {\n _mint(recipient, value);\n return true;\n }\n\n /**\n * @dev Burns `value` tokens owned by `msg.sender`.\n * @param value amount of tokens to burn.\n */\n function burn(uint256 value) external override onlyRoleHolder(uint256(Roles.Burner)) {\n _burn(msg.sender, value);\n }\n\n /**\n * @dev Burns `value` tokens owned by `recipient`.\n * @param recipient address to burn tokens from.\n * @param value amount of tokens to burn.\n * @return True if the burn succeeded, or False.\n */\n function burnFrom(address recipient, uint256 value)\n external\n override\n onlyRoleHolder(uint256(Roles.Burner))\n returns (bool)\n {\n _burn(recipient, value);\n return true;\n }\n\n /**\n * @notice Add Minter role to account.\n * @dev The caller must have the Owner role.\n * @param account The address to which the Minter role is added.\n */\n function addMinter(address account) external virtual override {\n addMember(uint256(Roles.Minter), account);\n }\n\n /**\n * @notice Add Burner role to account.\n * @dev The caller must have the Owner role.\n * @param account The address to which the Burner role is added.\n */\n function addBurner(address account) external virtual override {\n addMember(uint256(Roles.Burner), account);\n }\n\n /**\n * @notice Reset Owner role to account.\n * @dev The caller must have the Owner role.\n * @param account The new holder of the Owner role.\n */\n function resetOwner(address account) external virtual override {\n resetMember(uint256(Roles.Owner), account);\n }\n}\n" - }, - "@uma/core/contracts/common/implementation/MultiRole.sol": { - "content": "// SPDX-License-Identifier: AGPL-3.0-only\npragma solidity ^0.8.0;\n\nlibrary Exclusive {\n struct RoleMembership {\n address member;\n }\n\n function isMember(RoleMembership storage roleMembership, address memberToCheck) internal view returns (bool) {\n return roleMembership.member == memberToCheck;\n }\n\n function resetMember(RoleMembership storage roleMembership, address newMember) internal {\n require(newMember != address(0x0), \"Cannot set an exclusive role to 0x0\");\n roleMembership.member = newMember;\n }\n\n function getMember(RoleMembership storage roleMembership) internal view returns (address) {\n return roleMembership.member;\n }\n\n function init(RoleMembership storage roleMembership, address initialMember) internal {\n resetMember(roleMembership, initialMember);\n }\n}\n\nlibrary Shared {\n struct RoleMembership {\n mapping(address => bool) members;\n }\n\n function isMember(RoleMembership storage roleMembership, address memberToCheck) internal view returns (bool) {\n return roleMembership.members[memberToCheck];\n }\n\n function addMember(RoleMembership storage roleMembership, address memberToAdd) internal {\n require(memberToAdd != address(0x0), \"Cannot add 0x0 to a shared role\");\n roleMembership.members[memberToAdd] = true;\n }\n\n function removeMember(RoleMembership storage roleMembership, address memberToRemove) internal {\n roleMembership.members[memberToRemove] = false;\n }\n\n function init(RoleMembership storage roleMembership, address[] memory initialMembers) internal {\n for (uint256 i = 0; i < initialMembers.length; i++) {\n addMember(roleMembership, initialMembers[i]);\n }\n }\n}\n\n/**\n * @title Base class to manage permissions for the derived class.\n */\nabstract contract MultiRole {\n using Exclusive for Exclusive.RoleMembership;\n using Shared for Shared.RoleMembership;\n\n enum RoleType { Invalid, Exclusive, Shared }\n\n struct Role {\n uint256 managingRole;\n RoleType roleType;\n Exclusive.RoleMembership exclusiveRoleMembership;\n Shared.RoleMembership sharedRoleMembership;\n }\n\n mapping(uint256 => Role) private roles;\n\n event ResetExclusiveMember(uint256 indexed roleId, address indexed newMember, address indexed manager);\n event AddedSharedMember(uint256 indexed roleId, address indexed newMember, address indexed manager);\n event RemovedSharedMember(uint256 indexed roleId, address indexed oldMember, address indexed manager);\n\n /**\n * @notice Reverts unless the caller is a member of the specified roleId.\n */\n modifier onlyRoleHolder(uint256 roleId) {\n require(holdsRole(roleId, msg.sender), \"Sender does not hold required role\");\n _;\n }\n\n /**\n * @notice Reverts unless the caller is a member of the manager role for the specified roleId.\n */\n modifier onlyRoleManager(uint256 roleId) {\n require(holdsRole(roles[roleId].managingRole, msg.sender), \"Can only be called by a role manager\");\n _;\n }\n\n /**\n * @notice Reverts unless the roleId represents an initialized, exclusive roleId.\n */\n modifier onlyExclusive(uint256 roleId) {\n require(roles[roleId].roleType == RoleType.Exclusive, \"Must be called on an initialized Exclusive role\");\n _;\n }\n\n /**\n * @notice Reverts unless the roleId represents an initialized, shared roleId.\n */\n modifier onlyShared(uint256 roleId) {\n require(roles[roleId].roleType == RoleType.Shared, \"Must be called on an initialized Shared role\");\n _;\n }\n\n /**\n * @notice Whether `memberToCheck` is a member of roleId.\n * @dev Reverts if roleId does not correspond to an initialized role.\n * @param roleId the Role to check.\n * @param memberToCheck the address to check.\n * @return True if `memberToCheck` is a member of `roleId`.\n */\n function holdsRole(uint256 roleId, address memberToCheck) public view returns (bool) {\n Role storage role = roles[roleId];\n if (role.roleType == RoleType.Exclusive) {\n return role.exclusiveRoleMembership.isMember(memberToCheck);\n } else if (role.roleType == RoleType.Shared) {\n return role.sharedRoleMembership.isMember(memberToCheck);\n }\n revert(\"Invalid roleId\");\n }\n\n /**\n * @notice Changes the exclusive role holder of `roleId` to `newMember`.\n * @dev Reverts if the caller is not a member of the managing role for `roleId` or if `roleId` is not an\n * initialized, ExclusiveRole.\n * @param roleId the ExclusiveRole membership to modify.\n * @param newMember the new ExclusiveRole member.\n */\n function resetMember(uint256 roleId, address newMember) public onlyExclusive(roleId) onlyRoleManager(roleId) {\n roles[roleId].exclusiveRoleMembership.resetMember(newMember);\n emit ResetExclusiveMember(roleId, newMember, msg.sender);\n }\n\n /**\n * @notice Gets the current holder of the exclusive role, `roleId`.\n * @dev Reverts if `roleId` does not represent an initialized, exclusive role.\n * @param roleId the ExclusiveRole membership to check.\n * @return the address of the current ExclusiveRole member.\n */\n function getMember(uint256 roleId) public view onlyExclusive(roleId) returns (address) {\n return roles[roleId].exclusiveRoleMembership.getMember();\n }\n\n /**\n * @notice Adds `newMember` to the shared role, `roleId`.\n * @dev Reverts if `roleId` does not represent an initialized, SharedRole or if the caller is not a member of the\n * managing role for `roleId`.\n * @param roleId the SharedRole membership to modify.\n * @param newMember the new SharedRole member.\n */\n function addMember(uint256 roleId, address newMember) public onlyShared(roleId) onlyRoleManager(roleId) {\n roles[roleId].sharedRoleMembership.addMember(newMember);\n emit AddedSharedMember(roleId, newMember, msg.sender);\n }\n\n /**\n * @notice Removes `memberToRemove` from the shared role, `roleId`.\n * @dev Reverts if `roleId` does not represent an initialized, SharedRole or if the caller is not a member of the\n * managing role for `roleId`.\n * @param roleId the SharedRole membership to modify.\n * @param memberToRemove the current SharedRole member to remove.\n */\n function removeMember(uint256 roleId, address memberToRemove) public onlyShared(roleId) onlyRoleManager(roleId) {\n roles[roleId].sharedRoleMembership.removeMember(memberToRemove);\n emit RemovedSharedMember(roleId, memberToRemove, msg.sender);\n }\n\n /**\n * @notice Removes caller from the role, `roleId`.\n * @dev Reverts if the caller is not a member of the role for `roleId` or if `roleId` is not an\n * initialized, SharedRole.\n * @param roleId the SharedRole membership to modify.\n */\n function renounceMembership(uint256 roleId) public onlyShared(roleId) onlyRoleHolder(roleId) {\n roles[roleId].sharedRoleMembership.removeMember(msg.sender);\n emit RemovedSharedMember(roleId, msg.sender, msg.sender);\n }\n\n /**\n * @notice Reverts if `roleId` is not initialized.\n */\n modifier onlyValidRole(uint256 roleId) {\n require(roles[roleId].roleType != RoleType.Invalid, \"Attempted to use an invalid roleId\");\n _;\n }\n\n /**\n * @notice Reverts if `roleId` is initialized.\n */\n modifier onlyInvalidRole(uint256 roleId) {\n require(roles[roleId].roleType == RoleType.Invalid, \"Cannot use a pre-existing role\");\n _;\n }\n\n /**\n * @notice Internal method to initialize a shared role, `roleId`, which will be managed by `managingRoleId`.\n * `initialMembers` will be immediately added to the role.\n * @dev Should be called by derived contracts, usually at construction time. Will revert if the role is already\n * initialized.\n */\n function _createSharedRole(\n uint256 roleId,\n uint256 managingRoleId,\n address[] memory initialMembers\n ) internal onlyInvalidRole(roleId) {\n Role storage role = roles[roleId];\n role.roleType = RoleType.Shared;\n role.managingRole = managingRoleId;\n role.sharedRoleMembership.init(initialMembers);\n require(\n roles[managingRoleId].roleType != RoleType.Invalid,\n \"Attempted to use an invalid role to manage a shared role\"\n );\n }\n\n /**\n * @notice Internal method to initialize an exclusive role, `roleId`, which will be managed by `managingRoleId`.\n * `initialMember` will be immediately added to the role.\n * @dev Should be called by derived contracts, usually at construction time. Will revert if the role is already\n * initialized.\n */\n function _createExclusiveRole(\n uint256 roleId,\n uint256 managingRoleId,\n address initialMember\n ) internal onlyInvalidRole(roleId) {\n Role storage role = roles[roleId];\n role.roleType = RoleType.Exclusive;\n role.managingRole = managingRoleId;\n role.exclusiveRoleMembership.init(initialMember);\n require(\n roles[managingRoleId].roleType != RoleType.Invalid,\n \"Attempted to use an invalid role to manage an exclusive role\"\n );\n }\n}\n" - }, - "contracts/LpTokenFactory.sol": { - "content": "// SPDX-License-Identifier: GPL-3.0-only\npragma solidity ^0.8.0;\n\nimport \"./interfaces/LpTokenFactoryInterface.sol\";\n\nimport \"@uma/core/contracts/common/implementation/ExpandedERC20.sol\";\n\ncontract LpTokenFactory is LpTokenFactoryInterface {\n function createLpToken(address l1Token) public returns (address) {\n ExpandedERC20 lpToken = new ExpandedERC20(\n _append(\"Across \", IERC20Metadata(l1Token).name(), \" LP Token\"), // LP Token Name\n _append(\"Av2-\", IERC20Metadata(l1Token).symbol(), \"-LP\"), // LP Token Symbol\n IERC20Metadata(l1Token).decimals() // LP Token Decimals\n );\n lpToken.addMember(1, msg.sender); // Set this contract as the LP Token's minter.\n lpToken.addMember(2, msg.sender); // Set this contract as the LP Token's burner.\n\n return address(lpToken);\n }\n\n function _append(\n string memory a,\n string memory b,\n string memory c\n ) internal pure returns (string memory) {\n return string(abi.encodePacked(a, b, c));\n }\n}\n" - }, - "contracts/interfaces/LpTokenFactoryInterface.sol": { - "content": "// SPDX-License-Identifier: AGPL-3.0-only\npragma solidity ^0.8.0;\n\nimport \"@openzeppelin/contracts/token/ERC20/IERC20.sol\";\n\ninterface LpTokenFactoryInterface {\n function createLpToken(address l1Token) external returns (address);\n}\n" - }, - "@uma/core/contracts/oracle/interfaces/SkinnyOptimisticOracleInterface.sol": { - "content": "// SPDX-License-Identifier: AGPL-3.0-only\npragma solidity ^0.8.0;\n\nimport \"@openzeppelin/contracts/token/ERC20/IERC20.sol\";\nimport \"../interfaces/OptimisticOracleInterface.sol\";\n\n/**\n * @title Interface for the gas-cost-reduced version of the OptimisticOracle.\n * @notice Differences from normal OptimisticOracle:\n * - refundOnDispute: flag is removed, by default there are no refunds on disputes.\n * - customizing request parameters: In the OptimisticOracle, parameters like `bond` and `customLiveness` can be reset\n * after a request is already made via `requestPrice`. In the SkinnyOptimisticOracle, these parameters can only be\n * set in `requestPrice`, which has an expanded input set.\n * - settleAndGetPrice: Replaced by `settle`, which can only be called once per settleable request. The resolved price\n * can be fetched via the `Settle` event or the return value of `settle`.\n * - general changes to interface: Functions that interact with existing requests all require the parameters of the\n * request to modify to be passed as input. These parameters must match with the existing request parameters or the\n * function will revert. This change reflects the internal refactor to store hashed request parameters instead of the\n * full request struct.\n * @dev Interface used by financial contracts to interact with the Oracle. Voters will use a different interface.\n */\nabstract contract SkinnyOptimisticOracleInterface {\n // Struct representing a price request. Note that this differs from the OptimisticOracleInterface's Request struct\n // in that refundOnDispute is removed.\n struct Request {\n address proposer; // Address of the proposer.\n address disputer; // Address of the disputer.\n IERC20 currency; // ERC20 token used to pay rewards and fees.\n bool settled; // True if the request is settled.\n int256 proposedPrice; // Price that the proposer submitted.\n int256 resolvedPrice; // Price resolved once the request is settled.\n uint256 expirationTime; // Time at which the request auto-settles without a dispute.\n uint256 reward; // Amount of the currency to pay to the proposer on settlement.\n uint256 finalFee; // Final fee to pay to the Store upon request to the DVM.\n uint256 bond; // Bond that the proposer and disputer must pay on top of the final fee.\n uint256 customLiveness; // Custom liveness value set by the requester.\n }\n\n // This value must be <= the Voting contract's `ancillaryBytesLimit` value otherwise it is possible\n // that a price can be requested to this contract successfully, but cannot be disputed because the DVM refuses\n // to accept a price request made with ancillary data length over a certain size.\n uint256 public constant ancillaryBytesLimit = 8192;\n\n /**\n * @notice Requests a new price.\n * @param identifier price identifier being requested.\n * @param timestamp timestamp of the price being requested.\n * @param ancillaryData ancillary data representing additional args being passed with the price request.\n * @param currency ERC20 token used for payment of rewards and fees. Must be approved for use with the DVM.\n * @param reward reward offered to a successful proposer. Will be pulled from the caller. Note: this can be 0,\n * which could make sense if the contract requests and proposes the value in the same call or\n * provides its own reward system.\n * @param bond custom proposal bond to set for request. If set to 0, defaults to the final fee.\n * @param customLiveness custom proposal liveness to set for request.\n * @return totalBond default bond + final fee that the proposer and disputer will be required to pay.\n */\n function requestPrice(\n bytes32 identifier,\n uint32 timestamp,\n bytes memory ancillaryData,\n IERC20 currency,\n uint256 reward,\n uint256 bond,\n uint256 customLiveness\n ) external virtual returns (uint256 totalBond);\n\n /**\n * @notice Proposes a price value on another address' behalf. Note: this address will receive any rewards that come\n * from this proposal. However, any bonds are pulled from the caller.\n * @param requester sender of the initial price request.\n * @param identifier price identifier to identify the existing request.\n * @param timestamp timestamp to identify the existing request.\n * @param ancillaryData ancillary data of the price being requested.\n * @param request price request parameters whose hash must match the request that the caller wants to\n * propose a price for.\n * @param proposer address to set as the proposer.\n * @param proposedPrice price being proposed.\n * @return totalBond the amount that's pulled from the caller's wallet as a bond. The bond will be returned to\n * the proposer once settled if the proposal is correct.\n */\n function proposePriceFor(\n address requester,\n bytes32 identifier,\n uint32 timestamp,\n bytes memory ancillaryData,\n Request memory request,\n address proposer,\n int256 proposedPrice\n ) public virtual returns (uint256 totalBond);\n\n /**\n * @notice Proposes a price value where caller is the proposer.\n * @param requester sender of the initial price request.\n * @param identifier price identifier to identify the existing request.\n * @param timestamp timestamp to identify the existing request.\n * @param ancillaryData ancillary data of the price being requested.\n * @param request price request parameters whose hash must match the request that the caller wants to\n * propose a price for.\n * @param proposedPrice price being proposed.\n * @return totalBond the amount that's pulled from the caller's wallet as a bond. The bond will be returned to\n * the proposer once settled if the proposal is correct.\n */\n function proposePrice(\n address requester,\n bytes32 identifier,\n uint32 timestamp,\n bytes memory ancillaryData,\n Request memory request,\n int256 proposedPrice\n ) external virtual returns (uint256 totalBond);\n\n /**\n * @notice Combines logic of requestPrice and proposePrice while taking advantage of gas savings from not having to\n * overwrite Request params that a normal requestPrice() => proposePrice() flow would entail. Note: The proposer\n * will receive any rewards that come from this proposal. However, any bonds are pulled from the caller.\n * @dev The caller is the requester, but the proposer can be customized.\n * @param identifier price identifier to identify the existing request.\n * @param timestamp timestamp to identify the existing request.\n * @param ancillaryData ancillary data of the price being requested.\n * @param currency ERC20 token used for payment of rewards and fees. Must be approved for use with the DVM.\n * @param reward reward offered to a successful proposer. Will be pulled from the caller. Note: this can be 0,\n * which could make sense if the contract requests and proposes the value in the same call or\n * provides its own reward system.\n * @param bond custom proposal bond to set for request. If set to 0, defaults to the final fee.\n * @param customLiveness custom proposal liveness to set for request.\n * @param proposer address to set as the proposer.\n * @param proposedPrice price being proposed.\n * @return totalBond the amount that's pulled from the caller's wallet as a bond. The bond will be returned to\n * the proposer once settled if the proposal is correct.\n */\n function requestAndProposePriceFor(\n bytes32 identifier,\n uint32 timestamp,\n bytes memory ancillaryData,\n IERC20 currency,\n uint256 reward,\n uint256 bond,\n uint256 customLiveness,\n address proposer,\n int256 proposedPrice\n ) external virtual returns (uint256 totalBond);\n\n /**\n * @notice Disputes a price request with an active proposal on another address' behalf. Note: this address will\n * receive any rewards that come from this dispute. However, any bonds are pulled from the caller.\n * @param identifier price identifier to identify the existing request.\n * @param timestamp timestamp to identify the existing request.\n * @param ancillaryData ancillary data of the price being requested.\n * @param request price request parameters whose hash must match the request that the caller wants to\n * dispute.\n * @param disputer address to set as the disputer.\n * @param requester sender of the initial price request.\n * @return totalBond the amount that's pulled from the caller's wallet as a bond. The bond will be returned to\n * the disputer once settled if the dispute was valid (the proposal was incorrect).\n */\n function disputePriceFor(\n bytes32 identifier,\n uint32 timestamp,\n bytes memory ancillaryData,\n Request memory request,\n address disputer,\n address requester\n ) public virtual returns (uint256 totalBond);\n\n /**\n * @notice Disputes a price request with an active proposal where caller is the disputer.\n * @param requester sender of the initial price request.\n * @param identifier price identifier to identify the existing request.\n * @param timestamp timestamp to identify the existing request.\n * @param ancillaryData ancillary data of the price being requested.\n * @param request price request parameters whose hash must match the request that the caller wants to\n * dispute.\n * @return totalBond the amount that's pulled from the caller's wallet as a bond. The bond will be returned to\n * the disputer once settled if the dispute was valid (the proposal was incorrect).\n */\n function disputePrice(\n address requester,\n bytes32 identifier,\n uint32 timestamp,\n bytes memory ancillaryData,\n Request memory request\n ) external virtual returns (uint256 totalBond);\n\n /**\n * @notice Attempts to settle an outstanding price request. Will revert if it isn't settleable.\n * @param requester sender of the initial price request.\n * @param identifier price identifier to identify the existing request.\n * @param timestamp timestamp to identify the existing request.\n * @param ancillaryData ancillary data of the price being requested.\n * @param request price request parameters whose hash must match the request that the caller wants to\n * settle.\n * @return payout the amount that the \"winner\" (proposer or disputer) receives on settlement. This amount includes\n * the returned bonds as well as additional rewards.\n * @return resolvedPrice the price that the request settled to.\n */\n function settle(\n address requester,\n bytes32 identifier,\n uint32 timestamp,\n bytes memory ancillaryData,\n Request memory request\n ) external virtual returns (uint256 payout, int256 resolvedPrice);\n\n /**\n * @notice Computes the current state of a price request. See the State enum for more details.\n * @param requester sender of the initial price request.\n * @param identifier price identifier to identify the existing request.\n * @param timestamp timestamp to identify the existing request.\n * @param ancillaryData ancillary data of the price being requested.\n * @param request price request parameters.\n * @return the State.\n */\n function getState(\n address requester,\n bytes32 identifier,\n uint32 timestamp,\n bytes memory ancillaryData,\n Request memory request\n ) external virtual returns (OptimisticOracleInterface.State);\n\n /**\n * @notice Checks if a given request has resolved, expired or been settled (i.e the optimistic oracle has a price).\n * @param requester sender of the initial price request.\n * @param identifier price identifier to identify the existing request.\n * @param timestamp timestamp to identify the existing request.\n * @param ancillaryData ancillary data of the price being requested.\n * @param request price request parameters. The hash of these parameters must match with the request hash that is\n * associated with the price request unique ID {requester, identifier, timestamp, ancillaryData}, or this method\n * will revert.\n * @return boolean indicating true if price exists and false if not.\n */\n function hasPrice(\n address requester,\n bytes32 identifier,\n uint32 timestamp,\n bytes memory ancillaryData,\n Request memory request\n ) public virtual returns (bool);\n\n /**\n * @notice Generates stamped ancillary data in the format that it would be used in the case of a price dispute.\n * @param ancillaryData ancillary data of the price being requested.\n * @param requester sender of the initial price request.\n * @return the stamped ancillary bytes.\n */\n function stampAncillaryData(bytes memory ancillaryData, address requester)\n public\n pure\n virtual\n returns (bytes memory);\n}\n" - }, - "@uma/core/contracts/oracle/interfaces/OptimisticOracleInterface.sol": { - "content": "// SPDX-License-Identifier: AGPL-3.0-only\npragma solidity ^0.8.0;\n\nimport \"@openzeppelin/contracts/token/ERC20/IERC20.sol\";\n\n/**\n * @title Financial contract facing Oracle interface.\n * @dev Interface used by financial contracts to interact with the Oracle. Voters will use a different interface.\n */\nabstract contract OptimisticOracleInterface {\n // Struct representing the state of a price request.\n enum State {\n Invalid, // Never requested.\n Requested, // Requested, no other actions taken.\n Proposed, // Proposed, but not expired or disputed yet.\n Expired, // Proposed, not disputed, past liveness.\n Disputed, // Disputed, but no DVM price returned yet.\n Resolved, // Disputed and DVM price is available.\n Settled // Final price has been set in the contract (can get here from Expired or Resolved).\n }\n\n // Struct representing a price request.\n struct Request {\n address proposer; // Address of the proposer.\n address disputer; // Address of the disputer.\n IERC20 currency; // ERC20 token used to pay rewards and fees.\n bool settled; // True if the request is settled.\n bool refundOnDispute; // True if the requester should be refunded their reward on dispute.\n int256 proposedPrice; // Price that the proposer submitted.\n int256 resolvedPrice; // Price resolved once the request is settled.\n uint256 expirationTime; // Time at which the request auto-settles without a dispute.\n uint256 reward; // Amount of the currency to pay to the proposer on settlement.\n uint256 finalFee; // Final fee to pay to the Store upon request to the DVM.\n uint256 bond; // Bond that the proposer and disputer must pay on top of the final fee.\n uint256 customLiveness; // Custom liveness value set by the requester.\n }\n\n // This value must be <= the Voting contract's `ancillaryBytesLimit` value otherwise it is possible\n // that a price can be requested to this contract successfully, but cannot be disputed because the DVM refuses\n // to accept a price request made with ancillary data length over a certain size.\n uint256 public constant ancillaryBytesLimit = 8192;\n\n /**\n * @notice Requests a new price.\n * @param identifier price identifier being requested.\n * @param timestamp timestamp of the price being requested.\n * @param ancillaryData ancillary data representing additional args being passed with the price request.\n * @param currency ERC20 token used for payment of rewards and fees. Must be approved for use with the DVM.\n * @param reward reward offered to a successful proposer. Will be pulled from the caller. Note: this can be 0,\n * which could make sense if the contract requests and proposes the value in the same call or\n * provides its own reward system.\n * @return totalBond default bond (final fee) + final fee that the proposer and disputer will be required to pay.\n * This can be changed with a subsequent call to setBond().\n */\n function requestPrice(\n bytes32 identifier,\n uint256 timestamp,\n bytes memory ancillaryData,\n IERC20 currency,\n uint256 reward\n ) external virtual returns (uint256 totalBond);\n\n /**\n * @notice Set the proposal bond associated with a price request.\n * @param identifier price identifier to identify the existing request.\n * @param timestamp timestamp to identify the existing request.\n * @param ancillaryData ancillary data of the price being requested.\n * @param bond custom bond amount to set.\n * @return totalBond new bond + final fee that the proposer and disputer will be required to pay. This can be\n * changed again with a subsequent call to setBond().\n */\n function setBond(\n bytes32 identifier,\n uint256 timestamp,\n bytes memory ancillaryData,\n uint256 bond\n ) external virtual returns (uint256 totalBond);\n\n /**\n * @notice Sets the request to refund the reward if the proposal is disputed. This can help to \"hedge\" the caller\n * in the event of a dispute-caused delay. Note: in the event of a dispute, the winner still receives the other's\n * bond, so there is still profit to be made even if the reward is refunded.\n * @param identifier price identifier to identify the existing request.\n * @param timestamp timestamp to identify the existing request.\n * @param ancillaryData ancillary data of the price being requested.\n */\n function setRefundOnDispute(\n bytes32 identifier,\n uint256 timestamp,\n bytes memory ancillaryData\n ) external virtual;\n\n /**\n * @notice Sets a custom liveness value for the request. Liveness is the amount of time a proposal must wait before\n * being auto-resolved.\n * @param identifier price identifier to identify the existing request.\n * @param timestamp timestamp to identify the existing request.\n * @param ancillaryData ancillary data of the price being requested.\n * @param customLiveness new custom liveness.\n */\n function setCustomLiveness(\n bytes32 identifier,\n uint256 timestamp,\n bytes memory ancillaryData,\n uint256 customLiveness\n ) external virtual;\n\n /**\n * @notice Proposes a price value on another address' behalf. Note: this address will receive any rewards that come\n * from this proposal. However, any bonds are pulled from the caller.\n * @param proposer address to set as the proposer.\n * @param requester sender of the initial price request.\n * @param identifier price identifier to identify the existing request.\n * @param timestamp timestamp to identify the existing request.\n * @param ancillaryData ancillary data of the price being requested.\n * @param proposedPrice price being proposed.\n * @return totalBond the amount that's pulled from the caller's wallet as a bond. The bond will be returned to\n * the proposer once settled if the proposal is correct.\n */\n function proposePriceFor(\n address proposer,\n address requester,\n bytes32 identifier,\n uint256 timestamp,\n bytes memory ancillaryData,\n int256 proposedPrice\n ) public virtual returns (uint256 totalBond);\n\n /**\n * @notice Proposes a price value for an existing price request.\n * @param requester sender of the initial price request.\n * @param identifier price identifier to identify the existing request.\n * @param timestamp timestamp to identify the existing request.\n * @param ancillaryData ancillary data of the price being requested.\n * @param proposedPrice price being proposed.\n * @return totalBond the amount that's pulled from the proposer's wallet as a bond. The bond will be returned to\n * the proposer once settled if the proposal is correct.\n */\n function proposePrice(\n address requester,\n bytes32 identifier,\n uint256 timestamp,\n bytes memory ancillaryData,\n int256 proposedPrice\n ) external virtual returns (uint256 totalBond);\n\n /**\n * @notice Disputes a price request with an active proposal on another address' behalf. Note: this address will\n * receive any rewards that come from this dispute. However, any bonds are pulled from the caller.\n * @param disputer address to set as the disputer.\n * @param requester sender of the initial price request.\n * @param identifier price identifier to identify the existing request.\n * @param timestamp timestamp to identify the existing request.\n * @param ancillaryData ancillary data of the price being requested.\n * @return totalBond the amount that's pulled from the caller's wallet as a bond. The bond will be returned to\n * the disputer once settled if the dispute was value (the proposal was incorrect).\n */\n function disputePriceFor(\n address disputer,\n address requester,\n bytes32 identifier,\n uint256 timestamp,\n bytes memory ancillaryData\n ) public virtual returns (uint256 totalBond);\n\n /**\n * @notice Disputes a price value for an existing price request with an active proposal.\n * @param requester sender of the initial price request.\n * @param identifier price identifier to identify the existing request.\n * @param timestamp timestamp to identify the existing request.\n * @param ancillaryData ancillary data of the price being requested.\n * @return totalBond the amount that's pulled from the disputer's wallet as a bond. The bond will be returned to\n * the disputer once settled if the dispute was valid (the proposal was incorrect).\n */\n function disputePrice(\n address requester,\n bytes32 identifier,\n uint256 timestamp,\n bytes memory ancillaryData\n ) external virtual returns (uint256 totalBond);\n\n /**\n * @notice Retrieves a price that was previously requested by a caller. Reverts if the request is not settled\n * or settleable. Note: this method is not view so that this call may actually settle the price request if it\n * hasn't been settled.\n * @param identifier price identifier to identify the existing request.\n * @param timestamp timestamp to identify the existing request.\n * @param ancillaryData ancillary data of the price being requested.\n * @return resolved price.\n */\n function settleAndGetPrice(\n bytes32 identifier,\n uint256 timestamp,\n bytes memory ancillaryData\n ) external virtual returns (int256);\n\n /**\n * @notice Attempts to settle an outstanding price request. Will revert if it isn't settleable.\n * @param requester sender of the initial price request.\n * @param identifier price identifier to identify the existing request.\n * @param timestamp timestamp to identify the existing request.\n * @param ancillaryData ancillary data of the price being requested.\n * @return payout the amount that the \"winner\" (proposer or disputer) receives on settlement. This amount includes\n * the returned bonds as well as additional rewards.\n */\n function settle(\n address requester,\n bytes32 identifier,\n uint256 timestamp,\n bytes memory ancillaryData\n ) external virtual returns (uint256 payout);\n\n /**\n * @notice Gets the current data structure containing all information about a price request.\n * @param requester sender of the initial price request.\n * @param identifier price identifier to identify the existing request.\n * @param timestamp timestamp to identify the existing request.\n * @param ancillaryData ancillary data of the price being requested.\n * @return the Request data structure.\n */\n function getRequest(\n address requester,\n bytes32 identifier,\n uint256 timestamp,\n bytes memory ancillaryData\n ) public view virtual returns (Request memory);\n\n /**\n * @notice Returns the state of a price request.\n * @param requester sender of the initial price request.\n * @param identifier price identifier to identify the existing request.\n * @param timestamp timestamp to identify the existing request.\n * @param ancillaryData ancillary data of the price being requested.\n * @return the State enum value.\n */\n function getState(\n address requester,\n bytes32 identifier,\n uint256 timestamp,\n bytes memory ancillaryData\n ) public view virtual returns (State);\n\n /**\n * @notice Checks if a given request has resolved or been settled (i.e the optimistic oracle has a price).\n * @param requester sender of the initial price request.\n * @param identifier price identifier to identify the existing request.\n * @param timestamp timestamp to identify the existing request.\n * @param ancillaryData ancillary data of the price being requested.\n * @return true if price has resolved or settled, false otherwise.\n */\n function hasPrice(\n address requester,\n bytes32 identifier,\n uint256 timestamp,\n bytes memory ancillaryData\n ) public view virtual returns (bool);\n\n function stampAncillaryData(bytes memory ancillaryData, address requester)\n public\n view\n virtual\n returns (bytes memory);\n}\n" - }, - "@uma/core/contracts/oracle/interfaces/StoreInterface.sol": { - "content": "// SPDX-License-Identifier: AGPL-3.0-only\npragma solidity ^0.8.0;\n\nimport \"@openzeppelin/contracts/token/ERC20/IERC20.sol\";\nimport \"../../common/implementation/FixedPoint.sol\";\n\n/**\n * @title Interface that allows financial contracts to pay oracle fees for their use of the system.\n */\ninterface StoreInterface {\n /**\n * @notice Pays Oracle fees in ETH to the store.\n * @dev To be used by contracts whose margin currency is ETH.\n */\n function payOracleFees() external payable;\n\n /**\n * @notice Pays oracle fees in the margin currency, erc20Address, to the store.\n * @dev To be used if the margin currency is an ERC20 token rather than ETH.\n * @param erc20Address address of the ERC20 token used to pay the fee.\n * @param amount number of tokens to transfer. An approval for at least this amount must exist.\n */\n function payOracleFeesErc20(address erc20Address, FixedPoint.Unsigned calldata amount) external;\n\n /**\n * @notice Computes the regular oracle fees that a contract should pay for a period.\n * @param startTime defines the beginning time from which the fee is paid.\n * @param endTime end time until which the fee is paid.\n * @param pfc \"profit from corruption\", or the maximum amount of margin currency that a\n * token sponsor could extract from the contract through corrupting the price feed in their favor.\n * @return regularFee amount owed for the duration from start to end time for the given pfc.\n * @return latePenalty for paying the fee after the deadline.\n */\n function computeRegularFee(\n uint256 startTime,\n uint256 endTime,\n FixedPoint.Unsigned calldata pfc\n ) external view returns (FixedPoint.Unsigned memory regularFee, FixedPoint.Unsigned memory latePenalty);\n\n /**\n * @notice Computes the final oracle fees that a contract should pay at settlement.\n * @param currency token used to pay the final fee.\n * @return finalFee amount due.\n */\n function computeFinalFee(address currency) external view returns (FixedPoint.Unsigned memory);\n}\n" - }, - "@uma/core/contracts/common/implementation/FixedPoint.sol": { - "content": "// SPDX-License-Identifier: AGPL-3.0-only\npragma solidity ^0.8.0;\n\nimport \"@openzeppelin/contracts/utils/math/SafeMath.sol\";\nimport \"@openzeppelin/contracts/utils/math/SignedSafeMath.sol\";\n\n/**\n * @title Library for fixed point arithmetic on uints\n */\nlibrary FixedPoint {\n using SafeMath for uint256;\n using SignedSafeMath for int256;\n\n // Supports 18 decimals. E.g., 1e18 represents \"1\", 5e17 represents \"0.5\".\n // For unsigned values:\n // This can represent a value up to (2^256 - 1)/10^18 = ~10^59. 10^59 will be stored internally as uint256 10^77.\n uint256 private constant FP_SCALING_FACTOR = 10**18;\n\n // --------------------------------------- UNSIGNED -----------------------------------------------------------------------------\n struct Unsigned {\n uint256 rawValue;\n }\n\n /**\n * @notice Constructs an `Unsigned` from an unscaled uint, e.g., `b=5` gets stored internally as `5*(10**18)`.\n * @param a uint to convert into a FixedPoint.\n * @return the converted FixedPoint.\n */\n function fromUnscaledUint(uint256 a) internal pure returns (Unsigned memory) {\n return Unsigned(a.mul(FP_SCALING_FACTOR));\n }\n\n /**\n * @notice Whether `a` is equal to `b`.\n * @param a a FixedPoint.\n * @param b a uint256.\n * @return True if equal, or False.\n */\n function isEqual(Unsigned memory a, uint256 b) internal pure returns (bool) {\n return a.rawValue == fromUnscaledUint(b).rawValue;\n }\n\n /**\n * @notice Whether `a` is equal to `b`.\n * @param a a FixedPoint.\n * @param b a FixedPoint.\n * @return True if equal, or False.\n */\n function isEqual(Unsigned memory a, Unsigned memory b) internal pure returns (bool) {\n return a.rawValue == b.rawValue;\n }\n\n /**\n * @notice Whether `a` is greater than `b`.\n * @param a a FixedPoint.\n * @param b a FixedPoint.\n * @return True if `a > b`, or False.\n */\n function isGreaterThan(Unsigned memory a, Unsigned memory b) internal pure returns (bool) {\n return a.rawValue > b.rawValue;\n }\n\n /**\n * @notice Whether `a` is greater than `b`.\n * @param a a FixedPoint.\n * @param b a uint256.\n * @return True if `a > b`, or False.\n */\n function isGreaterThan(Unsigned memory a, uint256 b) internal pure returns (bool) {\n return a.rawValue > fromUnscaledUint(b).rawValue;\n }\n\n /**\n * @notice Whether `a` is greater than `b`.\n * @param a a uint256.\n * @param b a FixedPoint.\n * @return True if `a > b`, or False.\n */\n function isGreaterThan(uint256 a, Unsigned memory b) internal pure returns (bool) {\n return fromUnscaledUint(a).rawValue > b.rawValue;\n }\n\n /**\n * @notice Whether `a` is greater than or equal to `b`.\n * @param a a FixedPoint.\n * @param b a FixedPoint.\n * @return True if `a >= b`, or False.\n */\n function isGreaterThanOrEqual(Unsigned memory a, Unsigned memory b) internal pure returns (bool) {\n return a.rawValue >= b.rawValue;\n }\n\n /**\n * @notice Whether `a` is greater than or equal to `b`.\n * @param a a FixedPoint.\n * @param b a uint256.\n * @return True if `a >= b`, or False.\n */\n function isGreaterThanOrEqual(Unsigned memory a, uint256 b) internal pure returns (bool) {\n return a.rawValue >= fromUnscaledUint(b).rawValue;\n }\n\n /**\n * @notice Whether `a` is greater than or equal to `b`.\n * @param a a uint256.\n * @param b a FixedPoint.\n * @return True if `a >= b`, or False.\n */\n function isGreaterThanOrEqual(uint256 a, Unsigned memory b) internal pure returns (bool) {\n return fromUnscaledUint(a).rawValue >= b.rawValue;\n }\n\n /**\n * @notice Whether `a` is less than `b`.\n * @param a a FixedPoint.\n * @param b a FixedPoint.\n * @return True if `a < b`, or False.\n */\n function isLessThan(Unsigned memory a, Unsigned memory b) internal pure returns (bool) {\n return a.rawValue < b.rawValue;\n }\n\n /**\n * @notice Whether `a` is less than `b`.\n * @param a a FixedPoint.\n * @param b a uint256.\n * @return True if `a < b`, or False.\n */\n function isLessThan(Unsigned memory a, uint256 b) internal pure returns (bool) {\n return a.rawValue < fromUnscaledUint(b).rawValue;\n }\n\n /**\n * @notice Whether `a` is less than `b`.\n * @param a a uint256.\n * @param b a FixedPoint.\n * @return True if `a < b`, or False.\n */\n function isLessThan(uint256 a, Unsigned memory b) internal pure returns (bool) {\n return fromUnscaledUint(a).rawValue < b.rawValue;\n }\n\n /**\n * @notice Whether `a` is less than or equal to `b`.\n * @param a a FixedPoint.\n * @param b a FixedPoint.\n * @return True if `a <= b`, or False.\n */\n function isLessThanOrEqual(Unsigned memory a, Unsigned memory b) internal pure returns (bool) {\n return a.rawValue <= b.rawValue;\n }\n\n /**\n * @notice Whether `a` is less than or equal to `b`.\n * @param a a FixedPoint.\n * @param b a uint256.\n * @return True if `a <= b`, or False.\n */\n function isLessThanOrEqual(Unsigned memory a, uint256 b) internal pure returns (bool) {\n return a.rawValue <= fromUnscaledUint(b).rawValue;\n }\n\n /**\n * @notice Whether `a` is less than or equal to `b`.\n * @param a a uint256.\n * @param b a FixedPoint.\n * @return True if `a <= b`, or False.\n */\n function isLessThanOrEqual(uint256 a, Unsigned memory b) internal pure returns (bool) {\n return fromUnscaledUint(a).rawValue <= b.rawValue;\n }\n\n /**\n * @notice The minimum of `a` and `b`.\n * @param a a FixedPoint.\n * @param b a FixedPoint.\n * @return the minimum of `a` and `b`.\n */\n function min(Unsigned memory a, Unsigned memory b) internal pure returns (Unsigned memory) {\n return a.rawValue < b.rawValue ? a : b;\n }\n\n /**\n * @notice The maximum of `a` and `b`.\n * @param a a FixedPoint.\n * @param b a FixedPoint.\n * @return the maximum of `a` and `b`.\n */\n function max(Unsigned memory a, Unsigned memory b) internal pure returns (Unsigned memory) {\n return a.rawValue > b.rawValue ? a : b;\n }\n\n /**\n * @notice Adds two `Unsigned`s, reverting on overflow.\n * @param a a FixedPoint.\n * @param b a FixedPoint.\n * @return the sum of `a` and `b`.\n */\n function add(Unsigned memory a, Unsigned memory b) internal pure returns (Unsigned memory) {\n return Unsigned(a.rawValue.add(b.rawValue));\n }\n\n /**\n * @notice Adds an `Unsigned` to an unscaled uint, reverting on overflow.\n * @param a a FixedPoint.\n * @param b a uint256.\n * @return the sum of `a` and `b`.\n */\n function add(Unsigned memory a, uint256 b) internal pure returns (Unsigned memory) {\n return add(a, fromUnscaledUint(b));\n }\n\n /**\n * @notice Subtracts two `Unsigned`s, reverting on overflow.\n * @param a a FixedPoint.\n * @param b a FixedPoint.\n * @return the difference of `a` and `b`.\n */\n function sub(Unsigned memory a, Unsigned memory b) internal pure returns (Unsigned memory) {\n return Unsigned(a.rawValue.sub(b.rawValue));\n }\n\n /**\n * @notice Subtracts an unscaled uint256 from an `Unsigned`, reverting on overflow.\n * @param a a FixedPoint.\n * @param b a uint256.\n * @return the difference of `a` and `b`.\n */\n function sub(Unsigned memory a, uint256 b) internal pure returns (Unsigned memory) {\n return sub(a, fromUnscaledUint(b));\n }\n\n /**\n * @notice Subtracts an `Unsigned` from an unscaled uint256, reverting on overflow.\n * @param a a uint256.\n * @param b a FixedPoint.\n * @return the difference of `a` and `b`.\n */\n function sub(uint256 a, Unsigned memory b) internal pure returns (Unsigned memory) {\n return sub(fromUnscaledUint(a), b);\n }\n\n /**\n * @notice Multiplies two `Unsigned`s, reverting on overflow.\n * @dev This will \"floor\" the product.\n * @param a a FixedPoint.\n * @param b a FixedPoint.\n * @return the product of `a` and `b`.\n */\n function mul(Unsigned memory a, Unsigned memory b) internal pure returns (Unsigned memory) {\n // There are two caveats with this computation:\n // 1. Max output for the represented number is ~10^41, otherwise an intermediate value overflows. 10^41 is\n // stored internally as a uint256 ~10^59.\n // 2. Results that can't be represented exactly are truncated not rounded. E.g., 1.4 * 2e-18 = 2.8e-18, which\n // would round to 3, but this computation produces the result 2.\n // No need to use SafeMath because FP_SCALING_FACTOR != 0.\n return Unsigned(a.rawValue.mul(b.rawValue) / FP_SCALING_FACTOR);\n }\n\n /**\n * @notice Multiplies an `Unsigned` and an unscaled uint256, reverting on overflow.\n * @dev This will \"floor\" the product.\n * @param a a FixedPoint.\n * @param b a uint256.\n * @return the product of `a` and `b`.\n */\n function mul(Unsigned memory a, uint256 b) internal pure returns (Unsigned memory) {\n return Unsigned(a.rawValue.mul(b));\n }\n\n /**\n * @notice Multiplies two `Unsigned`s and \"ceil's\" the product, reverting on overflow.\n * @param a a FixedPoint.\n * @param b a FixedPoint.\n * @return the product of `a` and `b`.\n */\n function mulCeil(Unsigned memory a, Unsigned memory b) internal pure returns (Unsigned memory) {\n uint256 mulRaw = a.rawValue.mul(b.rawValue);\n uint256 mulFloor = mulRaw / FP_SCALING_FACTOR;\n uint256 mod = mulRaw.mod(FP_SCALING_FACTOR);\n if (mod != 0) {\n return Unsigned(mulFloor.add(1));\n } else {\n return Unsigned(mulFloor);\n }\n }\n\n /**\n * @notice Multiplies an `Unsigned` and an unscaled uint256 and \"ceil's\" the product, reverting on overflow.\n * @param a a FixedPoint.\n * @param b a FixedPoint.\n * @return the product of `a` and `b`.\n */\n function mulCeil(Unsigned memory a, uint256 b) internal pure returns (Unsigned memory) {\n // Since b is an uint, there is no risk of truncation and we can just mul it normally\n return Unsigned(a.rawValue.mul(b));\n }\n\n /**\n * @notice Divides one `Unsigned` by an `Unsigned`, reverting on overflow or division by 0.\n * @dev This will \"floor\" the quotient.\n * @param a a FixedPoint numerator.\n * @param b a FixedPoint denominator.\n * @return the quotient of `a` divided by `b`.\n */\n function div(Unsigned memory a, Unsigned memory b) internal pure returns (Unsigned memory) {\n // There are two caveats with this computation:\n // 1. Max value for the number dividend `a` represents is ~10^41, otherwise an intermediate value overflows.\n // 10^41 is stored internally as a uint256 10^59.\n // 2. Results that can't be represented exactly are truncated not rounded. E.g., 2 / 3 = 0.6 repeating, which\n // would round to 0.666666666666666667, but this computation produces the result 0.666666666666666666.\n return Unsigned(a.rawValue.mul(FP_SCALING_FACTOR).div(b.rawValue));\n }\n\n /**\n * @notice Divides one `Unsigned` by an unscaled uint256, reverting on overflow or division by 0.\n * @dev This will \"floor\" the quotient.\n * @param a a FixedPoint numerator.\n * @param b a uint256 denominator.\n * @return the quotient of `a` divided by `b`.\n */\n function div(Unsigned memory a, uint256 b) internal pure returns (Unsigned memory) {\n return Unsigned(a.rawValue.div(b));\n }\n\n /**\n * @notice Divides one unscaled uint256 by an `Unsigned`, reverting on overflow or division by 0.\n * @dev This will \"floor\" the quotient.\n * @param a a uint256 numerator.\n * @param b a FixedPoint denominator.\n * @return the quotient of `a` divided by `b`.\n */\n function div(uint256 a, Unsigned memory b) internal pure returns (Unsigned memory) {\n return div(fromUnscaledUint(a), b);\n }\n\n /**\n * @notice Divides one `Unsigned` by an `Unsigned` and \"ceil's\" the quotient, reverting on overflow or division by 0.\n * @param a a FixedPoint numerator.\n * @param b a FixedPoint denominator.\n * @return the quotient of `a` divided by `b`.\n */\n function divCeil(Unsigned memory a, Unsigned memory b) internal pure returns (Unsigned memory) {\n uint256 aScaled = a.rawValue.mul(FP_SCALING_FACTOR);\n uint256 divFloor = aScaled.div(b.rawValue);\n uint256 mod = aScaled.mod(b.rawValue);\n if (mod != 0) {\n return Unsigned(divFloor.add(1));\n } else {\n return Unsigned(divFloor);\n }\n }\n\n /**\n * @notice Divides one `Unsigned` by an unscaled uint256 and \"ceil's\" the quotient, reverting on overflow or division by 0.\n * @param a a FixedPoint numerator.\n * @param b a uint256 denominator.\n * @return the quotient of `a` divided by `b`.\n */\n function divCeil(Unsigned memory a, uint256 b) internal pure returns (Unsigned memory) {\n // Because it is possible that a quotient gets truncated, we can't just call \"Unsigned(a.rawValue.div(b))\"\n // similarly to mulCeil with a uint256 as the second parameter. Therefore we need to convert b into an Unsigned.\n // This creates the possibility of overflow if b is very large.\n return divCeil(a, fromUnscaledUint(b));\n }\n\n /**\n * @notice Raises an `Unsigned` to the power of an unscaled uint256, reverting on overflow. E.g., `b=2` squares `a`.\n * @dev This will \"floor\" the result.\n * @param a a FixedPoint numerator.\n * @param b a uint256 denominator.\n * @return output is `a` to the power of `b`.\n */\n function pow(Unsigned memory a, uint256 b) internal pure returns (Unsigned memory output) {\n output = fromUnscaledUint(1);\n for (uint256 i = 0; i < b; i = i.add(1)) {\n output = mul(output, a);\n }\n }\n\n // ------------------------------------------------- SIGNED -------------------------------------------------------------\n // Supports 18 decimals. E.g., 1e18 represents \"1\", 5e17 represents \"0.5\".\n // For signed values:\n // This can represent a value up (or down) to +-(2^255 - 1)/10^18 = ~10^58. 10^58 will be stored internally as int256 10^76.\n int256 private constant SFP_SCALING_FACTOR = 10**18;\n\n struct Signed {\n int256 rawValue;\n }\n\n function fromSigned(Signed memory a) internal pure returns (Unsigned memory) {\n require(a.rawValue >= 0, \"Negative value provided\");\n return Unsigned(uint256(a.rawValue));\n }\n\n function fromUnsigned(Unsigned memory a) internal pure returns (Signed memory) {\n require(a.rawValue <= uint256(type(int256).max), \"Unsigned too large\");\n return Signed(int256(a.rawValue));\n }\n\n /**\n * @notice Constructs a `Signed` from an unscaled int, e.g., `b=5` gets stored internally as `5*(10**18)`.\n * @param a int to convert into a FixedPoint.Signed.\n * @return the converted FixedPoint.Signed.\n */\n function fromUnscaledInt(int256 a) internal pure returns (Signed memory) {\n return Signed(a.mul(SFP_SCALING_FACTOR));\n }\n\n /**\n * @notice Whether `a` is equal to `b`.\n * @param a a FixedPoint.Signed.\n * @param b a int256.\n * @return True if equal, or False.\n */\n function isEqual(Signed memory a, int256 b) internal pure returns (bool) {\n return a.rawValue == fromUnscaledInt(b).rawValue;\n }\n\n /**\n * @notice Whether `a` is equal to `b`.\n * @param a a FixedPoint.Signed.\n * @param b a FixedPoint.Signed.\n * @return True if equal, or False.\n */\n function isEqual(Signed memory a, Signed memory b) internal pure returns (bool) {\n return a.rawValue == b.rawValue;\n }\n\n /**\n * @notice Whether `a` is greater than `b`.\n * @param a a FixedPoint.Signed.\n * @param b a FixedPoint.Signed.\n * @return True if `a > b`, or False.\n */\n function isGreaterThan(Signed memory a, Signed memory b) internal pure returns (bool) {\n return a.rawValue > b.rawValue;\n }\n\n /**\n * @notice Whether `a` is greater than `b`.\n * @param a a FixedPoint.Signed.\n * @param b an int256.\n * @return True if `a > b`, or False.\n */\n function isGreaterThan(Signed memory a, int256 b) internal pure returns (bool) {\n return a.rawValue > fromUnscaledInt(b).rawValue;\n }\n\n /**\n * @notice Whether `a` is greater than `b`.\n * @param a an int256.\n * @param b a FixedPoint.Signed.\n * @return True if `a > b`, or False.\n */\n function isGreaterThan(int256 a, Signed memory b) internal pure returns (bool) {\n return fromUnscaledInt(a).rawValue > b.rawValue;\n }\n\n /**\n * @notice Whether `a` is greater than or equal to `b`.\n * @param a a FixedPoint.Signed.\n * @param b a FixedPoint.Signed.\n * @return True if `a >= b`, or False.\n */\n function isGreaterThanOrEqual(Signed memory a, Signed memory b) internal pure returns (bool) {\n return a.rawValue >= b.rawValue;\n }\n\n /**\n * @notice Whether `a` is greater than or equal to `b`.\n * @param a a FixedPoint.Signed.\n * @param b an int256.\n * @return True if `a >= b`, or False.\n */\n function isGreaterThanOrEqual(Signed memory a, int256 b) internal pure returns (bool) {\n return a.rawValue >= fromUnscaledInt(b).rawValue;\n }\n\n /**\n * @notice Whether `a` is greater than or equal to `b`.\n * @param a an int256.\n * @param b a FixedPoint.Signed.\n * @return True if `a >= b`, or False.\n */\n function isGreaterThanOrEqual(int256 a, Signed memory b) internal pure returns (bool) {\n return fromUnscaledInt(a).rawValue >= b.rawValue;\n }\n\n /**\n * @notice Whether `a` is less than `b`.\n * @param a a FixedPoint.Signed.\n * @param b a FixedPoint.Signed.\n * @return True if `a < b`, or False.\n */\n function isLessThan(Signed memory a, Signed memory b) internal pure returns (bool) {\n return a.rawValue < b.rawValue;\n }\n\n /**\n * @notice Whether `a` is less than `b`.\n * @param a a FixedPoint.Signed.\n * @param b an int256.\n * @return True if `a < b`, or False.\n */\n function isLessThan(Signed memory a, int256 b) internal pure returns (bool) {\n return a.rawValue < fromUnscaledInt(b).rawValue;\n }\n\n /**\n * @notice Whether `a` is less than `b`.\n * @param a an int256.\n * @param b a FixedPoint.Signed.\n * @return True if `a < b`, or False.\n */\n function isLessThan(int256 a, Signed memory b) internal pure returns (bool) {\n return fromUnscaledInt(a).rawValue < b.rawValue;\n }\n\n /**\n * @notice Whether `a` is less than or equal to `b`.\n * @param a a FixedPoint.Signed.\n * @param b a FixedPoint.Signed.\n * @return True if `a <= b`, or False.\n */\n function isLessThanOrEqual(Signed memory a, Signed memory b) internal pure returns (bool) {\n return a.rawValue <= b.rawValue;\n }\n\n /**\n * @notice Whether `a` is less than or equal to `b`.\n * @param a a FixedPoint.Signed.\n * @param b an int256.\n * @return True if `a <= b`, or False.\n */\n function isLessThanOrEqual(Signed memory a, int256 b) internal pure returns (bool) {\n return a.rawValue <= fromUnscaledInt(b).rawValue;\n }\n\n /**\n * @notice Whether `a` is less than or equal to `b`.\n * @param a an int256.\n * @param b a FixedPoint.Signed.\n * @return True if `a <= b`, or False.\n */\n function isLessThanOrEqual(int256 a, Signed memory b) internal pure returns (bool) {\n return fromUnscaledInt(a).rawValue <= b.rawValue;\n }\n\n /**\n * @notice The minimum of `a` and `b`.\n * @param a a FixedPoint.Signed.\n * @param b a FixedPoint.Signed.\n * @return the minimum of `a` and `b`.\n */\n function min(Signed memory a, Signed memory b) internal pure returns (Signed memory) {\n return a.rawValue < b.rawValue ? a : b;\n }\n\n /**\n * @notice The maximum of `a` and `b`.\n * @param a a FixedPoint.Signed.\n * @param b a FixedPoint.Signed.\n * @return the maximum of `a` and `b`.\n */\n function max(Signed memory a, Signed memory b) internal pure returns (Signed memory) {\n return a.rawValue > b.rawValue ? a : b;\n }\n\n /**\n * @notice Adds two `Signed`s, reverting on overflow.\n * @param a a FixedPoint.Signed.\n * @param b a FixedPoint.Signed.\n * @return the sum of `a` and `b`.\n */\n function add(Signed memory a, Signed memory b) internal pure returns (Signed memory) {\n return Signed(a.rawValue.add(b.rawValue));\n }\n\n /**\n * @notice Adds an `Signed` to an unscaled int, reverting on overflow.\n * @param a a FixedPoint.Signed.\n * @param b an int256.\n * @return the sum of `a` and `b`.\n */\n function add(Signed memory a, int256 b) internal pure returns (Signed memory) {\n return add(a, fromUnscaledInt(b));\n }\n\n /**\n * @notice Subtracts two `Signed`s, reverting on overflow.\n * @param a a FixedPoint.Signed.\n * @param b a FixedPoint.Signed.\n * @return the difference of `a` and `b`.\n */\n function sub(Signed memory a, Signed memory b) internal pure returns (Signed memory) {\n return Signed(a.rawValue.sub(b.rawValue));\n }\n\n /**\n * @notice Subtracts an unscaled int256 from an `Signed`, reverting on overflow.\n * @param a a FixedPoint.Signed.\n * @param b an int256.\n * @return the difference of `a` and `b`.\n */\n function sub(Signed memory a, int256 b) internal pure returns (Signed memory) {\n return sub(a, fromUnscaledInt(b));\n }\n\n /**\n * @notice Subtracts an `Signed` from an unscaled int256, reverting on overflow.\n * @param a an int256.\n * @param b a FixedPoint.Signed.\n * @return the difference of `a` and `b`.\n */\n function sub(int256 a, Signed memory b) internal pure returns (Signed memory) {\n return sub(fromUnscaledInt(a), b);\n }\n\n /**\n * @notice Multiplies two `Signed`s, reverting on overflow.\n * @dev This will \"floor\" the product.\n * @param a a FixedPoint.Signed.\n * @param b a FixedPoint.Signed.\n * @return the product of `a` and `b`.\n */\n function mul(Signed memory a, Signed memory b) internal pure returns (Signed memory) {\n // There are two caveats with this computation:\n // 1. Max output for the represented number is ~10^41, otherwise an intermediate value overflows. 10^41 is\n // stored internally as an int256 ~10^59.\n // 2. Results that can't be represented exactly are truncated not rounded. E.g., 1.4 * 2e-18 = 2.8e-18, which\n // would round to 3, but this computation produces the result 2.\n // No need to use SafeMath because SFP_SCALING_FACTOR != 0.\n return Signed(a.rawValue.mul(b.rawValue) / SFP_SCALING_FACTOR);\n }\n\n /**\n * @notice Multiplies an `Signed` and an unscaled int256, reverting on overflow.\n * @dev This will \"floor\" the product.\n * @param a a FixedPoint.Signed.\n * @param b an int256.\n * @return the product of `a` and `b`.\n */\n function mul(Signed memory a, int256 b) internal pure returns (Signed memory) {\n return Signed(a.rawValue.mul(b));\n }\n\n /**\n * @notice Multiplies two `Signed`s and \"ceil's\" the product, reverting on overflow.\n * @param a a FixedPoint.Signed.\n * @param b a FixedPoint.Signed.\n * @return the product of `a` and `b`.\n */\n function mulAwayFromZero(Signed memory a, Signed memory b) internal pure returns (Signed memory) {\n int256 mulRaw = a.rawValue.mul(b.rawValue);\n int256 mulTowardsZero = mulRaw / SFP_SCALING_FACTOR;\n // Manual mod because SignedSafeMath doesn't support it.\n int256 mod = mulRaw % SFP_SCALING_FACTOR;\n if (mod != 0) {\n bool isResultPositive = isLessThan(a, 0) == isLessThan(b, 0);\n int256 valueToAdd = isResultPositive ? int256(1) : int256(-1);\n return Signed(mulTowardsZero.add(valueToAdd));\n } else {\n return Signed(mulTowardsZero);\n }\n }\n\n /**\n * @notice Multiplies an `Signed` and an unscaled int256 and \"ceil's\" the product, reverting on overflow.\n * @param a a FixedPoint.Signed.\n * @param b a FixedPoint.Signed.\n * @return the product of `a` and `b`.\n */\n function mulAwayFromZero(Signed memory a, int256 b) internal pure returns (Signed memory) {\n // Since b is an int, there is no risk of truncation and we can just mul it normally\n return Signed(a.rawValue.mul(b));\n }\n\n /**\n * @notice Divides one `Signed` by an `Signed`, reverting on overflow or division by 0.\n * @dev This will \"floor\" the quotient.\n * @param a a FixedPoint numerator.\n * @param b a FixedPoint denominator.\n * @return the quotient of `a` divided by `b`.\n */\n function div(Signed memory a, Signed memory b) internal pure returns (Signed memory) {\n // There are two caveats with this computation:\n // 1. Max value for the number dividend `a` represents is ~10^41, otherwise an intermediate value overflows.\n // 10^41 is stored internally as an int256 10^59.\n // 2. Results that can't be represented exactly are truncated not rounded. E.g., 2 / 3 = 0.6 repeating, which\n // would round to 0.666666666666666667, but this computation produces the result 0.666666666666666666.\n return Signed(a.rawValue.mul(SFP_SCALING_FACTOR).div(b.rawValue));\n }\n\n /**\n * @notice Divides one `Signed` by an unscaled int256, reverting on overflow or division by 0.\n * @dev This will \"floor\" the quotient.\n * @param a a FixedPoint numerator.\n * @param b an int256 denominator.\n * @return the quotient of `a` divided by `b`.\n */\n function div(Signed memory a, int256 b) internal pure returns (Signed memory) {\n return Signed(a.rawValue.div(b));\n }\n\n /**\n * @notice Divides one unscaled int256 by an `Signed`, reverting on overflow or division by 0.\n * @dev This will \"floor\" the quotient.\n * @param a an int256 numerator.\n * @param b a FixedPoint denominator.\n * @return the quotient of `a` divided by `b`.\n */\n function div(int256 a, Signed memory b) internal pure returns (Signed memory) {\n return div(fromUnscaledInt(a), b);\n }\n\n /**\n * @notice Divides one `Signed` by an `Signed` and \"ceil's\" the quotient, reverting on overflow or division by 0.\n * @param a a FixedPoint numerator.\n * @param b a FixedPoint denominator.\n * @return the quotient of `a` divided by `b`.\n */\n function divAwayFromZero(Signed memory a, Signed memory b) internal pure returns (Signed memory) {\n int256 aScaled = a.rawValue.mul(SFP_SCALING_FACTOR);\n int256 divTowardsZero = aScaled.div(b.rawValue);\n // Manual mod because SignedSafeMath doesn't support it.\n int256 mod = aScaled % b.rawValue;\n if (mod != 0) {\n bool isResultPositive = isLessThan(a, 0) == isLessThan(b, 0);\n int256 valueToAdd = isResultPositive ? int256(1) : int256(-1);\n return Signed(divTowardsZero.add(valueToAdd));\n } else {\n return Signed(divTowardsZero);\n }\n }\n\n /**\n * @notice Divides one `Signed` by an unscaled int256 and \"ceil's\" the quotient, reverting on overflow or division by 0.\n * @param a a FixedPoint numerator.\n * @param b an int256 denominator.\n * @return the quotient of `a` divided by `b`.\n */\n function divAwayFromZero(Signed memory a, int256 b) internal pure returns (Signed memory) {\n // Because it is possible that a quotient gets truncated, we can't just call \"Signed(a.rawValue.div(b))\"\n // similarly to mulCeil with an int256 as the second parameter. Therefore we need to convert b into an Signed.\n // This creates the possibility of overflow if b is very large.\n return divAwayFromZero(a, fromUnscaledInt(b));\n }\n\n /**\n * @notice Raises an `Signed` to the power of an unscaled uint256, reverting on overflow. E.g., `b=2` squares `a`.\n * @dev This will \"floor\" the result.\n * @param a a FixedPoint.Signed.\n * @param b a uint256 (negative exponents are not allowed).\n * @return output is `a` to the power of `b`.\n */\n function pow(Signed memory a, uint256 b) internal pure returns (Signed memory output) {\n output = fromUnscaledInt(1);\n for (uint256 i = 0; i < b; i = i.add(1)) {\n output = mul(output, a);\n }\n }\n}\n" - }, - "@openzeppelin/contracts/utils/math/SafeMath.sol": { - "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts v4.4.1 (utils/math/SafeMath.sol)\n\npragma solidity ^0.8.0;\n\n// CAUTION\n// This version of SafeMath should only be used with Solidity 0.8 or later,\n// because it relies on the compiler's built in overflow checks.\n\n/**\n * @dev Wrappers over Solidity's arithmetic operations.\n *\n * NOTE: `SafeMath` is generally not needed starting with Solidity 0.8, since the compiler\n * now has built in overflow checking.\n */\nlibrary SafeMath {\n /**\n * @dev Returns the addition of two unsigned integers, with an overflow flag.\n *\n * _Available since v3.4._\n */\n function tryAdd(uint256 a, uint256 b) internal pure returns (bool, uint256) {\n unchecked {\n uint256 c = a + b;\n if (c < a) return (false, 0);\n return (true, c);\n }\n }\n\n /**\n * @dev Returns the substraction of two unsigned integers, with an overflow flag.\n *\n * _Available since v3.4._\n */\n function trySub(uint256 a, uint256 b) internal pure returns (bool, uint256) {\n unchecked {\n if (b > a) return (false, 0);\n return (true, a - b);\n }\n }\n\n /**\n * @dev Returns the multiplication of two unsigned integers, with an overflow flag.\n *\n * _Available since v3.4._\n */\n function tryMul(uint256 a, uint256 b) internal pure returns (bool, uint256) {\n unchecked {\n // Gas optimization: this is cheaper than requiring 'a' not being zero, but the\n // benefit is lost if 'b' is also tested.\n // See: https://github.com/OpenZeppelin/openzeppelin-contracts/pull/522\n if (a == 0) return (true, 0);\n uint256 c = a * b;\n if (c / a != b) return (false, 0);\n return (true, c);\n }\n }\n\n /**\n * @dev Returns the division of two unsigned integers, with a division by zero flag.\n *\n * _Available since v3.4._\n */\n function tryDiv(uint256 a, uint256 b) internal pure returns (bool, uint256) {\n unchecked {\n if (b == 0) return (false, 0);\n return (true, a / b);\n }\n }\n\n /**\n * @dev Returns the remainder of dividing two unsigned integers, with a division by zero flag.\n *\n * _Available since v3.4._\n */\n function tryMod(uint256 a, uint256 b) internal pure returns (bool, uint256) {\n unchecked {\n if (b == 0) return (false, 0);\n return (true, a % b);\n }\n }\n\n /**\n * @dev Returns the addition of two unsigned integers, reverting on\n * overflow.\n *\n * Counterpart to Solidity's `+` operator.\n *\n * Requirements:\n *\n * - Addition cannot overflow.\n */\n function add(uint256 a, uint256 b) internal pure returns (uint256) {\n return a + b;\n }\n\n /**\n * @dev Returns the subtraction of two unsigned integers, reverting on\n * overflow (when the result is negative).\n *\n * Counterpart to Solidity's `-` operator.\n *\n * Requirements:\n *\n * - Subtraction cannot overflow.\n */\n function sub(uint256 a, uint256 b) internal pure returns (uint256) {\n return a - b;\n }\n\n /**\n * @dev Returns the multiplication of two unsigned integers, reverting on\n * overflow.\n *\n * Counterpart to Solidity's `*` operator.\n *\n * Requirements:\n *\n * - Multiplication cannot overflow.\n */\n function mul(uint256 a, uint256 b) internal pure returns (uint256) {\n return a * b;\n }\n\n /**\n * @dev Returns the integer division of two unsigned integers, reverting on\n * division by zero. The result is rounded towards zero.\n *\n * Counterpart to Solidity's `/` operator.\n *\n * Requirements:\n *\n * - The divisor cannot be zero.\n */\n function div(uint256 a, uint256 b) internal pure returns (uint256) {\n return a / b;\n }\n\n /**\n * @dev Returns the remainder of dividing two unsigned integers. (unsigned integer modulo),\n * reverting when dividing by zero.\n *\n * Counterpart to Solidity's `%` operator. This function uses a `revert`\n * opcode (which leaves remaining gas untouched) while Solidity uses an\n * invalid opcode to revert (consuming all remaining gas).\n *\n * Requirements:\n *\n * - The divisor cannot be zero.\n */\n function mod(uint256 a, uint256 b) internal pure returns (uint256) {\n return a % b;\n }\n\n /**\n * @dev Returns the subtraction of two unsigned integers, reverting with custom message on\n * overflow (when the result is negative).\n *\n * CAUTION: This function is deprecated because it requires allocating memory for the error\n * message unnecessarily. For custom revert reasons use {trySub}.\n *\n * Counterpart to Solidity's `-` operator.\n *\n * Requirements:\n *\n * - Subtraction cannot overflow.\n */\n function sub(\n uint256 a,\n uint256 b,\n string memory errorMessage\n ) internal pure returns (uint256) {\n unchecked {\n require(b <= a, errorMessage);\n return a - b;\n }\n }\n\n /**\n * @dev Returns the integer division of two unsigned integers, reverting with custom message on\n * division by zero. The result is rounded towards zero.\n *\n * Counterpart to Solidity's `/` operator. Note: this function uses a\n * `revert` opcode (which leaves remaining gas untouched) while Solidity\n * uses an invalid opcode to revert (consuming all remaining gas).\n *\n * Requirements:\n *\n * - The divisor cannot be zero.\n */\n function div(\n uint256 a,\n uint256 b,\n string memory errorMessage\n ) internal pure returns (uint256) {\n unchecked {\n require(b > 0, errorMessage);\n return a / b;\n }\n }\n\n /**\n * @dev Returns the remainder of dividing two unsigned integers. (unsigned integer modulo),\n * reverting with custom message when dividing by zero.\n *\n * CAUTION: This function is deprecated because it requires allocating memory for the error\n * message unnecessarily. For custom revert reasons use {tryMod}.\n *\n * Counterpart to Solidity's `%` operator. This function uses a `revert`\n * opcode (which leaves remaining gas untouched) while Solidity uses an\n * invalid opcode to revert (consuming all remaining gas).\n *\n * Requirements:\n *\n * - The divisor cannot be zero.\n */\n function mod(\n uint256 a,\n uint256 b,\n string memory errorMessage\n ) internal pure returns (uint256) {\n unchecked {\n require(b > 0, errorMessage);\n return a % b;\n }\n }\n}\n" - }, - "@openzeppelin/contracts/utils/math/SignedSafeMath.sol": { - "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts v4.4.1 (utils/math/SignedSafeMath.sol)\n\npragma solidity ^0.8.0;\n\n/**\n * @dev Wrappers over Solidity's arithmetic operations.\n *\n * NOTE: `SignedSafeMath` is no longer needed starting with Solidity 0.8. The compiler\n * now has built in overflow checking.\n */\nlibrary SignedSafeMath {\n /**\n * @dev Returns the multiplication of two signed integers, reverting on\n * overflow.\n *\n * Counterpart to Solidity's `*` operator.\n *\n * Requirements:\n *\n * - Multiplication cannot overflow.\n */\n function mul(int256 a, int256 b) internal pure returns (int256) {\n return a * b;\n }\n\n /**\n * @dev Returns the integer division of two signed integers. Reverts on\n * division by zero. The result is rounded towards zero.\n *\n * Counterpart to Solidity's `/` operator.\n *\n * Requirements:\n *\n * - The divisor cannot be zero.\n */\n function div(int256 a, int256 b) internal pure returns (int256) {\n return a / b;\n }\n\n /**\n * @dev Returns the subtraction of two signed integers, reverting on\n * overflow.\n *\n * Counterpart to Solidity's `-` operator.\n *\n * Requirements:\n *\n * - Subtraction cannot overflow.\n */\n function sub(int256 a, int256 b) internal pure returns (int256) {\n return a - b;\n }\n\n /**\n * @dev Returns the addition of two signed integers, reverting on\n * overflow.\n *\n * Counterpart to Solidity's `+` operator.\n *\n * Requirements:\n *\n * - Addition cannot overflow.\n */\n function add(int256 a, int256 b) internal pure returns (int256) {\n return a + b;\n }\n}\n" - }, - "@uma/core/contracts/oracle/interfaces/FinderInterface.sol": { - "content": "// SPDX-License-Identifier: AGPL-3.0-only\npragma solidity ^0.8.0;\n\n/**\n * @title Provides addresses of the live contracts implementing certain interfaces.\n * @dev Examples are the Oracle or Store interfaces.\n */\ninterface FinderInterface {\n /**\n * @notice Updates the address of the contract that implements `interfaceName`.\n * @param interfaceName bytes32 encoding of the interface name that is either changed or registered.\n * @param implementationAddress address of the deployed contract that implements the interface.\n */\n function changeImplementationAddress(bytes32 interfaceName, address implementationAddress) external;\n\n /**\n * @notice Gets the address of the contract that implements the given `interfaceName`.\n * @param interfaceName queried interface.\n * @return implementationAddress address of the deployed contract that implements the interface.\n */\n function getImplementationAddress(bytes32 interfaceName) external view returns (address);\n}\n" - }, - "@uma/core/contracts/oracle/interfaces/IdentifierWhitelistInterface.sol": { - "content": "// SPDX-License-Identifier: AGPL-3.0-only\npragma solidity ^0.8.0;\n\n/**\n * @title Interface for whitelists of supported identifiers that the oracle can provide prices for.\n */\ninterface IdentifierWhitelistInterface {\n /**\n * @notice Adds the provided identifier as a supported identifier.\n * @dev Price requests using this identifier will succeed after this call.\n * @param identifier bytes32 encoding of the string identifier. Eg: BTC/USD.\n */\n function addSupportedIdentifier(bytes32 identifier) external;\n\n /**\n * @notice Removes the identifier from the whitelist.\n * @dev Price requests using this identifier will no longer succeed after this call.\n * @param identifier bytes32 encoding of the string identifier. Eg: BTC/USD.\n */\n function removeSupportedIdentifier(bytes32 identifier) external;\n\n /**\n * @notice Checks whether an identifier is on the whitelist.\n * @param identifier bytes32 encoding of the string identifier. Eg: BTC/USD.\n * @return bool if the identifier is supported (or not).\n */\n function isIdentifierSupported(bytes32 identifier) external view returns (bool);\n}\n" - }, - "@uma/core/contracts/common/interfaces/AddressWhitelistInterface.sol": { - "content": "// SPDX-License-Identifier: AGPL-3.0-only\npragma solidity ^0.8.0;\n\ninterface AddressWhitelistInterface {\n function addToWhitelist(address newElement) external;\n\n function removeFromWhitelist(address newElement) external;\n\n function isOnWhitelist(address newElement) external view returns (bool);\n\n function getWhitelist() external view returns (address[] memory);\n}\n" - }, - "@uma/core/contracts/common/implementation/AncillaryData.sol": { - "content": "// SPDX-License-Identifier: AGPL-3.0-only\npragma solidity ^0.8.0;\n\n/**\n * @title Library for encoding and decoding ancillary data for DVM price requests.\n * @notice We assume that on-chain ancillary data can be formatted directly from bytes to utf8 encoding via\n * web3.utils.hexToUtf8, and that clients will parse the utf8-encoded ancillary data as a comma-delimitted key-value\n * dictionary. Therefore, this library provides internal methods that aid appending to ancillary data from Solidity\n * smart contracts. More details on UMA's ancillary data guidelines below:\n * https://docs.google.com/document/d/1zhKKjgY1BupBGPPrY_WOJvui0B6DMcd-xDR8-9-SPDw/edit\n */\nlibrary AncillaryData {\n // This converts the bottom half of a bytes32 input to hex in a highly gas-optimized way.\n // Source: the brilliant implementation at https://gitter.im/ethereum/solidity?at=5840d23416207f7b0ed08c9b.\n function toUtf8Bytes32Bottom(bytes32 bytesIn) private pure returns (bytes32) {\n unchecked {\n uint256 x = uint256(bytesIn);\n\n // Nibble interleave\n x = x & 0x00000000000000000000000000000000ffffffffffffffffffffffffffffffff;\n x = (x | (x * 2**64)) & 0x0000000000000000ffffffffffffffff0000000000000000ffffffffffffffff;\n x = (x | (x * 2**32)) & 0x00000000ffffffff00000000ffffffff00000000ffffffff00000000ffffffff;\n x = (x | (x * 2**16)) & 0x0000ffff0000ffff0000ffff0000ffff0000ffff0000ffff0000ffff0000ffff;\n x = (x | (x * 2**8)) & 0x00ff00ff00ff00ff00ff00ff00ff00ff00ff00ff00ff00ff00ff00ff00ff00ff;\n x = (x | (x * 2**4)) & 0x0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f;\n\n // Hex encode\n uint256 h = (x & 0x0808080808080808080808080808080808080808080808080808080808080808) / 8;\n uint256 i = (x & 0x0404040404040404040404040404040404040404040404040404040404040404) / 4;\n uint256 j = (x & 0x0202020202020202020202020202020202020202020202020202020202020202) / 2;\n x = x + (h & (i | j)) * 0x27 + 0x3030303030303030303030303030303030303030303030303030303030303030;\n\n // Return the result.\n return bytes32(x);\n }\n }\n\n /**\n * @notice Returns utf8-encoded bytes32 string that can be read via web3.utils.hexToUtf8.\n * @dev Will return bytes32 in all lower case hex characters and without the leading 0x.\n * This has minor changes from the toUtf8BytesAddress to control for the size of the input.\n * @param bytesIn bytes32 to encode.\n * @return utf8 encoded bytes32.\n */\n function toUtf8Bytes(bytes32 bytesIn) internal pure returns (bytes memory) {\n return abi.encodePacked(toUtf8Bytes32Bottom(bytesIn >> 128), toUtf8Bytes32Bottom(bytesIn));\n }\n\n /**\n * @notice Returns utf8-encoded address that can be read via web3.utils.hexToUtf8.\n * Source: https://ethereum.stackexchange.com/questions/8346/convert-address-to-string/8447#8447\n * @dev Will return address in all lower case characters and without the leading 0x.\n * @param x address to encode.\n * @return utf8 encoded address bytes.\n */\n function toUtf8BytesAddress(address x) internal pure returns (bytes memory) {\n return\n abi.encodePacked(toUtf8Bytes32Bottom(bytes32(bytes20(x)) >> 128), bytes8(toUtf8Bytes32Bottom(bytes20(x))));\n }\n\n /**\n * @notice Converts a uint into a base-10, UTF-8 representation stored in a `string` type.\n * @dev This method is based off of this code: https://stackoverflow.com/a/65707309.\n */\n function toUtf8BytesUint(uint256 x) internal pure returns (bytes memory) {\n if (x == 0) {\n return \"0\";\n }\n uint256 j = x;\n uint256 len;\n while (j != 0) {\n len++;\n j /= 10;\n }\n bytes memory bstr = new bytes(len);\n uint256 k = len;\n while (x != 0) {\n k = k - 1;\n uint8 temp = (48 + uint8(x - (x / 10) * 10));\n bytes1 b1 = bytes1(temp);\n bstr[k] = b1;\n x /= 10;\n }\n return bstr;\n }\n\n function appendKeyValueBytes32(\n bytes memory currentAncillaryData,\n bytes memory key,\n bytes32 value\n ) internal pure returns (bytes memory) {\n bytes memory prefix = constructPrefix(currentAncillaryData, key);\n return abi.encodePacked(currentAncillaryData, prefix, toUtf8Bytes(value));\n }\n\n /**\n * @notice Adds \"key:value\" to `currentAncillaryData` where `value` is an address that first needs to be converted\n * to utf8 bytes. For example, if `utf8(currentAncillaryData)=\"k1:v1\"`, then this function will return\n * `utf8(k1:v1,key:value)`, and if `currentAncillaryData` is blank, then this will return `utf8(key:value)`.\n * @param currentAncillaryData This bytes data should ideally be able to be utf8-decoded, but its OK if not.\n * @param key Again, this bytes data should ideally be able to be utf8-decoded, but its OK if not.\n * @param value An address to set as the value in the key:value pair to append to `currentAncillaryData`.\n * @return Newly appended ancillary data.\n */\n function appendKeyValueAddress(\n bytes memory currentAncillaryData,\n bytes memory key,\n address value\n ) internal pure returns (bytes memory) {\n bytes memory prefix = constructPrefix(currentAncillaryData, key);\n return abi.encodePacked(currentAncillaryData, prefix, toUtf8BytesAddress(value));\n }\n\n /**\n * @notice Adds \"key:value\" to `currentAncillaryData` where `value` is a uint that first needs to be converted\n * to utf8 bytes. For example, if `utf8(currentAncillaryData)=\"k1:v1\"`, then this function will return\n * `utf8(k1:v1,key:value)`, and if `currentAncillaryData` is blank, then this will return `utf8(key:value)`.\n * @param currentAncillaryData This bytes data should ideally be able to be utf8-decoded, but its OK if not.\n * @param key Again, this bytes data should ideally be able to be utf8-decoded, but its OK if not.\n * @param value A uint to set as the value in the key:value pair to append to `currentAncillaryData`.\n * @return Newly appended ancillary data.\n */\n function appendKeyValueUint(\n bytes memory currentAncillaryData,\n bytes memory key,\n uint256 value\n ) internal pure returns (bytes memory) {\n bytes memory prefix = constructPrefix(currentAncillaryData, key);\n return abi.encodePacked(currentAncillaryData, prefix, toUtf8BytesUint(value));\n }\n\n /**\n * @notice Helper method that returns the left hand side of a \"key:value\" pair plus the colon \":\" and a leading\n * comma \",\" if the `currentAncillaryData` is not empty. The return value is intended to be prepended as a prefix to\n * some utf8 value that is ultimately added to a comma-delimited, key-value dictionary.\n */\n function constructPrefix(bytes memory currentAncillaryData, bytes memory key) internal pure returns (bytes memory) {\n if (currentAncillaryData.length > 0) {\n return abi.encodePacked(\",\", key, \":\");\n } else {\n return abi.encodePacked(key, \":\");\n }\n }\n}\n" - }, - "@uma/core/contracts/oracle/implementation/Constants.sol": { - "content": "// SPDX-License-Identifier: AGPL-3.0-only\npragma solidity ^0.8.0;\n\n/**\n * @title Stores common interface names used throughout the DVM by registration in the Finder.\n */\nlibrary OracleInterfaces {\n bytes32 public constant Oracle = \"Oracle\";\n bytes32 public constant IdentifierWhitelist = \"IdentifierWhitelist\";\n bytes32 public constant Store = \"Store\";\n bytes32 public constant FinancialContractsAdmin = \"FinancialContractsAdmin\";\n bytes32 public constant Registry = \"Registry\";\n bytes32 public constant CollateralWhitelist = \"CollateralWhitelist\";\n bytes32 public constant OptimisticOracle = \"OptimisticOracle\";\n bytes32 public constant Bridge = \"Bridge\";\n bytes32 public constant GenericHandler = \"GenericHandler\";\n bytes32 public constant SkinnyOptimisticOracle = \"SkinnyOptimisticOracle\";\n bytes32 public constant ChildMessenger = \"ChildMessenger\";\n bytes32 public constant OracleHub = \"OracleHub\";\n bytes32 public constant OracleSpoke = \"OracleSpoke\";\n}\n\n/**\n * @title Commonly re-used values for contracts associated with the OptimisticOracle.\n */\nlibrary OptimisticOracleConstraints {\n // Any price request submitted to the OptimisticOracle must contain ancillary data no larger than this value.\n // This value must be <= the Voting contract's `ancillaryBytesLimit` constant value otherwise it is possible\n // that a price can be requested to the OptimisticOracle successfully, but cannot be resolved by the DVM which\n // refuses to accept a price request made with ancillary data length over a certain size.\n uint256 public constant ancillaryBytesLimit = 8192;\n}\n" - }, - "contracts/Lockable.sol": { - "content": "// SPDX-License-Identifier: AGPL-3.0-only\r\npragma solidity ^0.8.0;\r\n\r\n/**\r\n * @title A contract that provides modifiers to prevent reentrancy to state-changing and view-only methods. This contract\r\n * is inspired by https://github.com/OpenZeppelin/openzeppelin-contracts/blob/master/contracts/utils/ReentrancyGuard.sol\r\n * and https://github.com/balancer-labs/balancer-core/blob/master/contracts/BPool.sol.\r\n */\r\ncontract Lockable {\r\n bool internal _notEntered;\r\n\r\n constructor() {\r\n // Storing an initial non-zero value makes deployment a bit more expensive, but in exchange the refund on every\r\n // call to nonReentrant will be lower in amount. Since refunds are capped to a percentage of the total\r\n // transaction's gas, it is best to keep them low in cases like this one, to increase the likelihood of the full\r\n // refund coming into effect.\r\n _notEntered = true;\r\n }\r\n\r\n /**\r\n * @dev Prevents a contract from calling itself, directly or indirectly.\r\n * Calling a `nonReentrant` function from another `nonReentrant` function is not supported. It is possible to\r\n * prevent this from happening by making the `nonReentrant` function external, and making it call a `private`\r\n * function that does the actual state modification.\r\n */\r\n modifier nonReentrant() {\r\n _preEntranceCheck();\r\n _preEntranceSet();\r\n _;\r\n _postEntranceReset();\r\n }\r\n\r\n /**\r\n * @dev Designed to prevent a view-only method from being re-entered during a call to a `nonReentrant()` state-changing method.\r\n */\r\n modifier nonReentrantView() {\r\n _preEntranceCheck();\r\n _;\r\n }\r\n\r\n /**\r\n * @dev Returns true if the contract is currently in a non-entered state, meaning that the origination of the call\r\n * came from outside the contract. This is relevant with fallback/receive methods to see if the call came from ETH\r\n * being dropped onto the contract externally or due to ETH dropped on the the contract from within a method in this\r\n * contract, such as unwrapping WETH to ETH within the contract.\r\n */\r\n function functionCallStackOriginatesFromOutsideThisContract() internal view returns (bool) {\r\n return _notEntered;\r\n }\r\n\r\n // Internal methods are used to avoid copying the require statement's bytecode to every `nonReentrant()` method.\r\n // On entry into a function, `_preEntranceCheck()` should always be called to check if the function is being\r\n // re-entered. Then, if the function modifies state, it should call `_postEntranceSet()`, perform its logic, and\r\n // then call `_postEntranceReset()`.\r\n // View-only methods can simply call `_preEntranceCheck()` to make sure that it is not being re-entered.\r\n function _preEntranceCheck() internal view {\r\n // On the first call to nonReentrant, _notEntered will be true\r\n require(_notEntered, \"ReentrancyGuard: reentrant call\");\r\n }\r\n\r\n function _preEntranceSet() internal {\r\n // Any calls to nonReentrant after this point will fail\r\n _notEntered = false;\r\n }\r\n\r\n function _postEntranceReset() internal {\r\n // By storing the original value once again, a refund is triggered (see\r\n // https://eips.ethereum.org/EIPS/eip-2200)\r\n _notEntered = true;\r\n }\r\n}\r\n" - } - }, - "settings": { - "optimizer": { - "enabled": true, - "runs": 1000000 - }, - "outputSelection": { - "*": { - "*": [ - "abi", - "evm.bytecode", - "evm.deployedBytecode", - "evm.methodIdentifiers", - "metadata", - "devdoc", - "userdoc", - "storageLayout", - "evm.gasEstimates" - ], - "": ["ast"] - } - }, - "metadata": { - "useLiteralContent": true - } - } -} From a7d669560d6e651a762209387d72b05fbc09cf97 Mon Sep 17 00:00:00 2001 From: nicholaspai Date: Mon, 21 Mar 2022 18:24:19 -0400 Subject: [PATCH 05/11] finish arbitrum war games --- deploy/004_deploy_arbitrum_adapter.ts | 2 +- deploy/consts.ts | 6 +-- deployments/rinkeby/Arbitrum_Adapter.json | 36 ++++++------- ... => fc82eeb0fff4196cd4e0dfec8a3b3aca.json} | 2 +- scripts/setupArbitrumSpokePool.ts | 23 +++++++++ test/chain-adapters/Arbitrum_Adapter.ts | 51 ++++++++++++++----- test/chain-adapters/Optimism_Adapter.ts | 2 - test/constants.ts | 7 +-- 8 files changed, 87 insertions(+), 42 deletions(-) rename deployments/rinkeby/solcInputs/{c8b9349311d8b5049b613ac98eb998d0.json => fc82eeb0fff4196cd4e0dfec8a3b3aca.json} (97%) create mode 100644 scripts/setupArbitrumSpokePool.ts diff --git a/deploy/004_deploy_arbitrum_adapter.ts b/deploy/004_deploy_arbitrum_adapter.ts index 0010e1e5d..0f62a1064 100644 --- a/deploy/004_deploy_arbitrum_adapter.ts +++ b/deploy/004_deploy_arbitrum_adapter.ts @@ -18,7 +18,7 @@ const func = async function (hre: HardhatRuntimeEnvironment) { from: deployer, log: true, skipIfAlreadyDeployed: true, - args: [L1_ADDRESS_MAP[chainId].l1ArbitrumInbox, L1_ADDRESS_MAP[chainId].l1ERC20Gateway], + args: [L1_ADDRESS_MAP[chainId].l1ArbitrumInbox, L1_ADDRESS_MAP[chainId].l1ERC20GatewayRouter], }); }; diff --git a/deploy/consts.ts b/deploy/consts.ts index 2e7639780..e98224394 100644 --- a/deploy/consts.ts +++ b/deploy/consts.ts @@ -14,7 +14,7 @@ export const L1_ADDRESS_MAP: { [key: number]: { [contractName: string]: string } weth: "0xc778417E063141139Fce010982780140Aa0cD5Ab", finder: "0xbb6206fb01fAad31e8aaFc3AD303cEA89D8c8157", l1ArbitrumInbox: "0x578BAde599406A8fE3d24Fd7f7211c0911F5B29e", // Should be listed as "DelayedInbox" here: https://developer.offchainlabs.com/docs/useful_addresses - l1ERC20Gateway: "0x70C143928eCfFaf9F5b406f7f4fC28Dc43d68380", // Should be listed as "L1 ERC20 Gateway Router" here: https://developer.offchainlabs.com/docs/useful_addresses + l1ERC20GatewayRouter: "0x70C143928eCfFaf9F5b406f7f4fC28Dc43d68380", // Should be listed as "L1 ERC20 Gateway Router" here: https://developer.offchainlabs.com/docs/useful_addresses optimismCrossDomainMessenger: "0x25ace71c97B33Cc4729CF772ae268934F7ab5fA1", // dummy: Optimism's testnet is kovan optimismStandardBridge: "0x99C9fc46f92E8a1c0deC1b1747d010903E884bE1", // dummy: Optimism's testnet is kovan polygonRootChainManager: "0xBbD7cBFA79faee899Eaf900F13C9065bF03B1A74", // dummy: Polygon's testnet is goerli @@ -24,7 +24,7 @@ export const L1_ADDRESS_MAP: { [key: number]: { [contractName: string]: string } optimismCrossDomainMessenger: "0x25ace71c97B33Cc4729CF772ae268934F7ab5fA1", // dummy: Optimism's testnet is kovan optimismStandardBridge: "0x99C9fc46f92E8a1c0deC1b1747d010903E884bE1", // dummy: Optimism's testnet is kovan l1ArbitrumInbox: "0x578BAde599406A8fE3d24Fd7f7211c0911F5B29e", // dummy: Arbitrum's testnet is rinkeby - l1ERC20Gateway: "0x70C143928eCfFaf9F5b406f7f4fC28Dc43d68380", // dummy: Arbitrum's testnet is rinkeby + l1ERC20GatewayRouter: "0x70C143928eCfFaf9F5b406f7f4fC28Dc43d68380", // dummy: Arbitrum's testnet is rinkeby finder: "0xDC6b80D38004F495861E081e249213836a2F3217", polygonRootChainManager: "0xBbD7cBFA79faee899Eaf900F13C9065bF03B1A74", polygonFxRoot: "0x3d1d3E34f7fB6D26245E6640E1c50710eFFf15bA", @@ -32,7 +32,7 @@ export const L1_ADDRESS_MAP: { [key: number]: { [contractName: string]: string } }, 42: { l1ArbitrumInbox: "0x578BAde599406A8fE3d24Fd7f7211c0911F5B29e", // dummy: Arbitrum's testnet is rinkeby - l1ERC20Gateway: "0x70C143928eCfFaf9F5b406f7f4fC28Dc43d68380", // dummy: Arbitrum's testnet is rinkeby + l1ERC20GatewayRouter: "0x70C143928eCfFaf9F5b406f7f4fC28Dc43d68380", // dummy: Arbitrum's testnet is rinkeby optimismCrossDomainMessenger: "0x4361d0F75A0186C05f971c566dC6bEa5957483fD", weth: "0xd0A1E359811322d97991E03f863a0C30C2cF029C", optimismStandardBridge: "0x22F24361D548e5FaAfb36d1437839f080363982B", diff --git a/deployments/rinkeby/Arbitrum_Adapter.json b/deployments/rinkeby/Arbitrum_Adapter.json index b213a1d7a..5d851f904 100644 --- a/deployments/rinkeby/Arbitrum_Adapter.json +++ b/deployments/rinkeby/Arbitrum_Adapter.json @@ -1,5 +1,5 @@ { - "address": "0x1f3774939f477D54962EC0961545E782D5475B32", + "address": "0x18F4D98C7CeA6Ab934F2976c2a98009A529d8F49", "abi": [ { "inputs": [ @@ -10,7 +10,7 @@ }, { "internalType": "contract ArbitrumL1ERC20GatewayLike", - "name": "_l1ERC20Gateway", + "name": "_l1ERC20GatewayRouter", "type": "address" } ], @@ -82,7 +82,7 @@ }, { "inputs": [], - "name": "l1ERC20Gateway", + "name": "l1ERC20GatewayRouter", "outputs": [ { "internalType": "contract ArbitrumL1ERC20GatewayLike", @@ -205,28 +205,28 @@ "type": "function" } ], - "transactionHash": "0x778817240ebd86869141f3196957b4c3d0505dd5247a4108e5fcd1e64a0a2792", + "transactionHash": "0xb1dc1a8b06e95f6ba0d0ed36305e4e0eb27ea105d10d5abc1c9039bfbf9009e6", "receipt": { "to": null, "from": "0x9A8f92a830A5cB89a3816e3D267CB7791c16b04D", - "contractAddress": "0x1f3774939f477D54962EC0961545E782D5475B32", - "transactionIndex": 72, - "gasUsed": "644324", + "contractAddress": "0x18F4D98C7CeA6Ab934F2976c2a98009A529d8F49", + "transactionIndex": 6, + "gasUsed": "993269", "logsBloom": "0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", - "blockHash": "0xa43b341ea15163300bc2048b621c47b8ef1fb5802353336fb7314d33d5ad98b2", - "transactionHash": "0x778817240ebd86869141f3196957b4c3d0505dd5247a4108e5fcd1e64a0a2792", + "blockHash": "0x7728a44de00f1ba694c99c5fe6e5d6cd441be8fea6e620e3c6c9eb714cafef1e", + "transactionHash": "0xb1dc1a8b06e95f6ba0d0ed36305e4e0eb27ea105d10d5abc1c9039bfbf9009e6", "logs": [], - "blockNumber": 10365601, - "cumulativeGasUsed": "7380891", + "blockNumber": 10367195, + "cumulativeGasUsed": "1665421", "status": 1, "byzantium": true }, - "args": ["0x578BAde599406A8fE3d24Fd7f7211c0911F5B29e", "0x91169Dbb45e6804743F94609De50D511C437572E"], + "args": ["0x578BAde599406A8fE3d24Fd7f7211c0911F5B29e", "0x70C143928eCfFaf9F5b406f7f4fC28Dc43d68380"], "numDeployments": 1, - "solcInputHash": "c8b9349311d8b5049b613ac98eb998d0", - "metadata": "{\"compiler\":{\"version\":\"0.8.13+commit.abaa5c0e\"},\"language\":\"Solidity\",\"output\":{\"abi\":[{\"inputs\":[{\"internalType\":\"contract ArbitrumL1InboxLike\",\"name\":\"_l1ArbitrumInbox\",\"type\":\"address\"},{\"internalType\":\"contract ArbitrumL1ERC20GatewayLike\",\"name\":\"_l1ERC20Gateway\",\"type\":\"address\"}],\"stateMutability\":\"nonpayable\",\"type\":\"constructor\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"address\",\"name\":\"target\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"bytes\",\"name\":\"message\",\"type\":\"bytes\"}],\"name\":\"MessageRelayed\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"address\",\"name\":\"l1Token\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"address\",\"name\":\"l2Token\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"address\",\"name\":\"to\",\"type\":\"address\"}],\"name\":\"TokensRelayed\",\"type\":\"event\"},{\"inputs\":[],\"name\":\"getL1CallValue\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"pure\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"l1ERC20Gateway\",\"outputs\":[{\"internalType\":\"contract ArbitrumL1ERC20GatewayLike\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"l1Inbox\",\"outputs\":[{\"internalType\":\"contract ArbitrumL1InboxLike\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"l2GasLimit\",\"outputs\":[{\"internalType\":\"uint32\",\"name\":\"\",\"type\":\"uint32\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"l2GasPrice\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"l2MaxSubmissionCost\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"l2RefundL2Address\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"target\",\"type\":\"address\"},{\"internalType\":\"bytes\",\"name\":\"message\",\"type\":\"bytes\"}],\"name\":\"relayMessage\",\"outputs\":[],\"stateMutability\":\"payable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"l1Token\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"l2Token\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"},{\"internalType\":\"address\",\"name\":\"to\",\"type\":\"address\"}],\"name\":\"relayTokens\",\"outputs\":[],\"stateMutability\":\"payable\",\"type\":\"function\"}],\"devdoc\":{\"details\":\"Public functions calling external contracts do not guard against reentrancy because they are expected to be called via delegatecall, which will execute this contract's logic within the context of the originating contract. For example, the HubPool will delegatecall these functions, therefore its only necessary that the HubPool's methods that call this contract's logic guard against reentrancy.\",\"kind\":\"dev\",\"methods\":{\"constructor\":{\"params\":{\"_l1ArbitrumInbox\":\"Inbox helper contract to send messages to Arbitrum.\",\"_l1ERC20Gateway\":\"ERC20 gateway contract to send tokens to Arbitrum.\"}},\"getL1CallValue()\":{\"returns\":{\"_0\":\"amount of ETH that this contract needs to hold in order for relayMessage to succeed.\"}},\"relayMessage(address,bytes)\":{\"params\":{\"message\":\"Data to send to target.\",\"target\":\"Contract on Arbitrum that will receive message.\"}},\"relayTokens(address,address,uint256,address)\":{\"params\":{\"amount\":\"Amount of L1 tokens to deposit and L2 tokens to receive.\",\"l1Token\":\"L1 token to deposit.\",\"l2Token\":\"L2 token to receive.\",\"to\":\"Bridge recipient.\"}}},\"version\":1},\"userdoc\":{\"kind\":\"user\",\"methods\":{\"constructor\":{\"notice\":\"Constructs new Adapter.\"},\"getL1CallValue()\":{\"notice\":\"Returns required amount of ETH to send a message via the Inbox.\"},\"relayMessage(address,bytes)\":{\"notice\":\"Send cross-chain message to target on Arbitrum.This contract must hold at least getL1CallValue() amount of ETH to send a message via the Inbox successfully, or the message will get stuck.\"},\"relayTokens(address,address,uint256,address)\":{\"notice\":\"Bridge tokens to Arbitrum.\"}},\"notice\":\"Contract containing logic to send messages from L1 to Arbitrum.\",\"version\":1}},\"settings\":{\"compilationTarget\":{\"contracts/chain-adapters/Arbitrum_Adapter.sol\":\"Arbitrum_Adapter\"},\"evmVersion\":\"london\",\"libraries\":{},\"metadata\":{\"bytecodeHash\":\"ipfs\",\"useLiteralContent\":true},\"optimizer\":{\"enabled\":true,\"runs\":1000000},\"remappings\":[]},\"sources\":{\"contracts/chain-adapters/Arbitrum_Adapter.sol\":{\"content\":\"// SPDX-License-Identifier: AGPL-3.0-only\\npragma solidity ^0.8.0;\\n\\nimport \\\"../interfaces/AdapterInterface.sol\\\";\\n\\ninterface ArbitrumL1InboxLike {\\n function createRetryableTicket(\\n address destAddr,\\n uint256 arbTxCallValue,\\n uint256 maxSubmissionCost,\\n address submissionRefundAddress,\\n address valueRefundAddress,\\n uint256 maxGas,\\n uint256 gasPriceBid,\\n bytes calldata data\\n ) external payable returns (uint256);\\n}\\n\\ninterface ArbitrumL1ERC20GatewayLike {\\n function outboundTransfer(\\n address _token,\\n address _to,\\n uint256 _amount,\\n uint256 _maxGas,\\n uint256 _gasPriceBid,\\n bytes calldata _data\\n ) external payable returns (bytes memory);\\n}\\n\\n/**\\n * @notice Contract containing logic to send messages from L1 to Arbitrum.\\n * @dev Public functions calling external contracts do not guard against reentrancy because they are expected to be\\n * called via delegatecall, which will execute this contract's logic within the context of the originating contract.\\n * For example, the HubPool will delegatecall these functions, therefore its only necessary that the HubPool's methods\\n * that call this contract's logic guard against reentrancy.\\n */\\ncontract Arbitrum_Adapter is AdapterInterface {\\n // Gas limit for immediate L2 execution attempt (can be estimated via NodeInterface.estimateRetryableTicket).\\n // NodeInterface precompile interface exists at L2 address 0x00000000000000000000000000000000000000C8\\n uint32 public immutable l2GasLimit = 5_000_000;\\n\\n // Amount of ETH allocated to pay for the base submission fee. The base submission fee is a parameter unique to\\n // retryable transactions; the user is charged the base submission fee to cover the storage costs of keeping their\\n // ticket\\u2019s calldata in the retry buffer. (current base submission fee is queryable via\\n // ArbRetryableTx.getSubmissionPrice). ArbRetryableTicket precompile interface exists at L2 address\\n // 0x000000000000000000000000000000000000006E.\\n uint256 public immutable l2MaxSubmissionCost = 0.1e18;\\n\\n // L2 Gas price bid for immediate L2 execution attempt (queryable via standard eth*gasPrice RPC)\\n uint256 public immutable l2GasPrice = 10e9; // 10 gWei\\n\\n // This address on L2 receives extra ETH that is left over after relaying a message via the inbox.\\n address public immutable l2RefundL2Address;\\n\\n ArbitrumL1InboxLike public immutable l1Inbox;\\n\\n ArbitrumL1ERC20GatewayLike public immutable l1ERC20Gateway;\\n\\n /**\\n * @notice Constructs new Adapter.\\n * @param _l1ArbitrumInbox Inbox helper contract to send messages to Arbitrum.\\n * @param _l1ERC20Gateway ERC20 gateway contract to send tokens to Arbitrum.\\n */\\n constructor(ArbitrumL1InboxLike _l1ArbitrumInbox, ArbitrumL1ERC20GatewayLike _l1ERC20Gateway) {\\n l1Inbox = _l1ArbitrumInbox;\\n l1ERC20Gateway = _l1ERC20Gateway;\\n\\n l2RefundL2Address = msg.sender;\\n }\\n\\n /**\\n * @notice Send cross-chain message to target on Arbitrum.\\n * @notice This contract must hold at least getL1CallValue() amount of ETH to send a message via the Inbox\\n * successfully, or the message will get stuck.\\n * @param target Contract on Arbitrum that will receive message.\\n * @param message Data to send to target.\\n */\\n function relayMessage(address target, bytes memory message) external payable override {\\n uint256 requiredL1CallValue = getL1CallValue();\\n require(address(this).balance >= requiredL1CallValue, \\\"Insufficient ETH balance\\\");\\n\\n l1Inbox.createRetryableTicket{ value: requiredL1CallValue }(\\n target, // destAddr destination L2 contract address\\n 0, // l2CallValue call value for retryable L2 message\\n l2MaxSubmissionCost, // maxSubmissionCost Max gas deducted from user's L2 balance to cover base fee\\n l2RefundL2Address, // excessFeeRefundAddress maxgas * gasprice - execution cost gets credited here on L2\\n l2RefundL2Address, // callValueRefundAddress l2Callvalue gets credited here on L2 if retryable txn times out or gets cancelled\\n l2GasLimit, // maxGas Max gas deducted from user's L2 balance to cover L2 execution\\n l2GasPrice, // gasPriceBid price bid for L2 execution\\n message // data ABI encoded data of L2 message\\n );\\n\\n emit MessageRelayed(target, message);\\n }\\n\\n /**\\n * @notice Bridge tokens to Arbitrum.\\n * @param l1Token L1 token to deposit.\\n * @param l2Token L2 token to receive.\\n * @param amount Amount of L1 tokens to deposit and L2 tokens to receive.\\n * @param to Bridge recipient.\\n */\\n function relayTokens(\\n address l1Token,\\n address l2Token, // l2Token is unused for Arbitrum.\\n uint256 amount,\\n address to\\n ) external payable override {\\n l1ERC20Gateway.outboundTransfer(l1Token, to, amount, l2GasLimit, l2GasPrice, \\\"\\\");\\n emit TokensRelayed(l1Token, l2Token, amount, to);\\n }\\n\\n /**\\n * @notice Returns required amount of ETH to send a message via the Inbox.\\n * @return amount of ETH that this contract needs to hold in order for relayMessage to succeed.\\n */\\n function getL1CallValue() public pure returns (uint256) {\\n return l2MaxSubmissionCost + l2GasPrice * l2GasLimit;\\n }\\n}\\n\",\"keccak256\":\"0xd81b9aa219cd11f97cae6bc1ab5ca6b013a7021be5baac97cd25be637bda69bb\",\"license\":\"AGPL-3.0-only\"},\"contracts/interfaces/AdapterInterface.sol\":{\"content\":\"// SPDX-License-Identifier: AGPL-3.0-only\\npragma solidity ^0.8.0;\\n\\n/**\\n * @notice Sends cross chain messages and tokens to contracts on a specific L2 network.\\n */\\n\\ninterface AdapterInterface {\\n event MessageRelayed(address target, bytes message);\\n\\n event TokensRelayed(address l1Token, address l2Token, uint256 amount, address to);\\n\\n function relayMessage(address target, bytes memory message) external payable;\\n\\n function relayTokens(\\n address l1Token,\\n address l2Token,\\n uint256 amount,\\n address to\\n ) external payable;\\n}\\n\",\"keccak256\":\"0xbd7091006acbdfe72b21ce985f964f0682a2316d9d3b38967beeb55f4ae5118c\",\"license\":\"AGPL-3.0-only\"}},\"version\":1}", - "bytecode": "0x610140604052624c4b4060805267016345785d8a000060a0526402540be40060c05234801561002d57600080fd5b50604051610c11380380610c1183398101604081905261004c91610081565b6001600160a01b039182166101005216610120523360e0526100bb565b6001600160a01b038116811461007e57600080fd5b50565b6000806040838503121561009457600080fd5b825161009f81610069565b60208401519092506100b081610069565b809150509250929050565b60805160a05160c05160e0516101005161012051610abb6101566000396000818160d50152610392015260008181610143015261053e0152600081816101ab01526105940152600081816101770152818161028b0152818161035e01526105da015260008181610228015281816102b501526105720152600081816101df015281816102690152818161033701526105b80152610abb6000f3fe6080604052600436106100965760003560e01c80639ae3668511610069578063cf6e65b71161004e578063cf6e65b7146101cd578063e599477e14610216578063e6eb8ade1461024a57600080fd5b80639ae36685146101655780639c3ba2001461019957600080fd5b806308f1ed151461009b5780630e283a6a146100c357806352c8c75c1461011c5780638134f38514610131575b600080fd5b3480156100a757600080fd5b506100b061025d565b6040519081526020015b60405180910390f35b3480156100cf57600080fd5b506100f77f000000000000000000000000000000000000000000000000000000000000000081565b60405173ffffffffffffffffffffffffffffffffffffffff90911681526020016100ba565b61012f61012a3660046106af565b6102de565b005b34801561013d57600080fd5b506100f77f000000000000000000000000000000000000000000000000000000000000000081565b34801561017157600080fd5b506100b07f000000000000000000000000000000000000000000000000000000000000000081565b3480156101a557600080fd5b506100f77f000000000000000000000000000000000000000000000000000000000000000081565b3480156101d957600080fd5b506102017f000000000000000000000000000000000000000000000000000000000000000081565b60405163ffffffff90911681526020016100ba565b34801561022257600080fd5b506100b07f000000000000000000000000000000000000000000000000000000000000000081565b61012f6102583660046107c0565b610487565b60006102af63ffffffff7f0000000000000000000000000000000000000000000000000000000000000000167f0000000000000000000000000000000000000000000000000000000000000000610880565b6102d9907f00000000000000000000000000000000000000000000000000000000000000006108bd565b905090565b6040517fd2ce7d6500000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff858116600483015282811660248301526044820184905263ffffffff7f00000000000000000000000000000000000000000000000000000000000000001660648301527f0000000000000000000000000000000000000000000000000000000000000000608483015260c060a4830152600060c48301527f0000000000000000000000000000000000000000000000000000000000000000169063d2ce7d659060e4016000604051808303816000875af11580156103db573d6000803e3d6000fd5b505050506040513d6000823e601f3d9081017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe01682016040526104219190810190610905565b506040805173ffffffffffffffffffffffffffffffffffffffff868116825285811660208301528183018590528316606082015290517fd7e09655439c3932e55857df3220186e5a7f0980825f20691c2b35d941dee75b9181900360800190a150505050565b600061049161025d565b905080471015610501576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601860248201527f496e73756666696369656e74204554482062616c616e63650000000000000000604482015260640160405180910390fd5b6040517f679b6ded00000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff7f0000000000000000000000000000000000000000000000000000000000000000169063679b6ded9083906106049087906000907f0000000000000000000000000000000000000000000000000000000000000000907f00000000000000000000000000000000000000000000000000000000000000009081907f0000000000000000000000000000000000000000000000000000000000000000907f0000000000000000000000000000000000000000000000000000000000000000908d906004016109c6565b60206040518083038185885af1158015610622573d6000803e3d6000fd5b50505050506040513d601f19601f820116820180604052508101906106479190610a35565b507f9e6c52944e331ba6270e7fe4cea2a4086bae8f7a27e1cdba07f416806f5d0ac48383604051610679929190610a4e565b60405180910390a1505050565b803573ffffffffffffffffffffffffffffffffffffffff811681146106aa57600080fd5b919050565b600080600080608085870312156106c557600080fd5b6106ce85610686565b93506106dc60208601610686565b9250604085013591506106f160608601610686565b905092959194509250565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b604051601f82017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe016810167ffffffffffffffff81118282101715610772576107726106fc565b604052919050565b600067ffffffffffffffff821115610794576107946106fc565b50601f017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe01660200190565b600080604083850312156107d357600080fd5b6107dc83610686565b9150602083013567ffffffffffffffff8111156107f857600080fd5b8301601f8101851361080957600080fd5b803561081c6108178261077a565b61072b565b81815286602083850101111561083157600080fd5b816020840160208301376000602083830101528093505050509250929050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b6000817fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff04831182151516156108b8576108b8610851565b500290565b600082198211156108d0576108d0610851565b500190565b60005b838110156108f05781810151838201526020016108d8565b838111156108ff576000848401525b50505050565b60006020828403121561091757600080fd5b815167ffffffffffffffff81111561092e57600080fd5b8201601f8101841361093f57600080fd5b805161094d6108178261077a565b81815285602083850101111561096257600080fd5b6109738260208301602086016108d5565b95945050505050565b600081518084526109948160208601602086016108d5565b601f017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0169290920160200192915050565b600061010073ffffffffffffffffffffffffffffffffffffffff808c1684528a6020850152896040850152808916606085015280881660808501525063ffffffff861660a08401528460c08401528060e0840152610a268184018561097c565b9b9a5050505050505050505050565b600060208284031215610a4757600080fd5b5051919050565b73ffffffffffffffffffffffffffffffffffffffff83168152604060208201526000610a7d604083018461097c565b94935050505056fea26469706673582212201138a6fca9cde9a32c1accbbb9cfaeced745b08b0ff836da36e0cc9731508d6364736f6c634300080d0033", - "deployedBytecode": "0x6080604052600436106100965760003560e01c80639ae3668511610069578063cf6e65b71161004e578063cf6e65b7146101cd578063e599477e14610216578063e6eb8ade1461024a57600080fd5b80639ae36685146101655780639c3ba2001461019957600080fd5b806308f1ed151461009b5780630e283a6a146100c357806352c8c75c1461011c5780638134f38514610131575b600080fd5b3480156100a757600080fd5b506100b061025d565b6040519081526020015b60405180910390f35b3480156100cf57600080fd5b506100f77f000000000000000000000000000000000000000000000000000000000000000081565b60405173ffffffffffffffffffffffffffffffffffffffff90911681526020016100ba565b61012f61012a3660046106af565b6102de565b005b34801561013d57600080fd5b506100f77f000000000000000000000000000000000000000000000000000000000000000081565b34801561017157600080fd5b506100b07f000000000000000000000000000000000000000000000000000000000000000081565b3480156101a557600080fd5b506100f77f000000000000000000000000000000000000000000000000000000000000000081565b3480156101d957600080fd5b506102017f000000000000000000000000000000000000000000000000000000000000000081565b60405163ffffffff90911681526020016100ba565b34801561022257600080fd5b506100b07f000000000000000000000000000000000000000000000000000000000000000081565b61012f6102583660046107c0565b610487565b60006102af63ffffffff7f0000000000000000000000000000000000000000000000000000000000000000167f0000000000000000000000000000000000000000000000000000000000000000610880565b6102d9907f00000000000000000000000000000000000000000000000000000000000000006108bd565b905090565b6040517fd2ce7d6500000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff858116600483015282811660248301526044820184905263ffffffff7f00000000000000000000000000000000000000000000000000000000000000001660648301527f0000000000000000000000000000000000000000000000000000000000000000608483015260c060a4830152600060c48301527f0000000000000000000000000000000000000000000000000000000000000000169063d2ce7d659060e4016000604051808303816000875af11580156103db573d6000803e3d6000fd5b505050506040513d6000823e601f3d9081017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe01682016040526104219190810190610905565b506040805173ffffffffffffffffffffffffffffffffffffffff868116825285811660208301528183018590528316606082015290517fd7e09655439c3932e55857df3220186e5a7f0980825f20691c2b35d941dee75b9181900360800190a150505050565b600061049161025d565b905080471015610501576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601860248201527f496e73756666696369656e74204554482062616c616e63650000000000000000604482015260640160405180910390fd5b6040517f679b6ded00000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff7f0000000000000000000000000000000000000000000000000000000000000000169063679b6ded9083906106049087906000907f0000000000000000000000000000000000000000000000000000000000000000907f00000000000000000000000000000000000000000000000000000000000000009081907f0000000000000000000000000000000000000000000000000000000000000000907f0000000000000000000000000000000000000000000000000000000000000000908d906004016109c6565b60206040518083038185885af1158015610622573d6000803e3d6000fd5b50505050506040513d601f19601f820116820180604052508101906106479190610a35565b507f9e6c52944e331ba6270e7fe4cea2a4086bae8f7a27e1cdba07f416806f5d0ac48383604051610679929190610a4e565b60405180910390a1505050565b803573ffffffffffffffffffffffffffffffffffffffff811681146106aa57600080fd5b919050565b600080600080608085870312156106c557600080fd5b6106ce85610686565b93506106dc60208601610686565b9250604085013591506106f160608601610686565b905092959194509250565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b604051601f82017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe016810167ffffffffffffffff81118282101715610772576107726106fc565b604052919050565b600067ffffffffffffffff821115610794576107946106fc565b50601f017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe01660200190565b600080604083850312156107d357600080fd5b6107dc83610686565b9150602083013567ffffffffffffffff8111156107f857600080fd5b8301601f8101851361080957600080fd5b803561081c6108178261077a565b61072b565b81815286602083850101111561083157600080fd5b816020840160208301376000602083830101528093505050509250929050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b6000817fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff04831182151516156108b8576108b8610851565b500290565b600082198211156108d0576108d0610851565b500190565b60005b838110156108f05781810151838201526020016108d8565b838111156108ff576000848401525b50505050565b60006020828403121561091757600080fd5b815167ffffffffffffffff81111561092e57600080fd5b8201601f8101841361093f57600080fd5b805161094d6108178261077a565b81815285602083850101111561096257600080fd5b6109738260208301602086016108d5565b95945050505050565b600081518084526109948160208601602086016108d5565b601f017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0169290920160200192915050565b600061010073ffffffffffffffffffffffffffffffffffffffff808c1684528a6020850152896040850152808916606085015280881660808501525063ffffffff861660a08401528460c08401528060e0840152610a268184018561097c565b9b9a5050505050505050505050565b600060208284031215610a4757600080fd5b5051919050565b73ffffffffffffffffffffffffffffffffffffffff83168152604060208201526000610a7d604083018461097c565b94935050505056fea26469706673582212201138a6fca9cde9a32c1accbbb9cfaeced745b08b0ff836da36e0cc9731508d6364736f6c634300080d0033", + "solcInputHash": "fc82eeb0fff4196cd4e0dfec8a3b3aca", + "metadata": "{\"compiler\":{\"version\":\"0.8.13+commit.abaa5c0e\"},\"language\":\"Solidity\",\"output\":{\"abi\":[{\"inputs\":[{\"internalType\":\"contract ArbitrumL1InboxLike\",\"name\":\"_l1ArbitrumInbox\",\"type\":\"address\"},{\"internalType\":\"contract ArbitrumL1ERC20GatewayLike\",\"name\":\"_l1ERC20GatewayRouter\",\"type\":\"address\"}],\"stateMutability\":\"nonpayable\",\"type\":\"constructor\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"address\",\"name\":\"target\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"bytes\",\"name\":\"message\",\"type\":\"bytes\"}],\"name\":\"MessageRelayed\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"address\",\"name\":\"l1Token\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"address\",\"name\":\"l2Token\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"address\",\"name\":\"to\",\"type\":\"address\"}],\"name\":\"TokensRelayed\",\"type\":\"event\"},{\"inputs\":[],\"name\":\"getL1CallValue\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"pure\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"l1ERC20GatewayRouter\",\"outputs\":[{\"internalType\":\"contract ArbitrumL1ERC20GatewayLike\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"l1Inbox\",\"outputs\":[{\"internalType\":\"contract ArbitrumL1InboxLike\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"l2GasLimit\",\"outputs\":[{\"internalType\":\"uint32\",\"name\":\"\",\"type\":\"uint32\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"l2GasPrice\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"l2MaxSubmissionCost\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"l2RefundL2Address\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"target\",\"type\":\"address\"},{\"internalType\":\"bytes\",\"name\":\"message\",\"type\":\"bytes\"}],\"name\":\"relayMessage\",\"outputs\":[],\"stateMutability\":\"payable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"l1Token\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"l2Token\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"},{\"internalType\":\"address\",\"name\":\"to\",\"type\":\"address\"}],\"name\":\"relayTokens\",\"outputs\":[],\"stateMutability\":\"payable\",\"type\":\"function\"}],\"devdoc\":{\"details\":\"Public functions calling external contracts do not guard against reentrancy because they are expected to be called via delegatecall, which will execute this contract's logic within the context of the originating contract. For example, the HubPool will delegatecall these functions, therefore its only necessary that the HubPool's methods that call this contract's logic guard against reentrancy.\",\"kind\":\"dev\",\"methods\":{\"constructor\":{\"params\":{\"_l1ArbitrumInbox\":\"Inbox helper contract to send messages to Arbitrum.\",\"_l1ERC20GatewayRouter\":\"ERC20 gateway router contract to send tokens to Arbitrum.\"}},\"getL1CallValue()\":{\"returns\":{\"_0\":\"amount of ETH that this contract needs to hold in order for relayMessage to succeed.\"}},\"relayMessage(address,bytes)\":{\"params\":{\"message\":\"Data to send to target.\",\"target\":\"Contract on Arbitrum that will receive message.\"}},\"relayTokens(address,address,uint256,address)\":{\"params\":{\"amount\":\"Amount of L1 tokens to deposit and L2 tokens to receive.\",\"l1Token\":\"L1 token to deposit.\",\"l2Token\":\"L2 token to receive.\",\"to\":\"Bridge recipient.\"}}},\"version\":1},\"userdoc\":{\"kind\":\"user\",\"methods\":{\"constructor\":{\"notice\":\"Constructs new Adapter.\"},\"getL1CallValue()\":{\"notice\":\"Returns required amount of ETH to send a message via the Inbox.\"},\"relayMessage(address,bytes)\":{\"notice\":\"Send cross-chain message to target on Arbitrum.This contract must hold at least getL1CallValue() amount of ETH to send a message via the Inbox successfully, or the message will get stuck.\"},\"relayTokens(address,address,uint256,address)\":{\"notice\":\"Bridge tokens to Arbitrum.This contract must hold at least getL1CallValue() amount of ETH to send a message via the Inbox successfully, or the message will get stuck.\"}},\"notice\":\"Contract containing logic to send messages from L1 to Arbitrum.\",\"version\":1}},\"settings\":{\"compilationTarget\":{\"contracts/chain-adapters/Arbitrum_Adapter.sol\":\"Arbitrum_Adapter\"},\"evmVersion\":\"london\",\"libraries\":{},\"metadata\":{\"bytecodeHash\":\"ipfs\",\"useLiteralContent\":true},\"optimizer\":{\"enabled\":true,\"runs\":1000000},\"remappings\":[]},\"sources\":{\"@openzeppelin/contracts/token/ERC20/IERC20.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.5.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 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(\\n address from,\\n address to,\\n uint256 amount\\n ) external returns (bool);\\n\\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\",\"keccak256\":\"0xbbc8ac883ac3c0078ce5ad3e288fbb3ffcc8a30c3a98c0fda0114d64fc44fca2\",\"license\":\"MIT\"},\"@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts v4.4.1 (token/ERC20/utils/SafeERC20.sol)\\n\\npragma solidity ^0.8.0;\\n\\nimport \\\"../IERC20.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 function safeTransfer(\\n IERC20 token,\\n address to,\\n uint256 value\\n ) internal {\\n _callOptionalReturn(token, abi.encodeWithSelector(token.transfer.selector, to, value));\\n }\\n\\n function safeTransferFrom(\\n IERC20 token,\\n address from,\\n address to,\\n uint256 value\\n ) 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(\\n IERC20 token,\\n address spender,\\n uint256 value\\n ) 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 function safeIncreaseAllowance(\\n IERC20 token,\\n address spender,\\n uint256 value\\n ) internal {\\n uint256 newAllowance = token.allowance(address(this), spender) + value;\\n _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, newAllowance));\\n }\\n\\n function safeDecreaseAllowance(\\n IERC20 token,\\n address spender,\\n uint256 value\\n ) internal {\\n unchecked {\\n uint256 oldAllowance = token.allowance(address(this), spender);\\n require(oldAllowance >= value, \\\"SafeERC20: decreased allowance below zero\\\");\\n uint256 newAllowance = oldAllowance - value;\\n _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, newAllowance));\\n }\\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 if (returndata.length > 0) {\\n // Return data is optional\\n require(abi.decode(returndata, (bool)), \\\"SafeERC20: ERC20 operation did not succeed\\\");\\n }\\n }\\n}\\n\",\"keccak256\":\"0xc3d946432c0ddbb1f846a0d3985be71299df331b91d06732152117f62f0be2b5\",\"license\":\"MIT\"},\"@openzeppelin/contracts/utils/Address.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.5.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 *\\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://diligence.consensys.net/posts/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.5.11/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 functionCall(target, data, \\\"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(\\n address target,\\n bytes memory data,\\n uint256 value\\n ) 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 require(isContract(target), \\\"Address: call to non-contract\\\");\\n\\n (bool success, bytes memory returndata) = target.call{value: value}(data);\\n return verifyCallResult(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 require(isContract(target), \\\"Address: static call to non-contract\\\");\\n\\n (bool success, bytes memory returndata) = target.staticcall(data);\\n return verifyCallResult(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 require(isContract(target), \\\"Address: delegate call to non-contract\\\");\\n\\n (bool success, bytes memory returndata) = target.delegatecall(data);\\n return verifyCallResult(success, returndata, errorMessage);\\n }\\n\\n /**\\n * @dev Tool to verifies that a low level call was successful, and revert if it wasn't, either by bubbling the\\n * revert reason 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 // 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\\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}\\n\",\"keccak256\":\"0x2ccf9d2313a313d41a791505f2b5abfdc62191b5d4334f7f7a82691c088a1c87\",\"license\":\"MIT\"},\"contracts/chain-adapters/Arbitrum_Adapter.sol\":{\"content\":\"// SPDX-License-Identifier: AGPL-3.0-only\\npragma solidity ^0.8.0;\\n\\nimport \\\"../interfaces/AdapterInterface.sol\\\";\\n\\nimport \\\"@openzeppelin/contracts/token/ERC20/IERC20.sol\\\";\\nimport \\\"@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol\\\";\\n\\ninterface ArbitrumL1InboxLike {\\n function createRetryableTicket(\\n address destAddr,\\n uint256 arbTxCallValue,\\n uint256 maxSubmissionCost,\\n address submissionRefundAddress,\\n address valueRefundAddress,\\n uint256 maxGas,\\n uint256 gasPriceBid,\\n bytes calldata data\\n ) external payable returns (uint256);\\n}\\n\\ninterface ArbitrumL1ERC20GatewayLike {\\n function outboundTransfer(\\n address _token,\\n address _to,\\n uint256 _amount,\\n uint256 _maxGas,\\n uint256 _gasPriceBid,\\n bytes calldata _data\\n ) external payable returns (bytes memory);\\n\\n function getGateway(address _token) external view returns (address);\\n}\\n\\n/**\\n * @notice Contract containing logic to send messages from L1 to Arbitrum.\\n * @dev Public functions calling external contracts do not guard against reentrancy because they are expected to be\\n * called via delegatecall, which will execute this contract's logic within the context of the originating contract.\\n * For example, the HubPool will delegatecall these functions, therefore its only necessary that the HubPool's methods\\n * that call this contract's logic guard against reentrancy.\\n */\\ncontract Arbitrum_Adapter is AdapterInterface {\\n using SafeERC20 for IERC20;\\n\\n // Gas limit for immediate L2 execution attempt (can be estimated via NodeInterface.estimateRetryableTicket).\\n // NodeInterface precompile interface exists at L2 address 0x00000000000000000000000000000000000000C8\\n uint32 public immutable l2GasLimit = 2_000_000;\\n\\n // Amount of ETH allocated to pay for the base submission fee. The base submission fee is a parameter unique to\\n // retryable transactions; the user is charged the base submission fee to cover the storage costs of keeping their\\n // ticket\\u2019s calldata in the retry buffer. (current base submission fee is queryable via\\n // ArbRetryableTx.getSubmissionPrice). ArbRetryableTicket precompile interface exists at L2 address\\n // 0x000000000000000000000000000000000000006E.\\n uint256 public immutable l2MaxSubmissionCost = 0.01e18;\\n\\n // L2 Gas price bid for immediate L2 execution attempt (queryable via standard eth*gasPrice RPC)\\n uint256 public immutable l2GasPrice = 5e9; // 5 gWei\\n\\n // This address on L2 receives extra ETH that is left over after relaying a message via the inbox.\\n address public immutable l2RefundL2Address;\\n\\n ArbitrumL1InboxLike public immutable l1Inbox;\\n\\n ArbitrumL1ERC20GatewayLike public immutable l1ERC20GatewayRouter;\\n\\n /**\\n * @notice Constructs new Adapter.\\n * @param _l1ArbitrumInbox Inbox helper contract to send messages to Arbitrum.\\n * @param _l1ERC20GatewayRouter ERC20 gateway router contract to send tokens to Arbitrum.\\n */\\n constructor(ArbitrumL1InboxLike _l1ArbitrumInbox, ArbitrumL1ERC20GatewayLike _l1ERC20GatewayRouter) {\\n l1Inbox = _l1ArbitrumInbox;\\n l1ERC20GatewayRouter = _l1ERC20GatewayRouter;\\n\\n l2RefundL2Address = msg.sender;\\n }\\n\\n /**\\n * @notice Send cross-chain message to target on Arbitrum.\\n * @notice This contract must hold at least getL1CallValue() amount of ETH to send a message via the Inbox\\n * successfully, or the message will get stuck.\\n * @param target Contract on Arbitrum that will receive message.\\n * @param message Data to send to target.\\n */\\n function relayMessage(address target, bytes memory message) external payable override {\\n uint256 requiredL1CallValue = _contractHasSufficientEthBalance();\\n\\n l1Inbox.createRetryableTicket{ value: requiredL1CallValue }(\\n target, // destAddr destination L2 contract address\\n 0, // l2CallValue call value for retryable L2 message\\n l2MaxSubmissionCost, // maxSubmissionCost Max gas deducted from user's L2 balance to cover base fee\\n l2RefundL2Address, // excessFeeRefundAddress maxgas * gasprice - execution cost gets credited here on L2\\n l2RefundL2Address, // callValueRefundAddress l2Callvalue gets credited here on L2 if retryable txn times out or gets cancelled\\n l2GasLimit, // maxGas Max gas deducted from user's L2 balance to cover L2 execution\\n l2GasPrice, // gasPriceBid price bid for L2 execution\\n message // data ABI encoded data of L2 message\\n );\\n\\n emit MessageRelayed(target, message);\\n }\\n\\n /**\\n * @notice Bridge tokens to Arbitrum.\\n * @notice This contract must hold at least getL1CallValue() amount of ETH to send a message via the Inbox\\n * successfully, or the message will get stuck.\\n * @param l1Token L1 token to deposit.\\n * @param l2Token L2 token to receive.\\n * @param amount Amount of L1 tokens to deposit and L2 tokens to receive.\\n * @param to Bridge recipient.\\n */\\n function relayTokens(\\n address l1Token,\\n address l2Token, // l2Token is unused for Arbitrum.\\n uint256 amount,\\n address to\\n ) external payable override {\\n uint256 requiredL1CallValue = _contractHasSufficientEthBalance();\\n\\n // Approve the gateway, not the router, to spend the hub pool's balance. The gateway, which is different\\n // per L1 token, will temporarily escrow the tokens to be bridged and pull them from this contract.\\n address erc20Gateway = l1ERC20GatewayRouter.getGateway(l1Token);\\n IERC20(l1Token).safeIncreaseAllowance(erc20Gateway, amount);\\n\\n // `outboundTransfer` expects that the caller includes a bytes message as the last param that includes the\\n // maxSubmissionCost to use when creating an L2 retryable ticket: https://github.com/OffchainLabs/arbitrum/blob/e98d14873dd77513b569771f47b5e05b72402c5e/packages/arb-bridge-peripherals/contracts/tokenbridge/ethereum/gateway/L1GatewayRouter.sol#L232\\n bytes memory data = abi.encode(l2MaxSubmissionCost, \\\"\\\");\\n l1ERC20GatewayRouter.outboundTransfer{ value: requiredL1CallValue }(l1Token, to, amount, l2GasLimit, l2GasPrice, data);\\n\\n emit TokensRelayed(l1Token, l2Token, amount, to);\\n }\\n\\n /**\\n * @notice Returns required amount of ETH to send a message via the Inbox.\\n * @return amount of ETH that this contract needs to hold in order for relayMessage to succeed.\\n */\\n function getL1CallValue() public pure returns (uint256) {\\n return l2MaxSubmissionCost + l2GasPrice * l2GasLimit;\\n }\\n\\n function _contractHasSufficientEthBalance() internal view returns (uint256 requiredL1CallValue) {\\n requiredL1CallValue = getL1CallValue();\\n require(address(this).balance >= requiredL1CallValue, \\\"Insufficient ETH balance\\\");\\n }\\n}\\n\",\"keccak256\":\"0xbdebabe1e5a8750542eae714d268cf9c3b18c8bfe8cacce431ddefe6bcaf4334\",\"license\":\"AGPL-3.0-only\"},\"contracts/interfaces/AdapterInterface.sol\":{\"content\":\"// SPDX-License-Identifier: AGPL-3.0-only\\npragma solidity ^0.8.0;\\n\\n/**\\n * @notice Sends cross chain messages and tokens to contracts on a specific L2 network.\\n */\\n\\ninterface AdapterInterface {\\n event MessageRelayed(address target, bytes message);\\n\\n event TokensRelayed(address l1Token, address l2Token, uint256 amount, address to);\\n\\n function relayMessage(address target, bytes memory message) external payable;\\n\\n function relayTokens(\\n address l1Token,\\n address l2Token,\\n uint256 amount,\\n address to\\n ) external payable;\\n}\\n\",\"keccak256\":\"0xbd7091006acbdfe72b21ce985f964f0682a2316d9d3b38967beeb55f4ae5118c\",\"license\":\"AGPL-3.0-only\"}},\"version\":1}", + "bytecode": "0x610140604052621e8480608052662386f26fc1000060a05264012a05f20060c05234801561002c57600080fd5b5060405161128438038061128483398101604081905261004b91610080565b6001600160a01b039182166101005216610120523360e0526100ba565b6001600160a01b038116811461007d57600080fd5b50565b6000806040838503121561009357600080fd5b825161009e81610068565b60208401519092506100af81610068565b809150509250929050565b60805160a05160c05160e051610100516101205161111a61016a6000396000818160d501528181610333015261047001526000818161014301526105cd0152600081816101ab0152818161062e015261064f0152600081816101770152818161028b015281816104c70152610691015260008181610228015281816102b5015281816103c5015261060d0152600081816101df01528181610269015281816104a50152610670015261111a6000f3fe6080604052600436106100965760003560e01c80639ae3668511610069578063cf6e65b71161004e578063cf6e65b7146101cd578063e599477e14610216578063e6eb8ade1461024a57600080fd5b80639ae36685146101655780639c3ba2001461019957600080fd5b806308f1ed151461009b5780631ba4a9cb146100c357806352c8c75c1461011c5780638134f38514610131575b600080fd5b3480156100a757600080fd5b506100b061025d565b6040519081526020015b60405180910390f35b3480156100cf57600080fd5b506100f77f000000000000000000000000000000000000000000000000000000000000000081565b60405173ffffffffffffffffffffffffffffffffffffffff90911681526020016100ba565b61012f61012a366004610c47565b6102de565b005b34801561013d57600080fd5b506100f77f000000000000000000000000000000000000000000000000000000000000000081565b34801561017157600080fd5b506100b07f000000000000000000000000000000000000000000000000000000000000000081565b3480156101a557600080fd5b506100f77f000000000000000000000000000000000000000000000000000000000000000081565b3480156101d957600080fd5b506102017f000000000000000000000000000000000000000000000000000000000000000081565b60405163ffffffff90911681526020016100ba565b34801561022257600080fd5b506100b07f000000000000000000000000000000000000000000000000000000000000000081565b61012f610258366004610d5e565b6105bf565b60006102af63ffffffff7f0000000000000000000000000000000000000000000000000000000000000000167f0000000000000000000000000000000000000000000000000000000000000000610e20565b6102d9907f0000000000000000000000000000000000000000000000000000000000000000610e5d565b905090565b60006102e8610756565b6040517fbda009fe00000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff87811660048301529192506000917f0000000000000000000000000000000000000000000000000000000000000000169063bda009fe90602401602060405180830381865afa15801561037a573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061039e9190610e75565b90506103c173ffffffffffffffffffffffffffffffffffffffff871682866107d4565b60007f000000000000000000000000000000000000000000000000000000000000000060405160200161040591815260406020820181905260009082015260600190565b604080517fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0818403018152908290527fd2ce7d65000000000000000000000000000000000000000000000000000000008252915073ffffffffffffffffffffffffffffffffffffffff7f0000000000000000000000000000000000000000000000000000000000000000169063d2ce7d659085906104f1908b9089908b907f0000000000000000000000000000000000000000000000000000000000000000907f0000000000000000000000000000000000000000000000000000000000000000908a90600401610f08565b60006040518083038185885af115801561050f573d6000803e3d6000fd5b50505050506040513d6000823e601f3d9081017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe01682016040526105569190810190610f65565b506040805173ffffffffffffffffffffffffffffffffffffffff898116825288811660208301528183018890528616606082015290517fd7e09655439c3932e55857df3220186e5a7f0980825f20691c2b35d941dee75b9181900360800190a150505050505050565b60006105c9610756565b90507f000000000000000000000000000000000000000000000000000000000000000073ffffffffffffffffffffffffffffffffffffffff1663679b6ded828560007f00000000000000000000000000000000000000000000000000000000000000007f00000000000000000000000000000000000000000000000000000000000000007f00000000000000000000000000000000000000000000000000000000000000007f00000000000000000000000000000000000000000000000000000000000000007f00000000000000000000000000000000000000000000000000000000000000008b6040518a63ffffffff1660e01b81526004016106d4989796959493929190610fdc565b60206040518083038185885af11580156106f2573d6000803e3d6000fd5b50505050506040513d601f19601f82011682018060405250810190610717919061104b565b507f9e6c52944e331ba6270e7fe4cea2a4086bae8f7a27e1cdba07f416806f5d0ac48383604051610749929190611064565b60405180910390a1505050565b600061076061025d565b9050804710156107d1576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601860248201527f496e73756666696369656e74204554482062616c616e6365000000000000000060448201526064015b60405180910390fd5b90565b6040517fdd62ed3e00000000000000000000000000000000000000000000000000000000815230600482015273ffffffffffffffffffffffffffffffffffffffff8381166024830152600091839186169063dd62ed3e90604401602060405180830381865afa15801561084b573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061086f919061104b565b6108799190610e5d565b6040805173ffffffffffffffffffffffffffffffffffffffff8616602482015260448082018490528251808303909101815260649091019091526020810180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff167f095ea7b30000000000000000000000000000000000000000000000000000000017905290915061090990859061090f565b50505050565b6000610971826040518060400160405280602081526020017f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c65648152508573ffffffffffffffffffffffffffffffffffffffff16610a209092919063ffffffff16565b805190915015610a1b578080602001905181019061098f9190611093565b610a1b576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602a60248201527f5361666545524332303a204552433230206f7065726174696f6e20646964206e60448201527f6f7420737563636565640000000000000000000000000000000000000000000060648201526084016107c8565b505050565b6060610a2f8484600085610a39565b90505b9392505050565b606082471015610acb576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602660248201527f416464726573733a20696e73756666696369656e742062616c616e636520666f60448201527f722063616c6c000000000000000000000000000000000000000000000000000060648201526084016107c8565b73ffffffffffffffffffffffffffffffffffffffff85163b610b49576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e747261637400000060448201526064016107c8565b6000808673ffffffffffffffffffffffffffffffffffffffff168587604051610b7291906110b5565b60006040518083038185875af1925050503d8060008114610baf576040519150601f19603f3d011682016040523d82523d6000602084013e610bb4565b606091505b5091509150610bc4828286610bcf565b979650505050505050565b60608315610bde575081610a32565b825115610bee5782518084602001fd5b816040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016107c891906110d1565b73ffffffffffffffffffffffffffffffffffffffff81168114610c4457600080fd5b50565b60008060008060808587031215610c5d57600080fd5b8435610c6881610c22565b93506020850135610c7881610c22565b9250604085013591506060850135610c8f81610c22565b939692955090935050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b604051601f82017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe016810167ffffffffffffffff81118282101715610d1057610d10610c9a565b604052919050565b600067ffffffffffffffff821115610d3257610d32610c9a565b50601f017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe01660200190565b60008060408385031215610d7157600080fd5b8235610d7c81610c22565b9150602083013567ffffffffffffffff811115610d9857600080fd5b8301601f81018513610da957600080fd5b8035610dbc610db782610d18565b610cc9565b818152866020838501011115610dd157600080fd5b816020840160208301376000602083830101528093505050509250929050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b6000817fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0483118215151615610e5857610e58610df1565b500290565b60008219821115610e7057610e70610df1565b500190565b600060208284031215610e8757600080fd5b8151610a3281610c22565b60005b83811015610ead578181015183820152602001610e95565b838111156109095750506000910152565b60008151808452610ed6816020860160208601610e92565b601f017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0169290920160200192915050565b600073ffffffffffffffffffffffffffffffffffffffff808916835280881660208401525085604083015263ffffffff8516606083015283608083015260c060a0830152610f5960c0830184610ebe565b98975050505050505050565b600060208284031215610f7757600080fd5b815167ffffffffffffffff811115610f8e57600080fd5b8201601f81018413610f9f57600080fd5b8051610fad610db782610d18565b818152856020838501011115610fc257600080fd5b610fd3826020830160208601610e92565b95945050505050565b600061010073ffffffffffffffffffffffffffffffffffffffff808c1684528a6020850152896040850152808916606085015280881660808501525063ffffffff861660a08401528460c08401528060e084015261103c81840185610ebe565b9b9a5050505050505050505050565b60006020828403121561105d57600080fd5b5051919050565b73ffffffffffffffffffffffffffffffffffffffff83168152604060208201526000610a2f6040830184610ebe565b6000602082840312156110a557600080fd5b81518015158114610a3257600080fd5b600082516110c7818460208701610e92565b9190910192915050565b602081526000610a326020830184610ebe56fea26469706673582212208a27fef820b6942c0cf40e5cb9184416af0fd6bd08e2b4c6a9bfebf2716b4a1264736f6c634300080d0033", + "deployedBytecode": "0x6080604052600436106100965760003560e01c80639ae3668511610069578063cf6e65b71161004e578063cf6e65b7146101cd578063e599477e14610216578063e6eb8ade1461024a57600080fd5b80639ae36685146101655780639c3ba2001461019957600080fd5b806308f1ed151461009b5780631ba4a9cb146100c357806352c8c75c1461011c5780638134f38514610131575b600080fd5b3480156100a757600080fd5b506100b061025d565b6040519081526020015b60405180910390f35b3480156100cf57600080fd5b506100f77f000000000000000000000000000000000000000000000000000000000000000081565b60405173ffffffffffffffffffffffffffffffffffffffff90911681526020016100ba565b61012f61012a366004610c47565b6102de565b005b34801561013d57600080fd5b506100f77f000000000000000000000000000000000000000000000000000000000000000081565b34801561017157600080fd5b506100b07f000000000000000000000000000000000000000000000000000000000000000081565b3480156101a557600080fd5b506100f77f000000000000000000000000000000000000000000000000000000000000000081565b3480156101d957600080fd5b506102017f000000000000000000000000000000000000000000000000000000000000000081565b60405163ffffffff90911681526020016100ba565b34801561022257600080fd5b506100b07f000000000000000000000000000000000000000000000000000000000000000081565b61012f610258366004610d5e565b6105bf565b60006102af63ffffffff7f0000000000000000000000000000000000000000000000000000000000000000167f0000000000000000000000000000000000000000000000000000000000000000610e20565b6102d9907f0000000000000000000000000000000000000000000000000000000000000000610e5d565b905090565b60006102e8610756565b6040517fbda009fe00000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff87811660048301529192506000917f0000000000000000000000000000000000000000000000000000000000000000169063bda009fe90602401602060405180830381865afa15801561037a573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061039e9190610e75565b90506103c173ffffffffffffffffffffffffffffffffffffffff871682866107d4565b60007f000000000000000000000000000000000000000000000000000000000000000060405160200161040591815260406020820181905260009082015260600190565b604080517fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0818403018152908290527fd2ce7d65000000000000000000000000000000000000000000000000000000008252915073ffffffffffffffffffffffffffffffffffffffff7f0000000000000000000000000000000000000000000000000000000000000000169063d2ce7d659085906104f1908b9089908b907f0000000000000000000000000000000000000000000000000000000000000000907f0000000000000000000000000000000000000000000000000000000000000000908a90600401610f08565b60006040518083038185885af115801561050f573d6000803e3d6000fd5b50505050506040513d6000823e601f3d9081017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe01682016040526105569190810190610f65565b506040805173ffffffffffffffffffffffffffffffffffffffff898116825288811660208301528183018890528616606082015290517fd7e09655439c3932e55857df3220186e5a7f0980825f20691c2b35d941dee75b9181900360800190a150505050505050565b60006105c9610756565b90507f000000000000000000000000000000000000000000000000000000000000000073ffffffffffffffffffffffffffffffffffffffff1663679b6ded828560007f00000000000000000000000000000000000000000000000000000000000000007f00000000000000000000000000000000000000000000000000000000000000007f00000000000000000000000000000000000000000000000000000000000000007f00000000000000000000000000000000000000000000000000000000000000007f00000000000000000000000000000000000000000000000000000000000000008b6040518a63ffffffff1660e01b81526004016106d4989796959493929190610fdc565b60206040518083038185885af11580156106f2573d6000803e3d6000fd5b50505050506040513d601f19601f82011682018060405250810190610717919061104b565b507f9e6c52944e331ba6270e7fe4cea2a4086bae8f7a27e1cdba07f416806f5d0ac48383604051610749929190611064565b60405180910390a1505050565b600061076061025d565b9050804710156107d1576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601860248201527f496e73756666696369656e74204554482062616c616e6365000000000000000060448201526064015b60405180910390fd5b90565b6040517fdd62ed3e00000000000000000000000000000000000000000000000000000000815230600482015273ffffffffffffffffffffffffffffffffffffffff8381166024830152600091839186169063dd62ed3e90604401602060405180830381865afa15801561084b573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061086f919061104b565b6108799190610e5d565b6040805173ffffffffffffffffffffffffffffffffffffffff8616602482015260448082018490528251808303909101815260649091019091526020810180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff167f095ea7b30000000000000000000000000000000000000000000000000000000017905290915061090990859061090f565b50505050565b6000610971826040518060400160405280602081526020017f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c65648152508573ffffffffffffffffffffffffffffffffffffffff16610a209092919063ffffffff16565b805190915015610a1b578080602001905181019061098f9190611093565b610a1b576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602a60248201527f5361666545524332303a204552433230206f7065726174696f6e20646964206e60448201527f6f7420737563636565640000000000000000000000000000000000000000000060648201526084016107c8565b505050565b6060610a2f8484600085610a39565b90505b9392505050565b606082471015610acb576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602660248201527f416464726573733a20696e73756666696369656e742062616c616e636520666f60448201527f722063616c6c000000000000000000000000000000000000000000000000000060648201526084016107c8565b73ffffffffffffffffffffffffffffffffffffffff85163b610b49576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e747261637400000060448201526064016107c8565b6000808673ffffffffffffffffffffffffffffffffffffffff168587604051610b7291906110b5565b60006040518083038185875af1925050503d8060008114610baf576040519150601f19603f3d011682016040523d82523d6000602084013e610bb4565b606091505b5091509150610bc4828286610bcf565b979650505050505050565b60608315610bde575081610a32565b825115610bee5782518084602001fd5b816040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016107c891906110d1565b73ffffffffffffffffffffffffffffffffffffffff81168114610c4457600080fd5b50565b60008060008060808587031215610c5d57600080fd5b8435610c6881610c22565b93506020850135610c7881610c22565b9250604085013591506060850135610c8f81610c22565b939692955090935050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b604051601f82017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe016810167ffffffffffffffff81118282101715610d1057610d10610c9a565b604052919050565b600067ffffffffffffffff821115610d3257610d32610c9a565b50601f017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe01660200190565b60008060408385031215610d7157600080fd5b8235610d7c81610c22565b9150602083013567ffffffffffffffff811115610d9857600080fd5b8301601f81018513610da957600080fd5b8035610dbc610db782610d18565b610cc9565b818152866020838501011115610dd157600080fd5b816020840160208301376000602083830101528093505050509250929050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b6000817fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0483118215151615610e5857610e58610df1565b500290565b60008219821115610e7057610e70610df1565b500190565b600060208284031215610e8757600080fd5b8151610a3281610c22565b60005b83811015610ead578181015183820152602001610e95565b838111156109095750506000910152565b60008151808452610ed6816020860160208601610e92565b601f017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0169290920160200192915050565b600073ffffffffffffffffffffffffffffffffffffffff808916835280881660208401525085604083015263ffffffff8516606083015283608083015260c060a0830152610f5960c0830184610ebe565b98975050505050505050565b600060208284031215610f7757600080fd5b815167ffffffffffffffff811115610f8e57600080fd5b8201601f81018413610f9f57600080fd5b8051610fad610db782610d18565b818152856020838501011115610fc257600080fd5b610fd3826020830160208601610e92565b95945050505050565b600061010073ffffffffffffffffffffffffffffffffffffffff808c1684528a6020850152896040850152808916606085015280881660808501525063ffffffff861660a08401528460c08401528060e084015261103c81840185610ebe565b9b9a5050505050505050505050565b60006020828403121561105d57600080fd5b5051919050565b73ffffffffffffffffffffffffffffffffffffffff83168152604060208201526000610a2f6040830184610ebe565b6000602082840312156110a557600080fd5b81518015158114610a3257600080fd5b600082516110c7818460208701610e92565b9190910192915050565b602081526000610a326020830184610ebe56fea26469706673582212208a27fef820b6942c0cf40e5cb9184416af0fd6bd08e2b4c6a9bfebf2716b4a1264736f6c634300080d0033", "devdoc": { "details": "Public functions calling external contracts do not guard against reentrancy because they are expected to be called via delegatecall, which will execute this contract's logic within the context of the originating contract. For example, the HubPool will delegatecall these functions, therefore its only necessary that the HubPool's methods that call this contract's logic guard against reentrancy.", "kind": "dev", @@ -234,7 +234,7 @@ "constructor": { "params": { "_l1ArbitrumInbox": "Inbox helper contract to send messages to Arbitrum.", - "_l1ERC20Gateway": "ERC20 gateway contract to send tokens to Arbitrum." + "_l1ERC20GatewayRouter": "ERC20 gateway router contract to send tokens to Arbitrum." } }, "getL1CallValue()": { @@ -272,7 +272,7 @@ "notice": "Send cross-chain message to target on Arbitrum.This contract must hold at least getL1CallValue() amount of ETH to send a message via the Inbox successfully, or the message will get stuck." }, "relayTokens(address,address,uint256,address)": { - "notice": "Bridge tokens to Arbitrum." + "notice": "Bridge tokens to Arbitrum.This contract must hold at least getL1CallValue() amount of ETH to send a message via the Inbox successfully, or the message will get stuck." } }, "notice": "Contract containing logic to send messages from L1 to Arbitrum.", diff --git a/deployments/rinkeby/solcInputs/c8b9349311d8b5049b613ac98eb998d0.json b/deployments/rinkeby/solcInputs/fc82eeb0fff4196cd4e0dfec8a3b3aca.json similarity index 97% rename from deployments/rinkeby/solcInputs/c8b9349311d8b5049b613ac98eb998d0.json rename to deployments/rinkeby/solcInputs/fc82eeb0fff4196cd4e0dfec8a3b3aca.json index dfb09219e..f246a5bb5 100644 --- a/deployments/rinkeby/solcInputs/c8b9349311d8b5049b613ac98eb998d0.json +++ b/deployments/rinkeby/solcInputs/fc82eeb0fff4196cd4e0dfec8a3b3aca.json @@ -122,7 +122,7 @@ "content": "// SPDX-License-Identifier: AGPL-3.0-only\npragma solidity ^0.8.0;\n\nimport \"../interfaces/AdapterInterface.sol\";\n\nimport \"@openzeppelin/contracts/token/ERC20/IERC20.sol\";\nimport \"@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol\";\n\n/**\n * @notice Contract containing logic to send messages from L1 to Ethereum SpokePool.\n * @notice This contract should always be deployed on the same chain as the HubPool, as it acts as a pass-through\n * contract between HubPool and SpokePool on the same chain. Its named \"Ethereum_Adapter\" because a core assumption\n * is that the HubPool will be deployed on Ethereum, so this adapter will be used to communicate between HubPool\n * and the Ethereum_SpokePool.\n * @dev Public functions calling external contracts do not guard against reentrancy because they are expected to be\n * called via delegatecall, which will execute this contract's logic within the context of the originating contract.\n * For example, the HubPool will delegatecall these functions, therefore its only necessary that the HubPool's methods\n * that call this contract's logic guard against reentrancy.\n */\ncontract Ethereum_Adapter is AdapterInterface {\n using SafeERC20 for IERC20;\n\n /**\n * @notice Send message to target on Ethereum.\n * @notice This function, and contract overall, is not useful in practice except that the HubPool\n * expects to interact with the SpokePool via an Adapter, so when communicating to the Ethereum_SpokePool, it must\n * send messages via this pass-through contract.\n * @param target Contract that will receive message.\n * @param message Data to send to target.\n */\n function relayMessage(address target, bytes memory message) external payable override {\n _executeCall(target, message);\n emit MessageRelayed(target, message);\n }\n\n /**\n * @notice Send tokens to target.\n * @param l1Token L1 token to send.\n * @param l2Token Unused parameter in this contract.\n * @param amount Amount of L1 tokens to send.\n * @param to recipient.\n */\n function relayTokens(\n address l1Token,\n address l2Token, // l2Token is unused for ethereum since we are assuming that the HubPool is only deployed\n // on this network.\n uint256 amount,\n address to\n ) external payable override {\n IERC20(l1Token).safeTransfer(to, amount);\n emit TokensRelayed(l1Token, l2Token, amount, to);\n }\n\n // Note: this snippet of code is copied from Governor.sol. Source: https://github.com/UMAprotocol/protocol/blob/5b37ea818a28479c01e458389a83c3e736306b17/packages/core/contracts/oracle/implementation/Governor.sol#L190-L207\n function _executeCall(address to, bytes memory data) private {\n // Note: this snippet of code is copied from Governor.sol and modified to not include any \"value\" field.\n // solhint-disable-next-line no-inline-assembly\n\n bool success;\n assembly {\n let inputData := add(data, 0x20)\n let inputDataSize := mload(data)\n // Hardcode value to be 0 for relayed governance calls in order to avoid addressing complexity of bridging\n // value cross-chain.\n success := call(gas(), to, 0, inputData, inputDataSize, 0, 0)\n }\n require(success, \"execute call failed\");\n }\n}\n" }, "contracts/chain-adapters/Arbitrum_Adapter.sol": { - "content": "// SPDX-License-Identifier: AGPL-3.0-only\npragma solidity ^0.8.0;\n\nimport \"../interfaces/AdapterInterface.sol\";\n\ninterface ArbitrumL1InboxLike {\n function createRetryableTicket(\n address destAddr,\n uint256 arbTxCallValue,\n uint256 maxSubmissionCost,\n address submissionRefundAddress,\n address valueRefundAddress,\n uint256 maxGas,\n uint256 gasPriceBid,\n bytes calldata data\n ) external payable returns (uint256);\n}\n\ninterface ArbitrumL1ERC20GatewayLike {\n function outboundTransfer(\n address _token,\n address _to,\n uint256 _amount,\n uint256 _maxGas,\n uint256 _gasPriceBid,\n bytes calldata _data\n ) external payable returns (bytes memory);\n}\n\n/**\n * @notice Contract containing logic to send messages from L1 to Arbitrum.\n * @dev Public functions calling external contracts do not guard against reentrancy because they are expected to be\n * called via delegatecall, which will execute this contract's logic within the context of the originating contract.\n * For example, the HubPool will delegatecall these functions, therefore its only necessary that the HubPool's methods\n * that call this contract's logic guard against reentrancy.\n */\ncontract Arbitrum_Adapter is AdapterInterface {\n // Gas limit for immediate L2 execution attempt (can be estimated via NodeInterface.estimateRetryableTicket).\n // NodeInterface precompile interface exists at L2 address 0x00000000000000000000000000000000000000C8\n uint32 public immutable l2GasLimit = 5_000_000;\n\n // Amount of ETH allocated to pay for the base submission fee. The base submission fee is a parameter unique to\n // retryable transactions; the user is charged the base submission fee to cover the storage costs of keeping their\n // ticket’s calldata in the retry buffer. (current base submission fee is queryable via\n // ArbRetryableTx.getSubmissionPrice). ArbRetryableTicket precompile interface exists at L2 address\n // 0x000000000000000000000000000000000000006E.\n uint256 public immutable l2MaxSubmissionCost = 0.1e18;\n\n // L2 Gas price bid for immediate L2 execution attempt (queryable via standard eth*gasPrice RPC)\n uint256 public immutable l2GasPrice = 10e9; // 10 gWei\n\n // This address on L2 receives extra ETH that is left over after relaying a message via the inbox.\n address public immutable l2RefundL2Address;\n\n ArbitrumL1InboxLike public immutable l1Inbox;\n\n ArbitrumL1ERC20GatewayLike public immutable l1ERC20Gateway;\n\n /**\n * @notice Constructs new Adapter.\n * @param _l1ArbitrumInbox Inbox helper contract to send messages to Arbitrum.\n * @param _l1ERC20Gateway ERC20 gateway contract to send tokens to Arbitrum.\n */\n constructor(ArbitrumL1InboxLike _l1ArbitrumInbox, ArbitrumL1ERC20GatewayLike _l1ERC20Gateway) {\n l1Inbox = _l1ArbitrumInbox;\n l1ERC20Gateway = _l1ERC20Gateway;\n\n l2RefundL2Address = msg.sender;\n }\n\n /**\n * @notice Send cross-chain message to target on Arbitrum.\n * @notice This contract must hold at least getL1CallValue() amount of ETH to send a message via the Inbox\n * successfully, or the message will get stuck.\n * @param target Contract on Arbitrum that will receive message.\n * @param message Data to send to target.\n */\n function relayMessage(address target, bytes memory message) external payable override {\n uint256 requiredL1CallValue = getL1CallValue();\n require(address(this).balance >= requiredL1CallValue, \"Insufficient ETH balance\");\n\n l1Inbox.createRetryableTicket{ value: requiredL1CallValue }(\n target, // destAddr destination L2 contract address\n 0, // l2CallValue call value for retryable L2 message\n l2MaxSubmissionCost, // maxSubmissionCost Max gas deducted from user's L2 balance to cover base fee\n l2RefundL2Address, // excessFeeRefundAddress maxgas * gasprice - execution cost gets credited here on L2\n l2RefundL2Address, // callValueRefundAddress l2Callvalue gets credited here on L2 if retryable txn times out or gets cancelled\n l2GasLimit, // maxGas Max gas deducted from user's L2 balance to cover L2 execution\n l2GasPrice, // gasPriceBid price bid for L2 execution\n message // data ABI encoded data of L2 message\n );\n\n emit MessageRelayed(target, message);\n }\n\n /**\n * @notice Bridge tokens to Arbitrum.\n * @param l1Token L1 token to deposit.\n * @param l2Token L2 token to receive.\n * @param amount Amount of L1 tokens to deposit and L2 tokens to receive.\n * @param to Bridge recipient.\n */\n function relayTokens(\n address l1Token,\n address l2Token, // l2Token is unused for Arbitrum.\n uint256 amount,\n address to\n ) external payable override {\n l1ERC20Gateway.outboundTransfer(l1Token, to, amount, l2GasLimit, l2GasPrice, \"\");\n emit TokensRelayed(l1Token, l2Token, amount, to);\n }\n\n /**\n * @notice Returns required amount of ETH to send a message via the Inbox.\n * @return amount of ETH that this contract needs to hold in order for relayMessage to succeed.\n */\n function getL1CallValue() public pure returns (uint256) {\n return l2MaxSubmissionCost + l2GasPrice * l2GasLimit;\n }\n}\n" + "content": "// SPDX-License-Identifier: AGPL-3.0-only\npragma solidity ^0.8.0;\n\nimport \"../interfaces/AdapterInterface.sol\";\n\nimport \"@openzeppelin/contracts/token/ERC20/IERC20.sol\";\nimport \"@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol\";\n\ninterface ArbitrumL1InboxLike {\n function createRetryableTicket(\n address destAddr,\n uint256 arbTxCallValue,\n uint256 maxSubmissionCost,\n address submissionRefundAddress,\n address valueRefundAddress,\n uint256 maxGas,\n uint256 gasPriceBid,\n bytes calldata data\n ) external payable returns (uint256);\n}\n\ninterface ArbitrumL1ERC20GatewayLike {\n function outboundTransfer(\n address _token,\n address _to,\n uint256 _amount,\n uint256 _maxGas,\n uint256 _gasPriceBid,\n bytes calldata _data\n ) external payable returns (bytes memory);\n\n function getGateway(address _token) external view returns (address);\n}\n\n/**\n * @notice Contract containing logic to send messages from L1 to Arbitrum.\n * @dev Public functions calling external contracts do not guard against reentrancy because they are expected to be\n * called via delegatecall, which will execute this contract's logic within the context of the originating contract.\n * For example, the HubPool will delegatecall these functions, therefore its only necessary that the HubPool's methods\n * that call this contract's logic guard against reentrancy.\n */\ncontract Arbitrum_Adapter is AdapterInterface {\n using SafeERC20 for IERC20;\n\n // Gas limit for immediate L2 execution attempt (can be estimated via NodeInterface.estimateRetryableTicket).\n // NodeInterface precompile interface exists at L2 address 0x00000000000000000000000000000000000000C8\n uint32 public immutable l2GasLimit = 2_000_000;\n\n // Amount of ETH allocated to pay for the base submission fee. The base submission fee is a parameter unique to\n // retryable transactions; the user is charged the base submission fee to cover the storage costs of keeping their\n // ticket’s calldata in the retry buffer. (current base submission fee is queryable via\n // ArbRetryableTx.getSubmissionPrice). ArbRetryableTicket precompile interface exists at L2 address\n // 0x000000000000000000000000000000000000006E.\n uint256 public immutable l2MaxSubmissionCost = 0.01e18;\n\n // L2 Gas price bid for immediate L2 execution attempt (queryable via standard eth*gasPrice RPC)\n uint256 public immutable l2GasPrice = 5e9; // 5 gWei\n\n // This address on L2 receives extra ETH that is left over after relaying a message via the inbox.\n address public immutable l2RefundL2Address;\n\n ArbitrumL1InboxLike public immutable l1Inbox;\n\n ArbitrumL1ERC20GatewayLike public immutable l1ERC20GatewayRouter;\n\n /**\n * @notice Constructs new Adapter.\n * @param _l1ArbitrumInbox Inbox helper contract to send messages to Arbitrum.\n * @param _l1ERC20GatewayRouter ERC20 gateway router contract to send tokens to Arbitrum.\n */\n constructor(ArbitrumL1InboxLike _l1ArbitrumInbox, ArbitrumL1ERC20GatewayLike _l1ERC20GatewayRouter) {\n l1Inbox = _l1ArbitrumInbox;\n l1ERC20GatewayRouter = _l1ERC20GatewayRouter;\n\n l2RefundL2Address = msg.sender;\n }\n\n /**\n * @notice Send cross-chain message to target on Arbitrum.\n * @notice This contract must hold at least getL1CallValue() amount of ETH to send a message via the Inbox\n * successfully, or the message will get stuck.\n * @param target Contract on Arbitrum that will receive message.\n * @param message Data to send to target.\n */\n function relayMessage(address target, bytes memory message) external payable override {\n uint256 requiredL1CallValue = _contractHasSufficientEthBalance();\n\n l1Inbox.createRetryableTicket{ value: requiredL1CallValue }(\n target, // destAddr destination L2 contract address\n 0, // l2CallValue call value for retryable L2 message\n l2MaxSubmissionCost, // maxSubmissionCost Max gas deducted from user's L2 balance to cover base fee\n l2RefundL2Address, // excessFeeRefundAddress maxgas * gasprice - execution cost gets credited here on L2\n l2RefundL2Address, // callValueRefundAddress l2Callvalue gets credited here on L2 if retryable txn times out or gets cancelled\n l2GasLimit, // maxGas Max gas deducted from user's L2 balance to cover L2 execution\n l2GasPrice, // gasPriceBid price bid for L2 execution\n message // data ABI encoded data of L2 message\n );\n\n emit MessageRelayed(target, message);\n }\n\n /**\n * @notice Bridge tokens to Arbitrum.\n * @notice This contract must hold at least getL1CallValue() amount of ETH to send a message via the Inbox\n * successfully, or the message will get stuck.\n * @param l1Token L1 token to deposit.\n * @param l2Token L2 token to receive.\n * @param amount Amount of L1 tokens to deposit and L2 tokens to receive.\n * @param to Bridge recipient.\n */\n function relayTokens(\n address l1Token,\n address l2Token, // l2Token is unused for Arbitrum.\n uint256 amount,\n address to\n ) external payable override {\n uint256 requiredL1CallValue = _contractHasSufficientEthBalance();\n\n // Approve the gateway, not the router, to spend the hub pool's balance. The gateway, which is different\n // per L1 token, will temporarily escrow the tokens to be bridged and pull them from this contract.\n address erc20Gateway = l1ERC20GatewayRouter.getGateway(l1Token);\n IERC20(l1Token).safeIncreaseAllowance(erc20Gateway, amount);\n\n // `outboundTransfer` expects that the caller includes a bytes message as the last param that includes the\n // maxSubmissionCost to use when creating an L2 retryable ticket: https://github.com/OffchainLabs/arbitrum/blob/e98d14873dd77513b569771f47b5e05b72402c5e/packages/arb-bridge-peripherals/contracts/tokenbridge/ethereum/gateway/L1GatewayRouter.sol#L232\n bytes memory data = abi.encode(l2MaxSubmissionCost, \"\");\n l1ERC20GatewayRouter.outboundTransfer{ value: requiredL1CallValue }(l1Token, to, amount, l2GasLimit, l2GasPrice, data);\n\n emit TokensRelayed(l1Token, l2Token, amount, to);\n }\n\n /**\n * @notice Returns required amount of ETH to send a message via the Inbox.\n * @return amount of ETH that this contract needs to hold in order for relayMessage to succeed.\n */\n function getL1CallValue() public pure returns (uint256) {\n return l2MaxSubmissionCost + l2GasPrice * l2GasLimit;\n }\n\n function _contractHasSufficientEthBalance() internal view returns (uint256 requiredL1CallValue) {\n requiredL1CallValue = getL1CallValue();\n require(address(this).balance >= requiredL1CallValue, \"Insufficient ETH balance\");\n }\n}\n" }, "@openzeppelin/contracts/access/Ownable.sol": { "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts v4.4.1 (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 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 called by any account other than the owner.\n */\n modifier onlyOwner() {\n require(owner() == _msgSender(), \"Ownable: caller is not the owner\");\n _;\n }\n\n /**\n * @dev Leaves the contract without owner. It will not be possible to call\n * `onlyOwner` functions anymore. Can only be called by the current owner.\n *\n * NOTE: Renouncing ownership will leave the contract without an owner,\n * thereby removing 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" diff --git a/scripts/setupArbitrumSpokePool.ts b/scripts/setupArbitrumSpokePool.ts new file mode 100644 index 000000000..3a2220e24 --- /dev/null +++ b/scripts/setupArbitrumSpokePool.ts @@ -0,0 +1,23 @@ +// @notice Logs ABI-encoded function data that can be relayed from HubPool to ArbitrumSpokePool to set it up. + +import { getContractFactory, ethers } from "../test/utils"; + +async function main() { + const [signer] = await ethers.getSigners(); + + // We need to whitelist L2 --> L1 token mappings + const spokePool = await getContractFactory("Arbitrum_SpokePool", { signer }); + const whitelistWeth = spokePool.interface.encodeFunctionData("whitelistToken", [ + "0xB47e6A5f8b33b3F17603C83a0535A9dcD7E32681", // L2 WETH + "0xc778417e063141139fce010982780140aa0cd5ab", // L1 WETH + ]); + console.log(`(WETH) whitelistToken: `, whitelistWeth); +} + +main().then( + () => process.exit(0), + (error) => { + console.log(error); + process.exit(1); + } +); diff --git a/test/chain-adapters/Arbitrum_Adapter.ts b/test/chain-adapters/Arbitrum_Adapter.ts index 3b3ed9a60..bc20e5b00 100644 --- a/test/chain-adapters/Arbitrum_Adapter.ts +++ b/test/chain-adapters/Arbitrum_Adapter.ts @@ -1,16 +1,26 @@ import * as consts from "../constants"; -import { ethers, expect, Contract, FakeContract, SignerWithAddress, createFake, toWei, hre } from "../utils"; +import { + ethers, + expect, + Contract, + FakeContract, + SignerWithAddress, + createFake, + toWei, + hre, + defaultAbiCoder, + toBN, +} from "../utils"; import { getContractFactory, seedWallet, randomAddress } from "../utils"; import { hubPoolFixture, enableTokensForLP } from "../fixtures/HubPool.Fixture"; import { constructSingleChainTree } from "../MerkleLib.utils"; let hubPool: Contract, arbitrumAdapter: Contract, weth: Contract, dai: Contract, timer: Contract, mockSpoke: Contract; -let l2Weth: string, l2Dai: string; +let l2Weth: string, l2Dai: string, gatewayAddress: string; let owner: SignerWithAddress, dataWorker: SignerWithAddress, liquidityProvider: SignerWithAddress; -let l1ERC20Gateway: FakeContract, l1Inbox: FakeContract; +let l1ERC20GatewayRouter: FakeContract, l1Inbox: FakeContract; const arbitrumChainId = 42161; -let l1ChainId: number; describe("Arbitrum Chain Adapter", function () { beforeEach(async function () { @@ -28,12 +38,13 @@ describe("Arbitrum Chain Adapter", function () { await dai.connect(dataWorker).approve(hubPool.address, consts.bondAmount.mul(10)); l1Inbox = await createFake("Inbox"); - l1ERC20Gateway = await createFake("TokenGateway"); - l1ChainId = Number(await hre.getChainId()); + l1ERC20GatewayRouter = await createFake("ArbitrumMockErc20GatewayRouter"); + gatewayAddress = randomAddress(); + l1ERC20GatewayRouter.getGateway.returns(gatewayAddress); arbitrumAdapter = await ( await getContractFactory("Arbitrum_Adapter", owner) - ).deploy(l1Inbox.address, l1ERC20Gateway.address); + ).deploy(l1Inbox.address, l1ERC20GatewayRouter.address); // Seed the HubPool some funds so it can send L1->L2 messages. await hubPool.connect(liquidityProvider).loadEthForL2Calls({ value: toWei("1") }); @@ -48,9 +59,10 @@ describe("Arbitrum Chain Adapter", function () { const newAdmin = randomAddress(); const functionCallData = mockSpoke.interface.encodeFunctionData("setCrossDomainAdmin", [newAdmin]); - expect(await hubPool.relaySpokePoolAdminFunction(arbitrumChainId, functionCallData)) - .to.emit(arbitrumAdapter.attach(hubPool.address), "MessageRelayed") - .withArgs(mockSpoke.address, functionCallData); + expect(await hubPool.relaySpokePoolAdminFunction(arbitrumChainId, functionCallData)).to.changeEtherBalances( + [l1Inbox], + [toBN(consts.sampleL2MaxSubmissionCost).add(toBN(consts.sampleL2Gas).mul(consts.sampleL2GasPrice))] + ); expect(l1Inbox.createRetryableTicket).to.have.been.calledOnce; expect(l1Inbox.createRetryableTicket).to.have.been.calledWith( mockSpoke.address, @@ -71,16 +83,27 @@ describe("Arbitrum Chain Adapter", function () { .connect(dataWorker) .proposeRootBundle([3117], 1, tree.getHexRoot(), consts.mockRelayerRefundRoot, consts.mockSlowRelayRoot); await timer.setCurrentTime(Number(await timer.getCurrentTime()) + consts.refundProposalLiveness + 1); - await hubPool.connect(dataWorker).executeRootBundle(...Object.values(leaves[0]), tree.getHexProof(leaves[0])); + expect( + await hubPool.connect(dataWorker).executeRootBundle(...Object.values(leaves[0]), tree.getHexProof(leaves[0])) + ).to.changeEtherBalances( + [l1ERC20GatewayRouter], + [toBN(consts.sampleL2MaxSubmissionCost).add(toBN(consts.sampleL2Gas).mul(consts.sampleL2GasPrice))] + ); + // The correct functions should have been called on the arbitrum contracts. - expect(l1ERC20Gateway.outboundTransfer).to.have.been.calledOnce; // One token transfer over the canonical bridge. - expect(l1ERC20Gateway.outboundTransfer).to.have.been.calledWith( + expect(l1ERC20GatewayRouter.outboundTransfer).to.have.been.calledOnce; // One token transfer over the canonical bridge. + + // Adapter should have approved gateway to spend its ERC20. + expect(await dai.allowance(hubPool.address, gatewayAddress)).to.equal(tokensSendToL2); + + const message = defaultAbiCoder.encode(["uint256", "bytes"], [consts.sampleL2MaxSubmissionCost, "0x"]); + expect(l1ERC20GatewayRouter.outboundTransfer).to.have.been.calledWith( dai.address, mockSpoke.address, tokensSendToL2, consts.sampleL2Gas, consts.sampleL2GasPrice, - "0x" + message ); expect(l1Inbox.createRetryableTicket).to.have.been.calledOnce; // only 1 L1->L2 message sent. expect(l1Inbox.createRetryableTicket).to.have.been.calledWith( diff --git a/test/chain-adapters/Optimism_Adapter.ts b/test/chain-adapters/Optimism_Adapter.ts index 94de74984..0a4b689b2 100644 --- a/test/chain-adapters/Optimism_Adapter.ts +++ b/test/chain-adapters/Optimism_Adapter.ts @@ -16,13 +16,11 @@ let owner: SignerWithAddress, dataWorker: SignerWithAddress, liquidityProvider: let l1CrossDomainMessenger: FakeContract, l1StandardBridge: FakeContract; const optimismChainId = 10; -let l1ChainId: number; describe("Optimism Chain Adapter", function () { beforeEach(async function () { [owner, dataWorker, liquidityProvider] = await ethers.getSigners(); ({ weth, dai, l2Weth, l2Dai, hubPool, mockSpoke, timer, mockAdapter } = await hubPoolFixture()); - l1ChainId = Number(await hre.getChainId()); await seedWallet(dataWorker, [dai], weth, amountToLp); await seedWallet(liquidityProvider, [dai], weth, amountToLp.mul(10)); diff --git a/test/constants.ts b/test/constants.ts index bd4681948..dcd098b40 100644 --- a/test/constants.ts +++ b/test/constants.ts @@ -74,8 +74,9 @@ export const amountToReturn = toWei("1"); export const mockTreeRoot = createRandomBytes32(); -export const sampleL2Gas = 5000000; +// Following should match variables set in Arbitrum_Adapter +export const sampleL2Gas = 2000000; -export const sampleL2MaxSubmissionCost = toWei("0.1"); +export const sampleL2MaxSubmissionCost = toWei("0.01"); -export const sampleL2GasPrice = 10e9; // 10 gWei +export const sampleL2GasPrice = 5e9; From 954b02270ab5f7453ddf0d94e58c8a2cd84dd1c4 Mon Sep 17 00:00:00 2001 From: Chris Maree Date: Fri, 18 Mar 2022 18:07:26 +0200 Subject: [PATCH 06/11] fix[N06] Fix misleading comments (#104) * fix[N04] Add additional documentation Signed-off-by: chrismaree * nit Signed-off-by: chrismaree * fix[N06] Fix missleading comments Signed-off-by: chrismaree * Apply suggestions from code review Co-authored-by: nicholaspai <9457025+nicholaspai@users.noreply.github.com> * nit Signed-off-by: chrismaree Co-authored-by: nicholaspai <9457025+nicholaspai@users.noreply.github.com> --- contracts/HubPool.sol | 9 +++++---- contracts/HubPoolInterface.sol | 19 +++++++++---------- 2 files changed, 14 insertions(+), 14 deletions(-) diff --git a/contracts/HubPool.sol b/contracts/HubPool.sol index 6abf70110..be395c873 100644 --- a/contracts/HubPool.sol +++ b/contracts/HubPool.sol @@ -75,7 +75,9 @@ contract HubPool is HubPoolInterface, Testable, Lockable, MultiCaller, Ownable { bytes32 public identifier = "IS_ACROSS_V2_BUNDLE_VALID"; // Interest rate payment that scales the amount of pending fees per second paid to LPs. 0.0000015e18 will pay out - // the full amount of fees entitled to LPs in ~ 7.72 days, just over the standard L2 7 day liveness. + // the full amount of fees entitled to LPs in ~ 7.72 days assuming no contract interactions. If someone interacts + // with the contract then the LP rewards are smeared sublinearly over the window (i.e spread over the remaining + // period for each interaction which approximates a decreasing exponential function). uint256 public lpFeeRatePerSecond = 1500000000000; // Mapping of l1TokenAddress to cumulative unclaimed protocol tokens that can be sent to the protocolFeeCaptureAddress @@ -560,7 +562,7 @@ contract HubPool is HubPoolInterface, Testable, Lockable, MultiCaller, Ownable { uint32 requestExpirationTimestamp = uint32(getCurrentTime()) + liveness; - delete rootBundleProposal; // Only one bundle of roots can be executed at a time. + delete rootBundleProposal; // Only one bundle of roots can be executed at a time. Delete the previous bundle. rootBundleProposal.requestExpirationTimestamp = requestExpirationTimestamp; rootBundleProposal.unclaimedPoolRebalanceLeafCount = poolRebalanceLeafCount; @@ -588,7 +590,6 @@ contract HubPool is HubPoolInterface, Testable, Lockable, MultiCaller, Ownable { * from this contract to the SpokePool designated in the leaf, and will also publish relayer refund and slow * relay roots to the SpokePool on the network specified in the leaf. * @dev In some cases, will instruct spokePool to send funds back to L1. - * @notice Deletes the published root bundle if this is the last leaf to be executed in the root bundle. * @param chainId ChainId number of the target spoke pool on which the bundle is executed. * @param groupIndex If set to 0, then relay roots to SpokePool via cross chain bridge. Used by off-chain validator * to organize leaves with the same chain ID and also set which leaves should result in relayed messages. @@ -794,7 +795,7 @@ contract HubPool is HubPoolInterface, Testable, Lockable, MultiCaller, Ownable { emit ProtocolFeesCapturedClaimed(l1Token, _unclaimedAccumulatedProtocolFees); } - /** + /**master * @notice Conveniently queries which destination token is mapped to the hash of an l1 token + destination chain ID. * @param destinationChainId Where destination token is deployed. * @param l1Token Ethereum version token. diff --git a/contracts/HubPoolInterface.sol b/contracts/HubPoolInterface.sol index 8953669c1..3fb2eef4b 100644 --- a/contracts/HubPoolInterface.sol +++ b/contracts/HubPoolInterface.sol @@ -15,13 +15,12 @@ interface HubPoolInterface { uint256 chainId; // Total LP fee amount per token in this bundle, encompassing all associated bundled relays. uint256[] bundleLpFees; - // This array is grouped with the two above, and it represents the amount to send or request back from the - // SpokePool. If positive, the pool will pay the SpokePool. If negative the SpokePool will pay the HubPool. - // There can be arbitrarily complex rebalancing rules defined offchain. This number is only nonzero when the - // rules indicate that a rebalancing action should occur. When a rebalance does occur, runningBalances should be - // set to zero for this token and the netSendAmounts should be set to the previous runningBalances + relays - - // deposits in this bundle. If non-zero then it must be set on the SpokePool's RelayerRefundLeaf amountToReturn - // as -1 * this value to indicate if funds are being sent from or to the SpokePool. + // Represents the amount to push to or pull from the SpokePool. If +, the pool pays the SpokePool. If negative + // the SpokePool pays the HubPool. There can be arbitrarily complex rebalancing rules defined offchain. This + // number is only nonzero when the rules indicate that a rebalancing action should occur. When a rebalance does + // occur, runningBalances must be set to zero for this token and netSendAmounts should be set to the previous + // runningBalances + relays - deposits in this bundle. If non-zero then it must be set on the SpokePool's + // RelayerRefundLeaf amountToReturn as -1 * this value to show if funds are being sent from or to the SpokePool. int256[] netSendAmounts; // This is only here to be emitted in an event to track a running unpaid balance between the L2 pool and the L1 // pool. A positive number indicates that the HubPool owes the SpokePool funds. A negative number indicates that @@ -36,9 +35,9 @@ interface HubPoolInterface { uint256 groupIndex; // Used as the index in the bitmap to track whether this leaf has been executed or not. uint8 leafId; - // The following arrays are required to be the same length. They are parallel arrays for the given chainId and - // should be ordered by the l1Tokens field. All whitelisted tokens with nonzero relays on this chain in this - // bundle in the order of whitelisting. + // The bundleLpFees, netSendAmounts, and runningBalances are required to be the same length. They are parallel + // arrays for the given chainId and should be ordered by the l1Tokens field. All whitelisted tokens with nonzero + // relays on this chain in this bundle in the order of whitelisting. address[] l1Tokens; } From 980defa7de2f08413754834faac97bc32cb9b6dd Mon Sep 17 00:00:00 2001 From: Chris Maree Date: Fri, 18 Mar 2022 18:14:07 +0200 Subject: [PATCH 07/11] fix[N08] Propose fixes to some naming issues (#105) * fix[N02} Move all structs to the same place Signed-off-by: chrismaree * fix[N03] Fixed inconsistant token metadata versioning Signed-off-by: chrismaree * nit Signed-off-by: chrismaree * nit Signed-off-by: chrismaree * fix[N08] Propose fixes to some naming issues Signed-off-by: chrismaree --- contracts/HubPool.sol | 28 +++++---- contracts/HubPoolInterface.sol | 6 +- contracts/LpTokenFactory.sol | 7 ++- contracts/Optimism_SpokePool.sol | 16 ++--- contracts/Polygon_SpokePool.sol | 9 ++- contracts/SpokePool.sol | 61 ++++++++++--------- contracts/SpokePoolInterface.sol | 4 +- test/HubPool.DisputeRootBundle.ts | 6 +- test/HubPool.ProposeRootBundle.ts | 6 +- test/SpokePool.ExecuteRootBundle.ts | 15 ++--- test/SpokePool.SlowRelay.ts | 18 +++--- .../Arbitrum_SpokePool.ts | 4 +- .../Ethereum_SpokePool.ts | 2 +- .../Optimism_SpokePool.ts | 6 +- .../Polygon_SpokePool.ts | 2 +- .../SpokePool.RelayerRefundRootExecution.ts | 20 +++--- .../SpokePool.SlowRelayRootExecution.ts | 20 +++--- 17 files changed, 117 insertions(+), 113 deletions(-) diff --git a/contracts/HubPool.sol b/contracts/HubPool.sol index be395c873..70b7c29b5 100644 --- a/contracts/HubPool.sol +++ b/contracts/HubPool.sol @@ -149,8 +149,8 @@ contract HubPool is HubPoolInterface, Testable, Lockable, MultiCaller, Ownable { bool depositsEnabled ); event ProposeRootBundle( - uint32 requestExpirationTimestamp, - uint64 unclaimedPoolRebalanceLeafCount, + uint32 challengePeriodEndTimestamp, + uint64 poolRebalanceLeafCount, uint256[] bundleEvaluationBlockNumbers, bytes32 indexed poolRebalanceRoot, bytes32 indexed relayerRefundRoot, @@ -161,10 +161,10 @@ contract HubPool is HubPoolInterface, Testable, Lockable, MultiCaller, Ownable { uint256 groupIndex, uint256 indexed leafId, uint256 indexed chainId, - address[] l1Token, + address[] l1Tokens, uint256[] bundleLpFees, - int256[] netSendAmount, - int256[] runningBalance, + int256[] netSendAmounts, + int256[] runningBalances, address indexed caller ); event SpokePoolAdminFunctionTriggered(uint256 indexed chainId, bytes message); @@ -560,11 +560,11 @@ contract HubPool is HubPoolInterface, Testable, Lockable, MultiCaller, Ownable { // technically valid but not useful. This could also potentially be enforced at the UMIP-level. require(poolRebalanceLeafCount > 0, "Bundle must have at least 1 leaf"); - uint32 requestExpirationTimestamp = uint32(getCurrentTime()) + liveness; + uint32 challengePeriodEndTimestamp = uint32(getCurrentTime()) + liveness; delete rootBundleProposal; // Only one bundle of roots can be executed at a time. Delete the previous bundle. - rootBundleProposal.requestExpirationTimestamp = requestExpirationTimestamp; + rootBundleProposal.challengePeriodEndTimestamp = challengePeriodEndTimestamp; rootBundleProposal.unclaimedPoolRebalanceLeafCount = poolRebalanceLeafCount; rootBundleProposal.poolRebalanceRoot = poolRebalanceRoot; rootBundleProposal.relayerRefundRoot = relayerRefundRoot; @@ -575,7 +575,7 @@ contract HubPool is HubPoolInterface, Testable, Lockable, MultiCaller, Ownable { bondToken.safeTransferFrom(msg.sender, address(this), bondAmount); emit ProposeRootBundle( - requestExpirationTimestamp, + challengePeriodEndTimestamp, poolRebalanceLeafCount, bundleEvaluationBlockNumbers, poolRebalanceRoot, @@ -611,7 +611,7 @@ contract HubPool is HubPoolInterface, Testable, Lockable, MultiCaller, Ownable { address[] memory l1Tokens, bytes32[] memory proof ) public nonReentrant unpaused { - require(getCurrentTime() > rootBundleProposal.requestExpirationTimestamp, "Not passed liveness"); + require(getCurrentTime() > rootBundleProposal.challengePeriodEndTimestamp, "Not passed liveness"); // Verify the leafId in the poolRebalanceLeaf has not yet been claimed. require(!MerkleLib.isClaimed1D(rootBundleProposal.claimedBitMap, leafId), "Already claimed"); @@ -703,7 +703,7 @@ contract HubPool is HubPoolInterface, Testable, Lockable, MultiCaller, Ownable { */ function disputeRootBundle() public nonReentrant zeroOptimisticOracleApproval { uint32 currentTime = uint32(getCurrentTime()); - require(currentTime <= rootBundleProposal.requestExpirationTimestamp, "Request passed liveness"); + require(currentTime <= rootBundleProposal.challengePeriodEndTimestamp, "Request passed liveness"); // Request price from OO and dispute it. uint256 finalFee = _getBondTokenFinalFee(); @@ -949,10 +949,12 @@ contract HubPool is HubPoolInterface, Testable, Lockable, MultiCaller, Ownable { // that will flow from L2 to L1. In this case, we can use it normally in the equation. However, if it is // negative, then it is already counted in liquidReserves. This occurs if tokens are transferred directly to the // contract. In this case, ignore it as it is captured in liquid reserves and has no meaning in the numerator. - PooledToken memory pooledToken = pooledTokens[l1Token]; // Note this is storage so the state can be modified. - uint256 flooredUtilizedReserves = pooledToken.utilizedReserves > 0 ? uint256(pooledToken.utilizedReserves) : 0; + PooledToken memory pooledL1Token = pooledTokens[l1Token]; + uint256 flooredUtilizedReserves = pooledL1Token.utilizedReserves > 0 + ? uint256(pooledL1Token.utilizedReserves) // If positive: take the uint256 cast utilizedReserves. + : 0; // Else, if negative, then the is already captured in liquidReserves and should be ignored. uint256 numerator = relayedAmount + flooredUtilizedReserves; - uint256 denominator = pooledToken.liquidReserves + flooredUtilizedReserves; + uint256 denominator = pooledL1Token.liquidReserves + flooredUtilizedReserves; // If the denominator equals zero, return 1e18 (max utilization). if (denominator == 0) return 1e18; diff --git a/contracts/HubPoolInterface.sol b/contracts/HubPoolInterface.sol index 3fb2eef4b..1d72360ea 100644 --- a/contracts/HubPoolInterface.sol +++ b/contracts/HubPoolInterface.sol @@ -48,7 +48,7 @@ interface HubPoolInterface { // - Send funds from a SpokePool to Relayer as a refund for a relayed deposit // - Send funds from a SpokePool to a deposit recipient to fulfill a "slow" relay // Anyone can dispute this struct if the merkle roots contain invalid leaves before the - // requestExpirationTimestamp. Once the expiration timestamp is passed, executeRootBundle to execute a leaf + // challengePeriodEndTimestamp. Once the expiration timestamp is passed, executeRootBundle to execute a leaf // from the poolRebalanceRoot on this contract and it will simultaneously publish the relayerRefundRoot and // slowRelayRoot to a SpokePool. The latter two roots, once published to the SpokePool, contain // leaves that can be executed on the SpokePool to pay relayers or recipients. @@ -67,7 +67,7 @@ interface HubPoolInterface { // of leaves are executed, a new root bundle can be proposed uint8 unclaimedPoolRebalanceLeafCount; // When root bundle challenge period passes and this root bundle becomes executable. - uint32 requestExpirationTimestamp; + uint32 challengePeriodEndTimestamp; } // Each whitelisted L1 token has an associated pooledToken struct that contains all information used to track the @@ -130,7 +130,7 @@ interface HubPoolInterface { function liquidityUtilizationCurrent(address l1Token) external returns (uint256); - function liquidityUtilizationPostRelay(address token, uint256 relayedAmount) external returns (uint256); + function liquidityUtilizationPostRelay(address l1Token, uint256 relayedAmount) external returns (uint256); function sync(address l1Token) external; diff --git a/contracts/LpTokenFactory.sol b/contracts/LpTokenFactory.sol index 777558b55..f947805b1 100644 --- a/contracts/LpTokenFactory.sol +++ b/contracts/LpTokenFactory.sol @@ -17,10 +17,11 @@ contract LpTokenFactory is LpTokenFactoryInterface { */ function createLpToken(address l1Token) public returns (address) { ExpandedERC20 lpToken = new ExpandedERC20( - _append("Across V2 ", IERC20Metadata(l1Token).name(), " LP Token"), // LP Token Name - _append("Av2-", IERC20Metadata(l1Token).symbol(), "-LP"), // LP Token Symbol + _concatenate("Across V2 ", IERC20Metadata(l1Token).name(), " LP Token"), // LP Token Name + _concatenate("Av2-", IERC20Metadata(l1Token).symbol(), "-LP"), // LP Token Symbol IERC20Metadata(l1Token).decimals() // LP Token Decimals ); + lpToken.addMinter(msg.sender); // Set the caller as the LP Token's minter. lpToken.addBurner(msg.sender); // Set the caller as the LP Token's burner. lpToken.resetOwner(msg.sender); // Set the caller as the LP Token's owner. @@ -28,7 +29,7 @@ contract LpTokenFactory is LpTokenFactoryInterface { return address(lpToken); } - function _append( + function _concatenate( string memory a, string memory b, string memory c diff --git a/contracts/Optimism_SpokePool.sol b/contracts/Optimism_SpokePool.sol index 0776bd65d..03b11f940 100644 --- a/contracts/Optimism_SpokePool.sol +++ b/contracts/Optimism_SpokePool.sol @@ -74,7 +74,7 @@ contract Optimism_SpokePool is CrossDomainEnabled, SpokePool { * ETH over the canonical token bridge instead of WETH. * @inheritdoc SpokePool */ - function executeSlowRelayRoot( + function executeSlowRelayLeaf( address depositor, address recipient, address destinationToken, @@ -86,9 +86,9 @@ contract Optimism_SpokePool is CrossDomainEnabled, SpokePool { uint32 rootBundleId, bytes32[] memory proof ) public override(SpokePool) nonReentrant { - if (destinationToken == address(weth)) _depositEthToWeth(); + if (destinationToken == address(wrappedNativeToken)) _depositEthToWeth(); - _executeSlowRelayRoot( + _executeSlowRelayLeaf( depositor, recipient, destinationToken, @@ -108,14 +108,14 @@ contract Optimism_SpokePool is CrossDomainEnabled, SpokePool { * ETH over the canonical token bridge instead of WETH. * @inheritdoc SpokePool */ - function executeRelayerRefundRoot( + function executeRelayerRefundLeaf( uint32 rootBundleId, SpokePoolInterface.RelayerRefundLeaf memory relayerRefundLeaf, bytes32[] memory proof ) public override(SpokePool) nonReentrant { - if (relayerRefundLeaf.l2TokenAddress == address(weth)) _depositEthToWeth(); + if (relayerRefundLeaf.l2TokenAddress == address(wrappedNativeToken)) _depositEthToWeth(); - _executeRelayerRefundRoot(rootBundleId, relayerRefundLeaf, proof); + _executeRelayerRefundLeaf(rootBundleId, relayerRefundLeaf, proof); } /************************************** @@ -127,13 +127,13 @@ contract Optimism_SpokePool is CrossDomainEnabled, SpokePool { // this logic inside a fallback method that executes when this contract receives ETH because ETH is an ERC20 // on the OVM. function _depositEthToWeth() internal { - if (address(this).balance > 0) weth.deposit{ value: address(this).balance }(); + if (address(this).balance > 0) wrappedNativeToken.deposit{ value: address(this).balance }(); } function _bridgeTokensToHubPool(RelayerRefundLeaf memory relayerRefundLeaf) internal override { // If the token being bridged is WETH then we need to first unwrap it to ETH and then send ETH over the // canonical bridge. On Optimism, this is address 0xDeadDeAddeAddEAddeadDEaDDEAdDeaDDeAD0000. - if (relayerRefundLeaf.l2TokenAddress == address(weth)) { + if (relayerRefundLeaf.l2TokenAddress == address(wrappedNativeToken)) { WETH9(relayerRefundLeaf.l2TokenAddress).withdraw(relayerRefundLeaf.amountToReturn); // Unwrap into ETH. relayerRefundLeaf.l2TokenAddress = l2Eth; // Set the l2TokenAddress to ETH. } diff --git a/contracts/Polygon_SpokePool.sol b/contracts/Polygon_SpokePool.sol index 0d98a4132..1ae0db2f8 100644 --- a/contracts/Polygon_SpokePool.sol +++ b/contracts/Polygon_SpokePool.sol @@ -65,8 +65,7 @@ contract Polygon_SpokePool is IFxMessageProcessor, SpokePool { * @param _polygonTokenBridger Token routing contract that sends tokens from here to HubPool. Changeable by Admin. * @param _crossDomainAdmin Cross domain admin to set. Can be changed by admin. * @param _hubPool Hub pool address to set. Can be changed by admin. - * @param _wmaticAddress Replaces _wethAddress for this network since MATIC is the gas token and sent via msg.value - * on Polygon. + * @param _wmaticAddress Replaces wrappedNativeToken for this network since MATIC is the native currency on polygon. * @param _fxChild FxChild contract, changeable by Admin. * @param timerAddress Timer address to set. */ @@ -83,7 +82,7 @@ contract Polygon_SpokePool is IFxMessageProcessor, SpokePool { } /******************************************************** - * ARBITRUM-SPECIFIC CROSS-CHAIN ADMIN FUNCTIONS * + * POLYGON-SPECIFIC CROSS-CHAIN ADMIN FUNCTIONS * ********************************************************/ /** @@ -138,11 +137,11 @@ contract Polygon_SpokePool is IFxMessageProcessor, SpokePool { relayerRefundLeaf.amountToReturn ); - // Note: WETH is WMATIC on matic, so this tells the tokenbridger that this is an unwrappable native token. + // Note: WrappedNativeToken is WMATIC on matic, so this tells the tokenbridger that this is an unwrappable native token. polygonTokenBridger.send( PolygonIERC20(relayerRefundLeaf.l2TokenAddress), relayerRefundLeaf.amountToReturn, - address(weth) == relayerRefundLeaf.l2TokenAddress + address(wrappedNativeToken) == relayerRefundLeaf.l2TokenAddress ); emit PolygonTokensBridged(relayerRefundLeaf.l2TokenAddress, address(this), relayerRefundLeaf.amountToReturn); diff --git a/contracts/SpokePool.sol b/contracts/SpokePool.sol index 504a8ace8..adab439db 100644 --- a/contracts/SpokePool.sol +++ b/contracts/SpokePool.sol @@ -35,9 +35,9 @@ abstract contract SpokePool is SpokePoolInterface, Testable, Lockable, MultiCall // refunds and slow relays. address public hubPool; - // Address of WETH contract for this network. If an origin token matches this, then the caller can optionally - // instruct this contract to wrap ETH when depositing. - WETH9 public immutable weth; + // Address of wrappedNativeToken contract for this network. If an origin token matches this, then the caller can + // optionally instruct this contract to wrap native tokens when depositing (ie ETH->WETH or MATIC->WMATIC). + WETH9 public immutable wrappedNativeToken; // Any deposit quote times greater than or less than this value to the current contract time is blocked. Forces // caller to use an approximately "current" realized fee. Defaults to 10 minutes. @@ -123,18 +123,18 @@ abstract contract SpokePool is SpokePoolInterface, Testable, Lockable, MultiCall * @notice Construct the base SpokePool. * @param _crossDomainAdmin Cross domain admin to set. Can be changed by admin. * @param _hubPool Hub pool address to set. Can be changed by admin. - * @param _wethAddress Weth address for this network to set. + * @param _wrappedNativeTokenAddress wrappedNativeToken address for this network to set. * @param timerAddress Timer address to set. */ constructor( address _crossDomainAdmin, address _hubPool, - address _wethAddress, + address _wrappedNativeTokenAddress, address timerAddress ) Testable(timerAddress) { _setCrossDomainAdmin(_crossDomainAdmin); _setHubPool(_hubPool); - weth = WETH9(_wethAddress); + wrappedNativeToken = WETH9(_wrappedNativeTokenAddress); } /**************************************** @@ -197,9 +197,9 @@ abstract contract SpokePool is SpokePoolInterface, Testable, Lockable, MultiCall * slow relays, and send funds back to the HubPool on L1. This method can only be called by the admin and is * designed to be called as part of a cross-chain message from the HubPool's executeRootBundle method. * @param relayerRefundRoot Merkle root containing relayer refund leaves that can be individually executed via - * executeRelayerRefundRoot(). + * executeRelayerRefundLeaf(). * @param slowRelayRoot Merkle root containing slow relay fulfillment leaves that can be individually executed via - * executeSlowRelayRoot(). + * executeSlowRelayLeaf(). */ function relayRootBundle(bytes32 relayerRefundRoot, bytes32 slowRelayRoot) public override onlyAdmin nonReentrant { uint32 rootBundleId = uint32(rootBundles.length); @@ -230,8 +230,8 @@ abstract contract SpokePool is SpokePoolInterface, Testable, Lockable, MultiCall * token mapping is stored on the L1 HubPool. * @notice The caller must first approve this contract to spend amount of originToken. * @notice The originToken => destinationChainId must be enabled. - * @notice This method is payable because the caller is able to deposit ETH if the originToken is WETH and this - * function will handle wrapping ETH. + * @notice This method is payable because the caller is able to deposit native token if the originToken is + * wrappedNativeToken and this function will handle wrapping the native token to wrappedNativeToken. * @param recipient Address to receive funds at on destination chain. * @param originToken Token to lock into this contract to initiate deposit. * @param amount Amount of tokens to deposit. Will be amount of tokens to receive less fees. @@ -263,11 +263,11 @@ abstract contract SpokePool is SpokePoolInterface, Testable, Lockable, MultiCall getCurrentTime() <= quoteTimestamp + depositQuoteTimeBuffer, "invalid quote time" ); - // If the address of the origin token is a WETH contract and there is a msg.value with the transaction - // then the user is sending ETH. In this case, the ETH should be deposited to WETH. - if (originToken == address(weth) && msg.value > 0) { + // If the address of the origin token is a wrappedNativeToken contract and there is a msg.value with the + // transaction then the user is sending ETH. In this case, the ETH should be deposited to wrappedNativeToken. + if (originToken == address(wrappedNativeToken) && msg.value > 0) { require(msg.value == amount, "msg.value must match amount"); - weth.deposit{ value: msg.value }(); + wrappedNativeToken.deposit{ value: msg.value }(); // Else, it is a normal ERC20. In this case pull the token from the user's wallet as per normal. // Note: this includes the case where the L2 user has WETH (already wrapped ETH) and wants to bridge them. // In this case the msg.value will be set to 0, indicating a "normal" ERC20 bridging action. @@ -460,7 +460,7 @@ abstract contract SpokePool is SpokePoolInterface, Testable, Lockable, MultiCall * @param rootBundleId Unique ID of root bundle containing slow relay root that this leaf is contained in. * @param proof Inclusion proof for this leaf in slow relay root in root bundle. */ - function executeSlowRelayRoot( + function executeSlowRelayLeaf( address depositor, address recipient, address destinationToken, @@ -472,7 +472,7 @@ abstract contract SpokePool is SpokePoolInterface, Testable, Lockable, MultiCall uint32 rootBundleId, bytes32[] memory proof ) public virtual override nonReentrant { - _executeSlowRelayRoot( + _executeSlowRelayLeaf( depositor, recipient, destinationToken, @@ -495,12 +495,12 @@ abstract contract SpokePool is SpokePoolInterface, Testable, Lockable, MultiCall * refund relayer. This data structure is explained in detail in the SpokePoolInterface. * @param proof Inclusion proof for this leaf in relayer refund root in root bundle. */ - function executeRelayerRefundRoot( + function executeRelayerRefundLeaf( uint32 rootBundleId, SpokePoolInterface.RelayerRefundLeaf memory relayerRefundLeaf, bytes32[] memory proof ) public virtual override nonReentrant { - _executeRelayerRefundRoot(rootBundleId, relayerRefundLeaf, proof); + _executeRelayerRefundLeaf(rootBundleId, relayerRefundLeaf, proof); } /************************************** @@ -521,7 +521,7 @@ abstract contract SpokePool is SpokePoolInterface, Testable, Lockable, MultiCall // Verifies inclusion proof of leaf in root, sends relayer their refund, and sends to HubPool any rebalance // transfers. - function _executeRelayerRefundRoot( + function _executeRelayerRefundLeaf( uint32 rootBundleId, SpokePoolInterface.RelayerRefundLeaf memory relayerRefundLeaf, bytes32[] memory proof @@ -577,7 +577,7 @@ abstract contract SpokePool is SpokePoolInterface, Testable, Lockable, MultiCall } // Verifies inclusion proof of leaf in root and sends recipient remainder of relay. Marks relay as filled. - function _executeSlowRelayRoot( + function _executeSlowRelayLeaf( address depositor, address recipient, address destinationToken, @@ -687,12 +687,12 @@ abstract contract SpokePool is SpokePoolInterface, Testable, Lockable, MultiCall return keccak256(abi.encode(relayData)); } - // Unwraps ETH and does a transfer to a recipient address. If the recipient is a smart contract then sends WETH. - function _unwrapWETHTo(address payable to, uint256 amount) internal { + // Unwraps ETH and does a transfer to a recipient address. If the recipient is a smart contract then sends wrappedNativeToken. + function _unwrapwrappedNativeTokenTo(address payable to, uint256 amount) internal { if (address(to).isContract()) { - IERC20(address(weth)).safeTransfer(to, amount); + IERC20(address(wrappedNativeToken)).safeTransfer(to, amount); } else { - weth.withdraw(amount); + wrappedNativeToken.withdraw(amount); to.transfer(amount); } } @@ -755,15 +755,16 @@ abstract contract SpokePool is SpokePoolInterface, Testable, Lockable, MultiCall // fill any relay up to 100 tokens, and partial fill with 100 tokens for larger relays). relayFills[relayHash] += fillAmountPreFees; - // If relay token is weth then unwrap and send eth. - if (relayData.destinationToken == address(weth)) { + // If relay token is wrappedNativeToken then unwrap and send native token. + if (relayData.destinationToken == address(wrappedNativeToken)) { // Note: useContractFunds is True if we want to send funds to the recipient directly out of this contract, // otherwise we expect the caller to send funds to the recipient. If useContractFunds is True and the - // recipient wants WETH, then we can assume that WETH is already in the contract, otherwise we'll need the - // the user to send WETH to this contract. Regardless, we'll need to unwrap it before sending to the user. + // recipient wants wrappedNativeToken, then we can assume that wrappedNativeToken is already in the + // contract, otherwise we'll need the user to send wrappedNativeToken to this contract. Regardless, we'll + // need to unwrap it to native token before sending to the user. if (!useContractFunds) IERC20(relayData.destinationToken).safeTransferFrom(msg.sender, address(this), amountToSend); - _unwrapWETHTo(payable(relayData.recipient), amountToSend); + _unwrapwrappedNativeTokenTo(payable(relayData.recipient), amountToSend); // Else, this is a normal ERC20 token. Send to recipient. } else { // Note: Similar to note above, send token directly from the contract to the user in the slow relay case. @@ -830,6 +831,6 @@ abstract contract SpokePool is SpokePoolInterface, Testable, Lockable, MultiCall // L1, this would just be the same admin of the HubPool. function _requireAdminSender() internal virtual; - // Added to enable the this contract to receive ETH. Used when unwrapping Weth. + // Added to enable the this contract to receive native token (ETH). Used when unwrapping wrappedNativeToken. receive() external payable {} } diff --git a/contracts/SpokePoolInterface.sol b/contracts/SpokePoolInterface.sol index 3b33f6bbf..d77534d05 100644 --- a/contracts/SpokePoolInterface.sol +++ b/contracts/SpokePoolInterface.sol @@ -120,7 +120,7 @@ interface SpokePoolInterface { bytes memory depositorSignature ) external; - function executeSlowRelayRoot( + function executeSlowRelayLeaf( address depositor, address recipient, address destinationToken, @@ -133,7 +133,7 @@ interface SpokePoolInterface { bytes32[] memory proof ) external; - function executeRelayerRefundRoot( + function executeRelayerRefundLeaf( uint32 rootBundleId, SpokePoolInterface.RelayerRefundLeaf memory relayerRefundLeaf, bytes32[] memory proof diff --git a/test/HubPool.DisputeRootBundle.ts b/test/HubPool.DisputeRootBundle.ts index ce5f1c6dc..2c32e2dec 100644 --- a/test/HubPool.DisputeRootBundle.ts +++ b/test/HubPool.DisputeRootBundle.ts @@ -38,7 +38,7 @@ describe("HubPool Root Bundle Dispute", function () { // Data should be deleted from the contracts refundRequest struct. const rootBundle = await hubPool.rootBundleProposal(); - expect(rootBundle.requestExpirationTimestamp).to.equal(0); + expect(rootBundle.challengePeriodEndTimestamp).to.equal(0); expect(rootBundle.unclaimedPoolRebalanceLeafCount).to.equal(0); expect(rootBundle.poolRebalanceRoot).to.equal(consts.zeroBytes32); expect(rootBundle.relayerRefundRoot).to.equal(consts.zeroBytes32); @@ -97,7 +97,7 @@ describe("HubPool Root Bundle Dispute", function () { // Data should be deleted from the contracts refundRequest struct. const rootBundle = await hubPool.rootBundleProposal(); - expect(rootBundle.requestExpirationTimestamp).to.equal(0); + expect(rootBundle.challengePeriodEndTimestamp).to.equal(0); expect(rootBundle.unclaimedPoolRebalanceLeafCount).to.equal(0); expect(rootBundle.poolRebalanceRoot).to.equal(consts.zeroBytes32); expect(rootBundle.relayerRefundRoot).to.equal(consts.zeroBytes32); @@ -140,7 +140,7 @@ describe("HubPool Root Bundle Dispute", function () { // Data should be deleted from the contracts refundRequest struct. const rootBundle = await hubPool.rootBundleProposal(); - expect(rootBundle.requestExpirationTimestamp).to.equal(0); + expect(rootBundle.challengePeriodEndTimestamp).to.equal(0); expect(rootBundle.unclaimedPoolRebalanceLeafCount).to.equal(0); expect(rootBundle.poolRebalanceRoot).to.equal(consts.zeroBytes32); expect(rootBundle.relayerRefundRoot).to.equal(consts.zeroBytes32); diff --git a/test/HubPool.ProposeRootBundle.ts b/test/HubPool.ProposeRootBundle.ts index 3d7aaf4a9..fa6b3b254 100644 --- a/test/HubPool.ProposeRootBundle.ts +++ b/test/HubPool.ProposeRootBundle.ts @@ -12,7 +12,7 @@ describe("HubPool Root Bundle Proposal", function () { }); it("Proposal of root bundle correctly stores data, emits events and pulls the bond", async function () { - const expectedRequestExpirationTimestamp = Number(await hubPool.getCurrentTime()) + consts.refundProposalLiveness; + const expectedchallengePeriodEndTimestamp = Number(await hubPool.getCurrentTime()) + consts.refundProposalLiveness; await weth.connect(dataWorker).approve(hubPool.address, consts.totalBond); const dataWorkerWethBalancerBefore = await weth.callStatic.balanceOf(dataWorker.address); @@ -29,7 +29,7 @@ describe("HubPool Root Bundle Proposal", function () { ) .to.emit(hubPool, "ProposeRootBundle") .withArgs( - expectedRequestExpirationTimestamp, + expectedchallengePeriodEndTimestamp, consts.mockPoolRebalanceLeafCount, consts.mockBundleEvaluationBlockNumbers, consts.mockPoolRebalanceRoot, @@ -42,7 +42,7 @@ describe("HubPool Root Bundle Proposal", function () { expect(await weth.balanceOf(dataWorker.address)).to.equal(dataWorkerWethBalancerBefore.sub(consts.totalBond)); const rootBundle = await hubPool.rootBundleProposal(); - expect(rootBundle.requestExpirationTimestamp).to.equal(expectedRequestExpirationTimestamp); + expect(rootBundle.challengePeriodEndTimestamp).to.equal(expectedchallengePeriodEndTimestamp); expect(rootBundle.unclaimedPoolRebalanceLeafCount).to.equal(consts.mockPoolRebalanceLeafCount); expect(rootBundle.poolRebalanceRoot).to.equal(consts.mockPoolRebalanceRoot); expect(rootBundle.relayerRefundRoot).to.equal(consts.mockRelayerRefundRoot); diff --git a/test/SpokePool.ExecuteRootBundle.ts b/test/SpokePool.ExecuteRootBundle.ts index 8f336e96d..e883a90e2 100644 --- a/test/SpokePool.ExecuteRootBundle.ts +++ b/test/SpokePool.ExecuteRootBundle.ts @@ -43,7 +43,7 @@ describe("SpokePool Root Bundle Execution", function () { ); // Distribute the first leaf. - await spokePool.connect(dataWorker).executeRelayerRefundRoot(0, leaves[0], tree.getHexProof(leaves[0])); + await spokePool.connect(dataWorker).executeRelayerRefundLeaf(0, leaves[0], tree.getHexProof(leaves[0])); // Relayers should be refunded expect(await destErc20.balanceOf(spokePool.address)).to.equal(consts.amountHeldByPool.sub(leavesRefundAmount)); @@ -65,7 +65,8 @@ describe("SpokePool Root Bundle Execution", function () { expect(tokensBridgedEvents.length).to.equal(1); // Does not attempt to bridge tokens if amountToReturn is 0. Execute a leaf where amountToReturn is 0. - await spokePool.connect(dataWorker).executeRelayerRefundRoot(0, leaves[1], tree.getHexProof(leaves[1])); + await spokePool.connect(dataWorker).executeRelayerRefundLeaf(0, leaves[1], tree.getHexProof(leaves[1])); + // Show that a second DistributedRelayRefund event was emitted but not a second TokensBridged event. relayTokensEvents = await spokePool.queryFilter(spokePool.filters.ExecutedRelayerRefundRoot()); expect(relayTokensEvents.length).to.equal(2); @@ -83,11 +84,11 @@ describe("SpokePool Root Bundle Execution", function () { // Take the valid root but change some element within it. This will change the hash of the leaf // and as such the contract should reject it for not being included within the merkle tree for the valid proof. const badLeaf = { ...leaves[0], chainId: 13371 }; - await expect(spokePool.connect(dataWorker).executeRelayerRefundRoot(0, badLeaf, tree.getHexProof(leaves[0]))).to.be + await expect(spokePool.connect(dataWorker).executeRelayerRefundLeaf(0, badLeaf, tree.getHexProof(leaves[0]))).to.be .reverted; // Reverts if the distribution root index is incorrect. - await expect(spokePool.connect(dataWorker).executeRelayerRefundRoot(1, leaves[0], tree.getHexProof(leaves[0]))).to + await expect(spokePool.connect(dataWorker).executeRelayerRefundLeaf(1, leaves[0], tree.getHexProof(leaves[0]))).to .be.reverted; }); it("Cannot refund leaf with chain ID for another network", async function () { @@ -99,7 +100,7 @@ describe("SpokePool Root Bundle Execution", function () { ); // Root is valid and leaf is contained in tree, but chain ID doesn't match pool's chain ID. - await expect(spokePool.connect(dataWorker).executeRelayerRefundRoot(0, leaves[0], tree.getHexProof(leaves[0]))).to + await expect(spokePool.connect(dataWorker).executeRelayerRefundLeaf(0, leaves[0], tree.getHexProof(leaves[0]))).to .be.reverted; }); it("Execution rejects double claimed leaves", async function () { @@ -110,8 +111,8 @@ describe("SpokePool Root Bundle Execution", function () { ); // First claim should be fine. Second claim should be reverted as you cant double claim a leaf. - await spokePool.connect(dataWorker).executeRelayerRefundRoot(0, leaves[0], tree.getHexProof(leaves[0])); - await expect(spokePool.connect(dataWorker).executeRelayerRefundRoot(0, leaves[0], tree.getHexProof(leaves[0]))).to + await spokePool.connect(dataWorker).executeRelayerRefundLeaf(0, leaves[0], tree.getHexProof(leaves[0])); + await expect(spokePool.connect(dataWorker).executeRelayerRefundLeaf(0, leaves[0], tree.getHexProof(leaves[0]))).to .be.reverted; }); }); diff --git a/test/SpokePool.SlowRelay.ts b/test/SpokePool.SlowRelay.ts index c749059e2..b4dd8ff0d 100644 --- a/test/SpokePool.SlowRelay.ts +++ b/test/SpokePool.SlowRelay.ts @@ -90,7 +90,7 @@ describe("SpokePool Slow Relay Logic", async function () { await expect(() => spokePool .connect(relayer) - .executeSlowRelayRoot( + .executeSlowRelayLeaf( ...getExecuteSlowRelayParams( depositor.address, recipient.address, @@ -117,7 +117,7 @@ describe("SpokePool Slow Relay Logic", async function () { await expect( spokePool .connect(relayer) - .executeSlowRelayRoot( + .executeSlowRelayLeaf( ...getExecuteSlowRelayParams( depositor.address, recipient.address, @@ -156,7 +156,7 @@ describe("SpokePool Slow Relay Logic", async function () { await expect(() => spokePool .connect(relayer) - .executeSlowRelayRoot( + .executeSlowRelayLeaf( ...getExecuteSlowRelayParams( depositor.address, recipient.address, @@ -177,7 +177,7 @@ describe("SpokePool Slow Relay Logic", async function () { await expect(() => spokePool .connect(relayer) - .executeSlowRelayRoot( + .executeSlowRelayLeaf( ...getExecuteSlowRelayParams( depositor.address, recipient.address, @@ -221,7 +221,7 @@ describe("SpokePool Slow Relay Logic", async function () { await expect(() => spokePool .connect(relayer) - .executeSlowRelayRoot( + .executeSlowRelayLeaf( ...getExecuteSlowRelayParams( depositor.address, recipient.address, @@ -264,7 +264,7 @@ describe("SpokePool Slow Relay Logic", async function () { await expect(() => spokePool .connect(relayer) - .executeSlowRelayRoot( + .executeSlowRelayLeaf( ...getExecuteSlowRelayParams( depositor.address, recipient.address, @@ -307,7 +307,7 @@ describe("SpokePool Slow Relay Logic", async function () { await expect(() => spokePool .connect(relayer) - .executeSlowRelayRoot( + .executeSlowRelayLeaf( ...getExecuteSlowRelayParams( depositor.address, recipient.address, @@ -333,7 +333,7 @@ describe("SpokePool Slow Relay Logic", async function () { await expect( spokePool .connect(relayer) - .executeSlowRelayRoot( + .executeSlowRelayLeaf( ...getExecuteSlowRelayParams( relay.depositor, relay.recipient, @@ -352,7 +352,7 @@ describe("SpokePool Slow Relay Logic", async function () { it("Bad proof: Relay data besides destination chain ID is not included in merkle root", async function () { await expect( - spokePool.connect(relayer).executeSlowRelayRoot( + spokePool.connect(relayer).executeSlowRelayLeaf( ...getExecuteSlowRelayParams( depositor.address, recipient.address, diff --git a/test/chain-specific-spokepools/Arbitrum_SpokePool.ts b/test/chain-specific-spokepools/Arbitrum_SpokePool.ts index 25b5af048..1bc333008 100644 --- a/test/chain-specific-spokepools/Arbitrum_SpokePool.ts +++ b/test/chain-specific-spokepools/Arbitrum_SpokePool.ts @@ -93,11 +93,11 @@ describe("Arbitrum Spoke Pool", function () { // Reverts if route from arbitrum to mainnet for l2Dai isn't whitelisted. await arbitrumSpokePool.connect(crossDomainAlias).whitelistToken(l2Dai, ZERO_ADDRESS); await expect( - arbitrumSpokePool.executeRelayerRefundRoot(0, leaves[0], tree.getHexProof(leaves[0])) + arbitrumSpokePool.executeRelayerRefundLeaf(0, leaves[0], tree.getHexProof(leaves[0])) ).to.be.revertedWith("Uninitialized mainnet token"); await arbitrumSpokePool.connect(crossDomainAlias).whitelistToken(l2Dai, dai.address); - await arbitrumSpokePool.connect(relayer).executeRelayerRefundRoot(0, leaves[0], tree.getHexProof(leaves[0])); + await arbitrumSpokePool.connect(relayer).executeRelayerRefundLeaf(0, leaves[0], tree.getHexProof(leaves[0])); // This should have sent tokens back to L1. Check the correct methods on the gateway are correctly called. // outboundTransfer is overloaded in the arbitrum gateway. Define the interface to check the method is called. diff --git a/test/chain-specific-spokepools/Ethereum_SpokePool.ts b/test/chain-specific-spokepools/Ethereum_SpokePool.ts index 6d4b8c8d0..cd194b0e4 100644 --- a/test/chain-specific-spokepools/Ethereum_SpokePool.ts +++ b/test/chain-specific-spokepools/Ethereum_SpokePool.ts @@ -65,7 +65,7 @@ describe("Ethereum Spoke Pool", function () { const { leaves, tree } = await constructSingleRelayerRefundTree(dai.address, await spokePool.callStatic.chainId()); await spokePool.connect(owner).relayRootBundle(tree.getHexRoot(), mockTreeRoot); await expect(() => - spokePool.connect(relayer).executeRelayerRefundRoot(0, leaves[0], tree.getHexProof(leaves[0])) + spokePool.connect(relayer).executeRelayerRefundLeaf(0, leaves[0], tree.getHexProof(leaves[0])) ).to.changeTokenBalances(dai, [spokePool, hubPool], [amountToReturn.mul(-1), amountToReturn]); }); }); diff --git a/test/chain-specific-spokepools/Optimism_SpokePool.ts b/test/chain-specific-spokepools/Optimism_SpokePool.ts index 3c1195e38..abd4eac2e 100644 --- a/test/chain-specific-spokepools/Optimism_SpokePool.ts +++ b/test/chain-specific-spokepools/Optimism_SpokePool.ts @@ -102,7 +102,7 @@ describe("Optimism Spoke Pool", function () { ); crossDomainMessenger.xDomainMessageSender.returns(owner.address); await optimismSpokePool.connect(crossDomainMessenger.wallet).relayRootBundle(tree.getHexRoot(), mockTreeRoot); - await optimismSpokePool.connect(relayer).executeRelayerRefundRoot(0, leaves[0], tree.getHexProof(leaves[0])); + await optimismSpokePool.connect(relayer).executeRelayerRefundLeaf(0, leaves[0], tree.getHexProof(leaves[0])); // This should have sent tokens back to L1. Check the correct methods on the gateway are correctly called. expect(l2StandardBridge.withdrawTo).to.have.been.calledOnce; @@ -117,7 +117,7 @@ describe("Optimism Spoke Pool", function () { await optimismSpokePool.connect(crossDomainMessenger.wallet).relayRootBundle(tree.getHexRoot(), mockTreeRoot); const altL2Bridge = await createFake("L2StandardBridge"); await optimismSpokePool.connect(crossDomainMessenger.wallet).setTokenBridge(l2Dai, altL2Bridge.address); - await optimismSpokePool.connect(relayer).executeRelayerRefundRoot(0, leaves[0], tree.getHexProof(leaves[0])); + await optimismSpokePool.connect(relayer).executeRelayerRefundLeaf(0, leaves[0], tree.getHexProof(leaves[0])); // This should have sent tokens back to L1. Check the correct methods on the gateway are correctly called. expect(altL2Bridge.withdrawTo).to.have.been.calledOnce; @@ -130,7 +130,7 @@ describe("Optimism Spoke Pool", function () { ); crossDomainMessenger.xDomainMessageSender.returns(owner.address); await optimismSpokePool.connect(crossDomainMessenger.wallet).relayRootBundle(tree.getHexRoot(), mockTreeRoot); - await optimismSpokePool.connect(relayer).executeRelayerRefundRoot(0, leaves[0], tree.getHexProof(leaves[0])); + await optimismSpokePool.connect(relayer).executeRelayerRefundLeaf(0, leaves[0], tree.getHexProof(leaves[0])); // When sending l2Weth we should see two differences from the previous test: 1) there should be a call to l2WETH to // unwrap l2WETH to l2ETH. 2) the address in the l2StandardBridge that is withdrawn should no longer be l2WETH but diff --git a/test/chain-specific-spokepools/Polygon_SpokePool.ts b/test/chain-specific-spokepools/Polygon_SpokePool.ts index 56a75a4fd..ad4d0c69d 100644 --- a/test/chain-specific-spokepools/Polygon_SpokePool.ts +++ b/test/chain-specific-spokepools/Polygon_SpokePool.ts @@ -190,7 +190,7 @@ describe("Polygon Spoke Pool", function () { const bridger = await polygonSpokePool.polygonTokenBridger(); // Checks that there's a burn event from the bridger. - await expect(polygonSpokePool.connect(relayer).executeRelayerRefundRoot(0, leaves[0], tree.getHexProof(leaves[0]))) + await expect(polygonSpokePool.connect(relayer).executeRelayerRefundLeaf(0, leaves[0], tree.getHexProof(leaves[0]))) .to.emit(dai, "Transfer") .withArgs(bridger, ZERO_ADDRESS, amountToReturn); }); diff --git a/test/gas-analytics/SpokePool.RelayerRefundRootExecution.ts b/test/gas-analytics/SpokePool.RelayerRefundRootExecution.ts index 5419a0b02..abdf9ead6 100644 --- a/test/gas-analytics/SpokePool.RelayerRefundRootExecution.ts +++ b/test/gas-analytics/SpokePool.RelayerRefundRootExecution.ts @@ -150,7 +150,7 @@ describe("Gas Analytics: SpokePool Relayer Refund Root Execution", function () { // Execute 1 leaf from initial tree to warm state storage. await spokePool .connect(dataWorker) - .executeRelayerRefundRoot(0, initTree.leaves[0], initTree.tree.getHexProof(initTree.leaves[0])); + .executeRelayerRefundLeaf(0, initTree.leaves[0], initTree.tree.getHexProof(initTree.leaves[0])); const simpleTree = await constructSimpleTree( destinationChainIds, @@ -176,10 +176,10 @@ describe("Gas Analytics: SpokePool Relayer Refund Root Execution", function () { // Execute second root bundle with index 1: const txn = await spokePool .connect(dataWorker) - .executeRelayerRefundRoot(1, leaves[leafIndexToExecute], tree.getHexProof(leaves[leafIndexToExecute])); + .executeRelayerRefundLeaf(1, leaves[leafIndexToExecute], tree.getHexProof(leaves[leafIndexToExecute])); const receipt = await txn.wait(); - console.log(`executeRelayerRefundRoot-gasUsed: ${receipt.gasUsed}`); + console.log(`executeRelayerRefundLeaf-gasUsed: ${receipt.gasUsed}`); }); it("Executing all leaves", async function () { await spokePool.connect(dataWorker).relayRootBundle(tree.getHexRoot(), consts.mockSlowRelayRoot); @@ -187,25 +187,25 @@ describe("Gas Analytics: SpokePool Relayer Refund Root Execution", function () { const txns = []; for (let i = 0; i < REFUND_LEAF_COUNT; i++) { txns.push( - await spokePool.connect(dataWorker).executeRelayerRefundRoot(1, leaves[i], tree.getHexProof(leaves[i])) + await spokePool.connect(dataWorker).executeRelayerRefundLeaf(1, leaves[i], tree.getHexProof(leaves[i])) ); } // Compute average gas costs. const receipts = await Promise.all(txns.map((_txn) => _txn.wait())); const gasUsed = receipts.map((_receipt) => _receipt.gasUsed).reduce((x, y) => x.add(y)); - console.log(`(average) executeRelayerRefundRoot-gasUsed: ${gasUsed.div(REFUND_LEAF_COUNT)}`); + console.log(`(average) executeRelayerRefundLeaf-gasUsed: ${gasUsed.div(REFUND_LEAF_COUNT)}`); }); it("Executing all leaves using multicall", async function () { await spokePool.connect(dataWorker).relayRootBundle(tree.getHexRoot(), consts.mockSlowRelayRoot); const multicallData = leaves.map((leaf) => { - return spokePool.interface.encodeFunctionData("executeRelayerRefundRoot", [1, leaf, tree.getHexProof(leaf)]); + return spokePool.interface.encodeFunctionData("executeRelayerRefundLeaf", [1, leaf, tree.getHexProof(leaf)]); }); const receipt = await (await spokePool.connect(dataWorker).multicall(multicallData)).wait(); - console.log(`(average) executeRelayerRefundRoot-gasUsed: ${receipt.gasUsed.div(REFUND_LEAF_COUNT)}`); + console.log(`(average) executeRelayerRefundLeaf-gasUsed: ${receipt.gasUsed.div(REFUND_LEAF_COUNT)}`); }); }); describe(`(WETH): Relayer Refund tree with ${REFUND_LEAF_COUNT} leaves, each containing ${REFUNDS_PER_LEAF} refunds`, function () { @@ -228,7 +228,7 @@ describe("Gas Analytics: SpokePool Relayer Refund Root Execution", function () { // Execute 1 leaf from initial tree to warm state storage. await spokePool .connect(dataWorker) - .executeRelayerRefundRoot(0, initTree.leaves[0], initTree.tree.getHexProof(initTree.leaves[0])); + .executeRelayerRefundLeaf(0, initTree.leaves[0], initTree.tree.getHexProof(initTree.leaves[0])); const simpleTree = await constructSimpleTree( destinationChainIds, @@ -248,10 +248,10 @@ describe("Gas Analytics: SpokePool Relayer Refund Root Execution", function () { // Execute second root bundle with index 1: const txn = await spokePool .connect(dataWorker) - .executeRelayerRefundRoot(1, leaves[leafIndexToExecute], tree.getHexProof(leaves[leafIndexToExecute])); + .executeRelayerRefundLeaf(1, leaves[leafIndexToExecute], tree.getHexProof(leaves[leafIndexToExecute])); const receipt = await txn.wait(); - console.log(`executeRelayerRefundRoot-gasUsed: ${receipt.gasUsed}`); + console.log(`executeRelayerRefundLeaf-gasUsed: ${receipt.gasUsed}`); }); it(`Stress Test: 1 leaf contains ${STRESS_TEST_REFUND_COUNT} refunds with amount > 0`, async function () { // This test should inform the limit # refunds that we would allow a RelayerRefundLeaf to contain to avoid diff --git a/test/gas-analytics/SpokePool.SlowRelayRootExecution.ts b/test/gas-analytics/SpokePool.SlowRelayRootExecution.ts index 48693a782..664b353bf 100644 --- a/test/gas-analytics/SpokePool.SlowRelayRootExecution.ts +++ b/test/gas-analytics/SpokePool.SlowRelayRootExecution.ts @@ -97,7 +97,7 @@ describe("Gas Analytics: SpokePool Slow Relay Root Execution", function () { // Execute 1 leaf from initial tree to warm state storage. await spokePool .connect(dataWorker) - .executeSlowRelayRoot( + .executeSlowRelayLeaf( owner.address, recipient.address, l2Tokens[0].address, @@ -133,7 +133,7 @@ describe("Gas Analytics: SpokePool Slow Relay Root Execution", function () { // Execute second root bundle with index 1: const txn = await spokePool .connect(dataWorker) - .executeSlowRelayRoot( + .executeSlowRelayLeaf( owner.address, recipient.address, l2Tokens[0].address, @@ -146,7 +146,7 @@ describe("Gas Analytics: SpokePool Slow Relay Root Execution", function () { tree.getHexProof(leaves[leafIndexToExecute]) ); const receipt = await txn.wait(); - console.log(`executeSlowRelayRoot-gasUsed: ${receipt.gasUsed}`); + console.log(`executeSlowRelayLeaf-gasUsed: ${receipt.gasUsed}`); }); it("Executing all leaves", async function () { await spokePool.connect(dataWorker).relayRootBundle(consts.mockRelayerRefundRoot, tree.getHexRoot()); @@ -156,7 +156,7 @@ describe("Gas Analytics: SpokePool Slow Relay Root Execution", function () { txns.push( await spokePool .connect(dataWorker) - .executeSlowRelayRoot( + .executeSlowRelayLeaf( owner.address, recipient.address, l2Tokens[i].address, @@ -174,14 +174,14 @@ describe("Gas Analytics: SpokePool Slow Relay Root Execution", function () { // Compute average gas costs. const receipts = await Promise.all(txns.map((_txn) => _txn.wait())); const gasUsed = receipts.map((_receipt) => _receipt.gasUsed).reduce((x, y) => x.add(y)); - console.log(`(average) executeSlowRelayRoot-gasUsed: ${gasUsed.div(LEAF_COUNT)}`); + console.log(`(average) executeSlowRelayLeaf-gasUsed: ${gasUsed.div(LEAF_COUNT)}`); }); it("Executing all leaves using multicall", async function () { await spokePool.connect(dataWorker).relayRootBundle(consts.mockRelayerRefundRoot, tree.getHexRoot()); const multicallData = leaves.map((leaf, i) => { - return spokePool.interface.encodeFunctionData("executeSlowRelayRoot", [ + return spokePool.interface.encodeFunctionData("executeSlowRelayLeaf", [ owner.address, recipient.address, l2Tokens[i].address, @@ -196,7 +196,7 @@ describe("Gas Analytics: SpokePool Slow Relay Root Execution", function () { }); const receipt = await (await spokePool.connect(dataWorker).multicall(multicallData)).wait(); - console.log(`(average) executeSlowRelayRoot-gasUsed: ${receipt.gasUsed.div(LEAF_COUNT)}`); + console.log(`(average) executeSlowRelayLeaf-gasUsed: ${receipt.gasUsed.div(LEAF_COUNT)}`); }); }); describe(`(WETH) Tree with ${LEAF_COUNT} leaves`, function () { @@ -215,7 +215,7 @@ describe("Gas Analytics: SpokePool Slow Relay Root Execution", function () { // Execute 1 leaf from initial tree to warm state storage. await spokePool .connect(dataWorker) - .executeSlowRelayRoot( + .executeSlowRelayLeaf( owner.address, recipient.address, weth.address, @@ -246,7 +246,7 @@ describe("Gas Analytics: SpokePool Slow Relay Root Execution", function () { // Execute second root bundle with index 1: const txn = await spokePool .connect(dataWorker) - .executeSlowRelayRoot( + .executeSlowRelayLeaf( owner.address, recipient.address, weth.address, @@ -259,7 +259,7 @@ describe("Gas Analytics: SpokePool Slow Relay Root Execution", function () { tree.getHexProof(leaves[leafIndexToExecute]) ); const receipt = await txn.wait(); - console.log(`executeSlowRelayRoot-gasUsed: ${receipt.gasUsed}`); + console.log(`executeSlowRelayLeaf-gasUsed: ${receipt.gasUsed}`); }); }); }); From 65766634e51a38c1bf49578e42215432e88eb35d Mon Sep 17 00:00:00 2001 From: Matt Rice Date: Fri, 18 Mar 2022 16:04:18 -0400 Subject: [PATCH 08/11] fix[L04] Enforce chainId requirements in PolygonTokenBridger (#115) --- contracts/PolygonTokenBridger.sol | 42 ++++++++++-- ...08_deploy_polygon_token_bridger_mainnet.ts | 4 +- ...10_deploy_polygon_token_bridger_polygon.ts | 5 +- deploy/consts.ts | 5 ++ .../Polygon_SpokePool.ts | 64 ++++++++++++++++++- 5 files changed, 108 insertions(+), 12 deletions(-) diff --git a/contracts/PolygonTokenBridger.sol b/contracts/PolygonTokenBridger.sol index 3d67e8d8d..090bf63ab 100644 --- a/contracts/PolygonTokenBridger.sol +++ b/contracts/PolygonTokenBridger.sol @@ -41,14 +41,36 @@ contract PolygonTokenBridger is Lockable { // WETH contract on Ethereum. WETH9 public immutable l1Weth; + // Chain id for the L1 that this contract is deployed on or communicates with. + // For example: if this contract were meant to facilitate transfers from polygon to mainnet, this value would be + // the mainnet chainId 1. + uint256 public immutable l1ChainId; + + // Chain id for the L2 that this contract is deployed on or communicates with. + // For example: if this contract were meant to facilitate transfers from polygon to mainnet, this value would be + // the polygon chainId 137. + uint256 public immutable l2ChainId; + + modifier onlyChainId(uint256 chainId) { + _requireChainId(chainId); + _; + } + /** * @notice Constructs Token Bridger contract. * @param _destination Where to send tokens to for this network. * @param _l1Weth Ethereum WETH address. */ - constructor(address _destination, WETH9 _l1Weth) { + constructor( + address _destination, + WETH9 _l1Weth, + uint256 _l1ChainId, + uint256 _l2ChainId + ) { destination = _destination; l1Weth = _l1Weth; + l1ChainId = _l1ChainId; + l2ChainId = _l2ChainId; } /** @@ -62,7 +84,7 @@ contract PolygonTokenBridger is Lockable { PolygonIERC20 token, uint256 amount, bool isWrappedMatic - ) public nonReentrant { + ) public nonReentrant onlyChainId(l2ChainId) { token.safeTransferFrom(msg.sender, address(this), amount); // In the wMatic case, this unwraps. For other ERC20s, this is the burn/send action. @@ -76,12 +98,22 @@ contract PolygonTokenBridger is Lockable { * @notice Called by someone to send tokens to the destination, which should be set to the HubPool. * @param token Token to send to destination. */ - function retrieve(IERC20 token) public nonReentrant { + function retrieve(IERC20 token) public nonReentrant onlyChainId(l1ChainId) { token.safeTransfer(destination, token.balanceOf(address(this))); } receive() external payable { - // Note: this should only happen on the mainnet side where ETH is sent to the contract directly by the bridge. - if (functionCallStackOriginatesFromOutsideThisContract()) l1Weth.deposit{ value: address(this).balance }(); + if (functionCallStackOriginatesFromOutsideThisContract()) { + // This should only happen on the mainnet side where ETH is sent to the contract directly by the bridge. + _requireChainId(l1ChainId); + l1Weth.deposit{ value: address(this).balance }(); + } else { + // This should only happen on the l2 side where matic is unwrapped by this contract. + _requireChainId(l2ChainId); + } + } + + function _requireChainId(uint256 chainId) internal view { + require(block.chainid == chainId, "Cannot run method on this chain"); } } diff --git a/deploy/008_deploy_polygon_token_bridger_mainnet.ts b/deploy/008_deploy_polygon_token_bridger_mainnet.ts index ce2884ec8..b89a998d9 100644 --- a/deploy/008_deploy_polygon_token_bridger_mainnet.ts +++ b/deploy/008_deploy_polygon_token_bridger_mainnet.ts @@ -2,7 +2,7 @@ import "hardhat-deploy"; import { HardhatRuntimeEnvironment } from "hardhat/types/runtime"; -import { L1_ADDRESS_MAP } from "./consts"; +import { L1_ADDRESS_MAP, POLYGON_CHAIN_IDS } from "./consts"; const func = async function (hre: HardhatRuntimeEnvironment) { const { deployments, getNamedAccounts, getChainId } = hre; @@ -17,7 +17,7 @@ const func = async function (hre: HardhatRuntimeEnvironment) { from: deployer, log: true, skipIfAlreadyDeployed: true, - args: [hubPool.address, L1_ADDRESS_MAP[chainId].weth], + args: [hubPool.address, L1_ADDRESS_MAP[chainId].weth, chainId, POLYGON_CHAIN_IDS[chainId]], deterministicDeployment: "0x1234", // Salt for the create2 call. }); }; diff --git a/deploy/010_deploy_polygon_token_bridger_polygon.ts b/deploy/010_deploy_polygon_token_bridger_polygon.ts index 5c73e9d0d..7b72dc715 100644 --- a/deploy/010_deploy_polygon_token_bridger_polygon.ts +++ b/deploy/010_deploy_polygon_token_bridger_polygon.ts @@ -5,11 +5,12 @@ import { HardhatRuntimeEnvironment } from "hardhat/types/runtime"; import { L1_ADDRESS_MAP } from "./consts"; const func = async function (hre: HardhatRuntimeEnvironment) { - const { deployments, getNamedAccounts } = hre; + const { deployments, getNamedAccounts, getChainId } = hre; const { deploy } = deployments; const { deployer } = await getNamedAccounts(); + const chainId = parseInt(await getChainId()); const l1ChainId = parseInt(await hre.companionNetworks.l1.getChainId()); const l1HubPool = await hre.companionNetworks.l1.deployments.get("HubPool"); @@ -17,7 +18,7 @@ const func = async function (hre: HardhatRuntimeEnvironment) { from: deployer, log: true, skipIfAlreadyDeployed: true, - args: [l1HubPool.address, L1_ADDRESS_MAP[l1ChainId].weth], + args: [l1HubPool.address, L1_ADDRESS_MAP[l1ChainId].weth, l1ChainId, chainId], deterministicDeployment: "0x1234", // Salt for the create2 call. }); }; diff --git a/deploy/consts.ts b/deploy/consts.ts index e98224394..f009b0ea0 100644 --- a/deploy/consts.ts +++ b/deploy/consts.ts @@ -60,3 +60,8 @@ export const L2_ADDRESS_MAP: { [key: number]: { [contractName: string]: string } fxChild: "0xCf73231F28B7331BBe3124B907840A94851f9f11", }, }; + +export const POLYGON_CHAIN_IDS: { [l1ChainId: number]: number } = { + 1: 137, + 5: 80001, +}; diff --git a/test/chain-specific-spokepools/Polygon_SpokePool.ts b/test/chain-specific-spokepools/Polygon_SpokePool.ts index ad4d0c69d..a7f61b000 100644 --- a/test/chain-specific-spokepools/Polygon_SpokePool.ts +++ b/test/chain-specific-spokepools/Polygon_SpokePool.ts @@ -1,6 +1,16 @@ import { TokenRolesEnum, ZERO_ADDRESS } from "@uma/common"; import { mockTreeRoot, amountToReturn, amountHeldByPool } from "../constants"; -import { ethers, expect, Contract, SignerWithAddress, getContractFactory, seedContract, toWei } from "../utils"; +import { + ethers, + expect, + Contract, + SignerWithAddress, + getContractFactory, + seedContract, + toWei, + randomBigNumber, + seedWallet, +} from "../utils"; import { hubPoolFixture } from "../fixtures/HubPool.Fixture"; import { constructSingleRelayerRefundTree } from "../MerkleLib.utils"; @@ -13,9 +23,13 @@ describe("Polygon Spoke Pool", function () { [owner, relayer, fxChild, rando] = await ethers.getSigners(); ({ weth, hubPool, timer, l2Dai } = await hubPoolFixture()); + // The spoke pool exists on l2, so add a random chainId for L1 to ensure that the L2's block.chainid will not match. + const l1ChainId = randomBigNumber(); + const l2ChainId = await owner.getChainId(); + const polygonTokenBridger = await ( await getContractFactory("PolygonTokenBridger", owner) - ).deploy(hubPool.address, weth.address); + ).deploy(hubPool.address, weth.address, l1ChainId, l2ChainId); dai = await (await getContractFactory("PolygonERC20Test", owner)).deploy(); await dai.addMember(TokenRolesEnum.MINTER, owner.address); @@ -25,6 +39,7 @@ describe("Polygon Spoke Pool", function () { ).deploy(polygonTokenBridger.address, owner.address, hubPool.address, weth.address, fxChild.address, timer.address); await seedContract(polygonSpokePool, relayer, [dai], weth, amountHeldByPool); + await seedWallet(owner, [], weth, toWei("1")); }); it("Only correct caller can set the cross domain admin", async function () { @@ -196,9 +211,13 @@ describe("Polygon Spoke Pool", function () { }); it("PolygonTokenBridger retrieves and unwraps tokens correctly", async function () { + const l1ChainId = await owner.getChainId(); + + // Retrieve can only be performed on L1, so seed the L2 chainId with a non matching value. + const l2ChainId = randomBigNumber(); const polygonTokenBridger = await ( await getContractFactory("PolygonTokenBridger", owner) - ).deploy(hubPool.address, weth.address); + ).deploy(hubPool.address, weth.address, l1ChainId, l2ChainId); await expect(() => owner.sendTransaction({ to: polygonTokenBridger.address, value: toWei("1") }) @@ -210,4 +229,43 @@ describe("Polygon Spoke Pool", function () { [toWei("1").mul(-1), toWei("1")] ); }); + + it("PolygonTokenBridger doesn't allow L1 actions on L2", async function () { + // Make sure the L1 chain is different from the chainId where this is deployed. + const l1ChainId = randomBigNumber(); + const l2ChainId = await owner.getChainId(); + + const polygonTokenBridger = await ( + await getContractFactory("PolygonTokenBridger", owner) + ).deploy(hubPool.address, weth.address, l1ChainId, l2ChainId); + + // Cannot send ETH directly into the contract on L2. + await expect(owner.sendTransaction({ to: polygonTokenBridger.address, value: toWei("1") })).to.be.revertedWith( + "Cannot run method on this chain" + ); + + // Cannot call retrieve on the contract on L2. + await weth.connect(owner).transfer(polygonTokenBridger.address, toWei("1")); + await expect(polygonTokenBridger.connect(owner).retrieve(weth.address)).to.be.revertedWith( + "Cannot run method on this chain" + ); + }); + + it("PolygonTokenBridger doesn't allow L2 actions on L1", async function () { + const l1ChainId = await owner.getChainId(); + + // Make sure the L1 chain is different from the chainId where this is deployed. + const l2ChainId = randomBigNumber(); + + const polygonTokenBridger = await ( + await getContractFactory("PolygonTokenBridger", owner) + ).deploy(hubPool.address, weth.address, l1ChainId, l2ChainId); + + await weth.connect(owner).approve(polygonTokenBridger.address, toWei("1")); + + // Cannot call send on the contract on L1. + await expect(polygonTokenBridger.connect(owner).send(weth.address, toWei("1"), false)).to.be.revertedWith( + "Cannot run method on this chain" + ); + }); }); From 6dd9d589ba3baf85b34ac6a8aa08a69f7316fd57 Mon Sep 17 00:00:00 2001 From: nicholaspai Date: Mon, 21 Mar 2022 18:26:26 -0400 Subject: [PATCH 09/11] fix: Arbitrum Adapter needs to pay for L2 gas --- contracts/chain-adapters/Arbitrum_Adapter.sol | 51 +++++++++++++++---- contracts/chain-adapters/Optimism_Adapter.sol | 2 +- contracts/test/ArbitrumMocks.sol | 19 +++++++ 3 files changed, 61 insertions(+), 11 deletions(-) create mode 100644 contracts/test/ArbitrumMocks.sol diff --git a/contracts/chain-adapters/Arbitrum_Adapter.sol b/contracts/chain-adapters/Arbitrum_Adapter.sol index a8f4e16d6..727e9e99f 100644 --- a/contracts/chain-adapters/Arbitrum_Adapter.sol +++ b/contracts/chain-adapters/Arbitrum_Adapter.sol @@ -3,6 +3,9 @@ pragma solidity ^0.8.0; import "../interfaces/AdapterInterface.sol"; +import "@openzeppelin/contracts/token/ERC20/IERC20.sol"; +import "@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol"; + interface ArbitrumL1InboxLike { function createRetryableTicket( address destAddr, @@ -25,6 +28,8 @@ interface ArbitrumL1ERC20GatewayLike { uint256 _gasPriceBid, bytes calldata _data ) external payable returns (bytes memory); + + function getGateway(address _token) external view returns (address); } /** @@ -35,35 +40,37 @@ interface ArbitrumL1ERC20GatewayLike { * that call this contract's logic guard against reentrancy. */ contract Arbitrum_Adapter is AdapterInterface { + using SafeERC20 for IERC20; + // Gas limit for immediate L2 execution attempt (can be estimated via NodeInterface.estimateRetryableTicket). // NodeInterface precompile interface exists at L2 address 0x00000000000000000000000000000000000000C8 - uint32 public immutable l2GasLimit = 5_000_000; + uint32 public immutable l2GasLimit = 2_000_000; // Amount of ETH allocated to pay for the base submission fee. The base submission fee is a parameter unique to // retryable transactions; the user is charged the base submission fee to cover the storage costs of keeping their // ticket’s calldata in the retry buffer. (current base submission fee is queryable via // ArbRetryableTx.getSubmissionPrice). ArbRetryableTicket precompile interface exists at L2 address // 0x000000000000000000000000000000000000006E. - uint256 public immutable l2MaxSubmissionCost = 0.1e18; + uint256 public immutable l2MaxSubmissionCost = 0.01e18; // L2 Gas price bid for immediate L2 execution attempt (queryable via standard eth*gasPrice RPC) - uint256 public immutable l2GasPrice = 10e9; // 10 gWei + uint256 public immutable l2GasPrice = 5e9; // 5 gWei // This address on L2 receives extra ETH that is left over after relaying a message via the inbox. address public immutable l2RefundL2Address; ArbitrumL1InboxLike public immutable l1Inbox; - ArbitrumL1ERC20GatewayLike public immutable l1ERC20Gateway; + ArbitrumL1ERC20GatewayLike public immutable l1ERC20GatewayRouter; /** * @notice Constructs new Adapter. * @param _l1ArbitrumInbox Inbox helper contract to send messages to Arbitrum. - * @param _l1ERC20Gateway ERC20 gateway contract to send tokens to Arbitrum. + * @param _l1ERC20GatewayRouter ERC20 gateway router contract to send tokens to Arbitrum. */ - constructor(ArbitrumL1InboxLike _l1ArbitrumInbox, ArbitrumL1ERC20GatewayLike _l1ERC20Gateway) { + constructor(ArbitrumL1InboxLike _l1ArbitrumInbox, ArbitrumL1ERC20GatewayLike _l1ERC20GatewayRouter) { l1Inbox = _l1ArbitrumInbox; - l1ERC20Gateway = _l1ERC20Gateway; + l1ERC20GatewayRouter = _l1ERC20GatewayRouter; l2RefundL2Address = msg.sender; } @@ -76,8 +83,7 @@ contract Arbitrum_Adapter is AdapterInterface { * @param message Data to send to target. */ function relayMessage(address target, bytes memory message) external payable override { - uint256 requiredL1CallValue = getL1CallValue(); - require(address(this).balance >= requiredL1CallValue, "Insufficient ETH balance"); + uint256 requiredL1CallValue = _contractHasSufficientEthBalance(); l1Inbox.createRetryableTicket{ value: requiredL1CallValue }( target, // destAddr destination L2 contract address @@ -95,6 +101,8 @@ contract Arbitrum_Adapter is AdapterInterface { /** * @notice Bridge tokens to Arbitrum. + * @notice This contract must hold at least getL1CallValue() amount of ETH to send a message via the Inbox + * successfully, or the message will get stuck. * @param l1Token L1 token to deposit. * @param l2Token L2 token to receive. * @param amount Amount of L1 tokens to deposit and L2 tokens to receive. @@ -106,7 +114,25 @@ contract Arbitrum_Adapter is AdapterInterface { uint256 amount, address to ) external payable override { - l1ERC20Gateway.outboundTransfer(l1Token, to, amount, l2GasLimit, l2GasPrice, ""); + uint256 requiredL1CallValue = _contractHasSufficientEthBalance(); + + // Approve the gateway, not the router, to spend the hub pool's balance. The gateway, which is different + // per L1 token, will temporarily escrow the tokens to be bridged and pull them from this contract. + address erc20Gateway = l1ERC20GatewayRouter.getGateway(l1Token); + IERC20(l1Token).safeIncreaseAllowance(erc20Gateway, amount); + + // `outboundTransfer` expects that the caller includes a bytes message as the last param that includes the + // maxSubmissionCost to use when creating an L2 retryable ticket: https://github.com/OffchainLabs/arbitrum/blob/e98d14873dd77513b569771f47b5e05b72402c5e/packages/arb-bridge-peripherals/contracts/tokenbridge/ethereum/gateway/L1GatewayRouter.sol#L232 + bytes memory data = abi.encode(l2MaxSubmissionCost, ""); + l1ERC20GatewayRouter.outboundTransfer{ value: requiredL1CallValue }( + l1Token, + to, + amount, + l2GasLimit, + l2GasPrice, + data + ); + emit TokensRelayed(l1Token, l2Token, amount, to); } @@ -117,4 +143,9 @@ contract Arbitrum_Adapter is AdapterInterface { function getL1CallValue() public pure returns (uint256) { return l2MaxSubmissionCost + l2GasPrice * l2GasLimit; } + + function _contractHasSufficientEthBalance() internal view returns (uint256 requiredL1CallValue) { + requiredL1CallValue = getL1CallValue(); + require(address(this).balance >= requiredL1CallValue, "Insufficient ETH balance"); + } } diff --git a/contracts/chain-adapters/Optimism_Adapter.sol b/contracts/chain-adapters/Optimism_Adapter.sol index 715eeeb17..0b5390d18 100644 --- a/contracts/chain-adapters/Optimism_Adapter.sol +++ b/contracts/chain-adapters/Optimism_Adapter.sol @@ -21,7 +21,7 @@ import "@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol"; */ contract Optimism_Adapter is CrossDomainEnabled, AdapterInterface { using SafeERC20 for IERC20; - uint32 public immutable l2GasLimit = 5_000_000; + uint32 public immutable l2GasLimit = 2_000_000; WETH9 public immutable l1Weth; diff --git a/contracts/test/ArbitrumMocks.sol b/contracts/test/ArbitrumMocks.sol new file mode 100644 index 000000000..9b2ab711b --- /dev/null +++ b/contracts/test/ArbitrumMocks.sol @@ -0,0 +1,19 @@ +// SPDX-License-Identifier: AGPL-3.0-only +pragma solidity ^0.8.0; + +contract ArbitrumMockErc20GatewayRouter { + function outboundTransfer( + address _token, + address _to, + uint256 _amount, + uint256 _maxGas, + uint256 _gasPriceBid, + bytes calldata _data + ) external payable returns (bytes memory) { + return _data; + } + + function getGateway(address _token) external view returns (address) { + return address(this); + } +} From 52a456bde3662db447ee2b0e21f77ad55b2f77fa Mon Sep 17 00:00:00 2001 From: nicholaspai Date: Mon, 21 Mar 2022 19:40:46 -0400 Subject: [PATCH 10/11] Add helper scripts --- scripts/buildSampleTree.ts | 21 +++++++++++---------- scripts/setupArbitrumSpokePool.ts | 10 +++++++++- test/utils.ts | 6 ++++++ 3 files changed, 26 insertions(+), 11 deletions(-) diff --git a/scripts/buildSampleTree.ts b/scripts/buildSampleTree.ts index 75acc73a1..de7bca7aa 100644 --- a/scripts/buildSampleTree.ts +++ b/scripts/buildSampleTree.ts @@ -2,7 +2,7 @@ // test net. // @dev Modify constants to modify merkle leaves. Command: `yarn hardhat run ./scripts/buildSampleTree.ts` -import { toWei, toBN, toBNWei, getParamType, defaultAbiCoder, keccak256 } from "../test/utils"; +import { toBN, getParamType, defaultAbiCoder, keccak256, toBNWeiWithDecimals } from "../test/utils"; import { MerkleTree } from "../utils/MerkleTree"; import { RelayData } from "../test/fixtures/SpokePool.Fixture"; @@ -15,13 +15,14 @@ const RELAYER_REFUND_LEAF_COUNT = 1; const SLOW_RELAY_LEAF_COUNT = 1; const POOL_REBALANCE_NET_SEND_AMOUNT = 0.1; // Amount of tokens to send from HubPool to SpokePool const RELAYER_REFUND_AMOUNT_TO_RETURN = 0.1; // Amount of tokens to send from SpokePool to HubPool -const L1_TOKEN = "0xd0A1E359811322d97991E03f863a0C30C2cF029C"; -const L2_TOKEN = "0x4200000000000000000000000000000000000006"; +const L1_TOKEN = "0x4dbcdf9b62e891a7cec5a2568c3f4faf9e8abe2b"; +const L2_TOKEN = "0x1E77ad77925Ac0075CF61Fb76bA35D884985019d"; +const DECIMALS = 6; const RELAYER_REFUND_ADDRESS_TO_REFUND = "0x9a8f92a830a5cb89a3816e3d267cb7791c16b04d"; const RELAYER_REFUND_AMOUNT_TO_REFUND = 0.1; // Amount of tokens to send out of SpokePool to relayer refund recipient const SLOW_RELAY_RECIPIENT_ADDRESS = "0x9a8f92a830a5cb89a3816e3d267cb7791c16b04d"; const SLOW_RELAY_AMOUNT = 0.1; // Amount of tokens to send out of SpokePool to slow relay recipient address -const SPOKE_POOL_CHAIN_ID = 69; +const SPOKE_POOL_CHAIN_ID = 421611; function tuplelifyLeaf(leaf: Object) { return JSON.stringify( @@ -40,9 +41,9 @@ async function main() { for (let i = 0; i < POOL_REBALANCE_LEAF_COUNT; i++) { leaves.push({ chainId: toBN(SPOKE_POOL_CHAIN_ID), - bundleLpFees: [toBNWei(0.1)], - netSendAmounts: [toBNWei(POOL_REBALANCE_NET_SEND_AMOUNT)], - runningBalances: [toWei(0)], + bundleLpFees: [toBN(0)], + netSendAmounts: [toBNWeiWithDecimals(POOL_REBALANCE_NET_SEND_AMOUNT, DECIMALS)], + runningBalances: [toBN(0)], groupIndex: toBN(0), leafId: toBN(i), l1Tokens: [L1_TOKEN], @@ -81,9 +82,9 @@ async function main() { const leaves: RelayerRefundLeaf[] = []; for (let i = 0; i < RELAYER_REFUND_LEAF_COUNT; i++) { leaves.push({ - amountToReturn: toBNWei(RELAYER_REFUND_AMOUNT_TO_RETURN), + amountToReturn: toBNWeiWithDecimals(RELAYER_REFUND_AMOUNT_TO_RETURN, DECIMALS), chainId: toBN(SPOKE_POOL_CHAIN_ID), - refundAmounts: [toBNWei(RELAYER_REFUND_AMOUNT_TO_REFUND)], + refundAmounts: [toBNWeiWithDecimals(RELAYER_REFUND_AMOUNT_TO_REFUND, DECIMALS)], leafId: toBN(i), l2TokenAddress: L2_TOKEN, refundAddresses: [RELAYER_REFUND_ADDRESS_TO_REFUND], @@ -125,7 +126,7 @@ async function main() { depositor: SLOW_RELAY_RECIPIENT_ADDRESS, recipient: SLOW_RELAY_RECIPIENT_ADDRESS, destinationToken: L2_TOKEN, - amount: toBNWei(SLOW_RELAY_AMOUNT).toString(), + amount: toBNWeiWithDecimals(SLOW_RELAY_AMOUNT, DECIMALS).toString(), originChainId: SPOKE_POOL_CHAIN_ID.toString(), destinationChainId: SPOKE_POOL_CHAIN_ID.toString(), realizedLpFeePct: "0", diff --git a/scripts/setupArbitrumSpokePool.ts b/scripts/setupArbitrumSpokePool.ts index 3a2220e24..cea9c8ba7 100644 --- a/scripts/setupArbitrumSpokePool.ts +++ b/scripts/setupArbitrumSpokePool.ts @@ -1,6 +1,7 @@ // @notice Logs ABI-encoded function data that can be relayed from HubPool to ArbitrumSpokePool to set it up. -import { getContractFactory, ethers } from "../test/utils"; +import { getContractFactory, ethers, hre } from "../test/utils"; +import * as consts from "../test/constants"; async function main() { const [signer] = await ethers.getSigners(); @@ -12,6 +13,13 @@ async function main() { "0xc778417e063141139fce010982780140aa0cd5ab", // L1 WETH ]); console.log(`(WETH) whitelistToken: `, whitelistWeth); + + // USDC is also not verified on the rinkeby explorer so we should approve it to be spent by the spoke pool. + const ERC20 = await getContractFactory("ExpandedERC20", { signer }); + const usdc = await ERC20.attach("0x4dbcdf9b62e891a7cec5a2568c3f4faf9e8abe2b"); + const deployedHubPool = await hre.deployments.get("HubPool"); + const approval = await usdc.approve(deployedHubPool.address, consts.maxUint256); + console.log(`Approved USDC to be spent by HubPool @ ${deployedHubPool.address}: `, approval.hash); } main().then( diff --git a/test/utils.ts b/test/utils.ts index c58b26bec..f940834e7 100644 --- a/test/utils.ts +++ b/test/utils.ts @@ -104,8 +104,14 @@ export function getAllFilesInPath(dirPath: string, arrayOfFiles: string[] = []): export const toWei = (num: string | number | BigNumber) => ethers.utils.parseEther(num.toString()); +export const toWeiWithDecimals = (num: string | number | BigNumber, decimals: number) => + ethers.utils.parseUnits(num.toString(), decimals); + export const toBNWei = (num: string | number | BigNumber) => BigNumber.from(toWei(num)); +export const toBNWeiWithDecimals = (num: string | number | BigNumber, decimals: number) => + BigNumber.from(toWeiWithDecimals(num, decimals)); + export const fromWei = (num: string | number | BigNumber) => ethers.utils.formatUnits(num.toString()); export const toBN = (num: string | number | BigNumber) => { From e9169bc9ca5049a5fc5a69b2db6c5c9df9bf4dc5 Mon Sep 17 00:00:00 2001 From: nicholaspai Date: Mon, 21 Mar 2022 20:32:17 -0400 Subject: [PATCH 11/11] Update Arbitrum_Adapter.sol --- contracts/chain-adapters/Arbitrum_Adapter.sol | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/contracts/chain-adapters/Arbitrum_Adapter.sol b/contracts/chain-adapters/Arbitrum_Adapter.sol index 727e9e99f..11340b000 100644 --- a/contracts/chain-adapters/Arbitrum_Adapter.sol +++ b/contracts/chain-adapters/Arbitrum_Adapter.sol @@ -124,6 +124,10 @@ contract Arbitrum_Adapter is AdapterInterface { // `outboundTransfer` expects that the caller includes a bytes message as the last param that includes the // maxSubmissionCost to use when creating an L2 retryable ticket: https://github.com/OffchainLabs/arbitrum/blob/e98d14873dd77513b569771f47b5e05b72402c5e/packages/arb-bridge-peripherals/contracts/tokenbridge/ethereum/gateway/L1GatewayRouter.sol#L232 bytes memory data = abi.encode(l2MaxSubmissionCost, ""); + + // Note: outboundTransfer() will ultimately create a retryable ticket and set this contract's address as the + // refund address. This means that the excess ETH to pay for the L2 transaction will be sent to the aliased + // contract address on L2 and lost. l1ERC20GatewayRouter.outboundTransfer{ value: requiredL1CallValue }( l1Token, to,