diff --git a/deploy/001_deploy_hubpool.ts b/deploy/001_deploy_hubpool.ts index 04f251d8f..2893701fc 100644 --- a/deploy/001_deploy_hubpool.ts +++ b/deploy/001_deploy_hubpool.ts @@ -1,12 +1,16 @@ import { L1_ADDRESS_MAP } from "./consts"; -const func = async function (hre: any) { +// This import is needed to override the definition of the HardhatRuntimeEnvironment type. +import "hardhat-deploy"; +import { HardhatRuntimeEnvironment } from "hardhat/types/runtime"; + +const func = async function (hre: HardhatRuntimeEnvironment) { const { deployments, getNamedAccounts, getChainId } = hre; const { deploy } = deployments; const { deployer } = await getNamedAccounts(); - const chainId = await getChainId(); + const chainId = parseInt(await getChainId()); const lpTokenFactory = await deploy("LpTokenFactory", { from: deployer, log: true, skipIfAlreadyDeployed: true }); @@ -24,4 +28,4 @@ const func = async function (hre: any) { }); }; module.exports = func; -func.tags = ["hubpool"]; +func.tags = ["HubPool", "mainnet"]; diff --git a/deploy/002_deploy_optimism_adapter.ts b/deploy/002_deploy_optimism_adapter.ts index a717ddc73..064891540 100644 --- a/deploy/002_deploy_optimism_adapter.ts +++ b/deploy/002_deploy_optimism_adapter.ts @@ -3,13 +3,17 @@ import { L1_ADDRESS_MAP } from "./consts"; -const func = async function (hre: any) { +// This import is needed to override the definition of the HardhatRuntimeEnvironment type. +import "hardhat-deploy"; +import { HardhatRuntimeEnvironment } from "hardhat/types/runtime"; + +const func = async function (hre: HardhatRuntimeEnvironment) { const { deployments, getNamedAccounts, getChainId } = hre; const { deploy } = deployments; const { deployer } = await getNamedAccounts(); - const chainId = await getChainId(); + const chainId = parseInt(await getChainId()); await deploy("Optimism_Adapter", { from: deployer, @@ -25,4 +29,4 @@ const func = async function (hre: any) { module.exports = func; func.dependencies = ["HubPool"]; -func.tags = ["optimism-adapter"]; +func.tags = ["OptimismAdapter", "mainnet"]; diff --git a/deploy/003_deploy_optimism_spokepool.ts b/deploy/003_deploy_optimism_spokepool.ts index fd3b8721b..418a9d741 100644 --- a/deploy/003_deploy_optimism_spokepool.ts +++ b/deploy/003_deploy_optimism_spokepool.ts @@ -1,4 +1,8 @@ -const func = async function (hre: any) { +// This import is needed to override the definition of the HardhatRuntimeEnvironment type. +import "hardhat-deploy"; +import { HardhatRuntimeEnvironment } from "hardhat/types/runtime"; + +const func = async function (hre: HardhatRuntimeEnvironment) { const { deployments, getNamedAccounts, companionNetworks } = hre; const { deploy } = deployments; @@ -21,4 +25,4 @@ const func = async function (hre: any) { }); }; module.exports = func; -func.tags = ["optimism-spokepool"]; +func.tags = ["OptimismSpokePool", "optimism"]; diff --git a/deploy/004_deploy_arbitrum_adapter.ts b/deploy/004_deploy_arbitrum_adapter.ts index d22503442..0010e1e5d 100644 --- a/deploy/004_deploy_arbitrum_adapter.ts +++ b/deploy/004_deploy_arbitrum_adapter.ts @@ -2,13 +2,17 @@ import { L1_ADDRESS_MAP } from "./consts"; -const func = async function (hre: any) { +// This import is needed to override the definition of the HardhatRuntimeEnvironment type. +import "hardhat-deploy"; +import { HardhatRuntimeEnvironment } from "hardhat/types/runtime"; + +const func = async function (hre: HardhatRuntimeEnvironment) { const { deployments, getNamedAccounts, getChainId } = hre; const { deploy } = deployments; const { deployer } = await getNamedAccounts(); - const chainId = await getChainId(); + const chainId = parseInt(await getChainId()); await deploy("Arbitrum_Adapter", { from: deployer, @@ -20,4 +24,4 @@ const func = async function (hre: any) { module.exports = func; func.dependencies = ["HubPool"]; -func.tags = ["arbitrum-adapter"]; +func.tags = ["ArbitrumAdapter", "mainnet"]; diff --git a/deploy/005_deploy_arbitrum_spokepool.ts b/deploy/005_deploy_arbitrum_spokepool.ts index b7ff30d30..e5193d2e5 100644 --- a/deploy/005_deploy_arbitrum_spokepool.ts +++ b/deploy/005_deploy_arbitrum_spokepool.ts @@ -1,6 +1,10 @@ +// This import is needed to override the definition of the HardhatRuntimeEnvironment type. +import "hardhat-deploy"; +import { HardhatRuntimeEnvironment } from "hardhat/types/runtime"; + import { L2_ADDRESS_MAP } from "./consts"; -const func = async function (hre: any) { +const func = async function (hre: HardhatRuntimeEnvironment) { const { deployments, getNamedAccounts, companionNetworks, getChainId } = hre; const { deploy } = deployments; @@ -11,7 +15,7 @@ const func = async function (hre: any) { const hubPool = await l1Deployments.get("HubPool"); console.log(`Using l1 hub pool @ ${hubPool.address}`); - const chainId = await getChainId(); + const chainId = parseInt(await getChainId()); await deploy("Arbitrum_SpokePool", { from: deployer, @@ -27,4 +31,4 @@ const func = async function (hre: any) { }); }; module.exports = func; -func.tags = ["arbitrum-spokepool"]; +func.tags = ["ArbitrumSpokePool", "arbitrum"]; diff --git a/deploy/006_deploy_ethereum_adapter.ts b/deploy/006_deploy_ethereum_adapter.ts index d0b11900d..df224b827 100644 --- a/deploy/006_deploy_ethereum_adapter.ts +++ b/deploy/006_deploy_ethereum_adapter.ts @@ -1,4 +1,8 @@ -const func = async function (hre: any) { +// This import is needed to override the definition of the HardhatRuntimeEnvironment type. +import "hardhat-deploy"; +import { HardhatRuntimeEnvironment } from "hardhat/types/runtime"; + +const func = async function (hre: HardhatRuntimeEnvironment) { const { deployments, getNamedAccounts } = hre; const { deploy } = deployments; @@ -14,4 +18,4 @@ const func = async function (hre: any) { module.exports = func; func.dependencies = ["HubPool"]; -func.tags = ["ethereum-adapter"]; +func.tags = ["EthereumAdapter", "mainnet"]; diff --git a/deploy/007_deploy_ethereum_spokepool.ts b/deploy/007_deploy_ethereum_spokepool.ts index 9927b2a20..6d828ad78 100644 --- a/deploy/007_deploy_ethereum_spokepool.ts +++ b/deploy/007_deploy_ethereum_spokepool.ts @@ -1,12 +1,16 @@ +// This import is needed to override the definition of the HardhatRuntimeEnvironment type. +import "hardhat-deploy"; +import { HardhatRuntimeEnvironment } from "hardhat/types/runtime"; + import { L1_ADDRESS_MAP } from "./consts"; -const func = async function (hre: any) { +const func = async function (hre: HardhatRuntimeEnvironment) { const { deployments, getNamedAccounts, getChainId } = hre; const { deploy } = deployments; const { deployer } = await getNamedAccounts(); - const chainId = await getChainId(); + const chainId = parseInt(await getChainId()); const hubPool = await deployments.get("HubPool"); console.log(`Using l1 hub pool @ ${hubPool.address}`); @@ -19,4 +23,4 @@ const func = async function (hre: any) { }); }; module.exports = func; -func.tags = ["ethereum-spokepool"]; +func.tags = ["EthereumSpokePool", "mainnet"]; diff --git a/deploy/008_deploy_polygon_token_bridger_mainnet.ts b/deploy/008_deploy_polygon_token_bridger_mainnet.ts new file mode 100644 index 000000000..ce2884ec8 --- /dev/null +++ b/deploy/008_deploy_polygon_token_bridger_mainnet.ts @@ -0,0 +1,27 @@ +// This import is needed to override the definition of the HardhatRuntimeEnvironment type. +import "hardhat-deploy"; +import { HardhatRuntimeEnvironment } from "hardhat/types/runtime"; + +import { L1_ADDRESS_MAP } from "./consts"; + +const func = async function (hre: HardhatRuntimeEnvironment) { + const { deployments, getNamedAccounts, getChainId } = hre; + const { deploy } = deployments; + + const { deployer } = await getNamedAccounts(); + + const chainId = parseInt(await getChainId()); + const hubPool = await deployments.get("HubPool"); + + await deploy("PolygonTokenBridger", { + from: deployer, + log: true, + skipIfAlreadyDeployed: true, + args: [hubPool.address, L1_ADDRESS_MAP[chainId].weth], + deterministicDeployment: "0x1234", // Salt for the create2 call. + }); +}; + +module.exports = func; +func.dependencies = ["HubPool"]; +func.tags = ["PolygonTokenBridgerL1", "mainnet"]; diff --git a/deploy/009_deploy_polygon_adapter.ts b/deploy/009_deploy_polygon_adapter.ts new file mode 100644 index 000000000..9c5e3012b --- /dev/null +++ b/deploy/009_deploy_polygon_adapter.ts @@ -0,0 +1,28 @@ +// This import is needed to override the definition of the HardhatRuntimeEnvironment type. +import "hardhat-deploy"; +import { HardhatRuntimeEnvironment } from "hardhat/types/runtime"; + +import { L1_ADDRESS_MAP } from "./consts"; + +const func = async function (hre: HardhatRuntimeEnvironment) { + const { deployments, getNamedAccounts, getChainId } = hre; + const { deploy } = deployments; + + const { deployer } = await getNamedAccounts(); + + const chainId = parseInt(await getChainId()); + + await deploy("Polygon_Adapter", { + from: deployer, + log: true, + skipIfAlreadyDeployed: false, + args: [ + L1_ADDRESS_MAP[chainId].polygonRootChainManager, + L1_ADDRESS_MAP[chainId].polygonFxRoot, + L1_ADDRESS_MAP[chainId].weth, + ], + }); +}; + +module.exports = func; +func.tags = ["PolygonAdapter", "mainnet"]; diff --git a/deploy/010_deploy_polygon_token_bridger_polygon.ts b/deploy/010_deploy_polygon_token_bridger_polygon.ts new file mode 100644 index 000000000..5c73e9d0d --- /dev/null +++ b/deploy/010_deploy_polygon_token_bridger_polygon.ts @@ -0,0 +1,26 @@ +// This import is needed to override the definition of the HardhatRuntimeEnvironment type. +import "hardhat-deploy"; +import { HardhatRuntimeEnvironment } from "hardhat/types/runtime"; + +import { L1_ADDRESS_MAP } from "./consts"; + +const func = async function (hre: HardhatRuntimeEnvironment) { + const { deployments, getNamedAccounts } = hre; + const { deploy } = deployments; + + const { deployer } = await getNamedAccounts(); + + const l1ChainId = parseInt(await hre.companionNetworks.l1.getChainId()); + const l1HubPool = await hre.companionNetworks.l1.deployments.get("HubPool"); + + await deploy("PolygonTokenBridger", { + from: deployer, + log: true, + skipIfAlreadyDeployed: true, + args: [l1HubPool.address, L1_ADDRESS_MAP[l1ChainId].weth], + deterministicDeployment: "0x1234", // Salt for the create2 call. + }); +}; + +module.exports = func; +func.tags = ["PolygonTokenBridgerL2", "polygon"]; diff --git a/deploy/011_deploy_polygon_spokepool.ts b/deploy/011_deploy_polygon_spokepool.ts new file mode 100644 index 000000000..457991e3e --- /dev/null +++ b/deploy/011_deploy_polygon_spokepool.ts @@ -0,0 +1,34 @@ +// This import is needed to override the definition of the HardhatRuntimeEnvironment type. +import "hardhat-deploy"; +import { HardhatRuntimeEnvironment } from "hardhat/types/runtime"; + +import { L2_ADDRESS_MAP } from "./consts"; + +const func = async function (hre: HardhatRuntimeEnvironment) { + const { deployments, getNamedAccounts, getChainId } = hre; + const { deploy } = deployments; + + const { deployer } = await getNamedAccounts(); + + const chainId = parseInt(await getChainId()); + const l1HubPool = await hre.companionNetworks.l1.deployments.get("HubPool"); + const polygonTokenBridger = await deployments.get("PolygonTokenBridger"); + + await deploy("Polygon_SpokePool", { + from: deployer, + log: true, + skipIfAlreadyDeployed: true, + args: [ + polygonTokenBridger.address, + l1HubPool.address, + l1HubPool.address, + L2_ADDRESS_MAP[chainId].wMatic, + L2_ADDRESS_MAP[chainId].fxChild, + "0x0000000000000000000000000000000000000000", + ], + }); +}; + +module.exports = func; +func.dependencies = ["PolygonTokenBridgerL2"]; +func.tags = ["PolygonSpokePool", "polygon"]; diff --git a/deploy/consts.ts b/deploy/consts.ts index 082886529..bd0fd41a3 100644 --- a/deploy/consts.ts +++ b/deploy/consts.ts @@ -7,6 +7,8 @@ export const L1_ADDRESS_MAP: { [key: number]: { [contractName: string]: string } weth: "0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2", optimismStandardBridge: "0x99C9fc46f92E8a1c0deC1b1747d010903E884bE1", finder: "0x40f941E48A552bF496B154Af6bf55725f18D77c3", + polygonRootChainManager: "0xA0c68C638235ee32657e8f720a23ceC1bFc77C77", + polygonFxRoot: "0xfe5e5D361b2ad62c541bAb87C45a0B9B018389a2", }, 4: { weth: "0xc778417E063141139Fce010982780140Aa0cD5Ab", @@ -14,6 +16,16 @@ export const L1_ADDRESS_MAP: { [key: number]: { [contractName: string]: string } l1ArbitrumInbox: "0x578BAde599406A8fE3d24Fd7f7211c0911F5B29e", l1ERC20Gateway: "0x91169Dbb45e6804743F94609De50D511C437572E", }, + 5: { + optimismCrossDomainMessenger: "0x25ace71c97B33Cc4729CF772ae268934F7ab5fA1", // dummy + optimismStandardBridge: "0x99C9fc46f92E8a1c0deC1b1747d010903E884bE1", // dummy + l1ArbitrumInbox: "0x578BAde599406A8fE3d24Fd7f7211c0911F5B29e", // dummy + l1ERC20Gateway: "0x91169Dbb45e6804743F94609De50D511C437572E", // dummy + finder: "0xDC6b80D38004F495861E081e249213836a2F3217", + polygonRootChainManager: "0xBbD7cBFA79faee899Eaf900F13C9065bF03B1A74", + polygonFxRoot: "0x3d1d3E34f7fB6D26245E6640E1c50710eFFf15bA", + weth: "0x60D4dB9b534EF9260a88b0BED6c486fe13E604Fc", + }, 42: { optimismCrossDomainMessenger: "0x4361d0F75A0186C05f971c566dC6bEa5957483fD", weth: "0xd0A1E359811322d97991E03f863a0C30C2cF029C", @@ -31,4 +43,12 @@ export const L2_ADDRESS_MAP: { [key: number]: { [contractName: string]: string } l2GatewayRouter: "0x5288c571Fd7aD117beA99bF60FE0846C4E84F933", l2Weth: "0x82aF49447D8a07e3bd95BD0d56f35241523fBab1", }, + 137: { + wMatic: "0x0d500B1d8E8eF31E21C99d1Db9A6444d3ADf1270", + fxChild: "0x8397259c983751DAf40400790063935a11afa28a", + }, + 80001: { + wMatic: "0x9c3C9283D3e44854697Cd22D3Faa240Cfb032889", + fxChild: "0xCf73231F28B7331BBe3124B907840A94851f9f11", + }, }; diff --git a/deployments/goerli/.chainId b/deployments/goerli/.chainId new file mode 100644 index 000000000..7813681f5 --- /dev/null +++ b/deployments/goerli/.chainId @@ -0,0 +1 @@ +5 \ No newline at end of file diff --git a/deployments/goerli/Arbitrum_Adapter.json b/deployments/goerli/Arbitrum_Adapter.json new file mode 100644 index 000000000..9824d51a4 --- /dev/null +++ b/deployments/goerli/Arbitrum_Adapter.json @@ -0,0 +1,350 @@ +{ + "address": "0xc6aFa90Ebf5F7eC9Ce0409a0B2bF7b0E6E81b5F6", + "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": "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": 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": "0x015604f398bf11fee253ff3960326ad0a7daae704607713622c4b6fd55210ffd", + "receipt": { + "to": null, + "from": "0x9A8f92a830A5cB89a3816e3D267CB7791c16b04D", + "contractAddress": "0xc6aFa90Ebf5F7eC9Ce0409a0B2bF7b0E6E81b5F6", + "transactionIndex": 13, + "gasUsed": "644324", + "logsBloom": "0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", + "blockHash": "0x9986c306aa7ec40b63b23608b3d0410aea54a1fc2756ea562dc459f95f8e49ce", + "transactionHash": "0x015604f398bf11fee253ff3960326ad0a7daae704607713622c4b6fd55210ffd", + "logs": [], + "blockNumber": 6545768, + "cumulativeGasUsed": "6215687", + "status": 1, + "byzantium": true + }, + "args": ["0x578BAde599406A8fE3d24Fd7f7211c0911F5B29e", "0x91169Dbb45e6804743F94609De50D511C437572E"], + "numDeployments": 1, + "solcInputHash": "a6be65618c7af0eb8c96b985a450affc", + "metadata": "{\"compiler\":{\"version\":\"0.8.11+commit.d7f03943\"},\"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\":\"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\":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 neccessary 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\":{\"@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\"},\"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\\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 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\",\"keccak256\":\"0x1c43d258b70373428e96662fe751f339ed2322a6b2a277a70980c285236d05d1\",\"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": "0x610140604052624c4b4060805267016345785d8a000060a0526402540be40060c05234801561002d57600080fd5b50604051610c11380380610c1183398101604081905261004c91610081565b6001600160a01b039182166101005216610120523360e0526100bb565b6001600160a01b038116811461007e57600080fd5b50565b6000806040838503121561009457600080fd5b825161009f81610069565b60208401519092506100b081610069565b809150509250929050565b60805160a05160c05160e0516101005161012051610abb6101566000396000818160d50152610392015260008181610143015261053e0152600081816101ab01526105940152600081816101770152818161028b0152818161035e01526105da015260008181610228015281816102b501526105720152600081816101df015281816102690152818161033701526105b80152610abb6000f3fe6080604052600436106100965760003560e01c80639ae3668511610069578063cf6e65b71161004e578063cf6e65b7146101cd578063e599477e14610216578063e6eb8ade1461024a57600080fd5b80639ae36685146101655780639c3ba2001461019957600080fd5b806308f1ed151461009b5780630e283a6a146100c357806352c8c75c1461011c5780638134f38514610131575b600080fd5b3480156100a757600080fd5b506100b061025d565b6040519081526020015b60405180910390f35b3480156100cf57600080fd5b506100f77f000000000000000000000000000000000000000000000000000000000000000081565b60405173ffffffffffffffffffffffffffffffffffffffff90911681526020016100ba565b61012f61012a3660046106af565b6102de565b005b34801561013d57600080fd5b506100f77f000000000000000000000000000000000000000000000000000000000000000081565b34801561017157600080fd5b506100b07f000000000000000000000000000000000000000000000000000000000000000081565b3480156101a557600080fd5b506100f77f000000000000000000000000000000000000000000000000000000000000000081565b3480156101d957600080fd5b506102017f000000000000000000000000000000000000000000000000000000000000000081565b60405163ffffffff90911681526020016100ba565b34801561022257600080fd5b506100b07f000000000000000000000000000000000000000000000000000000000000000081565b61012f6102583660046107c0565b610487565b60006102af63ffffffff7f0000000000000000000000000000000000000000000000000000000000000000167f0000000000000000000000000000000000000000000000000000000000000000610880565b6102d9907f00000000000000000000000000000000000000000000000000000000000000006108bd565b905090565b6040517fd2ce7d6500000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff858116600483015282811660248301526044820184905263ffffffff7f00000000000000000000000000000000000000000000000000000000000000001660648301527f0000000000000000000000000000000000000000000000000000000000000000608483015260c060a4830152600060c48301527f0000000000000000000000000000000000000000000000000000000000000000169063d2ce7d659060e4016000604051808303816000875af11580156103db573d6000803e3d6000fd5b505050506040513d6000823e601f3d9081017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe01682016040526104219190810190610905565b506040805173ffffffffffffffffffffffffffffffffffffffff868116825285811660208301528183018590528316606082015290517fd7e09655439c3932e55857df3220186e5a7f0980825f20691c2b35d941dee75b9181900360800190a150505050565b600061049161025d565b905080471015610501576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601860248201527f496e73756666696369656e74204554482062616c616e63650000000000000000604482015260640160405180910390fd5b6040517f679b6ded00000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff7f0000000000000000000000000000000000000000000000000000000000000000169063679b6ded9083906106049087906000907f0000000000000000000000000000000000000000000000000000000000000000907f00000000000000000000000000000000000000000000000000000000000000009081907f0000000000000000000000000000000000000000000000000000000000000000907f0000000000000000000000000000000000000000000000000000000000000000908d906004016109c6565b60206040518083038185885af1158015610622573d6000803e3d6000fd5b50505050506040513d601f19601f820116820180604052508101906106479190610a35565b507f9e6c52944e331ba6270e7fe4cea2a4086bae8f7a27e1cdba07f416806f5d0ac48383604051610679929190610a4e565b60405180910390a1505050565b803573ffffffffffffffffffffffffffffffffffffffff811681146106aa57600080fd5b919050565b600080600080608085870312156106c557600080fd5b6106ce85610686565b93506106dc60208601610686565b9250604085013591506106f160608601610686565b905092959194509250565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b604051601f82017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe016810167ffffffffffffffff81118282101715610772576107726106fc565b604052919050565b600067ffffffffffffffff821115610794576107946106fc565b50601f017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe01660200190565b600080604083850312156107d357600080fd5b6107dc83610686565b9150602083013567ffffffffffffffff8111156107f857600080fd5b8301601f8101851361080957600080fd5b803561081c6108178261077a565b61072b565b81815286602083850101111561083157600080fd5b816020840160208301376000602083830101528093505050509250929050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b6000817fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff04831182151516156108b8576108b8610851565b500290565b600082198211156108d0576108d0610851565b500190565b60005b838110156108f05781810151838201526020016108d8565b838111156108ff576000848401525b50505050565b60006020828403121561091757600080fd5b815167ffffffffffffffff81111561092e57600080fd5b8201601f8101841361093f57600080fd5b805161094d6108178261077a565b81815285602083850101111561096257600080fd5b6109738260208301602086016108d5565b95945050505050565b600081518084526109948160208601602086016108d5565b601f017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0169290920160200192915050565b600061010073ffffffffffffffffffffffffffffffffffffffff808c1684528a6020850152896040850152808916606085015280881660808501525063ffffffff861660a08401528460c08401528060e0840152610a268184018561097c565b9b9a5050505050505050505050565b600060208284031215610a4757600080fd5b5051919050565b73ffffffffffffffffffffffffffffffffffffffff83168152604060208201526000610a7d604083018461097c565b94935050505056fea2646970667358221220ad13d968df2a348c173b7de1ff2e269558eeba1b239309cc8439fc6b2925637064736f6c634300080b0033", + "deployedBytecode": "0x6080604052600436106100965760003560e01c80639ae3668511610069578063cf6e65b71161004e578063cf6e65b7146101cd578063e599477e14610216578063e6eb8ade1461024a57600080fd5b80639ae36685146101655780639c3ba2001461019957600080fd5b806308f1ed151461009b5780630e283a6a146100c357806352c8c75c1461011c5780638134f38514610131575b600080fd5b3480156100a757600080fd5b506100b061025d565b6040519081526020015b60405180910390f35b3480156100cf57600080fd5b506100f77f000000000000000000000000000000000000000000000000000000000000000081565b60405173ffffffffffffffffffffffffffffffffffffffff90911681526020016100ba565b61012f61012a3660046106af565b6102de565b005b34801561013d57600080fd5b506100f77f000000000000000000000000000000000000000000000000000000000000000081565b34801561017157600080fd5b506100b07f000000000000000000000000000000000000000000000000000000000000000081565b3480156101a557600080fd5b506100f77f000000000000000000000000000000000000000000000000000000000000000081565b3480156101d957600080fd5b506102017f000000000000000000000000000000000000000000000000000000000000000081565b60405163ffffffff90911681526020016100ba565b34801561022257600080fd5b506100b07f000000000000000000000000000000000000000000000000000000000000000081565b61012f6102583660046107c0565b610487565b60006102af63ffffffff7f0000000000000000000000000000000000000000000000000000000000000000167f0000000000000000000000000000000000000000000000000000000000000000610880565b6102d9907f00000000000000000000000000000000000000000000000000000000000000006108bd565b905090565b6040517fd2ce7d6500000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff858116600483015282811660248301526044820184905263ffffffff7f00000000000000000000000000000000000000000000000000000000000000001660648301527f0000000000000000000000000000000000000000000000000000000000000000608483015260c060a4830152600060c48301527f0000000000000000000000000000000000000000000000000000000000000000169063d2ce7d659060e4016000604051808303816000875af11580156103db573d6000803e3d6000fd5b505050506040513d6000823e601f3d9081017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe01682016040526104219190810190610905565b506040805173ffffffffffffffffffffffffffffffffffffffff868116825285811660208301528183018590528316606082015290517fd7e09655439c3932e55857df3220186e5a7f0980825f20691c2b35d941dee75b9181900360800190a150505050565b600061049161025d565b905080471015610501576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601860248201527f496e73756666696369656e74204554482062616c616e63650000000000000000604482015260640160405180910390fd5b6040517f679b6ded00000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff7f0000000000000000000000000000000000000000000000000000000000000000169063679b6ded9083906106049087906000907f0000000000000000000000000000000000000000000000000000000000000000907f00000000000000000000000000000000000000000000000000000000000000009081907f0000000000000000000000000000000000000000000000000000000000000000907f0000000000000000000000000000000000000000000000000000000000000000908d906004016109c6565b60206040518083038185885af1158015610622573d6000803e3d6000fd5b50505050506040513d601f19601f820116820180604052508101906106479190610a35565b507f9e6c52944e331ba6270e7fe4cea2a4086bae8f7a27e1cdba07f416806f5d0ac48383604051610679929190610a4e565b60405180910390a1505050565b803573ffffffffffffffffffffffffffffffffffffffff811681146106aa57600080fd5b919050565b600080600080608085870312156106c557600080fd5b6106ce85610686565b93506106dc60208601610686565b9250604085013591506106f160608601610686565b905092959194509250565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b604051601f82017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe016810167ffffffffffffffff81118282101715610772576107726106fc565b604052919050565b600067ffffffffffffffff821115610794576107946106fc565b50601f017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe01660200190565b600080604083850312156107d357600080fd5b6107dc83610686565b9150602083013567ffffffffffffffff8111156107f857600080fd5b8301601f8101851361080957600080fd5b803561081c6108178261077a565b61072b565b81815286602083850101111561083157600080fd5b816020840160208301376000602083830101528093505050509250929050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b6000817fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff04831182151516156108b8576108b8610851565b500290565b600082198211156108d0576108d0610851565b500190565b60005b838110156108f05781810151838201526020016108d8565b838111156108ff576000848401525b50505050565b60006020828403121561091757600080fd5b815167ffffffffffffffff81111561092e57600080fd5b8201601f8101841361093f57600080fd5b805161094d6108178261077a565b81815285602083850101111561096257600080fd5b6109738260208301602086016108d5565b95945050505050565b600081518084526109948160208601602086016108d5565b601f017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0169290920160200192915050565b600061010073ffffffffffffffffffffffffffffffffffffffff808c1684528a6020850152896040850152808916606085015280881660808501525063ffffffff861660a08401528460c08401528060e0840152610a268184018561097c565b9b9a5050505050505050505050565b600060208284031215610a4757600080fd5b5051919050565b73ffffffffffffffffffffffffffffffffffffffff83168152604060208201526000610a7d604083018461097c565b94935050505056fea2646970667358221220ad13d968df2a348c173b7de1ff2e269558eeba1b239309cc8439fc6b2925637064736f6c634300080b0033", + "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": { + "_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/goerli/Ethereum_Adapter.json b/deployments/goerli/Ethereum_Adapter.json new file mode 100644 index 000000000..e4736d085 --- /dev/null +++ b/deployments/goerli/Ethereum_Adapter.json @@ -0,0 +1,174 @@ +{ + "address": "0xbe96050668dECb6FA0ef5Af919f37221658cfbEf", + "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" + } + ], + "transactionHash": "0x35fb9a3704253c25d9abd5765148795d28f6cce849c8327c6c87df7330dceec7", + "receipt": { + "to": null, + "from": "0x9A8f92a830A5cB89a3816e3D267CB7791c16b04D", + "contractAddress": "0xbe96050668dECb6FA0ef5Af919f37221658cfbEf", + "transactionIndex": 2, + "gasUsed": "491295", + "logsBloom": "0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", + "blockHash": "0x07e5b904c8b26db7a40d0267daf48c54223d2e9e5d49becb632e6052e530fc38", + "transactionHash": "0x35fb9a3704253c25d9abd5765148795d28f6cce849c8327c6c87df7330dceec7", + "logs": [], + "blockNumber": 6545769, + "cumulativeGasUsed": "851441", + "status": 1, + "byzantium": true + }, + "args": [], + "numDeployments": 1, + "solcInputHash": "a6be65618c7af0eb8c96b985a450affc", + "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", + "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 + }, + "storageLayout": { + "storage": [], + "types": null + } +} diff --git a/deployments/goerli/Ethereum_SpokePool.json b/deployments/goerli/Ethereum_SpokePool.json new file mode 100644 index 000000000..b3152bf62 --- /dev/null +++ b/deployments/goerli/Ethereum_SpokePool.json @@ -0,0 +1,1524 @@ +{ + "address": "0x9a5de999108042946F59848E083e12690ff018C6", + "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": "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": "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" + } + ], + "transactionHash": "0x38682adf28f82bc566c3f9298b687c4c65b812128e82da992fcfd7afdc7f93bf", + "receipt": { + "to": null, + "from": "0x9A8f92a830A5cB89a3816e3D267CB7791c16b04D", + "contractAddress": "0x9a5de999108042946F59848E083e12690ff018C6", + "transactionIndex": 1, + "gasUsed": "3679033", + "logsBloom": "0x00000000000000000000000000000000000000100000000000800000001000000000000000000000000000000800000000200000000000000000000000000000000000000000000000000000000000000001000000000000000040000000000000000000020000000000000000000800000800000000000000000000040000400000000000000000000000000000000040000000000000000000000000000000000000000000000000000000000002000000000000000000000000000000000000000000000000801000000000000000000080000000000000000000000020000001000000020000000000000000000000000400000000000000000000000000", + "blockHash": "0xc86c9c47a6b417b0f3caf8926d7146973060f73b7a9a27ef5b723b7a1f48c2bf", + "transactionHash": "0x38682adf28f82bc566c3f9298b687c4c65b812128e82da992fcfd7afdc7f93bf", + "logs": [ + { + "transactionIndex": 1, + "blockNumber": 6545770, + "transactionHash": "0x38682adf28f82bc566c3f9298b687c4c65b812128e82da992fcfd7afdc7f93bf", + "address": "0x9a5de999108042946F59848E083e12690ff018C6", + "topics": [ + "0xa9e8c42c9e7fca7f62755189a16b2f5314d43d8fb24e91ba54e6d65f9314e849", + "0x0000000000000000000000009a8f92a830a5cb89a3816e3d267cb7791c16b04d" + ], + "data": "0x", + "logIndex": 6, + "blockHash": "0xc86c9c47a6b417b0f3caf8926d7146973060f73b7a9a27ef5b723b7a1f48c2bf" + }, + { + "transactionIndex": 1, + "blockNumber": 6545770, + "transactionHash": "0x38682adf28f82bc566c3f9298b687c4c65b812128e82da992fcfd7afdc7f93bf", + "address": "0x9a5de999108042946F59848E083e12690ff018C6", + "topics": [ + "0x1f17a88f67b0f49060a34bec1a4723a563620e6aa265eb640b5046dcee0759a0", + "0x000000000000000000000000e1fc1eb80db9ad0160aef6998673625bc2a09d14" + ], + "data": "0x", + "logIndex": 7, + "blockHash": "0xc86c9c47a6b417b0f3caf8926d7146973060f73b7a9a27ef5b723b7a1f48c2bf" + }, + { + "transactionIndex": 1, + "blockNumber": 6545770, + "transactionHash": "0x38682adf28f82bc566c3f9298b687c4c65b812128e82da992fcfd7afdc7f93bf", + "address": "0x9a5de999108042946F59848E083e12690ff018C6", + "topics": [ + "0x8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0", + "0x0000000000000000000000000000000000000000000000000000000000000000", + "0x0000000000000000000000009a8f92a830a5cb89a3816e3d267cb7791c16b04d" + ], + "data": "0x", + "logIndex": 8, + "blockHash": "0xc86c9c47a6b417b0f3caf8926d7146973060f73b7a9a27ef5b723b7a1f48c2bf" + } + ], + "blockNumber": 6545770, + "cumulativeGasUsed": "4158111", + "status": 1, + "byzantium": true + }, + "args": [ + "0xe1fC1EB80db9AD0160AEF6998673625bc2a09d14", + "0x60D4dB9b534EF9260a88b0BED6c486fe13E604Fc", + "0x0000000000000000000000000000000000000000" + ], + "numDeployments": 1, + "solcInputHash": "a6be65618c7af0eb8c96b985a450affc", + "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\":\"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\":\"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\":\"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 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.\"},\"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 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 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 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\":\"0x55308c0cc6f1bd7fc05c9fe23e7333e67d2405f01d27467e9dc34a1892e0c5e4\",\"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 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 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 * @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 {\\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 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\":\"0x93dabfc8d23654e9d613cfe9e03834a8d69d3a848416f1f434d84bd49567ec74\",\"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 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\":\"0xf5fb5cf93d68052bc380b78b84cfe8e0eb11cb47dc362dd8eb2b029839bd4522\",\"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": "0x60806040526003805463ffffffff60c01b1916604b60c31b1790553480156200002757600080fd5b506040516200434c3803806200434c8339810160408190526200004a916200033a565b600080546001600160a81b0319166001600160a01b03831617600160a01b179055338383836200007a84620000ee565b620000858362000194565b6200008f62000236565b600380546001600160a01b039094166001600160a01b031963ffffffff93909316600160a01b02929092166001600160c01b0319909416939093171790915550620000e59150620000df90503390565b620002cb565b5050506200039e565b6001600160a01b0381166200014a5760405162461bcd60e51b815260206004820152601960248201527f4261642062726964676520726f7574657220616464726573730000000000000060448201526064015b60405180910390fd5b600180546001600160a01b0319166001600160a01b0383169081179091556040517fa9e8c42c9e7fca7f62755189a16b2f5314d43d8fb24e91ba54e6d65f9314e84990600090a250565b6001600160a01b038116620001ec5760405162461bcd60e51b815260206004820152601460248201527f4261642068756220706f6f6c2061646472657373000000000000000000000000604482015260640162000141565b600280546001600160a01b0319166001600160a01b0383169081179091556040517f1f17a88f67b0f49060a34bec1a4723a563620e6aa265eb640b5046dcee0759a090600090a250565b600080546001600160a01b031615620002c65760008054906101000a90046001600160a01b03166001600160a01b03166329cb924d6040518163ffffffff1660e01b8152600401602060405180830381865afa1580156200029b573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190620002c1919062000384565b905090565b504290565b600780546001600160a01b038381166001600160a01b0319831681179093556040519116919082907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e090600090a35050565b80516001600160a01b03811681146200033557600080fd5b919050565b6000806000606084860312156200035057600080fd5b6200035b846200031d565b92506200036b602085016200031d565b91506200037b604085016200031d565b90509250925092565b6000602082840312156200039757600080fd5b5051919050565b613f9e80620003ae6000396000f3fe6080604052600436106101c65760003560e01c80638a7860ce116100f7578063e190440211610095578063f06850f611610064578063f06850f6146105db578063f2fde38b14610608578063f500697c14610628578063ffc351a31461064857600080fd5b8063e190440214610524578063e282d5b914610551578063ecda10f514610571578063ee2a53f8146105a657600080fd5b8063a1244c67116100d1578063a1244c6714610487578063ac9650d8146104c4578063c894c0ca146104e4578063de7eba781461050457600080fd5b80638a7860ce146104295780638da5cb5b146104495780639a8a05921461047457600080fd5b806349228978116101645780635285e0581161013e5780635285e0581461037957806357f6dcb8146103a6578063715018a6146103f457806389a153cc1461040957600080fd5b806349228978146102fb578063493a4f841461030e5780635249fef11461032e57600080fd5b8063272751c7116101a0578063272751c71461026b5780632752042e1461028b57806329cb924d146102ab5780633fc8cef3146102ce57600080fd5b80631c39c38d146101d25780631dfb2d021461022957806322f8e5661461024b57600080fd5b366101cd57005b600080fd5b3480156101de57600080fd5b506000546101ff9073ffffffffffffffffffffffffffffffffffffffff1681565b60405173ffffffffffffffffffffffffffffffffffffffff90911681526020015b60405180910390f35b34801561023557600080fd5b5061024961024436600461309b565b610668565b005b34801561025757600080fd5b506102496102663660046130b6565b61067c565b34801561027757600080fd5b506102496102863660046130dd565b610725565b34801561029757600080fd5b506102496102a6366004613131565b6107c3565b3480156102b757600080fd5b506102c0610852565b604051908152602001610220565b3480156102da57600080fd5b506003546101ff9073ffffffffffffffffffffffffffffffffffffffff1681565b610249610309366004613164565b61090a565b34801561031a57600080fd5b506102496103293660046131ca565b610dba565b34801561033a57600080fd5b506103696103493660046131ec565b600460209081526000928352604080842090915290825290205460ff1681565b6040519015158152602001610220565b34801561038557600080fd5b506001546101ff9073ffffffffffffffffffffffffffffffffffffffff1681565b3480156103b257600080fd5b506003546103df907801000000000000000000000000000000000000000000000000900463ffffffff1681565b60405163ffffffff9091168152602001610220565b34801561040057600080fd5b50610249610e68565b34801561041557600080fd5b50610249610424366004613216565b610ef5565b34801561043557600080fd5b506102496104443660046130b6565b611045565b34801561045557600080fd5b5060075473ffffffffffffffffffffffffffffffffffffffff166101ff565b34801561048057600080fd5b50466102c0565b34801561049357600080fd5b506003546103df907c0100000000000000000000000000000000000000000000000000000000900463ffffffff1681565b6104d76104d23660046132b4565b6110a3565b604051610220919061339f565b3480156104f057600080fd5b506102496104ff3660046135b7565b61127d565b34801561051057600080fd5b5061024961051f36600461309b565b611306565b34801561053057600080fd5b506002546101ff9073ffffffffffffffffffffffffffffffffffffffff1681565b34801561055d57600080fd5b5061024961056c36600461374a565b611317565b34801561057d57600080fd5b506003546103df9074010000000000000000000000000000000000000000900463ffffffff1681565b3480156105b257600080fd5b506105c66105c13660046130b6565b6113fa565b60408051928352602083019190915201610220565b3480156105e757600080fd5b506102c06105f63660046130b6565b60066020526000908152604090205481565b34801561061457600080fd5b5061024961062336600461309b565b611428565b34801561063457600080fd5b506102496106433660046137b9565b611555565b34801561065457600080fd5b50610249610663366004613880565b6115e0565b61067061173f565b610679816117c0565b50565b60005473ffffffffffffffffffffffffffffffffffffffff1661069e57600080fd5b6000546040517f22f8e5660000000000000000000000000000000000000000000000000000000081526004810183905273ffffffffffffffffffffffffffffffffffffffff909116906322f8e56690602401600060405180830381600087803b15801561070a57600080fd5b505af115801561071e573d6000803e3d6000fd5b5050505050565b61072d61173f565b73ffffffffffffffffffffffffffffffffffffffff8316600081815260046020908152604080832086845282529182902080547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff001685151590811790915591519182528492917f0a21fdd43d0ad0c62689ee7230a47309a050755bcc52eba00310add65297692a910160405180910390a3505050565b6107cb61173f565b600380547fffffffff00000000ffffffffffffffffffffffffffffffffffffffffffffffff16780100000000000000000000000000000000000000000000000063ffffffff8416908102919091179091556040519081527f0e55dd180fa793d9036c804d0a116e6a7617a48e72cee1f83d92793a793fcc039060200160405180910390a150565b6000805473ffffffffffffffffffffffffffffffffffffffff16156109055760008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166329cb924d6040518163ffffffff1660e01b8152600401602060405180830381865afa1580156108dc573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610900919061395e565b905090565b504290565b73ffffffffffffffffffffffffffffffffffffffff851660009081526004602090815260408083208684529091529020548590849060ff166109ad576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152600e60248201527f44697361626c656420726f75746500000000000000000000000000000000000060448201526064015b60405180910390fd5b6109b56118ac565b6109e2600080547fffffffffffffffffffffff00ffffffffffffffffffffffffffffffffffffffff169055565b6706f05b59d3b200008467ffffffffffffffff1610610a5d576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601360248201527f696e76616c69642072656c61796572206665650000000000000000000000000060448201526064016109a4565b600354610a8c907801000000000000000000000000000000000000000000000000900463ffffffff16846139a6565b63ffffffff16610a9a610852565b10158015610ae35750600354610ad2907801000000000000000000000000000000000000000000000000900463ffffffff16846139cb565b63ffffffff16610ae0610852565b11155b610b49576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601260248201527f696e76616c69642071756f74652074696d65000000000000000000000000000060448201526064016109a4565b60035473ffffffffffffffffffffffffffffffffffffffff8881169116148015610b735750600034115b15610c6957853414610be1576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601b60248201527f6d73672e76616c7565206d757374206d6174636820616d6f756e74000000000060448201526064016109a4565b600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663d0e30db0346040518263ffffffff1660e01b81526004016000604051808303818588803b158015610c4b57600080fd5b505af1158015610c5f573d6000803e3d6000fd5b5050505050610c8b565b610c8b73ffffffffffffffffffffffffffffffffffffffff8816333089611930565b600354604080518881526020810188905267ffffffffffffffff87168183015263ffffffff868116606083015273ffffffffffffffffffffffffffffffffffffffff8c8116608084015292513394938c16937c01000000000000000000000000000000000000000000000000000000009004909116917ffc53c5b967d467d4136291c639720626f3d6dda97b4364da813e6858ad48a721919081900360a00190a460016003601c8282829054906101000a900463ffffffff16610d4e91906139cb565b92506101000a81548163ffffffff021916908363ffffffff160217905550610db0600080547fffffffffffffffffffffff00ffffffffffffffffffffffffffffffffffffffff1674010000000000000000000000000000000000000000179055565b5050505050505050565b610dc261173f565b60058054600181018255600091909152600381027f036b6384b5eca791c62761152d0c79bb0604c104a5fb6f4eb0703f3154bb3db181018490557f036b6384b5eca791c62761152d0c79bb0604c104a5fb6f4eb0703f3154bb3db001828155604080518581526020810185905263ffffffff8416917fc86ba04c55bc5eb2f2876b91c438849a296dbec7b08751c3074d92e04f0a77af910160405180910390a250505050565b60075473ffffffffffffffffffffffffffffffffffffffff163314610ee9576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657260448201526064016109a4565b610ef36000611a0c565b565b610efd6118ac565b610f2a600080547fffffffffffffffffffffff00ffffffffffffffffffffffffffffffffffffffff169055565b60006040518061010001604052808c73ffffffffffffffffffffffffffffffffffffffff1681526020018b73ffffffffffffffffffffffffffffffffffffffff1681526020018a73ffffffffffffffffffffffffffffffffffffffff1681526020018981526020018681526020018567ffffffffffffffff1681526020018467ffffffffffffffff1681526020018363ffffffff1681525090506000610fcf82611a83565b90506000610fe182848b886000611ab3565b9050610ff282828a88876000611d41565b505050611039600080547fffffffffffffffffffffff00ffffffffffffffffffffffffffffffffffffffff1674010000000000000000000000000000000000000000179055565b50505050505050505050565b61104d61173f565b60058181548110611060576110606139f3565b60009182526020822060039091020181815560010181905560405182917f3569b846531b754c99cb80df3f49cd72fa6fe106aaee5ab8e0caf35a9d7ce88d91a250565b6060341561110d576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601b60248201527f4f6e6c79206d756c746963616c6c207769746820302076616c7565000000000060448201526064016109a4565b8167ffffffffffffffff8111156111265761112661341f565b60405190808252806020026020018201604052801561115957816020015b60608152602001906001900390816111445790505b50905060005b82811015611276576000803086868581811061117d5761117d6139f3565b905060200281019061118f9190613a22565b60405161119d929190613a87565b600060405180830381855af49150503d80600081146111d8576040519150601f19603f3d011682016040523d82523d6000602084013e6111dd565b606091505b509150915081611243576044815110156111f657600080fd5b600481019050808060200190518101906112109190613a97565b6040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016109a49190613b05565b80848481518110611256576112566139f3565b60200260200101819052505050808061126e90613b18565b91505061115f565b5092915050565b6112856118ac565b6112b2600080547fffffffffffffffffffffff00ffffffffffffffffffffffffffffffffffffffff169055565b6112bd838383611e66565b611301600080547fffffffffffffffffffffff00ffffffffffffffffffffffffffffffffffffffff1674010000000000000000000000000000000000000000179055565b505050565b61130e61173f565b6106798161222c565b61131f6118ac565b61134c600080547fffffffffffffffffffffff00ffffffffffffffffffffffffffffffffffffffff169055565b6113598446858585612318565b8373ffffffffffffffffffffffffffffffffffffffff168263ffffffff167fb9de16bf376724405019a10ef4fedac57fecd292bf86c08d81d7c42d394d5d3785846040516113a8929190613b51565b60405180910390a36113f4600080547fffffffffffffffffffffff00ffffffffffffffffffffffffffffffffffffffff1674010000000000000000000000000000000000000000179055565b50505050565b6005818154811061140a57600080fd5b60009182526020909120600390910201805460019091015490915082565b60075473ffffffffffffffffffffffffffffffffffffffff1633146114a9576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657260448201526064016109a4565b73ffffffffffffffffffffffffffffffffffffffff811661154c576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201527f646472657373000000000000000000000000000000000000000000000000000060648201526084016109a4565b61067981611a0c565b61155d6118ac565b61158a600080547fffffffffffffffffffffff00ffffffffffffffffffffffffffffffffffffffff169055565b61159c8a8a8a8a8a8a8a8a8a8a6123b5565b611039600080547fffffffffffffffffffffff00ffffffffffffffffffffffffffffffffffffffff1674010000000000000000000000000000000000000000179055565b6115e86118ac565b611615600080547fffffffffffffffffffffff00ffffffffffffffffffffffffffffffffffffffff169055565b6116228c87858585612318565b60006040518061010001604052808e73ffffffffffffffffffffffffffffffffffffffff1681526020018d73ffffffffffffffffffffffffffffffffffffffff1681526020018c73ffffffffffffffffffffffffffffffffffffffff1681526020018b81526020018881526020018767ffffffffffffffff1681526020018667ffffffffffffffff1681526020018463ffffffff16815250905060006116c782611a83565b905060006116d982848d896000611ab3565b90506116ea82828c89876000611d41565b505050611731600080547fffffffffffffffffffffff00ffffffffffffffffffffffffffffffffffffffff1674010000000000000000000000000000000000000000179055565b505050505050505050505050565b60075473ffffffffffffffffffffffffffffffffffffffff163314610ef3576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657260448201526064016109a4565b73ffffffffffffffffffffffffffffffffffffffff811661183d576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601460248201527f4261642068756220706f6f6c206164647265737300000000000000000000000060448201526064016109a4565b600280547fffffffffffffffffffffffff00000000000000000000000000000000000000001673ffffffffffffffffffffffffffffffffffffffff83169081179091556040517f1f17a88f67b0f49060a34bec1a4723a563620e6aa265eb640b5046dcee0759a090600090a250565b60005474010000000000000000000000000000000000000000900460ff16610ef3576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601f60248201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c0060448201526064016109a4565b60405173ffffffffffffffffffffffffffffffffffffffff808516602483015283166044820152606481018290526113f49085907f23b872dd00000000000000000000000000000000000000000000000000000000906084015b604080517fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe08184030181529190526020810180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff167fffffffff000000000000000000000000000000000000000000000000000000009093169290921790915261252d565b6007805473ffffffffffffffffffffffffffffffffffffffff8381167fffffffffffffffffffffffff0000000000000000000000000000000000000000831681179093556040519116919082907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e090600090a35050565b600081604051602001611a969190613b74565b604051602081830303815290604052805190602001209050919050565b60006706f05b59d3b200008367ffffffffffffffff16108015611aeb57506706f05b59d3b200008560a0015167ffffffffffffffff16105b611b51576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152600c60248201527f696e76616c69642066656573000000000000000000000000000000000000000060448201526064016109a4565b606085015160008781526006602052604090205410611bcc576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152600c60248201527f72656c61792066696c6c6564000000000000000000000000000000000000000060448201526064016109a4565b83611bd957506000611d38565b611bf284848760a00151611bed9190613c00565b612639565b60008781526006602052604081205460608801519293508692611c159190613c23565b905082811015611c3e57809250611c3b83868960a00151611c369190613c00565b61267a565b91505b60008881526006602052604081208054859290611c5c908490613c3a565b9091555050600354604088015173ffffffffffffffffffffffffffffffffffffffff90811691161415611cc85783611cb5576040870151611cb59073ffffffffffffffffffffffffffffffffffffffff16333085611930565b611cc38760200151836126a3565b611d35565b83611d0257611cc3338860200151848a6040015173ffffffffffffffffffffffffffffffffffffffff16611930909392919063ffffffff16565b611d35876020015183896040015173ffffffffffffffffffffffffffffffffffffffff166127af9092919063ffffffff16565b50505b95945050505050565b816000015173ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16877fedf6b64f49870333280b7dcf98ec56c6b9ff7cf50aa9be7caecb3874e961849f8560600151600660008c8152602001908152602001600020548a8a89608001518b8b60a001518c60e001518d604001518e602001518e604051611e569b9a999897969594939291909a8b5260208b019990995260408a01979097526060890195909552608088019390935267ffffffffffffffff91821660a08801521660c086015263ffffffff1660e085015273ffffffffffffffffffffffffffffffffffffffff9081166101008501521661012083015215156101408201526101600190565b60405180910390a4505050505050565b46826020015114611ed3576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152600f60248201527f496e76616c696420636861696e4964000000000000000000000000000000000060448201526064016109a4565b8160400151518260a001515114611f46576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152600c60248201527f696e76616c6964206c656166000000000000000000000000000000000000000060448201526064016109a4565b600060058463ffffffff1681548110611f6157611f616139f3565b90600052602060002090600302019050611f8081600101548484612805565b611fe6576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152600960248201527f4261642050726f6f66000000000000000000000000000000000000000000000060448201526064016109a4565b611ffd81600201846060015163ffffffff16612840565b15612064576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152600f60248201527f416c726561647920636c61696d6564000000000000000000000000000000000060448201526064016109a4565b61207b81600201846060015163ffffffff16612881565b60005b8360400151518163ffffffff16101561212757600084604001518263ffffffff16815181106120af576120af6139f3565b602002602001015190506000811115612114576121148560a001518363ffffffff16815181106120e1576120e16139f3565b602002602001015182876080015173ffffffffffffffffffffffffffffffffffffffff166127af9092919063ffffffff16565b508061211f81613c52565b91505061207e565b508251156121c057612138836128bf565b826080015173ffffffffffffffffffffffffffffffffffffffff16836060015163ffffffff1684602001517f828fc203220356df8f072a91681caee7d5c75095e2a95e80ed5a14b384697f718660000151336040516121b792919091825273ffffffffffffffffffffffffffffffffffffffff16602082015260400190565b60405180910390a45b826060015163ffffffff168463ffffffff1684602001517ff8bd640004bcec1b89657020f561d0b070cbdf662d0b158db9dccb0a8301bfab8660000151876040015188608001518960a001513360405161221e959493929190613cf7565b60405180910390a450505050565b73ffffffffffffffffffffffffffffffffffffffff81166122a9576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601960248201527f4261642062726964676520726f7574657220616464726573730000000000000060448201526064016109a4565b600180547fffffffffffffffffffffffff00000000000000000000000000000000000000001673ffffffffffffffffffffffffffffffffffffffff83169081179091556040517fa9e8c42c9e7fca7f62755189a16b2f5314d43d8fb24e91ba54e6d65f9314e84990600090a250565b60408051608060208201819052601160a08301527f4143524f53532d56322d4645452d312e3000000000000000000000000000000060c083015267ffffffffffffffff86169282019290925263ffffffff8416606082015290810185905260009060e001604051602081830303815290604052805190602001209050600061239f82612963565b90506123ac87828561299e565b50505050505050565b60006040518061010001604052808c73ffffffffffffffffffffffffffffffffffffffff1681526020018b73ffffffffffffffffffffffffffffffffffffffff1681526020018a73ffffffffffffffffffffffffffffffffffffffff1681526020018981526020018881526020018767ffffffffffffffff1681526020018667ffffffffffffffff1681526020018563ffffffff16815250905061248460058463ffffffff168154811061246b5761246b6139f3565b9060005260206000209060030201600001548284612a0f565b6124ea576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152600d60248201527f496e76616c69642070726f6f660000000000000000000000000000000000000060448201526064016109a4565b60006124f582611a83565b9050600061250c8284856060015160006001611ab3565b905061251e8282600080876001611d41565b50505050505050505050505050565b600061258f826040518060400160405280602081526020017f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c65648152508573ffffffffffffffffffffffffffffffffffffffff16612a279092919063ffffffff16565b80519091501561130157808060200190518101906125ad9190613d55565b611301576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602a60248201527f5361666545524332303a204552433230206f7065726174696f6e20646964206e60448201527f6f7420737563636565640000000000000000000000000000000000000000000060648201526084016109a4565b600061264d82670de0b6b3a7640000613d72565b67ffffffffffffffff1661266984670de0b6b3a7640000613d93565b6126739190613dff565b9392505050565b6000670de0b6b3a764000061268f8382613d72565b6126699067ffffffffffffffff1685613d93565b73ffffffffffffffffffffffffffffffffffffffff82163b156126e8576003546126e49073ffffffffffffffffffffffffffffffffffffffff1683836127af565b5050565b6003546040517f2e1a7d4d0000000000000000000000000000000000000000000000000000000081526004810183905273ffffffffffffffffffffffffffffffffffffffff90911690632e1a7d4d90602401600060405180830381600087803b15801561275457600080fd5b505af1158015612768573d6000803e3d6000fd5b505060405173ffffffffffffffffffffffffffffffffffffffff8516925083156108fc02915083906000818181858888f19350505050158015611301573d6000803e3d6000fd5b60405173ffffffffffffffffffffffffffffffffffffffff83166024820152604481018290526113019084907fa9059cbb000000000000000000000000000000000000000000000000000000009060640161198a565b600061283882858560405160200161281d9190613e13565b60405160208183030381529060405280519060200120612a36565b949350505050565b60008061284f61010084613dff565b9050600061285f61010085613eae565b6000928352602095909552506040902054600190931b92831690921492915050565b600061288f61010083613dff565b9050600061289f61010084613eae565b600092835260209490945250604090208054600190931b90921790915550565b608081015160025482516040517fa9059cbb00000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff9283166004820152602481019190915291169063a9059cbb906044016020604051808303816000875af115801561293f573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906126e49190613d55565b6040517f19457468657265756d205369676e6564204d6573736167653a0a3332000000006020820152603c8101829052600090605c01611a96565b6129a9838383612a4c565b611301576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601160248201527f696e76616c6964207369676e617475726500000000000000000000000000000060448201526064016109a4565b600061283882858560405160200161281d9190613b74565b60606128388484600085612c3b565b600082612a438584612dd1565b14949350505050565b6000806000612a5b8585612e45565b90925090506000816004811115612a7457612a74613ec2565b148015612aac57508573ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff16145b15612abc57600192505050612673565b6000808773ffffffffffffffffffffffffffffffffffffffff16631626ba7e60e01b8888604051602401612af1929190613ef1565b604080517fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe08184030181529181526020820180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff167fffffffff00000000000000000000000000000000000000000000000000000000909416939093179092529051612b7a9190613f0a565b600060405180830381855afa9150503d8060008114612bb5576040519150601f19603f3d011682016040523d82523d6000602084013e612bba565b606091505b5091509150818015612bcd575080516020145b8015612c2f575080517f1626ba7e0000000000000000000000000000000000000000000000000000000090612c0b9083016020908101908401613f26565b7fffffffff0000000000000000000000000000000000000000000000000000000016145b98975050505050505050565b606082471015612ccd576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602660248201527f416464726573733a20696e73756666696369656e742062616c616e636520666f60448201527f722063616c6c000000000000000000000000000000000000000000000000000060648201526084016109a4565b73ffffffffffffffffffffffffffffffffffffffff85163b612d4b576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e747261637400000060448201526064016109a4565b6000808673ffffffffffffffffffffffffffffffffffffffff168587604051612d749190613f0a565b60006040518083038185875af1925050503d8060008114612db1576040519150601f19603f3d011682016040523d82523d6000602084013e612db6565b606091505b5091509150612dc6828286612eb5565b979650505050505050565b600081815b8451811015612e3d576000858281518110612df357612df36139f3565b60200260200101519050808311612e195760008381526020829052604090209250612e2a565b600081815260208490526040902092505b5080612e3581613b18565b915050612dd6565b509392505050565b600080825160411415612e7c5760208301516040840151606085015160001a612e7087828585612f08565b94509450505050612eae565b825160401415612ea65760208301516040840151612e9b868383613020565b935093505050612eae565b506000905060025b9250929050565b60608315612ec4575081612673565b825115612ed45782518084602001fd5b816040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016109a49190613b05565b6000807f7fffffffffffffffffffffffffffffff5d576e7357a4501ddfe92f46681b20a0831115612f3f5750600090506003613017565b8460ff16601b14158015612f5757508460ff16601c14155b15612f685750600090506004613017565b6040805160008082526020820180845289905260ff881692820192909252606081018690526080810185905260019060a0016020604051602081039080840390855afa158015612fbc573d6000803e3d6000fd5b50506040517fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0015191505073ffffffffffffffffffffffffffffffffffffffff811661301057600060019250925050613017565b9150600090505b94509492505050565b6000807f7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff83168161305660ff86901c601b613c3a565b905061306487828885612f08565b935093505050935093915050565b803573ffffffffffffffffffffffffffffffffffffffff8116811461309657600080fd5b919050565b6000602082840312156130ad57600080fd5b61267382613072565b6000602082840312156130c857600080fd5b5035919050565b801515811461067957600080fd5b6000806000606084860312156130f257600080fd5b6130fb84613072565b9250602084013591506040840135613112816130cf565b809150509250925092565b803563ffffffff8116811461309657600080fd5b60006020828403121561314357600080fd5b6126738261311d565b803567ffffffffffffffff8116811461309657600080fd5b60008060008060008060c0878903121561317d57600080fd5b61318687613072565b955061319460208801613072565b945060408701359350606087013592506131b06080880161314c565b91506131be60a0880161311d565b90509295509295509295565b600080604083850312156131dd57600080fd5b50508035926020909101359150565b600080604083850312156131ff57600080fd5b61320883613072565b946020939093013593505050565b6000806000806000806000806000806101408b8d03121561323657600080fd5b61323f8b613072565b995061324d60208c01613072565b985061325b60408c01613072565b975060608b0135965060808b0135955060a08b0135945060c08b0135935061328560e08c0161314c565b92506132946101008c0161314c565b91506132a36101208c0161311d565b90509295989b9194979a5092959850565b600080602083850312156132c757600080fd5b823567ffffffffffffffff808211156132df57600080fd5b818501915085601f8301126132f357600080fd5b81358181111561330257600080fd5b8660208260051b850101111561331757600080fd5b60209290920196919550909350505050565b60005b8381101561334457818101518382015260200161332c565b838111156113f45750506000910152565b6000815180845261336d816020860160208601613329565b601f017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0169290920160200192915050565b6000602080830181845280855180835260408601915060408160051b870101925083870160005b82811015613412577fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc0888603018452613400858351613355565b945092850192908501906001016133c6565b5092979650505050505050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b60405160c0810167ffffffffffffffff811182821017156134715761347161341f565b60405290565b604051601f82017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe016810167ffffffffffffffff811182821017156134be576134be61341f565b604052919050565b600067ffffffffffffffff8211156134e0576134e061341f565b5060051b60200190565b600082601f8301126134fb57600080fd5b8135602061351061350b836134c6565b613477565b82815260059290921b8401810191818101908684111561352f57600080fd5b8286015b8481101561354a5780358352918301918301613533565b509695505050505050565b600082601f83011261356657600080fd5b8135602061357661350b836134c6565b82815260059290921b8401810191818101908684111561359557600080fd5b8286015b8481101561354a576135aa81613072565b8352918301918301613599565b6000806000606084860312156135cc57600080fd5b6135d58461311d565b9250602084013567ffffffffffffffff808211156135f257600080fd5b9085019060c0828803121561360657600080fd5b61360e61344e565b823581526020830135602082015260408301358281111561362e57600080fd5b61363a898286016134ea565b60408301525061364c6060840161311d565b606082015261365d60808401613072565b608082015260a08301358281111561367457600080fd5b61368089828601613555565b60a0830152509350604086013591508082111561369c57600080fd5b506136a9868287016134ea565b9150509250925092565b600067ffffffffffffffff8211156136cd576136cd61341f565b50601f017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe01660200190565b600082601f83011261370a57600080fd5b813561371861350b826136b3565b81815284602083860101111561372d57600080fd5b816020850160208301376000918101602001919091529392505050565b6000806000806080858703121561376057600080fd5b61376985613072565b93506137776020860161314c565b92506137856040860161311d565b9150606085013567ffffffffffffffff8111156137a157600080fd5b6137ad878288016136f9565b91505092959194509250565b6000806000806000806000806000806101408b8d0312156137d957600080fd5b6137e28b613072565b99506137f060208c01613072565b98506137fe60408c01613072565b975060608b0135965060808b0135955061381a60a08c0161314c565b945061382860c08c0161314c565b935061383660e08c0161311d565b92506138456101008c0161311d565b91506101208b013567ffffffffffffffff81111561386257600080fd5b61386e8d828e016134ea565b9150509295989b9194979a5092959850565b6000806000806000806000806000806000806101808d8f0312156138a357600080fd5b6138ac8d613072565b9b506138ba60208e01613072565b9a506138c860408e01613072565b995060608d0135985060808d0135975060a08d0135965060c08d013595506138f260e08e0161314c565b94506139016101008e0161314c565b93506139106101208e0161314c565b925061391f6101408e0161311d565b915067ffffffffffffffff6101608e0135111561393b57600080fd5b61394c8e6101608f01358f016136f9565b90509295989b509295989b509295989b565b60006020828403121561397057600080fd5b5051919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b600063ffffffff838116908316818110156139c3576139c3613977565b039392505050565b600063ffffffff8083168185168083038211156139ea576139ea613977565b01949350505050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b60008083357fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe1843603018112613a5757600080fd5b83018035915067ffffffffffffffff821115613a7257600080fd5b602001915036819003821315612eae57600080fd5b8183823760009101908152919050565b600060208284031215613aa957600080fd5b815167ffffffffffffffff811115613ac057600080fd5b8201601f81018413613ad157600080fd5b8051613adf61350b826136b3565b818152856020838501011115613af457600080fd5b611d38826020830160208601613329565b6020815260006126736020830184613355565b60007fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff821415613b4a57613b4a613977565b5060010190565b67ffffffffffffffff831681526040602082015260006128386040830184613355565b60006101008201905073ffffffffffffffffffffffffffffffffffffffff80845116835280602085015116602084015280604085015116604084015250606083015160608301526080830151608083015260a083015167ffffffffffffffff80821660a08501528060c08601511660c0850152505060e083015161127660e084018263ffffffff169052565b600067ffffffffffffffff8083168185168083038211156139ea576139ea613977565b600082821015613c3557613c35613977565b500390565b60008219821115613c4d57613c4d613977565b500190565b600063ffffffff80831681811415613c6c57613c6c613977565b6001019392505050565b600081518084526020808501945080840160005b83811015613ca657815187529582019590820190600101613c8a565b509495945050505050565b600081518084526020808501945080840160005b83811015613ca657815173ffffffffffffffffffffffffffffffffffffffff1687529582019590820190600101613cc5565b85815260a060208201526000613d1060a0830187613c76565b73ffffffffffffffffffffffffffffffffffffffff80871660408501528382036060850152613d3f8287613cb1565b9250808516608085015250509695505050505050565b600060208284031215613d6757600080fd5b8151612673816130cf565b600067ffffffffffffffff838116908316818110156139c3576139c3613977565b6000817fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0483118215151615613dcb57613dcb613977565b500290565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601260045260246000fd5b600082613e0e57613e0e613dd0565b500490565b6020815281516020820152602082015160408201526000604083015160c06060840152613e4360e0840182613c76565b905063ffffffff606085015116608084015273ffffffffffffffffffffffffffffffffffffffff60808501511660a084015260a08401517fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe08483030160c0850152611d388282613cb1565b600082613ebd57613ebd613dd0565b500690565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052602160045260246000fd5b8281526040602082015260006128386040830184613355565b60008251613f1c818460208701613329565b9190910192915050565b600060208284031215613f3857600080fd5b81517fffffffff000000000000000000000000000000000000000000000000000000008116811461267357600080fdfea264697066735822122008611c782993f84999c5bbae3514787870b91cb520248d3fb3854db39d729ca064736f6c634300080b0033", + "deployedBytecode": "0x6080604052600436106101c65760003560e01c80638a7860ce116100f7578063e190440211610095578063f06850f611610064578063f06850f6146105db578063f2fde38b14610608578063f500697c14610628578063ffc351a31461064857600080fd5b8063e190440214610524578063e282d5b914610551578063ecda10f514610571578063ee2a53f8146105a657600080fd5b8063a1244c67116100d1578063a1244c6714610487578063ac9650d8146104c4578063c894c0ca146104e4578063de7eba781461050457600080fd5b80638a7860ce146104295780638da5cb5b146104495780639a8a05921461047457600080fd5b806349228978116101645780635285e0581161013e5780635285e0581461037957806357f6dcb8146103a6578063715018a6146103f457806389a153cc1461040957600080fd5b806349228978146102fb578063493a4f841461030e5780635249fef11461032e57600080fd5b8063272751c7116101a0578063272751c71461026b5780632752042e1461028b57806329cb924d146102ab5780633fc8cef3146102ce57600080fd5b80631c39c38d146101d25780631dfb2d021461022957806322f8e5661461024b57600080fd5b366101cd57005b600080fd5b3480156101de57600080fd5b506000546101ff9073ffffffffffffffffffffffffffffffffffffffff1681565b60405173ffffffffffffffffffffffffffffffffffffffff90911681526020015b60405180910390f35b34801561023557600080fd5b5061024961024436600461309b565b610668565b005b34801561025757600080fd5b506102496102663660046130b6565b61067c565b34801561027757600080fd5b506102496102863660046130dd565b610725565b34801561029757600080fd5b506102496102a6366004613131565b6107c3565b3480156102b757600080fd5b506102c0610852565b604051908152602001610220565b3480156102da57600080fd5b506003546101ff9073ffffffffffffffffffffffffffffffffffffffff1681565b610249610309366004613164565b61090a565b34801561031a57600080fd5b506102496103293660046131ca565b610dba565b34801561033a57600080fd5b506103696103493660046131ec565b600460209081526000928352604080842090915290825290205460ff1681565b6040519015158152602001610220565b34801561038557600080fd5b506001546101ff9073ffffffffffffffffffffffffffffffffffffffff1681565b3480156103b257600080fd5b506003546103df907801000000000000000000000000000000000000000000000000900463ffffffff1681565b60405163ffffffff9091168152602001610220565b34801561040057600080fd5b50610249610e68565b34801561041557600080fd5b50610249610424366004613216565b610ef5565b34801561043557600080fd5b506102496104443660046130b6565b611045565b34801561045557600080fd5b5060075473ffffffffffffffffffffffffffffffffffffffff166101ff565b34801561048057600080fd5b50466102c0565b34801561049357600080fd5b506003546103df907c0100000000000000000000000000000000000000000000000000000000900463ffffffff1681565b6104d76104d23660046132b4565b6110a3565b604051610220919061339f565b3480156104f057600080fd5b506102496104ff3660046135b7565b61127d565b34801561051057600080fd5b5061024961051f36600461309b565b611306565b34801561053057600080fd5b506002546101ff9073ffffffffffffffffffffffffffffffffffffffff1681565b34801561055d57600080fd5b5061024961056c36600461374a565b611317565b34801561057d57600080fd5b506003546103df9074010000000000000000000000000000000000000000900463ffffffff1681565b3480156105b257600080fd5b506105c66105c13660046130b6565b6113fa565b60408051928352602083019190915201610220565b3480156105e757600080fd5b506102c06105f63660046130b6565b60066020526000908152604090205481565b34801561061457600080fd5b5061024961062336600461309b565b611428565b34801561063457600080fd5b506102496106433660046137b9565b611555565b34801561065457600080fd5b50610249610663366004613880565b6115e0565b61067061173f565b610679816117c0565b50565b60005473ffffffffffffffffffffffffffffffffffffffff1661069e57600080fd5b6000546040517f22f8e5660000000000000000000000000000000000000000000000000000000081526004810183905273ffffffffffffffffffffffffffffffffffffffff909116906322f8e56690602401600060405180830381600087803b15801561070a57600080fd5b505af115801561071e573d6000803e3d6000fd5b5050505050565b61072d61173f565b73ffffffffffffffffffffffffffffffffffffffff8316600081815260046020908152604080832086845282529182902080547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff001685151590811790915591519182528492917f0a21fdd43d0ad0c62689ee7230a47309a050755bcc52eba00310add65297692a910160405180910390a3505050565b6107cb61173f565b600380547fffffffff00000000ffffffffffffffffffffffffffffffffffffffffffffffff16780100000000000000000000000000000000000000000000000063ffffffff8416908102919091179091556040519081527f0e55dd180fa793d9036c804d0a116e6a7617a48e72cee1f83d92793a793fcc039060200160405180910390a150565b6000805473ffffffffffffffffffffffffffffffffffffffff16156109055760008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166329cb924d6040518163ffffffff1660e01b8152600401602060405180830381865afa1580156108dc573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610900919061395e565b905090565b504290565b73ffffffffffffffffffffffffffffffffffffffff851660009081526004602090815260408083208684529091529020548590849060ff166109ad576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152600e60248201527f44697361626c656420726f75746500000000000000000000000000000000000060448201526064015b60405180910390fd5b6109b56118ac565b6109e2600080547fffffffffffffffffffffff00ffffffffffffffffffffffffffffffffffffffff169055565b6706f05b59d3b200008467ffffffffffffffff1610610a5d576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601360248201527f696e76616c69642072656c61796572206665650000000000000000000000000060448201526064016109a4565b600354610a8c907801000000000000000000000000000000000000000000000000900463ffffffff16846139a6565b63ffffffff16610a9a610852565b10158015610ae35750600354610ad2907801000000000000000000000000000000000000000000000000900463ffffffff16846139cb565b63ffffffff16610ae0610852565b11155b610b49576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601260248201527f696e76616c69642071756f74652074696d65000000000000000000000000000060448201526064016109a4565b60035473ffffffffffffffffffffffffffffffffffffffff8881169116148015610b735750600034115b15610c6957853414610be1576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601b60248201527f6d73672e76616c7565206d757374206d6174636820616d6f756e74000000000060448201526064016109a4565b600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663d0e30db0346040518263ffffffff1660e01b81526004016000604051808303818588803b158015610c4b57600080fd5b505af1158015610c5f573d6000803e3d6000fd5b5050505050610c8b565b610c8b73ffffffffffffffffffffffffffffffffffffffff8816333089611930565b600354604080518881526020810188905267ffffffffffffffff87168183015263ffffffff868116606083015273ffffffffffffffffffffffffffffffffffffffff8c8116608084015292513394938c16937c01000000000000000000000000000000000000000000000000000000009004909116917ffc53c5b967d467d4136291c639720626f3d6dda97b4364da813e6858ad48a721919081900360a00190a460016003601c8282829054906101000a900463ffffffff16610d4e91906139cb565b92506101000a81548163ffffffff021916908363ffffffff160217905550610db0600080547fffffffffffffffffffffff00ffffffffffffffffffffffffffffffffffffffff1674010000000000000000000000000000000000000000179055565b5050505050505050565b610dc261173f565b60058054600181018255600091909152600381027f036b6384b5eca791c62761152d0c79bb0604c104a5fb6f4eb0703f3154bb3db181018490557f036b6384b5eca791c62761152d0c79bb0604c104a5fb6f4eb0703f3154bb3db001828155604080518581526020810185905263ffffffff8416917fc86ba04c55bc5eb2f2876b91c438849a296dbec7b08751c3074d92e04f0a77af910160405180910390a250505050565b60075473ffffffffffffffffffffffffffffffffffffffff163314610ee9576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657260448201526064016109a4565b610ef36000611a0c565b565b610efd6118ac565b610f2a600080547fffffffffffffffffffffff00ffffffffffffffffffffffffffffffffffffffff169055565b60006040518061010001604052808c73ffffffffffffffffffffffffffffffffffffffff1681526020018b73ffffffffffffffffffffffffffffffffffffffff1681526020018a73ffffffffffffffffffffffffffffffffffffffff1681526020018981526020018681526020018567ffffffffffffffff1681526020018467ffffffffffffffff1681526020018363ffffffff1681525090506000610fcf82611a83565b90506000610fe182848b886000611ab3565b9050610ff282828a88876000611d41565b505050611039600080547fffffffffffffffffffffff00ffffffffffffffffffffffffffffffffffffffff1674010000000000000000000000000000000000000000179055565b50505050505050505050565b61104d61173f565b60058181548110611060576110606139f3565b60009182526020822060039091020181815560010181905560405182917f3569b846531b754c99cb80df3f49cd72fa6fe106aaee5ab8e0caf35a9d7ce88d91a250565b6060341561110d576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601b60248201527f4f6e6c79206d756c746963616c6c207769746820302076616c7565000000000060448201526064016109a4565b8167ffffffffffffffff8111156111265761112661341f565b60405190808252806020026020018201604052801561115957816020015b60608152602001906001900390816111445790505b50905060005b82811015611276576000803086868581811061117d5761117d6139f3565b905060200281019061118f9190613a22565b60405161119d929190613a87565b600060405180830381855af49150503d80600081146111d8576040519150601f19603f3d011682016040523d82523d6000602084013e6111dd565b606091505b509150915081611243576044815110156111f657600080fd5b600481019050808060200190518101906112109190613a97565b6040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016109a49190613b05565b80848481518110611256576112566139f3565b60200260200101819052505050808061126e90613b18565b91505061115f565b5092915050565b6112856118ac565b6112b2600080547fffffffffffffffffffffff00ffffffffffffffffffffffffffffffffffffffff169055565b6112bd838383611e66565b611301600080547fffffffffffffffffffffff00ffffffffffffffffffffffffffffffffffffffff1674010000000000000000000000000000000000000000179055565b505050565b61130e61173f565b6106798161222c565b61131f6118ac565b61134c600080547fffffffffffffffffffffff00ffffffffffffffffffffffffffffffffffffffff169055565b6113598446858585612318565b8373ffffffffffffffffffffffffffffffffffffffff168263ffffffff167fb9de16bf376724405019a10ef4fedac57fecd292bf86c08d81d7c42d394d5d3785846040516113a8929190613b51565b60405180910390a36113f4600080547fffffffffffffffffffffff00ffffffffffffffffffffffffffffffffffffffff1674010000000000000000000000000000000000000000179055565b50505050565b6005818154811061140a57600080fd5b60009182526020909120600390910201805460019091015490915082565b60075473ffffffffffffffffffffffffffffffffffffffff1633146114a9576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657260448201526064016109a4565b73ffffffffffffffffffffffffffffffffffffffff811661154c576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201527f646472657373000000000000000000000000000000000000000000000000000060648201526084016109a4565b61067981611a0c565b61155d6118ac565b61158a600080547fffffffffffffffffffffff00ffffffffffffffffffffffffffffffffffffffff169055565b61159c8a8a8a8a8a8a8a8a8a8a6123b5565b611039600080547fffffffffffffffffffffff00ffffffffffffffffffffffffffffffffffffffff1674010000000000000000000000000000000000000000179055565b6115e86118ac565b611615600080547fffffffffffffffffffffff00ffffffffffffffffffffffffffffffffffffffff169055565b6116228c87858585612318565b60006040518061010001604052808e73ffffffffffffffffffffffffffffffffffffffff1681526020018d73ffffffffffffffffffffffffffffffffffffffff1681526020018c73ffffffffffffffffffffffffffffffffffffffff1681526020018b81526020018881526020018767ffffffffffffffff1681526020018667ffffffffffffffff1681526020018463ffffffff16815250905060006116c782611a83565b905060006116d982848d896000611ab3565b90506116ea82828c89876000611d41565b505050611731600080547fffffffffffffffffffffff00ffffffffffffffffffffffffffffffffffffffff1674010000000000000000000000000000000000000000179055565b505050505050505050505050565b60075473ffffffffffffffffffffffffffffffffffffffff163314610ef3576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657260448201526064016109a4565b73ffffffffffffffffffffffffffffffffffffffff811661183d576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601460248201527f4261642068756220706f6f6c206164647265737300000000000000000000000060448201526064016109a4565b600280547fffffffffffffffffffffffff00000000000000000000000000000000000000001673ffffffffffffffffffffffffffffffffffffffff83169081179091556040517f1f17a88f67b0f49060a34bec1a4723a563620e6aa265eb640b5046dcee0759a090600090a250565b60005474010000000000000000000000000000000000000000900460ff16610ef3576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601f60248201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c0060448201526064016109a4565b60405173ffffffffffffffffffffffffffffffffffffffff808516602483015283166044820152606481018290526113f49085907f23b872dd00000000000000000000000000000000000000000000000000000000906084015b604080517fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe08184030181529190526020810180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff167fffffffff000000000000000000000000000000000000000000000000000000009093169290921790915261252d565b6007805473ffffffffffffffffffffffffffffffffffffffff8381167fffffffffffffffffffffffff0000000000000000000000000000000000000000831681179093556040519116919082907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e090600090a35050565b600081604051602001611a969190613b74565b604051602081830303815290604052805190602001209050919050565b60006706f05b59d3b200008367ffffffffffffffff16108015611aeb57506706f05b59d3b200008560a0015167ffffffffffffffff16105b611b51576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152600c60248201527f696e76616c69642066656573000000000000000000000000000000000000000060448201526064016109a4565b606085015160008781526006602052604090205410611bcc576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152600c60248201527f72656c61792066696c6c6564000000000000000000000000000000000000000060448201526064016109a4565b83611bd957506000611d38565b611bf284848760a00151611bed9190613c00565b612639565b60008781526006602052604081205460608801519293508692611c159190613c23565b905082811015611c3e57809250611c3b83868960a00151611c369190613c00565b61267a565b91505b60008881526006602052604081208054859290611c5c908490613c3a565b9091555050600354604088015173ffffffffffffffffffffffffffffffffffffffff90811691161415611cc85783611cb5576040870151611cb59073ffffffffffffffffffffffffffffffffffffffff16333085611930565b611cc38760200151836126a3565b611d35565b83611d0257611cc3338860200151848a6040015173ffffffffffffffffffffffffffffffffffffffff16611930909392919063ffffffff16565b611d35876020015183896040015173ffffffffffffffffffffffffffffffffffffffff166127af9092919063ffffffff16565b50505b95945050505050565b816000015173ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16877fedf6b64f49870333280b7dcf98ec56c6b9ff7cf50aa9be7caecb3874e961849f8560600151600660008c8152602001908152602001600020548a8a89608001518b8b60a001518c60e001518d604001518e602001518e604051611e569b9a999897969594939291909a8b5260208b019990995260408a01979097526060890195909552608088019390935267ffffffffffffffff91821660a08801521660c086015263ffffffff1660e085015273ffffffffffffffffffffffffffffffffffffffff9081166101008501521661012083015215156101408201526101600190565b60405180910390a4505050505050565b46826020015114611ed3576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152600f60248201527f496e76616c696420636861696e4964000000000000000000000000000000000060448201526064016109a4565b8160400151518260a001515114611f46576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152600c60248201527f696e76616c6964206c656166000000000000000000000000000000000000000060448201526064016109a4565b600060058463ffffffff1681548110611f6157611f616139f3565b90600052602060002090600302019050611f8081600101548484612805565b611fe6576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152600960248201527f4261642050726f6f66000000000000000000000000000000000000000000000060448201526064016109a4565b611ffd81600201846060015163ffffffff16612840565b15612064576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152600f60248201527f416c726561647920636c61696d6564000000000000000000000000000000000060448201526064016109a4565b61207b81600201846060015163ffffffff16612881565b60005b8360400151518163ffffffff16101561212757600084604001518263ffffffff16815181106120af576120af6139f3565b602002602001015190506000811115612114576121148560a001518363ffffffff16815181106120e1576120e16139f3565b602002602001015182876080015173ffffffffffffffffffffffffffffffffffffffff166127af9092919063ffffffff16565b508061211f81613c52565b91505061207e565b508251156121c057612138836128bf565b826080015173ffffffffffffffffffffffffffffffffffffffff16836060015163ffffffff1684602001517f828fc203220356df8f072a91681caee7d5c75095e2a95e80ed5a14b384697f718660000151336040516121b792919091825273ffffffffffffffffffffffffffffffffffffffff16602082015260400190565b60405180910390a45b826060015163ffffffff168463ffffffff1684602001517ff8bd640004bcec1b89657020f561d0b070cbdf662d0b158db9dccb0a8301bfab8660000151876040015188608001518960a001513360405161221e959493929190613cf7565b60405180910390a450505050565b73ffffffffffffffffffffffffffffffffffffffff81166122a9576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601960248201527f4261642062726964676520726f7574657220616464726573730000000000000060448201526064016109a4565b600180547fffffffffffffffffffffffff00000000000000000000000000000000000000001673ffffffffffffffffffffffffffffffffffffffff83169081179091556040517fa9e8c42c9e7fca7f62755189a16b2f5314d43d8fb24e91ba54e6d65f9314e84990600090a250565b60408051608060208201819052601160a08301527f4143524f53532d56322d4645452d312e3000000000000000000000000000000060c083015267ffffffffffffffff86169282019290925263ffffffff8416606082015290810185905260009060e001604051602081830303815290604052805190602001209050600061239f82612963565b90506123ac87828561299e565b50505050505050565b60006040518061010001604052808c73ffffffffffffffffffffffffffffffffffffffff1681526020018b73ffffffffffffffffffffffffffffffffffffffff1681526020018a73ffffffffffffffffffffffffffffffffffffffff1681526020018981526020018881526020018767ffffffffffffffff1681526020018667ffffffffffffffff1681526020018563ffffffff16815250905061248460058463ffffffff168154811061246b5761246b6139f3565b9060005260206000209060030201600001548284612a0f565b6124ea576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152600d60248201527f496e76616c69642070726f6f660000000000000000000000000000000000000060448201526064016109a4565b60006124f582611a83565b9050600061250c8284856060015160006001611ab3565b905061251e8282600080876001611d41565b50505050505050505050505050565b600061258f826040518060400160405280602081526020017f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c65648152508573ffffffffffffffffffffffffffffffffffffffff16612a279092919063ffffffff16565b80519091501561130157808060200190518101906125ad9190613d55565b611301576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602a60248201527f5361666545524332303a204552433230206f7065726174696f6e20646964206e60448201527f6f7420737563636565640000000000000000000000000000000000000000000060648201526084016109a4565b600061264d82670de0b6b3a7640000613d72565b67ffffffffffffffff1661266984670de0b6b3a7640000613d93565b6126739190613dff565b9392505050565b6000670de0b6b3a764000061268f8382613d72565b6126699067ffffffffffffffff1685613d93565b73ffffffffffffffffffffffffffffffffffffffff82163b156126e8576003546126e49073ffffffffffffffffffffffffffffffffffffffff1683836127af565b5050565b6003546040517f2e1a7d4d0000000000000000000000000000000000000000000000000000000081526004810183905273ffffffffffffffffffffffffffffffffffffffff90911690632e1a7d4d90602401600060405180830381600087803b15801561275457600080fd5b505af1158015612768573d6000803e3d6000fd5b505060405173ffffffffffffffffffffffffffffffffffffffff8516925083156108fc02915083906000818181858888f19350505050158015611301573d6000803e3d6000fd5b60405173ffffffffffffffffffffffffffffffffffffffff83166024820152604481018290526113019084907fa9059cbb000000000000000000000000000000000000000000000000000000009060640161198a565b600061283882858560405160200161281d9190613e13565b60405160208183030381529060405280519060200120612a36565b949350505050565b60008061284f61010084613dff565b9050600061285f61010085613eae565b6000928352602095909552506040902054600190931b92831690921492915050565b600061288f61010083613dff565b9050600061289f61010084613eae565b600092835260209490945250604090208054600190931b90921790915550565b608081015160025482516040517fa9059cbb00000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff9283166004820152602481019190915291169063a9059cbb906044016020604051808303816000875af115801561293f573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906126e49190613d55565b6040517f19457468657265756d205369676e6564204d6573736167653a0a3332000000006020820152603c8101829052600090605c01611a96565b6129a9838383612a4c565b611301576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601160248201527f696e76616c6964207369676e617475726500000000000000000000000000000060448201526064016109a4565b600061283882858560405160200161281d9190613b74565b60606128388484600085612c3b565b600082612a438584612dd1565b14949350505050565b6000806000612a5b8585612e45565b90925090506000816004811115612a7457612a74613ec2565b148015612aac57508573ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff16145b15612abc57600192505050612673565b6000808773ffffffffffffffffffffffffffffffffffffffff16631626ba7e60e01b8888604051602401612af1929190613ef1565b604080517fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe08184030181529181526020820180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff167fffffffff00000000000000000000000000000000000000000000000000000000909416939093179092529051612b7a9190613f0a565b600060405180830381855afa9150503d8060008114612bb5576040519150601f19603f3d011682016040523d82523d6000602084013e612bba565b606091505b5091509150818015612bcd575080516020145b8015612c2f575080517f1626ba7e0000000000000000000000000000000000000000000000000000000090612c0b9083016020908101908401613f26565b7fffffffff0000000000000000000000000000000000000000000000000000000016145b98975050505050505050565b606082471015612ccd576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602660248201527f416464726573733a20696e73756666696369656e742062616c616e636520666f60448201527f722063616c6c000000000000000000000000000000000000000000000000000060648201526084016109a4565b73ffffffffffffffffffffffffffffffffffffffff85163b612d4b576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e747261637400000060448201526064016109a4565b6000808673ffffffffffffffffffffffffffffffffffffffff168587604051612d749190613f0a565b60006040518083038185875af1925050503d8060008114612db1576040519150601f19603f3d011682016040523d82523d6000602084013e612db6565b606091505b5091509150612dc6828286612eb5565b979650505050505050565b600081815b8451811015612e3d576000858281518110612df357612df36139f3565b60200260200101519050808311612e195760008381526020829052604090209250612e2a565b600081815260208490526040902092505b5080612e3581613b18565b915050612dd6565b509392505050565b600080825160411415612e7c5760208301516040840151606085015160001a612e7087828585612f08565b94509450505050612eae565b825160401415612ea65760208301516040840151612e9b868383613020565b935093505050612eae565b506000905060025b9250929050565b60608315612ec4575081612673565b825115612ed45782518084602001fd5b816040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016109a49190613b05565b6000807f7fffffffffffffffffffffffffffffff5d576e7357a4501ddfe92f46681b20a0831115612f3f5750600090506003613017565b8460ff16601b14158015612f5757508460ff16601c14155b15612f685750600090506004613017565b6040805160008082526020820180845289905260ff881692820192909252606081018690526080810185905260019060a0016020604051602081039080840390855afa158015612fbc573d6000803e3d6000fd5b50506040517fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0015191505073ffffffffffffffffffffffffffffffffffffffff811661301057600060019250925050613017565b9150600090505b94509492505050565b6000807f7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff83168161305660ff86901c601b613c3a565b905061306487828885612f08565b935093505050935093915050565b803573ffffffffffffffffffffffffffffffffffffffff8116811461309657600080fd5b919050565b6000602082840312156130ad57600080fd5b61267382613072565b6000602082840312156130c857600080fd5b5035919050565b801515811461067957600080fd5b6000806000606084860312156130f257600080fd5b6130fb84613072565b9250602084013591506040840135613112816130cf565b809150509250925092565b803563ffffffff8116811461309657600080fd5b60006020828403121561314357600080fd5b6126738261311d565b803567ffffffffffffffff8116811461309657600080fd5b60008060008060008060c0878903121561317d57600080fd5b61318687613072565b955061319460208801613072565b945060408701359350606087013592506131b06080880161314c565b91506131be60a0880161311d565b90509295509295509295565b600080604083850312156131dd57600080fd5b50508035926020909101359150565b600080604083850312156131ff57600080fd5b61320883613072565b946020939093013593505050565b6000806000806000806000806000806101408b8d03121561323657600080fd5b61323f8b613072565b995061324d60208c01613072565b985061325b60408c01613072565b975060608b0135965060808b0135955060a08b0135945060c08b0135935061328560e08c0161314c565b92506132946101008c0161314c565b91506132a36101208c0161311d565b90509295989b9194979a5092959850565b600080602083850312156132c757600080fd5b823567ffffffffffffffff808211156132df57600080fd5b818501915085601f8301126132f357600080fd5b81358181111561330257600080fd5b8660208260051b850101111561331757600080fd5b60209290920196919550909350505050565b60005b8381101561334457818101518382015260200161332c565b838111156113f45750506000910152565b6000815180845261336d816020860160208601613329565b601f017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0169290920160200192915050565b6000602080830181845280855180835260408601915060408160051b870101925083870160005b82811015613412577fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc0888603018452613400858351613355565b945092850192908501906001016133c6565b5092979650505050505050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b60405160c0810167ffffffffffffffff811182821017156134715761347161341f565b60405290565b604051601f82017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe016810167ffffffffffffffff811182821017156134be576134be61341f565b604052919050565b600067ffffffffffffffff8211156134e0576134e061341f565b5060051b60200190565b600082601f8301126134fb57600080fd5b8135602061351061350b836134c6565b613477565b82815260059290921b8401810191818101908684111561352f57600080fd5b8286015b8481101561354a5780358352918301918301613533565b509695505050505050565b600082601f83011261356657600080fd5b8135602061357661350b836134c6565b82815260059290921b8401810191818101908684111561359557600080fd5b8286015b8481101561354a576135aa81613072565b8352918301918301613599565b6000806000606084860312156135cc57600080fd5b6135d58461311d565b9250602084013567ffffffffffffffff808211156135f257600080fd5b9085019060c0828803121561360657600080fd5b61360e61344e565b823581526020830135602082015260408301358281111561362e57600080fd5b61363a898286016134ea565b60408301525061364c6060840161311d565b606082015261365d60808401613072565b608082015260a08301358281111561367457600080fd5b61368089828601613555565b60a0830152509350604086013591508082111561369c57600080fd5b506136a9868287016134ea565b9150509250925092565b600067ffffffffffffffff8211156136cd576136cd61341f565b50601f017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe01660200190565b600082601f83011261370a57600080fd5b813561371861350b826136b3565b81815284602083860101111561372d57600080fd5b816020850160208301376000918101602001919091529392505050565b6000806000806080858703121561376057600080fd5b61376985613072565b93506137776020860161314c565b92506137856040860161311d565b9150606085013567ffffffffffffffff8111156137a157600080fd5b6137ad878288016136f9565b91505092959194509250565b6000806000806000806000806000806101408b8d0312156137d957600080fd5b6137e28b613072565b99506137f060208c01613072565b98506137fe60408c01613072565b975060608b0135965060808b0135955061381a60a08c0161314c565b945061382860c08c0161314c565b935061383660e08c0161311d565b92506138456101008c0161311d565b91506101208b013567ffffffffffffffff81111561386257600080fd5b61386e8d828e016134ea565b9150509295989b9194979a5092959850565b6000806000806000806000806000806000806101808d8f0312156138a357600080fd5b6138ac8d613072565b9b506138ba60208e01613072565b9a506138c860408e01613072565b995060608d0135985060808d0135975060a08d0135965060c08d013595506138f260e08e0161314c565b94506139016101008e0161314c565b93506139106101208e0161314c565b925061391f6101408e0161311d565b915067ffffffffffffffff6101608e0135111561393b57600080fd5b61394c8e6101608f01358f016136f9565b90509295989b509295989b509295989b565b60006020828403121561397057600080fd5b5051919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b600063ffffffff838116908316818110156139c3576139c3613977565b039392505050565b600063ffffffff8083168185168083038211156139ea576139ea613977565b01949350505050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b60008083357fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe1843603018112613a5757600080fd5b83018035915067ffffffffffffffff821115613a7257600080fd5b602001915036819003821315612eae57600080fd5b8183823760009101908152919050565b600060208284031215613aa957600080fd5b815167ffffffffffffffff811115613ac057600080fd5b8201601f81018413613ad157600080fd5b8051613adf61350b826136b3565b818152856020838501011115613af457600080fd5b611d38826020830160208601613329565b6020815260006126736020830184613355565b60007fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff821415613b4a57613b4a613977565b5060010190565b67ffffffffffffffff831681526040602082015260006128386040830184613355565b60006101008201905073ffffffffffffffffffffffffffffffffffffffff80845116835280602085015116602084015280604085015116604084015250606083015160608301526080830151608083015260a083015167ffffffffffffffff80821660a08501528060c08601511660c0850152505060e083015161127660e084018263ffffffff169052565b600067ffffffffffffffff8083168185168083038211156139ea576139ea613977565b600082821015613c3557613c35613977565b500390565b60008219821115613c4d57613c4d613977565b500190565b600063ffffffff80831681811415613c6c57613c6c613977565b6001019392505050565b600081518084526020808501945080840160005b83811015613ca657815187529582019590820190600101613c8a565b509495945050505050565b600081518084526020808501945080840160005b83811015613ca657815173ffffffffffffffffffffffffffffffffffffffff1687529582019590820190600101613cc5565b85815260a060208201526000613d1060a0830187613c76565b73ffffffffffffffffffffffffffffffffffffffff80871660408501528382036060850152613d3f8287613cb1565b9250808516608085015250509695505050505050565b600060208284031215613d6757600080fd5b8151612673816130cf565b600067ffffffffffffffff838116908316818110156139c3576139c3613977565b6000817fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0483118215151615613dcb57613dcb613977565b500290565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601260045260246000fd5b600082613e0e57613e0e613dd0565b500490565b6020815281516020820152602082015160408201526000604083015160c06060840152613e4360e0840182613c76565b905063ffffffff606085015116608084015273ffffffffffffffffffffffffffffffffffffffff60808501511660a084015260a08401517fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe08483030160c0850152611d388282613cb1565b600082613ebd57613ebd613dd0565b500690565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052602160045260246000fd5b8281526040602082015260006128386040830184613355565b60008251613f1c818460208701613329565b9190910192915050565b600060208284031215613f3857600080fd5b81517fffffffff000000000000000000000000000000000000000000000000000000008116811461267357600080fdfea264697066735822122008611c782993f84999c5bbae3514787870b91cb520248d3fb3854db39d729ca064736f6c634300080b0033", + "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 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." + }, + "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 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 + }, + "storageLayout": { + "storage": [ + { + "astId": 5884, + "contract": "contracts/Ethereum_SpokePool.sol:Ethereum_SpokePool", + "label": "timerAddress", + "offset": 0, + "slot": "0", + "type": "t_address" + }, + { + "astId": 7114, + "contract": "contracts/Ethereum_SpokePool.sol:Ethereum_SpokePool", + "label": "_notEntered", + "offset": 20, + "slot": "0", + "type": "t_bool" + }, + { + "astId": 8200, + "contract": "contracts/Ethereum_SpokePool.sol:Ethereum_SpokePool", + "label": "crossDomainAdmin", + "offset": 0, + "slot": "1", + "type": "t_address" + }, + { + "astId": 8202, + "contract": "contracts/Ethereum_SpokePool.sol:Ethereum_SpokePool", + "label": "hubPool", + "offset": 0, + "slot": "2", + "type": "t_address" + }, + { + "astId": 8205, + "contract": "contracts/Ethereum_SpokePool.sol:Ethereum_SpokePool", + "label": "weth", + "offset": 0, + "slot": "3", + "type": "t_contract(WETH9)10698" + }, + { + "astId": 8207, + "contract": "contracts/Ethereum_SpokePool.sol:Ethereum_SpokePool", + "label": "deploymentTime", + "offset": 20, + "slot": "3", + "type": "t_uint32" + }, + { + "astId": 8210, + "contract": "contracts/Ethereum_SpokePool.sol:Ethereum_SpokePool", + "label": "depositQuoteTimeBuffer", + "offset": 24, + "slot": "3", + "type": "t_uint32" + }, + { + "astId": 8212, + "contract": "contracts/Ethereum_SpokePool.sol:Ethereum_SpokePool", + "label": "numberOfDeposits", + "offset": 28, + "slot": "3", + "type": "t_uint32" + }, + { + "astId": 8218, + "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": 8231, + "contract": "contracts/Ethereum_SpokePool.sol:Ethereum_SpokePool", + "label": "rootBundles", + "offset": 0, + "slot": "5", + "type": "t_array(t_struct(RootBundle)8227_storage)dyn_storage" + }, + { + "astId": 8235, + "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)8227_storage)dyn_storage": { + "base": "t_struct(RootBundle)8227_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)10698": { + "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)8227_storage": { + "encoding": "inplace", + "label": "struct SpokePool.RootBundle", + "members": [ + { + "astId": 8220, + "contract": "contracts/Ethereum_SpokePool.sol:Ethereum_SpokePool", + "label": "slowRelayRoot", + "offset": 0, + "slot": "0", + "type": "t_bytes32" + }, + { + "astId": 8222, + "contract": "contracts/Ethereum_SpokePool.sol:Ethereum_SpokePool", + "label": "relayerRefundRoot", + "offset": 0, + "slot": "1", + "type": "t_bytes32" + }, + { + "astId": 8226, + "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/goerli/HubPool.json b/deployments/goerli/HubPool.json new file mode 100644 index 000000000..089c473a9 --- /dev/null +++ b/deployments/goerli/HubPool.json @@ -0,0 +1,1373 @@ +{ + "address": "0xe1fC1EB80db9AD0160AEF6998673625bc2a09d14", + "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" + }, + { + "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": [], + "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": [ + { + "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": [], + "name": "paused", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "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": "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": "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" + } + ], + "transactionHash": "0xd9a488b2a9ddfdd87ca9ef38a6dc8515ed141ef2824acf87622dce8501c3b0c1", + "receipt": { + "to": null, + "from": "0x9A8f92a830A5cB89a3816e3D267CB7791c16b04D", + "contractAddress": "0xe1fC1EB80db9AD0160AEF6998673625bc2a09d14", + "transactionIndex": 13, + "gasUsed": "4686689", + "logsBloom": "0x00400000000000000000000000000000000000000000000000800000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001000000000000000000000000000000000000020000000000000000000800000000000000000000000000040000400000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000800000000000000800000000000000000000000000000020000001000000000000004000000000000000000000000000000000000000000000", + "blockHash": "0x08abbc809c224b0b98e79528bc2cc83a08a20c26735d790464ff31689acb6e89", + "transactionHash": "0xd9a488b2a9ddfdd87ca9ef38a6dc8515ed141ef2824acf87622dce8501c3b0c1", + "logs": [ + { + "transactionIndex": 13, + "blockNumber": 6545728, + "transactionHash": "0xd9a488b2a9ddfdd87ca9ef38a6dc8515ed141ef2824acf87622dce8501c3b0c1", + "address": "0xe1fC1EB80db9AD0160AEF6998673625bc2a09d14", + "topics": [ + "0x8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0", + "0x0000000000000000000000000000000000000000000000000000000000000000", + "0x0000000000000000000000009a8f92a830a5cb89a3816e3d267cb7791c16b04d" + ], + "data": "0x", + "logIndex": 61, + "blockHash": "0x08abbc809c224b0b98e79528bc2cc83a08a20c26735d790464ff31689acb6e89" + } + ], + "blockNumber": 6545728, + "cumulativeGasUsed": "9801734", + "status": 1, + "byzantium": true + }, + "args": [ + "0x56f2c8353049270d3553773E680B0d6c632544b6", + "0xDC6b80D38004F495861E081e249213836a2F3217", + "0x60D4dB9b534EF9260a88b0BED6c486fe13E604Fc", + "0x0000000000000000000000000000000000000000" + ], + "numDeployments": 1, + "solcInputHash": "a279276f4631f65ac9d6cbb82cf77d0b", + "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\":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\"},{\"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\":[],\"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\":[{\"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\":[],\"name\":\"paused\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"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\":\"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\":\"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.\"}},\"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[],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.\"}},\"setPaused(bool)\":{\"params\":{\"pause\":\"true if the call is meant to pause the system, false if the call is meant to unpause it.\"}},\"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.\"},\"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[],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.\"},\"setPaused(bool)\":{\"notice\":\"Pauses the bundle proposal and execution process. This is intended to be used during upgrades or when something goes awry.\"},\"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\":\"0xbdbff748fc9c67d532490ac4a87ec0231e382a196c51702c5658d0f9a3efb896\",\"license\":\"GPL-3.0-only\",\"urls\":[\"bzz-raw://8ab6155485fd10ce09b3b30ec31c0f98e3ebf75cd90fa0f50483e20f7769247e\",\"dweb:/ipfs/QmfZ2NNN9HzcQAaRh3Cnd1Bd7FDRpho45YSknSzDryMibP\"]},\"contracts/HubPoolInterface.sol\":{\"keccak256\":\"0x55308c0cc6f1bd7fc05c9fe23e7333e67d2405f01d27467e9dc34a1892e0c5e4\",\"license\":\"GPL-3.0-only\",\"urls\":[\"bzz-raw://c4e134cbbecade7789d17e83b67f3e53e6d7e72945699ef3c70553768055dc21\",\"dweb:/ipfs/QmQYLiyyF5w2fmTLDYtQ4e3CbrstDpwGvBqaAY8rxV7j4A\"]},\"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\":\"0xf5fb5cf93d68052bc380b78b84cfe8e0eb11cb47dc362dd8eb2b029839bd4522\",\"license\":\"GPL-3.0-only\",\"urls\":[\"bzz-raw://aec2c126dfce2d2293c4f65d4a202be0ae3af5e08db7c081229357b594a0a4c5\",\"dweb:/ipfs/QmYihczST3VxfkYeYh8Pmeh58CNq9STTzJtRks1hkjrC6v\"]},\"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": "0x60806040527f49535f4143524f53535f56325f42554e444c455f56414c494400000000000000600e5565015d3ef79800600f556015805463ffffffff1916611c201790553480156200005057600080fd5b50604051620051e8380380620051e8833981016040819052620000739162000166565b600080546001600160a81b0319166001600160a01b03831617600160a01b179055620000a6620000a03390565b620000fb565b50600c80546001600160a01b03199081166001600160a01b0395861617909155600d8054821693851693909317909255600b8054831691841691909117905560015460118054919093169116179055620001ce565b600180546001600160a01b038381166001600160a01b0319831681179093556040519116919082907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e090600090a35050565b6001600160a01b03811681146200016357600080fd5b50565b600080600080608085870312156200017d57600080fd5b84516200018a816200014d565b60208601519094506200019d816200014d565b6040860151909350620001b0816200014d565b6060860151909250620001c3816200014d565b939692955090935050565b61500a80620001de6000396000f3fe60806040526004361061027f5760003560e01c8063625997c01161014f578063ac9650d8116100c1578063dd70e5e81161007a578063dd70e5e81461080e578063e0f339e31461082e578063e40064d71461084e578063e460e35c1461087b578063f0056a7d1461089b578063f2fde38b146109405761028e565b8063ac9650d81461074e578063ad68eda51461076e578063b60c2d7d1461078e578063b9a3c84c146107ae578063c28f4392146107ce578063cd949995146107ee5761028e565b80637998a1c4116101135780637998a1c4146106a457806380f323a7146106ba5780638bda0c00146106d05780638da5cb5b146106f0578063a16fd6e91461070e578063a58411941461072e5761028e565b8063625997c01461062857806369b625021461028c5780636ad0690a1461063d578063715018a61461066f57806376ec08dd146106845761028e565b806322395aaa116101f357806338b9e2ce116101ac57806338b9e2ce146105045780633fc8cef3146105245780634144fd61146105445780634f7473ff146105d557806356688700146105eb5780635c975abb146105fe5761028e565b806322395aaa1461045a57806322f8e5661461046f578063240f475f1461048f57806329cb924d146104af5780632d0f6f84146104c457806333dc09ca146104e45761028e565b80630c501af9116102455780630c501af91461038c5780630ee28a88146103ac57806311cfc159146103cc57806316c38b3c146103e25780631b107ee0146104025780631c39c38d146104225761028e565b8062660b5314610296578062c99206146102b6578063084d0513146102d657806309474ae2146103095780630a2dc9ec1461036a5761028e565b3661028e5761028c610960565b005b61028c610960565b3480156102a257600080fd5b5061028c6102b1366004614159565b6109de565b3480156102c257600080fd5b5061028c6102d1366004614185565b610abc565b3480156102e257600080fd5b506102f66102f1366004614159565b610c9f565b6040519081526020015b60405180910390f35b34801561031557600080fd5b5061034a610324366004614185565b600a60205260009081526040902080546001909101546001600160a01b03918216911682565b604080516001600160a01b03938416815292909116602083015201610300565b34801561037657600080fd5b5061037f610ccb565b60405161030091906141f6565b34801561039857600080fd5b5061028c6103a7366004614209565b610e9a565b3480156103b857600080fd5b5061028c6103c7366004614234565b610f2c565b3480156103d857600080fd5b506102f6600f5481565b3480156103ee57600080fd5b5061028c6103fd366004614276565b6110ee565b34801561040e57600080fd5b5061028c61041d366004614293565b61116a565b34801561042e57600080fd5b50600054610442906001600160a01b031681565b6040516001600160a01b039091168152602001610300565b34801561046657600080fd5b5061028c6112cb565b34801561047b57600080fd5b5061028c61048a366004614185565b611680565b34801561049b57600080fd5b50601154610442906001600160a01b031681565b3480156104bb57600080fd5b506102f66116db565b3480156104d057600080fd5b5061028c6104df366004614209565b611767565b3480156104f057600080fd5b5061028c6104ff366004614159565b611806565b34801561051057600080fd5b5061028c61051f366004614463565b611a17565b34801561053057600080fd5b50600b54610442906001600160a01b031681565b34801561055057600080fd5b5060025460035460045460055460065461058e94939291906001600160a01b03811690600160a01b810460ff1690600160a81b900463ffffffff1687565b6040805197885260208801969096529486019390935260608501919091526001600160a01b0316608084015260ff1660a083015263ffffffff1660c082015260e001610300565b3480156105e157600080fd5b506102f660125481565b61028c6105f9366004614159565b611d4b565b34801561060a57600080fd5b506007546106189060ff1681565b6040519015158152602001610300565b34801561063457600080fd5b5061028c611fdc565b34801561064957600080fd5b5060155461065a9063ffffffff1681565b60405163ffffffff9091168152602001610300565b34801561067b57600080fd5b5061028c6120c0565b34801561069057600080fd5b50600c54610442906001600160a01b031681565b3480156106b057600080fd5b506102f6600e5481565b3480156106c657600080fd5b506102f660145481565b3480156106dc57600080fd5b5061028c6106eb36600461457b565b6120f4565b3480156106fc57600080fd5b506001546001600160a01b0316610442565b34801561071a57600080fd5b506102f6610729366004614209565b6122be565b34801561073a57600080fd5b5061028c610749366004614209565b6122ea565b61076161075c3660046145e2565b61230b565b6040516103009190614656565b34801561077a57600080fd5b506104426107893660046146b8565b6124b0565b34801561079a57600080fd5b5061028c6107a9366004614209565b6124e5565b3480156107ba57600080fd5b50600d54610442906001600160a01b031681565b3480156107da57600080fd5b50601354610442906001600160a01b031681565b3480156107fa57600080fd5b5061028c6108093660046146f0565b6126a5565b34801561081a57600080fd5b5061028c61082936600461473d565b612763565b34801561083a57600080fd5b506102f6610849366004614209565b6127af565b34801561085a57600080fd5b506102f6610869366004614209565b60106020526000908152604090205481565b34801561088757600080fd5b5061028c6108963660046147c1565b6127ca565b3480156108a757600080fd5b506108fe6108b6366004614209565b60096020526000908152604090208054600182015460028301546003909301546001600160a01b03831693600160a01b840460ff1693600160a81b900463ffffffff16929186565b604080516001600160a01b039097168752941515602087015263ffffffff909316938501939093526060840152608083019190915260a082015260c001610300565b34801561094c57600080fd5b5061028c61095b366004614209565b612890565b600054600160a01b900460ff16156109dc57600b60009054906101000a90046001600160a01b03166001600160a01b031663d0e30db0346040518263ffffffff1660e01b81526004016000604051808303818588803b1580156109c257600080fd5b505af11580156109d6573d6000803e3d6000fd5b50505050505b565b6001546001600160a01b03163314610a115760405162461bcd60e51b8152600401610a08906147f8565b60405180910390fd5b670de0b6b3a7640000811115610a695760405162461bcd60e51b815260206004820152601960248201527f4261642070726f746f636f6c46656543617074757265506374000000000000006044820152606401610a08565b601180546001600160a01b0319166001600160a01b03841690811790915560128290556040518291907fc1993b89fd79a19ece7beb067ddc8534ca26d29c0ff94ea2f53b4a508d1eedc990600090a35050565b6001546001600160a01b03163314610ae65760405162461bcd60e51b8152600401610a08906147f8565b600654600160a01b900460ff1615610b105760405162461bcd60e51b8152600401610a089061482d565b610b18612928565b610b20612981565b600d546040516302abf57960e61b8152721259195b9d1a599a595c95da1a5d195b1a5cdd606a1b60048201526000916001600160a01b03169063aafd5e4090602401602060405180830381865afa158015610b7f573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610ba39190614864565b6040516390978d1b60e01b8152600481018490529091506001600160a01b038216906390978d1b90602401602060405180830381865afa158015610beb573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610c0f9190614881565b610c5b5760405162461bcd60e51b815260206004820152601860248201527f4964656e746966696572206e6f7420737570706f7274656400000000000000006044820152606401610a08565b600e8290556040518281527ff45367c278fcceff23d601ce4bdd191e5bd61687ff9f29dc7276a08fe54c0c5d9060200160405180910390a150610c9c612990565b50565b6000610ca9612928565b610cb1612981565b610cbb83836129a5565b9050610cc5612990565b92915050565b6040805160208082018352600082528251808401909352601a83527f7265717565737445787069726174696f6e54696d657374616d7000000000000090830152600654606092610d289291600160a81b900463ffffffff16612a9a565b60408051808201909152601f81527f756e636c61696d6564506f6f6c526562616c616e63654c656166436f756e74006020820152600654919250610d7891839190600160a01b900460ff16612a9a565b9050610db381604051806040016040528060118152602001701c1bdbdb149958985b185b98d9549bdbdd607a1b815250600260000154612ae0565b9050610dee81604051806040016040528060118152602001701c995b185e595c9499599d5b99149bdbdd607a1b815250600260010154612ae0565b9050610e24816040518060400160405280600d81526020016c1cdb1bddd4995b185e549bdbdd609a1b8152506002800154612ae0565b9050610e5b816040518060400160405280600d81526020016c0636c61696d65644269744d617609c1b815250600260030154612a9a565b604080518082019091526008815267383937b837b9b2b960c11b6020820152600654919250610e95918391906001600160a01b0316612afb565b905090565b6001546001600160a01b03163314610ec45760405162461bcd60e51b8152600401610a08906147f8565b6001600160a01b03818116600081815260096020908152604091829020805460ff60a01b1981169091558251938452909316928201929092527fac111b3b527b307393c94d98f26140effb71411054466818be97912d2d65f77691015b60405180910390a150565b610f34612928565b610f3c612981565b600b546001600160a01b0384811691161480610f56575080155b610f925760405162461bcd60e51b815260206004820152600d60248201526c086c2dce840e6cadcc840cae8d609b1b6044820152606401610a08565b6000670de0b6b3a7640000610fa685612b16565b610fb090856148b4565b610fba91906148e9565b6001600160a01b038581166000908152600960205260409081902054905163079cc67960e41b81523360048201526024810187905292935016906379cc6790906044016020604051808303816000875af115801561101c573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906110409190614881565b506001600160a01b0384166000908152600960205260408120600201805483929061106c9084906148fd565b90915550508115611086576110813382612c0e565b61109a565b61109a6001600160a01b0385163383612cc9565b604080518281526020810185905233916001600160a01b038716917fcda1185f28599e6bd14ab8a68b3c30a11e1dce4256b5e67e94dd3fd846a6c589910160405180910390a3506110e9612990565b505050565b6001546001600160a01b031633146111185760405162461bcd60e51b8152600401610a08906147f8565b611120612928565b611128612981565b6007805460ff19168215159081179091556040517f0e2fb031ee032dc02d8011dc50b816eb450cf856abd8261680dac74f72165bd290600090a2610c9c612990565b6001546001600160a01b031633146111945760405162461bcd60e51b8152600401610a08906147f8565b61119c612928565b6111a4612981565b80156111f15781600860006111ba888789612d2c565b815260200190815260200160002060006101000a8154816001600160a01b0302191690836001600160a01b0316021790555061121f565b60086000611200878688612d2c565b8152602081019190915260400160002080546001600160a01b03191690555b6040516001600160a01b038416602482015260448101859052811515606482015261127890869060840160408051601f198184030181529190526020810180516001600160e01b031663272751c760e01b179052612d6c565b604080516001600160a01b0384811682528315156020830152851691869188917f6b6ad6b78778f6301df516688e316a2d4183a1ea99adae498c8e119debe9b146910160405180910390a46109d6612990565b6112d3612928565b6112db612981565b60006112e56116db565b60065490915063ffffffff600160a81b9091048116908216111561134b5760405162461bcd60e51b815260206004820152601760248201527f5265717565737420706173736564206c6976656e6573730000000000000000006044820152606401610a08565b6000611355610ccb565b90506000611361612ed7565b905060145481111561137e5761137682612fbf565b505050611659565b60006113886130a5565b6014546013549192506113a6916001600160a01b031690839061312b565b806001600160a01b031663af355d1e600e548686601360009054906101000a90046001600160a01b03166000886014546113e091906148fd565b6015546006546040516001600160e01b031960e08b901b1681526114279897969594939263ffffffff16916001600160a01b031690670de0b6b3a764000090600401614914565b6020604051808303816000875af1925050508015611462575060408051601f3d908101601f1916820190925261145f9181019061497f565b60015b6114785761146f83612fbf565b50505050611659565b601354611490906001600160a01b03168360006131e3565b5060408051610160810182526006546001600160a01b0390811682526000602083018190526013549091169282019290925260608101829052670de0b6b3a7640000608082015260a0810182905260155460c08201906114f69063ffffffff1688614998565b63ffffffff168152602001600081526020018481526020018460145461151c91906148fd565b815260155463ffffffff908116602090920191909152601454601354929350611553926001600160a01b031691339130916132f816565b601454601354611570916001600160a01b0390911690849061312b565b600e5460405163139c641960e31b81526001600160a01b03841691639ce320c8916115a89190899089908790339030906004016149c0565b6020604051808303816000875af11580156115c7573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906115eb919061497f565b50336001600160a01b03167f4c789f44a7398cb63bf580e03ad5a7ec8228ea4935d3c1a1135eb449f0bb301b8686604051611627929190614abf565b60405180910390a2505060006002819055600381905560048190556005555050600680546001600160c81b0319169055505b6116786116646130a5565b6013546001600160a01b03169060006131e3565b6109dc612990565b6000546001600160a01b031661169557600080fd5b60005460405163117c72b360e11b8152600481018390526001600160a01b03909116906322f8e56690602401600060405180830381600087803b1580156109c257600080fd5b600080546001600160a01b0316156117625760008054906101000a90046001600160a01b03166001600160a01b03166329cb924d6040518163ffffffff1660e01b8152600401602060405180830381865afa15801561173e573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610e95919061497f565b504290565b61176f612928565b611777612981565b6011546001600160a01b038281166000818152601060205260409020546117a393919290911690612cc9565b6001600160a01b0381166000818152601060205260408082205490519092917f74740239d7d696c84422b720e125e1f47c4138c66d1f4d2a48e99f4197cdb79c91a36001600160a01b038116600090815260106020526040812055610c9c612990565b6001546001600160a01b031633146118305760405162461bcd60e51b8152600401610a08906147f8565b600654600160a01b900460ff161561185a5760405162461bcd60e51b8152600401610a089061482d565b611862612928565b61186a612981565b600d546040516302abf57960e61b81527210dbdb1b185d195c985b15da1a5d195b1a5cdd606a1b60048201526000916001600160a01b03169063aafd5e4090602401602060405180830381865afa1580156118c9573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906118ed9190614864565b604051631d1d5b3960e11b81526001600160a01b03858116600483015291925090821690633a3ab67290602401602060405180830381865afa158015611937573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061195b9190614881565b61199a5760405162461bcd60e51b815260206004820152601060248201526f139bdd081bdb881dda1a5d195b1a5cdd60821b6044820152606401610a08565b601380546001600160a01b0319166001600160a01b0385161790556119bd612ed7565b6119c79083614ade565b60148190556040519081526001600160a01b038416907fbfa9a96010167e98ce8c004f718932cbbfd33a58d681c752e693be7d457a1b3b9060200160405180910390a250611a13612990565b5050565b611a1f612928565b611a27612981565b60075460ff1615611a7a5760405162461bcd60e51b815260206004820181905260248201527f50726f706f73616c2070726f6365737320686173206265656e207061757365646044820152606401610a08565b600654600160a81b900463ffffffff16611a926116db565b11611ad55760405162461bcd60e51b81526020600482015260136024820152724e6f7420706173736564206c6976656e65737360681b6044820152606401610a08565b6005546080830151600160ff9091161b9081161415611b285760405162461bcd60e51b815260206004820152600f60248201526e105b1c9958591e4818db185a5b5959608a1b6044820152606401610a08565b600254611b36908383613330565b611b6e5760405162461bcd60e51b81526020600482015260096024820152682130b210283937b7b360b91b6044820152606401610a08565b81516000908152600a60205260409020546001600160a01b0316611bcb5760405162461bcd60e51b815260206004820152601460248201527327379030b230b83a32b9103337b91031b430b4b760611b6044820152606401610a08565b81516000908152600a60205260409020600101546001600160a01b031680611c355760405162461bcd60e51b815260206004820152601860248201527f556e696e697469616c697a65642073706f6b6520706f6f6c00000000000000006044820152606401610a08565b611c4b600260030154846080015160ff1661336b565b60055560068054600160a01b900460ff16906014611c6883614af6565b91906101000a81548160ff021916908360ff16021790555050611c9e8184600001518560a00151866040015187602001516133ce565b611cac8184600001516136aa565b600654600160a01b900460ff16611cde57600654601454601354611cde926001600160a01b0391821692911690612cc9565b336001600160a01b03168360000151846080015160ff167f269bcb1817facd431d586b474ce46fe1ca2921cd1a19314c01a606804ea8b9458660a00151876020015188604001518960600151604051611d3a9493929190614b87565b60405180910390a450611a13612990565b611d53612928565b611d5b612981565b6001600160a01b038216600090815260096020526040902054600160a01b900460ff16611dbe5760405162461bcd60e51b8152602060048201526011602482015270151bdad95b881b9bdd08195b98589b1959607a1b6044820152606401610a08565b600b546001600160a01b038381169116148015611dda57508034145b80611de3575034155b611e1f5760405162461bcd60e51b815260206004820152600d60248201526c426164206d73672e76616c756560981b6044820152606401610a08565b6000611e2a83612b16565b611e3c83670de0b6b3a76400006148b4565b611e4691906148e9565b6001600160a01b03848116600090815260096020526040908190205490516340c10f1960e01b81523360048201526024810184905292935016906340c10f19906044016020604051808303816000875af1158015611ea8573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611ecc9190614881565b506001600160a01b03831660009081526009602052604081206002018054849290611ef8908490614ade565b9091555050600b546001600160a01b038481169116148015611f1a5750600034115b15611f7857826001600160a01b031663d0e30db0346040518263ffffffff1660e01b81526004016000604051808303818588803b158015611f5a57600080fd5b505af1158015611f6e573d6000803e3d6000fd5b5050505050611f8d565b611f8d6001600160a01b0384163330856132f8565b604080518381526020810183905233916001600160a01b038616917f3c69701a61c79a92ef9692903aaa0068bce8771361ecb09547391e4fb4df8537910160405180910390a350611a13612990565b6001546001600160a01b031633146120065760405162461bcd60e51b8152600401610a08906147f8565b61200e612928565b612016612981565b600654600160a01b900460ff161561204957600654601454601354612049926001600160a01b0391821692911690612cc9565b6006546003546002546004546040519081526001600160a01b03909316927f993cba33f9b140c9ce20ba10d7eda92128d5beb6df856f064916108a11647a739060200160405180910390a46000600281905560038190556004819055600555600680546001600160c81b03191690556109dc612990565b6001546001600160a01b031633146120ea5760405162461bcd60e51b8152600401610a08906147f8565b6109dc60006137b3565b6120fc612928565b612104612981565b600654600160a01b900460ff161561212e5760405162461bcd60e51b8152600401610a089061482d565b60075460ff16156121815760405162461bcd60e51b815260206004820181905260248201527f50726f706f73616c2070726f6365737320686173206265656e207061757365646044820152606401610a08565b60008460ff16116121d45760405162461bcd60e51b815260206004820181905260248201527f42756e646c65206d7573742068617665206174206c656173742031206c6561666044820152606401610a08565b60155460009063ffffffff166121e86116db565b6121f29190614998565b60006005556006805460028790556003869055600485905560ff8816600160a01b0263ffffffff808516600160a81b0260ff60a01b19166001600160c81b031990931692909217176001600160a01b0319163390811790925560145460135493945061226c936001600160a01b031692913091906132f816565b336001600160a01b031683857f50e585dd6361c7cb2613ce2334814bb2a789f5a8ad4b161fe0e248043737d1d284898b886040516122ad9493929190614bd4565b60405180910390a4506109d6612990565b60006122c8612928565b6122d0612981565b6122db8260006129a5565b90506122e5612990565b919050565b6122f2612928565b6122fa612981565b61230381613805565b610c9c612990565b6060341561235b5760405162461bcd60e51b815260206004820152601b60248201527f4f6e6c79206d756c746963616c6c207769746820302076616c756500000000006044820152606401610a08565b816001600160401b03811115612373576123736142f2565b6040519080825280602002602001820160405280156123a657816020015b60608152602001906001900390816123915790505b50905060005b828110156124a957600080308686858181106123ca576123ca614c0d565b90506020028101906123dc9190614c23565b6040516123ea929190614c70565b600060405180830381855af49150503d8060008114612425576040519150601f19603f3d011682016040523d82523d6000602084013e61242a565b606091505b5091509150816124765760448151101561244357600080fd5b6004810190508080602001905181019061245d9190614c80565b60405162461bcd60e51b8152600401610a0891906141f6565b8084848151811061248957612489614c0d565b6020026020010181905250505080806124a190614ced565b9150506123ac565b5092915050565b6000600860006124c1868686612d2c565b81526020810191909152604001600020546001600160a01b031690505b9392505050565b6001546001600160a01b0316331461250f5760405162461bcd60e51b8152600401610a08906147f8565b612517612928565b61251f612981565b6001600160a01b03818116600090815260096020526040902054166125de57600c54604051637e178db760e11b81526001600160a01b0383811660048301529091169063fc2f1b6e906024016020604051808303816000875af115801561258a573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906125ae9190614864565b6001600160a01b03828116600090815260096020526040902080546001600160a01b031916929091169190911790555b6001600160a01b0381166000908152600960205260409020805460ff60a01b1916600160a01b17905561260f6116db565b6001600160a01b0380831660009081526009602052604090819020805463ffffffff94909416600160a81b0263ffffffff60a81b198516811790915590517f04e291c80180d65a57b5bf1bed775777ec0d6f283ef34bcf130712714d8bb7f7936126959386938116911617906001600160a01b0392831681529116602082015260400190565b60405180910390a1610c9c612990565b6001546001600160a01b031633146126cf5760405162461bcd60e51b8152600401610a08906147f8565b6102588163ffffffff161161271b5760405162461bcd60e51b8152602060048201526012602482015271131a5d995b995cdcc81d1bdbc81cda1bdc9d60721b6044820152606401610a08565b6015805463ffffffff191663ffffffff83169081179091556040519081527f04dd1d84d387f404568a7954b5e398518bdd716e1a8f4a790be9a1a225ad934790602001610f21565b6001546001600160a01b0316331461278d5760405162461bcd60e51b8152600401610a08906147f8565b612795612928565b61279d612981565b6127a78282612d6c565b611a13612990565b60006127b9612928565b6127c1612981565b6122db82612b16565b6001546001600160a01b031633146127f45760405162461bcd60e51b8152600401610a08906147f8565b6040805180820182526001600160a01b03848116808352848216602080850182815260008a8152600a8352879020955186549086166001600160a01b031991821617875590516001909601805496909516951694909417909255835187815292830152918101919091527f36050d958750e6ac3aa674ac7bbe8d0ae6a2f7d4b808e8c2c42c1f22fc9fc4bb9060600160405180910390a1505050565b6001546001600160a01b031633146128ba5760405162461bcd60e51b8152600401610a08906147f8565b6001600160a01b03811661291f5760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201526564647265737360d01b6064820152608401610a08565b610c9c816137b3565b600054600160a01b900460ff166109dc5760405162461bcd60e51b815260206004820152601f60248201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c006044820152606401610a08565b6000805460ff60a01b19169055565b6000805460ff60a01b1916600160a01b179055565b60006129b083613805565b6001600160a01b038381166000908152600960209081526040808320815160c08101835281549586168152600160a01b860460ff16151593810193909352600160a81b90940463ffffffff16908201526001830154606082018190526002840154608083015260039093015460a0820152918112612a2f576000612a35565b81606001515b90506000612a438286614ade565b90506000828460800151612a579190614ade565b905080612a7257670de0b6b3a7640000945050505050610cc5565b80612a8583670de0b6b3a76400006148b4565b612a8f91906148e9565b979650505050505050565b60606000612aa88585613954565b90508481612ab585613996565b604051602001612ac793929190614d08565b6040516020818303038152906040529150509392505050565b60606000612aee8585613954565b90508481612ab585613abe565b60606000612b098585613954565b90508481612ab585613aff565b6001600160a01b038082166000908152600960209081526040808320805482516318160ddd60e01b8152925194959194869491909216926318160ddd92600480830193928290030181865afa158015612b73573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190612b97919061497f565b905080612baf5750670de0b6b3a76400009392505050565b612bb882613b56565b612bc184613805565b6000826003015483600101548460020154612bdc9190614d4b565b612be69190614d8c565b905081612bfb82670de0b6b3a76400006148b4565b612c0591906148e9565b95945050505050565b6001600160a01b0382163b15612c3557600b54611a13906001600160a01b03168383612cc9565b600b54604051632e1a7d4d60e01b8152600481018390526001600160a01b0390911690632e1a7d4d90602401600060405180830381600087803b158015612c7b57600080fd5b505af1158015612c8f573d6000803e3d6000fd5b50506040516001600160a01b038516925083156108fc02915083906000818181858888f193505050501580156110e9573d6000803e3d6000fd5b6040516001600160a01b0383166024820152604481018290526110e990849063a9059cbb60e01b906064015b60408051601f198184030181529190526020810180516001600160e01b03166001600160e01b031990931692909217909152613bbe565b604080516020808201959095526001600160a01b039390931683820152606080840192909252805180840390920182526080909201909152805191012090565b6000828152600a60205260409020546001600160a01b031680612dd15760405162461bcd60e51b815260206004820152601760248201527f41646170746572206e6f7420696e697469616c697a65640000000000000000006044820152606401610a08565b6000838152600a60205260408082206001015490516001600160a01b0380851692612e03929116908690602401614dcb565b60408051601f198184030181529181526020820180516001600160e01b0316637375c56f60e11b17905251612e389190614def565b600060405180830381855af49150503d8060008114612e73576040519150601f19603f3d011682016040523d82523d6000602084013e612e78565b606091505b5050905080612e995760405162461bcd60e51b8152600401610a0890614e0b565b837f218987b934c2f6bc596136829fbf43a5fef4d6fafce41f3f6254d9a870c2deec84604051612ec991906141f6565b60405180910390a250505050565b600d546040516302abf57960e61b81526453746f726560d81b60048201526000916001600160a01b03169063aafd5e4090602401602060405180830381865afa158015612f28573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190612f4c9190614864565b601354604051635b97aadd60e01b81526001600160a01b039182166004820152911690635b97aadd90602401602060405180830381865afa158015612f95573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190612fb99190614e38565b51919050565b60135460065460145460405163a9059cbb60e01b81526001600160a01b039283166004820152602481019190915291169063a9059cbb906044016020604051808303816000875af1158015613018573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061303c9190614881565b506000600281905560038190556004819055600555600680546001600160c81b0319169055337f1d2f9274429d71a4bfb9fe52ed39d766c4d0f7b072f0989cf7072229fbc6332861308b6116db565b8360405161309a929190614e79565b60405180910390a250565b600d546040516302abf57960e61b815275536b696e6e794f7074696d69737469634f7261636c6560501b60048201526000916001600160a01b03169063aafd5e4090602401602060405180830381865afa158015613107573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610e959190614864565b604051636eb1769f60e11b81523060048201526001600160a01b038381166024830152600091839186169063dd62ed3e90604401602060405180830381865afa15801561317c573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906131a0919061497f565b6131aa9190614ade565b6040516001600160a01b0385166024820152604481018290529091506131dd90859063095ea7b360e01b90606401612cf5565b50505050565b80158061325d5750604051636eb1769f60e11b81523060048201526001600160a01b03838116602483015284169063dd62ed3e90604401602060405180830381865afa158015613237573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061325b919061497f565b155b6132c85760405162461bcd60e51b815260206004820152603660248201527f5361666545524332303a20617070726f76652066726f6d206e6f6e2d7a65726f60448201527520746f206e6f6e2d7a65726f20616c6c6f77616e636560501b6064820152608401610a08565b6040516001600160a01b0383166024820152604481018290526110e990849063095ea7b360e01b90606401612cf5565b6040516001600160a01b03808516602483015283166044820152606481018290526131dd9085906323b872dd60e01b90608401612cf5565b60006133638285856040516020016133489190614e92565b60405160208183030381529060405280519060200120613c90565b949350505050565b600060ff8211156133b45760405162461bcd60e51b8152602060048201526013602482015272496e646578206f7574206f6620626f756e647360681b6044820152606401610a08565b6133c061010083614f1e565b6001901b8317905092915050565b6000848152600a60205260408120546001600160a01b0316905b84518163ffffffff1610156136a1576000858263ffffffff168151811061341157613411614c0d565b6020026020010151905060006008600061342c46858c612d2c565b81526020810191909152604001600020546001600160a01b031690508061348d5760405162461bcd60e51b8152602060048201526015602482015274149bdd5d19481b9bdd081dda1a5d195b1a5cdd1959605a1b6044820152606401610a08565b6000868463ffffffff16815181106134a7576134a7614c0d565b60200260200101511315613663576000846001600160a01b03168383898763ffffffff16815181106134db576134db614c0d565b60209081029190910101516040516001600160a01b03938416602482015291831660448301526064820152908c16608482015260a40160408051601f198184030181529181526020820180516001600160e01b03166314b231d760e21b179052516135469190614def565b600060405180830381855af49150503d8060008114613581576040519150601f19603f3d011682016040523d82523d6000602084013e613586565b606091505b50509050806135a75760405162461bcd60e51b8152600401610a0890614e0b565b868463ffffffff16815181106135bf576135bf614c0d565b602002602001015160096000856001600160a01b03166001600160a01b0316815260200190815260200160002060010160008282546135fe9190614d4b565b92505081905550868463ffffffff168151811061361d5761361d614c0d565b602002602001015160096000856001600160a01b03166001600160a01b03168152602001908152602001600020600201600082825461365c91906148fd565b9091555050505b61368c82868563ffffffff168151811061367f5761367f614c0d565b6020026020010151613ca6565b5050808061369990614f32565b9150506133e8565b50505050505050565b6000818152600a6020526040808220546003546004549251602481019190915260448101929092526001600160a01b031691908290859060640160408051601f198184030181529181526020820180516001600160e01b031663124e93e160e21b1790525161371d929190602401614dcb565b60408051601f198184030181529181526020820180516001600160e01b0316637375c56f60e11b179052516137529190614def565b600060405180830381855af49150503d806000811461378d576040519150601f19603f3d011682016040523d82523d6000602084013e613792565b606091505b50509050806131dd5760405162461bcd60e51b8152600401610a0890614e0b565b600180546001600160a01b038381166001600160a01b0319831681179093556040519116919082907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e090600090a35050565b6040516370a0823160e01b81523060048201526000906001600160a01b038316906370a0823190602401602060405180830381865afa15801561384c573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190613870919061497f565b6013549091506000906001600160a01b03848116911614801561389e5750600654600160a01b900460ff1615155b6138a857816138b5565b6014546138b590836148fd565b6001600160a01b0384166000908152600960205260409020600201549091508111156110e9576001600160a01b03831660009081526009602052604090206002015461390190826148fd565b6001600160a01b0384166000908152600960205260408120600101805490919061392c908490614d8c565b90915550506001600160a01b0383166000908152600960205260409020600201819055505050565b815160609015613985578160405160200161396f9190614f56565b6040516020818303038152906040529050610cc5565b8160405160200161396f9190614f8a565b6060816139ba5750506040805180820190915260018152600360fc1b602082015290565b8160005b81156139e457806139ce81614ced565b91506139dd9050600a836148e9565b91506139be565b6000816001600160401b038111156139fe576139fe6142f2565b6040519080825280601f01601f191660200182016040528015613a28576020820181803683370190505b509050815b8515613ab557613a3e6001826148fd565b90506000613a4d600a886148e9565b613a5890600a6148b4565b613a6290886148fd565b613a6d906030614faf565b905060008160f81b905080848481518110613a8a57613a8a614c0d565b60200101906001600160f81b031916908160001a905350613aac600a896148e9565b97505050613a2d565b50949350505050565b6060613acd608083901c613d79565b613ad683613d79565b6040805160208101939093528201526060015b6040516020818303038152906040529050919050565b6060613b176001600160801b03602084901c16613d79565b613b328360601b6bffffffffffffffffffffffff1916613d79565b604051602001613ae99291909182526001600160c01b031916602082015260280190565b60038101548154600091613b7691600160a81b900463ffffffff16613f12565b905080826003016000828254613b8c91906148fd565b90915550613b9a90506116db565b825463ffffffff91909116600160a81b0263ffffffff60a81b199091161790915550565b6000613c13826040518060400160405280602081526020017f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c6564815250856001600160a01b0316613f679092919063ffffffff16565b8051909150156110e95780806020019051810190613c319190614881565b6110e95760405162461bcd60e51b815260206004820152602a60248201527f5361666545524332303a204552433230206f7065726174696f6e20646964206e6044820152691bdd081cdd58d8d9595960b21b6064820152608401610a08565b600082613c9d8584613f76565b14949350505050565b6000670de0b6b3a764000060125483613cbf91906148b4565b613cc991906148e9565b90506000613cd782846148fd565b90508015613d40576001600160a01b03841660009081526009602052604081206003018054839290613d0a908490614ade565b90915550506001600160a01b03841660009081526009602052604081206001018054839290613d3a908490614d4b565b90915550505b81156131dd576001600160a01b03841660009081526010602052604081208054849290613d6e908490614ade565b909155505050505050565b6000808260001c9050806001600160801b03169050806801000000000000000002811777ffffffffffffffff0000000000000000ffffffffffffffff169050806401000000000281177bffffffff00000000ffffffff00000000ffffffff00000000ffffffff16905080620100000281177dffff0000ffff0000ffff0000ffff0000ffff0000ffff0000ffff0000ffff169050806101000281177eff00ff00ff00ff00ff00ff00ff00ff00ff00ff00ff00ff00ff00ff00ff00ff1690508060100281177f0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f16905060006008827f08080808080808080808080808080808080808080808080808080808080808081681613e9457613e946148d3565b0460047f040404040404040404040404040404040404040404040404040404040404040484160460027f020202020202020202020202020202020202020202020202020202020202020285160417166027029091017f3030303030303030303030303030303030303030303030303030303030303030019392505050565b60008082613f1e6116db565b613f2891906148fd565b90506000670de0b6b3a764000082600f5487613f4491906148b4565b613f4e91906148b4565b613f5891906148e9565b90508481106133635784612c05565b60606133638484600085613fea565b600081815b8451811015613fe2576000858281518110613f9857613f98614c0d565b60200260200101519050808311613fbe5760008381526020829052604090209250613fcf565b600081815260208490526040902092505b5080613fda81614ced565b915050613f7b565b509392505050565b60608247101561404b5760405162461bcd60e51b815260206004820152602660248201527f416464726573733a20696e73756666696369656e742062616c616e636520666f6044820152651c8818d85b1b60d21b6064820152608401610a08565b6001600160a01b0385163b6140a25760405162461bcd60e51b815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e74726163740000006044820152606401610a08565b600080866001600160a01b031685876040516140be9190614def565b60006040518083038185875af1925050503d80600081146140fb576040519150601f19603f3d011682016040523d82523d6000602084013e614100565b606091505b5091509150612a8f8282866060831561411a5750816124de565b82511561412a5782518084602001fd5b8160405162461bcd60e51b8152600401610a0891906141f6565b6001600160a01b0381168114610c9c57600080fd5b6000806040838503121561416c57600080fd5b823561417781614144565b946020939093013593505050565b60006020828403121561419757600080fd5b5035919050565b60005b838110156141b95781810151838201526020016141a1565b838111156131dd5750506000910152565b600081518084526141e281602086016020860161419e565b601f01601f19169290920160200192915050565b6020815260006124de60208301846141ca565b60006020828403121561421b57600080fd5b81356124de81614144565b8015158114610c9c57600080fd5b60008060006060848603121561424957600080fd5b833561425481614144565b925060208401359150604084013561426b81614226565b809150509250925092565b60006020828403121561428857600080fd5b81356124de81614226565b600080600080600060a086880312156142ab57600080fd5b853594506020860135935060408601356142c481614144565b925060608601356142d481614144565b915060808601356142e481614226565b809150509295509295909350565b634e487b7160e01b600052604160045260246000fd5b60405160c081016001600160401b038111828210171561432a5761432a6142f2565b60405290565b604051601f8201601f191681016001600160401b0381118282101715614358576143586142f2565b604052919050565b60006001600160401b03821115614379576143796142f2565b5060051b60200190565b600082601f83011261439457600080fd5b813560206143a96143a483614360565b614330565b82815260059290921b840181019181810190868411156143c857600080fd5b8286015b848110156143e357803583529183019183016143cc565b509695505050505050565b803560ff811681146122e557600080fd5b600082601f83011261441057600080fd5b813560206144206143a483614360565b82815260059290921b8401810191818101908684111561443f57600080fd5b8286015b848110156143e357803561445681614144565b8352918301918301614443565b6000806040838503121561447657600080fd5b82356001600160401b038082111561448d57600080fd5b9084019060c082870312156144a157600080fd5b6144a9614308565b823581526020830135828111156144bf57600080fd5b6144cb88828601614383565b6020830152506040830135828111156144e357600080fd5b6144ef88828601614383565b60408301525060608301358281111561450757600080fd5b61451388828601614383565b606083015250614525608084016143ee565b608082015260a08301358281111561453c57600080fd5b614548888286016143ff565b60a0830152509350602085013591508082111561456457600080fd5b5061457185828601614383565b9150509250929050565b600080600080600060a0868803121561459357600080fd5b85356001600160401b038111156145a957600080fd5b6145b588828901614383565b9550506145c4602087016143ee565b94979496505050506040830135926060810135926080909101359150565b600080602083850312156145f557600080fd5b82356001600160401b038082111561460c57600080fd5b818501915085601f83011261462057600080fd5b81358181111561462f57600080fd5b8660208260051b850101111561464457600080fd5b60209290920196919550909350505050565b6000602080830181845280855180835260408601915060408160051b870101925083870160005b828110156146ab57603f198886030184526146998583516141ca565b9450928501929085019060010161467d565b5092979650505050505050565b6000806000606084860312156146cd57600080fd5b8335925060208401356146df81614144565b929592945050506040919091013590565b60006020828403121561470257600080fd5b813563ffffffff811681146124de57600080fd5b60006001600160401b0382111561472f5761472f6142f2565b50601f01601f191660200190565b6000806040838503121561475057600080fd5b8235915060208301356001600160401b0381111561476d57600080fd5b8301601f8101851361477e57600080fd5b803561478c6143a482614716565b8181528660208385010111156147a157600080fd5b816020840160208301376000602083830101528093505050509250929050565b6000806000606084860312156147d657600080fd5b8335925060208401356147e881614144565b9150604084013561426b81614144565b6020808252818101527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604082015260600190565b6020808252601c908201527f70726f706f73616c2068617320756e636c61696d6564206c6561667300000000604082015260600190565b60006020828403121561487657600080fd5b81516124de81614144565b60006020828403121561489357600080fd5b81516124de81614226565b634e487b7160e01b600052601160045260246000fd5b60008160001904831182151516156148ce576148ce61489e565b500290565b634e487b7160e01b600052601260045260246000fd5b6000826148f8576148f86148d3565b500490565b60008282101561490f5761490f61489e565b500390565b60006101208b835263ffffffff808c16602085015281604085015261493b8285018c6141ca565b6001600160a01b039a8b166060860152608085019990995260a084019790975250509290931660c083015290931660e0840152610100909201919091529392505050565b60006020828403121561499157600080fd5b5051919050565b600063ffffffff8083168185168083038211156149b7576149b761489e565b01949350505050565b600061020088835263ffffffff881660208401528060408401526149e6818401886141ca565b9150506149ff6060830186516001600160a01b03169052565b60208501516001600160a01b03811660808401525060408501516001600160a01b03811660a084015250606085015180151560c084015250608085015160e083015260a0850151610100818185015260c08701519150610120828186015260e0880151925061014083818701528289015161016087015281890151610180870152808901516101a087015250505050614aa46101c08301856001600160a01b03169052565b6001600160a01b0383166101e0830152979650505050505050565b63ffffffff8316815260406020820152600061336360408301846141ca565b60008219821115614af157614af161489e565b500190565b600060ff821680614b0957614b0961489e565b6000190192915050565b600081518084526020808501945080840160005b83811015614b4c5781516001600160a01b031687529582019590820190600101614b27565b509495945050505050565b600081518084526020808501945080840160005b83811015614b4c57815187529582019590820190600101614b6b565b608081526000614b9a6080830187614b13565b8281036020840152614bac8187614b57565b90508281036040840152614bc08186614b57565b90508281036060840152612a8f8185614b57565b63ffffffff8516815260ff84166020820152608060408201526000614bfc6080830185614b57565b905082606083015295945050505050565b634e487b7160e01b600052603260045260246000fd5b6000808335601e19843603018112614c3a57600080fd5b8301803591506001600160401b03821115614c5457600080fd5b602001915036819003821315614c6957600080fd5b9250929050565b8183823760009101908152919050565b600060208284031215614c9257600080fd5b81516001600160401b03811115614ca857600080fd5b8201601f81018413614cb957600080fd5b8051614cc76143a482614716565b818152856020838501011115614cdc57600080fd5b612c0582602083016020860161419e565b6000600019821415614d0157614d0161489e565b5060010190565b60008451614d1a81846020890161419e565b845190830190614d2e81836020890161419e565b8451910190614d4181836020880161419e565b0195945050505050565b600080821280156001600160ff1b0384900385131615614d6d57614d6d61489e565b600160ff1b8390038412811615614d8657614d8661489e565b50500190565b60008083128015600160ff1b850184121615614daa57614daa61489e565b6001600160ff1b0384018313811615614dc557614dc561489e565b50500390565b6001600160a01b0383168152604060208201819052600090613363908301846141ca565b60008251614e0181846020870161419e565b9190910192915050565b60208082526013908201527219195b1959d85d1958d85b1b0819985a5b1959606a1b604082015260600190565b600060208284031215614e4a57600080fd5b604051602081018181106001600160401b0382111715614e6c57614e6c6142f2565b6040529151825250919050565b82815260406020820152600061336360408301846141ca565b60208152815160208201526000602083015160c06040840152614eb860e0840182614b57565b90506040840151601f1980858403016060860152614ed68383614b57565b92506060860151915080858403016080860152614ef38383614b57565b925060ff60808701511660a086015260a08601519150808584030160c086015250612c058282614b13565b600082614f2d57614f2d6148d3565b500690565b600063ffffffff80831681811415614f4c57614f4c61489e565b6001019392505050565b600b60fa1b815260008251614f7281600185016020870161419e565b601d60f91b6001939091019283015250600201919050565b60008251614f9c81846020870161419e565b601d60f91b920191825250600101919050565b600060ff821660ff84168060ff03821115614fcc57614fcc61489e565b01939250505056fea2646970667358221220777769bea87524c859b5b55ca9cd8838f00ef8ae2fc22760bc7afed4f9496abd64736f6c634300080b0033", + "deployedBytecode": "0x60806040526004361061027f5760003560e01c8063625997c01161014f578063ac9650d8116100c1578063dd70e5e81161007a578063dd70e5e81461080e578063e0f339e31461082e578063e40064d71461084e578063e460e35c1461087b578063f0056a7d1461089b578063f2fde38b146109405761028e565b8063ac9650d81461074e578063ad68eda51461076e578063b60c2d7d1461078e578063b9a3c84c146107ae578063c28f4392146107ce578063cd949995146107ee5761028e565b80637998a1c4116101135780637998a1c4146106a457806380f323a7146106ba5780638bda0c00146106d05780638da5cb5b146106f0578063a16fd6e91461070e578063a58411941461072e5761028e565b8063625997c01461062857806369b625021461028c5780636ad0690a1461063d578063715018a61461066f57806376ec08dd146106845761028e565b806322395aaa116101f357806338b9e2ce116101ac57806338b9e2ce146105045780633fc8cef3146105245780634144fd61146105445780634f7473ff146105d557806356688700146105eb5780635c975abb146105fe5761028e565b806322395aaa1461045a57806322f8e5661461046f578063240f475f1461048f57806329cb924d146104af5780632d0f6f84146104c457806333dc09ca146104e45761028e565b80630c501af9116102455780630c501af91461038c5780630ee28a88146103ac57806311cfc159146103cc57806316c38b3c146103e25780631b107ee0146104025780631c39c38d146104225761028e565b8062660b5314610296578062c99206146102b6578063084d0513146102d657806309474ae2146103095780630a2dc9ec1461036a5761028e565b3661028e5761028c610960565b005b61028c610960565b3480156102a257600080fd5b5061028c6102b1366004614159565b6109de565b3480156102c257600080fd5b5061028c6102d1366004614185565b610abc565b3480156102e257600080fd5b506102f66102f1366004614159565b610c9f565b6040519081526020015b60405180910390f35b34801561031557600080fd5b5061034a610324366004614185565b600a60205260009081526040902080546001909101546001600160a01b03918216911682565b604080516001600160a01b03938416815292909116602083015201610300565b34801561037657600080fd5b5061037f610ccb565b60405161030091906141f6565b34801561039857600080fd5b5061028c6103a7366004614209565b610e9a565b3480156103b857600080fd5b5061028c6103c7366004614234565b610f2c565b3480156103d857600080fd5b506102f6600f5481565b3480156103ee57600080fd5b5061028c6103fd366004614276565b6110ee565b34801561040e57600080fd5b5061028c61041d366004614293565b61116a565b34801561042e57600080fd5b50600054610442906001600160a01b031681565b6040516001600160a01b039091168152602001610300565b34801561046657600080fd5b5061028c6112cb565b34801561047b57600080fd5b5061028c61048a366004614185565b611680565b34801561049b57600080fd5b50601154610442906001600160a01b031681565b3480156104bb57600080fd5b506102f66116db565b3480156104d057600080fd5b5061028c6104df366004614209565b611767565b3480156104f057600080fd5b5061028c6104ff366004614159565b611806565b34801561051057600080fd5b5061028c61051f366004614463565b611a17565b34801561053057600080fd5b50600b54610442906001600160a01b031681565b34801561055057600080fd5b5060025460035460045460055460065461058e94939291906001600160a01b03811690600160a01b810460ff1690600160a81b900463ffffffff1687565b6040805197885260208801969096529486019390935260608501919091526001600160a01b0316608084015260ff1660a083015263ffffffff1660c082015260e001610300565b3480156105e157600080fd5b506102f660125481565b61028c6105f9366004614159565b611d4b565b34801561060a57600080fd5b506007546106189060ff1681565b6040519015158152602001610300565b34801561063457600080fd5b5061028c611fdc565b34801561064957600080fd5b5060155461065a9063ffffffff1681565b60405163ffffffff9091168152602001610300565b34801561067b57600080fd5b5061028c6120c0565b34801561069057600080fd5b50600c54610442906001600160a01b031681565b3480156106b057600080fd5b506102f6600e5481565b3480156106c657600080fd5b506102f660145481565b3480156106dc57600080fd5b5061028c6106eb36600461457b565b6120f4565b3480156106fc57600080fd5b506001546001600160a01b0316610442565b34801561071a57600080fd5b506102f6610729366004614209565b6122be565b34801561073a57600080fd5b5061028c610749366004614209565b6122ea565b61076161075c3660046145e2565b61230b565b6040516103009190614656565b34801561077a57600080fd5b506104426107893660046146b8565b6124b0565b34801561079a57600080fd5b5061028c6107a9366004614209565b6124e5565b3480156107ba57600080fd5b50600d54610442906001600160a01b031681565b3480156107da57600080fd5b50601354610442906001600160a01b031681565b3480156107fa57600080fd5b5061028c6108093660046146f0565b6126a5565b34801561081a57600080fd5b5061028c61082936600461473d565b612763565b34801561083a57600080fd5b506102f6610849366004614209565b6127af565b34801561085a57600080fd5b506102f6610869366004614209565b60106020526000908152604090205481565b34801561088757600080fd5b5061028c6108963660046147c1565b6127ca565b3480156108a757600080fd5b506108fe6108b6366004614209565b60096020526000908152604090208054600182015460028301546003909301546001600160a01b03831693600160a01b840460ff1693600160a81b900463ffffffff16929186565b604080516001600160a01b039097168752941515602087015263ffffffff909316938501939093526060840152608083019190915260a082015260c001610300565b34801561094c57600080fd5b5061028c61095b366004614209565b612890565b600054600160a01b900460ff16156109dc57600b60009054906101000a90046001600160a01b03166001600160a01b031663d0e30db0346040518263ffffffff1660e01b81526004016000604051808303818588803b1580156109c257600080fd5b505af11580156109d6573d6000803e3d6000fd5b50505050505b565b6001546001600160a01b03163314610a115760405162461bcd60e51b8152600401610a08906147f8565b60405180910390fd5b670de0b6b3a7640000811115610a695760405162461bcd60e51b815260206004820152601960248201527f4261642070726f746f636f6c46656543617074757265506374000000000000006044820152606401610a08565b601180546001600160a01b0319166001600160a01b03841690811790915560128290556040518291907fc1993b89fd79a19ece7beb067ddc8534ca26d29c0ff94ea2f53b4a508d1eedc990600090a35050565b6001546001600160a01b03163314610ae65760405162461bcd60e51b8152600401610a08906147f8565b600654600160a01b900460ff1615610b105760405162461bcd60e51b8152600401610a089061482d565b610b18612928565b610b20612981565b600d546040516302abf57960e61b8152721259195b9d1a599a595c95da1a5d195b1a5cdd606a1b60048201526000916001600160a01b03169063aafd5e4090602401602060405180830381865afa158015610b7f573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610ba39190614864565b6040516390978d1b60e01b8152600481018490529091506001600160a01b038216906390978d1b90602401602060405180830381865afa158015610beb573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610c0f9190614881565b610c5b5760405162461bcd60e51b815260206004820152601860248201527f4964656e746966696572206e6f7420737570706f7274656400000000000000006044820152606401610a08565b600e8290556040518281527ff45367c278fcceff23d601ce4bdd191e5bd61687ff9f29dc7276a08fe54c0c5d9060200160405180910390a150610c9c612990565b50565b6000610ca9612928565b610cb1612981565b610cbb83836129a5565b9050610cc5612990565b92915050565b6040805160208082018352600082528251808401909352601a83527f7265717565737445787069726174696f6e54696d657374616d7000000000000090830152600654606092610d289291600160a81b900463ffffffff16612a9a565b60408051808201909152601f81527f756e636c61696d6564506f6f6c526562616c616e63654c656166436f756e74006020820152600654919250610d7891839190600160a01b900460ff16612a9a565b9050610db381604051806040016040528060118152602001701c1bdbdb149958985b185b98d9549bdbdd607a1b815250600260000154612ae0565b9050610dee81604051806040016040528060118152602001701c995b185e595c9499599d5b99149bdbdd607a1b815250600260010154612ae0565b9050610e24816040518060400160405280600d81526020016c1cdb1bddd4995b185e549bdbdd609a1b8152506002800154612ae0565b9050610e5b816040518060400160405280600d81526020016c0636c61696d65644269744d617609c1b815250600260030154612a9a565b604080518082019091526008815267383937b837b9b2b960c11b6020820152600654919250610e95918391906001600160a01b0316612afb565b905090565b6001546001600160a01b03163314610ec45760405162461bcd60e51b8152600401610a08906147f8565b6001600160a01b03818116600081815260096020908152604091829020805460ff60a01b1981169091558251938452909316928201929092527fac111b3b527b307393c94d98f26140effb71411054466818be97912d2d65f77691015b60405180910390a150565b610f34612928565b610f3c612981565b600b546001600160a01b0384811691161480610f56575080155b610f925760405162461bcd60e51b815260206004820152600d60248201526c086c2dce840e6cadcc840cae8d609b1b6044820152606401610a08565b6000670de0b6b3a7640000610fa685612b16565b610fb090856148b4565b610fba91906148e9565b6001600160a01b038581166000908152600960205260409081902054905163079cc67960e41b81523360048201526024810187905292935016906379cc6790906044016020604051808303816000875af115801561101c573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906110409190614881565b506001600160a01b0384166000908152600960205260408120600201805483929061106c9084906148fd565b90915550508115611086576110813382612c0e565b61109a565b61109a6001600160a01b0385163383612cc9565b604080518281526020810185905233916001600160a01b038716917fcda1185f28599e6bd14ab8a68b3c30a11e1dce4256b5e67e94dd3fd846a6c589910160405180910390a3506110e9612990565b505050565b6001546001600160a01b031633146111185760405162461bcd60e51b8152600401610a08906147f8565b611120612928565b611128612981565b6007805460ff19168215159081179091556040517f0e2fb031ee032dc02d8011dc50b816eb450cf856abd8261680dac74f72165bd290600090a2610c9c612990565b6001546001600160a01b031633146111945760405162461bcd60e51b8152600401610a08906147f8565b61119c612928565b6111a4612981565b80156111f15781600860006111ba888789612d2c565b815260200190815260200160002060006101000a8154816001600160a01b0302191690836001600160a01b0316021790555061121f565b60086000611200878688612d2c565b8152602081019190915260400160002080546001600160a01b03191690555b6040516001600160a01b038416602482015260448101859052811515606482015261127890869060840160408051601f198184030181529190526020810180516001600160e01b031663272751c760e01b179052612d6c565b604080516001600160a01b0384811682528315156020830152851691869188917f6b6ad6b78778f6301df516688e316a2d4183a1ea99adae498c8e119debe9b146910160405180910390a46109d6612990565b6112d3612928565b6112db612981565b60006112e56116db565b60065490915063ffffffff600160a81b9091048116908216111561134b5760405162461bcd60e51b815260206004820152601760248201527f5265717565737420706173736564206c6976656e6573730000000000000000006044820152606401610a08565b6000611355610ccb565b90506000611361612ed7565b905060145481111561137e5761137682612fbf565b505050611659565b60006113886130a5565b6014546013549192506113a6916001600160a01b031690839061312b565b806001600160a01b031663af355d1e600e548686601360009054906101000a90046001600160a01b03166000886014546113e091906148fd565b6015546006546040516001600160e01b031960e08b901b1681526114279897969594939263ffffffff16916001600160a01b031690670de0b6b3a764000090600401614914565b6020604051808303816000875af1925050508015611462575060408051601f3d908101601f1916820190925261145f9181019061497f565b60015b6114785761146f83612fbf565b50505050611659565b601354611490906001600160a01b03168360006131e3565b5060408051610160810182526006546001600160a01b0390811682526000602083018190526013549091169282019290925260608101829052670de0b6b3a7640000608082015260a0810182905260155460c08201906114f69063ffffffff1688614998565b63ffffffff168152602001600081526020018481526020018460145461151c91906148fd565b815260155463ffffffff908116602090920191909152601454601354929350611553926001600160a01b031691339130916132f816565b601454601354611570916001600160a01b0390911690849061312b565b600e5460405163139c641960e31b81526001600160a01b03841691639ce320c8916115a89190899089908790339030906004016149c0565b6020604051808303816000875af11580156115c7573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906115eb919061497f565b50336001600160a01b03167f4c789f44a7398cb63bf580e03ad5a7ec8228ea4935d3c1a1135eb449f0bb301b8686604051611627929190614abf565b60405180910390a2505060006002819055600381905560048190556005555050600680546001600160c81b0319169055505b6116786116646130a5565b6013546001600160a01b03169060006131e3565b6109dc612990565b6000546001600160a01b031661169557600080fd5b60005460405163117c72b360e11b8152600481018390526001600160a01b03909116906322f8e56690602401600060405180830381600087803b1580156109c257600080fd5b600080546001600160a01b0316156117625760008054906101000a90046001600160a01b03166001600160a01b03166329cb924d6040518163ffffffff1660e01b8152600401602060405180830381865afa15801561173e573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610e95919061497f565b504290565b61176f612928565b611777612981565b6011546001600160a01b038281166000818152601060205260409020546117a393919290911690612cc9565b6001600160a01b0381166000818152601060205260408082205490519092917f74740239d7d696c84422b720e125e1f47c4138c66d1f4d2a48e99f4197cdb79c91a36001600160a01b038116600090815260106020526040812055610c9c612990565b6001546001600160a01b031633146118305760405162461bcd60e51b8152600401610a08906147f8565b600654600160a01b900460ff161561185a5760405162461bcd60e51b8152600401610a089061482d565b611862612928565b61186a612981565b600d546040516302abf57960e61b81527210dbdb1b185d195c985b15da1a5d195b1a5cdd606a1b60048201526000916001600160a01b03169063aafd5e4090602401602060405180830381865afa1580156118c9573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906118ed9190614864565b604051631d1d5b3960e11b81526001600160a01b03858116600483015291925090821690633a3ab67290602401602060405180830381865afa158015611937573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061195b9190614881565b61199a5760405162461bcd60e51b815260206004820152601060248201526f139bdd081bdb881dda1a5d195b1a5cdd60821b6044820152606401610a08565b601380546001600160a01b0319166001600160a01b0385161790556119bd612ed7565b6119c79083614ade565b60148190556040519081526001600160a01b038416907fbfa9a96010167e98ce8c004f718932cbbfd33a58d681c752e693be7d457a1b3b9060200160405180910390a250611a13612990565b5050565b611a1f612928565b611a27612981565b60075460ff1615611a7a5760405162461bcd60e51b815260206004820181905260248201527f50726f706f73616c2070726f6365737320686173206265656e207061757365646044820152606401610a08565b600654600160a81b900463ffffffff16611a926116db565b11611ad55760405162461bcd60e51b81526020600482015260136024820152724e6f7420706173736564206c6976656e65737360681b6044820152606401610a08565b6005546080830151600160ff9091161b9081161415611b285760405162461bcd60e51b815260206004820152600f60248201526e105b1c9958591e4818db185a5b5959608a1b6044820152606401610a08565b600254611b36908383613330565b611b6e5760405162461bcd60e51b81526020600482015260096024820152682130b210283937b7b360b91b6044820152606401610a08565b81516000908152600a60205260409020546001600160a01b0316611bcb5760405162461bcd60e51b815260206004820152601460248201527327379030b230b83a32b9103337b91031b430b4b760611b6044820152606401610a08565b81516000908152600a60205260409020600101546001600160a01b031680611c355760405162461bcd60e51b815260206004820152601860248201527f556e696e697469616c697a65642073706f6b6520706f6f6c00000000000000006044820152606401610a08565b611c4b600260030154846080015160ff1661336b565b60055560068054600160a01b900460ff16906014611c6883614af6565b91906101000a81548160ff021916908360ff16021790555050611c9e8184600001518560a00151866040015187602001516133ce565b611cac8184600001516136aa565b600654600160a01b900460ff16611cde57600654601454601354611cde926001600160a01b0391821692911690612cc9565b336001600160a01b03168360000151846080015160ff167f269bcb1817facd431d586b474ce46fe1ca2921cd1a19314c01a606804ea8b9458660a00151876020015188604001518960600151604051611d3a9493929190614b87565b60405180910390a450611a13612990565b611d53612928565b611d5b612981565b6001600160a01b038216600090815260096020526040902054600160a01b900460ff16611dbe5760405162461bcd60e51b8152602060048201526011602482015270151bdad95b881b9bdd08195b98589b1959607a1b6044820152606401610a08565b600b546001600160a01b038381169116148015611dda57508034145b80611de3575034155b611e1f5760405162461bcd60e51b815260206004820152600d60248201526c426164206d73672e76616c756560981b6044820152606401610a08565b6000611e2a83612b16565b611e3c83670de0b6b3a76400006148b4565b611e4691906148e9565b6001600160a01b03848116600090815260096020526040908190205490516340c10f1960e01b81523360048201526024810184905292935016906340c10f19906044016020604051808303816000875af1158015611ea8573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611ecc9190614881565b506001600160a01b03831660009081526009602052604081206002018054849290611ef8908490614ade565b9091555050600b546001600160a01b038481169116148015611f1a5750600034115b15611f7857826001600160a01b031663d0e30db0346040518263ffffffff1660e01b81526004016000604051808303818588803b158015611f5a57600080fd5b505af1158015611f6e573d6000803e3d6000fd5b5050505050611f8d565b611f8d6001600160a01b0384163330856132f8565b604080518381526020810183905233916001600160a01b038616917f3c69701a61c79a92ef9692903aaa0068bce8771361ecb09547391e4fb4df8537910160405180910390a350611a13612990565b6001546001600160a01b031633146120065760405162461bcd60e51b8152600401610a08906147f8565b61200e612928565b612016612981565b600654600160a01b900460ff161561204957600654601454601354612049926001600160a01b0391821692911690612cc9565b6006546003546002546004546040519081526001600160a01b03909316927f993cba33f9b140c9ce20ba10d7eda92128d5beb6df856f064916108a11647a739060200160405180910390a46000600281905560038190556004819055600555600680546001600160c81b03191690556109dc612990565b6001546001600160a01b031633146120ea5760405162461bcd60e51b8152600401610a08906147f8565b6109dc60006137b3565b6120fc612928565b612104612981565b600654600160a01b900460ff161561212e5760405162461bcd60e51b8152600401610a089061482d565b60075460ff16156121815760405162461bcd60e51b815260206004820181905260248201527f50726f706f73616c2070726f6365737320686173206265656e207061757365646044820152606401610a08565b60008460ff16116121d45760405162461bcd60e51b815260206004820181905260248201527f42756e646c65206d7573742068617665206174206c656173742031206c6561666044820152606401610a08565b60155460009063ffffffff166121e86116db565b6121f29190614998565b60006005556006805460028790556003869055600485905560ff8816600160a01b0263ffffffff808516600160a81b0260ff60a01b19166001600160c81b031990931692909217176001600160a01b0319163390811790925560145460135493945061226c936001600160a01b031692913091906132f816565b336001600160a01b031683857f50e585dd6361c7cb2613ce2334814bb2a789f5a8ad4b161fe0e248043737d1d284898b886040516122ad9493929190614bd4565b60405180910390a4506109d6612990565b60006122c8612928565b6122d0612981565b6122db8260006129a5565b90506122e5612990565b919050565b6122f2612928565b6122fa612981565b61230381613805565b610c9c612990565b6060341561235b5760405162461bcd60e51b815260206004820152601b60248201527f4f6e6c79206d756c746963616c6c207769746820302076616c756500000000006044820152606401610a08565b816001600160401b03811115612373576123736142f2565b6040519080825280602002602001820160405280156123a657816020015b60608152602001906001900390816123915790505b50905060005b828110156124a957600080308686858181106123ca576123ca614c0d565b90506020028101906123dc9190614c23565b6040516123ea929190614c70565b600060405180830381855af49150503d8060008114612425576040519150601f19603f3d011682016040523d82523d6000602084013e61242a565b606091505b5091509150816124765760448151101561244357600080fd5b6004810190508080602001905181019061245d9190614c80565b60405162461bcd60e51b8152600401610a0891906141f6565b8084848151811061248957612489614c0d565b6020026020010181905250505080806124a190614ced565b9150506123ac565b5092915050565b6000600860006124c1868686612d2c565b81526020810191909152604001600020546001600160a01b031690505b9392505050565b6001546001600160a01b0316331461250f5760405162461bcd60e51b8152600401610a08906147f8565b612517612928565b61251f612981565b6001600160a01b03818116600090815260096020526040902054166125de57600c54604051637e178db760e11b81526001600160a01b0383811660048301529091169063fc2f1b6e906024016020604051808303816000875af115801561258a573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906125ae9190614864565b6001600160a01b03828116600090815260096020526040902080546001600160a01b031916929091169190911790555b6001600160a01b0381166000908152600960205260409020805460ff60a01b1916600160a01b17905561260f6116db565b6001600160a01b0380831660009081526009602052604090819020805463ffffffff94909416600160a81b0263ffffffff60a81b198516811790915590517f04e291c80180d65a57b5bf1bed775777ec0d6f283ef34bcf130712714d8bb7f7936126959386938116911617906001600160a01b0392831681529116602082015260400190565b60405180910390a1610c9c612990565b6001546001600160a01b031633146126cf5760405162461bcd60e51b8152600401610a08906147f8565b6102588163ffffffff161161271b5760405162461bcd60e51b8152602060048201526012602482015271131a5d995b995cdcc81d1bdbc81cda1bdc9d60721b6044820152606401610a08565b6015805463ffffffff191663ffffffff83169081179091556040519081527f04dd1d84d387f404568a7954b5e398518bdd716e1a8f4a790be9a1a225ad934790602001610f21565b6001546001600160a01b0316331461278d5760405162461bcd60e51b8152600401610a08906147f8565b612795612928565b61279d612981565b6127a78282612d6c565b611a13612990565b60006127b9612928565b6127c1612981565b6122db82612b16565b6001546001600160a01b031633146127f45760405162461bcd60e51b8152600401610a08906147f8565b6040805180820182526001600160a01b03848116808352848216602080850182815260008a8152600a8352879020955186549086166001600160a01b031991821617875590516001909601805496909516951694909417909255835187815292830152918101919091527f36050d958750e6ac3aa674ac7bbe8d0ae6a2f7d4b808e8c2c42c1f22fc9fc4bb9060600160405180910390a1505050565b6001546001600160a01b031633146128ba5760405162461bcd60e51b8152600401610a08906147f8565b6001600160a01b03811661291f5760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201526564647265737360d01b6064820152608401610a08565b610c9c816137b3565b600054600160a01b900460ff166109dc5760405162461bcd60e51b815260206004820152601f60248201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c006044820152606401610a08565b6000805460ff60a01b19169055565b6000805460ff60a01b1916600160a01b179055565b60006129b083613805565b6001600160a01b038381166000908152600960209081526040808320815160c08101835281549586168152600160a01b860460ff16151593810193909352600160a81b90940463ffffffff16908201526001830154606082018190526002840154608083015260039093015460a0820152918112612a2f576000612a35565b81606001515b90506000612a438286614ade565b90506000828460800151612a579190614ade565b905080612a7257670de0b6b3a7640000945050505050610cc5565b80612a8583670de0b6b3a76400006148b4565b612a8f91906148e9565b979650505050505050565b60606000612aa88585613954565b90508481612ab585613996565b604051602001612ac793929190614d08565b6040516020818303038152906040529150509392505050565b60606000612aee8585613954565b90508481612ab585613abe565b60606000612b098585613954565b90508481612ab585613aff565b6001600160a01b038082166000908152600960209081526040808320805482516318160ddd60e01b8152925194959194869491909216926318160ddd92600480830193928290030181865afa158015612b73573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190612b97919061497f565b905080612baf5750670de0b6b3a76400009392505050565b612bb882613b56565b612bc184613805565b6000826003015483600101548460020154612bdc9190614d4b565b612be69190614d8c565b905081612bfb82670de0b6b3a76400006148b4565b612c0591906148e9565b95945050505050565b6001600160a01b0382163b15612c3557600b54611a13906001600160a01b03168383612cc9565b600b54604051632e1a7d4d60e01b8152600481018390526001600160a01b0390911690632e1a7d4d90602401600060405180830381600087803b158015612c7b57600080fd5b505af1158015612c8f573d6000803e3d6000fd5b50506040516001600160a01b038516925083156108fc02915083906000818181858888f193505050501580156110e9573d6000803e3d6000fd5b6040516001600160a01b0383166024820152604481018290526110e990849063a9059cbb60e01b906064015b60408051601f198184030181529190526020810180516001600160e01b03166001600160e01b031990931692909217909152613bbe565b604080516020808201959095526001600160a01b039390931683820152606080840192909252805180840390920182526080909201909152805191012090565b6000828152600a60205260409020546001600160a01b031680612dd15760405162461bcd60e51b815260206004820152601760248201527f41646170746572206e6f7420696e697469616c697a65640000000000000000006044820152606401610a08565b6000838152600a60205260408082206001015490516001600160a01b0380851692612e03929116908690602401614dcb565b60408051601f198184030181529181526020820180516001600160e01b0316637375c56f60e11b17905251612e389190614def565b600060405180830381855af49150503d8060008114612e73576040519150601f19603f3d011682016040523d82523d6000602084013e612e78565b606091505b5050905080612e995760405162461bcd60e51b8152600401610a0890614e0b565b837f218987b934c2f6bc596136829fbf43a5fef4d6fafce41f3f6254d9a870c2deec84604051612ec991906141f6565b60405180910390a250505050565b600d546040516302abf57960e61b81526453746f726560d81b60048201526000916001600160a01b03169063aafd5e4090602401602060405180830381865afa158015612f28573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190612f4c9190614864565b601354604051635b97aadd60e01b81526001600160a01b039182166004820152911690635b97aadd90602401602060405180830381865afa158015612f95573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190612fb99190614e38565b51919050565b60135460065460145460405163a9059cbb60e01b81526001600160a01b039283166004820152602481019190915291169063a9059cbb906044016020604051808303816000875af1158015613018573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061303c9190614881565b506000600281905560038190556004819055600555600680546001600160c81b0319169055337f1d2f9274429d71a4bfb9fe52ed39d766c4d0f7b072f0989cf7072229fbc6332861308b6116db565b8360405161309a929190614e79565b60405180910390a250565b600d546040516302abf57960e61b815275536b696e6e794f7074696d69737469634f7261636c6560501b60048201526000916001600160a01b03169063aafd5e4090602401602060405180830381865afa158015613107573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610e959190614864565b604051636eb1769f60e11b81523060048201526001600160a01b038381166024830152600091839186169063dd62ed3e90604401602060405180830381865afa15801561317c573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906131a0919061497f565b6131aa9190614ade565b6040516001600160a01b0385166024820152604481018290529091506131dd90859063095ea7b360e01b90606401612cf5565b50505050565b80158061325d5750604051636eb1769f60e11b81523060048201526001600160a01b03838116602483015284169063dd62ed3e90604401602060405180830381865afa158015613237573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061325b919061497f565b155b6132c85760405162461bcd60e51b815260206004820152603660248201527f5361666545524332303a20617070726f76652066726f6d206e6f6e2d7a65726f60448201527520746f206e6f6e2d7a65726f20616c6c6f77616e636560501b6064820152608401610a08565b6040516001600160a01b0383166024820152604481018290526110e990849063095ea7b360e01b90606401612cf5565b6040516001600160a01b03808516602483015283166044820152606481018290526131dd9085906323b872dd60e01b90608401612cf5565b60006133638285856040516020016133489190614e92565b60405160208183030381529060405280519060200120613c90565b949350505050565b600060ff8211156133b45760405162461bcd60e51b8152602060048201526013602482015272496e646578206f7574206f6620626f756e647360681b6044820152606401610a08565b6133c061010083614f1e565b6001901b8317905092915050565b6000848152600a60205260408120546001600160a01b0316905b84518163ffffffff1610156136a1576000858263ffffffff168151811061341157613411614c0d565b6020026020010151905060006008600061342c46858c612d2c565b81526020810191909152604001600020546001600160a01b031690508061348d5760405162461bcd60e51b8152602060048201526015602482015274149bdd5d19481b9bdd081dda1a5d195b1a5cdd1959605a1b6044820152606401610a08565b6000868463ffffffff16815181106134a7576134a7614c0d565b60200260200101511315613663576000846001600160a01b03168383898763ffffffff16815181106134db576134db614c0d565b60209081029190910101516040516001600160a01b03938416602482015291831660448301526064820152908c16608482015260a40160408051601f198184030181529181526020820180516001600160e01b03166314b231d760e21b179052516135469190614def565b600060405180830381855af49150503d8060008114613581576040519150601f19603f3d011682016040523d82523d6000602084013e613586565b606091505b50509050806135a75760405162461bcd60e51b8152600401610a0890614e0b565b868463ffffffff16815181106135bf576135bf614c0d565b602002602001015160096000856001600160a01b03166001600160a01b0316815260200190815260200160002060010160008282546135fe9190614d4b565b92505081905550868463ffffffff168151811061361d5761361d614c0d565b602002602001015160096000856001600160a01b03166001600160a01b03168152602001908152602001600020600201600082825461365c91906148fd565b9091555050505b61368c82868563ffffffff168151811061367f5761367f614c0d565b6020026020010151613ca6565b5050808061369990614f32565b9150506133e8565b50505050505050565b6000818152600a6020526040808220546003546004549251602481019190915260448101929092526001600160a01b031691908290859060640160408051601f198184030181529181526020820180516001600160e01b031663124e93e160e21b1790525161371d929190602401614dcb565b60408051601f198184030181529181526020820180516001600160e01b0316637375c56f60e11b179052516137529190614def565b600060405180830381855af49150503d806000811461378d576040519150601f19603f3d011682016040523d82523d6000602084013e613792565b606091505b50509050806131dd5760405162461bcd60e51b8152600401610a0890614e0b565b600180546001600160a01b038381166001600160a01b0319831681179093556040519116919082907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e090600090a35050565b6040516370a0823160e01b81523060048201526000906001600160a01b038316906370a0823190602401602060405180830381865afa15801561384c573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190613870919061497f565b6013549091506000906001600160a01b03848116911614801561389e5750600654600160a01b900460ff1615155b6138a857816138b5565b6014546138b590836148fd565b6001600160a01b0384166000908152600960205260409020600201549091508111156110e9576001600160a01b03831660009081526009602052604090206002015461390190826148fd565b6001600160a01b0384166000908152600960205260408120600101805490919061392c908490614d8c565b90915550506001600160a01b0383166000908152600960205260409020600201819055505050565b815160609015613985578160405160200161396f9190614f56565b6040516020818303038152906040529050610cc5565b8160405160200161396f9190614f8a565b6060816139ba5750506040805180820190915260018152600360fc1b602082015290565b8160005b81156139e457806139ce81614ced565b91506139dd9050600a836148e9565b91506139be565b6000816001600160401b038111156139fe576139fe6142f2565b6040519080825280601f01601f191660200182016040528015613a28576020820181803683370190505b509050815b8515613ab557613a3e6001826148fd565b90506000613a4d600a886148e9565b613a5890600a6148b4565b613a6290886148fd565b613a6d906030614faf565b905060008160f81b905080848481518110613a8a57613a8a614c0d565b60200101906001600160f81b031916908160001a905350613aac600a896148e9565b97505050613a2d565b50949350505050565b6060613acd608083901c613d79565b613ad683613d79565b6040805160208101939093528201526060015b6040516020818303038152906040529050919050565b6060613b176001600160801b03602084901c16613d79565b613b328360601b6bffffffffffffffffffffffff1916613d79565b604051602001613ae99291909182526001600160c01b031916602082015260280190565b60038101548154600091613b7691600160a81b900463ffffffff16613f12565b905080826003016000828254613b8c91906148fd565b90915550613b9a90506116db565b825463ffffffff91909116600160a81b0263ffffffff60a81b199091161790915550565b6000613c13826040518060400160405280602081526020017f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c6564815250856001600160a01b0316613f679092919063ffffffff16565b8051909150156110e95780806020019051810190613c319190614881565b6110e95760405162461bcd60e51b815260206004820152602a60248201527f5361666545524332303a204552433230206f7065726174696f6e20646964206e6044820152691bdd081cdd58d8d9595960b21b6064820152608401610a08565b600082613c9d8584613f76565b14949350505050565b6000670de0b6b3a764000060125483613cbf91906148b4565b613cc991906148e9565b90506000613cd782846148fd565b90508015613d40576001600160a01b03841660009081526009602052604081206003018054839290613d0a908490614ade565b90915550506001600160a01b03841660009081526009602052604081206001018054839290613d3a908490614d4b565b90915550505b81156131dd576001600160a01b03841660009081526010602052604081208054849290613d6e908490614ade565b909155505050505050565b6000808260001c9050806001600160801b03169050806801000000000000000002811777ffffffffffffffff0000000000000000ffffffffffffffff169050806401000000000281177bffffffff00000000ffffffff00000000ffffffff00000000ffffffff16905080620100000281177dffff0000ffff0000ffff0000ffff0000ffff0000ffff0000ffff0000ffff169050806101000281177eff00ff00ff00ff00ff00ff00ff00ff00ff00ff00ff00ff00ff00ff00ff00ff1690508060100281177f0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f16905060006008827f08080808080808080808080808080808080808080808080808080808080808081681613e9457613e946148d3565b0460047f040404040404040404040404040404040404040404040404040404040404040484160460027f020202020202020202020202020202020202020202020202020202020202020285160417166027029091017f3030303030303030303030303030303030303030303030303030303030303030019392505050565b60008082613f1e6116db565b613f2891906148fd565b90506000670de0b6b3a764000082600f5487613f4491906148b4565b613f4e91906148b4565b613f5891906148e9565b90508481106133635784612c05565b60606133638484600085613fea565b600081815b8451811015613fe2576000858281518110613f9857613f98614c0d565b60200260200101519050808311613fbe5760008381526020829052604090209250613fcf565b600081815260208490526040902092505b5080613fda81614ced565b915050613f7b565b509392505050565b60608247101561404b5760405162461bcd60e51b815260206004820152602660248201527f416464726573733a20696e73756666696369656e742062616c616e636520666f6044820152651c8818d85b1b60d21b6064820152608401610a08565b6001600160a01b0385163b6140a25760405162461bcd60e51b815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e74726163740000006044820152606401610a08565b600080866001600160a01b031685876040516140be9190614def565b60006040518083038185875af1925050503d80600081146140fb576040519150601f19603f3d011682016040523d82523d6000602084013e614100565b606091505b5091509150612a8f8282866060831561411a5750816124de565b82511561412a5782518084602001fd5b8160405162461bcd60e51b8152600401610a0891906141f6565b6001600160a01b0381168114610c9c57600080fd5b6000806040838503121561416c57600080fd5b823561417781614144565b946020939093013593505050565b60006020828403121561419757600080fd5b5035919050565b60005b838110156141b95781810151838201526020016141a1565b838111156131dd5750506000910152565b600081518084526141e281602086016020860161419e565b601f01601f19169290920160200192915050565b6020815260006124de60208301846141ca565b60006020828403121561421b57600080fd5b81356124de81614144565b8015158114610c9c57600080fd5b60008060006060848603121561424957600080fd5b833561425481614144565b925060208401359150604084013561426b81614226565b809150509250925092565b60006020828403121561428857600080fd5b81356124de81614226565b600080600080600060a086880312156142ab57600080fd5b853594506020860135935060408601356142c481614144565b925060608601356142d481614144565b915060808601356142e481614226565b809150509295509295909350565b634e487b7160e01b600052604160045260246000fd5b60405160c081016001600160401b038111828210171561432a5761432a6142f2565b60405290565b604051601f8201601f191681016001600160401b0381118282101715614358576143586142f2565b604052919050565b60006001600160401b03821115614379576143796142f2565b5060051b60200190565b600082601f83011261439457600080fd5b813560206143a96143a483614360565b614330565b82815260059290921b840181019181810190868411156143c857600080fd5b8286015b848110156143e357803583529183019183016143cc565b509695505050505050565b803560ff811681146122e557600080fd5b600082601f83011261441057600080fd5b813560206144206143a483614360565b82815260059290921b8401810191818101908684111561443f57600080fd5b8286015b848110156143e357803561445681614144565b8352918301918301614443565b6000806040838503121561447657600080fd5b82356001600160401b038082111561448d57600080fd5b9084019060c082870312156144a157600080fd5b6144a9614308565b823581526020830135828111156144bf57600080fd5b6144cb88828601614383565b6020830152506040830135828111156144e357600080fd5b6144ef88828601614383565b60408301525060608301358281111561450757600080fd5b61451388828601614383565b606083015250614525608084016143ee565b608082015260a08301358281111561453c57600080fd5b614548888286016143ff565b60a0830152509350602085013591508082111561456457600080fd5b5061457185828601614383565b9150509250929050565b600080600080600060a0868803121561459357600080fd5b85356001600160401b038111156145a957600080fd5b6145b588828901614383565b9550506145c4602087016143ee565b94979496505050506040830135926060810135926080909101359150565b600080602083850312156145f557600080fd5b82356001600160401b038082111561460c57600080fd5b818501915085601f83011261462057600080fd5b81358181111561462f57600080fd5b8660208260051b850101111561464457600080fd5b60209290920196919550909350505050565b6000602080830181845280855180835260408601915060408160051b870101925083870160005b828110156146ab57603f198886030184526146998583516141ca565b9450928501929085019060010161467d565b5092979650505050505050565b6000806000606084860312156146cd57600080fd5b8335925060208401356146df81614144565b929592945050506040919091013590565b60006020828403121561470257600080fd5b813563ffffffff811681146124de57600080fd5b60006001600160401b0382111561472f5761472f6142f2565b50601f01601f191660200190565b6000806040838503121561475057600080fd5b8235915060208301356001600160401b0381111561476d57600080fd5b8301601f8101851361477e57600080fd5b803561478c6143a482614716565b8181528660208385010111156147a157600080fd5b816020840160208301376000602083830101528093505050509250929050565b6000806000606084860312156147d657600080fd5b8335925060208401356147e881614144565b9150604084013561426b81614144565b6020808252818101527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604082015260600190565b6020808252601c908201527f70726f706f73616c2068617320756e636c61696d6564206c6561667300000000604082015260600190565b60006020828403121561487657600080fd5b81516124de81614144565b60006020828403121561489357600080fd5b81516124de81614226565b634e487b7160e01b600052601160045260246000fd5b60008160001904831182151516156148ce576148ce61489e565b500290565b634e487b7160e01b600052601260045260246000fd5b6000826148f8576148f86148d3565b500490565b60008282101561490f5761490f61489e565b500390565b60006101208b835263ffffffff808c16602085015281604085015261493b8285018c6141ca565b6001600160a01b039a8b166060860152608085019990995260a084019790975250509290931660c083015290931660e0840152610100909201919091529392505050565b60006020828403121561499157600080fd5b5051919050565b600063ffffffff8083168185168083038211156149b7576149b761489e565b01949350505050565b600061020088835263ffffffff881660208401528060408401526149e6818401886141ca565b9150506149ff6060830186516001600160a01b03169052565b60208501516001600160a01b03811660808401525060408501516001600160a01b03811660a084015250606085015180151560c084015250608085015160e083015260a0850151610100818185015260c08701519150610120828186015260e0880151925061014083818701528289015161016087015281890151610180870152808901516101a087015250505050614aa46101c08301856001600160a01b03169052565b6001600160a01b0383166101e0830152979650505050505050565b63ffffffff8316815260406020820152600061336360408301846141ca565b60008219821115614af157614af161489e565b500190565b600060ff821680614b0957614b0961489e565b6000190192915050565b600081518084526020808501945080840160005b83811015614b4c5781516001600160a01b031687529582019590820190600101614b27565b509495945050505050565b600081518084526020808501945080840160005b83811015614b4c57815187529582019590820190600101614b6b565b608081526000614b9a6080830187614b13565b8281036020840152614bac8187614b57565b90508281036040840152614bc08186614b57565b90508281036060840152612a8f8185614b57565b63ffffffff8516815260ff84166020820152608060408201526000614bfc6080830185614b57565b905082606083015295945050505050565b634e487b7160e01b600052603260045260246000fd5b6000808335601e19843603018112614c3a57600080fd5b8301803591506001600160401b03821115614c5457600080fd5b602001915036819003821315614c6957600080fd5b9250929050565b8183823760009101908152919050565b600060208284031215614c9257600080fd5b81516001600160401b03811115614ca857600080fd5b8201601f81018413614cb957600080fd5b8051614cc76143a482614716565b818152856020838501011115614cdc57600080fd5b612c0582602083016020860161419e565b6000600019821415614d0157614d0161489e565b5060010190565b60008451614d1a81846020890161419e565b845190830190614d2e81836020890161419e565b8451910190614d4181836020880161419e565b0195945050505050565b600080821280156001600160ff1b0384900385131615614d6d57614d6d61489e565b600160ff1b8390038412811615614d8657614d8661489e565b50500190565b60008083128015600160ff1b850184121615614daa57614daa61489e565b6001600160ff1b0384018313811615614dc557614dc561489e565b50500390565b6001600160a01b0383168152604060208201819052600090613363908301846141ca565b60008251614e0181846020870161419e565b9190910192915050565b60208082526013908201527219195b1959d85d1958d85b1b0819985a5b1959606a1b604082015260600190565b600060208284031215614e4a57600080fd5b604051602081018181106001600160401b0382111715614e6c57614e6c6142f2565b6040529151825250919050565b82815260406020820152600061336360408301846141ca565b60208152815160208201526000602083015160c06040840152614eb860e0840182614b57565b90506040840151601f1980858403016060860152614ed68383614b57565b92506060860151915080858403016080860152614ef38383614b57565b925060ff60808701511660a086015260a08601519150808584030160c086015250612c058282614b13565b600082614f2d57614f2d6148d3565b500690565b600063ffffffff80831681811415614f4c57614f4c61489e565b6001019392505050565b600b60fa1b815260008251614f7281600185016020870161419e565b601d60f91b6001939091019283015250600201919050565b60008251614f9c81846020870161419e565b601d60f91b920191825250600101919050565b600060ff821660ff84168060ff03821115614fcc57614fcc61489e565b01939250505056fea2646970667358221220777769bea87524c859b5b55ca9cd8838f00ef8ae2fc22760bc7afed4f9496abd64736f6c634300080b0033", + "libraries": { + "MerkleLib": "0x56f2c8353049270d3553773E680B0d6c632544b6" + } +} diff --git a/deployments/goerli/LpTokenFactory.json b/deployments/goerli/LpTokenFactory.json new file mode 100644 index 000000000..420dd730c --- /dev/null +++ b/deployments/goerli/LpTokenFactory.json @@ -0,0 +1,74 @@ +{ + "address": "0x56f2c8353049270d3553773E680B0d6c632544b6", + "abi": [ + { + "inputs": [ + { + "internalType": "address", + "name": "l1Token", + "type": "address" + } + ], + "name": "createLpToken", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "nonpayable", + "type": "function" + } + ], + "transactionHash": "0xeaf5e4d15deb64e382e6aac580c5d340ae8522c898b2667f7eb7db9728bd95ba", + "receipt": { + "to": null, + "from": "0x9A8f92a830A5cB89a3816e3D267CB7791c16b04D", + "contractAddress": "0x56f2c8353049270d3553773E680B0d6c632544b6", + "transactionIndex": 2, + "gasUsed": "2523579", + "logsBloom": "0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", + "blockHash": "0x53a99d2eb6540bd4499e426eb2c858570781a4e9171518ca6e7705fc1685a0e4", + "transactionHash": "0xeaf5e4d15deb64e382e6aac580c5d340ae8522c898b2667f7eb7db9728bd95ba", + "logs": [], + "blockNumber": 6545720, + "cumulativeGasUsed": "2732905", + "status": 1, + "byzantium": true + }, + "args": [], + "numDeployments": 1, + "solcInputHash": "a6be65618c7af0eb8c96b985a450affc", + "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", + "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 + }, + "storageLayout": { + "storage": [], + "types": null + } +} diff --git a/deployments/goerli/Optimism_Adapter.json b/deployments/goerli/Optimism_Adapter.json new file mode 100644 index 000000000..d5b86b72d --- /dev/null +++ b/deployments/goerli/Optimism_Adapter.json @@ -0,0 +1,326 @@ +{ + "address": "0x04Ec0038859943Cf28E49d51821e33c987C4faDD", + "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" + } + ], + "transactionHash": "0x83778c1e9c189d69508c0097dd260df08464961d46fdbc4720a8e5975f6d6080", + "receipt": { + "to": null, + "from": "0x9A8f92a830A5cB89a3816e3D267CB7791c16b04D", + "contractAddress": "0x04Ec0038859943Cf28E49d51821e33c987C4faDD", + "transactionIndex": 2, + "gasUsed": "918341", + "logsBloom": "0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", + "blockHash": "0x2f95c85ae3574e4906b777294b0d7b4e3aab654718dad92e6f3e4784723b65d2", + "transactionHash": "0x83778c1e9c189d69508c0097dd260df08464961d46fdbc4720a8e5975f6d6080", + "logs": [], + "blockNumber": 6545764, + "cumulativeGasUsed": "1188166", + "status": 1, + "byzantium": true + }, + "args": [ + "0x60D4dB9b534EF9260a88b0BED6c486fe13E604Fc", + "0x25ace71c97B33Cc4729CF772ae268934F7ab5fA1", + "0x99C9fc46f92E8a1c0deC1b1747d010903E884bE1" + ], + "numDeployments": 1, + "solcInputHash": "a6be65618c7af0eb8c96b985a450affc", + "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", + "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 + }, + "storageLayout": { + "storage": [], + "types": null + } +} diff --git a/deployments/goerli/PolygonTokenBridger.json b/deployments/goerli/PolygonTokenBridger.json new file mode 100644 index 000000000..1a955d714 --- /dev/null +++ b/deployments/goerli/PolygonTokenBridger.json @@ -0,0 +1,182 @@ +{ + "address": "0xe9D669a4A28aBF4C77c1c6f98942638b7A9aEaC9", + "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": "isMatic", + "type": "bool" + } + ], + "name": "send", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "stateMutability": "payable", + "type": "receive" + } + ], + "transactionHash": "0xf194bb1510623e21c38ddf15496e23934d37efcc188ce303f65b07b8cfb7206f", + "receipt": { + "to": "0x4e59b44847b379578588920cA78FbF26c0B4956C", + "from": "0x9A8f92a830A5cB89a3816e3D267CB7791c16b04D", + "contractAddress": null, + "transactionIndex": 2, + "gasUsed": "677446", + "logsBloom": "0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", + "blockHash": "0x396dbdfcce78fe6ff28fcc96e7751930b2cfa618bf57bd49e3a13ceb34bf6a25", + "transactionHash": "0xf194bb1510623e21c38ddf15496e23934d37efcc188ce303f65b07b8cfb7206f", + "logs": [], + "blockNumber": 6545790, + "cumulativeGasUsed": "830305", + "status": 1, + "byzantium": true + }, + "args": ["0xe1fC1EB80db9AD0160AEF6998673625bc2a09d14", "0x60D4dB9b534EF9260a88b0BED6c486fe13E604Fc"], + "numDeployments": 2, + "solcInputHash": "a6be65618c7af0eb8c96b985a450affc", + "metadata": "{\"compiler\":{\"version\":\"0.8.11+commit.d7f03943\"},\"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\":\"isMatic\",\"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.\",\"isMatic\":\"True if token is MATIC.\",\"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.\"}},\"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 \\\"@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\",\"keccak256\":\"0x25193122b8b7e3c69b16ff876d37da95d86ea86cbf2bbaaa2fc4174535b17f94\",\"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": "0x60c060405234801561001057600080fd5b50604051610bbd380380610bbd83398101604081905261002f9161006b565b6000805460ff191660011790556001600160a01b039182166080521660a0526100a5565b6001600160a01b038116811461006857600080fd5b50565b6000806040838503121561007e57600080fd5b825161008981610053565b602084015190925061009a81610053565b809150509250929050565b60805160a051610ae66100d7600039600081816070015261012901526000818161018601526102450152610ae66000f3fe60806040526004361061005e5760003560e01c8063b269681d11610043578063b269681d14610174578063d124dc4f146101a8578063dc354296146101c857600080fd5b80630a79309b146100f7578063146bf4b11461011757600080fd5b366100f25760005460ff16156100f0577f000000000000000000000000000000000000000000000000000000000000000073ffffffffffffffffffffffffffffffffffffffff1663d0e30db0476040518263ffffffff1660e01b81526004016000604051808303818588803b1580156100d657600080fd5b505af11580156100ea573d6000803e3d6000fd5b50505050505b005b600080fd5b34801561010357600080fd5b506100f0610112366004610974565b6101de565b34801561012357600080fd5b5061014b7f000000000000000000000000000000000000000000000000000000000000000081565b60405173ffffffffffffffffffffffffffffffffffffffff909116815260200160405180910390f35b34801561018057600080fd5b5061014b7f000000000000000000000000000000000000000000000000000000000000000081565b3480156101b457600080fd5b506100f06101c336600461099f565b610318565b3480156101d457600080fd5b5061014b61101081565b6101e6610499565b610213600080547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff00169055565b6040517f70a082310000000000000000000000000000000000000000000000000000000081523060048201526102e5907f00000000000000000000000000000000000000000000000000000000000000009073ffffffffffffffffffffffffffffffffffffffff8416906370a0823190602401602060405180830381865afa1580156102a3573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906102c791906109e1565b73ffffffffffffffffffffffffffffffffffffffff8416919061050c565b610315600080547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff00166001179055565b50565b610320610499565b61034d600080547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff00169055565b61036f73ffffffffffffffffffffffffffffffffffffffff84163330856105e0565b6040517f2e1a7d4d0000000000000000000000000000000000000000000000000000000081526004810183905273ffffffffffffffffffffffffffffffffffffffff841690632e1a7d4d90602401600060405180830381600087803b1580156103d757600080fd5b505af11580156103eb573d6000803e3d6000fd5b505050508015610464576040517f2e1a7d4d0000000000000000000000000000000000000000000000000000000081526004810183905261101090632e1a7d4d9084906024016000604051808303818588803b15801561044a57600080fd5b505af115801561045e573d6000803e3d6000fd5b50505050505b610494600080547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff00166001179055565b505050565b60005460ff1661050a576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601f60248201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c0060448201526064015b60405180910390fd5b565b60405173ffffffffffffffffffffffffffffffffffffffff83166024820152604481018290526104949084907fa9059cbb00000000000000000000000000000000000000000000000000000000906064015b604080517fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe08184030181529190526020810180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff167fffffffff0000000000000000000000000000000000000000000000000000000090931692909217909152610644565b60405173ffffffffffffffffffffffffffffffffffffffff8085166024830152831660448201526064810182905261063e9085907f23b872dd000000000000000000000000000000000000000000000000000000009060840161055e565b50505050565b60006106a6826040518060400160405280602081526020017f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c65648152508573ffffffffffffffffffffffffffffffffffffffff166107509092919063ffffffff16565b80519091501561049457808060200190518101906106c491906109fa565b610494576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602a60248201527f5361666545524332303a204552433230206f7065726174696f6e20646964206e60448201527f6f742073756363656564000000000000000000000000000000000000000000006064820152608401610501565b606061075f8484600085610769565b90505b9392505050565b6060824710156107fb576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602660248201527f416464726573733a20696e73756666696369656e742062616c616e636520666f60448201527f722063616c6c00000000000000000000000000000000000000000000000000006064820152608401610501565b73ffffffffffffffffffffffffffffffffffffffff85163b610879576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e74726163740000006044820152606401610501565b6000808673ffffffffffffffffffffffffffffffffffffffff1685876040516108a29190610a43565b60006040518083038185875af1925050503d80600081146108df576040519150601f19603f3d011682016040523d82523d6000602084013e6108e4565b606091505b50915091506108f48282866108ff565b979650505050505050565b6060831561090e575081610762565b82511561091e5782518084602001fd5b816040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016105019190610a5f565b73ffffffffffffffffffffffffffffffffffffffff8116811461031557600080fd5b60006020828403121561098657600080fd5b813561076281610952565b801515811461031557600080fd5b6000806000606084860312156109b457600080fd5b83356109bf81610952565b92506020840135915060408401356109d681610991565b809150509250925092565b6000602082840312156109f357600080fd5b5051919050565b600060208284031215610a0c57600080fd5b815161076281610991565b60005b83811015610a32578181015183820152602001610a1a565b8381111561063e5750506000910152565b60008251610a55818460208701610a17565b9190910192915050565b6020815260008251806020840152610a7e816040850160208701610a17565b601f017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe016919091016040019291505056fea2646970667358221220f1cc848e3ad63c2a8228332d4710a19a242bf1490810efee19a4398900eb127464736f6c634300080b0033", + "deployedBytecode": "0x60806040526004361061005e5760003560e01c8063b269681d11610043578063b269681d14610174578063d124dc4f146101a8578063dc354296146101c857600080fd5b80630a79309b146100f7578063146bf4b11461011757600080fd5b366100f25760005460ff16156100f0577f000000000000000000000000000000000000000000000000000000000000000073ffffffffffffffffffffffffffffffffffffffff1663d0e30db0476040518263ffffffff1660e01b81526004016000604051808303818588803b1580156100d657600080fd5b505af11580156100ea573d6000803e3d6000fd5b50505050505b005b600080fd5b34801561010357600080fd5b506100f0610112366004610974565b6101de565b34801561012357600080fd5b5061014b7f000000000000000000000000000000000000000000000000000000000000000081565b60405173ffffffffffffffffffffffffffffffffffffffff909116815260200160405180910390f35b34801561018057600080fd5b5061014b7f000000000000000000000000000000000000000000000000000000000000000081565b3480156101b457600080fd5b506100f06101c336600461099f565b610318565b3480156101d457600080fd5b5061014b61101081565b6101e6610499565b610213600080547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff00169055565b6040517f70a082310000000000000000000000000000000000000000000000000000000081523060048201526102e5907f00000000000000000000000000000000000000000000000000000000000000009073ffffffffffffffffffffffffffffffffffffffff8416906370a0823190602401602060405180830381865afa1580156102a3573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906102c791906109e1565b73ffffffffffffffffffffffffffffffffffffffff8416919061050c565b610315600080547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff00166001179055565b50565b610320610499565b61034d600080547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff00169055565b61036f73ffffffffffffffffffffffffffffffffffffffff84163330856105e0565b6040517f2e1a7d4d0000000000000000000000000000000000000000000000000000000081526004810183905273ffffffffffffffffffffffffffffffffffffffff841690632e1a7d4d90602401600060405180830381600087803b1580156103d757600080fd5b505af11580156103eb573d6000803e3d6000fd5b505050508015610464576040517f2e1a7d4d0000000000000000000000000000000000000000000000000000000081526004810183905261101090632e1a7d4d9084906024016000604051808303818588803b15801561044a57600080fd5b505af115801561045e573d6000803e3d6000fd5b50505050505b610494600080547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff00166001179055565b505050565b60005460ff1661050a576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601f60248201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c0060448201526064015b60405180910390fd5b565b60405173ffffffffffffffffffffffffffffffffffffffff83166024820152604481018290526104949084907fa9059cbb00000000000000000000000000000000000000000000000000000000906064015b604080517fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe08184030181529190526020810180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff167fffffffff0000000000000000000000000000000000000000000000000000000090931692909217909152610644565b60405173ffffffffffffffffffffffffffffffffffffffff8085166024830152831660448201526064810182905261063e9085907f23b872dd000000000000000000000000000000000000000000000000000000009060840161055e565b50505050565b60006106a6826040518060400160405280602081526020017f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c65648152508573ffffffffffffffffffffffffffffffffffffffff166107509092919063ffffffff16565b80519091501561049457808060200190518101906106c491906109fa565b610494576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602a60248201527f5361666545524332303a204552433230206f7065726174696f6e20646964206e60448201527f6f742073756363656564000000000000000000000000000000000000000000006064820152608401610501565b606061075f8484600085610769565b90505b9392505050565b6060824710156107fb576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602660248201527f416464726573733a20696e73756666696369656e742062616c616e636520666f60448201527f722063616c6c00000000000000000000000000000000000000000000000000006064820152608401610501565b73ffffffffffffffffffffffffffffffffffffffff85163b610879576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e74726163740000006044820152606401610501565b6000808673ffffffffffffffffffffffffffffffffffffffff1685876040516108a29190610a43565b60006040518083038185875af1925050503d80600081146108df576040519150601f19603f3d011682016040523d82523d6000602084013e6108e4565b606091505b50915091506108f48282866108ff565b979650505050505050565b6060831561090e575081610762565b82511561091e5782518084602001fd5b816040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016105019190610a5f565b73ffffffffffffffffffffffffffffffffffffffff8116811461031557600080fd5b60006020828403121561098657600080fd5b813561076281610952565b801515811461031557600080fd5b6000806000606084860312156109b457600080fd5b83356109bf81610952565b92506020840135915060408401356109d681610991565b809150509250925092565b6000602082840312156109f357600080fd5b5051919050565b600060208284031215610a0c57600080fd5b815161076281610991565b60005b83811015610a32578181015183820152602001610a1a565b8381111561063e5750506000910152565b60008251610a55818460208701610a17565b9190910192915050565b6020815260008251806020840152610a7e816040850160208701610a17565b601f017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe016919091016040019291505056fea2646970667358221220f1cc848e3ad63c2a8228332d4710a19a242bf1490810efee19a4398900eb127464736f6c634300080b0033", + "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.", + "isMatic": "True if token is MATIC.", + "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." + } + }, + "notice": "Contract deployed on Ethereum and Polygon to facilitate token transfers from Polygon to the HubPool and back.", + "version": 1 + }, + "storageLayout": { + "storage": [ + { + "astId": 7114, + "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/goerli/Polygon_Adapter.json b/deployments/goerli/Polygon_Adapter.json new file mode 100644 index 000000000..502e57578 --- /dev/null +++ b/deployments/goerli/Polygon_Adapter.json @@ -0,0 +1,248 @@ +{ + "address": "0xD732393f8eC57644675c104Ec8A4661db58CCE41", + "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": "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": [], + "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": "0xaf5c6b890fd0112ac428df70cfb3718d9ee734ac45d83e955e73a66055a3a14f", + "receipt": { + "to": null, + "from": "0x9A8f92a830A5cB89a3816e3D267CB7791c16b04D", + "contractAddress": "0xD732393f8eC57644675c104Ec8A4661db58CCE41", + "transactionIndex": 8, + "gasUsed": "755693", + "logsBloom": "0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", + "blockHash": "0xddf04aeca38931c90392c5cb3dbb8ba3bf73352e69cd0871db19dce0302a83f3", + "transactionHash": "0xaf5c6b890fd0112ac428df70cfb3718d9ee734ac45d83e955e73a66055a3a14f", + "logs": [], + "blockNumber": 6545797, + "cumulativeGasUsed": "4910123", + "status": 1, + "byzantium": true + }, + "args": [ + "0xBbD7cBFA79faee899Eaf900F13C9065bF03B1A74", + "0x3d1d3E34f7fB6D26245E6640E1c50710eFFf15bA", + "0x60D4dB9b534EF9260a88b0BED6c486fe13E604Fc" + ], + "numDeployments": 1, + "solcInputHash": "a6be65618c7af0eb8c96b985a450affc", + "metadata": "{\"compiler\":{\"version\":\"0.8.11+commit.d7f03943\"},\"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\":\"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\":[],\"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 neccessary 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\":{\"@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/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\"},\"@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/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\",\"keccak256\":\"0x7d093f27ef32011386931f313b3ceb30a1874bd40a4022ae3f01b215660992ac\",\"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": "0x60e060405234801561001057600080fd5b50604051610dc8380380610dc883398101604081905261002f91610064565b6001600160a01b0392831660805290821660a0521660c0526100b1565b6001600160a01b038116811461006157600080fd5b50565b60008060006060848603121561007957600080fd5b83516100848161004c565b60208501519093506100958161004c565b60408501519092506100a68161004c565b809150509250925092565b60805160a05160c051610cc06101086000396000818160710152818161014e01526101cf01526000818160e3015261047c0152600081816101170152818161028301528181610304015261032b0152610cc06000f3fe60806040526004361061005a5760003560e01c8063a996cabb11610043578063a996cabb146100d1578063bd07018d14610105578063e6eb8ade1461013957600080fd5b8063146bf4b11461005f57806352c8c75c146100bc575b600080fd5b34801561006b57600080fd5b506100937f000000000000000000000000000000000000000000000000000000000000000081565b60405173ffffffffffffffffffffffffffffffffffffffff909116815260200160405180910390f35b6100cf6100ca36600461099e565b61014c565b005b3480156100dd57600080fd5b506100937f000000000000000000000000000000000000000000000000000000000000000081565b34801561011157600080fd5b506100937f000000000000000000000000000000000000000000000000000000000000000081565b6100cf610147366004610a1a565b61043f565b7f000000000000000000000000000000000000000000000000000000000000000073ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff1614156102e8576040517f2e1a7d4d000000000000000000000000000000000000000000000000000000008152600481018390527f000000000000000000000000000000000000000000000000000000000000000073ffffffffffffffffffffffffffffffffffffffff1690632e1a7d4d90602401600060405180830381600087803b15801561022857600080fd5b505af115801561023c573d6000803e3d6000fd5b50506040517f4faa8a2600000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff84811660048301527f0000000000000000000000000000000000000000000000000000000000000000169250634faa8a26915084906024016000604051808303818588803b1580156102ca57600080fd5b505af11580156102de573d6000803e3d6000fd5b50505050506103da565b61032973ffffffffffffffffffffffffffffffffffffffff85167f000000000000000000000000000000000000000000000000000000000000000084610522565b7f000000000000000000000000000000000000000000000000000000000000000073ffffffffffffffffffffffffffffffffffffffff1663e3dec8fb82868560405160200161037a91815260200190565b6040516020818303038152906040526040518463ffffffff1660e01b81526004016103a793929190610b70565b600060405180830381600087803b1580156103c157600080fd5b505af11580156103d5573d6000803e3d6000fd5b505050505b6040805173ffffffffffffffffffffffffffffffffffffffff868116825285811660208301528183018590528316606082015290517fd7e09655439c3932e55857df3220186e5a7f0980825f20691c2b35d941dee75b9181900360800190a150505050565b6040517fb472047700000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff7f0000000000000000000000000000000000000000000000000000000000000000169063b4720477906104b39085908590600401610bb2565b600060405180830381600087803b1580156104cd57600080fd5b505af11580156104e1573d6000803e3d6000fd5b505050507f9e6c52944e331ba6270e7fe4cea2a4086bae8f7a27e1cdba07f416806f5d0ac48282604051610516929190610bb2565b60405180910390a15050565b6040517fdd62ed3e00000000000000000000000000000000000000000000000000000000815230600482015273ffffffffffffffffffffffffffffffffffffffff8381166024830152600091839186169063dd62ed3e90604401602060405180830381865afa158015610599573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906105bd9190610be1565b6105c79190610bfa565b6040805173ffffffffffffffffffffffffffffffffffffffff8616602482015260448082018490528251808303909101815260649091019091526020810180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff167f095ea7b30000000000000000000000000000000000000000000000000000000017905290915061065790859061065d565b50505050565b60006106bf826040518060400160405280602081526020017f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c65648152508573ffffffffffffffffffffffffffffffffffffffff166107739092919063ffffffff16565b80519091501561076e57808060200190518101906106dd9190610c39565b61076e576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602a60248201527f5361666545524332303a204552433230206f7065726174696f6e20646964206e60448201527f6f7420737563636565640000000000000000000000000000000000000000000060648201526084015b60405180910390fd5b505050565b6060610782848460008561078c565b90505b9392505050565b60608247101561081e576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602660248201527f416464726573733a20696e73756666696369656e742062616c616e636520666f60448201527f722063616c6c00000000000000000000000000000000000000000000000000006064820152608401610765565b73ffffffffffffffffffffffffffffffffffffffff85163b61089c576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e74726163740000006044820152606401610765565b6000808673ffffffffffffffffffffffffffffffffffffffff1685876040516108c59190610c5b565b60006040518083038185875af1925050503d8060008114610902576040519150601f19603f3d011682016040523d82523d6000602084013e610907565b606091505b5091509150610917828286610922565b979650505050505050565b60608315610931575081610785565b8251156109415782518084602001fd5b816040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016107659190610c77565b803573ffffffffffffffffffffffffffffffffffffffff8116811461099957600080fd5b919050565b600080600080608085870312156109b457600080fd5b6109bd85610975565b93506109cb60208601610975565b9250604085013591506109e060608601610975565b905092959194509250565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b60008060408385031215610a2d57600080fd5b610a3683610975565b9150602083013567ffffffffffffffff80821115610a5357600080fd5b818501915085601f830112610a6757600080fd5b813581811115610a7957610a796109eb565b604051601f82017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0908116603f01168101908382118183101715610abf57610abf6109eb565b81604052828152886020848701011115610ad857600080fd5b8260208601602083013760006020848301015280955050505050509250929050565b60005b83811015610b15578181015183820152602001610afd565b838111156106575750506000910152565b60008151808452610b3e816020860160208601610afa565b601f017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0169290920160200192915050565b600073ffffffffffffffffffffffffffffffffffffffff808616835280851660208401525060606040830152610ba96060830184610b26565b95945050505050565b73ffffffffffffffffffffffffffffffffffffffff831681526040602082015260006107826040830184610b26565b600060208284031215610bf357600080fd5b5051919050565b60008219821115610c34577f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b500190565b600060208284031215610c4b57600080fd5b8151801515811461078557600080fd5b60008251610c6d818460208701610afa565b9190910192915050565b6020815260006107856020830184610b2656fea26469706673582212206ccb2c999629f5b7b03eb6b166577a70a94e54d5081728bea152d5947648f1ab64736f6c634300080b0033", + "deployedBytecode": "0x60806040526004361061005a5760003560e01c8063a996cabb11610043578063a996cabb146100d1578063bd07018d14610105578063e6eb8ade1461013957600080fd5b8063146bf4b11461005f57806352c8c75c146100bc575b600080fd5b34801561006b57600080fd5b506100937f000000000000000000000000000000000000000000000000000000000000000081565b60405173ffffffffffffffffffffffffffffffffffffffff909116815260200160405180910390f35b6100cf6100ca36600461099e565b61014c565b005b3480156100dd57600080fd5b506100937f000000000000000000000000000000000000000000000000000000000000000081565b34801561011157600080fd5b506100937f000000000000000000000000000000000000000000000000000000000000000081565b6100cf610147366004610a1a565b61043f565b7f000000000000000000000000000000000000000000000000000000000000000073ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff1614156102e8576040517f2e1a7d4d000000000000000000000000000000000000000000000000000000008152600481018390527f000000000000000000000000000000000000000000000000000000000000000073ffffffffffffffffffffffffffffffffffffffff1690632e1a7d4d90602401600060405180830381600087803b15801561022857600080fd5b505af115801561023c573d6000803e3d6000fd5b50506040517f4faa8a2600000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff84811660048301527f0000000000000000000000000000000000000000000000000000000000000000169250634faa8a26915084906024016000604051808303818588803b1580156102ca57600080fd5b505af11580156102de573d6000803e3d6000fd5b50505050506103da565b61032973ffffffffffffffffffffffffffffffffffffffff85167f000000000000000000000000000000000000000000000000000000000000000084610522565b7f000000000000000000000000000000000000000000000000000000000000000073ffffffffffffffffffffffffffffffffffffffff1663e3dec8fb82868560405160200161037a91815260200190565b6040516020818303038152906040526040518463ffffffff1660e01b81526004016103a793929190610b70565b600060405180830381600087803b1580156103c157600080fd5b505af11580156103d5573d6000803e3d6000fd5b505050505b6040805173ffffffffffffffffffffffffffffffffffffffff868116825285811660208301528183018590528316606082015290517fd7e09655439c3932e55857df3220186e5a7f0980825f20691c2b35d941dee75b9181900360800190a150505050565b6040517fb472047700000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff7f0000000000000000000000000000000000000000000000000000000000000000169063b4720477906104b39085908590600401610bb2565b600060405180830381600087803b1580156104cd57600080fd5b505af11580156104e1573d6000803e3d6000fd5b505050507f9e6c52944e331ba6270e7fe4cea2a4086bae8f7a27e1cdba07f416806f5d0ac48282604051610516929190610bb2565b60405180910390a15050565b6040517fdd62ed3e00000000000000000000000000000000000000000000000000000000815230600482015273ffffffffffffffffffffffffffffffffffffffff8381166024830152600091839186169063dd62ed3e90604401602060405180830381865afa158015610599573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906105bd9190610be1565b6105c79190610bfa565b6040805173ffffffffffffffffffffffffffffffffffffffff8616602482015260448082018490528251808303909101815260649091019091526020810180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff167f095ea7b30000000000000000000000000000000000000000000000000000000017905290915061065790859061065d565b50505050565b60006106bf826040518060400160405280602081526020017f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c65648152508573ffffffffffffffffffffffffffffffffffffffff166107739092919063ffffffff16565b80519091501561076e57808060200190518101906106dd9190610c39565b61076e576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602a60248201527f5361666545524332303a204552433230206f7065726174696f6e20646964206e60448201527f6f7420737563636565640000000000000000000000000000000000000000000060648201526084015b60405180910390fd5b505050565b6060610782848460008561078c565b90505b9392505050565b60608247101561081e576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602660248201527f416464726573733a20696e73756666696369656e742062616c616e636520666f60448201527f722063616c6c00000000000000000000000000000000000000000000000000006064820152608401610765565b73ffffffffffffffffffffffffffffffffffffffff85163b61089c576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e74726163740000006044820152606401610765565b6000808673ffffffffffffffffffffffffffffffffffffffff1685876040516108c59190610c5b565b60006040518083038185875af1925050503d8060008114610902576040519150601f19603f3d011682016040523d82523d6000602084013e610907565b606091505b5091509150610917828286610922565b979650505050505050565b60608315610931575081610785565b8251156109415782518084602001fd5b816040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016107659190610c77565b803573ffffffffffffffffffffffffffffffffffffffff8116811461099957600080fd5b919050565b600080600080608085870312156109b457600080fd5b6109bd85610975565b93506109cb60208601610975565b9250604085013591506109e060608601610975565b905092959194509250565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b60008060408385031215610a2d57600080fd5b610a3683610975565b9150602083013567ffffffffffffffff80821115610a5357600080fd5b818501915085601f830112610a6757600080fd5b813581811115610a7957610a796109eb565b604051601f82017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0908116603f01168101908382118183101715610abf57610abf6109eb565b81604052828152886020848701011115610ad857600080fd5b8260208601602083013760006020848301015280955050505050509250929050565b60005b83811015610b15578181015183820152602001610afd565b838111156106575750506000910152565b60008151808452610b3e816020860160208601610afa565b601f017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0169290920160200192915050565b600073ffffffffffffffffffffffffffffffffffffffff808616835280851660208401525060606040830152610ba96060830184610b26565b95945050505050565b73ffffffffffffffffffffffffffffffffffffffff831681526040602082015260006107826040830184610b26565b600060208284031215610bf357600080fd5b5051919050565b60008219821115610c34577f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b500190565b600060208284031215610c4b57600080fd5b8151801515811461078557600080fd5b60008251610c6d818460208701610afa565b9190910192915050565b6020815260006107856020830184610b2656fea26469706673582212206ccb2c999629f5b7b03eb6b166577a70a94e54d5081728bea152d5947648f1ab64736f6c634300080b0033", + "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": { + "_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/goerli/solcInputs/a279276f4631f65ac9d6cbb82cf77d0b.json b/deployments/goerli/solcInputs/a279276f4631f65ac9d6cbb82cf77d0b.json new file mode 100644 index 000000000..5a90cca0b --- /dev/null +++ b/deployments/goerli/solcInputs/a279276f4631f65ac9d6cbb82cf77d0b.json @@ -0,0 +1,104 @@ +{ + "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 // 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 // Whether the bundle proposal process is paused.\n bool public paused;\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 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 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 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 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 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 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)\n public\n nonReentrant\n unpaused\n {\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" + }, + "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" + }, + "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 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 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/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" + }, + "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" + }, + "@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" + }, + "@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" + }, + "@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/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/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/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/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/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/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/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/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/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 (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/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 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" + }, + "@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" + }, + "@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/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" + }, + "@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" + } + }, + "settings": { + "optimizer": { + "enabled": true, + "runs": 200 + }, + "outputSelection": { + "*": { + "*": ["abi", "evm.bytecode", "evm.deployedBytecode", "evm.methodIdentifiers", "metadata"], + "": ["ast"] + } + } + } +} diff --git a/deployments/goerli/solcInputs/a6be65618c7af0eb8c96b985a450affc.json b/deployments/goerli/solcInputs/a6be65618c7af0eb8c96b985a450affc.json new file mode 100644 index 000000000..1d3b0f1a6 --- /dev/null +++ b/deployments/goerli/solcInputs/a6be65618c7af0eb8c96b985a450affc.json @@ -0,0 +1,204 @@ +{ + "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" + }, + "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 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 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 * @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 {\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 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 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" + }, + "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" + }, + "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" + }, + "@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/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" + }, + "@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/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" + }, + "@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 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 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" + }, + "@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 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" + }, + "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/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" + }, + "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" + }, + "@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/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" + }, + "@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/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" + }, + "@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" + }, + "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" + }, + "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/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/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" + }, + "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" + }, + "@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/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": { + "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/polygon-mumbai/.chainId b/deployments/polygon-mumbai/.chainId new file mode 100644 index 000000000..d7e2f72ce --- /dev/null +++ b/deployments/polygon-mumbai/.chainId @@ -0,0 +1 @@ +80001 \ No newline at end of file diff --git a/deployments/polygon-mumbai/PolygonTokenBridger.json b/deployments/polygon-mumbai/PolygonTokenBridger.json new file mode 100644 index 000000000..df5be0c11 --- /dev/null +++ b/deployments/polygon-mumbai/PolygonTokenBridger.json @@ -0,0 +1,198 @@ +{ + "address": "0xe9D669a4A28aBF4C77c1c6f98942638b7A9aEaC9", + "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": "isMatic", + "type": "bool" + } + ], + "name": "send", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "stateMutability": "payable", + "type": "receive" + } + ], + "transactionHash": "0xda5f6c3f8494de4e65f2edf0854db6415d764e37bc5d197a3a3a2b41a9a2aebe", + "receipt": { + "to": "0x4e59b44847b379578588920cA78FbF26c0B4956C", + "from": "0x9A8f92a830A5cB89a3816e3D267CB7791c16b04D", + "contractAddress": null, + "transactionIndex": 11, + "gasUsed": "677446", + "logsBloom": "0x00000000000000020000000000000000000000000000000000000000000000000000000000000000000000000000000000008000000000000000000000000000000000000000000000000000000000800000000000000000000100000000000000000000000000000000000000000000000000000000000080000000040000000000000000000000000000000000000000000000000000000000000000000000200000000000000020000000000000000001000000000000000000000000004000000000000000800001000000000000000000000000000000100000000000000001000000000000000000000000000000000000000000000000000000100000", + "blockHash": "0x54c91a853ecefcc90e4d6586abe742b7ed7320ff21fd9b10167fd87067e2ea70", + "transactionHash": "0xda5f6c3f8494de4e65f2edf0854db6415d764e37bc5d197a3a3a2b41a9a2aebe", + "logs": [ + { + "transactionIndex": 11, + "blockNumber": 25535121, + "transactionHash": "0xda5f6c3f8494de4e65f2edf0854db6415d764e37bc5d197a3a3a2b41a9a2aebe", + "address": "0x0000000000000000000000000000000000001010", + "topics": [ + "0x4dfe1bbbcf077ddc3e01291eea2d5c70c2b422b415d95645b9adcfd678cb1d63", + "0x0000000000000000000000000000000000000000000000000000000000001010", + "0x0000000000000000000000009a8f92a830a5cb89a3816e3d267cb7791c16b04d", + "0x000000000000000000000000c26880a0af2ea0c7e8130e6ec47af756465452e8" + ], + "data": "0x000000000000000000000000000000000000000000000000003022abc265e7400000000000000000000000000000000000000000000000000e02560fac4950180000000000000000000000000000000000000000000007fb6489373e10afffca0000000000000000000000000000000000000000000000000dd23363e9e368d80000000000000000000000000000000000000000000007fb64b959e9d315e70a", + "logIndex": 122, + "blockHash": "0x54c91a853ecefcc90e4d6586abe742b7ed7320ff21fd9b10167fd87067e2ea70" + } + ], + "blockNumber": 25535121, + "cumulativeGasUsed": "3331926", + "status": 1, + "byzantium": true + }, + "args": ["0xe1fC1EB80db9AD0160AEF6998673625bc2a09d14", "0x60D4dB9b534EF9260a88b0BED6c486fe13E604Fc"], + "numDeployments": 1, + "solcInputHash": "a6be65618c7af0eb8c96b985a450affc", + "metadata": "{\"compiler\":{\"version\":\"0.8.11+commit.d7f03943\"},\"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\":\"isMatic\",\"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.\",\"isMatic\":\"True if token is MATIC.\",\"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.\"}},\"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 \\\"@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\",\"keccak256\":\"0x25193122b8b7e3c69b16ff876d37da95d86ea86cbf2bbaaa2fc4174535b17f94\",\"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": "0x60c060405234801561001057600080fd5b50604051610bbd380380610bbd83398101604081905261002f9161006b565b6000805460ff191660011790556001600160a01b039182166080521660a0526100a5565b6001600160a01b038116811461006857600080fd5b50565b6000806040838503121561007e57600080fd5b825161008981610053565b602084015190925061009a81610053565b809150509250929050565b60805160a051610ae66100d7600039600081816070015261012901526000818161018601526102450152610ae66000f3fe60806040526004361061005e5760003560e01c8063b269681d11610043578063b269681d14610174578063d124dc4f146101a8578063dc354296146101c857600080fd5b80630a79309b146100f7578063146bf4b11461011757600080fd5b366100f25760005460ff16156100f0577f000000000000000000000000000000000000000000000000000000000000000073ffffffffffffffffffffffffffffffffffffffff1663d0e30db0476040518263ffffffff1660e01b81526004016000604051808303818588803b1580156100d657600080fd5b505af11580156100ea573d6000803e3d6000fd5b50505050505b005b600080fd5b34801561010357600080fd5b506100f0610112366004610974565b6101de565b34801561012357600080fd5b5061014b7f000000000000000000000000000000000000000000000000000000000000000081565b60405173ffffffffffffffffffffffffffffffffffffffff909116815260200160405180910390f35b34801561018057600080fd5b5061014b7f000000000000000000000000000000000000000000000000000000000000000081565b3480156101b457600080fd5b506100f06101c336600461099f565b610318565b3480156101d457600080fd5b5061014b61101081565b6101e6610499565b610213600080547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff00169055565b6040517f70a082310000000000000000000000000000000000000000000000000000000081523060048201526102e5907f00000000000000000000000000000000000000000000000000000000000000009073ffffffffffffffffffffffffffffffffffffffff8416906370a0823190602401602060405180830381865afa1580156102a3573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906102c791906109e1565b73ffffffffffffffffffffffffffffffffffffffff8416919061050c565b610315600080547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff00166001179055565b50565b610320610499565b61034d600080547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff00169055565b61036f73ffffffffffffffffffffffffffffffffffffffff84163330856105e0565b6040517f2e1a7d4d0000000000000000000000000000000000000000000000000000000081526004810183905273ffffffffffffffffffffffffffffffffffffffff841690632e1a7d4d90602401600060405180830381600087803b1580156103d757600080fd5b505af11580156103eb573d6000803e3d6000fd5b505050508015610464576040517f2e1a7d4d0000000000000000000000000000000000000000000000000000000081526004810183905261101090632e1a7d4d9084906024016000604051808303818588803b15801561044a57600080fd5b505af115801561045e573d6000803e3d6000fd5b50505050505b610494600080547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff00166001179055565b505050565b60005460ff1661050a576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601f60248201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c0060448201526064015b60405180910390fd5b565b60405173ffffffffffffffffffffffffffffffffffffffff83166024820152604481018290526104949084907fa9059cbb00000000000000000000000000000000000000000000000000000000906064015b604080517fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe08184030181529190526020810180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff167fffffffff0000000000000000000000000000000000000000000000000000000090931692909217909152610644565b60405173ffffffffffffffffffffffffffffffffffffffff8085166024830152831660448201526064810182905261063e9085907f23b872dd000000000000000000000000000000000000000000000000000000009060840161055e565b50505050565b60006106a6826040518060400160405280602081526020017f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c65648152508573ffffffffffffffffffffffffffffffffffffffff166107509092919063ffffffff16565b80519091501561049457808060200190518101906106c491906109fa565b610494576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602a60248201527f5361666545524332303a204552433230206f7065726174696f6e20646964206e60448201527f6f742073756363656564000000000000000000000000000000000000000000006064820152608401610501565b606061075f8484600085610769565b90505b9392505050565b6060824710156107fb576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602660248201527f416464726573733a20696e73756666696369656e742062616c616e636520666f60448201527f722063616c6c00000000000000000000000000000000000000000000000000006064820152608401610501565b73ffffffffffffffffffffffffffffffffffffffff85163b610879576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e74726163740000006044820152606401610501565b6000808673ffffffffffffffffffffffffffffffffffffffff1685876040516108a29190610a43565b60006040518083038185875af1925050503d80600081146108df576040519150601f19603f3d011682016040523d82523d6000602084013e6108e4565b606091505b50915091506108f48282866108ff565b979650505050505050565b6060831561090e575081610762565b82511561091e5782518084602001fd5b816040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016105019190610a5f565b73ffffffffffffffffffffffffffffffffffffffff8116811461031557600080fd5b60006020828403121561098657600080fd5b813561076281610952565b801515811461031557600080fd5b6000806000606084860312156109b457600080fd5b83356109bf81610952565b92506020840135915060408401356109d681610991565b809150509250925092565b6000602082840312156109f357600080fd5b5051919050565b600060208284031215610a0c57600080fd5b815161076281610991565b60005b83811015610a32578181015183820152602001610a1a565b8381111561063e5750506000910152565b60008251610a55818460208701610a17565b9190910192915050565b6020815260008251806020840152610a7e816040850160208701610a17565b601f017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe016919091016040019291505056fea2646970667358221220f1cc848e3ad63c2a8228332d4710a19a242bf1490810efee19a4398900eb127464736f6c634300080b0033", + "deployedBytecode": "0x60806040526004361061005e5760003560e01c8063b269681d11610043578063b269681d14610174578063d124dc4f146101a8578063dc354296146101c857600080fd5b80630a79309b146100f7578063146bf4b11461011757600080fd5b366100f25760005460ff16156100f0577f000000000000000000000000000000000000000000000000000000000000000073ffffffffffffffffffffffffffffffffffffffff1663d0e30db0476040518263ffffffff1660e01b81526004016000604051808303818588803b1580156100d657600080fd5b505af11580156100ea573d6000803e3d6000fd5b50505050505b005b600080fd5b34801561010357600080fd5b506100f0610112366004610974565b6101de565b34801561012357600080fd5b5061014b7f000000000000000000000000000000000000000000000000000000000000000081565b60405173ffffffffffffffffffffffffffffffffffffffff909116815260200160405180910390f35b34801561018057600080fd5b5061014b7f000000000000000000000000000000000000000000000000000000000000000081565b3480156101b457600080fd5b506100f06101c336600461099f565b610318565b3480156101d457600080fd5b5061014b61101081565b6101e6610499565b610213600080547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff00169055565b6040517f70a082310000000000000000000000000000000000000000000000000000000081523060048201526102e5907f00000000000000000000000000000000000000000000000000000000000000009073ffffffffffffffffffffffffffffffffffffffff8416906370a0823190602401602060405180830381865afa1580156102a3573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906102c791906109e1565b73ffffffffffffffffffffffffffffffffffffffff8416919061050c565b610315600080547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff00166001179055565b50565b610320610499565b61034d600080547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff00169055565b61036f73ffffffffffffffffffffffffffffffffffffffff84163330856105e0565b6040517f2e1a7d4d0000000000000000000000000000000000000000000000000000000081526004810183905273ffffffffffffffffffffffffffffffffffffffff841690632e1a7d4d90602401600060405180830381600087803b1580156103d757600080fd5b505af11580156103eb573d6000803e3d6000fd5b505050508015610464576040517f2e1a7d4d0000000000000000000000000000000000000000000000000000000081526004810183905261101090632e1a7d4d9084906024016000604051808303818588803b15801561044a57600080fd5b505af115801561045e573d6000803e3d6000fd5b50505050505b610494600080547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff00166001179055565b505050565b60005460ff1661050a576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601f60248201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c0060448201526064015b60405180910390fd5b565b60405173ffffffffffffffffffffffffffffffffffffffff83166024820152604481018290526104949084907fa9059cbb00000000000000000000000000000000000000000000000000000000906064015b604080517fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe08184030181529190526020810180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff167fffffffff0000000000000000000000000000000000000000000000000000000090931692909217909152610644565b60405173ffffffffffffffffffffffffffffffffffffffff8085166024830152831660448201526064810182905261063e9085907f23b872dd000000000000000000000000000000000000000000000000000000009060840161055e565b50505050565b60006106a6826040518060400160405280602081526020017f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c65648152508573ffffffffffffffffffffffffffffffffffffffff166107509092919063ffffffff16565b80519091501561049457808060200190518101906106c491906109fa565b610494576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602a60248201527f5361666545524332303a204552433230206f7065726174696f6e20646964206e60448201527f6f742073756363656564000000000000000000000000000000000000000000006064820152608401610501565b606061075f8484600085610769565b90505b9392505050565b6060824710156107fb576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602660248201527f416464726573733a20696e73756666696369656e742062616c616e636520666f60448201527f722063616c6c00000000000000000000000000000000000000000000000000006064820152608401610501565b73ffffffffffffffffffffffffffffffffffffffff85163b610879576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e74726163740000006044820152606401610501565b6000808673ffffffffffffffffffffffffffffffffffffffff1685876040516108a29190610a43565b60006040518083038185875af1925050503d80600081146108df576040519150601f19603f3d011682016040523d82523d6000602084013e6108e4565b606091505b50915091506108f48282866108ff565b979650505050505050565b6060831561090e575081610762565b82511561091e5782518084602001fd5b816040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016105019190610a5f565b73ffffffffffffffffffffffffffffffffffffffff8116811461031557600080fd5b60006020828403121561098657600080fd5b813561076281610952565b801515811461031557600080fd5b6000806000606084860312156109b457600080fd5b83356109bf81610952565b92506020840135915060408401356109d681610991565b809150509250925092565b6000602082840312156109f357600080fd5b5051919050565b600060208284031215610a0c57600080fd5b815161076281610991565b60005b83811015610a32578181015183820152602001610a1a565b8381111561063e5750506000910152565b60008251610a55818460208701610a17565b9190910192915050565b6020815260008251806020840152610a7e816040850160208701610a17565b601f017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe016919091016040019291505056fea2646970667358221220f1cc848e3ad63c2a8228332d4710a19a242bf1490810efee19a4398900eb127464736f6c634300080b0033", + "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.", + "isMatic": "True if token is MATIC.", + "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." + } + }, + "notice": "Contract deployed on Ethereum and Polygon to facilitate token transfers from Polygon to the HubPool and back.", + "version": 1 + }, + "storageLayout": { + "storage": [ + { + "astId": 7114, + "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/polygon-mumbai/Polygon_SpokePool.json b/deployments/polygon-mumbai/Polygon_SpokePool.json new file mode 100644 index 000000000..cdae88be0 --- /dev/null +++ b/deployments/polygon-mumbai/Polygon_SpokePool.json @@ -0,0 +1,1658 @@ +{ + "address": "0xC50c8cEd449321a6c506a5Da409D9eDe7269ac3a", + "abi": [ + { + "inputs": [ + { + "internalType": "contract PolygonTokenBridger", + "name": "_polygonTokenBridger", + "type": "address" + }, + { + "internalType": "address", + "name": "_crossDomainAdmin", + "type": "address" + }, + { + "internalType": "address", + "name": "_hubPool", + "type": "address" + }, + { + "internalType": "address", + "name": "_wmaticAddress", + "type": "address" + }, + { + "internalType": "address", + "name": "_fxChild", + "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": "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": "token", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "receiver", + "type": "address" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "amount", + "type": "uint256" + } + ], + "name": "PolygonTokensBridged", + "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": "newFxChild", + "type": "address" + } + ], + "name": "SetFxChild", + "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": "polygonTokenBridger", + "type": "address" + } + ], + "name": "SetPolygonTokenBridger", + "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": "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": "fxChild", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "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": "polygonTokenBridger", + "outputs": [ + { + "internalType": "contract PolygonTokenBridger", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + }, + { + "internalType": "address", + "name": "rootMessageSender", + "type": "address" + }, + { + "internalType": "bytes", + "name": "data", + "type": "bytes" + } + ], + "name": "processMessageFromRoot", + "outputs": [], + "stateMutability": "nonpayable", + "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": "newFxChild", + "type": "address" + } + ], + "name": "setFxChild", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "newHubPool", + "type": "address" + } + ], + "name": "setHubPool", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address payable", + "name": "newPolygonTokenBridger", + "type": "address" + } + ], + "name": "setPolygonTokenBridger", + "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" + }, + { + "stateMutability": "payable", + "type": "receive" + } + ], + "transactionHash": "0x20606bf46402e0e80612aeb12b1ef526d0aad891494326f2b32686ab1d0c1bcc", + "receipt": { + "to": null, + "from": "0x9A8f92a830A5cB89a3816e3D267CB7791c16b04D", + "contractAddress": "0xC50c8cEd449321a6c506a5Da409D9eDe7269ac3a", + "transactionIndex": 8, + "gasUsed": "3933744", + "logsBloom": "0x00000000000000020000000000000000000000000000002000000000001000000000000000000000000000000800000000208000000000000000000000000000000000000000010000000000000000800000000000000000000100000000000000000000000000000000000000000000000800000000000080000000040000000000000000000000000000000000000040000000000000000000000000000000200000000000000020000000000002000001000000000000000000000000004000000000000000801001000000000000000080000000020000100000000000000001000000000000000000000000000000000400000000000000000000100000", + "blockHash": "0x14c0a3fc9e487f647afa0875ed8fadcf2147d4a812c1908ca2848f10ddd3375a", + "transactionHash": "0x20606bf46402e0e80612aeb12b1ef526d0aad891494326f2b32686ab1d0c1bcc", + "logs": [ + { + "transactionIndex": 8, + "blockNumber": 25535123, + "transactionHash": "0x20606bf46402e0e80612aeb12b1ef526d0aad891494326f2b32686ab1d0c1bcc", + "address": "0xC50c8cEd449321a6c506a5Da409D9eDe7269ac3a", + "topics": [ + "0xa9e8c42c9e7fca7f62755189a16b2f5314d43d8fb24e91ba54e6d65f9314e849", + "0x000000000000000000000000e1fc1eb80db9ad0160aef6998673625bc2a09d14" + ], + "data": "0x", + "logIndex": 117, + "blockHash": "0x14c0a3fc9e487f647afa0875ed8fadcf2147d4a812c1908ca2848f10ddd3375a" + }, + { + "transactionIndex": 8, + "blockNumber": 25535123, + "transactionHash": "0x20606bf46402e0e80612aeb12b1ef526d0aad891494326f2b32686ab1d0c1bcc", + "address": "0xC50c8cEd449321a6c506a5Da409D9eDe7269ac3a", + "topics": [ + "0x1f17a88f67b0f49060a34bec1a4723a563620e6aa265eb640b5046dcee0759a0", + "0x000000000000000000000000e1fc1eb80db9ad0160aef6998673625bc2a09d14" + ], + "data": "0x", + "logIndex": 118, + "blockHash": "0x14c0a3fc9e487f647afa0875ed8fadcf2147d4a812c1908ca2848f10ddd3375a" + }, + { + "transactionIndex": 8, + "blockNumber": 25535123, + "transactionHash": "0x20606bf46402e0e80612aeb12b1ef526d0aad891494326f2b32686ab1d0c1bcc", + "address": "0x0000000000000000000000000000000000001010", + "topics": [ + "0x4dfe1bbbcf077ddc3e01291eea2d5c70c2b422b415d95645b9adcfd678cb1d63", + "0x0000000000000000000000000000000000000000000000000000000000001010", + "0x0000000000000000000000009a8f92a830a5cb89a3816e3d267cb7791c16b04d", + "0x000000000000000000000000c26880a0af2ea0c7e8130e6ec47af756465452e8" + ], + "data": "0x00000000000000000000000000000000000000000000000001178262ebe0c0300000000000000000000000000000000000000000000000000dd23363e8a2f65e0000000000000000000000000000000000000000000007fb6822c949835fb6180000000000000000000000000000000000000000000000000cbab100fcc2362e0000000000000000000000000000000000000000000007fb693a4bac6f407648", + "logIndex": 119, + "blockHash": "0x14c0a3fc9e487f647afa0875ed8fadcf2147d4a812c1908ca2848f10ddd3375a" + } + ], + "blockNumber": 25535123, + "cumulativeGasUsed": "6108136", + "status": 1, + "byzantium": true + }, + "args": [ + "0xe9D669a4A28aBF4C77c1c6f98942638b7A9aEaC9", + "0xe1fC1EB80db9AD0160AEF6998673625bc2a09d14", + "0xe1fC1EB80db9AD0160AEF6998673625bc2a09d14", + "0x9c3C9283D3e44854697Cd22D3Faa240Cfb032889", + "0xCf73231F28B7331BBe3124B907840A94851f9f11", + "0x0000000000000000000000000000000000000000" + ], + "numDeployments": 1, + "solcInputHash": "a6be65618c7af0eb8c96b985a450affc", + "metadata": "{\"compiler\":{\"version\":\"0.8.11+commit.d7f03943\"},\"language\":\"Solidity\",\"output\":{\"abi\":[{\"inputs\":[{\"internalType\":\"contract PolygonTokenBridger\",\"name\":\"_polygonTokenBridger\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"_crossDomainAdmin\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"_hubPool\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"_wmaticAddress\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"_fxChild\",\"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\":\"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\":\"token\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"receiver\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"}],\"name\":\"PolygonTokensBridged\",\"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\":\"newFxChild\",\"type\":\"address\"}],\"name\":\"SetFxChild\",\"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\":\"polygonTokenBridger\",\"type\":\"address\"}],\"name\":\"SetPolygonTokenBridger\",\"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\":\"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\":\"fxChild\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"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\":\"polygonTokenBridger\",\"outputs\":[{\"internalType\":\"contract PolygonTokenBridger\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"},{\"internalType\":\"address\",\"name\":\"rootMessageSender\",\"type\":\"address\"},{\"internalType\":\"bytes\",\"name\":\"data\",\"type\":\"bytes\"}],\"name\":\"processMessageFromRoot\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"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\":\"newFxChild\",\"type\":\"address\"}],\"name\":\"setFxChild\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"newHubPool\",\"type\":\"address\"}],\"name\":\"setHubPool\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address payable\",\"name\":\"newPolygonTokenBridger\",\"type\":\"address\"}],\"name\":\"setPolygonTokenBridger\",\"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\"},{\"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.\",\"_fxChild\":\"FxChild contract, changeable by Admin.\",\"_hubPool\":\"Hub pool address to set. Can be changed by admin.\",\"_polygonTokenBridger\":\"Token routing contract that sends tokens from here to HubPool. Changeable by Admin.\",\"_wmaticAddress\":\"Replaces _wethAddress for this network since MATIC is the gas token and sent via msg.value on Polygon.\",\"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 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.\"}},\"processMessageFromRoot(uint256,address,bytes)\":{\"details\":\"stateId value isn't used because it isn't relevant for this method. It doesn't care what state sync triggered this call.\",\"params\":{\"data\":\"ABI encoded function call to execute on this contract.\",\"rootMessageSender\":\"Original L1 sender of data.\"}},\"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.\"}},\"setFxChild(address)\":{\"params\":{\"newFxChild\":\"New FxChild.\"}},\"setHubPool(address)\":{\"params\":{\"newHubPool\":\"New hub pool.\"}},\"setPolygonTokenBridger(address)\":{\"params\":{\"newPolygonTokenBridger\":\"New Polygon Token Bridger contract.\"}},\"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 Polygon 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 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.\"},\"processMessageFromRoot(uint256,address,bytes)\":{\"notice\":\"Called by FxChild upon receiving L1 message that targets this contract. Performs an additional check that the L1 caller was the expected cross domain admin, and then delegate calls.Polygon bridge only executes this external function on the target Polygon contract when relaying messages from L1, so all functions on this SpokePool are expected to originate via this call.\"},\"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.\"},\"setFxChild(address)\":{\"notice\":\"Change FxChild address. Callable only by admin via processMessageFromRoot.\"},\"setHubPool(address)\":{\"notice\":\"Change L1 hub pool address. Callable by admin only.\"},\"setPolygonTokenBridger(address)\":{\"notice\":\"Change polygonTokenBridger address. Callable only by admin via processMessageFromRoot.\"},\"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\":\"Polygon specific SpokePool.\",\"version\":1}},\"settings\":{\"compilationTarget\":{\"contracts/Polygon_SpokePool.sol\":\"Polygon_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 (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 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 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\":\"0x55308c0cc6f1bd7fc05c9fe23e7333e67d2405f01d27467e9dc34a1892e0c5e4\",\"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/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\",\"keccak256\":\"0x25193122b8b7e3c69b16ff876d37da95d86ea86cbf2bbaaa2fc4174535b17f94\",\"license\":\"AGPL-3.0-only\"},\"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\",\"keccak256\":\"0xabaacbc553b6dfd66eea008e1b5db19691aaf445298ccc2f23a5bfe6804e9b5c\",\"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 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 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 * @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 {\\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 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\":\"0x93dabfc8d23654e9d613cfe9e03834a8d69d3a848416f1f434d84bd49567ec74\",\"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 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\":\"0xf5fb5cf93d68052bc380b78b84cfe8e0eb11cb47dc362dd8eb2b029839bd4522\",\"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": "0x60806040526003805463ffffffff60c01b1916604b60c31b1790556008805460ff60a01b191690553480156200003457600080fd5b5060405162004796380380620047968339810160408190526200005791620002fe565b600080546001600160a81b0319166001600160a01b03831617600160a01b17905584848483620000878462000108565b6200009283620001ae565b6200009c62000250565b600380546001600160c01b031916600160a01b63ffffffff93909316929092026001600160a01b0319908116929092176001600160a01b039485161790556008805482169b84169b909b17909a55506007805490991694169390931790965550620003ac945050505050565b6001600160a01b038116620001645760405162461bcd60e51b815260206004820152601960248201527f4261642062726964676520726f7574657220616464726573730000000000000060448201526064015b60405180910390fd5b600180546001600160a01b0319166001600160a01b0383169081179091556040517fa9e8c42c9e7fca7f62755189a16b2f5314d43d8fb24e91ba54e6d65f9314e84990600090a250565b6001600160a01b038116620002065760405162461bcd60e51b815260206004820152601460248201527f4261642068756220706f6f6c206164647265737300000000000000000000000060448201526064016200015b565b600280546001600160a01b0319166001600160a01b0383169081179091556040517f1f17a88f67b0f49060a34bec1a4723a563620e6aa265eb640b5046dcee0759a090600090a250565b600080546001600160a01b031615620002e05760008054906101000a90046001600160a01b03166001600160a01b03166329cb924d6040518163ffffffff1660e01b8152600401602060405180830381865afa158015620002b5573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190620002db919062000392565b905090565b504290565b6001600160a01b0381168114620002fb57600080fd5b50565b60008060008060008060c087890312156200031857600080fd5b86516200032581620002e5565b60208801519096506200033881620002e5565b60408801519095506200034b81620002e5565b60608801519094506200035e81620002e5565b60808801519093506200037181620002e5565b60a08801519092506200038481620002e5565b809150509295509295509295565b600060208284031215620003a557600080fd5b5051919050565b6143da80620003bc6000396000f3fe6080604052600436106101dc5760003560e01c806389a153cc11610102578063de7eba7811610095578063ee2a53f811610064578063ee2a53f814610636578063f06850f61461066b578063f500697c14610698578063ffc351a3146106b857600080fd5b8063de7eba7814610594578063e1904402146105b4578063e282d5b9146105e1578063ecda10f51461060157600080fd5b8063a1244c67116100d1578063a1244c67146104f7578063ac9650d814610534578063b86cfdcf14610554578063c894c0ca1461057457600080fd5b806389a153cc146104845780638a7860ce146104a45780639a7c4b71146104c45780639a8a0592146104e457600080fd5b80633edb89d11161017a578063493a4f8411610149578063493a4f841461039e5780635249fef1146103be5780635285e0581461040957806357f6dcb81461043657600080fd5b80633edb89d1146103045780633fc8cef314610331578063450d11f01461035e578063492289781461038b57600080fd5b806322f8e566116101b657806322f8e56614610281578063272751c7146102a15780632752042e146102c157806329cb924d146102e157600080fd5b806313fb77ee146101e85780631c39c38d1461020a5780631dfb2d021461026157600080fd5b366101e357005b600080fd5b3480156101f457600080fd5b50610208610203366004613424565b6106d8565b005b34801561021657600080fd5b506000546102379073ffffffffffffffffffffffffffffffffffffffff1681565b60405173ffffffffffffffffffffffffffffffffffffffff90911681526020015b60405180910390f35b34801561026d57600080fd5b5061020861027c366004613424565b61074f565b34801561028d57600080fd5b5061020861029c366004613451565b610763565b3480156102ad57600080fd5b506102086102bc366004613478565b61080c565b3480156102cd57600080fd5b506102086102dc3660046134ce565b6108aa565b3480156102ed57600080fd5b506102f6610939565b604051908152602001610258565b34801561031057600080fd5b506008546102379073ffffffffffffffffffffffffffffffffffffffff1681565b34801561033d57600080fd5b506003546102379073ffffffffffffffffffffffffffffffffffffffff1681565b34801561036a57600080fd5b506007546102379073ffffffffffffffffffffffffffffffffffffffff1681565b610208610399366004613501565b6109f1565b3480156103aa57600080fd5b506102086103b936600461356b565b610ea1565b3480156103ca57600080fd5b506103f96103d936600461358d565b600460209081526000928352604080842090915290825290205460ff1681565b6040519015158152602001610258565b34801561041557600080fd5b506001546102379073ffffffffffffffffffffffffffffffffffffffff1681565b34801561044257600080fd5b5060035461046f907801000000000000000000000000000000000000000000000000900463ffffffff1681565b60405163ffffffff9091168152602001610258565b34801561049057600080fd5b5061020861049f3660046135b9565b610f4f565b3480156104b057600080fd5b506102086104bf366004613451565b61109f565b3480156104d057600080fd5b506102086104df36600461365d565b6110fd565b3480156104f057600080fd5b50466102f6565b34801561050357600080fd5b5060035461046f907c0100000000000000000000000000000000000000000000000000000000900463ffffffff1681565b6105476105423660046136e6565b6113bd565b60405161025891906137d1565b34801561056057600080fd5b5061020861056f366004613424565b611597565b34801561058057600080fd5b5061020861058f3660046139eb565b61160e565b3480156105a057600080fd5b506102086105af366004613424565b611697565b3480156105c057600080fd5b506002546102379073ffffffffffffffffffffffffffffffffffffffff1681565b3480156105ed57600080fd5b506102086105fc366004613b7e565b6116a8565b34801561060d57600080fd5b5060035461046f9074010000000000000000000000000000000000000000900463ffffffff1681565b34801561064257600080fd5b50610656610651366004613451565b61178b565b60408051928352602083019190915201610258565b34801561067757600080fd5b506102f6610686366004613451565b60066020526000908152604090205481565b3480156106a457600080fd5b506102086106b3366004613bef565b6117b9565b3480156106c457600080fd5b506102086106d3366004613cbc565b611844565b6106e06119a3565b600880547fffffffffffffffffffffffff00000000000000000000000000000000000000001673ffffffffffffffffffffffffffffffffffffffff83169081179091556040517f6ade7bc58132776cc11d9b570837a732329396078de17b87db95463ca7f5d25f90600090a250565b6107576119a3565b61076081611a29565b50565b60005473ffffffffffffffffffffffffffffffffffffffff1661078557600080fd5b6000546040517f22f8e5660000000000000000000000000000000000000000000000000000000081526004810183905273ffffffffffffffffffffffffffffffffffffffff909116906322f8e56690602401600060405180830381600087803b1580156107f157600080fd5b505af1158015610805573d6000803e3d6000fd5b5050505050565b6108146119a3565b73ffffffffffffffffffffffffffffffffffffffff8316600081815260046020908152604080832086845282529182902080547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff001685151590811790915591519182528492917f0a21fdd43d0ad0c62689ee7230a47309a050755bcc52eba00310add65297692a910160405180910390a3505050565b6108b26119a3565b600380547fffffffff00000000ffffffffffffffffffffffffffffffffffffffffffffffff16780100000000000000000000000000000000000000000000000063ffffffff8416908102919091179091556040519081527f0e55dd180fa793d9036c804d0a116e6a7617a48e72cee1f83d92793a793fcc039060200160405180910390a150565b6000805473ffffffffffffffffffffffffffffffffffffffff16156109ec5760008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166329cb924d6040518163ffffffff1660e01b8152600401602060405180830381865afa1580156109c3573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906109e79190613d9a565b905090565b504290565b73ffffffffffffffffffffffffffffffffffffffff851660009081526004602090815260408083208684529091529020548590849060ff16610a94576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152600e60248201527f44697361626c656420726f75746500000000000000000000000000000000000060448201526064015b60405180910390fd5b610a9c611b15565b610ac9600080547fffffffffffffffffffffff00ffffffffffffffffffffffffffffffffffffffff169055565b6706f05b59d3b200008467ffffffffffffffff1610610b44576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601360248201527f696e76616c69642072656c6179657220666565000000000000000000000000006044820152606401610a8b565b600354610b73907801000000000000000000000000000000000000000000000000900463ffffffff1684613de2565b63ffffffff16610b81610939565b10158015610bca5750600354610bb9907801000000000000000000000000000000000000000000000000900463ffffffff1684613e07565b63ffffffff16610bc7610939565b11155b610c30576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601260248201527f696e76616c69642071756f74652074696d6500000000000000000000000000006044820152606401610a8b565b60035473ffffffffffffffffffffffffffffffffffffffff8881169116148015610c5a5750600034115b15610d5057853414610cc8576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601b60248201527f6d73672e76616c7565206d757374206d6174636820616d6f756e7400000000006044820152606401610a8b565b600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663d0e30db0346040518263ffffffff1660e01b81526004016000604051808303818588803b158015610d3257600080fd5b505af1158015610d46573d6000803e3d6000fd5b5050505050610d72565b610d7273ffffffffffffffffffffffffffffffffffffffff8816333089611b99565b600354604080518881526020810188905267ffffffffffffffff87168183015263ffffffff868116606083015273ffffffffffffffffffffffffffffffffffffffff8c8116608084015292513394938c16937c01000000000000000000000000000000000000000000000000000000009004909116917ffc53c5b967d467d4136291c639720626f3d6dda97b4364da813e6858ad48a721919081900360a00190a460016003601c8282829054906101000a900463ffffffff16610e359190613e07565b92506101000a81548163ffffffff021916908363ffffffff160217905550610e97600080547fffffffffffffffffffffff00ffffffffffffffffffffffffffffffffffffffff1674010000000000000000000000000000000000000000179055565b5050505050505050565b610ea96119a3565b60058054600181018255600091909152600381027f036b6384b5eca791c62761152d0c79bb0604c104a5fb6f4eb0703f3154bb3db181018490557f036b6384b5eca791c62761152d0c79bb0604c104a5fb6f4eb0703f3154bb3db001828155604080518581526020810185905263ffffffff8416917fc86ba04c55bc5eb2f2876b91c438849a296dbec7b08751c3074d92e04f0a77af910160405180910390a250505050565b610f57611b15565b610f84600080547fffffffffffffffffffffff00ffffffffffffffffffffffffffffffffffffffff169055565b60006040518061010001604052808c73ffffffffffffffffffffffffffffffffffffffff1681526020018b73ffffffffffffffffffffffffffffffffffffffff1681526020018a73ffffffffffffffffffffffffffffffffffffffff1681526020018981526020018681526020018567ffffffffffffffff1681526020018467ffffffffffffffff1681526020018363ffffffff168152509050600061102982611c75565b9050600061103b82848b886000611ca5565b905061104c82828a88876000611f33565b505050611093600080547fffffffffffffffffffffff00ffffffffffffffffffffffffffffffffffffffff1674010000000000000000000000000000000000000000179055565b50505050505050505050565b6110a76119a3565b600581815481106110ba576110ba613e2f565b60009182526020822060039091020181815560010181905560405182917f3569b846531b754c99cb80df3f49cd72fa6fe106aaee5ab8e0caf35a9d7ce88d91a250565b600880547fffffffffffffffffffffff00ffffffffffffffffffffffffffffffffffffffff1674010000000000000000000000000000000000000000179055611144611b15565b611171600080547fffffffffffffffffffffff00ffffffffffffffffffffffffffffffffffffffff169055565b60075473ffffffffffffffffffffffffffffffffffffffff1633146111f2576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601060248201527f4e6f742066726f6d2066784368696c64000000000000000000000000000000006044820152606401610a8b565b60015473ffffffffffffffffffffffffffffffffffffffff848116911614611276576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601660248201527f4e6f742066726f6d206d61696e6e65742061646d696e000000000000000000006044820152606401610a8b565b60003073ffffffffffffffffffffffffffffffffffffffff16838360405161129f929190613e5e565b600060405180830381855af49150503d80600081146112da576040519150601f19603f3d011682016040523d82523d6000602084013e6112df565b606091505b505090508061134a576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601360248201527f64656c656761746563616c6c206661696c6564000000000000000000000000006044820152606401610a8b565b5061138f600080547fffffffffffffffffffffff00ffffffffffffffffffffffffffffffffffffffff1674010000000000000000000000000000000000000000179055565b5050600880547fffffffffffffffffffffff00ffffffffffffffffffffffffffffffffffffffff1690555050565b60603415611427576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601b60248201527f4f6e6c79206d756c746963616c6c207769746820302076616c756500000000006044820152606401610a8b565b8167ffffffffffffffff81111561144057611440613851565b60405190808252806020026020018201604052801561147357816020015b606081526020019060019003908161145e5790505b50905060005b82811015611590576000803086868581811061149757611497613e2f565b90506020028101906114a99190613e6e565b6040516114b7929190613e5e565b600060405180830381855af49150503d80600081146114f2576040519150601f19603f3d011682016040523d82523d6000602084013e6114f7565b606091505b50915091508161155d5760448151101561151057600080fd5b6004810190508080602001905181019061152a9190613ed3565b6040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610a8b9190613f41565b8084848151811061157057611570613e2f565b60200260200101819052505050808061158890613f54565b915050611479565b5092915050565b61159f6119a3565b600780547fffffffffffffffffffffffff00000000000000000000000000000000000000001673ffffffffffffffffffffffffffffffffffffffff83169081179091556040517f573834b6d6901b74ef64eeb676a0b99d7946df822b7021e44ee0da19d846c49590600090a250565b611616611b15565b611643600080547fffffffffffffffffffffff00ffffffffffffffffffffffffffffffffffffffff169055565b61164e838383612058565b611692600080547fffffffffffffffffffffff00ffffffffffffffffffffffffffffffffffffffff1674010000000000000000000000000000000000000000179055565b505050565b61169f6119a3565b6107608161241e565b6116b0611b15565b6116dd600080547fffffffffffffffffffffff00ffffffffffffffffffffffffffffffffffffffff169055565b6116ea844685858561250a565b8373ffffffffffffffffffffffffffffffffffffffff168263ffffffff167fb9de16bf376724405019a10ef4fedac57fecd292bf86c08d81d7c42d394d5d378584604051611739929190613f8d565b60405180910390a3611785600080547fffffffffffffffffffffff00ffffffffffffffffffffffffffffffffffffffff1674010000000000000000000000000000000000000000179055565b50505050565b6005818154811061179b57600080fd5b60009182526020909120600390910201805460019091015490915082565b6117c1611b15565b6117ee600080547fffffffffffffffffffffff00ffffffffffffffffffffffffffffffffffffffff169055565b6118008a8a8a8a8a8a8a8a8a8a6125a7565b611093600080547fffffffffffffffffffffff00ffffffffffffffffffffffffffffffffffffffff1674010000000000000000000000000000000000000000179055565b61184c611b15565b611879600080547fffffffffffffffffffffff00ffffffffffffffffffffffffffffffffffffffff169055565b6118868c8785858561250a565b60006040518061010001604052808e73ffffffffffffffffffffffffffffffffffffffff1681526020018d73ffffffffffffffffffffffffffffffffffffffff1681526020018c73ffffffffffffffffffffffffffffffffffffffff1681526020018b81526020018881526020018767ffffffffffffffff1681526020018667ffffffffffffffff1681526020018463ffffffff168152509050600061192b82611c75565b9050600061193d82848d896000611ca5565b905061194e82828c89876000611f33565b505050611995600080547fffffffffffffffffffffff00ffffffffffffffffffffffffffffffffffffffff1674010000000000000000000000000000000000000000179055565b505050505050505050505050565b60085474010000000000000000000000000000000000000000900460ff16611a27576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820181905260248201527f4d7573742063616c6c2070726f636573734d65737361676546726f6d526f6f746044820152606401610a8b565b565b73ffffffffffffffffffffffffffffffffffffffff8116611aa6576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601460248201527f4261642068756220706f6f6c20616464726573730000000000000000000000006044820152606401610a8b565b600280547fffffffffffffffffffffffff00000000000000000000000000000000000000001673ffffffffffffffffffffffffffffffffffffffff83169081179091556040517f1f17a88f67b0f49060a34bec1a4723a563620e6aa265eb640b5046dcee0759a090600090a250565b60005474010000000000000000000000000000000000000000900460ff16611a27576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601f60248201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c006044820152606401610a8b565b60405173ffffffffffffffffffffffffffffffffffffffff808516602483015283166044820152606481018290526117859085907f23b872dd00000000000000000000000000000000000000000000000000000000906084015b604080517fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe08184030181529190526020810180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff167fffffffff000000000000000000000000000000000000000000000000000000009093169290921790915261271f565b600081604051602001611c889190613fb0565b604051602081830303815290604052805190602001209050919050565b60006706f05b59d3b200008367ffffffffffffffff16108015611cdd57506706f05b59d3b200008560a0015167ffffffffffffffff16105b611d43576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152600c60248201527f696e76616c6964206665657300000000000000000000000000000000000000006044820152606401610a8b565b606085015160008781526006602052604090205410611dbe576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152600c60248201527f72656c61792066696c6c656400000000000000000000000000000000000000006044820152606401610a8b565b83611dcb57506000611f2a565b611de484848760a00151611ddf919061403c565b61282b565b60008781526006602052604081205460608801519293508692611e07919061405f565b905082811015611e3057809250611e2d83868960a00151611e28919061403c565b61286c565b91505b60008881526006602052604081208054859290611e4e908490614076565b9091555050600354604088015173ffffffffffffffffffffffffffffffffffffffff90811691161415611eba5783611ea7576040870151611ea79073ffffffffffffffffffffffffffffffffffffffff16333085611b99565b611eb5876020015183612895565b611f27565b83611ef457611eb5338860200151848a6040015173ffffffffffffffffffffffffffffffffffffffff16611b99909392919063ffffffff16565b611f27876020015183896040015173ffffffffffffffffffffffffffffffffffffffff166129a19092919063ffffffff16565b50505b95945050505050565b816000015173ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16877fedf6b64f49870333280b7dcf98ec56c6b9ff7cf50aa9be7caecb3874e961849f8560600151600660008c8152602001908152602001600020548a8a89608001518b8b60a001518c60e001518d604001518e602001518e6040516120489b9a999897969594939291909a8b5260208b019990995260408a01979097526060890195909552608088019390935267ffffffffffffffff91821660a08801521660c086015263ffffffff1660e085015273ffffffffffffffffffffffffffffffffffffffff9081166101008501521661012083015215156101408201526101600190565b60405180910390a4505050505050565b468260200151146120c5576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152600f60248201527f496e76616c696420636861696e496400000000000000000000000000000000006044820152606401610a8b565b8160400151518260a001515114612138576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152600c60248201527f696e76616c6964206c65616600000000000000000000000000000000000000006044820152606401610a8b565b600060058463ffffffff168154811061215357612153613e2f565b90600052602060002090600302019050612172816001015484846129f7565b6121d8576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152600960248201527f4261642050726f6f6600000000000000000000000000000000000000000000006044820152606401610a8b565b6121ef81600201846060015163ffffffff16612a32565b15612256576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152600f60248201527f416c726561647920636c61696d656400000000000000000000000000000000006044820152606401610a8b565b61226d81600201846060015163ffffffff16612a73565b60005b8360400151518163ffffffff16101561231957600084604001518263ffffffff16815181106122a1576122a1613e2f565b602002602001015190506000811115612306576123068560a001518363ffffffff16815181106122d3576122d3613e2f565b602002602001015182876080015173ffffffffffffffffffffffffffffffffffffffff166129a19092919063ffffffff16565b50806123118161408e565b915050612270565b508251156123b25761232a83612ab1565b826080015173ffffffffffffffffffffffffffffffffffffffff16836060015163ffffffff1684602001517f828fc203220356df8f072a91681caee7d5c75095e2a95e80ed5a14b384697f718660000151336040516123a992919091825273ffffffffffffffffffffffffffffffffffffffff16602082015260400190565b60405180910390a45b826060015163ffffffff168463ffffffff1684602001517ff8bd640004bcec1b89657020f561d0b070cbdf662d0b158db9dccb0a8301bfab8660000151876040015188608001518960a0015133604051612410959493929190614133565b60405180910390a450505050565b73ffffffffffffffffffffffffffffffffffffffff811661249b576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601960248201527f4261642062726964676520726f757465722061646472657373000000000000006044820152606401610a8b565b600180547fffffffffffffffffffffffff00000000000000000000000000000000000000001673ffffffffffffffffffffffffffffffffffffffff83169081179091556040517fa9e8c42c9e7fca7f62755189a16b2f5314d43d8fb24e91ba54e6d65f9314e84990600090a250565b60408051608060208201819052601160a08301527f4143524f53532d56322d4645452d312e3000000000000000000000000000000060c083015267ffffffffffffffff86169282019290925263ffffffff8416606082015290810185905260009060e001604051602081830303815290604052805190602001209050600061259182612bf5565b905061259e878285612c30565b50505050505050565b60006040518061010001604052808c73ffffffffffffffffffffffffffffffffffffffff1681526020018b73ffffffffffffffffffffffffffffffffffffffff1681526020018a73ffffffffffffffffffffffffffffffffffffffff1681526020018981526020018881526020018767ffffffffffffffff1681526020018667ffffffffffffffff1681526020018563ffffffff16815250905061267660058463ffffffff168154811061265d5761265d613e2f565b9060005260206000209060030201600001548284612ca1565b6126dc576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152600d60248201527f496e76616c69642070726f6f66000000000000000000000000000000000000006044820152606401610a8b565b60006126e782611c75565b905060006126fe8284856060015160006001611ca5565b90506127108282600080876001611f33565b50505050505050505050505050565b6000612781826040518060400160405280602081526020017f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c65648152508573ffffffffffffffffffffffffffffffffffffffff16612cb99092919063ffffffff16565b805190915015611692578080602001905181019061279f9190614191565b611692576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602a60248201527f5361666545524332303a204552433230206f7065726174696f6e20646964206e60448201527f6f742073756363656564000000000000000000000000000000000000000000006064820152608401610a8b565b600061283f82670de0b6b3a76400006141ae565b67ffffffffffffffff1661285b84670de0b6b3a76400006141cf565b612865919061423b565b9392505050565b6000670de0b6b3a764000061288183826141ae565b61285b9067ffffffffffffffff16856141cf565b73ffffffffffffffffffffffffffffffffffffffff82163b156128da576003546128d69073ffffffffffffffffffffffffffffffffffffffff1683836129a1565b5050565b6003546040517f2e1a7d4d0000000000000000000000000000000000000000000000000000000081526004810183905273ffffffffffffffffffffffffffffffffffffffff90911690632e1a7d4d90602401600060405180830381600087803b15801561294657600080fd5b505af115801561295a573d6000803e3d6000fd5b505060405173ffffffffffffffffffffffffffffffffffffffff8516925083156108fc02915083906000818181858888f19350505050158015611692573d6000803e3d6000fd5b60405173ffffffffffffffffffffffffffffffffffffffff83166024820152604481018290526116929084907fa9059cbb0000000000000000000000000000000000000000000000000000000090606401611bf3565b6000612a2a828585604051602001612a0f919061424f565b60405160208183030381529060405280519060200120612cc8565b949350505050565b600080612a416101008461423b565b90506000612a51610100856142ea565b6000928352602095909552506040902054600190931b92831690921492915050565b6000612a816101008361423b565b90506000612a91610100846142ea565b600092835260209490945250604090208054600190931b90921790915550565b60085481516080830151612ae09273ffffffffffffffffffffffffffffffffffffffff91821692911690612cde565b600854608082015182516003546040517fd124dc4f00000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff938416600482018190526024820193909352908316909114604482015291169063d124dc4f90606401600060405180830381600087803b158015612b6b57600080fd5b505af1158015612b7f573d6000803e3d6000fd5b505050503073ffffffffffffffffffffffffffffffffffffffff16816080015173ffffffffffffffffffffffffffffffffffffffff167ff6003d597c8a5b43987488bd11bfd2ed0c5a14172ae0f7ce18894e7b004915be8360000151604051612bea91815260200190565b60405180910390a350565b6040517f19457468657265756d205369676e6564204d6573736167653a0a3332000000006020820152603c8101829052600090605c01611c88565b612c3b838383612ddc565b611692576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601160248201527f696e76616c6964207369676e61747572650000000000000000000000000000006044820152606401610a8b565b6000612a2a828585604051602001612a0f9190613fb0565b6060612a2a8484600085612fcb565b600082612cd58584613161565b14949350505050565b6040517fdd62ed3e00000000000000000000000000000000000000000000000000000000815230600482015273ffffffffffffffffffffffffffffffffffffffff8381166024830152600091839186169063dd62ed3e90604401602060405180830381865afa158015612d55573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190612d799190613d9a565b612d839190614076565b60405173ffffffffffffffffffffffffffffffffffffffff85166024820152604481018290529091506117859085907f095ea7b30000000000000000000000000000000000000000000000000000000090606401611bf3565b6000806000612deb85856131d5565b90925090506000816004811115612e0457612e046142fe565b148015612e3c57508573ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff16145b15612e4c57600192505050612865565b6000808773ffffffffffffffffffffffffffffffffffffffff16631626ba7e60e01b8888604051602401612e8192919061432d565b604080517fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe08184030181529181526020820180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff167fffffffff00000000000000000000000000000000000000000000000000000000909416939093179092529051612f0a9190614346565b600060405180830381855afa9150503d8060008114612f45576040519150601f19603f3d011682016040523d82523d6000602084013e612f4a565b606091505b5091509150818015612f5d575080516020145b8015612fbf575080517f1626ba7e0000000000000000000000000000000000000000000000000000000090612f9b9083016020908101908401614362565b7fffffffff0000000000000000000000000000000000000000000000000000000016145b98975050505050505050565b60608247101561305d576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602660248201527f416464726573733a20696e73756666696369656e742062616c616e636520666f60448201527f722063616c6c00000000000000000000000000000000000000000000000000006064820152608401610a8b565b73ffffffffffffffffffffffffffffffffffffffff85163b6130db576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e74726163740000006044820152606401610a8b565b6000808673ffffffffffffffffffffffffffffffffffffffff1685876040516131049190614346565b60006040518083038185875af1925050503d8060008114613141576040519150601f19603f3d011682016040523d82523d6000602084013e613146565b606091505b5091509150613156828286613245565b979650505050505050565b600081815b84518110156131cd57600085828151811061318357613183613e2f565b602002602001015190508083116131a957600083815260208290526040902092506131ba565b600081815260208490526040902092505b50806131c581613f54565b915050613166565b509392505050565b60008082516041141561320c5760208301516040840151606085015160001a61320087828585613298565b9450945050505061323e565b825160401415613236576020830151604084015161322b8683836133b0565b93509350505061323e565b506000905060025b9250929050565b60608315613254575081612865565b8251156132645782518084602001fd5b816040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610a8b9190613f41565b6000807f7fffffffffffffffffffffffffffffff5d576e7357a4501ddfe92f46681b20a08311156132cf57506000905060036133a7565b8460ff16601b141580156132e757508460ff16601c14155b156132f857506000905060046133a7565b6040805160008082526020820180845289905260ff881692820192909252606081018690526080810185905260019060a0016020604051602081039080840390855afa15801561334c573d6000803e3d6000fd5b50506040517fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0015191505073ffffffffffffffffffffffffffffffffffffffff81166133a0576000600192509250506133a7565b9150600090505b94509492505050565b6000807f7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff8316816133e660ff86901c601b614076565b90506133f487828885613298565b935093505050935093915050565b73ffffffffffffffffffffffffffffffffffffffff8116811461076057600080fd5b60006020828403121561343657600080fd5b813561286581613402565b803561344c81613402565b919050565b60006020828403121561346357600080fd5b5035919050565b801515811461076057600080fd5b60008060006060848603121561348d57600080fd5b833561349881613402565b92506020840135915060408401356134af8161346a565b809150509250925092565b803563ffffffff8116811461344c57600080fd5b6000602082840312156134e057600080fd5b612865826134ba565b803567ffffffffffffffff8116811461344c57600080fd5b60008060008060008060c0878903121561351a57600080fd5b863561352581613402565b9550602087013561353581613402565b94506040870135935060608701359250613551608088016134e9565b915061355f60a088016134ba565b90509295509295509295565b6000806040838503121561357e57600080fd5b50508035926020909101359150565b600080604083850312156135a057600080fd5b82356135ab81613402565b946020939093013593505050565b6000806000806000806000806000806101408b8d0312156135d957600080fd5b8a356135e481613402565b995060208b01356135f481613402565b985060408b013561360481613402565b975060608b0135965060808b0135955060a08b0135945060c08b0135935061362e60e08c016134e9565b925061363d6101008c016134e9565b915061364c6101208c016134ba565b90509295989b9194979a5092959850565b6000806000806060858703121561367357600080fd5b84359350602085013561368581613402565b9250604085013567ffffffffffffffff808211156136a257600080fd5b818701915087601f8301126136b657600080fd5b8135818111156136c557600080fd5b8860208285010111156136d757600080fd5b95989497505060200194505050565b600080602083850312156136f957600080fd5b823567ffffffffffffffff8082111561371157600080fd5b818501915085601f83011261372557600080fd5b81358181111561373457600080fd5b8660208260051b850101111561374957600080fd5b60209290920196919550909350505050565b60005b8381101561377657818101518382015260200161375e565b838111156117855750506000910152565b6000815180845261379f81602086016020860161375b565b601f017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0169290920160200192915050565b6000602080830181845280855180835260408601915060408160051b870101925083870160005b82811015613844577fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc0888603018452613832858351613787565b945092850192908501906001016137f8565b5092979650505050505050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b60405160c0810167ffffffffffffffff811182821017156138a3576138a3613851565b60405290565b604051601f82017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe016810167ffffffffffffffff811182821017156138f0576138f0613851565b604052919050565b600067ffffffffffffffff82111561391257613912613851565b5060051b60200190565b600082601f83011261392d57600080fd5b8135602061394261393d836138f8565b6138a9565b82815260059290921b8401810191818101908684111561396157600080fd5b8286015b8481101561397c5780358352918301918301613965565b509695505050505050565b600082601f83011261399857600080fd5b813560206139a861393d836138f8565b82815260059290921b840181019181810190868411156139c757600080fd5b8286015b8481101561397c5780356139de81613402565b83529183019183016139cb565b600080600060608486031215613a0057600080fd5b613a09846134ba565b9250602084013567ffffffffffffffff80821115613a2657600080fd5b9085019060c08288031215613a3a57600080fd5b613a42613880565b8235815260208301356020820152604083013582811115613a6257600080fd5b613a6e8982860161391c565b604083015250613a80606084016134ba565b6060820152613a9160808401613441565b608082015260a083013582811115613aa857600080fd5b613ab489828601613987565b60a08301525093506040860135915080821115613ad057600080fd5b50613add8682870161391c565b9150509250925092565b600067ffffffffffffffff821115613b0157613b01613851565b50601f017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe01660200190565b600082601f830112613b3e57600080fd5b8135613b4c61393d82613ae7565b818152846020838601011115613b6157600080fd5b816020850160208301376000918101602001919091529392505050565b60008060008060808587031215613b9457600080fd5b8435613b9f81613402565b9350613bad602086016134e9565b9250613bbb604086016134ba565b9150606085013567ffffffffffffffff811115613bd757600080fd5b613be387828801613b2d565b91505092959194509250565b6000806000806000806000806000806101408b8d031215613c0f57600080fd5b8a35613c1a81613402565b995060208b0135613c2a81613402565b985060408b0135613c3a81613402565b975060608b0135965060808b01359550613c5660a08c016134e9565b9450613c6460c08c016134e9565b9350613c7260e08c016134ba565b9250613c816101008c016134ba565b91506101208b013567ffffffffffffffff811115613c9e57600080fd5b613caa8d828e0161391c565b9150509295989b9194979a5092959850565b6000806000806000806000806000806000806101808d8f031215613cdf57600080fd5b613ce88d613441565b9b50613cf660208e01613441565b9a50613d0460408e01613441565b995060608d0135985060808d0135975060a08d0135965060c08d01359550613d2e60e08e016134e9565b9450613d3d6101008e016134e9565b9350613d4c6101208e016134e9565b9250613d5b6101408e016134ba565b915067ffffffffffffffff6101608e01351115613d7757600080fd5b613d888e6101608f01358f01613b2d565b90509295989b509295989b509295989b565b600060208284031215613dac57600080fd5b5051919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b600063ffffffff83811690831681811015613dff57613dff613db3565b039392505050565b600063ffffffff808316818516808303821115613e2657613e26613db3565b01949350505050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b8183823760009101908152919050565b60008083357fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe1843603018112613ea357600080fd5b83018035915067ffffffffffffffff821115613ebe57600080fd5b60200191503681900382131561323e57600080fd5b600060208284031215613ee557600080fd5b815167ffffffffffffffff811115613efc57600080fd5b8201601f81018413613f0d57600080fd5b8051613f1b61393d82613ae7565b818152856020838501011115613f3057600080fd5b611f2a82602083016020860161375b565b6020815260006128656020830184613787565b60007fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff821415613f8657613f86613db3565b5060010190565b67ffffffffffffffff83168152604060208201526000612a2a6040830184613787565b60006101008201905073ffffffffffffffffffffffffffffffffffffffff80845116835280602085015116602084015280604085015116604084015250606083015160608301526080830151608083015260a083015167ffffffffffffffff80821660a08501528060c08601511660c0850152505060e083015161159060e084018263ffffffff169052565b600067ffffffffffffffff808316818516808303821115613e2657613e26613db3565b60008282101561407157614071613db3565b500390565b6000821982111561408957614089613db3565b500190565b600063ffffffff808316818114156140a8576140a8613db3565b6001019392505050565b600081518084526020808501945080840160005b838110156140e2578151875295820195908201906001016140c6565b509495945050505050565b600081518084526020808501945080840160005b838110156140e257815173ffffffffffffffffffffffffffffffffffffffff1687529582019590820190600101614101565b85815260a06020820152600061414c60a08301876140b2565b73ffffffffffffffffffffffffffffffffffffffff8087166040850152838203606085015261417b82876140ed565b9250808516608085015250509695505050505050565b6000602082840312156141a357600080fd5b81516128658161346a565b600067ffffffffffffffff83811690831681811015613dff57613dff613db3565b6000817fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff048311821515161561420757614207613db3565b500290565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601260045260246000fd5b60008261424a5761424a61420c565b500490565b6020815281516020820152602082015160408201526000604083015160c0606084015261427f60e08401826140b2565b905063ffffffff606085015116608084015273ffffffffffffffffffffffffffffffffffffffff60808501511660a084015260a08401517fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe08483030160c0850152611f2a82826140ed565b6000826142f9576142f961420c565b500690565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052602160045260246000fd5b828152604060208201526000612a2a6040830184613787565b6000825161435881846020870161375b565b9190910192915050565b60006020828403121561437457600080fd5b81517fffffffff000000000000000000000000000000000000000000000000000000008116811461286557600080fdfea264697066735822122057814f8438e18cbe0bb4ce14fd5312f99122d72bf404b9dac176163188539c3464736f6c634300080b0033", + "deployedBytecode": "0x6080604052600436106101dc5760003560e01c806389a153cc11610102578063de7eba7811610095578063ee2a53f811610064578063ee2a53f814610636578063f06850f61461066b578063f500697c14610698578063ffc351a3146106b857600080fd5b8063de7eba7814610594578063e1904402146105b4578063e282d5b9146105e1578063ecda10f51461060157600080fd5b8063a1244c67116100d1578063a1244c67146104f7578063ac9650d814610534578063b86cfdcf14610554578063c894c0ca1461057457600080fd5b806389a153cc146104845780638a7860ce146104a45780639a7c4b71146104c45780639a8a0592146104e457600080fd5b80633edb89d11161017a578063493a4f8411610149578063493a4f841461039e5780635249fef1146103be5780635285e0581461040957806357f6dcb81461043657600080fd5b80633edb89d1146103045780633fc8cef314610331578063450d11f01461035e578063492289781461038b57600080fd5b806322f8e566116101b657806322f8e56614610281578063272751c7146102a15780632752042e146102c157806329cb924d146102e157600080fd5b806313fb77ee146101e85780631c39c38d1461020a5780631dfb2d021461026157600080fd5b366101e357005b600080fd5b3480156101f457600080fd5b50610208610203366004613424565b6106d8565b005b34801561021657600080fd5b506000546102379073ffffffffffffffffffffffffffffffffffffffff1681565b60405173ffffffffffffffffffffffffffffffffffffffff90911681526020015b60405180910390f35b34801561026d57600080fd5b5061020861027c366004613424565b61074f565b34801561028d57600080fd5b5061020861029c366004613451565b610763565b3480156102ad57600080fd5b506102086102bc366004613478565b61080c565b3480156102cd57600080fd5b506102086102dc3660046134ce565b6108aa565b3480156102ed57600080fd5b506102f6610939565b604051908152602001610258565b34801561031057600080fd5b506008546102379073ffffffffffffffffffffffffffffffffffffffff1681565b34801561033d57600080fd5b506003546102379073ffffffffffffffffffffffffffffffffffffffff1681565b34801561036a57600080fd5b506007546102379073ffffffffffffffffffffffffffffffffffffffff1681565b610208610399366004613501565b6109f1565b3480156103aa57600080fd5b506102086103b936600461356b565b610ea1565b3480156103ca57600080fd5b506103f96103d936600461358d565b600460209081526000928352604080842090915290825290205460ff1681565b6040519015158152602001610258565b34801561041557600080fd5b506001546102379073ffffffffffffffffffffffffffffffffffffffff1681565b34801561044257600080fd5b5060035461046f907801000000000000000000000000000000000000000000000000900463ffffffff1681565b60405163ffffffff9091168152602001610258565b34801561049057600080fd5b5061020861049f3660046135b9565b610f4f565b3480156104b057600080fd5b506102086104bf366004613451565b61109f565b3480156104d057600080fd5b506102086104df36600461365d565b6110fd565b3480156104f057600080fd5b50466102f6565b34801561050357600080fd5b5060035461046f907c0100000000000000000000000000000000000000000000000000000000900463ffffffff1681565b6105476105423660046136e6565b6113bd565b60405161025891906137d1565b34801561056057600080fd5b5061020861056f366004613424565b611597565b34801561058057600080fd5b5061020861058f3660046139eb565b61160e565b3480156105a057600080fd5b506102086105af366004613424565b611697565b3480156105c057600080fd5b506002546102379073ffffffffffffffffffffffffffffffffffffffff1681565b3480156105ed57600080fd5b506102086105fc366004613b7e565b6116a8565b34801561060d57600080fd5b5060035461046f9074010000000000000000000000000000000000000000900463ffffffff1681565b34801561064257600080fd5b50610656610651366004613451565b61178b565b60408051928352602083019190915201610258565b34801561067757600080fd5b506102f6610686366004613451565b60066020526000908152604090205481565b3480156106a457600080fd5b506102086106b3366004613bef565b6117b9565b3480156106c457600080fd5b506102086106d3366004613cbc565b611844565b6106e06119a3565b600880547fffffffffffffffffffffffff00000000000000000000000000000000000000001673ffffffffffffffffffffffffffffffffffffffff83169081179091556040517f6ade7bc58132776cc11d9b570837a732329396078de17b87db95463ca7f5d25f90600090a250565b6107576119a3565b61076081611a29565b50565b60005473ffffffffffffffffffffffffffffffffffffffff1661078557600080fd5b6000546040517f22f8e5660000000000000000000000000000000000000000000000000000000081526004810183905273ffffffffffffffffffffffffffffffffffffffff909116906322f8e56690602401600060405180830381600087803b1580156107f157600080fd5b505af1158015610805573d6000803e3d6000fd5b5050505050565b6108146119a3565b73ffffffffffffffffffffffffffffffffffffffff8316600081815260046020908152604080832086845282529182902080547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff001685151590811790915591519182528492917f0a21fdd43d0ad0c62689ee7230a47309a050755bcc52eba00310add65297692a910160405180910390a3505050565b6108b26119a3565b600380547fffffffff00000000ffffffffffffffffffffffffffffffffffffffffffffffff16780100000000000000000000000000000000000000000000000063ffffffff8416908102919091179091556040519081527f0e55dd180fa793d9036c804d0a116e6a7617a48e72cee1f83d92793a793fcc039060200160405180910390a150565b6000805473ffffffffffffffffffffffffffffffffffffffff16156109ec5760008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166329cb924d6040518163ffffffff1660e01b8152600401602060405180830381865afa1580156109c3573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906109e79190613d9a565b905090565b504290565b73ffffffffffffffffffffffffffffffffffffffff851660009081526004602090815260408083208684529091529020548590849060ff16610a94576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152600e60248201527f44697361626c656420726f75746500000000000000000000000000000000000060448201526064015b60405180910390fd5b610a9c611b15565b610ac9600080547fffffffffffffffffffffff00ffffffffffffffffffffffffffffffffffffffff169055565b6706f05b59d3b200008467ffffffffffffffff1610610b44576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601360248201527f696e76616c69642072656c6179657220666565000000000000000000000000006044820152606401610a8b565b600354610b73907801000000000000000000000000000000000000000000000000900463ffffffff1684613de2565b63ffffffff16610b81610939565b10158015610bca5750600354610bb9907801000000000000000000000000000000000000000000000000900463ffffffff1684613e07565b63ffffffff16610bc7610939565b11155b610c30576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601260248201527f696e76616c69642071756f74652074696d6500000000000000000000000000006044820152606401610a8b565b60035473ffffffffffffffffffffffffffffffffffffffff8881169116148015610c5a5750600034115b15610d5057853414610cc8576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601b60248201527f6d73672e76616c7565206d757374206d6174636820616d6f756e7400000000006044820152606401610a8b565b600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663d0e30db0346040518263ffffffff1660e01b81526004016000604051808303818588803b158015610d3257600080fd5b505af1158015610d46573d6000803e3d6000fd5b5050505050610d72565b610d7273ffffffffffffffffffffffffffffffffffffffff8816333089611b99565b600354604080518881526020810188905267ffffffffffffffff87168183015263ffffffff868116606083015273ffffffffffffffffffffffffffffffffffffffff8c8116608084015292513394938c16937c01000000000000000000000000000000000000000000000000000000009004909116917ffc53c5b967d467d4136291c639720626f3d6dda97b4364da813e6858ad48a721919081900360a00190a460016003601c8282829054906101000a900463ffffffff16610e359190613e07565b92506101000a81548163ffffffff021916908363ffffffff160217905550610e97600080547fffffffffffffffffffffff00ffffffffffffffffffffffffffffffffffffffff1674010000000000000000000000000000000000000000179055565b5050505050505050565b610ea96119a3565b60058054600181018255600091909152600381027f036b6384b5eca791c62761152d0c79bb0604c104a5fb6f4eb0703f3154bb3db181018490557f036b6384b5eca791c62761152d0c79bb0604c104a5fb6f4eb0703f3154bb3db001828155604080518581526020810185905263ffffffff8416917fc86ba04c55bc5eb2f2876b91c438849a296dbec7b08751c3074d92e04f0a77af910160405180910390a250505050565b610f57611b15565b610f84600080547fffffffffffffffffffffff00ffffffffffffffffffffffffffffffffffffffff169055565b60006040518061010001604052808c73ffffffffffffffffffffffffffffffffffffffff1681526020018b73ffffffffffffffffffffffffffffffffffffffff1681526020018a73ffffffffffffffffffffffffffffffffffffffff1681526020018981526020018681526020018567ffffffffffffffff1681526020018467ffffffffffffffff1681526020018363ffffffff168152509050600061102982611c75565b9050600061103b82848b886000611ca5565b905061104c82828a88876000611f33565b505050611093600080547fffffffffffffffffffffff00ffffffffffffffffffffffffffffffffffffffff1674010000000000000000000000000000000000000000179055565b50505050505050505050565b6110a76119a3565b600581815481106110ba576110ba613e2f565b60009182526020822060039091020181815560010181905560405182917f3569b846531b754c99cb80df3f49cd72fa6fe106aaee5ab8e0caf35a9d7ce88d91a250565b600880547fffffffffffffffffffffff00ffffffffffffffffffffffffffffffffffffffff1674010000000000000000000000000000000000000000179055611144611b15565b611171600080547fffffffffffffffffffffff00ffffffffffffffffffffffffffffffffffffffff169055565b60075473ffffffffffffffffffffffffffffffffffffffff1633146111f2576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601060248201527f4e6f742066726f6d2066784368696c64000000000000000000000000000000006044820152606401610a8b565b60015473ffffffffffffffffffffffffffffffffffffffff848116911614611276576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601660248201527f4e6f742066726f6d206d61696e6e65742061646d696e000000000000000000006044820152606401610a8b565b60003073ffffffffffffffffffffffffffffffffffffffff16838360405161129f929190613e5e565b600060405180830381855af49150503d80600081146112da576040519150601f19603f3d011682016040523d82523d6000602084013e6112df565b606091505b505090508061134a576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601360248201527f64656c656761746563616c6c206661696c6564000000000000000000000000006044820152606401610a8b565b5061138f600080547fffffffffffffffffffffff00ffffffffffffffffffffffffffffffffffffffff1674010000000000000000000000000000000000000000179055565b5050600880547fffffffffffffffffffffff00ffffffffffffffffffffffffffffffffffffffff1690555050565b60603415611427576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601b60248201527f4f6e6c79206d756c746963616c6c207769746820302076616c756500000000006044820152606401610a8b565b8167ffffffffffffffff81111561144057611440613851565b60405190808252806020026020018201604052801561147357816020015b606081526020019060019003908161145e5790505b50905060005b82811015611590576000803086868581811061149757611497613e2f565b90506020028101906114a99190613e6e565b6040516114b7929190613e5e565b600060405180830381855af49150503d80600081146114f2576040519150601f19603f3d011682016040523d82523d6000602084013e6114f7565b606091505b50915091508161155d5760448151101561151057600080fd5b6004810190508080602001905181019061152a9190613ed3565b6040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610a8b9190613f41565b8084848151811061157057611570613e2f565b60200260200101819052505050808061158890613f54565b915050611479565b5092915050565b61159f6119a3565b600780547fffffffffffffffffffffffff00000000000000000000000000000000000000001673ffffffffffffffffffffffffffffffffffffffff83169081179091556040517f573834b6d6901b74ef64eeb676a0b99d7946df822b7021e44ee0da19d846c49590600090a250565b611616611b15565b611643600080547fffffffffffffffffffffff00ffffffffffffffffffffffffffffffffffffffff169055565b61164e838383612058565b611692600080547fffffffffffffffffffffff00ffffffffffffffffffffffffffffffffffffffff1674010000000000000000000000000000000000000000179055565b505050565b61169f6119a3565b6107608161241e565b6116b0611b15565b6116dd600080547fffffffffffffffffffffff00ffffffffffffffffffffffffffffffffffffffff169055565b6116ea844685858561250a565b8373ffffffffffffffffffffffffffffffffffffffff168263ffffffff167fb9de16bf376724405019a10ef4fedac57fecd292bf86c08d81d7c42d394d5d378584604051611739929190613f8d565b60405180910390a3611785600080547fffffffffffffffffffffff00ffffffffffffffffffffffffffffffffffffffff1674010000000000000000000000000000000000000000179055565b50505050565b6005818154811061179b57600080fd5b60009182526020909120600390910201805460019091015490915082565b6117c1611b15565b6117ee600080547fffffffffffffffffffffff00ffffffffffffffffffffffffffffffffffffffff169055565b6118008a8a8a8a8a8a8a8a8a8a6125a7565b611093600080547fffffffffffffffffffffff00ffffffffffffffffffffffffffffffffffffffff1674010000000000000000000000000000000000000000179055565b61184c611b15565b611879600080547fffffffffffffffffffffff00ffffffffffffffffffffffffffffffffffffffff169055565b6118868c8785858561250a565b60006040518061010001604052808e73ffffffffffffffffffffffffffffffffffffffff1681526020018d73ffffffffffffffffffffffffffffffffffffffff1681526020018c73ffffffffffffffffffffffffffffffffffffffff1681526020018b81526020018881526020018767ffffffffffffffff1681526020018667ffffffffffffffff1681526020018463ffffffff168152509050600061192b82611c75565b9050600061193d82848d896000611ca5565b905061194e82828c89876000611f33565b505050611995600080547fffffffffffffffffffffff00ffffffffffffffffffffffffffffffffffffffff1674010000000000000000000000000000000000000000179055565b505050505050505050505050565b60085474010000000000000000000000000000000000000000900460ff16611a27576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820181905260248201527f4d7573742063616c6c2070726f636573734d65737361676546726f6d526f6f746044820152606401610a8b565b565b73ffffffffffffffffffffffffffffffffffffffff8116611aa6576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601460248201527f4261642068756220706f6f6c20616464726573730000000000000000000000006044820152606401610a8b565b600280547fffffffffffffffffffffffff00000000000000000000000000000000000000001673ffffffffffffffffffffffffffffffffffffffff83169081179091556040517f1f17a88f67b0f49060a34bec1a4723a563620e6aa265eb640b5046dcee0759a090600090a250565b60005474010000000000000000000000000000000000000000900460ff16611a27576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601f60248201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c006044820152606401610a8b565b60405173ffffffffffffffffffffffffffffffffffffffff808516602483015283166044820152606481018290526117859085907f23b872dd00000000000000000000000000000000000000000000000000000000906084015b604080517fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe08184030181529190526020810180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff167fffffffff000000000000000000000000000000000000000000000000000000009093169290921790915261271f565b600081604051602001611c889190613fb0565b604051602081830303815290604052805190602001209050919050565b60006706f05b59d3b200008367ffffffffffffffff16108015611cdd57506706f05b59d3b200008560a0015167ffffffffffffffff16105b611d43576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152600c60248201527f696e76616c6964206665657300000000000000000000000000000000000000006044820152606401610a8b565b606085015160008781526006602052604090205410611dbe576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152600c60248201527f72656c61792066696c6c656400000000000000000000000000000000000000006044820152606401610a8b565b83611dcb57506000611f2a565b611de484848760a00151611ddf919061403c565b61282b565b60008781526006602052604081205460608801519293508692611e07919061405f565b905082811015611e3057809250611e2d83868960a00151611e28919061403c565b61286c565b91505b60008881526006602052604081208054859290611e4e908490614076565b9091555050600354604088015173ffffffffffffffffffffffffffffffffffffffff90811691161415611eba5783611ea7576040870151611ea79073ffffffffffffffffffffffffffffffffffffffff16333085611b99565b611eb5876020015183612895565b611f27565b83611ef457611eb5338860200151848a6040015173ffffffffffffffffffffffffffffffffffffffff16611b99909392919063ffffffff16565b611f27876020015183896040015173ffffffffffffffffffffffffffffffffffffffff166129a19092919063ffffffff16565b50505b95945050505050565b816000015173ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16877fedf6b64f49870333280b7dcf98ec56c6b9ff7cf50aa9be7caecb3874e961849f8560600151600660008c8152602001908152602001600020548a8a89608001518b8b60a001518c60e001518d604001518e602001518e6040516120489b9a999897969594939291909a8b5260208b019990995260408a01979097526060890195909552608088019390935267ffffffffffffffff91821660a08801521660c086015263ffffffff1660e085015273ffffffffffffffffffffffffffffffffffffffff9081166101008501521661012083015215156101408201526101600190565b60405180910390a4505050505050565b468260200151146120c5576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152600f60248201527f496e76616c696420636861696e496400000000000000000000000000000000006044820152606401610a8b565b8160400151518260a001515114612138576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152600c60248201527f696e76616c6964206c65616600000000000000000000000000000000000000006044820152606401610a8b565b600060058463ffffffff168154811061215357612153613e2f565b90600052602060002090600302019050612172816001015484846129f7565b6121d8576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152600960248201527f4261642050726f6f6600000000000000000000000000000000000000000000006044820152606401610a8b565b6121ef81600201846060015163ffffffff16612a32565b15612256576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152600f60248201527f416c726561647920636c61696d656400000000000000000000000000000000006044820152606401610a8b565b61226d81600201846060015163ffffffff16612a73565b60005b8360400151518163ffffffff16101561231957600084604001518263ffffffff16815181106122a1576122a1613e2f565b602002602001015190506000811115612306576123068560a001518363ffffffff16815181106122d3576122d3613e2f565b602002602001015182876080015173ffffffffffffffffffffffffffffffffffffffff166129a19092919063ffffffff16565b50806123118161408e565b915050612270565b508251156123b25761232a83612ab1565b826080015173ffffffffffffffffffffffffffffffffffffffff16836060015163ffffffff1684602001517f828fc203220356df8f072a91681caee7d5c75095e2a95e80ed5a14b384697f718660000151336040516123a992919091825273ffffffffffffffffffffffffffffffffffffffff16602082015260400190565b60405180910390a45b826060015163ffffffff168463ffffffff1684602001517ff8bd640004bcec1b89657020f561d0b070cbdf662d0b158db9dccb0a8301bfab8660000151876040015188608001518960a0015133604051612410959493929190614133565b60405180910390a450505050565b73ffffffffffffffffffffffffffffffffffffffff811661249b576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601960248201527f4261642062726964676520726f757465722061646472657373000000000000006044820152606401610a8b565b600180547fffffffffffffffffffffffff00000000000000000000000000000000000000001673ffffffffffffffffffffffffffffffffffffffff83169081179091556040517fa9e8c42c9e7fca7f62755189a16b2f5314d43d8fb24e91ba54e6d65f9314e84990600090a250565b60408051608060208201819052601160a08301527f4143524f53532d56322d4645452d312e3000000000000000000000000000000060c083015267ffffffffffffffff86169282019290925263ffffffff8416606082015290810185905260009060e001604051602081830303815290604052805190602001209050600061259182612bf5565b905061259e878285612c30565b50505050505050565b60006040518061010001604052808c73ffffffffffffffffffffffffffffffffffffffff1681526020018b73ffffffffffffffffffffffffffffffffffffffff1681526020018a73ffffffffffffffffffffffffffffffffffffffff1681526020018981526020018881526020018767ffffffffffffffff1681526020018667ffffffffffffffff1681526020018563ffffffff16815250905061267660058463ffffffff168154811061265d5761265d613e2f565b9060005260206000209060030201600001548284612ca1565b6126dc576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152600d60248201527f496e76616c69642070726f6f66000000000000000000000000000000000000006044820152606401610a8b565b60006126e782611c75565b905060006126fe8284856060015160006001611ca5565b90506127108282600080876001611f33565b50505050505050505050505050565b6000612781826040518060400160405280602081526020017f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c65648152508573ffffffffffffffffffffffffffffffffffffffff16612cb99092919063ffffffff16565b805190915015611692578080602001905181019061279f9190614191565b611692576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602a60248201527f5361666545524332303a204552433230206f7065726174696f6e20646964206e60448201527f6f742073756363656564000000000000000000000000000000000000000000006064820152608401610a8b565b600061283f82670de0b6b3a76400006141ae565b67ffffffffffffffff1661285b84670de0b6b3a76400006141cf565b612865919061423b565b9392505050565b6000670de0b6b3a764000061288183826141ae565b61285b9067ffffffffffffffff16856141cf565b73ffffffffffffffffffffffffffffffffffffffff82163b156128da576003546128d69073ffffffffffffffffffffffffffffffffffffffff1683836129a1565b5050565b6003546040517f2e1a7d4d0000000000000000000000000000000000000000000000000000000081526004810183905273ffffffffffffffffffffffffffffffffffffffff90911690632e1a7d4d90602401600060405180830381600087803b15801561294657600080fd5b505af115801561295a573d6000803e3d6000fd5b505060405173ffffffffffffffffffffffffffffffffffffffff8516925083156108fc02915083906000818181858888f19350505050158015611692573d6000803e3d6000fd5b60405173ffffffffffffffffffffffffffffffffffffffff83166024820152604481018290526116929084907fa9059cbb0000000000000000000000000000000000000000000000000000000090606401611bf3565b6000612a2a828585604051602001612a0f919061424f565b60405160208183030381529060405280519060200120612cc8565b949350505050565b600080612a416101008461423b565b90506000612a51610100856142ea565b6000928352602095909552506040902054600190931b92831690921492915050565b6000612a816101008361423b565b90506000612a91610100846142ea565b600092835260209490945250604090208054600190931b90921790915550565b60085481516080830151612ae09273ffffffffffffffffffffffffffffffffffffffff91821692911690612cde565b600854608082015182516003546040517fd124dc4f00000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff938416600482018190526024820193909352908316909114604482015291169063d124dc4f90606401600060405180830381600087803b158015612b6b57600080fd5b505af1158015612b7f573d6000803e3d6000fd5b505050503073ffffffffffffffffffffffffffffffffffffffff16816080015173ffffffffffffffffffffffffffffffffffffffff167ff6003d597c8a5b43987488bd11bfd2ed0c5a14172ae0f7ce18894e7b004915be8360000151604051612bea91815260200190565b60405180910390a350565b6040517f19457468657265756d205369676e6564204d6573736167653a0a3332000000006020820152603c8101829052600090605c01611c88565b612c3b838383612ddc565b611692576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601160248201527f696e76616c6964207369676e61747572650000000000000000000000000000006044820152606401610a8b565b6000612a2a828585604051602001612a0f9190613fb0565b6060612a2a8484600085612fcb565b600082612cd58584613161565b14949350505050565b6040517fdd62ed3e00000000000000000000000000000000000000000000000000000000815230600482015273ffffffffffffffffffffffffffffffffffffffff8381166024830152600091839186169063dd62ed3e90604401602060405180830381865afa158015612d55573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190612d799190613d9a565b612d839190614076565b60405173ffffffffffffffffffffffffffffffffffffffff85166024820152604481018290529091506117859085907f095ea7b30000000000000000000000000000000000000000000000000000000090606401611bf3565b6000806000612deb85856131d5565b90925090506000816004811115612e0457612e046142fe565b148015612e3c57508573ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff16145b15612e4c57600192505050612865565b6000808773ffffffffffffffffffffffffffffffffffffffff16631626ba7e60e01b8888604051602401612e8192919061432d565b604080517fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe08184030181529181526020820180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff167fffffffff00000000000000000000000000000000000000000000000000000000909416939093179092529051612f0a9190614346565b600060405180830381855afa9150503d8060008114612f45576040519150601f19603f3d011682016040523d82523d6000602084013e612f4a565b606091505b5091509150818015612f5d575080516020145b8015612fbf575080517f1626ba7e0000000000000000000000000000000000000000000000000000000090612f9b9083016020908101908401614362565b7fffffffff0000000000000000000000000000000000000000000000000000000016145b98975050505050505050565b60608247101561305d576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602660248201527f416464726573733a20696e73756666696369656e742062616c616e636520666f60448201527f722063616c6c00000000000000000000000000000000000000000000000000006064820152608401610a8b565b73ffffffffffffffffffffffffffffffffffffffff85163b6130db576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e74726163740000006044820152606401610a8b565b6000808673ffffffffffffffffffffffffffffffffffffffff1685876040516131049190614346565b60006040518083038185875af1925050503d8060008114613141576040519150601f19603f3d011682016040523d82523d6000602084013e613146565b606091505b5091509150613156828286613245565b979650505050505050565b600081815b84518110156131cd57600085828151811061318357613183613e2f565b602002602001015190508083116131a957600083815260208290526040902092506131ba565b600081815260208490526040902092505b50806131c581613f54565b915050613166565b509392505050565b60008082516041141561320c5760208301516040840151606085015160001a61320087828585613298565b9450945050505061323e565b825160401415613236576020830151604084015161322b8683836133b0565b93509350505061323e565b506000905060025b9250929050565b60608315613254575081612865565b8251156132645782518084602001fd5b816040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610a8b9190613f41565b6000807f7fffffffffffffffffffffffffffffff5d576e7357a4501ddfe92f46681b20a08311156132cf57506000905060036133a7565b8460ff16601b141580156132e757508460ff16601c14155b156132f857506000905060046133a7565b6040805160008082526020820180845289905260ff881692820192909252606081018690526080810185905260019060a0016020604051602081039080840390855afa15801561334c573d6000803e3d6000fd5b50506040517fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0015191505073ffffffffffffffffffffffffffffffffffffffff81166133a0576000600192509250506133a7565b9150600090505b94509492505050565b6000807f7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff8316816133e660ff86901c601b614076565b90506133f487828885613298565b935093505050935093915050565b73ffffffffffffffffffffffffffffffffffffffff8116811461076057600080fd5b60006020828403121561343657600080fd5b813561286581613402565b803561344c81613402565b919050565b60006020828403121561346357600080fd5b5035919050565b801515811461076057600080fd5b60008060006060848603121561348d57600080fd5b833561349881613402565b92506020840135915060408401356134af8161346a565b809150509250925092565b803563ffffffff8116811461344c57600080fd5b6000602082840312156134e057600080fd5b612865826134ba565b803567ffffffffffffffff8116811461344c57600080fd5b60008060008060008060c0878903121561351a57600080fd5b863561352581613402565b9550602087013561353581613402565b94506040870135935060608701359250613551608088016134e9565b915061355f60a088016134ba565b90509295509295509295565b6000806040838503121561357e57600080fd5b50508035926020909101359150565b600080604083850312156135a057600080fd5b82356135ab81613402565b946020939093013593505050565b6000806000806000806000806000806101408b8d0312156135d957600080fd5b8a356135e481613402565b995060208b01356135f481613402565b985060408b013561360481613402565b975060608b0135965060808b0135955060a08b0135945060c08b0135935061362e60e08c016134e9565b925061363d6101008c016134e9565b915061364c6101208c016134ba565b90509295989b9194979a5092959850565b6000806000806060858703121561367357600080fd5b84359350602085013561368581613402565b9250604085013567ffffffffffffffff808211156136a257600080fd5b818701915087601f8301126136b657600080fd5b8135818111156136c557600080fd5b8860208285010111156136d757600080fd5b95989497505060200194505050565b600080602083850312156136f957600080fd5b823567ffffffffffffffff8082111561371157600080fd5b818501915085601f83011261372557600080fd5b81358181111561373457600080fd5b8660208260051b850101111561374957600080fd5b60209290920196919550909350505050565b60005b8381101561377657818101518382015260200161375e565b838111156117855750506000910152565b6000815180845261379f81602086016020860161375b565b601f017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0169290920160200192915050565b6000602080830181845280855180835260408601915060408160051b870101925083870160005b82811015613844577fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc0888603018452613832858351613787565b945092850192908501906001016137f8565b5092979650505050505050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b60405160c0810167ffffffffffffffff811182821017156138a3576138a3613851565b60405290565b604051601f82017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe016810167ffffffffffffffff811182821017156138f0576138f0613851565b604052919050565b600067ffffffffffffffff82111561391257613912613851565b5060051b60200190565b600082601f83011261392d57600080fd5b8135602061394261393d836138f8565b6138a9565b82815260059290921b8401810191818101908684111561396157600080fd5b8286015b8481101561397c5780358352918301918301613965565b509695505050505050565b600082601f83011261399857600080fd5b813560206139a861393d836138f8565b82815260059290921b840181019181810190868411156139c757600080fd5b8286015b8481101561397c5780356139de81613402565b83529183019183016139cb565b600080600060608486031215613a0057600080fd5b613a09846134ba565b9250602084013567ffffffffffffffff80821115613a2657600080fd5b9085019060c08288031215613a3a57600080fd5b613a42613880565b8235815260208301356020820152604083013582811115613a6257600080fd5b613a6e8982860161391c565b604083015250613a80606084016134ba565b6060820152613a9160808401613441565b608082015260a083013582811115613aa857600080fd5b613ab489828601613987565b60a08301525093506040860135915080821115613ad057600080fd5b50613add8682870161391c565b9150509250925092565b600067ffffffffffffffff821115613b0157613b01613851565b50601f017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe01660200190565b600082601f830112613b3e57600080fd5b8135613b4c61393d82613ae7565b818152846020838601011115613b6157600080fd5b816020850160208301376000918101602001919091529392505050565b60008060008060808587031215613b9457600080fd5b8435613b9f81613402565b9350613bad602086016134e9565b9250613bbb604086016134ba565b9150606085013567ffffffffffffffff811115613bd757600080fd5b613be387828801613b2d565b91505092959194509250565b6000806000806000806000806000806101408b8d031215613c0f57600080fd5b8a35613c1a81613402565b995060208b0135613c2a81613402565b985060408b0135613c3a81613402565b975060608b0135965060808b01359550613c5660a08c016134e9565b9450613c6460c08c016134e9565b9350613c7260e08c016134ba565b9250613c816101008c016134ba565b91506101208b013567ffffffffffffffff811115613c9e57600080fd5b613caa8d828e0161391c565b9150509295989b9194979a5092959850565b6000806000806000806000806000806000806101808d8f031215613cdf57600080fd5b613ce88d613441565b9b50613cf660208e01613441565b9a50613d0460408e01613441565b995060608d0135985060808d0135975060a08d0135965060c08d01359550613d2e60e08e016134e9565b9450613d3d6101008e016134e9565b9350613d4c6101208e016134e9565b9250613d5b6101408e016134ba565b915067ffffffffffffffff6101608e01351115613d7757600080fd5b613d888e6101608f01358f01613b2d565b90509295989b509295989b509295989b565b600060208284031215613dac57600080fd5b5051919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b600063ffffffff83811690831681811015613dff57613dff613db3565b039392505050565b600063ffffffff808316818516808303821115613e2657613e26613db3565b01949350505050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b8183823760009101908152919050565b60008083357fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe1843603018112613ea357600080fd5b83018035915067ffffffffffffffff821115613ebe57600080fd5b60200191503681900382131561323e57600080fd5b600060208284031215613ee557600080fd5b815167ffffffffffffffff811115613efc57600080fd5b8201601f81018413613f0d57600080fd5b8051613f1b61393d82613ae7565b818152856020838501011115613f3057600080fd5b611f2a82602083016020860161375b565b6020815260006128656020830184613787565b60007fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff821415613f8657613f86613db3565b5060010190565b67ffffffffffffffff83168152604060208201526000612a2a6040830184613787565b60006101008201905073ffffffffffffffffffffffffffffffffffffffff80845116835280602085015116602084015280604085015116604084015250606083015160608301526080830151608083015260a083015167ffffffffffffffff80821660a08501528060c08601511660c0850152505060e083015161159060e084018263ffffffff169052565b600067ffffffffffffffff808316818516808303821115613e2657613e26613db3565b60008282101561407157614071613db3565b500390565b6000821982111561408957614089613db3565b500190565b600063ffffffff808316818114156140a8576140a8613db3565b6001019392505050565b600081518084526020808501945080840160005b838110156140e2578151875295820195908201906001016140c6565b509495945050505050565b600081518084526020808501945080840160005b838110156140e257815173ffffffffffffffffffffffffffffffffffffffff1687529582019590820190600101614101565b85815260a06020820152600061414c60a08301876140b2565b73ffffffffffffffffffffffffffffffffffffffff8087166040850152838203606085015261417b82876140ed565b9250808516608085015250509695505050505050565b6000602082840312156141a357600080fd5b81516128658161346a565b600067ffffffffffffffff83811690831681811015613dff57613dff613db3565b6000817fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff048311821515161561420757614207613db3565b500290565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601260045260246000fd5b60008261424a5761424a61420c565b500490565b6020815281516020820152602082015160408201526000604083015160c0606084015261427f60e08401826140b2565b905063ffffffff606085015116608084015273ffffffffffffffffffffffffffffffffffffffff60808501511660a084015260a08401517fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe08483030160c0850152611f2a82826140ed565b6000826142f9576142f961420c565b500690565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052602160045260246000fd5b828152604060208201526000612a2a6040830184613787565b6000825161435881846020870161375b565b9190910192915050565b60006020828403121561437457600080fd5b81517fffffffff000000000000000000000000000000000000000000000000000000008116811461286557600080fdfea264697066735822122057814f8438e18cbe0bb4ce14fd5312f99122d72bf404b9dac176163188539c3464736f6c634300080b0033", + "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.", + "_fxChild": "FxChild contract, changeable by Admin.", + "_hubPool": "Hub pool address to set. Can be changed by admin.", + "_polygonTokenBridger": "Token routing contract that sends tokens from here to HubPool. Changeable by Admin.", + "_wmaticAddress": "Replaces _wethAddress for this network since MATIC is the gas token and sent via msg.value on Polygon.", + "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 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." + } + }, + "processMessageFromRoot(uint256,address,bytes)": { + "details": "stateId value isn't used because it isn't relevant for this method. It doesn't care what state sync triggered this call.", + "params": { + "data": "ABI encoded function call to execute on this contract.", + "rootMessageSender": "Original L1 sender of data." + } + }, + "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." + } + }, + "setFxChild(address)": { + "params": { + "newFxChild": "New FxChild." + } + }, + "setHubPool(address)": { + "params": { + "newHubPool": "New hub pool." + } + }, + "setPolygonTokenBridger(address)": { + "params": { + "newPolygonTokenBridger": "New Polygon Token Bridger contract." + } + }, + "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 Polygon 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 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." + }, + "processMessageFromRoot(uint256,address,bytes)": { + "notice": "Called by FxChild upon receiving L1 message that targets this contract. Performs an additional check that the L1 caller was the expected cross domain admin, and then delegate calls.Polygon bridge only executes this external function on the target Polygon contract when relaying messages from L1, so all functions on this SpokePool are expected to originate via this call." + }, + "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." + }, + "setFxChild(address)": { + "notice": "Change FxChild address. Callable only by admin via processMessageFromRoot." + }, + "setHubPool(address)": { + "notice": "Change L1 hub pool address. Callable by admin only." + }, + "setPolygonTokenBridger(address)": { + "notice": "Change polygonTokenBridger address. Callable only by admin via processMessageFromRoot." + }, + "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": "Polygon specific SpokePool.", + "version": 1 + }, + "storageLayout": { + "storage": [ + { + "astId": 5884, + "contract": "contracts/Polygon_SpokePool.sol:Polygon_SpokePool", + "label": "timerAddress", + "offset": 0, + "slot": "0", + "type": "t_address" + }, + { + "astId": 7114, + "contract": "contracts/Polygon_SpokePool.sol:Polygon_SpokePool", + "label": "_notEntered", + "offset": 20, + "slot": "0", + "type": "t_bool" + }, + { + "astId": 8200, + "contract": "contracts/Polygon_SpokePool.sol:Polygon_SpokePool", + "label": "crossDomainAdmin", + "offset": 0, + "slot": "1", + "type": "t_address" + }, + { + "astId": 8202, + "contract": "contracts/Polygon_SpokePool.sol:Polygon_SpokePool", + "label": "hubPool", + "offset": 0, + "slot": "2", + "type": "t_address" + }, + { + "astId": 8205, + "contract": "contracts/Polygon_SpokePool.sol:Polygon_SpokePool", + "label": "weth", + "offset": 0, + "slot": "3", + "type": "t_contract(WETH9)10698" + }, + { + "astId": 8207, + "contract": "contracts/Polygon_SpokePool.sol:Polygon_SpokePool", + "label": "deploymentTime", + "offset": 20, + "slot": "3", + "type": "t_uint32" + }, + { + "astId": 8210, + "contract": "contracts/Polygon_SpokePool.sol:Polygon_SpokePool", + "label": "depositQuoteTimeBuffer", + "offset": 24, + "slot": "3", + "type": "t_uint32" + }, + { + "astId": 8212, + "contract": "contracts/Polygon_SpokePool.sol:Polygon_SpokePool", + "label": "numberOfDeposits", + "offset": 28, + "slot": "3", + "type": "t_uint32" + }, + { + "astId": 8218, + "contract": "contracts/Polygon_SpokePool.sol:Polygon_SpokePool", + "label": "enabledDepositRoutes", + "offset": 0, + "slot": "4", + "type": "t_mapping(t_address,t_mapping(t_uint256,t_bool))" + }, + { + "astId": 8231, + "contract": "contracts/Polygon_SpokePool.sol:Polygon_SpokePool", + "label": "rootBundles", + "offset": 0, + "slot": "5", + "type": "t_array(t_struct(RootBundle)8227_storage)dyn_storage" + }, + { + "astId": 8235, + "contract": "contracts/Polygon_SpokePool.sol:Polygon_SpokePool", + "label": "relayFills", + "offset": 0, + "slot": "6", + "type": "t_mapping(t_bytes32,t_uint256)" + }, + { + "astId": 7957, + "contract": "contracts/Polygon_SpokePool.sol:Polygon_SpokePool", + "label": "fxChild", + "offset": 0, + "slot": "7", + "type": "t_address" + }, + { + "astId": 7960, + "contract": "contracts/Polygon_SpokePool.sol:Polygon_SpokePool", + "label": "polygonTokenBridger", + "offset": 0, + "slot": "8", + "type": "t_contract(PolygonTokenBridger)7928" + }, + { + "astId": 7963, + "contract": "contracts/Polygon_SpokePool.sol:Polygon_SpokePool", + "label": "callValidated", + "offset": 20, + "slot": "8", + "type": "t_bool" + } + ], + "types": { + "t_address": { + "encoding": "inplace", + "label": "address", + "numberOfBytes": "20" + }, + "t_array(t_struct(RootBundle)8227_storage)dyn_storage": { + "base": "t_struct(RootBundle)8227_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(PolygonTokenBridger)7928": { + "encoding": "inplace", + "label": "contract PolygonTokenBridger", + "numberOfBytes": "20" + }, + "t_contract(WETH9)10698": { + "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)8227_storage": { + "encoding": "inplace", + "label": "struct SpokePool.RootBundle", + "members": [ + { + "astId": 8220, + "contract": "contracts/Polygon_SpokePool.sol:Polygon_SpokePool", + "label": "slowRelayRoot", + "offset": 0, + "slot": "0", + "type": "t_bytes32" + }, + { + "astId": 8222, + "contract": "contracts/Polygon_SpokePool.sol:Polygon_SpokePool", + "label": "relayerRefundRoot", + "offset": 0, + "slot": "1", + "type": "t_bytes32" + }, + { + "astId": 8226, + "contract": "contracts/Polygon_SpokePool.sol:Polygon_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/polygon-mumbai/solcInputs/a6be65618c7af0eb8c96b985a450affc.json b/deployments/polygon-mumbai/solcInputs/a6be65618c7af0eb8c96b985a450affc.json new file mode 100644 index 000000000..1d3b0f1a6 --- /dev/null +++ b/deployments/polygon-mumbai/solcInputs/a6be65618c7af0eb8c96b985a450affc.json @@ -0,0 +1,204 @@ +{ + "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" + }, + "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 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 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 * @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 {\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 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 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" + }, + "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" + }, + "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" + }, + "@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/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" + }, + "@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/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" + }, + "@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 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 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" + }, + "@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 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" + }, + "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/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" + }, + "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" + }, + "@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/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" + }, + "@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/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" + }, + "@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" + }, + "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" + }, + "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/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/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" + }, + "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" + }, + "@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/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": { + "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/hardhat.config.ts b/hardhat.config.ts index acbba3417..168b7ea41 100644 --- a/hardhat.config.ts +++ b/hardhat.config.ts @@ -21,7 +21,6 @@ const LARGE_CONTRACT_COMPILER_SETTINGS = { version: solcVersion, settings: { optimizer: { enabled: true, runs: 200 } }, }; -``; const config: HardhatUserConfig = { solidity: { @@ -72,6 +71,26 @@ const config: HardhatUserConfig = { saveDeployments: true, accounts: { mnemonic }, }, + goerli: { + chainId: 5, + url: getNodeUrl("goerli", true, 5), + saveDeployments: true, + accounts: { mnemonic }, + }, + polygon: { + chainId: 137, + url: getNodeUrl("polygon-matic", true, 137), + saveDeployments: true, + accounts: { mnemonic }, + companionNetworks: { l1: "mainnet" }, + }, + "polygon-mumbai": { + chainId: 80001, + url: getNodeUrl("polygon-mumbai", true, 80001), + saveDeployments: true, + accounts: { mnemonic }, + companionNetworks: { l1: "goerli" }, + }, }, gasReporter: { enabled: process.env.REPORT_GAS !== undefined, currency: "USD" }, etherscan: { @@ -79,6 +98,7 @@ const config: HardhatUserConfig = { mainnet: process.env.ETHERSCAN_API_KEY, kovan: process.env.ETHERSCAN_API_KEY, rinkeby: process.env.ETHERSCAN_API_KEY, + goerli: process.env.ETHERSCAN_API_KEY, optimisticEthereum: process.env.OPTIMISM_ETHERSCAN_API_KEY, optimisticKovan: process.env.OPTIMISM_ETHERSCAN_API_KEY, arbitrumOne: process.env.ARBITRUM_ETHERSCAN_API_KEY,