Registry
Deploy on AlchemyContract Information
The following smart contract is a Registry contract that manages routes for cross-chain transfers. It allows adding, disabling, and executing routes for middleware and bridge contracts. It also includes a function for rescuing funds and uses OpenZeppelin libraries for access control and ERC20 token handling.
More Info
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.4;
import "@openzeppelin/contracts/access/Ownable.sol";
import "@openzeppelin/contracts/token/ERC20/IERC20.sol";
import "@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol";
import "./helpers/errors.sol";
import "./ImplBase.sol";
import "./MiddlewareImplBase.sol";
/**
// @title Movr Regisrtry Contract.
// @notice This is the main contract that is called using fund movr.
// This contains all the bridge and middleware ids.
// RouteIds signify which bridge to be used.
// Middleware Id signifies which aggregator will be used for swapping if required.
*/
contract Registry is Ownable {
using SafeERC20 for IERC20;
address private constant NATIVE_TOKEN_ADDRESS =
address(0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE);
///@notice RouteData stores information for a route
struct RouteData {
address route;
bool isEnabled;
bool isMiddleware;
}
RouteData[] public routes;
modifier onlyExistingRoute(uint256 _routeId) {
require(
routes[_routeId].route != address(0),
MovrErrors.ROUTE_NOT_FOUND
);
_;
}
constructor(address _owner) Ownable() {
// first route is for direct bridging
routes.push(RouteData(NATIVE_TOKEN_ADDRESS, true, true));
transferOwnership(_owner);
}
// Function to receive Ether. msg.data must be empty
receive() external payable {}
//
// Events
//
event NewRouteAdded(
uint256 routeID,
address route,
bool isEnabled,
bool isMiddleware
);
event RouteDisabled(uint256 routeID);
event ExecutionCompleted(
uint256 middlewareID,
uint256 bridgeID,
uint256 inputAmount
);
/**
// @param id route id of middleware to be used
// @param optionalNativeAmount is the amount of native asset that the route requires
// @param inputToken token address which will be swapped to
// BridgeRequest inputToken
// @param data to be used by middleware
*/
struct MiddlewareRequest {
uint256 id;
uint256 optionalNativeAmount;
address inputToken;
bytes data;
}
/**
// @param id route id of bridge to be used
// @param optionalNativeAmount optinal native amount, to be used
// when bridge needs native token along with ERC20
// @param inputToken token addresss which will be bridged
// @param data bridgeData to be used by bridge
*/
struct BridgeRequest {
uint256 id;
uint256 optionalNativeAmount;
address inputToken;
bytes data;
}
/**
// @param receiverAddress Recipient address to recieve funds on destination chain
// @param toChainId Destination ChainId
// @param amount amount to be swapped if middlewareId is 0 it will be
// the amount to be bridged
// @param middlewareRequest middleware Requestdata
// @param bridgeRequest bridge request data
*/
struct UserRequest {
address receiverAddress;
uint256 toChainId;
uint256 amount;
MiddlewareRequest middlewareRequest;
BridgeRequest bridgeRequest;
}
/**
// @notice function responsible for calling the respective implementation
// depending on the bridge to be used
// If the middlewareId is 0 then no swap is required,
// we can directly bridge the source token to wherever required,
// else, we first call the Swap Impl Base for swapping to the required
// token and then start the bridging
// @dev It is required for isMiddleWare to be true for route 0 as it is a special case
// @param _userRequest calldata follows the input data struct
*/
function outboundTransferTo(UserRequest calldata _userRequest)
external
payable
{
require(_userRequest.amount != 0, MovrErrors.INVALID_AMT);
// make sure bridge ID is not 0
require(
_userRequest.bridgeRequest.id != 0,
MovrErrors.INVALID_BRIDGE_ID
);
// make sure bridge input is provided
require(
_userRequest.bridgeRequest.inputToken != address(0),
MovrErrors.ADDRESS_0_PROVIDED
);
// load middleware info and validate
RouteData memory middlewareInfo = routes[
_userRequest.middlewareRequest.id
];
require(
middlewareInfo.route != address(0) &&
middlewareInfo.isEnabled &&
middlewareInfo.isMiddleware,
MovrErrors.ROUTE_NOT_ALLOWED
);
// load bridge info and validate
RouteData memory bridgeInfo = routes[_userRequest.bridgeRequest.id];
require(
bridgeInfo.route != address(0) &&
bridgeInfo.isEnabled &&
!bridgeInfo.isMiddleware,
MovrErrors.ROUTE_NOT_ALLOWED
);
emit ExecutionCompleted(
_userRequest.middlewareRequest.id,
_userRequest.bridgeRequest.id,
_userRequest.amount
);
// if middlewareID is 0 it means we dont want to perform a action before bridging
// and directly want to move for bridging
if (_userRequest.middlewareRequest.id == 0) {
// perform the bridging
ImplBase(bridgeInfo.route).outboundTransferTo{value: msg.value}(
_userRequest.amount,
msg.sender,
_userRequest.receiverAddress,
_userRequest.bridgeRequest.inputToken,
_userRequest.toChainId,
_userRequest.bridgeRequest.data
);
return;
}
// we first perform an action using the middleware
// we determine if the input asset is a native asset, if yes we pass
// the amount as value, else we pass the optionalNativeAmount
uint256 _amountOut = MiddlewareImplBase(middlewareInfo.route)
.performAction{
value: _userRequest.middlewareRequest.inputToken ==
NATIVE_TOKEN_ADDRESS
? _userRequest.amount +
_userRequest.middlewareRequest.optionalNativeAmount
: _userRequest.middlewareRequest.optionalNativeAmount
}(
msg.sender,
_userRequest.middlewareRequest.inputToken,
_userRequest.amount,
address(this),
_userRequest.middlewareRequest.data
);
// we mutate this variable if the input asset to bridge Impl is NATIVE
uint256 nativeInput = _userRequest.bridgeRequest.optionalNativeAmount;
// if the input asset is ERC20, we need to grant the bridge implementation approval
if (_userRequest.bridgeRequest.inputToken != NATIVE_TOKEN_ADDRESS) {
IERC20(_userRequest.bridgeRequest.inputToken).safeIncreaseAllowance(
bridgeInfo.route,
_amountOut
);
} else {
// if the input asset is native we need to set it as value
nativeInput =
_amountOut +
_userRequest.bridgeRequest.optionalNativeAmount;
}
// send off to bridge
ImplBase(bridgeInfo.route).outboundTransferTo{value: nativeInput}(
_amountOut,
address(this),
_userRequest.receiverAddress,
_userRequest.bridgeRequest.inputToken,
_userRequest.toChainId,
_userRequest.bridgeRequest.data
);
}
//
// Route management functions
//
/// @notice add routes to the registry.
function addRoutes(RouteData[] calldata _routes)
external
onlyOwner
returns (uint256[] memory)
{
require(_routes.length != 0, MovrErrors.EMPTY_INPUT);
uint256[] memory _routeIds = new uint256[](_routes.length);
for (uint256 i = 0; i < _routes.length; i++) {
require(
_routes[i].route != address(0),
MovrErrors.ADDRESS_0_PROVIDED
);
routes.push(_routes[i]);
_routeIds[i] = routes.length - 1;
emit NewRouteAdded(
i,
_routes[i].route,
_routes[i].isEnabled,
_routes[i].isMiddleware
);
}
return _routeIds;
}
///@notice disables the route if required.
function disableRoute(uint256 _routeId)
external
onlyOwner
onlyExistingRoute(_routeId)
{
routes[_routeId].isEnabled = false;
emit RouteDisabled(_routeId);
}
function rescueFunds(
address _token,
address _receiverAddress,
uint256 _amount
) external onlyOwner {
IERC20(_token).safeTransfer(_receiverAddress, _amount);
}
}
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
import "../utils/Context.sol";
/**
* @dev Contract module which provides a basic access control mechanism, where
* there is an account (an owner) that can be granted exclusive access to
* specific functions.
*
* By default, the owner account will be the one that deploys the contract. This
* can later be changed with {transferOwnership}.
*
* This module is used through inheritance. It will make available the modifier
* `onlyOwner`, which can be applied to your functions to restrict their use to
* the owner.
*/
abstract contract Ownable is Context {
address private _owner;
event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);
/**
* @dev Initializes the contract setting the deployer as the initial owner.
*/
constructor () {
address msgSender = _msgSender();
_owner = msgSender;
emit OwnershipTransferred(address(0), msgSender);
}
/**
* @dev Returns the address of the current owner.
*/
function owner() public view virtual returns (address) {
return _owner;
}
/**
* @dev Throws if called by any account other than the owner.
*/
modifier onlyOwner() {
require(owner() == _msgSender(), "Ownable: caller is not the owner");
_;
}
/**
* @dev Leaves the contract without owner. It will not be possible to call
* `onlyOwner` functions anymore. Can only be called by the current owner.
*
* NOTE: Renouncing ownership will leave the contract without an owner,
* thereby removing any functionality that is only available to the owner.
*/
function renounceOwnership() public virtual onlyOwner {
emit OwnershipTransferred(_owner, address(0));
_owner = address(0);
}
/**
* @dev Transfers ownership of the contract to a new account (`newOwner`).
* Can only be called by the current owner.
*/
function transferOwnership(address newOwner) public virtual onlyOwner {
require(newOwner != address(0), "Ownable: new owner is the zero address");
emit OwnershipTransferred(_owner, newOwner);
_owner = newOwner;
}
}
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
/**
* @dev Interface of the ERC20 standard as defined in the EIP.
*/
interface IERC20 {
/**
* @dev Returns the amount of tokens in existence.
*/
function totalSupply() external view returns (uint256);
/**
* @dev Returns the amount of tokens owned by `account`.
*/
function balanceOf(address account) external view returns (uint256);
/**
* @dev Moves `amount` tokens from the caller's account to `recipient`.
*
* Returns a boolean value indicating whether the operation succeeded.
*
* Emits a {Transfer} event.
*/
function transfer(address recipient, uint256 amount) external returns (bool);
/**
* @dev Returns the remaining number of tokens that `spender` will be
* allowed to spend on behalf of `owner` through {transferFrom}. This is
* zero by default.
*
* This value changes when {approve} or {transferFrom} are called.
*/
function allowance(address owner, address spender) external view returns (uint256);
/**
* @dev Sets `amount` as the allowance of `spender` over the caller's tokens.
*
* Returns a boolean value indicating whether the operation succeeded.
*
* IMPORTANT: Beware that changing an allowance with this method brings the risk
* that someone may use both the old and the new allowance by unfortunate
* transaction ordering. One possible solution to mitigate this race
* condition is to first reduce the spender's allowance to 0 and set the
* desired value afterwards:
* https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729
*
* Emits an {Approval} event.
*/
function approve(address spender, uint256 amount) external returns (bool);
/**
* @dev Moves `amount` tokens from `sender` to `recipient` using the
* allowance mechanism. `amount` is then deducted from the caller's
* allowance.
*
* Returns a boolean value indicating whether the operation succeeded.
*
* Emits a {Transfer} event.
*/
function transferFrom(address sender, address recipient, uint256 amount) external returns (bool);
/**
* @dev Emitted when `value` tokens are moved from one account (`from`) to
* another (`to`).
*
* Note that `value` may be zero.
*/
event Transfer(address indexed from, address indexed to, uint256 value);
/**
* @dev Emitted when the allowance of a `spender` for an `owner` is set by
* a call to {approve}. `value` is the new allowance.
*/
event Approval(address indexed owner, address indexed spender, uint256 value);
}
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
import "../IERC20.sol";
import "../../../utils/Address.sol";
/**
* @title SafeERC20
* @dev Wrappers around ERC20 operations that throw on failure (when the token
* contract returns false). Tokens that return no value (and instead revert or
* throw on failure) are also supported, non-reverting calls are assumed to be
* successful.
* To use this library you can add a `using SafeERC20 for IERC20;` statement to your contract,
* which allows you to call the safe operations as `token.safeTransfer(...)`, etc.
*/
library SafeERC20 {
using Address for address;
function safeTransfer(IERC20 token, address to, uint256 value) internal {
_callOptionalReturn(token, abi.encodeWithSelector(token.transfer.selector, to, value));
}
function safeTransferFrom(IERC20 token, address from, address to, uint256 value) internal {
_callOptionalReturn(token, abi.encodeWithSelector(token.transferFrom.selector, from, to, value));
}
/**
* @dev Deprecated. This function has issues similar to the ones found in
* {IERC20-approve}, and its usage is discouraged.
*
* Whenever possible, use {safeIncreaseAllowance} and
* {safeDecreaseAllowance} instead.
*/
function safeApprove(IERC20 token, address spender, uint256 value) internal {
// safeApprove should only be called when setting an initial allowance,
// or when resetting it to zero. To increase and decrease it, use
// 'safeIncreaseAllowance' and 'safeDecreaseAllowance'
// solhint-disable-next-line max-line-length
require((value == 0) || (token.allowance(address(this), spender) == 0),
"SafeERC20: approve from non-zero to non-zero allowance"
);
_callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, value));
}
function safeIncreaseAllowance(IERC20 token, address spender, uint256 value) internal {
uint256 newAllowance = token.allowance(address(this), spender) + value;
_callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, newAllowance));
}
function safeDecreaseAllowance(IERC20 token, address spender, uint256 value) internal {
unchecked {
uint256 oldAllowance = token.allowance(address(this), spender);
require(oldAllowance >= value, "SafeERC20: decreased allowance below zero");
uint256 newAllowance = oldAllowance - value;
_callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, newAllowance));
}
}
/**
* @dev Imitates a Solidity high-level call (i.e. a regular function call to a contract), relaxing the requirement
* on the return value: the return value is optional (but if data is returned, it must not be false).
* @param token The token targeted by the call.
* @param data The call data (encoded using abi.encode or one of its variants).
*/
function _callOptionalReturn(IERC20 token, bytes memory data) private {
// We need to perform a low level call here, to bypass Solidity's return data size checking mechanism, since
// we're implementing it ourselves. We use {Address.functionCall} to perform this call, which verifies that
// the target address contains contract code and also asserts for success in the low-level call.
bytes memory returndata = address(token).functionCall(data, "SafeERC20: low-level call failed");
if (returndata.length > 0) { // Return data is optional
// solhint-disable-next-line max-line-length
require(abi.decode(returndata, (bool)), "SafeERC20: ERC20 operation did not succeed");
}
}
}
// SPDX-License-Identifier: MIT
pragma solidity >=0.8.0;
library MovrErrors {
string internal constant ADDRESS_0_PROVIDED = "ADDRESS_0_PROVIDED";
string internal constant EMPTY_INPUT = "EMPTY_INPUT";
string internal constant LENGTH_MISMATCH = "LENGTH_MISMATCH";
string internal constant INVALID_VALUE = "INVALID_VALUE";
string internal constant INVALID_AMT = "INVALID_AMT";
string internal constant IMPL_NOT_FOUND = "IMPL_NOT_FOUND";
string internal constant ROUTE_NOT_FOUND = "ROUTE_NOT_FOUND";
string internal constant IMPL_NOT_ALLOWED = "IMPL_NOT_ALLOWED";
string internal constant ROUTE_NOT_ALLOWED = "ROUTE_NOT_ALLOWED";
string internal constant INVALID_CHAIN_DATA = "INVALID_CHAIN_DATA";
string internal constant CHAIN_NOT_SUPPORTED = "CHAIN_NOT_SUPPORTED";
string internal constant TOKEN_NOT_SUPPORTED = "TOKEN_NOT_SUPPORTED";
string internal constant NOT_IMPLEMENTED = "NOT_IMPLEMENTED";
string internal constant INVALID_SENDER = "INVALID_SENDER";
string internal constant INVALID_BRIDGE_ID = "INVALID_BRIDGE_ID";
string internal constant MIDDLEWARE_ACTION_FAILED =
"MIDDLEWARE_ACTION_FAILED";
string internal constant VALUE_SHOULD_BE_ZERO = "VALUE_SHOULD_BE_ZERO";
string internal constant VALUE_SHOULD_NOT_BE_ZERO = "VALUE_SHOULD_NOT_BE_ZERO";
string internal constant VALUE_NOT_ENOUGH = "VALUE_NOT_ENOUGH";
string internal constant VALUE_NOT_EQUAL_TO_AMOUNT = "VALUE_NOT_EQUAL_TO_AMOUNT";
}
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.4;
import "@openzeppelin/contracts/token/ERC20/IERC20.sol";
import "@openzeppelin/contracts/access/Ownable.sol";
import "@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol";
import "./helpers/errors.sol";
/**
@title Abstract Implementation Contract.
@notice All Bridge Implementation will follow this interface.
*/
abstract contract ImplBase is Ownable {
using SafeERC20 for IERC20;
address public registry;
address public constant NATIVE_TOKEN_ADDRESS =
address(0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE);
event UpdateRegistryAddress(address indexed registryAddress);
constructor(address _registry) Ownable() {
registry = _registry;
}
modifier onlyRegistry() {
require(msg.sender == registry, MovrErrors.INVALID_SENDER);
_;
}
function updateRegistryAddress(address newRegistry) external onlyOwner {
registry = newRegistry;
emit UpdateRegistryAddress(newRegistry);
}
function rescueFunds(
address token,
address userAddress,
uint256 amount
) external onlyOwner {
IERC20(token).safeTransfer(userAddress, amount);
}
function outboundTransferTo(
uint256 _amount,
address _from,
address _receiverAddress,
address _token,
uint256 _toChainId,
bytes memory _extraData
) external payable virtual;
}
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.4;
import "@openzeppelin/contracts/access/Ownable.sol";
import "@openzeppelin/contracts/token/ERC20/IERC20.sol";
import "@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol";
import "./helpers/errors.sol";
/**
// @title Abstract Contract for middleware services.
// @notice All middleware services will follow this interface.
*/
abstract contract MiddlewareImplBase is Ownable {
using SafeERC20 for IERC20;
address public immutable registry;
/// @notice only registry address is required.
constructor(address _registry) Ownable() {
registry = _registry;
}
modifier onlyRegistry {
require(msg.sender == registry, MovrErrors.INVALID_SENDER);
_;
}
function performAction(
address from,
address fromToken,
uint256 amount,
address receiverAddress,
bytes memory data
) external payable virtual returns (uint256);
function rescueFunds(
address token,
address userAddress,
uint256 amount
) external onlyOwner {
IERC20(token).safeTransfer(userAddress, amount);
}
}
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
/*
* @dev Provides information about the current execution context, including the
* sender of the transaction and its data. While these are generally available
* via msg.sender and msg.data, they should not be accessed in such a direct
* manner, since when dealing with meta-transactions the account sending and
* paying for execution may not be the actual sender (as far as an application
* is concerned).
*
* This contract is only required for intermediate, library-like contracts.
*/
abstract contract Context {
function _msgSender() internal view virtual returns (address) {
return msg.sender;
}
function _msgData() internal view virtual returns (bytes calldata) {
this; // silence state mutability warning without generating bytecode - see https://github.com/ethereum/solidity/issues/2691
return msg.data;
}
}
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
/**
* @dev Collection of functions related to the address type
*/
library Address {
/**
* @dev Returns true if `account` is a contract.
*
* [IMPORTANT]
* ====
* It is unsafe to assume that an address for which this function returns
* false is an externally-owned account (EOA) and not a contract.
*
* Among others, `isContract` will return false for the following
* types of addresses:
*
* - an externally-owned account
* - a contract in construction
* - an address where a contract will be created
* - an address where a contract lived, but was destroyed
* ====
*/
function isContract(address account) internal view returns (bool) {
// This method relies on extcodesize, which returns 0 for contracts in
// construction, since the code is only stored at the end of the
// constructor execution.
uint256 size;
// solhint-disable-next-line no-inline-assembly
assembly { size := extcodesize(account) }
return size > 0;
}
/**
* @dev Replacement for Solidity's `transfer`: sends `amount` wei to
* `recipient`, forwarding all available gas and reverting on errors.
*
* https://eips.ethereum.org/EIPS/eip-1884[EIP1884] increases the gas cost
* of certain opcodes, possibly making contracts go over the 2300 gas limit
* imposed by `transfer`, making them unable to receive funds via
* `transfer`. {sendValue} removes this limitation.
*
* https://diligence.consensys.net/posts/2019/09/stop-using-soliditys-transfer-now/[Learn more].
*
* IMPORTANT: because control is transferred to `recipient`, care must be
* taken to not create reentrancy vulnerabilities. Consider using
* {ReentrancyGuard} or the
* https://solidity.readthedocs.io/en/v0.5.11/security-considerations.html#use-the-checks-effects-interactions-pattern[checks-effects-interactions pattern].
*/
function sendValue(address payable recipient, uint256 amount) internal {
require(address(this).balance >= amount, "Address: insufficient balance");
// solhint-disable-next-line avoid-low-level-calls, avoid-call-value
(bool success, ) = recipient.call{ value: amount }("");
require(success, "Address: unable to send value, recipient may have reverted");
}
/**
* @dev Performs a Solidity function call using a low level `call`. A
* plain`call` is an unsafe replacement for a function call: use this
* function instead.
*
* If `target` reverts with a revert reason, it is bubbled up by this
* function (like regular Solidity function calls).
*
* Returns the raw returned data. To convert to the expected return value,
* use https://solidity.readthedocs.io/en/latest/units-and-global-variables.html?highlight=abi.decode#abi-encoding-and-decoding-functions[`abi.decode`].
*
* Requirements:
*
* - `target` must be a contract.
* - calling `target` with `data` must not revert.
*
* _Available since v3.1._
*/
function functionCall(address target, bytes memory data) internal returns (bytes memory) {
return functionCall(target, data, "Address: low-level call failed");
}
/**
* @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], but with
* `errorMessage` as a fallback revert reason when `target` reverts.
*
* _Available since v3.1._
*/
function functionCall(address target, bytes memory data, string memory errorMessage) internal returns (bytes memory) {
return functionCallWithValue(target, data, 0, errorMessage);
}
/**
* @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],
* but also transferring `value` wei to `target`.
*
* Requirements:
*
* - the calling contract must have an ETH balance of at least `value`.
* - the called Solidity function must be `payable`.
*
* _Available since v3.1._
*/
function functionCallWithValue(address target, bytes memory data, uint256 value) internal returns (bytes memory) {
return functionCallWithValue(target, data, value, "Address: low-level call with value failed");
}
/**
* @dev Same as {xref-Address-functionCallWithValue-address-bytes-uint256-}[`functionCallWithValue`], but
* with `errorMessage` as a fallback revert reason when `target` reverts.
*
* _Available since v3.1._
*/
function functionCallWithValue(address target, bytes memory data, uint256 value, string memory errorMessage) internal returns (bytes memory) {
require(address(this).balance >= value, "Address: insufficient balance for call");
require(isContract(target), "Address: call to non-contract");
// solhint-disable-next-line avoid-low-level-calls
(bool success, bytes memory returndata) = target.call{ value: value }(data);
return _verifyCallResult(success, returndata, errorMessage);
}
/**
* @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],
* but performing a static call.
*
* _Available since v3.3._
*/
function functionStaticCall(address target, bytes memory data) internal view returns (bytes memory) {
return functionStaticCall(target, data, "Address: low-level static call failed");
}
/**
* @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],
* but performing a static call.
*
* _Available since v3.3._
*/
function functionStaticCall(address target, bytes memory data, string memory errorMessage) internal view returns (bytes memory) {
require(isContract(target), "Address: static call to non-contract");
// solhint-disable-next-line avoid-low-level-calls
(bool success, bytes memory returndata) = target.staticcall(data);
return _verifyCallResult(success, returndata, errorMessage);
}
/**
* @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],
* but performing a delegate call.
*
* _Available since v3.4._
*/
function functionDelegateCall(address target, bytes memory data) internal returns (bytes memory) {
return functionDelegateCall(target, data, "Address: low-level delegate call failed");
}
/**
* @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],
* but performing a delegate call.
*
* _Available since v3.4._
*/
function functionDelegateCall(address target, bytes memory data, string memory errorMessage) internal returns (bytes memory) {
require(isContract(target), "Address: delegate call to non-contract");
// solhint-disable-next-line avoid-low-level-calls
(bool success, bytes memory returndata) = target.delegatecall(data);
return _verifyCallResult(success, returndata, errorMessage);
}
function _verifyCallResult(bool success, bytes memory returndata, string memory errorMessage) private pure returns(bytes memory) {
if (success) {
return returndata;
} else {
// Look for revert reason and bubble it up if present
if (returndata.length > 0) {
// The easiest way to bubble the revert reason is using memory via assembly
// solhint-disable-next-line no-inline-assembly
assembly {
let returndata_size := mload(returndata)
revert(add(32, returndata), returndata_size)
}
} else {
revert(errorMessage);
}
}
}
}
[{"inputs":[{"internalType":"address","name":"_owner","type":"address"}],"stateMutability":"nonpayable","type":"constructor"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint256","name":"middlewareID","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"bridgeID","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"inputAmount","type":"uint256"}],"name":"ExecutionCompleted","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint256","name":"routeID","type":"uint256"},{"indexed":false,"internalType":"address","name":"route","type":"address"},{"indexed":false,"internalType":"bool","name":"isEnabled","type":"bool"},{"indexed":false,"internalType":"bool","name":"isMiddleware","type":"bool"}],"name":"NewRouteAdded","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"previousOwner","type":"address"},{"indexed":true,"internalType":"address","name":"newOwner","type":"address"}],"name":"OwnershipTransferred","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint256","name":"routeID","type":"uint256"}],"name":"RouteDisabled","type":"event"},{"inputs":[{"components":[{"internalType":"address","name":"route","type":"address"},{"internalType":"bool","name":"isEnabled","type":"bool"},{"internalType":"bool","name":"isMiddleware","type":"bool"}],"internalType":"struct Registry.RouteData[]","name":"_routes","type":"tuple[]"}],"name":"addRoutes","outputs":[{"internalType":"uint256[]","name":"","type":"uint256[]"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_routeId","type":"uint256"}],"name":"disableRoute","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"components":[{"internalType":"address","name":"receiverAddress","type":"address"},{"internalType":"uint256","name":"toChainId","type":"uint256"},{"internalType":"uint256","name":"amount","type":"uint256"},{"components":[{"internalType":"uint256","name":"id","type":"uint256"},{"internalType":"uint256","name":"optionalNativeAmount","type":"uint256"},{"internalType":"address","name":"inputToken","type":"address"},{"internalType":"bytes","name":"data","type":"bytes"}],"internalType":"struct Registry.MiddlewareRequest","name":"middlewareRequest","type":"tuple"},{"components":[{"internalType":"uint256","name":"id","type":"uint256"},{"internalType":"uint256","name":"optionalNativeAmount","type":"uint256"},{"internalType":"address","name":"inputToken","type":"address"},{"internalType":"bytes","name":"data","type":"bytes"}],"internalType":"struct Registry.BridgeRequest","name":"bridgeRequest","type":"tuple"}],"internalType":"struct Registry.UserRequest","name":"_userRequest","type":"tuple"}],"name":"outboundTransferTo","outputs":[],"stateMutability":"payable","type":"function"},{"inputs":[],"name":"owner","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"renounceOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_token","type":"address"},{"internalType":"address","name":"_receiverAddress","type":"address"},{"internalType":"uint256","name":"_amount","type":"uint256"}],"name":"rescueFunds","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"","type":"uint256"}],"name":"routes","outputs":[{"internalType":"address","name":"route","type":"address"},{"internalType":"bool","name":"isEnabled","type":"bool"},{"internalType":"bool","name":"isMiddleware","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"newOwner","type":"address"}],"name":"transferOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"stateMutability":"payable","type":"receive"}]
[{"inputs":[{"internalType":"address","name":"_owner","type":"address"}],"stateMutability":"nonpayable","type":"constructor"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint256","name":"middlewareID","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"bridgeID","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"inputAmount","type":"uint256"}],"name":"ExecutionCompleted","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint256","name":"routeID","type":"uint256"},{"indexed":false,"internalType":"address","name":"route","type":"address"},{"indexed":false,"internalType":"bool","name":"isEnabled","type":"bool"},{"indexed":false,"internalType":"bool","name":"isMiddleware","type":"bool"}],"name":"NewRouteAdded","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"previousOwner","type":"address"},{"indexed":true,"internalType":"address","name":"newOwner","type":"address"}],"name":"OwnershipTransferred","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint256","name":"routeID","type":"uint256"}],"name":"RouteDisabled","type":"event"},{"inputs":[{"components":[{"internalType":"address","name":"route","type":"address"},{"internalType":"bool","name":"isEnabled","type":"bool"},{"internalType":"bool","name":"isMiddleware","type":"bool"}],"internalType":"struct Registry.RouteData[]","name":"_routes","type":"tuple[]"}],"name":"addRoutes","outputs":[{"internalType":"uint256[]","name":"","type":"uint256[]"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_routeId","type":"uint256"}],"name":"disableRoute","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"components":[{"internalType":"address","name":"receiverAddress","type":"address"},{"internalType":"uint256","name":"toChainId","type":"uint256"},{"internalType":"uint256","name":"amount","type":"uint256"},{"components":[{"internalType":"uint256","name":"id","type":"uint256"},{"internalType":"uint256","name":"optionalNativeAmount","type":"uint256"},{"internalType":"address","name":"inputToken","type":"address"},{"internalType":"bytes","name":"data","type":"bytes"}],"internalType":"struct Registry.MiddlewareRequest","name":"middlewareRequest","type":"tuple"},{"components":[{"internalType":"uint256","name":"id","type":"uint256"},{"internalType":"uint256","name":"optionalNativeAmount","type":"uint256"},{"internalType":"address","name":"inputToken","type":"address"},{"internalType":"bytes","name":"data","type":"bytes"}],"internalType":"struct Registry.BridgeRequest","name":"bridgeRequest","type":"tuple"}],"internalType":"struct Registry.UserRequest","name":"_userRequest","type":"tuple"}],"name":"outboundTransferTo","outputs":[],"stateMutability":"payable","type":"function"},{"inputs":[],"name":"owner","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"renounceOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_token","type":"address"},{"internalType":"address","name":"_receiverAddress","type":"address"},{"internalType":"uint256","name":"_amount","type":"uint256"}],"name":"rescueFunds","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"","type":"uint256"}],"name":"routes","outputs":[{"internalType":"address","name":"route","type":"address"},{"internalType":"bool","name":"isEnabled","type":"bool"},{"internalType":"bool","name":"isMiddleware","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"newOwner","type":"address"}],"name":"transferOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"stateMutability":"payable","type":"receive"}]
60806040523480156200001157600080fd5b5060405162001b4538038062001b4583398101604081905262000034916200022e565b600080546001600160a01b0319163390811782556040519091829160008051602062001b25833981519152908290a3506040805160608101825273eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee81526001602082018181529282018181528154808301835560009290925291517fb10e2d527612073b26eecdfd717e6a320cf44b4afac2b0732d9fcbe2b7fa0cf69091018054935192511515600160a81b0260ff60a81b19931515600160a01b026001600160a81b03199095166001600160a01b039390931692909217939093179190911617905562000116816200011d565b506200025e565b6000546001600160a01b031633146200017d5760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657260448201526064015b60405180910390fd5b6001600160a01b038116620001e45760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201526564647265737360d01b606482015260840162000174565b600080546040516001600160a01b038085169392169160008051602062001b2583398151915291a3600080546001600160a01b0319166001600160a01b0392909216919091179055565b60006020828403121562000240578081fd5b81516001600160a01b038116811462000257578182fd5b9392505050565b6118b7806200026e6000396000f3fe60806040526004361061007f5760003560e01c80638da5cb5b1161004e5780638da5cb5b1461013f578063a44bbb1514610167578063f2fde38b1461017a578063ffcdf4ed1461019a57600080fd5b806302a9c0511461008b5780636ccae054146100c1578063715018a6146100e3578063726f16d8146100f857600080fd5b3661008657005b600080fd5b34801561009757600080fd5b506100ab6100a636600461144f565b6101ba565b6040516100b891906115eb565b60405180910390f35b3480156100cd57600080fd5b506100e16100dc36600461140f565b610503565b005b3480156100ef57600080fd5b506100e1610576565b34801561010457600080fd5b5061011861011336600461152f565b610627565b604080516001600160a01b03909416845291151560208401521515908201526060016100b8565b34801561014b57600080fd5b506000546040516001600160a01b0390911681526020016100b8565b6100e16101753660046114f7565b610666565b34801561018657600080fd5b506100e16101953660046113f3565b610d50565b3480156101a657600080fd5b506100e16101b536600461152f565b610e8e565b6000546060906001600160a01b0316331461021c5760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657260448201526064015b60405180910390fd5b60408051808201909152600b81527f454d5054595f494e50555400000000000000000000000000000000000000000060208201528261026e5760405162461bcd60e51b8152600401610213919061162f565b5060008267ffffffffffffffff81111561029857634e487b7160e01b600052604160045260246000fd5b6040519080825280602002602001820160405280156102c1578160200160208202803683370190505b50905060005b838110156104fb5760008585838181106102f157634e487b7160e01b600052603260045260246000fd5b61030792602060609092020190810191506113f3565b6001600160a01b031614156040518060400160405280601281526020017f414444524553535f305f50524f56494445440000000000000000000000000000815250906103665760405162461bcd60e51b8152600401610213919061162f565b50600185858381811061038957634e487b7160e01b600052603260045260246000fd5b835460018101855560009485526020909420606090910292909201929190910190506103b5828261179d565b5050600180546103c59190611729565b8282815181106103e557634e487b7160e01b600052603260045260246000fd5b6020026020010181815250507fd7b1a492030c0a30b288b91bf46f20c49c7715b0dd6d42244c61c540111256b58186868481811061043357634e487b7160e01b600052603260045260246000fd5b61044992602060609092020190810191506113f3565b87878581811061046957634e487b7160e01b600052603260045260246000fd5b905060600201602001602081019061048191906114bf565b8888868181106104a157634e487b7160e01b600052603260045260246000fd5b90506060020160400160208101906104b991906114bf565b604080519485526001600160a01b039390931660208501529015158383015215156060830152519081900360800190a1806104f38161176c565b9150506102c7565b509392505050565b6000546001600160a01b0316331461055d5760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e65726044820152606401610213565b6105716001600160a01b0384168383611026565b505050565b6000546001600160a01b031633146105d05760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e65726044820152606401610213565b600080546040516001600160a01b03909116907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0908390a36000805473ffffffffffffffffffffffffffffffffffffffff19169055565b6001818154811061063757600080fd5b6000918252602090912001546001600160a01b038116915060ff600160a01b8204811691600160a81b90041683565b604080518082018252600b81527f494e56414c49445f414d540000000000000000000000000000000000000000006020820152908201356106ba5760405162461bcd60e51b8152600401610213919061162f565b506106c860808201826116fc565b60408051808201909152601181527f494e56414c49445f4252494447455f49440000000000000000000000000000006020820152903561071b5760405162461bcd60e51b8152600401610213919061162f565b50600061072b60808301836116fc565b61073c9060608101906040016113f3565b6001600160a01b031614156040518060400160405280601281526020017f414444524553535f305f50524f564944454400000000000000000000000000008152509061079b5760405162461bcd60e51b8152600401610213919061162f565b50600060016107ad60608401846116fc565b60000135815481106107cf57634e487b7160e01b600052603260045260246000fd5b60009182526020918290206040805160608101825292909101546001600160a01b03811680845260ff600160a01b83048116151595850195909552600160a81b90910490931615159082015291501580159061082c575080602001515b8015610839575080604001515b6040518060400160405280601181526020017f524f5554455f4e4f545f414c4c4f5745440000000000000000000000000000008152509061088d5760405162461bcd60e51b8152600401610213919061162f565b506000600161089f60808501856116fc565b60000135815481106108c157634e487b7160e01b600052603260045260246000fd5b60009182526020918290206040805160608101825292909101546001600160a01b03811680845260ff600160a01b83048116151595850195909552600160a81b90910490931615159082015291501580159061091e575080602001515b801561092c57508060400151155b6040518060400160405280601181526020017f524f5554455f4e4f545f414c4c4f574544000000000000000000000000000000815250906109805760405162461bcd60e51b8152600401610213919061162f565b507f28fd8a5dda29b4035905e0657f97244a0e0bef97951e248ed0f2c6878d6590c26109af60608501856116fc565b356109bd60808601866116fc565b6040805192835290356020830152858101359082015260600160405180910390a16109eb60608401846116fc565b35610aab5780516001600160a01b031663022490c834604086013533610a1460208901896113f3565b610a2160808a018a6116fc565b610a329060608101906040016113f3565b60208a0135610a4460808c018c6116fc565b610a529060608101906116b0565b6040518963ffffffff1660e01b8152600401610a749796959493929190611662565b6000604051808303818588803b158015610a8d57600080fd5b505af1158015610aa1573d6000803e3d6000fd5b5050505050505050565b81516000906001600160a01b031663545ebbb073eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee610ae060608801886116fc565b610af19060608101906040016113f3565b6001600160a01b031614610b1557610b0c60608701876116fc565b60200135610b34565b610b2260608701876116fc565b610b3490602001356040880135611711565b33610b4260608901896116fc565b610b539060608101906040016113f3565b604089013530610b6660608c018c6116fc565b610b749060608101906116b0565b6040518863ffffffff1660e01b8152600401610b95969594939291906115a4565b6020604051808303818588803b158015610bae57600080fd5b505af1158015610bc2573d6000803e3d6000fd5b50505050506040513d601f19601f82011682018060405250810190610be79190611547565b90506000610bf860808601866116fc565b60200135905073eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee610c2060808701876116fc565b610c319060608101906040016113f3565b6001600160a01b031614610c79578251610c749083610c5360808901896116fc565b610c649060608101906040016113f3565b6001600160a01b031691906110b6565b610c97565b610c8660808601866116fc565b610c94906020013583611711565b90505b82516001600160a01b031663022490c8828430610cb760208b018b6113f3565b610cc460808c018c6116fc565b610cd59060608101906040016113f3565b60208c0135610ce760808e018e6116fc565b610cf59060608101906116b0565b6040518963ffffffff1660e01b8152600401610d179796959493929190611662565b6000604051808303818588803b158015610d3057600080fd5b505af1158015610d44573d6000803e3d6000fd5b50505050505050505050565b6000546001600160a01b03163314610daa5760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e65726044820152606401610213565b6001600160a01b038116610e265760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201527f64647265737300000000000000000000000000000000000000000000000000006064820152608401610213565b600080546040516001600160a01b03808516939216917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e091a36000805473ffffffffffffffffffffffffffffffffffffffff19166001600160a01b0392909216919091179055565b6000546001600160a01b03163314610ee85760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e65726044820152606401610213565b8060006001600160a01b031660018281548110610f1557634e487b7160e01b600052603260045260246000fd5b6000918252602091829020015460408051808201909152600f81527f524f5554455f4e4f545f464f554e4400000000000000000000000000000000009281019290925290916001600160a01b039091161415610f845760405162461bcd60e51b8152600401610213919061162f565b50600060018381548110610fa857634e487b7160e01b600052603260045260246000fd5b60009182526020909120018054911515600160a01b027fffffffffffffffffffffff00ffffffffffffffffffffffffffffffffffffffff9092169190911790556040517f91a0168fe2af7d03fc4465ab611da7d997fe924f69c20e9d16a23e6fc7af88d49061101a9084815260200190565b60405180910390a15050565b6040516001600160a01b03831660248201526044810182905261057190849063a9059cbb60e01b906064015b60408051601f198184030181529190526020810180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff167fffffffff000000000000000000000000000000000000000000000000000000009093169290921790915261117d565b604051636eb1769f60e11b81523060048201526001600160a01b038381166024830152600091839186169063dd62ed3e9060440160206040518083038186803b15801561110257600080fd5b505afa158015611116573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061113a9190611547565b6111449190611711565b6040516001600160a01b03851660248201526044810182905290915061117790859063095ea7b360e01b90606401611052565b50505050565b60006111d2826040518060400160405280602081526020017f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c6564815250856001600160a01b03166112629092919063ffffffff16565b80519091501561057157808060200190518101906111f091906114db565b6105715760405162461bcd60e51b815260206004820152602a60248201527f5361666545524332303a204552433230206f7065726174696f6e20646964206e60448201527f6f742073756363656564000000000000000000000000000000000000000000006064820152608401610213565b6060611271848460008561127b565b90505b9392505050565b6060824710156112f35760405162461bcd60e51b815260206004820152602660248201527f416464726573733a20696e73756666696369656e742062616c616e636520666f60448201527f722063616c6c00000000000000000000000000000000000000000000000000006064820152608401610213565b843b6113415760405162461bcd60e51b815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e74726163740000006044820152606401610213565b600080866001600160a01b0316858760405161135d9190611588565b60006040518083038185875af1925050503d806000811461139a576040519150601f19603f3d011682016040523d82523d6000602084013e61139f565b606091505b50915091506113af8282866113ba565b979650505050505050565b606083156113c9575081611274565b8251156113d95782518084602001fd5b8160405162461bcd60e51b8152600401610213919061162f565b600060208284031215611404578081fd5b813561127481611884565b600080600060608486031215611423578182fd5b833561142e81611884565b9250602084013561143e81611884565b929592945050506040919091013590565b60008060208385031215611461578182fd5b823567ffffffffffffffff80821115611478578384fd5b818501915085601f83011261148b578384fd5b813581811115611499578485fd5b8660206060830285010111156114ad578485fd5b60209290920196919550909350505050565b6000602082840312156114d0578081fd5b81356112748161189c565b6000602082840312156114ec578081fd5b81516112748161189c565b600060208284031215611508578081fd5b813567ffffffffffffffff81111561151e578182fd5b820160a08185031215611274578182fd5b600060208284031215611540578081fd5b5035919050565b600060208284031215611558578081fd5b5051919050565b81835281816020850137506000828201602090810191909152601f909101601f19169091010190565b6000825161159a818460208701611740565b9190910192915050565b60006001600160a01b038089168352808816602084015286604084015280861660608401525060a060808301526115df60a08301848661155f565b98975050505050505050565b6020808252825182820181905260009190848201906040850190845b8181101561162357835183529284019291840191600101611607565b50909695505050505050565b602081526000825180602084015261164e816040850160208701611740565b601f01601f19169190910160400192915050565b87815260006001600160a01b038089166020840152808816604084015280871660608401525084608083015260c060a08301526116a360c08301848661155f565b9998505050505050505050565b6000808335601e198436030181126116c6578283fd5b83018035915067ffffffffffffffff8211156116e0578283fd5b6020019150368190038213156116f557600080fd5b9250929050565b60008235607e1983360301811261159a578182fd5b6000821982111561172457611724611787565b500190565b60008282101561173b5761173b611787565b500390565b60005b8381101561175b578181015183820152602001611743565b838111156111775750506000910152565b600060001982141561178057611780611787565b5060010190565b634e487b7160e01b600052601160045260246000fd5b81356117a881611884565b6001600160a01b038116905081548173ffffffffffffffffffffffffffffffffffffffff19821617835560208401356117e08161189c565b74ff000000000000000000000000000000000000000090151560a01b167fffffffffffffffffffffff000000000000000000000000000000000000000000821683178117845560408501356118348161189c565b75ff00000000000000000000000000000000000000000081151560a81b16847fffffffffffffffffffff000000000000000000000000000000000000000000008516178317178555505050505050565b6001600160a01b038116811461189957600080fd5b50565b801515811461189957600080fdfea164736f6c6343000804000a8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e00000000000000000000000005fd7d0d6b91cc4787bcb86ca47e0bd4ea0346d34
60806040523480156200001157600080fd5b5060405162001b4538038062001b4583398101604081905262000034916200022e565b600080546001600160a01b0319163390811782556040519091829160008051602062001b25833981519152908290a3506040805160608101825273eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee81526001602082018181529282018181528154808301835560009290925291517fb10e2d527612073b26eecdfd717e6a320cf44b4afac2b0732d9fcbe2b7fa0cf69091018054935192511515600160a81b0260ff60a81b19931515600160a01b026001600160a81b03199095166001600160a01b039390931692909217939093179190911617905562000116816200011d565b506200025e565b6000546001600160a01b031633146200017d5760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657260448201526064015b60405180910390fd5b6001600160a01b038116620001e45760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201526564647265737360d01b606482015260840162000174565b600080546040516001600160a01b038085169392169160008051602062001b2583398151915291a3600080546001600160a01b0319166001600160a01b0392909216919091179055565b60006020828403121562000240578081fd5b81516001600160a01b038116811462000257578182fd5b9392505050565b6118b7806200026e6000396000f3fe60806040526004361061007f5760003560e01c80638da5cb5b1161004e5780638da5cb5b1461013f578063a44bbb1514610167578063f2fde38b1461017a578063ffcdf4ed1461019a57600080fd5b806302a9c0511461008b5780636ccae054146100c1578063715018a6146100e3578063726f16d8146100f857600080fd5b3661008657005b600080fd5b34801561009757600080fd5b506100ab6100a636600461144f565b6101ba565b6040516100b891906115eb565b60405180910390f35b3480156100cd57600080fd5b506100e16100dc36600461140f565b610503565b005b3480156100ef57600080fd5b506100e1610576565b34801561010457600080fd5b5061011861011336600461152f565b610627565b604080516001600160a01b03909416845291151560208401521515908201526060016100b8565b34801561014b57600080fd5b506000546040516001600160a01b0390911681526020016100b8565b6100e16101753660046114f7565b610666565b34801561018657600080fd5b506100e16101953660046113f3565b610d50565b3480156101a657600080fd5b506100e16101b536600461152f565b610e8e565b6000546060906001600160a01b0316331461021c5760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657260448201526064015b60405180910390fd5b60408051808201909152600b81527f454d5054595f494e50555400000000000000000000000000000000000000000060208201528261026e5760405162461bcd60e51b8152600401610213919061162f565b5060008267ffffffffffffffff81111561029857634e487b7160e01b600052604160045260246000fd5b6040519080825280602002602001820160405280156102c1578160200160208202803683370190505b50905060005b838110156104fb5760008585838181106102f157634e487b7160e01b600052603260045260246000fd5b61030792602060609092020190810191506113f3565b6001600160a01b031614156040518060400160405280601281526020017f414444524553535f305f50524f56494445440000000000000000000000000000815250906103665760405162461bcd60e51b8152600401610213919061162f565b50600185858381811061038957634e487b7160e01b600052603260045260246000fd5b835460018101855560009485526020909420606090910292909201929190910190506103b5828261179d565b5050600180546103c59190611729565b8282815181106103e557634e487b7160e01b600052603260045260246000fd5b6020026020010181815250507fd7b1a492030c0a30b288b91bf46f20c49c7715b0dd6d42244c61c540111256b58186868481811061043357634e487b7160e01b600052603260045260246000fd5b61044992602060609092020190810191506113f3565b87878581811061046957634e487b7160e01b600052603260045260246000fd5b905060600201602001602081019061048191906114bf565b8888868181106104a157634e487b7160e01b600052603260045260246000fd5b90506060020160400160208101906104b991906114bf565b604080519485526001600160a01b039390931660208501529015158383015215156060830152519081900360800190a1806104f38161176c565b9150506102c7565b509392505050565b6000546001600160a01b0316331461055d5760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e65726044820152606401610213565b6105716001600160a01b0384168383611026565b505050565b6000546001600160a01b031633146105d05760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e65726044820152606401610213565b600080546040516001600160a01b03909116907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0908390a36000805473ffffffffffffffffffffffffffffffffffffffff19169055565b6001818154811061063757600080fd5b6000918252602090912001546001600160a01b038116915060ff600160a01b8204811691600160a81b90041683565b604080518082018252600b81527f494e56414c49445f414d540000000000000000000000000000000000000000006020820152908201356106ba5760405162461bcd60e51b8152600401610213919061162f565b506106c860808201826116fc565b60408051808201909152601181527f494e56414c49445f4252494447455f49440000000000000000000000000000006020820152903561071b5760405162461bcd60e51b8152600401610213919061162f565b50600061072b60808301836116fc565b61073c9060608101906040016113f3565b6001600160a01b031614156040518060400160405280601281526020017f414444524553535f305f50524f564944454400000000000000000000000000008152509061079b5760405162461bcd60e51b8152600401610213919061162f565b50600060016107ad60608401846116fc565b60000135815481106107cf57634e487b7160e01b600052603260045260246000fd5b60009182526020918290206040805160608101825292909101546001600160a01b03811680845260ff600160a01b83048116151595850195909552600160a81b90910490931615159082015291501580159061082c575080602001515b8015610839575080604001515b6040518060400160405280601181526020017f524f5554455f4e4f545f414c4c4f5745440000000000000000000000000000008152509061088d5760405162461bcd60e51b8152600401610213919061162f565b506000600161089f60808501856116fc565b60000135815481106108c157634e487b7160e01b600052603260045260246000fd5b60009182526020918290206040805160608101825292909101546001600160a01b03811680845260ff600160a01b83048116151595850195909552600160a81b90910490931615159082015291501580159061091e575080602001515b801561092c57508060400151155b6040518060400160405280601181526020017f524f5554455f4e4f545f414c4c4f574544000000000000000000000000000000815250906109805760405162461bcd60e51b8152600401610213919061162f565b507f28fd8a5dda29b4035905e0657f97244a0e0bef97951e248ed0f2c6878d6590c26109af60608501856116fc565b356109bd60808601866116fc565b6040805192835290356020830152858101359082015260600160405180910390a16109eb60608401846116fc565b35610aab5780516001600160a01b031663022490c834604086013533610a1460208901896113f3565b610a2160808a018a6116fc565b610a329060608101906040016113f3565b60208a0135610a4460808c018c6116fc565b610a529060608101906116b0565b6040518963ffffffff1660e01b8152600401610a749796959493929190611662565b6000604051808303818588803b158015610a8d57600080fd5b505af1158015610aa1573d6000803e3d6000fd5b5050505050505050565b81516000906001600160a01b031663545ebbb073eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee610ae060608801886116fc565b610af19060608101906040016113f3565b6001600160a01b031614610b1557610b0c60608701876116fc565b60200135610b34565b610b2260608701876116fc565b610b3490602001356040880135611711565b33610b4260608901896116fc565b610b539060608101906040016113f3565b604089013530610b6660608c018c6116fc565b610b749060608101906116b0565b6040518863ffffffff1660e01b8152600401610b95969594939291906115a4565b6020604051808303818588803b158015610bae57600080fd5b505af1158015610bc2573d6000803e3d6000fd5b50505050506040513d601f19601f82011682018060405250810190610be79190611547565b90506000610bf860808601866116fc565b60200135905073eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee610c2060808701876116fc565b610c319060608101906040016113f3565b6001600160a01b031614610c79578251610c749083610c5360808901896116fc565b610c649060608101906040016113f3565b6001600160a01b031691906110b6565b610c97565b610c8660808601866116fc565b610c94906020013583611711565b90505b82516001600160a01b031663022490c8828430610cb760208b018b6113f3565b610cc460808c018c6116fc565b610cd59060608101906040016113f3565b60208c0135610ce760808e018e6116fc565b610cf59060608101906116b0565b6040518963ffffffff1660e01b8152600401610d179796959493929190611662565b6000604051808303818588803b158015610d3057600080fd5b505af1158015610d44573d6000803e3d6000fd5b50505050505050505050565b6000546001600160a01b03163314610daa5760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e65726044820152606401610213565b6001600160a01b038116610e265760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201527f64647265737300000000000000000000000000000000000000000000000000006064820152608401610213565b600080546040516001600160a01b03808516939216917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e091a36000805473ffffffffffffffffffffffffffffffffffffffff19166001600160a01b0392909216919091179055565b6000546001600160a01b03163314610ee85760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e65726044820152606401610213565b8060006001600160a01b031660018281548110610f1557634e487b7160e01b600052603260045260246000fd5b6000918252602091829020015460408051808201909152600f81527f524f5554455f4e4f545f464f554e4400000000000000000000000000000000009281019290925290916001600160a01b039091161415610f845760405162461bcd60e51b8152600401610213919061162f565b50600060018381548110610fa857634e487b7160e01b600052603260045260246000fd5b60009182526020909120018054911515600160a01b027fffffffffffffffffffffff00ffffffffffffffffffffffffffffffffffffffff9092169190911790556040517f91a0168fe2af7d03fc4465ab611da7d997fe924f69c20e9d16a23e6fc7af88d49061101a9084815260200190565b60405180910390a15050565b6040516001600160a01b03831660248201526044810182905261057190849063a9059cbb60e01b906064015b60408051601f198184030181529190526020810180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff167fffffffff000000000000000000000000000000000000000000000000000000009093169290921790915261117d565b604051636eb1769f60e11b81523060048201526001600160a01b038381166024830152600091839186169063dd62ed3e9060440160206040518083038186803b15801561110257600080fd5b505afa158015611116573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061113a9190611547565b6111449190611711565b6040516001600160a01b03851660248201526044810182905290915061117790859063095ea7b360e01b90606401611052565b50505050565b60006111d2826040518060400160405280602081526020017f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c6564815250856001600160a01b03166112629092919063ffffffff16565b80519091501561057157808060200190518101906111f091906114db565b6105715760405162461bcd60e51b815260206004820152602a60248201527f5361666545524332303a204552433230206f7065726174696f6e20646964206e60448201527f6f742073756363656564000000000000000000000000000000000000000000006064820152608401610213565b6060611271848460008561127b565b90505b9392505050565b6060824710156112f35760405162461bcd60e51b815260206004820152602660248201527f416464726573733a20696e73756666696369656e742062616c616e636520666f60448201527f722063616c6c00000000000000000000000000000000000000000000000000006064820152608401610213565b843b6113415760405162461bcd60e51b815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e74726163740000006044820152606401610213565b600080866001600160a01b0316858760405161135d9190611588565b60006040518083038185875af1925050503d806000811461139a576040519150601f19603f3d011682016040523d82523d6000602084013e61139f565b606091505b50915091506113af8282866113ba565b979650505050505050565b606083156113c9575081611274565b8251156113d95782518084602001fd5b8160405162461bcd60e51b8152600401610213919061162f565b600060208284031215611404578081fd5b813561127481611884565b600080600060608486031215611423578182fd5b833561142e81611884565b9250602084013561143e81611884565b929592945050506040919091013590565b60008060208385031215611461578182fd5b823567ffffffffffffffff80821115611478578384fd5b818501915085601f83011261148b578384fd5b813581811115611499578485fd5b8660206060830285010111156114ad578485fd5b60209290920196919550909350505050565b6000602082840312156114d0578081fd5b81356112748161189c565b6000602082840312156114ec578081fd5b81516112748161189c565b600060208284031215611508578081fd5b813567ffffffffffffffff81111561151e578182fd5b820160a08185031215611274578182fd5b600060208284031215611540578081fd5b5035919050565b600060208284031215611558578081fd5b5051919050565b81835281816020850137506000828201602090810191909152601f909101601f19169091010190565b6000825161159a818460208701611740565b9190910192915050565b60006001600160a01b038089168352808816602084015286604084015280861660608401525060a060808301526115df60a08301848661155f565b98975050505050505050565b6020808252825182820181905260009190848201906040850190845b8181101561162357835183529284019291840191600101611607565b50909695505050505050565b602081526000825180602084015261164e816040850160208701611740565b601f01601f19169190910160400192915050565b87815260006001600160a01b038089166020840152808816604084015280871660608401525084608083015260c060a08301526116a360c08301848661155f565b9998505050505050505050565b6000808335601e198436030181126116c6578283fd5b83018035915067ffffffffffffffff8211156116e0578283fd5b6020019150368190038213156116f557600080fd5b9250929050565b60008235607e1983360301811261159a578182fd5b6000821982111561172457611724611787565b500190565b60008282101561173b5761173b611787565b500390565b60005b8381101561175b578181015183820152602001611743565b838111156111775750506000910152565b600060001982141561178057611780611787565b5060010190565b634e487b7160e01b600052601160045260246000fd5b81356117a881611884565b6001600160a01b038116905081548173ffffffffffffffffffffffffffffffffffffffff19821617835560208401356117e08161189c565b74ff000000000000000000000000000000000000000090151560a01b167fffffffffffffffffffffff000000000000000000000000000000000000000000821683178117845560408501356118348161189c565b75ff00000000000000000000000000000000000000000081151560a81b16847fffffffffffffffffffff000000000000000000000000000000000000000000008516178317178555505050505050565b6001600160a01b038116811461189957600080fd5b50565b801515811461189957600080fdfea164736f6c6343000804000a8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e00000000000000000000000005fd7d0d6b91cc4787bcb86ca47e0bd4ea0346d34