{"file_path":"lib/mento-core-2.2.0/contracts/swap/Broker.sol","creation_status":"success","source_code":"// SPDX-License-Identifier: GPL-3.0-or-later\npragma solidity ^0.5.13;\npragma experimental ABIEncoderV2;\n\nimport { Ownable } from \"openzeppelin-solidity/contracts/ownership/Ownable.sol\";\nimport { SafeERC20 } from \"openzeppelin-solidity/contracts/token/ERC20/SafeERC20.sol\";\nimport { SafeMath } from \"openzeppelin-solidity/contracts/math/SafeMath.sol\";\nimport { IERC20 } from \"openzeppelin-solidity/contracts/token/ERC20/IERC20.sol\";\n\nimport { IExchangeProvider } from \"../interfaces/IExchangeProvider.sol\";\nimport { IBroker } from \"../interfaces/IBroker.sol\";\nimport { IBrokerAdmin } from \"../interfaces/IBrokerAdmin.sol\";\nimport { IReserve } from \"../interfaces/IReserve.sol\";\nimport { IERC20Metadata } from \"../common/interfaces/IERC20Metadata.sol\";\nimport { IStableTokenV2 } from \"../interfaces/IStableTokenV2.sol\";\n\nimport { Initializable } from \"../common/Initializable.sol\";\nimport { TradingLimits } from \"../libraries/TradingLimits.sol\";\nimport { ReentrancyGuard } from \"../common/ReentrancyGuard.sol\";\n\n/**\n * @title Broker\n * @notice The broker executes swaps and keeps track of spending limits per pair.\n */\ncontract Broker is IBroker, IBrokerAdmin, Initializable, Ownable, ReentrancyGuard {\n  using TradingLimits for TradingLimits.State;\n  using TradingLimits for TradingLimits.Config;\n  using SafeERC20 for IERC20;\n  using SafeMath for uint256;\n\n  /* ==================== State Variables ==================== */\n\n  address[] public exchangeProviders;\n  mapping(address => bool) public isExchangeProvider;\n  mapping(bytes32 => TradingLimits.State) public tradingLimitsState;\n  mapping(bytes32 => TradingLimits.Config) public tradingLimitsConfig;\n\n  // Address of the reserve.\n  IReserve public reserve;\n\n  uint256 private constant MAX_INT256 = uint256(-1) / 2;\n\n  /* ==================== Constructor ==================== */\n\n  /**\n   * @notice Sets initialized == true on implementation contracts.\n   * @param test Set to true to skip implementation initialization.\n   */\n  constructor(bool test) public Initializable(test) {}\n\n  /**\n   * @notice Allows the contract to be upgradable via the proxy.\n   * @param _exchangeProviders The addresses of the ExchangeProvider contracts.\n   * @param _reserve The address of the Reserve contract.\n   */\n  function initialize(address[] calldata _exchangeProviders, address _reserve) external initializer {\n    _transferOwnership(msg.sender);\n    for (uint256 i = 0; i < _exchangeProviders.length; i++) {\n      addExchangeProvider(_exchangeProviders[i]);\n    }\n    setReserve(_reserve);\n  }\n\n  /* ==================== Mutative Functions ==================== */\n\n  /**\n   * @notice Add an exchange provider to the list of providers.\n   * @param exchangeProvider The address of the exchange provider to add.\n   * @return index The index of the newly added specified exchange provider.\n   */\n  function addExchangeProvider(address exchangeProvider) public onlyOwner returns (uint256 index) {\n    require(!isExchangeProvider[exchangeProvider], \"ExchangeProvider already exists in the list\");\n    require(exchangeProvider != address(0), \"ExchangeProvider address can't be 0\");\n    exchangeProviders.push(exchangeProvider);\n    isExchangeProvider[exchangeProvider] = true;\n    emit ExchangeProviderAdded(exchangeProvider);\n    index = exchangeProviders.length.sub(1);\n  }\n\n  /**\n   * @notice Remove an exchange provider from the list of providers.\n   * @param exchangeProvider The address of the exchange provider to remove.\n   * @param index The index of the exchange provider being removed.\n   */\n  function removeExchangeProvider(address exchangeProvider, uint256 index) public onlyOwner {\n    require(exchangeProviders[index] == exchangeProvider, \"index doesn't match provider\");\n    exchangeProviders[index] = exchangeProviders[exchangeProviders.length.sub(1)];\n    exchangeProviders.pop();\n    delete isExchangeProvider[exchangeProvider];\n    emit ExchangeProviderRemoved(exchangeProvider);\n  }\n\n  /**\n   * @notice Set the Mento reserve address.\n   * @param _reserve The Mento reserve address.\n   */\n  function setReserve(address _reserve) public onlyOwner {\n    require(_reserve != address(0), \"Reserve address must be set\");\n    emit ReserveSet(_reserve, address(reserve));\n    reserve = IReserve(_reserve);\n  }\n\n  /**\n   * @notice Calculate the amount of tokenIn to be sold for a given amountOut of tokenOut\n   * @param exchangeProvider the address of the exchange manager for the pair\n   * @param exchangeId The id of the exchange to use\n   * @param tokenIn The token to be sold\n   * @param tokenOut The token to be bought\n   * @param amountOut The amount of tokenOut to be bought\n   * @return amountIn The amount of tokenIn to be sold\n   */\n  function getAmountIn(\n    address exchangeProvider,\n    bytes32 exchangeId,\n    address tokenIn,\n    address tokenOut,\n    uint256 amountOut\n  ) external view returns (uint256 amountIn) {\n    require(isExchangeProvider[exchangeProvider], \"ExchangeProvider does not exist\");\n    amountIn = IExchangeProvider(exchangeProvider).getAmountIn(exchangeId, tokenIn, tokenOut, amountOut);\n  }\n\n  /**\n   * @notice Calculate the amount of tokenOut to be bought for a given amount of tokenIn to be sold\n   * @param exchangeProvider the address of the exchange manager for the pair\n   * @param exchangeId The id of the exchange to use\n   * @param tokenIn The token to be sold\n   * @param tokenOut The token to be bought\n   * @param amountIn The amount of tokenIn to be sold\n   * @return amountOut The amount of tokenOut to be bought\n   */\n  function getAmountOut(\n    address exchangeProvider,\n    bytes32 exchangeId,\n    address tokenIn,\n    address tokenOut,\n    uint256 amountIn\n  ) external view returns (uint256 amountOut) {\n    require(isExchangeProvider[exchangeProvider], \"ExchangeProvider does not exist\");\n    amountOut = IExchangeProvider(exchangeProvider).getAmountOut(exchangeId, tokenIn, tokenOut, amountIn);\n  }\n\n  /**\n   * @notice Execute a token swap with fixed amountIn.\n   * @param exchangeProvider the address of the exchange provider for the pair.\n   * @param exchangeId The id of the exchange to use.\n   * @param tokenIn The token to be sold.\n   * @param tokenOut The token to be bought.\n   * @param amountIn The amount of tokenIn to be sold.\n   * @param amountOutMin Minimum amountOut to be received - controls slippage.\n   * @return amountOut The amount of tokenOut to be bought.\n   */\n  function swapIn(\n    address exchangeProvider,\n    bytes32 exchangeId,\n    address tokenIn,\n    address tokenOut,\n    uint256 amountIn,\n    uint256 amountOutMin\n  ) external nonReentrant returns (uint256 amountOut) {\n    require(isExchangeProvider[exchangeProvider], \"ExchangeProvider does not exist\");\n    amountOut = IExchangeProvider(exchangeProvider).swapIn(exchangeId, tokenIn, tokenOut, amountIn);\n    require(amountOut >= amountOutMin, \"amountOutMin not met\");\n    guardTradingLimits(exchangeId, tokenIn, amountIn, tokenOut, amountOut);\n    transferIn(msg.sender, tokenIn, amountIn);\n    transferOut(msg.sender, tokenOut, amountOut);\n    emit Swap(exchangeProvider, exchangeId, msg.sender, tokenIn, tokenOut, amountIn, amountOut);\n  }\n\n  /**\n   * @notice Execute a token swap with fixed amountOut.\n   * @param exchangeProvider the address of the exchange provider for the pair.\n   * @param exchangeId The id of the exchange to use.\n   * @param tokenIn The token to be sold.\n   * @param tokenOut The token to be bought.\n   * @param amountOut The amount of tokenOut to be bought.\n   * @param amountInMax Maximum amount of tokenIn that can be traded.\n   * @return amountIn The amount of tokenIn to be sold.\n   */\n  function swapOut(\n    address exchangeProvider,\n    bytes32 exchangeId,\n    address tokenIn,\n    address tokenOut,\n    uint256 amountOut,\n    uint256 amountInMax\n  ) external nonReentrant returns (uint256 amountIn) {\n    require(isExchangeProvider[exchangeProvider], \"ExchangeProvider does not exist\");\n    amountIn = IExchangeProvider(exchangeProvider).swapOut(exchangeId, tokenIn, tokenOut, amountOut);\n    require(amountIn <= amountInMax, \"amountInMax exceeded\");\n    guardTradingLimits(exchangeId, tokenIn, amountIn, tokenOut, amountOut);\n    transferIn(msg.sender, tokenIn, amountIn);\n    transferOut(msg.sender, tokenOut, amountOut);\n    emit Swap(exchangeProvider, exchangeId, msg.sender, tokenIn, tokenOut, amountIn, amountOut);\n  }\n\n  /**\n   * @notice Permissionless way to burn stables from msg.sender directly.\n   * @param token The token getting burned.\n   * @param amount The amount of the token getting burned.\n   * @return True if transaction succeeds.\n   */\n  function burnStableTokens(address token, uint256 amount) public returns (bool) {\n    require(reserve.isStableAsset(token), \"Token must be a reserve stable asset\");\n    IERC20(token).safeTransferFrom(msg.sender, address(this), amount);\n    require(IStableTokenV2(token).burn(amount), \"Burning of the stable asset failed\");\n    return true;\n  }\n\n  /**\n   * @notice Configure trading limits for an (exchangeId, token) touple.\n   * @dev Will revert if the configuration is not valid according to the\n   * TradingLimits library.\n   * Resets existing state according to the TradingLimits library logic.\n   * Can only be called by owner.\n   * @param exchangeId the exchangeId to target.\n   * @param token the token to target.\n   * @param config the new trading limits config.\n   */\n  function configureTradingLimit(\n    bytes32 exchangeId,\n    address token,\n    TradingLimits.Config memory config\n  ) public onlyOwner {\n    config.validate();\n\n    bytes32 limitId = exchangeId ^ bytes32(uint256(uint160(token)));\n    tradingLimitsConfig[limitId] = config;\n    tradingLimitsState[limitId] = tradingLimitsState[limitId].reset(config);\n    emit TradingLimitConfigured(exchangeId, token, config);\n  }\n\n  /* ==================== Private Functions ==================== */\n\n  /**\n   * @notice Transfer a specified Mento asset to the given address.\n   * If the specified asset is a stable asset it will be minted directly to the address. If\n   * the asset is a collateral asset it will be transferred from the reserve to the given address.\n   * @param to The address receiving the asset.\n   * @param token The asset to transfer.\n   * @param amount The amount of `token` to be transferred.\n   */\n  function transferOut(\n    address payable to,\n    address token,\n    uint256 amount\n  ) internal {\n    if (reserve.isStableAsset(token)) {\n      require(IStableTokenV2(token).mint(to, amount), \"Minting of the stable asset failed\");\n    } else if (reserve.isCollateralAsset(token)) {\n      require(reserve.transferExchangeCollateralAsset(token, to, amount), \"Transfer of the collateral asset failed\");\n    } else {\n      revert(\"Token must be stable or collateral assert\");\n    }\n  }\n\n  /**\n   * @notice Transfer a specified Mento asset into the reserve or the broker.\n   * If the specified asset is a stable asset it will be transfered to the broker\n   * and burned. If the asset is a collateral asset it will be transferred to the reserve.\n   * @param from The address to transfer the asset from.\n   * @param token The asset to transfer.\n   * @param amount The amount of `token` to be transferred.\n   */\n  function transferIn(\n    address payable from,\n    address token,\n    uint256 amount\n  ) internal {\n    if (reserve.isStableAsset(token)) {\n      IERC20(token).safeTransferFrom(from, address(this), amount);\n      require(IStableTokenV2(token).burn(amount), \"Burning of the stable asset failed\");\n    } else if (reserve.isCollateralAsset(token)) {\n      IERC20(token).safeTransferFrom(from, address(reserve), amount);\n    } else {\n      revert(\"Token must be stable or collateral assert\");\n    }\n  }\n\n  /**\n   * @notice Verify trading limits for a trade in both directions.\n   * @dev Reverts if the trading limits are met for outflow or inflow.\n   * @param exchangeId the ID of the exchange being used.\n   * @param _tokenIn the address of the token flowing in.\n   * @param amountIn the amount of token flowing in.\n   * @param _tokenOut the address of the token flowing out.\n   * @param amountOut  the amount of token flowing out.\n   */\n  function guardTradingLimits(\n    bytes32 exchangeId,\n    address _tokenIn,\n    uint256 amountIn,\n    address _tokenOut,\n    uint256 amountOut\n  ) internal {\n    bytes32 tokenIn = bytes32(uint256(uint160(_tokenIn)));\n    bytes32 tokenOut = bytes32(uint256(uint160(_tokenOut)));\n    require(amountIn <= uint256(MAX_INT256), \"amountIn too large\");\n    require(amountOut <= uint256(MAX_INT256), \"amountOut too large\");\n\n    guardTradingLimit(exchangeId ^ tokenIn, int256(amountIn), _tokenIn);\n    guardTradingLimit(exchangeId ^ tokenOut, -1 * int256(amountOut), _tokenOut);\n  }\n\n  /**\n   * @notice Updates and verifies a trading limit if it's configured.\n   * @dev Will revert if the trading limit is exceeded by this trade.\n   * @param tradingLimitId the ID of the trading limit associated with the token\n   * @param deltaFlow the deltaflow of this token, negative for outflow, positive for inflow.\n   * @param token the address of the token, used to lookup decimals.\n   */\n  function guardTradingLimit(\n    bytes32 tradingLimitId,\n    int256 deltaFlow,\n    address token\n  ) internal {\n    TradingLimits.Config memory tradingLimitConfig = tradingLimitsConfig[tradingLimitId];\n    if (tradingLimitConfig.flags > 0) {\n      TradingLimits.State memory tradingLimitState = tradingLimitsState[tradingLimitId];\n      tradingLimitState = tradingLimitState.update(tradingLimitConfig, deltaFlow, IERC20Metadata(token).decimals());\n      tradingLimitState.verify(tradingLimitConfig);\n      tradingLimitsState[tradingLimitId] = tradingLimitState;\n    }\n  }\n\n  /* ==================== View Functions ==================== */\n\n  /**\n   * @notice Get the list of registered exchange providers.\n   * @dev This can be used by UI or clients to discover all pairs.\n   * @return exchangeProviders the addresses of all exchange providers.\n   */\n  function getExchangeProviders() external view returns (address[] memory) {\n    return exchangeProviders;\n  }\n}\n","deployed_bytecode":"0x608060405234801561001057600080fd5b50600436106101775760003560e01c80638f32d59b116100d8578063cd3293de1161008c578063ddbbe85011610066578063ddbbe850146102ee578063f01ecd1714610301578063f2fde38b1461032557610177565b8063cd3293de146102b3578063d163b135146102c8578063d1d786b1146102db57610177565b8063a20f2305116100bd578063a20f23051461027a578063a9b5aab31461028d578063c4454fdc146102a057610177565b80638f32d59b1461025f5780639cecc80a1461026757610177565b8063462d0b2e1161012f57806373ec4cf41161011457806373ec4cf414610212578063821a816c146102255780638da5cb5b1461024a57610177565b8063462d0b2e146101f7578063715018a61461020a57610177565b8063131cab2a11610160578063131cab2a146101ba578063158ef93e146101da5780632cac2568146101e257610177565b806304710d531461017c57806304e4564014610191575b600080fd5b61018f61018a36600461283f565b610338565b005b6101a461019f366004612743565b6104ef565b6040516101b19190613870565b60405180910390f35b6101cd6101c836600461283f565b6105cc565b6040516101b191906135c2565b6101cd61075a565b6101ea610763565b6040516101b191906135b1565b61018f610205366004612879565b6107c5565b61018f610863565b6101a4610220366004612725565b6108ed565b6102386102333660046128ec565b610a48565b6040516101b1969594939291906138c0565b610252610ad3565b6040516101b19190613522565b6101cd610ae7565b61018f610275366004612725565b610b10565b6101a4610288366004612743565b610bcf565b61018f61029b36600461290a565b610c52565b6102526102ae3660046128ec565b611008565b6102bb61102f565b6040516101b19190613621565b6101a46102d63660046127b8565b61103e565b6101cd6102e9366004612725565b6111e3565b6101a46102fc3660046127b8565b6111f8565b61031461030f3660046128ec565b611369565b6040516101b195949392919061387e565b61018f610333366004612725565b6113d2565b610340610ae7565b6103655760405162461bcd60e51b815260040161035c90613750565b60405180910390fd5b816001600160a01b03166002828154811061037c57fe5b6000918252602090912001546001600160a01b0316146103ae5760405162461bcd60e51b815260040161035c906136c0565b600280546103c390600163ffffffff61140216565b815481106103cd57fe5b600091825260209091200154600280546001600160a01b0390921691839081106103f357fe5b9060005260206000200160006101000a8154816001600160a01b0302191690836001600160a01b03160217905550600280548061042c57fe5b6000828152602080822083017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff90810180547fffffffffffffffffffffffff00000000000000000000000000000000000000001690559092019092556001600160a01b0384168083526003909152604080832080547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff001690555190917f29e92ab2e30f4f74283034c28c451b6faac986b554f1808101eb6418bdba19d491a25050565b6001600160a01b03851660009081526003602052604081205460ff166105275760405162461bcd60e51b815260040161035c90613720565b6040517ff670dde10000000000000000000000000000000000000000000000000000000081526001600160a01b0387169063f670dde1906105729088908890889088906004016135d0565b60206040518083038186803b15801561058a57600080fd5b505afa15801561059e573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052506105c2919081019061294e565b9695505050505050565b6006546040517f4f8e6e230000000000000000000000000000000000000000000000000000000081526000916001600160a01b031690634f8e6e2390610616908690600401613522565b60206040518083038186803b15801561062e57600080fd5b505afa158015610642573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525061066691908101906128ce565b6106825760405162461bcd60e51b815260040161035c906136f0565b61069d6001600160a01b03841633308563ffffffff61144b16565b6040517f42966c680000000000000000000000000000000000000000000000000000000081526001600160a01b038416906342966c68906106e2908590600401613870565b602060405180830381600087803b1580156106fc57600080fd5b505af1158015610710573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525061073491908101906128ce565b6107505760405162461bcd60e51b815260040161035c90613790565b5060015b92915050565b60005460ff1681565b606060028054806020026020016040519081016040528092919081815260200182805480156107bb57602002820191906000526020600020905b81546001600160a01b0316815260019091019060200180831161079d575b5050505050905090565b60005460ff16156107e85760405162461bcd60e51b815260040161035c90613650565b600080547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0016600117905561081c33611510565b60005b828110156108545761084b84848381811061083657fe5b90506020020160206102209190810190612725565b5060010161081f565b5061085e81610b10565b505050565b61086b610ae7565b6108875760405162461bcd60e51b815260040161035c90613750565b600080546040516101009091046001600160a01b0316907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0908390a3600080547fffffffffffffffffffffff0000000000000000000000000000000000000000ff169055565b60006108f7610ae7565b6109135760405162461bcd60e51b815260040161035c90613750565b6001600160a01b03821660009081526003602052604090205460ff161561094c5760405162461bcd60e51b815260040161035c90613640565b6001600160a01b0382166109725760405162461bcd60e51b815260040161035c90613740565b6002805460018082019092557f405787fa12a823e0f2b7631cc41b3ba8828b3321ca811111fa75cd3aa3bb5ace0180547fffffffffffffffffffffffff0000000000000000000000000000000000000000166001600160a01b03851690811790915560008181526003602052604080822080547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0016909417909355915190917f2ee2cb0721ec60b86190cae5c48e25064b69b35abad32452a4ec99d232033de291a260025461075490600163ffffffff61140216565b60056020819052600091825260409091205463ffffffff80821692640100000000830490911691680100000000000000008104820b916e0100000000000000000000000000008204810b9174010000000000000000000000000000000000000000810490910b907a010000000000000000000000000000000000000000000000000000900460ff1686565b60005461010090046001600160a01b031690565b6000805461010090046001600160a01b0316610b016115b3565b6001600160a01b031614905090565b610b18610ae7565b610b345760405162461bcd60e51b815260040161035c90613750565b6001600160a01b038116610b5a5760405162461bcd60e51b815260040161035c90613820565b6006546040516001600160a01b03918216918316907fb69e1c416d8be92ac92c8e97e77c4626fba5e6ab50161099f659ea3303479e5090600090a3600680547fffffffffffffffffffffffff0000000000000000000000000000000000000000166001600160a01b0392909216919091179055565b6001600160a01b03851660009081526003602052604081205460ff16610c075760405162461bcd60e51b815260040161035c90613720565b6040517f93c7e3bc0000000000000000000000000000000000000000000000000000000081526001600160a01b038716906393c7e3bc906105729088908890889088906004016135d0565b610c5a610ae7565b610c765760405162461bcd60e51b815260040161035c90613750565b610c7f816115b7565b6000826001600160a01b031660001b84189050816005600083815260200190815260200160002060008201518160000160006101000a81548163ffffffff021916908363ffffffff16021790555060208201518160000160046101000a81548163ffffffff021916908363ffffffff16021790555060408201518160000160086101000a81548165ffffffffffff021916908360050b65ffffffffffff160217905550606082015181600001600e6101000a81548165ffffffffffff021916908360050b65ffffffffffff16021790555060808201518160000160146101000a81548165ffffffffffff021916908360050b65ffffffffffff16021790555060a082015181600001601a6101000a81548160ff021916908360ff160217905550905050610e7582600460008481526020019081526020016000206040518060a00160405290816000820160009054906101000a900463ffffffff1663ffffffff1663ffffffff1681526020016000820160049054906101000a900463ffffffff1663ffffffff1663ffffffff1681526020016000820160089054906101000a900460050b60050b60050b815260200160008201600e9054906101000a900460050b60050b60050b81526020016000820160149054906101000a900460050b60050b60050b815250506117c290919063ffffffff16565b6000828152600460209081526040918290208351815492850151858501516060870151608090970151600590810b65ffffffffffff90811674010000000000000000000000000000000000000000027fffffffffffff000000000000ffffffffffffffffffffffffffffffffffffffff99830b82166e010000000000000000000000000000027fffffffffffffffffffffffff000000000000ffffffffffffffffffffffffffff9490930b90911668010000000000000000027fffffffffffffffffffffffffffffffffffff000000000000ffffffffffffffff63ffffffff958616640100000000027fffffffffffffffffffffffffffffffffffffffffffffffff00000000ffffffff969097167fffffffffffffffffffffffffffffffffffffffffffffffffffffffff00000000909916989098179490941694909417959095169190911716929092179390931617909155517f1a082a1efaf1549c18917ddcb1f759680c29371609e24f4b946e93acf4ce5ad290610ffa908690869086906135f8565b60405180910390a150505050565b6002818154811061101557fe5b6000918252602090912001546001600160a01b0316905081565b6006546001600160a01b031681565b600180548101908190556001600160a01b03871660009081526003602052604081205490919060ff166110835760405162461bcd60e51b815260040161035c90613720565b6040517fd3385d050000000000000000000000000000000000000000000000000000000081526001600160a01b0389169063d3385d05906110ce908a908a908a908a906004016135d0565b602060405180830381600087803b1580156110e857600080fd5b505af11580156110fc573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250611120919081019061294e565b9150828211156111425760405162461bcd60e51b815260040161035c906136a0565b61114f8787848888611817565b61115a3387846118ea565b611165338686611b33565b856001600160a01b0316336001600160a01b0316887fe7b046415cac9de47940c3087e06db13a0e058ccf53ac5f0edd49ebb4c2c3a6f8b89878a6040516111af9493929190613573565b60405180910390a460015481146111d85760405162461bcd60e51b815260040161035c90613710565b509695505050505050565b60036020526000908152604090205460ff1681565b600180548101908190556001600160a01b03871660009081526003602052604081205490919060ff1661123d5760405162461bcd60e51b815260040161035c90613720565b6040517f42bfc99c0000000000000000000000000000000000000000000000000000000081526001600160a01b038916906342bfc99c90611288908a908a908a908a906004016135d0565b602060405180830381600087803b1580156112a257600080fd5b505af11580156112b6573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052506112da919081019061294e565b9150828210156112fc5760405162461bcd60e51b815260040161035c906137d0565b6113098787868886611817565b6113143387866118ea565b61131f338684611b33565b856001600160a01b0316336001600160a01b0316887fe7b046415cac9de47940c3087e06db13a0e058ccf53ac5f0edd49ebb4c2c3a6f8b8989886040516111af9493929190613573565b60046020526000908152604090205463ffffffff80821691640100000000810490911690680100000000000000008104600590810b916e0100000000000000000000000000008104820b9174010000000000000000000000000000000000000000909104900b85565b6113da610ae7565b6113f65760405162461bcd60e51b815260040161035c90613750565b6113ff81611510565b50565b600061144483836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f770000815250611ddf565b9392505050565b60405161150a9085907f23b872dd00000000000000000000000000000000000000000000000000000000906114889087908790879060240161354b565b604080517fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe08184030181529190526020810180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff167fffffffff0000000000000000000000000000000000000000000000000000000090931692909217909152611e0b565b50505050565b6001600160a01b0381166115365760405162461bcd60e51b815260040161035c90613670565b600080546040516001600160a01b038085169361010090930416917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e091a3600080546001600160a01b03909216610100027fffffffffffffffffffffff0000000000000000000000000000000000000000ff909216919091179055565b3390565b60a081015160021615806115d1575060a081015160011615155b6115ed5760405162461bcd60e51b815260040161035c906136b0565b60a081015160011615806116075750805163ffffffff1615155b6116235760405162461bcd60e51b815260040161035c90613730565b60a0810151600216158061164157506000816020015163ffffffff16115b61165d5760405162461bcd60e51b815260040161035c906136e0565b60a0810151600116158061167857506000816040015160050b135b6116945760405162461bcd60e51b815260040161035c90613770565b60a081015160021615806116af57506000816060015160050b135b6116cb5760405162461bcd60e51b815260040161035c90613660565b60a081015160041615806116e657506000816080015160050b135b6117025760405162461bcd60e51b815260040161035c90613800565b60a081015160039081161415806117265750806060015160050b816040015160050b125b6117425760405162461bcd60e51b815260040161035c90613760565b60a081015160069081161415806117665750806080015160050b816060015160050b125b6117825760405162461bcd60e51b815260040161035c906137a0565b60a081015160059081161415806117a65750806080015160050b816040015160050b125b6113ff5760405162461bcd60e51b815260040161035c90613680565b6117ca61258a565b6000808452602084015260a08201516001166117e857600060408401525b60a08201516002166117fc57600060608401525b60a082015160041661181057600060808401525b5090919050565b6001600160a01b038481169083167f7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff8511156118655760405162461bcd60e51b815260040161035c90613780565b7f7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff8311156118a55760405162461bcd60e51b815260040161035c906137b0565b6118b28288188688611ef0565b6118e1818818847fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0286611ef0565b50505050505050565b6006546040517f4f8e6e230000000000000000000000000000000000000000000000000000000081526001600160a01b0390911690634f8e6e2390611933908590600401613522565b60206040518083038186803b15801561194b57600080fd5b505afa15801561195f573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525061198391908101906128ce565b15611a5b576119a36001600160a01b03831684308463ffffffff61144b16565b6040517f42966c680000000000000000000000000000000000000000000000000000000081526001600160a01b038316906342966c68906119e8908490600401613870565b602060405180830381600087803b158015611a0257600080fd5b505af1158015611a16573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250611a3a91908101906128ce565b611a565760405162461bcd60e51b815260040161035c90613790565b61085e565b6006546040517fcae182fe0000000000000000000000000000000000000000000000000000000081526001600160a01b039091169063cae182fe90611aa4908590600401613522565b60206040518083038186803b158015611abc57600080fd5b505afa158015611ad0573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250611af491908101906128ce565b15611b1b57600654611a56906001600160a01b03848116918691168463ffffffff61144b16565b60405162461bcd60e51b815260040161035c90613840565b6006546040517f4f8e6e230000000000000000000000000000000000000000000000000000000081526001600160a01b0390911690634f8e6e2390611b7c908590600401613522565b60206040518083038186803b158015611b9457600080fd5b505afa158015611ba8573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250611bcc91908101906128ce565b15611c86576040517f40c10f190000000000000000000000000000000000000000000000000000000081526001600160a01b038316906340c10f1990611c189086908590600401613530565b602060405180830381600087803b158015611c3257600080fd5b505af1158015611c46573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250611c6a91908101906128ce565b611a565760405162461bcd60e51b815260040161035c90613810565b6006546040517fcae182fe0000000000000000000000000000000000000000000000000000000081526001600160a01b039091169063cae182fe90611ccf908590600401613522565b60206040518083038186803b158015611ce757600080fd5b505afa158015611cfb573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250611d1f91908101906128ce565b15611b1b576006546040517f6be383fc0000000000000000000000000000000000000000000000000000000081526001600160a01b0390911690636be383fc90611d719085908790869060040161354b565b602060405180830381600087803b158015611d8b57600080fd5b505af1158015611d9f573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250611dc391908101906128ce565b611a565760405162461bcd60e51b815260040161035c90613850565b60008184841115611e035760405162461bcd60e51b815260040161035c919061362f565b505050900390565b611e1d826001600160a01b031661225a565b611e395760405162461bcd60e51b815260040161035c90613860565b60006060836001600160a01b031683604051611e559190613516565b6000604051808303816000865af19150503d8060008114611e92576040519150601f19603f3d011682016040523d82523d6000602084013e611e97565b606091505b509150915081611eb95760405162461bcd60e51b815260040161035c906136d0565b80511561150a5780806020019051611ed491908101906128ce565b61150a5760405162461bcd60e51b815260040161035c90613830565b611ef86125b8565b50600083815260056020818152604092839020835160c081018552905463ffffffff808216835264010000000082041692820192909252680100000000000000008204830b830b830b938101939093526e0100000000000000000000000000008104820b820b820b6060840152740100000000000000000000000000000000000000008104820b820b90910b60808301527a010000000000000000000000000000000000000000000000000000900460ff1660a082018190521561150a57611fbe61258a565b50600084815260046020818152604092839020835160a081018552905463ffffffff808216835264010000000082041682840152680100000000000000008104600590810b810b810b838701526e0100000000000000000000000000008204810b810b810b606084015274010000000000000000000000000000000000000000909104810b810b900b608082015283517f313ce567000000000000000000000000000000000000000000000000000000008152935190936120ef93869389936001600160a01b038a169363313ce56793818101939291829003018186803b1580156120a857600080fd5b505afa1580156120bc573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052506120e0919081019061296c565b8492919063ffffffff61229616565b9050612101818363ffffffff6123bd16565b60009485526004602090815260409586902082518154928401519784015160608501516080909501517fffffffffffffffffffffffffffffffffffffffffffffffffffffffff0000000090941663ffffffff928316177fffffffffffffffffffffffffffffffffffffffffffffffff00000000ffffffff166401000000009290991691909102979097177fffffffffffffffffffffffffffffffffffff000000000000ffffffffffffffff1668010000000000000000600598890b65ffffffffffff90811691909102919091177fffffffffffffffffffffffff000000000000ffffffffffffffffffffffffffff166e01000000000000000000000000000094890b821694909402939093177fffffffffffff000000000000ffffffffffffffffffffffffffffffffffffffff16740100000000000000000000000000000000000000009290970b929092160294909417909355505050565b6000813f7fc5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a47081811480159061228e57508115155b949350505050565b61229e61258a565b60008260ff16600a0a84816122af57fe5b059050657fffffffffff8113156122d85760405162461bcd60e51b815260040161035c906137e0565b600081156122e657816122e9565b60015b60a08701519091506001161561238a57855187510163ffffffff1642111561231c576000604088015263ffffffff421687525b61232a87604001518261252c565b600590810b900b604088015260a08601516002161561238a57856020015187602001510163ffffffff1642111561236f576000606088015263ffffffff421660208801525b61237d87606001518261252c565b600590810b900b60608801525b60a0860151600416156123b2576123a587608001518261252c565b600590810b900b60808801525b509495945050505050565b60a0810151600116158015906124195750816040015160050b81604001517fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0260050b13806124195750806040015160050b826040015160050b135b156124365760405162461bcd60e51b815260040161035c906137c0565b60a0810151600216158015906124925750816060015160050b81606001517fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0260050b13806124925750806060015160050b826060015160050b135b156124af5760405162461bcd60e51b815260040161035c90613700565b60a08101516004161580159061250b5750816080015160050b81608001517fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0260050b138061250b5750806080015160050b826080015160050b135b156125285760405162461bcd60e51b815260040161035c906137f0565b5050565b6000600582810b9084900b017fffffffffffffffffffffffffffffffffffffffffffffffffffff800000000001811280159061256e5750657fffffffffff8113155b6114445760405162461bcd60e51b815260040161035c90613690565b6040805160a08101825260008082526020820181905291810182905260608101829052608081019190915290565b6040805160c081018252600080825260208201819052918101829052606081018290526080810182905260a081019190915290565b8035610754816139f3565b60008083601f84011261260a57600080fd5b50813567ffffffffffffffff81111561262257600080fd5b60208301915083602082028301111561263a57600080fd5b9250929050565b805161075481613a07565b803561075481613a10565b803561075481613a19565b600060c0828403121561267457600080fd5b61267e60c061391a565b9050600061268c8484612704565b825250602061269d84848301612704565b60208301525060406126b184828501612657565b60408301525060606126c584828501612657565b60608301525060806126d984828501612657565b60808301525060a06126ed8482850161270f565b60a08301525092915050565b805161075481613a10565b803561075481613a22565b803561075481613a2b565b805161075481613a2b565b60006020828403121561273757600080fd5b600061228e84846125ed565b600080600080600060a0868803121561275b57600080fd5b600061276788886125ed565b95505060206127788882890161264c565b9450506040612789888289016125ed565b935050606061279a888289016125ed565b92505060806127ab8882890161264c565b9150509295509295909350565b60008060008060008060c087890312156127d157600080fd5b60006127dd89896125ed565b96505060206127ee89828a0161264c565b95505060406127ff89828a016125ed565b945050606061281089828a016125ed565b935050608061282189828a0161264c565b92505060a061283289828a0161264c565b9150509295509295509295565b6000806040838503121561285257600080fd5b600061285e85856125ed565b925050602061286f8582860161264c565b9150509250929050565b60008060006040848603121561288e57600080fd5b833567ffffffffffffffff8111156128a557600080fd5b6128b1868287016125f8565b935093505060206128c4868287016125ed565b9150509250925092565b6000602082840312156128e057600080fd5b600061228e8484612641565b6000602082840312156128fe57600080fd5b600061228e848461264c565b6000806000610100848603121561292057600080fd5b600061292c868661264c565b935050602061293d868287016125ed565b92505060406128c486828701612662565b60006020828403121561296057600080fd5b600061228e84846126f9565b60006020828403121561297e57600080fd5b600061228e848461271a565b600061299683836129ad565b505060200190565b6129a78161398d565b82525050565b6129a781613959565b60006129c182613947565b6129cb818561394b565b93506129d683613941565b8060005b838110156123b25781516129ee888261298a565b97506129f983613941565b9250506001016129da565b6129a781613964565b6129a781613969565b6000612a2182613947565b612a2b8185613954565b9350612a3b81856020860161399f565b9290920192915050565b6129a781613994565b6129a78161396c565b6000612a6282613947565b612a6c818561394b565b9350612a7c81856020860161399f565b612a85816139cb565b9093019392505050565b6000612a9c602b8361394b565b7f45786368616e676550726f766964657220616c7265616479206578697374732081527f696e20746865206c697374000000000000000000000000000000000000000000602082015260400192915050565b6000612afb601c8361394b565b7f636f6e747261637420616c726561647920696e697469616c697a656400000000815260200192915050565b6000612b34601e8361394b565b7f6c696d6974312063616e2774206265207a65726f206966206163746976650000815260200192915050565b6000612b6d60268361394b565b7f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206181527f6464726573730000000000000000000000000000000000000000000000000000602082015260400192915050565b6000612bcc60278361394b565b7f6c696d6974476c6f62616c206d7573742062652067726561746572207468616e81527f206c696d69743000000000000000000000000000000000000000000000000000602082015260400192915050565b6000612c2b60178361394b565b7f696e743438206164646974696f6e206f766572666c6f77000000000000000000815260200192915050565b6000612c6460148361394b565b7f616d6f756e74496e4d6178206578636565646564000000000000000000000000815260200192915050565b6000612c9d60198361394b565b7f4c3120776974686f7574204c30206e6f7420616c6c6f77656400000000000000815260200192915050565b6000612cd6601c8361394b565b7f696e64657820646f65736e2774206d617463682070726f766964657200000000815260200192915050565b6000612d0f60208361394b565b7f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c6564815260200192915050565b6000612d4860218361394b565b7f74696d6573746570312063616e2774206265207a65726f20696620616374697681527f6500000000000000000000000000000000000000000000000000000000000000602082015260400192915050565b6000612da760248361394b565b7f546f6b656e206d7573742062652061207265736572766520737461626c65206181527f7373657400000000000000000000000000000000000000000000000000000000602082015260400192915050565b6000612e06600b8361394b565b7f4c31204578636565646564000000000000000000000000000000000000000000815260200192915050565b6000612e3f600e8361394b565b7f7265656e7472616e742063616c6c000000000000000000000000000000000000815260200192915050565b6000612e78601f8361394b565b7f45786368616e676550726f766964657220646f6573206e6f7420657869737400815260200192915050565b6000612eb160218361394b565b7f74696d6573746570302063616e2774206265207a65726f20696620616374697681527f6500000000000000000000000000000000000000000000000000000000000000602082015260400192915050565b6000612f1060238361394b565b7f45786368616e676550726f766964657220616464726573732063616e2774206281527f6520300000000000000000000000000000000000000000000000000000000000602082015260400192915050565b6000612f6f60208361394b565b7f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572815260200192915050565b6000612fa860228361394b565b7f6c696d697431206d7573742062652067726561746572207468616e206c696d6981527f7430000000000000000000000000000000000000000000000000000000000000602082015260400192915050565b6000613007601e8361394b565b7f6c696d6974302063616e2774206265207a65726f206966206163746976650000815260200192915050565b600061304060128361394b565b7f616d6f756e74496e20746f6f206c617267650000000000000000000000000000815260200192915050565b600061307960228361394b565b7f4275726e696e67206f662074686520737461626c65206173736574206661696c81527f6564000000000000000000000000000000000000000000000000000000000000602082015260400192915050565b60006130d860278361394b565b7f6c696d6974476c6f62616c206d7573742062652067726561746572207468616e81527f206c696d69743100000000000000000000000000000000000000000000000000602082015260400192915050565b600061313760138361394b565b7f616d6f756e744f757420746f6f206c6172676500000000000000000000000000815260200192915050565b6000613170600b8361394b565b7f4c30204578636565646564000000000000000000000000000000000000000000815260200192915050565b60006131a960148361394b565b7f616d6f756e744f75744d696e206e6f74206d6574000000000000000000000000815260200192915050565b60006131e2600f8361394b565b7f64466c6f7720746f6f206c617267650000000000000000000000000000000000815260200192915050565b600061321b600b8361394b565b7f4c47204578636565646564000000000000000000000000000000000000000000815260200192915050565b600061325460238361394b565b7f6c696d6974476c6f62616c2063616e2774206265207a65726f2069662061637481527f6976650000000000000000000000000000000000000000000000000000000000602082015260400192915050565b60006132b360228361394b565b7f4d696e74696e67206f662074686520737461626c65206173736574206661696c81527f6564000000000000000000000000000000000000000000000000000000000000602082015260400192915050565b6000613312601b8361394b565b7f526573657276652061646472657373206d757374206265207365740000000000815260200192915050565b600061334b602a8361394b565b7f5361666545524332303a204552433230206f7065726174696f6e20646964206e81527f6f74207375636365656400000000000000000000000000000000000000000000602082015260400192915050565b60006133aa60298361394b565b7f546f6b656e206d75737420626520737461626c65206f7220636f6c6c6174657281527f616c206173736572740000000000000000000000000000000000000000000000602082015260400192915050565b600061340960278361394b565b7f5472616e73666572206f662074686520636f6c6c61746572616c20617373657481527f206661696c656400000000000000000000000000000000000000000000000000602082015260400192915050565b6000613468601f8361394b565b7f5361666545524332303a2063616c6c20746f206e6f6e2d636f6e747261637400815260200192915050565b805160c08301906134a58482613504565b5060208201516134b86020850182613504565b5060408201516134cb6040850182612a4e565b5060608201516134de6060850182612a4e565b5060808201516134f16080850182612a4e565b5060a082015161150a60a085018261350d565b6129a78161397e565b6129a781613987565b60006114448284612a16565b6020810161075482846129ad565b6040810161353e828561299e565b6114446020830184612a0d565b6060810161355982866129ad565b61356660208301856129ad565b61228e6040830184612a0d565b6080810161358182876129ad565b61358e60208301866129ad565b61359b6040830185612a0d565b6135a86060830184612a0d565b95945050505050565b6020808252810161144481846129b6565b602081016107548284612a04565b608081016135de8287612a0d565b6135eb60208301866129ad565b61359b60408301856129ad565b61010081016136078286612a0d565b61361460208301856129ad565b61228e6040830184613494565b602081016107548284612a45565b602080825281016114448184612a57565b6020808252810161075481612a8f565b6020808252810161075481612aee565b6020808252810161075481612b27565b6020808252810161075481612b60565b6020808252810161075481612bbf565b6020808252810161075481612c1e565b6020808252810161075481612c57565b6020808252810161075481612c90565b6020808252810161075481612cc9565b6020808252810161075481612d02565b6020808252810161075481612d3b565b6020808252810161075481612d9a565b6020808252810161075481612df9565b6020808252810161075481612e32565b6020808252810161075481612e6b565b6020808252810161075481612ea4565b6020808252810161075481612f03565b6020808252810161075481612f62565b6020808252810161075481612f9b565b6020808252810161075481612ffa565b6020808252810161075481613033565b602080825281016107548161306c565b60208082528101610754816130cb565b602080825281016107548161312a565b6020808252810161075481613163565b602080825281016107548161319c565b60208082528101610754816131d5565b602080825281016107548161320e565b6020808252810161075481613247565b60208082528101610754816132a6565b6020808252810161075481613305565b602080825281016107548161333e565b602080825281016107548161339d565b60208082528101610754816133fc565b602080825281016107548161345b565b602081016107548284612a0d565b60a0810161388c8288613504565b6138996020830187613504565b6138a66040830186612a4e565b6138b36060830185612a4e565b6105c26080830184612a4e565b60c081016138ce8289613504565b6138db6020830188613504565b6138e86040830187612a4e565b6138f56060830186612a4e565b6139026080830185612a4e565b61390f60a083018461350d565b979650505050505050565b60405181810167ffffffffffffffff8111828210171561393957600080fd5b604052919050565b60200190565b5190565b90815260200190565b919050565b600061075482613972565b151590565b90565b60050b90565b6001600160a01b031690565b63ffffffff1690565b60ff1690565b6000610754825b600061075482613959565b60005b838110156139ba5781810151838201526020016139a2565b8381111561150a5750506000910152565b601f017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe01690565b6139fc81613959565b81146113ff57600080fd5b6139fc81613964565b6139fc81613969565b6139fc8161396c565b6139fc8161397e565b6139fc8161398756fea365627a7a7231582009020e48eeea2b6a9d3dd2ecbfafc07fe7dbcfed935c640b6497d70f64ca262e6c6578706572696d656e74616cf564736f6c63430005110040","optimization_enabled":true,"verified_twin_address_hash":null,"is_verified":true,"compiler_settings":{"evmVersion":"istanbul","libraries":{"AddressLinkedList":"0x6200f54d73491d56b8d7a975c9ee18efb4d518df","AddressSortedLinkedListWithMedian":"0xed477a99035d0c1e11369f1d7a4e587893cc002b"},"optimizer":{"enabled":true,"runs":10000},"remappings":[":celo-foundry/=lib/celo-foundry/src/",":contracts/=contracts/",":ds-test/=lib/celo-foundry/lib/forge-std/lib/ds-test/src/",":forge-std-next/=lib/mento-core-2.2.0/lib/forge-std-next/src/",":forge-std/=lib/celo-foundry/lib/forge-std/src/",":mento-core-2.0.0/=lib/mento-core-2.0.0/contracts/",":mento-core-2.1.0/=lib/mento-core-2.1.0/contracts/",":mento-core-2.2.0/=lib/mento-core-2.2.0/contracts/",":openzeppelin-contracts-next/=lib/mento-core-2.2.0/lib/openzeppelin-contracts-next/",":openzeppelin-contracts-upgradeable/=lib/mento-core-2.2.0/lib/openzeppelin-contracts-upgradeable/",":openzeppelin-contracts/=lib/mento-core-2.0.0/lib/openzeppelin-contracts/contracts/",":openzeppelin-solidity/=lib/mento-core-2.0.0/lib/openzeppelin-contracts/",":test/=lib/mento-core-2.0.0/test/"]},"optimization_runs":10000,"sourcify_repo_url":"https://repo.sourcify.dev/contracts/full_match/42220/0x1B78f6acD05e7BcB00f74863bfd8a7C264143e37/","decoded_constructor_args":[["false",{"internalType":"bool","name":"test","type":"bool"}]],"compiler_version":"0.5.17+commit.d19bba13","is_verified_via_verifier_alliance":false,"verified_at":"2024-11-18T03:17:45.567607Z","implementations":[],"proxy_type":null,"external_libraries":[{"name":"AddressLinkedList","address_hash":"0x6200F54D73491d56b8d7A975C9ee18EFb4D518Df"},{"name":"AddressSortedLinkedListWithMedian","address_hash":"0xED477A99035d0c1e11369F1D7A4e587893cc002B"}],"creation_bytecode":"0x60806040523480156200001157600080fd5b5060405162003ba238038062003ba28339810160408190526200003491620000d3565b808062000049576000805460ff191660011790555b5060006200005f6001600160e01b03620000bc16565b60008054610100600160a81b0319166101006001600160a01b038416908102919091178255604051929350917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0908290a35050600180556200011b565b3390565b8051620000cd8162000101565b92915050565b600060208284031215620000e657600080fd5b6000620000f48484620000c0565b949350505050565b151590565b6200010c81620000fc565b81146200011857600080fd5b50565b613a77806200012b6000396000f3fe608060405234801561001057600080fd5b50600436106101775760003560e01c80638f32d59b116100d8578063cd3293de1161008c578063ddbbe85011610066578063ddbbe850146102ee578063f01ecd1714610301578063f2fde38b1461032557610177565b8063cd3293de146102b3578063d163b135146102c8578063d1d786b1146102db57610177565b8063a20f2305116100bd578063a20f23051461027a578063a9b5aab31461028d578063c4454fdc146102a057610177565b80638f32d59b1461025f5780639cecc80a1461026757610177565b8063462d0b2e1161012f57806373ec4cf41161011457806373ec4cf414610212578063821a816c146102255780638da5cb5b1461024a57610177565b8063462d0b2e146101f7578063715018a61461020a57610177565b8063131cab2a11610160578063131cab2a146101ba578063158ef93e146101da5780632cac2568146101e257610177565b806304710d531461017c57806304e4564014610191575b600080fd5b61018f61018a36600461283f565b610338565b005b6101a461019f366004612743565b6104ef565b6040516101b19190613870565b60405180910390f35b6101cd6101c836600461283f565b6105cc565b6040516101b191906135c2565b6101cd61075a565b6101ea610763565b6040516101b191906135b1565b61018f610205366004612879565b6107c5565b61018f610863565b6101a4610220366004612725565b6108ed565b6102386102333660046128ec565b610a48565b6040516101b1969594939291906138c0565b610252610ad3565b6040516101b19190613522565b6101cd610ae7565b61018f610275366004612725565b610b10565b6101a4610288366004612743565b610bcf565b61018f61029b36600461290a565b610c52565b6102526102ae3660046128ec565b611008565b6102bb61102f565b6040516101b19190613621565b6101a46102d63660046127b8565b61103e565b6101cd6102e9366004612725565b6111e3565b6101a46102fc3660046127b8565b6111f8565b61031461030f3660046128ec565b611369565b6040516101b195949392919061387e565b61018f610333366004612725565b6113d2565b610340610ae7565b6103655760405162461bcd60e51b815260040161035c90613750565b60405180910390fd5b816001600160a01b03166002828154811061037c57fe5b6000918252602090912001546001600160a01b0316146103ae5760405162461bcd60e51b815260040161035c906136c0565b600280546103c390600163ffffffff61140216565b815481106103cd57fe5b600091825260209091200154600280546001600160a01b0390921691839081106103f357fe5b9060005260206000200160006101000a8154816001600160a01b0302191690836001600160a01b03160217905550600280548061042c57fe5b6000828152602080822083017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff90810180547fffffffffffffffffffffffff00000000000000000000000000000000000000001690559092019092556001600160a01b0384168083526003909152604080832080547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff001690555190917f29e92ab2e30f4f74283034c28c451b6faac986b554f1808101eb6418bdba19d491a25050565b6001600160a01b03851660009081526003602052604081205460ff166105275760405162461bcd60e51b815260040161035c90613720565b6040517ff670dde10000000000000000000000000000000000000000000000000000000081526001600160a01b0387169063f670dde1906105729088908890889088906004016135d0565b60206040518083038186803b15801561058a57600080fd5b505afa15801561059e573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052506105c2919081019061294e565b9695505050505050565b6006546040517f4f8e6e230000000000000000000000000000000000000000000000000000000081526000916001600160a01b031690634f8e6e2390610616908690600401613522565b60206040518083038186803b15801561062e57600080fd5b505afa158015610642573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525061066691908101906128ce565b6106825760405162461bcd60e51b815260040161035c906136f0565b61069d6001600160a01b03841633308563ffffffff61144b16565b6040517f42966c680000000000000000000000000000000000000000000000000000000081526001600160a01b038416906342966c68906106e2908590600401613870565b602060405180830381600087803b1580156106fc57600080fd5b505af1158015610710573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525061073491908101906128ce565b6107505760405162461bcd60e51b815260040161035c90613790565b5060015b92915050565b60005460ff1681565b606060028054806020026020016040519081016040528092919081815260200182805480156107bb57602002820191906000526020600020905b81546001600160a01b0316815260019091019060200180831161079d575b5050505050905090565b60005460ff16156107e85760405162461bcd60e51b815260040161035c90613650565b600080547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0016600117905561081c33611510565b60005b828110156108545761084b84848381811061083657fe5b90506020020160206102209190810190612725565b5060010161081f565b5061085e81610b10565b505050565b61086b610ae7565b6108875760405162461bcd60e51b815260040161035c90613750565b600080546040516101009091046001600160a01b0316907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0908390a3600080547fffffffffffffffffffffff0000000000000000000000000000000000000000ff169055565b60006108f7610ae7565b6109135760405162461bcd60e51b815260040161035c90613750565b6001600160a01b03821660009081526003602052604090205460ff161561094c5760405162461bcd60e51b815260040161035c90613640565b6001600160a01b0382166109725760405162461bcd60e51b815260040161035c90613740565b6002805460018082019092557f405787fa12a823e0f2b7631cc41b3ba8828b3321ca811111fa75cd3aa3bb5ace0180547fffffffffffffffffffffffff0000000000000000000000000000000000000000166001600160a01b03851690811790915560008181526003602052604080822080547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0016909417909355915190917f2ee2cb0721ec60b86190cae5c48e25064b69b35abad32452a4ec99d232033de291a260025461075490600163ffffffff61140216565b60056020819052600091825260409091205463ffffffff80821692640100000000830490911691680100000000000000008104820b916e0100000000000000000000000000008204810b9174010000000000000000000000000000000000000000810490910b907a010000000000000000000000000000000000000000000000000000900460ff1686565b60005461010090046001600160a01b031690565b6000805461010090046001600160a01b0316610b016115b3565b6001600160a01b031614905090565b610b18610ae7565b610b345760405162461bcd60e51b815260040161035c90613750565b6001600160a01b038116610b5a5760405162461bcd60e51b815260040161035c90613820565b6006546040516001600160a01b03918216918316907fb69e1c416d8be92ac92c8e97e77c4626fba5e6ab50161099f659ea3303479e5090600090a3600680547fffffffffffffffffffffffff0000000000000000000000000000000000000000166001600160a01b0392909216919091179055565b6001600160a01b03851660009081526003602052604081205460ff16610c075760405162461bcd60e51b815260040161035c90613720565b6040517f93c7e3bc0000000000000000000000000000000000000000000000000000000081526001600160a01b038716906393c7e3bc906105729088908890889088906004016135d0565b610c5a610ae7565b610c765760405162461bcd60e51b815260040161035c90613750565b610c7f816115b7565b6000826001600160a01b031660001b84189050816005600083815260200190815260200160002060008201518160000160006101000a81548163ffffffff021916908363ffffffff16021790555060208201518160000160046101000a81548163ffffffff021916908363ffffffff16021790555060408201518160000160086101000a81548165ffffffffffff021916908360050b65ffffffffffff160217905550606082015181600001600e6101000a81548165ffffffffffff021916908360050b65ffffffffffff16021790555060808201518160000160146101000a81548165ffffffffffff021916908360050b65ffffffffffff16021790555060a082015181600001601a6101000a81548160ff021916908360ff160217905550905050610e7582600460008481526020019081526020016000206040518060a00160405290816000820160009054906101000a900463ffffffff1663ffffffff1663ffffffff1681526020016000820160049054906101000a900463ffffffff1663ffffffff1663ffffffff1681526020016000820160089054906101000a900460050b60050b60050b815260200160008201600e9054906101000a900460050b60050b60050b81526020016000820160149054906101000a900460050b60050b60050b815250506117c290919063ffffffff16565b6000828152600460209081526040918290208351815492850151858501516060870151608090970151600590810b65ffffffffffff90811674010000000000000000000000000000000000000000027fffffffffffff000000000000ffffffffffffffffffffffffffffffffffffffff99830b82166e010000000000000000000000000000027fffffffffffffffffffffffff000000000000ffffffffffffffffffffffffffff9490930b90911668010000000000000000027fffffffffffffffffffffffffffffffffffff000000000000ffffffffffffffff63ffffffff958616640100000000027fffffffffffffffffffffffffffffffffffffffffffffffff00000000ffffffff969097167fffffffffffffffffffffffffffffffffffffffffffffffffffffffff00000000909916989098179490941694909417959095169190911716929092179390931617909155517f1a082a1efaf1549c18917ddcb1f759680c29371609e24f4b946e93acf4ce5ad290610ffa908690869086906135f8565b60405180910390a150505050565b6002818154811061101557fe5b6000918252602090912001546001600160a01b0316905081565b6006546001600160a01b031681565b600180548101908190556001600160a01b03871660009081526003602052604081205490919060ff166110835760405162461bcd60e51b815260040161035c90613720565b6040517fd3385d050000000000000000000000000000000000000000000000000000000081526001600160a01b0389169063d3385d05906110ce908a908a908a908a906004016135d0565b602060405180830381600087803b1580156110e857600080fd5b505af11580156110fc573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250611120919081019061294e565b9150828211156111425760405162461bcd60e51b815260040161035c906136a0565b61114f8787848888611817565b61115a3387846118ea565b611165338686611b33565b856001600160a01b0316336001600160a01b0316887fe7b046415cac9de47940c3087e06db13a0e058ccf53ac5f0edd49ebb4c2c3a6f8b89878a6040516111af9493929190613573565b60405180910390a460015481146111d85760405162461bcd60e51b815260040161035c90613710565b509695505050505050565b60036020526000908152604090205460ff1681565b600180548101908190556001600160a01b03871660009081526003602052604081205490919060ff1661123d5760405162461bcd60e51b815260040161035c90613720565b6040517f42bfc99c0000000000000000000000000000000000000000000000000000000081526001600160a01b038916906342bfc99c90611288908a908a908a908a906004016135d0565b602060405180830381600087803b1580156112a257600080fd5b505af11580156112b6573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052506112da919081019061294e565b9150828210156112fc5760405162461bcd60e51b815260040161035c906137d0565b6113098787868886611817565b6113143387866118ea565b61131f338684611b33565b856001600160a01b0316336001600160a01b0316887fe7b046415cac9de47940c3087e06db13a0e058ccf53ac5f0edd49ebb4c2c3a6f8b8989886040516111af9493929190613573565b60046020526000908152604090205463ffffffff80821691640100000000810490911690680100000000000000008104600590810b916e0100000000000000000000000000008104820b9174010000000000000000000000000000000000000000909104900b85565b6113da610ae7565b6113f65760405162461bcd60e51b815260040161035c90613750565b6113ff81611510565b50565b600061144483836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f770000815250611ddf565b9392505050565b60405161150a9085907f23b872dd00000000000000000000000000000000000000000000000000000000906114889087908790879060240161354b565b604080517fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe08184030181529190526020810180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff167fffffffff0000000000000000000000000000000000000000000000000000000090931692909217909152611e0b565b50505050565b6001600160a01b0381166115365760405162461bcd60e51b815260040161035c90613670565b600080546040516001600160a01b038085169361010090930416917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e091a3600080546001600160a01b03909216610100027fffffffffffffffffffffff0000000000000000000000000000000000000000ff909216919091179055565b3390565b60a081015160021615806115d1575060a081015160011615155b6115ed5760405162461bcd60e51b815260040161035c906136b0565b60a081015160011615806116075750805163ffffffff1615155b6116235760405162461bcd60e51b815260040161035c90613730565b60a0810151600216158061164157506000816020015163ffffffff16115b61165d5760405162461bcd60e51b815260040161035c906136e0565b60a0810151600116158061167857506000816040015160050b135b6116945760405162461bcd60e51b815260040161035c90613770565b60a081015160021615806116af57506000816060015160050b135b6116cb5760405162461bcd60e51b815260040161035c90613660565b60a081015160041615806116e657506000816080015160050b135b6117025760405162461bcd60e51b815260040161035c90613800565b60a081015160039081161415806117265750806060015160050b816040015160050b125b6117425760405162461bcd60e51b815260040161035c90613760565b60a081015160069081161415806117665750806080015160050b816060015160050b125b6117825760405162461bcd60e51b815260040161035c906137a0565b60a081015160059081161415806117a65750806080015160050b816040015160050b125b6113ff5760405162461bcd60e51b815260040161035c90613680565b6117ca61258a565b6000808452602084015260a08201516001166117e857600060408401525b60a08201516002166117fc57600060608401525b60a082015160041661181057600060808401525b5090919050565b6001600160a01b038481169083167f7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff8511156118655760405162461bcd60e51b815260040161035c90613780565b7f7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff8311156118a55760405162461bcd60e51b815260040161035c906137b0565b6118b28288188688611ef0565b6118e1818818847fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0286611ef0565b50505050505050565b6006546040517f4f8e6e230000000000000000000000000000000000000000000000000000000081526001600160a01b0390911690634f8e6e2390611933908590600401613522565b60206040518083038186803b15801561194b57600080fd5b505afa15801561195f573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525061198391908101906128ce565b15611a5b576119a36001600160a01b03831684308463ffffffff61144b16565b6040517f42966c680000000000000000000000000000000000000000000000000000000081526001600160a01b038316906342966c68906119e8908490600401613870565b602060405180830381600087803b158015611a0257600080fd5b505af1158015611a16573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250611a3a91908101906128ce565b611a565760405162461bcd60e51b815260040161035c90613790565b61085e565b6006546040517fcae182fe0000000000000000000000000000000000000000000000000000000081526001600160a01b039091169063cae182fe90611aa4908590600401613522565b60206040518083038186803b158015611abc57600080fd5b505afa158015611ad0573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250611af491908101906128ce565b15611b1b57600654611a56906001600160a01b03848116918691168463ffffffff61144b16565b60405162461bcd60e51b815260040161035c90613840565b6006546040517f4f8e6e230000000000000000000000000000000000000000000000000000000081526001600160a01b0390911690634f8e6e2390611b7c908590600401613522565b60206040518083038186803b158015611b9457600080fd5b505afa158015611ba8573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250611bcc91908101906128ce565b15611c86576040517f40c10f190000000000000000000000000000000000000000000000000000000081526001600160a01b038316906340c10f1990611c189086908590600401613530565b602060405180830381600087803b158015611c3257600080fd5b505af1158015611c46573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250611c6a91908101906128ce565b611a565760405162461bcd60e51b815260040161035c90613810565b6006546040517fcae182fe0000000000000000000000000000000000000000000000000000000081526001600160a01b039091169063cae182fe90611ccf908590600401613522565b60206040518083038186803b158015611ce757600080fd5b505afa158015611cfb573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250611d1f91908101906128ce565b15611b1b576006546040517f6be383fc0000000000000000000000000000000000000000000000000000000081526001600160a01b0390911690636be383fc90611d719085908790869060040161354b565b602060405180830381600087803b158015611d8b57600080fd5b505af1158015611d9f573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250611dc391908101906128ce565b611a565760405162461bcd60e51b815260040161035c90613850565b60008184841115611e035760405162461bcd60e51b815260040161035c919061362f565b505050900390565b611e1d826001600160a01b031661225a565b611e395760405162461bcd60e51b815260040161035c90613860565b60006060836001600160a01b031683604051611e559190613516565b6000604051808303816000865af19150503d8060008114611e92576040519150601f19603f3d011682016040523d82523d6000602084013e611e97565b606091505b509150915081611eb95760405162461bcd60e51b815260040161035c906136d0565b80511561150a5780806020019051611ed491908101906128ce565b61150a5760405162461bcd60e51b815260040161035c90613830565b611ef86125b8565b50600083815260056020818152604092839020835160c081018552905463ffffffff808216835264010000000082041692820192909252680100000000000000008204830b830b830b938101939093526e0100000000000000000000000000008104820b820b820b6060840152740100000000000000000000000000000000000000008104820b820b90910b60808301527a010000000000000000000000000000000000000000000000000000900460ff1660a082018190521561150a57611fbe61258a565b50600084815260046020818152604092839020835160a081018552905463ffffffff808216835264010000000082041682840152680100000000000000008104600590810b810b810b838701526e0100000000000000000000000000008204810b810b810b606084015274010000000000000000000000000000000000000000909104810b810b900b608082015283517f313ce567000000000000000000000000000000000000000000000000000000008152935190936120ef93869389936001600160a01b038a169363313ce56793818101939291829003018186803b1580156120a857600080fd5b505afa1580156120bc573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052506120e0919081019061296c565b8492919063ffffffff61229616565b9050612101818363ffffffff6123bd16565b60009485526004602090815260409586902082518154928401519784015160608501516080909501517fffffffffffffffffffffffffffffffffffffffffffffffffffffffff0000000090941663ffffffff928316177fffffffffffffffffffffffffffffffffffffffffffffffff00000000ffffffff166401000000009290991691909102979097177fffffffffffffffffffffffffffffffffffff000000000000ffffffffffffffff1668010000000000000000600598890b65ffffffffffff90811691909102919091177fffffffffffffffffffffffff000000000000ffffffffffffffffffffffffffff166e01000000000000000000000000000094890b821694909402939093177fffffffffffff000000000000ffffffffffffffffffffffffffffffffffffffff16740100000000000000000000000000000000000000009290970b929092160294909417909355505050565b6000813f7fc5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a47081811480159061228e57508115155b949350505050565b61229e61258a565b60008260ff16600a0a84816122af57fe5b059050657fffffffffff8113156122d85760405162461bcd60e51b815260040161035c906137e0565b600081156122e657816122e9565b60015b60a08701519091506001161561238a57855187510163ffffffff1642111561231c576000604088015263ffffffff421687525b61232a87604001518261252c565b600590810b900b604088015260a08601516002161561238a57856020015187602001510163ffffffff1642111561236f576000606088015263ffffffff421660208801525b61237d87606001518261252c565b600590810b900b60608801525b60a0860151600416156123b2576123a587608001518261252c565b600590810b900b60808801525b509495945050505050565b60a0810151600116158015906124195750816040015160050b81604001517fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0260050b13806124195750806040015160050b826040015160050b135b156124365760405162461bcd60e51b815260040161035c906137c0565b60a0810151600216158015906124925750816060015160050b81606001517fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0260050b13806124925750806060015160050b826060015160050b135b156124af5760405162461bcd60e51b815260040161035c90613700565b60a08101516004161580159061250b5750816080015160050b81608001517fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0260050b138061250b5750806080015160050b826080015160050b135b156125285760405162461bcd60e51b815260040161035c906137f0565b5050565b6000600582810b9084900b017fffffffffffffffffffffffffffffffffffffffffffffffffffff800000000001811280159061256e5750657fffffffffff8113155b6114445760405162461bcd60e51b815260040161035c90613690565b6040805160a08101825260008082526020820181905291810182905260608101829052608081019190915290565b6040805160c081018252600080825260208201819052918101829052606081018290526080810182905260a081019190915290565b8035610754816139f3565b60008083601f84011261260a57600080fd5b50813567ffffffffffffffff81111561262257600080fd5b60208301915083602082028301111561263a57600080fd5b9250929050565b805161075481613a07565b803561075481613a10565b803561075481613a19565b600060c0828403121561267457600080fd5b61267e60c061391a565b9050600061268c8484612704565b825250602061269d84848301612704565b60208301525060406126b184828501612657565b60408301525060606126c584828501612657565b60608301525060806126d984828501612657565b60808301525060a06126ed8482850161270f565b60a08301525092915050565b805161075481613a10565b803561075481613a22565b803561075481613a2b565b805161075481613a2b565b60006020828403121561273757600080fd5b600061228e84846125ed565b600080600080600060a0868803121561275b57600080fd5b600061276788886125ed565b95505060206127788882890161264c565b9450506040612789888289016125ed565b935050606061279a888289016125ed565b92505060806127ab8882890161264c565b9150509295509295909350565b60008060008060008060c087890312156127d157600080fd5b60006127dd89896125ed565b96505060206127ee89828a0161264c565b95505060406127ff89828a016125ed565b945050606061281089828a016125ed565b935050608061282189828a0161264c565b92505060a061283289828a0161264c565b9150509295509295509295565b6000806040838503121561285257600080fd5b600061285e85856125ed565b925050602061286f8582860161264c565b9150509250929050565b60008060006040848603121561288e57600080fd5b833567ffffffffffffffff8111156128a557600080fd5b6128b1868287016125f8565b935093505060206128c4868287016125ed565b9150509250925092565b6000602082840312156128e057600080fd5b600061228e8484612641565b6000602082840312156128fe57600080fd5b600061228e848461264c565b6000806000610100848603121561292057600080fd5b600061292c868661264c565b935050602061293d868287016125ed565b92505060406128c486828701612662565b60006020828403121561296057600080fd5b600061228e84846126f9565b60006020828403121561297e57600080fd5b600061228e848461271a565b600061299683836129ad565b505060200190565b6129a78161398d565b82525050565b6129a781613959565b60006129c182613947565b6129cb818561394b565b93506129d683613941565b8060005b838110156123b25781516129ee888261298a565b97506129f983613941565b9250506001016129da565b6129a781613964565b6129a781613969565b6000612a2182613947565b612a2b8185613954565b9350612a3b81856020860161399f565b9290920192915050565b6129a781613994565b6129a78161396c565b6000612a6282613947565b612a6c818561394b565b9350612a7c81856020860161399f565b612a85816139cb565b9093019392505050565b6000612a9c602b8361394b565b7f45786368616e676550726f766964657220616c7265616479206578697374732081527f696e20746865206c697374000000000000000000000000000000000000000000602082015260400192915050565b6000612afb601c8361394b565b7f636f6e747261637420616c726561647920696e697469616c697a656400000000815260200192915050565b6000612b34601e8361394b565b7f6c696d6974312063616e2774206265207a65726f206966206163746976650000815260200192915050565b6000612b6d60268361394b565b7f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206181527f6464726573730000000000000000000000000000000000000000000000000000602082015260400192915050565b6000612bcc60278361394b565b7f6c696d6974476c6f62616c206d7573742062652067726561746572207468616e81527f206c696d69743000000000000000000000000000000000000000000000000000602082015260400192915050565b6000612c2b60178361394b565b7f696e743438206164646974696f6e206f766572666c6f77000000000000000000815260200192915050565b6000612c6460148361394b565b7f616d6f756e74496e4d6178206578636565646564000000000000000000000000815260200192915050565b6000612c9d60198361394b565b7f4c3120776974686f7574204c30206e6f7420616c6c6f77656400000000000000815260200192915050565b6000612cd6601c8361394b565b7f696e64657820646f65736e2774206d617463682070726f766964657200000000815260200192915050565b6000612d0f60208361394b565b7f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c6564815260200192915050565b6000612d4860218361394b565b7f74696d6573746570312063616e2774206265207a65726f20696620616374697681527f6500000000000000000000000000000000000000000000000000000000000000602082015260400192915050565b6000612da760248361394b565b7f546f6b656e206d7573742062652061207265736572766520737461626c65206181527f7373657400000000000000000000000000000000000000000000000000000000602082015260400192915050565b6000612e06600b8361394b565b7f4c31204578636565646564000000000000000000000000000000000000000000815260200192915050565b6000612e3f600e8361394b565b7f7265656e7472616e742063616c6c000000000000000000000000000000000000815260200192915050565b6000612e78601f8361394b565b7f45786368616e676550726f766964657220646f6573206e6f7420657869737400815260200192915050565b6000612eb160218361394b565b7f74696d6573746570302063616e2774206265207a65726f20696620616374697681527f6500000000000000000000000000000000000000000000000000000000000000602082015260400192915050565b6000612f1060238361394b565b7f45786368616e676550726f766964657220616464726573732063616e2774206281527f6520300000000000000000000000000000000000000000000000000000000000602082015260400192915050565b6000612f6f60208361394b565b7f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572815260200192915050565b6000612fa860228361394b565b7f6c696d697431206d7573742062652067726561746572207468616e206c696d6981527f7430000000000000000000000000000000000000000000000000000000000000602082015260400192915050565b6000613007601e8361394b565b7f6c696d6974302063616e2774206265207a65726f206966206163746976650000815260200192915050565b600061304060128361394b565b7f616d6f756e74496e20746f6f206c617267650000000000000000000000000000815260200192915050565b600061307960228361394b565b7f4275726e696e67206f662074686520737461626c65206173736574206661696c81527f6564000000000000000000000000000000000000000000000000000000000000602082015260400192915050565b60006130d860278361394b565b7f6c696d6974476c6f62616c206d7573742062652067726561746572207468616e81527f206c696d69743100000000000000000000000000000000000000000000000000602082015260400192915050565b600061313760138361394b565b7f616d6f756e744f757420746f6f206c6172676500000000000000000000000000815260200192915050565b6000613170600b8361394b565b7f4c30204578636565646564000000000000000000000000000000000000000000815260200192915050565b60006131a960148361394b565b7f616d6f756e744f75744d696e206e6f74206d6574000000000000000000000000815260200192915050565b60006131e2600f8361394b565b7f64466c6f7720746f6f206c617267650000000000000000000000000000000000815260200192915050565b600061321b600b8361394b565b7f4c47204578636565646564000000000000000000000000000000000000000000815260200192915050565b600061325460238361394b565b7f6c696d6974476c6f62616c2063616e2774206265207a65726f2069662061637481527f6976650000000000000000000000000000000000000000000000000000000000602082015260400192915050565b60006132b360228361394b565b7f4d696e74696e67206f662074686520737461626c65206173736574206661696c81527f6564000000000000000000000000000000000000000000000000000000000000602082015260400192915050565b6000613312601b8361394b565b7f526573657276652061646472657373206d757374206265207365740000000000815260200192915050565b600061334b602a8361394b565b7f5361666545524332303a204552433230206f7065726174696f6e20646964206e81527f6f74207375636365656400000000000000000000000000000000000000000000602082015260400192915050565b60006133aa60298361394b565b7f546f6b656e206d75737420626520737461626c65206f7220636f6c6c6174657281527f616c206173736572740000000000000000000000000000000000000000000000602082015260400192915050565b600061340960278361394b565b7f5472616e73666572206f662074686520636f6c6c61746572616c20617373657481527f206661696c656400000000000000000000000000000000000000000000000000602082015260400192915050565b6000613468601f8361394b565b7f5361666545524332303a2063616c6c20746f206e6f6e2d636f6e747261637400815260200192915050565b805160c08301906134a58482613504565b5060208201516134b86020850182613504565b5060408201516134cb6040850182612a4e565b5060608201516134de6060850182612a4e565b5060808201516134f16080850182612a4e565b5060a082015161150a60a085018261350d565b6129a78161397e565b6129a781613987565b60006114448284612a16565b6020810161075482846129ad565b6040810161353e828561299e565b6114446020830184612a0d565b6060810161355982866129ad565b61356660208301856129ad565b61228e6040830184612a0d565b6080810161358182876129ad565b61358e60208301866129ad565b61359b6040830185612a0d565b6135a86060830184612a0d565b95945050505050565b6020808252810161144481846129b6565b602081016107548284612a04565b608081016135de8287612a0d565b6135eb60208301866129ad565b61359b60408301856129ad565b61010081016136078286612a0d565b61361460208301856129ad565b61228e6040830184613494565b602081016107548284612a45565b602080825281016114448184612a57565b6020808252810161075481612a8f565b6020808252810161075481612aee565b6020808252810161075481612b27565b6020808252810161075481612b60565b6020808252810161075481612bbf565b6020808252810161075481612c1e565b6020808252810161075481612c57565b6020808252810161075481612c90565b6020808252810161075481612cc9565b6020808252810161075481612d02565b6020808252810161075481612d3b565b6020808252810161075481612d9a565b6020808252810161075481612df9565b6020808252810161075481612e32565b6020808252810161075481612e6b565b6020808252810161075481612ea4565b6020808252810161075481612f03565b6020808252810161075481612f62565b6020808252810161075481612f9b565b6020808252810161075481612ffa565b6020808252810161075481613033565b602080825281016107548161306c565b60208082528101610754816130cb565b602080825281016107548161312a565b6020808252810161075481613163565b602080825281016107548161319c565b60208082528101610754816131d5565b602080825281016107548161320e565b6020808252810161075481613247565b60208082528101610754816132a6565b6020808252810161075481613305565b602080825281016107548161333e565b602080825281016107548161339d565b60208082528101610754816133fc565b602080825281016107548161345b565b602081016107548284612a0d565b60a0810161388c8288613504565b6138996020830187613504565b6138a66040830186612a4e565b6138b36060830185612a4e565b6105c26080830184612a4e565b60c081016138ce8289613504565b6138db6020830188613504565b6138e86040830187612a4e565b6138f56060830186612a4e565b6139026080830185612a4e565b61390f60a083018461350d565b979650505050505050565b60405181810167ffffffffffffffff8111828210171561393957600080fd5b604052919050565b60200190565b5190565b90815260200190565b919050565b600061075482613972565b151590565b90565b60050b90565b6001600160a01b031690565b63ffffffff1690565b60ff1690565b6000610754825b600061075482613959565b60005b838110156139ba5781810151838201526020016139a2565b8381111561150a5750506000910152565b601f017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe01690565b6139fc81613959565b81146113ff57600080fd5b6139fc81613964565b6139fc81613969565b6139fc8161396c565b6139fc8161397e565b6139fc8161398756fea365627a7a7231582009020e48eeea2b6a9d3dd2ecbfafc07fe7dbcfed935c640b6497d70f64ca262e6c6578706572696d656e74616cf564736f6c634300051100400000000000000000000000000000000000000000000000000000000000000000","name":"Broker","is_blueprint":false,"license_type":"none","is_fully_verified":true,"is_verified_via_eth_bytecode_db":true,"language":"solidity","evm_version":"istanbul","can_be_visualized_via_sol2uml":true,"is_verified_via_sourcify":true,"additional_sources":[{"file_path":"lib/mento-core-2.0.0/lib/openzeppelin-contracts/contracts/GSN/Context.sol","source_code":"pragma solidity ^0.5.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 GSN 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 */\ncontract Context {\n    // Empty internal constructor, to prevent people from mistakenly deploying\n    // an instance of this contract, which should be used via inheritance.\n    constructor () internal { }\n    // solhint-disable-previous-line no-empty-blocks\n\n    function _msgSender() internal view returns (address payable) {\n        return msg.sender;\n    }\n\n    function _msgData() internal view returns (bytes memory) {\n        this; // silence state mutability warning without generating bytecode - see https://github.com/ethereum/solidity/issues/2691\n        return msg.data;\n    }\n}\n"},{"file_path":"lib/mento-core-2.0.0/lib/openzeppelin-contracts/contracts/math/SafeMath.sol","source_code":"pragma solidity ^0.5.0;\n\n/**\n * @dev Wrappers over Solidity's arithmetic operations with added overflow\n * checks.\n *\n * Arithmetic operations in Solidity wrap on overflow. This can easily result\n * in bugs, because programmers usually assume that an overflow raises an\n * error, which is the standard behavior in high level programming languages.\n * `SafeMath` restores this intuition by reverting the transaction when an\n * operation overflows.\n *\n * Using this library instead of the unchecked operations eliminates an entire\n * class of bugs, so it's recommended to use it always.\n */\nlibrary SafeMath {\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     * - Addition cannot overflow.\n     */\n    function add(uint256 a, uint256 b) internal pure returns (uint256) {\n        uint256 c = a + b;\n        require(c >= a, \"SafeMath: addition overflow\");\n\n        return c;\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     * - Subtraction cannot overflow.\n     */\n    function sub(uint256 a, uint256 b) internal pure returns (uint256) {\n        return sub(a, b, \"SafeMath: subtraction overflow\");\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     * Counterpart to Solidity's `-` operator.\n     *\n     * Requirements:\n     * - Subtraction cannot overflow.\n     *\n     * _Available since v2.4.0._\n     */\n    function sub(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {\n        require(b <= a, errorMessage);\n        uint256 c = a - b;\n\n        return c;\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     * - Multiplication cannot overflow.\n     */\n    function mul(uint256 a, uint256 b) internal pure returns (uint256) {\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) {\n            return 0;\n        }\n\n        uint256 c = a * b;\n        require(c / a == b, \"SafeMath: multiplication overflow\");\n\n        return c;\n    }\n\n    /**\n     * @dev Returns the integer division of two unsigned integers. Reverts 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     * - The divisor cannot be zero.\n     */\n    function div(uint256 a, uint256 b) internal pure returns (uint256) {\n        return div(a, b, \"SafeMath: division by zero\");\n    }\n\n    /**\n     * @dev Returns the integer division of two unsigned integers. Reverts 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     * - The divisor cannot be zero.\n     *\n     * _Available since v2.4.0._\n     */\n    function div(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {\n        // Solidity only automatically asserts when dividing by 0\n        require(b > 0, errorMessage);\n        uint256 c = a / b;\n        // assert(a == b * c + a % b); // There is no case in which this doesn't hold\n\n        return c;\n    }\n\n    /**\n     * @dev Returns the remainder of dividing two unsigned integers. (unsigned integer modulo),\n     * Reverts 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     * - The divisor cannot be zero.\n     */\n    function mod(uint256 a, uint256 b) internal pure returns (uint256) {\n        return mod(a, b, \"SafeMath: modulo by zero\");\n    }\n\n    /**\n     * @dev Returns the remainder of dividing two unsigned integers. (unsigned integer modulo),\n     * Reverts with custom message 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     * - The divisor cannot be zero.\n     *\n     * _Available since v2.4.0._\n     */\n    function mod(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {\n        require(b != 0, errorMessage);\n        return a % b;\n    }\n}\n"},{"file_path":"lib/mento-core-2.0.0/lib/openzeppelin-contracts/contracts/ownership/Ownable.sol","source_code":"pragma solidity ^0.5.0;\n\nimport \"../GSN/Context.sol\";\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 * 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 */\ncontract 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 () internal {\n        address msgSender = _msgSender();\n        _owner = msgSender;\n        emit OwnershipTransferred(address(0), msgSender);\n    }\n\n    /**\n     * @dev Returns the address of the current owner.\n     */\n    function owner() public view 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(isOwner(), \"Ownable: caller is not the owner\");\n        _;\n    }\n\n    /**\n     * @dev Returns true if the caller is the current owner.\n     */\n    function isOwner() public view returns (bool) {\n        return _msgSender() == _owner;\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 onlyOwner {\n        emit OwnershipTransferred(_owner, address(0));\n        _owner = 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 onlyOwner {\n        _transferOwnership(newOwner);\n    }\n\n    /**\n     * @dev Transfers ownership of the contract to a new account (`newOwner`).\n     */\n    function _transferOwnership(address newOwner) internal {\n        require(newOwner != address(0), \"Ownable: new owner is the zero address\");\n        emit OwnershipTransferred(_owner, newOwner);\n        _owner = newOwner;\n    }\n}\n"},{"file_path":"lib/mento-core-2.0.0/lib/openzeppelin-contracts/contracts/token/ERC20/IERC20.sol","source_code":"pragma solidity ^0.5.0;\n\n/**\n * @dev Interface of the ERC20 standard as defined in the EIP. Does not include\n * the optional functions; to access them see {ERC20Detailed}.\n */\ninterface IERC20 {\n    /**\n     * @dev Returns the amount of tokens in existence.\n     */\n    function totalSupply() external view returns (uint256);\n\n    /**\n     * @dev Returns the amount of tokens owned by `account`.\n     */\n    function balanceOf(address account) external view returns (uint256);\n\n    /**\n     * @dev Moves `amount` tokens from the caller's account to `recipient`.\n     *\n     * Returns a boolean value indicating whether the operation succeeded.\n     *\n     * Emits a {Transfer} event.\n     */\n    function transfer(address recipient, uint256 amount) external returns (bool);\n\n    /**\n     * @dev Returns the remaining number of tokens that `spender` will be\n     * allowed to spend on behalf of `owner` through {transferFrom}. This is\n     * zero by default.\n     *\n     * This value changes when {approve} or {transferFrom} are called.\n     */\n    function allowance(address owner, address spender) external view returns (uint256);\n\n    /**\n     * @dev Sets `amount` as the allowance of `spender` over the caller's tokens.\n     *\n     * Returns a boolean value indicating whether the operation succeeded.\n     *\n     * IMPORTANT: Beware that changing an allowance with this method brings the risk\n     * that someone may use both the old and the new allowance by unfortunate\n     * transaction ordering. One possible solution to mitigate this race\n     * condition is to first reduce the spender's allowance to 0 and set the\n     * desired value afterwards:\n     * https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729\n     *\n     * Emits an {Approval} event.\n     */\n    function approve(address spender, uint256 amount) external returns (bool);\n\n    /**\n     * @dev Moves `amount` tokens from `sender` to `recipient` using the\n     * allowance mechanism. `amount` is then deducted from the caller's\n     * allowance.\n     *\n     * Returns a boolean value indicating whether the operation succeeded.\n     *\n     * Emits a {Transfer} event.\n     */\n    function transferFrom(address sender, address recipient, uint256 amount) 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"},{"file_path":"lib/mento-core-2.0.0/lib/openzeppelin-contracts/contracts/token/ERC20/SafeERC20.sol","source_code":"pragma solidity ^0.5.0;\n\nimport \"./IERC20.sol\";\nimport \"../../math/SafeMath.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 ERC20;` statement to your contract,\n * which allows you to call the safe operations as `token.safeTransfer(...)`, etc.\n */\nlibrary SafeERC20 {\n    using SafeMath for uint256;\n    using Address for address;\n\n    function safeTransfer(IERC20 token, address to, uint256 value) internal {\n        callOptionalReturn(token, abi.encodeWithSelector(token.transfer.selector, to, value));\n    }\n\n    function safeTransferFrom(IERC20 token, address from, address to, uint256 value) internal {\n        callOptionalReturn(token, abi.encodeWithSelector(token.transferFrom.selector, from, to, value));\n    }\n\n    function safeApprove(IERC20 token, address spender, uint256 value) internal {\n        // safeApprove should only be called when setting an initial allowance,\n        // or when resetting it to zero. To increase and decrease it, use\n        // 'safeIncreaseAllowance' and 'safeDecreaseAllowance'\n        // solhint-disable-next-line max-line-length\n        require((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(IERC20 token, address spender, uint256 value) internal {\n        uint256 newAllowance = token.allowance(address(this), spender).add(value);\n        callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, newAllowance));\n    }\n\n    function safeDecreaseAllowance(IERC20 token, address spender, uint256 value) internal {\n        uint256 newAllowance = token.allowance(address(this), spender).sub(value, \"SafeERC20: decreased allowance below zero\");\n        callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, newAllowance));\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.\n\n        // A Solidity high level call has three parts:\n        //  1. The target address is checked to verify it contains contract code\n        //  2. The call itself is made, and success asserted\n        //  3. The return value is decoded, which in turn checks the size of the returned data.\n        // solhint-disable-next-line max-line-length\n        require(address(token).isContract(), \"SafeERC20: call to non-contract\");\n\n        // solhint-disable-next-line avoid-low-level-calls\n        (bool success, bytes memory returndata) = address(token).call(data);\n        require(success, \"SafeERC20: low-level call failed\");\n\n        if (returndata.length > 0) { // Return data is optional\n            // solhint-disable-next-line max-line-length\n            require(abi.decode(returndata, (bool)), \"SafeERC20: ERC20 operation did not succeed\");\n        }\n    }\n}\n"},{"file_path":"lib/mento-core-2.0.0/lib/openzeppelin-contracts/contracts/utils/Address.sol","source_code":"pragma solidity ^0.5.5;\n\n/**\n * @dev Collection of functions related to the address type\n */\nlibrary Address {\n    /**\n     * @dev Returns true if `account` is a contract.\n     *\n     * [IMPORTANT]\n     * ====\n     * It is unsafe to assume that an address for which this function returns\n     * false is an externally-owned account (EOA) and not a contract.\n     *\n     * Among others, `isContract` will return false for the following \n     * types of addresses:\n     *\n     *  - an externally-owned account\n     *  - a contract in construction\n     *  - an address where a contract will be created\n     *  - an address where a contract lived, but was destroyed\n     * ====\n     */\n    function isContract(address account) internal view returns (bool) {\n        // According to EIP-1052, 0x0 is the value returned for not-yet created accounts\n        // and 0xc5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470 is returned\n        // for accounts without code, i.e. `keccak256('')`\n        bytes32 codehash;\n        bytes32 accountHash = 0xc5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470;\n        // solhint-disable-next-line no-inline-assembly\n        assembly { codehash := extcodehash(account) }\n        return (codehash != accountHash && codehash != 0x0);\n    }\n\n    /**\n     * @dev Converts an `address` into `address payable`. Note that this is\n     * simply a type cast: the actual underlying value is not changed.\n     *\n     * _Available since v2.4.0._\n     */\n    function toPayable(address account) internal pure returns (address payable) {\n        return address(uint160(account));\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     * _Available since v2.4.0._\n     */\n    function sendValue(address payable recipient, uint256 amount) internal {\n        require(address(this).balance >= amount, \"Address: insufficient balance\");\n\n        // solhint-disable-next-line avoid-call-value\n        (bool success, ) = recipient.call.value(amount)(\"\");\n        require(success, \"Address: unable to send value, recipient may have reverted\");\n    }\n}\n"},{"file_path":"lib/mento-core-2.2.0/contracts/common/Initializable.sol","source_code":"// SPDX-License-Identifier: GPL-3.0-or-later\npragma solidity ^0.5.13;\n\ncontract Initializable {\n  bool public initialized;\n\n  constructor(bool testingDeployment) public {\n    if (!testingDeployment) {\n      initialized = true;\n    }\n  }\n\n  modifier initializer() {\n    require(!initialized, \"contract already initialized\");\n    initialized = true;\n    _;\n  }\n}\n"},{"file_path":"lib/mento-core-2.2.0/contracts/common/ReentrancyGuard.sol","source_code":"// SPDX-License-Identifier: GPL-3.0-or-later\npragma solidity ^0.5.13;\n\n/**\n * @title Helps contracts guard against reentrancy attacks.\n * @author Remco Bloemen <remco@2π.com>, Eenae <alexey@mixbytes.io>\n * @dev If you mark a function `nonReentrant`, you should also\n * mark it `external`.\n */\ncontract ReentrancyGuard {\n  /// @dev counter to allow mutex lock with only one SSTORE operation\n  uint256 private _guardCounter;\n\n  constructor() internal {\n    // The counter starts at one to prevent changing it from zero to a non-zero\n    // value, which is a more expensive operation.\n    _guardCounter = 1;\n  }\n\n  /**\n   * @dev Prevents a contract from calling itself, directly or indirectly.\n   * Calling a `nonReentrant` function from another `nonReentrant`\n   * function is not supported. It is possible to prevent this from happening\n   * by making the `nonReentrant` function external, and make it call a\n   * `private` function that does the actual work.\n   */\n  modifier nonReentrant() {\n    _guardCounter += 1;\n    uint256 localCounter = _guardCounter;\n    _;\n    require(localCounter == _guardCounter, \"reentrant call\");\n  }\n}\n"},{"file_path":"lib/mento-core-2.2.0/contracts/common/interfaces/IERC20Metadata.sol","source_code":"// SPDX-License-Identifier: GPL-3.0-or-later\npragma solidity ^0.5.13;\n\ninterface IERC20Metadata {\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  /**\n   * @dev Returns the amount of tokens in existence.\n   */\n  function totalSupply() external view returns (uint256);\n\n  /**\n   * @dev Returns the amount of tokens owned by `account`.\n   */\n  function balanceOf(address account) external view returns (uint256);\n\n  /**\n   * @dev Moves `amount` tokens from the caller's account to `recipient`.\n   *\n   * Returns a boolean value indicating whether the operation succeeded.\n   *\n   * Emits a {Transfer} event.\n   */\n  function transfer(address recipient, uint256 amount) external returns (bool);\n\n  /**\n   * @dev Returns the remaining number of tokens that `spender` will be\n   * allowed to spend on behalf of `owner` through {transferFrom}. This is\n   * zero by default.\n   *\n   * This value changes when {approve} or {transferFrom} are called.\n   */\n  function allowance(address owner, address spender) external view returns (uint256);\n\n  /**\n   * @dev Sets `amount` as the allowance of `spender` over the caller's tokens.\n   *\n   * Returns a boolean value indicating whether the operation succeeded.\n   *\n   * IMPORTANT: Beware that changing an allowance with this method brings the risk\n   * that someone may use both the old and the new allowance by unfortunate\n   * transaction ordering. One possible solution to mitigate this race\n   * condition is to first reduce the spender's allowance to 0 and set the\n   * desired value afterwards:\n   * https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729\n   *\n   * Emits an {Approval} event.\n   */\n  function approve(address spender, uint256 amount) external returns (bool);\n\n  /**\n   * @dev Moves `amount` tokens from `sender` to `recipient` using the\n   * allowance mechanism. `amount` is then deducted from the caller's\n   * allowance.\n   *\n   * Returns a boolean value indicating whether the operation succeeded.\n   *\n   * Emits a {Transfer} event.\n   */\n  function transferFrom(\n    address sender,\n    address recipient,\n    uint256 amount\n  ) external returns (bool);\n\n  /**\n   * @dev Emitted when `value` tokens are moved from one account (`from`) to\n   * another (`to`).\n   *\n   * Note that `value` may be zero.\n   */\n  event Transfer(address indexed from, address indexed to, uint256 value);\n\n  /**\n   * @dev Emitted when the allowance of a `spender` for an `owner` is set by\n   * a call to {approve}. `value` is the new allowance.\n   */\n  event Approval(address indexed owner, address indexed spender, uint256 value);\n}\n"},{"file_path":"lib/mento-core-2.2.0/contracts/interfaces/IBroker.sol","source_code":"// SPDX-License-Identifier: GPL-3.0-or-later\npragma solidity ^0.5.13;\npragma experimental ABIEncoderV2;\n\nimport { TradingLimits } from \"../libraries/TradingLimits.sol\";\n\n/*\n * @title Broker Interface for trader functions\n * @notice The broker is responsible for executing swaps and keeping track of trading limits.\n */\ninterface IBroker {\n  /**\n   * @notice Emitted when a swap occurs.\n   * @param exchangeProvider The exchange provider used.\n   * @param exchangeId The id of the exchange used.\n   * @param trader The user that initiated the swap.\n   * @param tokenIn The address of the token that was sold.\n   * @param tokenOut The address of the token that was bought.\n   * @param amountIn The amount of token sold.\n   * @param amountOut The amount of token bought.\n   */\n  event Swap(\n    address exchangeProvider,\n    bytes32 indexed exchangeId,\n    address indexed trader,\n    address indexed tokenIn,\n    address tokenOut,\n    uint256 amountIn,\n    uint256 amountOut\n  );\n\n  /**\n   * @notice Emitted when a new trading limit is configured.\n   * @param exchangeId the exchangeId to target.\n   * @param token the token to target.\n   * @param config the new trading limits config.\n   */\n  event TradingLimitConfigured(bytes32 exchangeId, address token, TradingLimits.Config config);\n\n  /**\n   * @notice Execute a token swap with fixed amountIn.\n   * @param exchangeProvider the address of the exchange provider for the pair.\n   * @param exchangeId The id of the exchange to use.\n   * @param tokenIn The token to be sold.\n   * @param tokenOut The token to be bought.\n   * @param amountIn The amount of tokenIn to be sold.\n   * @param amountOutMin Minimum amountOut to be received - controls slippage.\n   * @return amountOut The amount of tokenOut to be bought.\n   */\n  function swapIn(\n    address exchangeProvider,\n    bytes32 exchangeId,\n    address tokenIn,\n    address tokenOut,\n    uint256 amountIn,\n    uint256 amountOutMin\n  ) external returns (uint256 amountOut);\n\n  /**\n   * @notice Execute a token swap with fixed amountOut.\n   * @param exchangeProvider the address of the exchange provider for the pair.\n   * @param exchangeId The id of the exchange to use.\n   * @param tokenIn The token to be sold.\n   * @param tokenOut The token to be bought.\n   * @param amountOut The amount of tokenOut to be bought.\n   * @param amountInMax Maximum amount of tokenIn that can be traded.\n   * @return amountIn The amount of tokenIn to be sold.\n   */\n  function swapOut(\n    address exchangeProvider,\n    bytes32 exchangeId,\n    address tokenIn,\n    address tokenOut,\n    uint256 amountOut,\n    uint256 amountInMax\n  ) external returns (uint256 amountIn);\n\n  /**\n   * @notice Calculate amountOut of tokenOut received for a given amountIn of tokenIn.\n   * @param exchangeProvider the address of the exchange provider for the pair.\n   * @param exchangeId The id of the exchange to use.\n   * @param tokenIn The token to be sold.\n   * @param tokenOut The token to be bought.\n   * @param amountIn The amount of tokenIn to be sold.\n   * @return amountOut The amount of tokenOut to be bought.\n   */\n  function getAmountOut(\n    address exchangeProvider,\n    bytes32 exchangeId,\n    address tokenIn,\n    address tokenOut,\n    uint256 amountIn\n  ) external view returns (uint256 amountOut);\n\n  /**\n   * @notice Calculate amountIn of tokenIn needed for a given amountOut of tokenOut.\n   * @param exchangeProvider the address of the exchange provider for the pair.\n   * @param exchangeId The id of the exchange to use.\n   * @param tokenIn The token to be sold.\n   * @param tokenOut The token to be bought.\n   * @param amountOut The amount of tokenOut to be bought.\n   * @return amountIn The amount of tokenIn to be sold.\n   */\n  function getAmountIn(\n    address exchangeProvider,\n    bytes32 exchangeId,\n    address tokenIn,\n    address tokenOut,\n    uint256 amountOut\n  ) external view returns (uint256 amountIn);\n\n  /**\n   * @notice Get the list of registered exchange providers.\n   * @dev This can be used by UI or clients to discover all pairs.\n   * @return exchangeProviders the addresses of all exchange providers.\n   */\n  function getExchangeProviders() external view returns (address[] memory exchangeProviders);\n}\n"},{"file_path":"lib/mento-core-2.2.0/contracts/interfaces/IBrokerAdmin.sol","source_code":"// SPDX-License-Identifier: GPL-3.0-or-later\npragma solidity ^0.5.13;\n\n/*\n * @title Broker Admin Interface\n * @notice Contains admin functions to configure the broker that\n *         should be only callable by the owner.\n */\ninterface IBrokerAdmin {\n  /**\n   * @notice Emitted when an ExchangeProvider is added.\n   * @param exchangeProvider The address of the ExchangeProvider.\n   */\n  event ExchangeProviderAdded(address indexed exchangeProvider);\n\n  /**\n   * @notice Emitted when an ExchangeProvider is removed.\n   * @param exchangeProvider The address of the ExchangeProvider.\n   */\n  event ExchangeProviderRemoved(address indexed exchangeProvider);\n\n  /**\n   * @notice Emitted when the reserve is updated.\n   * @param newAddress The new address.\n   * @param prevAddress The previous address.\n   */\n  event ReserveSet(address indexed newAddress, address indexed prevAddress);\n\n  /**\n   * @notice Remove an ExchangeProvider at a specified index.\n   * @param exchangeProvider The address of the ExchangeProvider to remove.\n   * @param index The index in the exchange providers array.\n   */\n  function removeExchangeProvider(address exchangeProvider, uint256 index) external;\n\n  /**\n   * @notice Add an ExchangeProvider.\n   * @param exchangeProvider The address of the ExchangeProvider to add.\n   * @return index The index where the ExchangeProvider was inserted.\n   */\n  function addExchangeProvider(address exchangeProvider) external returns (uint256 index);\n\n  /**\n   * @notice Set the Mento reserve address.\n   * @param reserve The Mento reserve address.\n   */\n  function setReserve(address reserve) external;\n}\n"},{"file_path":"lib/mento-core-2.2.0/contracts/interfaces/IExchangeProvider.sol","source_code":"// SPDX-License-Identifier: GPL-3.0-or-later\npragma solidity ^0.5.13;\npragma experimental ABIEncoderV2;\n\n/**\n * @title ExchangeProvider interface\n * @notice The IExchangeProvider interface is the interface that the Broker uses\n * to communicate with different exchange manager implementations like the BiPoolManager\n */\ninterface IExchangeProvider {\n  /**\n   * @notice Exchange - a struct that's used only by UIs (frontends/CLIs)\n   * in order to discover what asset swaps are possible within an\n   * exchange provider.\n   * It's up to the specific exchange provider to convert its internal\n   * representation to this universal struct. This conversion should\n   * only happen in view calls used for discovery.\n   * @param exchangeId The ID of the exchange, used to initiate swaps or get quotes.\n   * @param assets An array of addresses of ERC20 tokens that can be swapped.\n   */\n  struct Exchange {\n    bytes32 exchangeId;\n    address[] assets;\n  }\n\n  /**\n   * @notice Get all exchanges supported by the ExchangeProvider.\n   * @return exchanges An array of Exchange structs.\n   */\n  function getExchanges() external view returns (Exchange[] memory exchanges);\n\n  /**\n   * @notice Execute a token swap with fixed amountIn\n   * @param exchangeId The id of the exchange to use\n   * @param tokenIn The token to be sold\n   * @param tokenOut The token to be bought\n   * @param amountIn The amount of tokenIn to be sold\n   * @return amountOut The amount of tokenOut to be bought\n   */\n  function swapIn(\n    bytes32 exchangeId,\n    address tokenIn,\n    address tokenOut,\n    uint256 amountIn\n  ) external returns (uint256 amountOut);\n\n  /**\n   * @notice Execute a token swap with fixed amountOut\n   * @param exchangeId The id of the exchange to use\n   * @param tokenIn The token to be sold\n   * @param tokenOut The token to be bought\n   * @param amountOut The amount of tokenOut to be bought\n   * @return amountIn The amount of tokenIn to be sold\n   */\n  function swapOut(\n    bytes32 exchangeId,\n    address tokenIn,\n    address tokenOut,\n    uint256 amountOut\n  ) external returns (uint256 amountIn);\n\n  /**\n   * @notice Calculate amountOut of tokenOut received for a given amountIn of tokenIn\n   * @param exchangeId The id of the exchange to use\n   * @param tokenIn The token to be sold\n   * @param tokenOut The token to be bought\n   * @param amountIn The amount of tokenIn to be sold\n   * @return amountOut The amount of tokenOut to be bought\n   */\n  function getAmountOut(\n    bytes32 exchangeId,\n    address tokenIn,\n    address tokenOut,\n    uint256 amountIn\n  ) external view returns (uint256 amountOut);\n\n  /**\n   * @notice Calculate amountIn of tokenIn needed for a given amountOut of tokenOut\n   * @param exchangeId The id of the exchange to use\n   * @param tokenIn The token to be sold\n   * @param tokenOut The token to be bought\n   * @param amountOut The amount of tokenOut to be bought\n   * @return amountIn The amount of tokenIn to be sold\n   */\n  function getAmountIn(\n    bytes32 exchangeId,\n    address tokenIn,\n    address tokenOut,\n    uint256 amountOut\n  ) external view returns (uint256 amountIn);\n}\n"},{"file_path":"lib/mento-core-2.2.0/contracts/interfaces/IReserve.sol","source_code":"// SPDX-License-Identifier: GPL-3.0-or-later\npragma solidity ^0.5.13;\n\ninterface IReserve {\n  function setTobinTaxStalenessThreshold(uint256) external;\n\n  function addToken(address) external returns (bool);\n\n  function removeToken(address, uint256) external returns (bool);\n\n  function transferGold(address payable, uint256) external returns (bool);\n\n  function transferExchangeGold(address payable, uint256) external returns (bool);\n\n  function transferCollateralAsset(\n    address collateralAsset,\n    address payable to,\n    uint256 value\n  ) external returns (bool);\n\n  function getReserveGoldBalance() external view returns (uint256);\n\n  function getUnfrozenReserveGoldBalance() external view returns (uint256);\n\n  function getOrComputeTobinTax() external returns (uint256, uint256);\n\n  function getTokens() external view returns (address[] memory);\n\n  function getReserveRatio() external view returns (uint256);\n\n  function addExchangeSpender(address) external;\n\n  function removeExchangeSpender(address, uint256) external;\n\n  function addSpender(address) external;\n\n  function removeSpender(address) external;\n\n  function isStableAsset(address) external view returns (bool);\n\n  function isCollateralAsset(address) external view returns (bool);\n\n  function getDailySpendingRatioForCollateralAsset(address collateralAsset) external view returns (uint256);\n\n  function isExchangeSpender(address exchange) external view returns (bool);\n\n  function addCollateralAsset(address asset) external returns (bool);\n\n  function transferExchangeCollateralAsset(\n    address collateralAsset,\n    address payable to,\n    uint256 value\n  ) external returns (bool);\n}\n"},{"file_path":"lib/mento-core-2.2.0/contracts/interfaces/IStableTokenV2.sol","source_code":"// SPDX-License-Identifier: GPL-3.0-or-later\npragma solidity >=0.5.17 <0.8.19;\n\ninterface IStableTokenV2 {\n  function totalSupply() external view returns (uint256);\n\n  function balanceOf(address account) external view returns (uint256);\n\n  function transfer(address recipient, uint256 amount) external returns (bool);\n\n  function allowance(address owner, address spender) external view returns (uint256);\n\n  function approve(address spender, uint256 amount) external returns (bool);\n\n  function transferFrom(\n    address sender,\n    address recipient,\n    uint256 amount\n  ) external returns (bool);\n\n  function mint(address, uint256) external returns (bool);\n\n  function burn(uint256) external returns (bool);\n\n  function permit(\n    address owner,\n    address spender,\n    uint256 value,\n    uint256 deadline,\n    uint8 v,\n    bytes32 r,\n    bytes32 s\n  ) external;\n\n  /**\n   * @notice Transfer token for a specified address\n   * @param to The address to transfer to.\n   * @param value The amount to be transferred.\n   * @param comment The transfer comment.\n   * @return True if the transaction succeeds.\n   */\n  function transferWithComment(\n    address to,\n    uint256 value,\n    string calldata comment\n  ) external returns (bool);\n\n  /**\n   * @notice Initializes a StableTokenV2.\n   * It keeps the same signature as the original initialize() function\n   * in legacy/StableToken.sol\n   * @param _name The name of the stable token (English)\n   * @param _symbol A short symbol identifying the token (e.g. \"cUSD\")\n   * deprecated-param decimals Tokens are divisible to this many decimal places.\n   * deprecated-param registryAddress Address of the Registry contract.\n   * deprecated-param inflationRate Weekly inflation rate.\n   * deprecated-param inflationFactorUpdatePeriod How often the inflation factor is updated, in seconds.\n   * @param initialBalanceAddresses Array of addresses with an initial balance.\n   * @param initialBalanceValues Array of balance values corresponding to initialBalanceAddresses.\n   * deprecated-param exchangeIdentifier String identifier of exchange in registry (for specific fiat pairs)\n   */\n  function initialize(\n    string calldata _name,\n    string calldata _symbol,\n    uint8, // deprecated: decimals\n    address, // deprecated: registryAddress,\n    uint256, // deprecated: inflationRate,\n    uint256, // deprecated:  inflationFactorUpdatePeriod,\n    address[] calldata initialBalanceAddresses,\n    uint256[] calldata initialBalanceValues,\n    string calldata // deprecated: exchangeIdentifier\n  ) external;\n\n  /**\n   * @notice Initializes a StableTokenV2 contract\n   * when upgrading from legacy/StableToken.sol.\n   * It sets the addresses that were previously read from the Registry.\n   * It runs the ERC20PermitUpgradeable initializer.\n   * @dev This function is only callable once.\n   * @param _broker The address of the Broker contract.\n   * @param _validators The address of the Validators contract.\n   * @param _exchange The address of the Exchange contract.\n   */\n  function initializeV2(\n    address _broker,\n    address _validators,\n    address _exchange\n  ) external;\n\n  /**\n   * @notice Gets the address of the Broker contract.\n   */\n  function broker() external returns (address);\n\n  function debitGasFees(address from, uint256 value) external;\n\n  function creditGasFees(\n    address from,\n    address feeRecipient,\n    address gatewayFeeRecipient,\n    address communityFund,\n    uint256 refund,\n    uint256 tipTxFee,\n    uint256 gatewayFee,\n    uint256 baseTxFee\n  ) external;\n}\n"},{"file_path":"lib/mento-core-2.2.0/contracts/libraries/TradingLimits.sol","source_code":"// SPDX-License-Identifier: GPL-3.0-or-later\npragma solidity ^0.5.13;\npragma experimental ABIEncoderV2;\n\n/**\n * @title TradingLimits\n * @author Mento Team\n * @notice This library provides data structs and utility functions for\n * defining and verifying trading limits on the netflow of an asset.\n * There are three limits that can be enabled:\n * - L0: A timewindow based limit, verifies that:\n *       -1 * limit0 <= netflow0 <= limit0,\n *       for a netflow0 that resets every timespan0 seconds.\n * - L1: A timewindow based limit, verifies that:\n *       -1 * limit1 <= netflow1 <= limit1,\n *       for a netflow1 that resets every timespan1 second.\n * - LG: A global (or lifetime) limit that ensures that:\n *       -1 * limitGlobal <= netflowGlobal <= limitGlobal,\n *       for a netflowGlobal that doesn't reset until the\n *       limit is disabled.\n * @dev All contained functions are pure or view and marked internal to\n * be inlined on consuming contracts at compile time for gas efficiency.\n * Both State and Config structs are designed to be packed in one\n * storage slot each.\n * In order to pack both the state and config into one slot each,\n * some assumptions are made:\n * 1. limit{0,1,Global} and netflow{0,1,Global} are recorded with\n *    ZERO decimals precision to fit in an int48.\n *    Any subunit delta in netflow will be rounded up to one unit.\n * 2. netflow{0,1,Global} have to fit in int48, thus have to fit in the range:\n *    -140_737_488_355_328 to 140_737_488_355_328, which can cover most\n *    tokens of interest, but will break down for tokens which trade\n *    in large unit values.\n * 3. timespan{0,1} and lastUpdated{0,1} have to fit in int32 therefore\n *    the timestamps will overflow sometime in the year 2102.\n *\n * The library ensures that netflow0 and netflow1 are reset during\n * the update phase, but does not control how the full State gets\n * updated if the Config changes, this is left to the library consumer.\n */\nlibrary TradingLimits {\n  uint8 private constant L0 = 1; // 0b001 Limit0\n  uint8 private constant L1 = 2; // 0b010 Limit1\n  uint8 private constant LG = 4; // 0b100 LimitGlobal\n  int48 private constant MAX_INT48 = int48(uint48(-1) / 2);\n\n  /**\n   * @dev The State struct contains the current state of a trading limit config.\n   * @param lastUpdated0 The timestamp of the last reset of netflow0.\n   * @param lastUpdated1 The timestamp of the last reset of netflow1.\n   * @param netflow0 The current netflow of the asset for limit0.\n   * @param netflow1 The current netflow of the asset for limit1.\n   * @param netflowGlobal The current netflow of the asset for limitGlobal.\n   */\n  struct State {\n    uint32 lastUpdated0;\n    uint32 lastUpdated1;\n    int48 netflow0;\n    int48 netflow1;\n    int48 netflowGlobal;\n  }\n\n  /**\n   * @dev The Config struct contains the configuration of trading limits.\n   * @param timestep0 The time window in seconds for limit0.\n   * @param timestep1 The time window in seconds for limit1.\n   * @param limit0 The limit0 for the asset.\n   * @param limit1 The limit1 for the asset.\n   * @param limitGlobal The global limit for the asset.\n   * @param flags A bitfield of flags to enable/disable the individual limits.\n   */\n  struct Config {\n    uint32 timestep0;\n    uint32 timestep1;\n    int48 limit0;\n    int48 limit1;\n    int48 limitGlobal;\n    uint8 flags;\n  }\n\n  /**\n   * @notice Validate a trading limit configuration.\n   * @dev Reverts if the configuration is malformed.\n   * @param self the Config struct to check.\n   */\n  function validate(Config memory self) internal pure {\n    require(self.flags & L1 == 0 || self.flags & L0 != 0, \"L1 without L0 not allowed\");\n    require(self.flags & L0 == 0 || self.timestep0 > 0, \"timestep0 can't be zero if active\");\n    require(self.flags & L1 == 0 || self.timestep1 > 0, \"timestep1 can't be zero if active\");\n    require(self.flags & L0 == 0 || self.limit0 > 0, \"limit0 can't be zero if active\");\n    require(self.flags & L1 == 0 || self.limit1 > 0, \"limit1 can't be zero if active\");\n    require(self.flags & LG == 0 || self.limitGlobal > 0, \"limitGlobal can't be zero if active\");\n    require(self.flags & (L0 | L1) != 3 || self.limit0 < self.limit1, \"limit1 must be greater than limit0\");\n    require(self.flags & (L1 | LG) != 6 || self.limit1 < self.limitGlobal, \"limitGlobal must be greater than limit1\");\n    require(self.flags & (L0 | LG) != 5 || self.limit0 < self.limitGlobal, \"limitGlobal must be greater than limit0\");\n  }\n\n  /**\n   * @notice Verify a trading limit State with a provided Config.\n   * @dev Reverts if the limits are exceeded.\n   * @param self the trading limit State to check.\n   * @param config the trading limit Config to check against.\n   */\n  function verify(State memory self, Config memory config) internal pure {\n    if ((config.flags & L0) > 0 && (-1 * config.limit0 > self.netflow0 || self.netflow0 > config.limit0)) {\n      revert(\"L0 Exceeded\");\n    }\n    if ((config.flags & L1) > 0 && (-1 * config.limit1 > self.netflow1 || self.netflow1 > config.limit1)) {\n      revert(\"L1 Exceeded\");\n    }\n    if (\n      (config.flags & LG) > 0 &&\n      (-1 * config.limitGlobal > self.netflowGlobal || self.netflowGlobal > config.limitGlobal)\n    ) {\n      revert(\"LG Exceeded\");\n    }\n  }\n\n  /**\n   * @notice Reset an existing state with a new config.\n   * It keps netflows of enabled limits and resets when disabled.\n   * It resets all timestamp checkpoints to reset time-window limits\n   * on next swap.\n   * @param self the trading limit state to reset.\n   * @param config the updated config to reset against.\n   * @return the reset state.\n   */\n  function reset(State memory self, Config memory config) internal pure returns (State memory) {\n    // Ensure the next swap will reset the trading limits windows.\n    self.lastUpdated0 = 0;\n    self.lastUpdated1 = 0;\n    if (config.flags & L0 == 0) {\n      self.netflow0 = 0;\n    }\n    if (config.flags & L1 == 0) {\n      self.netflow1 = 0;\n    }\n    if (config.flags & LG == 0) {\n      self.netflowGlobal = 0;\n    }\n    return self;\n  }\n\n  /**\n   * @notice  Updates a trading limit State in the context of a Config with the deltaFlow provided.\n   * @dev Reverts if the values provided cause overflows.\n   * @param self the trading limit State to update.\n   * @param config the trading limit Config for the provided State.\n   * @param _deltaFlow the delta flow to add to the netflow.\n   * @param decimals the number of decimals the _deltaFlow is denominated in.\n   * @return State the updated state.\n   */\n  function update(\n    State memory self,\n    Config memory config,\n    int256 _deltaFlow,\n    uint8 decimals\n  ) internal view returns (State memory) {\n    int256 _deltaFlowUnits = _deltaFlow / int256((10**uint256(decimals)));\n    require(_deltaFlowUnits <= MAX_INT48, \"dFlow too large\");\n    int48 deltaFlowUnits = _deltaFlowUnits == 0 ? 1 : int48(_deltaFlowUnits);\n\n    if (config.flags & L0 > 0) {\n      if (block.timestamp > self.lastUpdated0 + config.timestep0) {\n        self.netflow0 = 0;\n        self.lastUpdated0 = uint32(block.timestamp);\n      }\n      self.netflow0 = safeINT48Add(self.netflow0, deltaFlowUnits);\n\n      if (config.flags & L1 > 0) {\n        if (block.timestamp > self.lastUpdated1 + config.timestep1) {\n          self.netflow1 = 0;\n          self.lastUpdated1 = uint32(block.timestamp);\n        }\n        self.netflow1 = safeINT48Add(self.netflow1, deltaFlowUnits);\n      }\n    }\n    if (config.flags & LG > 0) {\n      self.netflowGlobal = safeINT48Add(self.netflowGlobal, deltaFlowUnits);\n    }\n\n    return self;\n  }\n\n  /**\n   * @notice Safe add two int48s.\n   * @dev Reverts if addition causes over/underflow.\n   * @param a number to add.\n   * @param b number to add.\n   * @return int48 result of addition.\n   */\n  function safeINT48Add(int48 a, int48 b) internal pure returns (int48) {\n    int256 c = int256(a) + int256(b);\n    require(c >= -1 * MAX_INT48 && c <= MAX_INT48, \"int48 addition overflow\");\n    return int48(c);\n  }\n}\n"}],"certified":false,"conflicting_implementations":null,"abi":[{"inputs":[{"internalType":"bool","name":"test","type":"bool"}],"payable":false,"stateMutability":"nonpayable","type":"constructor"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"exchangeProvider","type":"address"}],"name":"ExchangeProviderAdded","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"exchangeProvider","type":"address"}],"name":"ExchangeProviderRemoved","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":"address","name":"newAddress","type":"address"},{"indexed":true,"internalType":"address","name":"prevAddress","type":"address"}],"name":"ReserveSet","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"exchangeProvider","type":"address"},{"indexed":true,"internalType":"bytes32","name":"exchangeId","type":"bytes32"},{"indexed":true,"internalType":"address","name":"trader","type":"address"},{"indexed":true,"internalType":"address","name":"tokenIn","type":"address"},{"indexed":false,"internalType":"address","name":"tokenOut","type":"address"},{"indexed":false,"internalType":"uint256","name":"amountIn","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"amountOut","type":"uint256"}],"name":"Swap","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"bytes32","name":"exchangeId","type":"bytes32"},{"indexed":false,"internalType":"address","name":"token","type":"address"},{"components":[{"internalType":"uint32","name":"timestep0","type":"uint32"},{"internalType":"uint32","name":"timestep1","type":"uint32"},{"internalType":"int48","name":"limit0","type":"int48"},{"internalType":"int48","name":"limit1","type":"int48"},{"internalType":"int48","name":"limitGlobal","type":"int48"},{"internalType":"uint8","name":"flags","type":"uint8"}],"indexed":false,"internalType":"struct TradingLimits.Config","name":"config","type":"tuple"}],"name":"TradingLimitConfigured","type":"event"},{"constant":false,"inputs":[{"internalType":"address","name":"exchangeProvider","type":"address"}],"name":"addExchangeProvider","outputs":[{"internalType":"uint256","name":"index","type":"uint256"}],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[{"internalType":"address","name":"token","type":"address"},{"internalType":"uint256","name":"amount","type":"uint256"}],"name":"burnStableTokens","outputs":[{"internalType":"bool","name":"","type":"bool"}],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[{"internalType":"bytes32","name":"exchangeId","type":"bytes32"},{"internalType":"address","name":"token","type":"address"},{"components":[{"internalType":"uint32","name":"timestep0","type":"uint32"},{"internalType":"uint32","name":"timestep1","type":"uint32"},{"internalType":"int48","name":"limit0","type":"int48"},{"internalType":"int48","name":"limit1","type":"int48"},{"internalType":"int48","name":"limitGlobal","type":"int48"},{"internalType":"uint8","name":"flags","type":"uint8"}],"internalType":"struct TradingLimits.Config","name":"config","type":"tuple"}],"name":"configureTradingLimit","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[{"internalType":"uint256","name":"","type":"uint256"}],"name":"exchangeProviders","outputs":[{"internalType":"address","name":"","type":"address"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"internalType":"address","name":"exchangeProvider","type":"address"},{"internalType":"bytes32","name":"exchangeId","type":"bytes32"},{"internalType":"address","name":"tokenIn","type":"address"},{"internalType":"address","name":"tokenOut","type":"address"},{"internalType":"uint256","name":"amountOut","type":"uint256"}],"name":"getAmountIn","outputs":[{"internalType":"uint256","name":"amountIn","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"internalType":"address","name":"exchangeProvider","type":"address"},{"internalType":"bytes32","name":"exchangeId","type":"bytes32"},{"internalType":"address","name":"tokenIn","type":"address"},{"internalType":"address","name":"tokenOut","type":"address"},{"internalType":"uint256","name":"amountIn","type":"uint256"}],"name":"getAmountOut","outputs":[{"internalType":"uint256","name":"amountOut","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"getExchangeProviders","outputs":[{"internalType":"address[]","name":"","type":"address[]"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"internalType":"address[]","name":"_exchangeProviders","type":"address[]"},{"internalType":"address","name":"_reserve","type":"address"}],"name":"initialize","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"initialized","outputs":[{"internalType":"bool","name":"","type":"bool"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"internalType":"address","name":"","type":"address"}],"name":"isExchangeProvider","outputs":[{"internalType":"bool","name":"","type":"bool"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"isOwner","outputs":[{"internalType":"bool","name":"","type":"bool"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"owner","outputs":[{"internalType":"address","name":"","type":"address"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"internalType":"address","name":"exchangeProvider","type":"address"},{"internalType":"uint256","name":"index","type":"uint256"}],"name":"removeExchangeProvider","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[],"name":"renounceOwnership","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"reserve","outputs":[{"internalType":"contract IReserve","name":"","type":"address"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"internalType":"address","name":"_reserve","type":"address"}],"name":"setReserve","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[{"internalType":"address","name":"exchangeProvider","type":"address"},{"internalType":"bytes32","name":"exchangeId","type":"bytes32"},{"internalType":"address","name":"tokenIn","type":"address"},{"internalType":"address","name":"tokenOut","type":"address"},{"internalType":"uint256","name":"amountIn","type":"uint256"},{"internalType":"uint256","name":"amountOutMin","type":"uint256"}],"name":"swapIn","outputs":[{"internalType":"uint256","name":"amountOut","type":"uint256"}],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[{"internalType":"address","name":"exchangeProvider","type":"address"},{"internalType":"bytes32","name":"exchangeId","type":"bytes32"},{"internalType":"address","name":"tokenIn","type":"address"},{"internalType":"address","name":"tokenOut","type":"address"},{"internalType":"uint256","name":"amountOut","type":"uint256"},{"internalType":"uint256","name":"amountInMax","type":"uint256"}],"name":"swapOut","outputs":[{"internalType":"uint256","name":"amountIn","type":"uint256"}],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"name":"tradingLimitsConfig","outputs":[{"internalType":"uint32","name":"timestep0","type":"uint32"},{"internalType":"uint32","name":"timestep1","type":"uint32"},{"internalType":"int48","name":"limit0","type":"int48"},{"internalType":"int48","name":"limit1","type":"int48"},{"internalType":"int48","name":"limitGlobal","type":"int48"},{"internalType":"uint8","name":"flags","type":"uint8"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"name":"tradingLimitsState","outputs":[{"internalType":"uint32","name":"lastUpdated0","type":"uint32"},{"internalType":"uint32","name":"lastUpdated1","type":"uint32"},{"internalType":"int48","name":"netflow0","type":"int48"},{"internalType":"int48","name":"netflow1","type":"int48"},{"internalType":"int48","name":"netflowGlobal","type":"int48"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"internalType":"address","name":"newOwner","type":"address"}],"name":"transferOwnership","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"}],"is_changed_bytecode":false,"is_partially_verified":false,"constructor_args":"0x0000000000000000000000000000000000000000000000000000000000000000"}