Source Code
Overview
ETH Balance
0 ETH
ETH Value
$0.00| Transaction Hash |
|
Block
|
From
|
To
|
|||||
|---|---|---|---|---|---|---|---|---|---|
Latest 25 internal transactions (View All)
Advanced mode:
| Parent Transaction Hash | Block | From | To | |||
|---|---|---|---|---|---|---|
| 106083021 | 965 days ago | 0 ETH | ||||
| 106083010 | 965 days ago | 0 ETH | ||||
| 105909131 | 969 days ago | 0.000197946103048 ETH | ||||
| 105908212 | 969 days ago | 0.0041362 ETH | ||||
| 105906791 | 969 days ago | 0.000413429688473 ETH | ||||
| 105906526 | 969 days ago | 0 ETH | ||||
| 105905860 | 969 days ago | 0.000601993312812 ETH | ||||
| 105905860 | 969 days ago | 0 ETH | ||||
| 105905593 | 969 days ago | 0.005 ETH | ||||
| 105905588 | 969 days ago | 0.0006 ETH | ||||
| 105904776 | 969 days ago | 0 ETH | ||||
| 105904449 | 969 days ago | 0.123659 ETH | ||||
| 105903366 | 969 days ago | 0.006558566667365 ETH | ||||
| 105901395 | 969 days ago | 0.025239264538547 ETH | ||||
| 105901375 | 969 days ago | 0.020239264538547 ETH | ||||
| 105901350 | 969 days ago | 0.025239264538547 ETH | ||||
| 105901332 | 969 days ago | 0.020239264538547 ETH | ||||
| 105901307 | 969 days ago | 0.025239264538547 ETH | ||||
| 105901112 | 969 days ago | 0.000332366667365 ETH | ||||
| 105899311 | 969 days ago | 0 ETH | ||||
| 105898550 | 969 days ago | 0 ETH | ||||
| 105893947 | 969 days ago | 0.003424087697183 ETH | ||||
| 105893672 | 969 days ago | 0.022427708568475 ETH | ||||
| 105892884 | 969 days ago | 0.014197032676169 ETH | ||||
| 105890552 | 969 days ago | 0.000495278708482 ETH |
Cross-Chain Transactions
Loading...
Loading
Contract Name:
ExecutionNode
Compiler Version
v0.8.15+commit.e14f2714
Optimization Enabled:
Yes with 800 runs
Other Settings:
default evmVersion
Contract Source Code (Solidity Standard Json-Input format)
// SPDX-License-Identifier: GPL-3.0-only
pragma solidity >=0.8.15;
import "@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol";
import "@openzeppelin/contracts/token/ERC20/IERC20.sol";
import "@openzeppelin/contracts/utils/cryptography/ECDSA.sol";
import "@openzeppelin/contracts/security/ReentrancyGuard.sol";
import "@openzeppelin/contracts/proxy/utils/Initializable.sol";
import "./lib/Types.sol";
import "./lib/MessageReceiver.sol";
import "./lib/Pauser.sol";
import "./lib/NativeWrap.sol";
import "./lib/Bytes.sol";
import "./interfaces/IBridgeAdapter.sol";
import "./interfaces/ICodec.sol";
import "./interfaces/IExecutionNodeEvents.sol";
import "./interfaces/IWETH.sol";
import "./interfaces/IMessageBus.sol";
import "./registries/BridgeRegistry.sol";
import "./registries/DexRegistry.sol";
import "./registries/RemoteExecutionNodeRegistry.sol";
import "./registries/FeeVaultRegistry.sol";
import "./SigVerifier.sol";
import "./Pocket.sol";
/**
* @author Chainhop Dex Team
* @author Padoriku
* @title a route execution contract
* @notice
* a few key concepts about how the chain of execution works:
* - a "swap-bridge execution combo" (Types.ExecutionInfo) is a node in the execution chain
* - a node be swap-only, bridge-only, or swap-bridge
* - a message is an edge in the execution chain, it carries the remaining swap-bridge combos to the next node
* - execute() executes a swap-bridge combo and determines if the current node is the final one by looking at Types.DestinationInfo
* - executeMessage() is called on the intermediate nodes by chainhop's executor. it simply calls execute() to advance the execution chain
* - a "pocket" is a counterfactual contract of which the address is determined at quote-time by chainhop's pathfinder server with using
* the id as salt. the actual pocket contract deployment is done at execution time by the the ExecutionNode on that chain
*/
contract ExecutionNode is
IExecutionNodeEvents,
MessageReceiver,
DexRegistry,
BridgeRegistry,
SigVerifier,
FeeVaultRegistry,
NativeWrap,
ReentrancyGuard,
Pauser,
RemoteExecutionNodeRegistry
{
using SafeERC20 for IERC20;
using ECDSA for bytes32;
using Bytes for bytes;
constructor(
bool _testMode,
address _messageBus,
address _nativeWrap
) MessageReceiver(_testMode, _messageBus) NativeWrap(_nativeWrap) {
_disableInitializers();
}
// init() can only be called once during the first deployment of the proxy contract.
// any subsequent changes to the proxy contract's state must be done through their respective set methods via owner key.
function init(
bool _testMode,
address _messageBus,
address _nativeWrap,
address _signer,
address _feeVault,
address[] memory _dexList,
string[] memory _funcs,
address[] memory _codecs,
string[] memory _bridgeProviders,
address[] memory _bridgeAdapters
) external initializer {
initOwner();
initMessageReceiver(_testMode, _messageBus);
initDexRegistry(_dexList, _funcs, _codecs);
initBridgeRegistry(_bridgeProviders, _bridgeAdapters);
initFeeVaultRegistry(_feeVault);
initSigVerifier(_signer);
initNativeWrap(_nativeWrap);
}
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
* Core
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
/**
* @notice executes a swap-bridge combo and relays the next swap-bridge combo to the next chain (if any)
* @param _execs contains info that tells this contract how to collect a part of the bridge token
* received as fee and how to swap can be omitted on the source chain if there is no swaps to execute
* @param _src info that is processed on the source chain. only required on the source chain and should not be populated on subsequent hops
* @param _dst the receiving info of the entire operation
*/
function srcExecute(
Types.ExecutionInfo[] memory _execs,
Types.SourceInfo memory _src,
Types.DestinationInfo memory _dst
) external payable whenNotPaused nonReentrant {
require(_execs.length > 0, "nop");
require(_src.amountIn > 0, "0 amount");
require(_dst.receiver != address(0), "0 receiver");
bytes32 id = _computeId(msg.sender, _dst.receiver, _src.nonce);
Types.ExecutionInfo memory exec = _execs[0];
if (_execs.length > 1) {
_verify(_execs, _src);
}
(uint256 amountIn, address tokenIn) = _pullFundFromSender(_src);
require(amountIn > 0, "amount must > 0");
// process swap if any
uint256 nextAmount = amountIn;
address nextToken = tokenIn;
if (exec.swap.dex != address(0)) {
bool success = true;
(success, nextAmount, nextToken) = _executeSwap(exec.swap, amountIn, tokenIn);
require(success, "swap fail");
}
_processNextStep(id, _execs, _dst, nextToken, nextAmount);
}
/**
* @notice called by cBridge MessageBus. processes the execution info and carry on the executions
* @param _message the message that contains the remaining swap-bridge combos to be executed
* @return executionStatus always success if no reverts to let the MessageBus know that the message is processed
*/
function executeMessage(
address _sender,
uint64 _srcChainId,
bytes memory _message,
address // _executor
)
external
payable
override
onlyMessageBus
onlyRemoteExecutionNode(_srcChainId, _sender)
whenNotPaused
nonReentrant
returns (ExecutionStatus)
{
Types.Message memory m = abi.decode((_message), (Types.Message));
require(m.execs.length > 0, "nop");
uint256 remainingValue = msg.value;
Types.ExecutionInfo memory exec = m.execs[0];
(uint256 amountIn, address tokenIn) = _pullFundFromPocket(m.id, exec);
// if amountIn is 0 after deducting fee, this contract keeps all amountIn as fee and
// ends the execution
if (amountIn == 0) {
emit StepExecuted(m.id, 0, tokenIn);
return _refundValueAndDone(remainingValue);
}
// refund immediately if receives bridge out fallback token
if (tokenIn == exec.bridgeOutFallbackToken) {
_sendToken(tokenIn, amountIn, m.dst.receiver, false);
emit StepExecuted(m.id, amountIn, tokenIn);
return _refundValueAndDone(remainingValue);
}
// process swap if any
uint256 nextAmount = amountIn;
address nextToken = tokenIn;
if (exec.swap.dex != address(0)) {
bool success = true;
(success, nextAmount, nextToken) = _executeSwap(exec.swap, amountIn, tokenIn);
// refund immediately if swap fails
if (!success) {
_sendToken(tokenIn, amountIn, m.dst.receiver, false);
emit StepExecuted(m.id, amountIn, tokenIn);
return _refundValueAndDone(remainingValue);
}
}
uint256 consumedValue = _processNextStep(m.id, m.execs, m.dst, nextToken, nextAmount);
remainingValue -= consumedValue;
return _refundValueAndDone(remainingValue);
}
// the receiver of a swap is entitled to all the funds in the pocket. as long as someone can prove
// that they are the receiver of a swap, they can always recreate the pocket contract and claim the
// funds inside.
function claimPocketFund(
address _srcSender,
address _dstReceiver,
uint64 _nonce,
address _token
) external whenNotPaused nonReentrant {
require(msg.sender == _dstReceiver, "only receiver can claim");
// id ensures that only the designated receiver of a swap can claim funds from the designated pocket of a swap
bytes32 id = _computeId(_srcSender, _dstReceiver, _nonce);
Pocket pocket = new Pocket{salt: id}();
uint256 erc20Amount = IERC20(_token).balanceOf(address(pocket));
uint256 nativeAmount = address(pocket).balance;
require(erc20Amount > 0 || nativeAmount > 0, "pocket is empty");
// this claims both _token and native
_claimPocketERC20(pocket, _token, erc20Amount);
if (erc20Amount > 0) {
IERC20(_token).safeTransfer(_dstReceiver, erc20Amount);
}
if (nativeAmount > 0) {
(bool ok, ) = _dstReceiver.call{value: nativeAmount, gas: 50000}("");
require(ok, "failed to send native");
}
emit PocketFundClaimed(_dstReceiver, erc20Amount, _token, nativeAmount);
}
/**
* @notice allows the owner to extract stuck funds from this contract and sent to _receiver
* @dev since bridged funds are sent to the pocket contract, and fees are sent to the fee vault,
* normally there should be no residue funds in this contract. but in case someone mistakenly
* send tokens directly to this contract, this function can be used to access these funds.
* @param _token the token to extract, use address(0) for native token
*/
function resecueFund(address _token) external onlyOwner {
if (_token == address(0)) {
(bool ok, ) = owner().call{value: address(this).balance}("");
require(ok, "send native failed");
} else {
IERC20(_token).safeTransfer(owner(), IERC20(_token).balanceOf(address(this)));
}
}
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
* Misc
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
// encoding src sender into the id prevents the scenario where different senders can send funds to the the same receiver
// causing the swap behavior to be non-deterministic. e.g. if src sender is not in id generation, an attacker can send
// send a modified swap data as soon as they see the victim executes on the src chain. since the processing of messages
// is asynchronous, the hacker's message can be executed first, accessing the fund inside the victim's pocket and
// swapping it in some unfavorable ways.
//
// note that if the original tx sender is a contract, the integrator MUST ensure that they maintain a unique nonce so
// that the same sender/receiver/nonce combo cannot be used twice. otherwise, the above attack is possible via the
// integrator's contract. TODO: maybe add the nonce maintenance in this contract.
function _computeId(
address _srcSender,
address _dstReceiver,
uint64 _nonce
) private pure returns (bytes32) {
// the main purpose of this id is to uniquely identify a user-swap.
return keccak256(abi.encodePacked(_srcSender, _dstReceiver, _nonce));
}
function _processNextStep(
bytes32 _id,
Types.ExecutionInfo[] memory _execs,
Types.DestinationInfo memory _dst,
address _nextToken,
uint256 _nextAmount
) private returns (uint256 consumedValue) {
Types.ExecutionInfo memory exec = _execs[0];
_execs = _removeFirst(_execs);
// pay receiver if there is no more swaps or bridges
if (_execs.length == 0 && exec.bridge.toChainId == 0) {
_sendToken(_nextToken, _nextAmount, _dst.receiver, _dst.nativeOut);
emit StepExecuted(_id, _nextAmount, _nextToken);
return 0;
}
// funds are bridged directly to the receiver if there are no subsequent executions on the destination chain.
// otherwise, it's sent to a "pocket" contract addr to temporarily hold the fund before it is used for swapping.
address bridgeOutReceiver = _dst.receiver;
// if there are more execution steps left, pack them and send to the next chain
if (_execs.length > 0) {
address remote = remotes[exec.bridge.toChainId];
require(remote != address(0), "remote not found");
bridgeOutReceiver = _getPocketAddr(_id, remote);
bytes memory message = abi.encode(Types.Message({id: _id, execs: _execs, dst: _dst}));
uint256 msgFee = IMessageBus(messageBus).calcFee(message);
IMessageBus(messageBus).sendMessage{value: msgFee}(remote, exec.bridge.toChainId, message);
consumedValue += msgFee;
}
_bridgeSend(exec.bridge, bridgeOutReceiver, _nextToken, _nextAmount);
consumedValue += exec.bridge.nativeFee;
emit StepExecuted(_id, _nextAmount, _nextToken);
}
function _refundValueAndDone(uint256 _remainingValue) private returns (ExecutionStatus status) {
// chainhop executor would always send a set amount of native token when calling messagebus's executeMessage().
// these tokens cover the fee introduced by chaining another message when there are more bridging.
// refunding the unspent native tokens back to the executor
if (_remainingValue > 0) {
// TODO, use the _executor param passed in from executeMessage for the refund receiver
(bool ok, ) = tx.origin.call{value: _remainingValue, gas: 50000}("");
require(ok, "failed to refund remaining native token");
}
return ExecutionStatus.Success;
}
function _pullFundFromSender(Types.SourceInfo memory _src) private returns (uint256 amount, address token) {
if (_src.nativeIn) {
require(_src.tokenIn == nativeWrap, "tokenIn not nativeWrap");
require(msg.value >= _src.amountIn, "insufficient native amount");
IWETH(nativeWrap).deposit{value: _src.amountIn}();
} else {
IERC20(_src.tokenIn).safeTransferFrom(msg.sender, address(this), _src.amountIn);
}
return (_src.amountIn, _src.tokenIn);
}
function _pullFundFromPocket(bytes32 _id, Types.ExecutionInfo memory _exec)
private
returns (uint256 amount, address token)
{
Pocket pocket = new Pocket{salt: _id}();
uint256 fallbackAmount;
if (_exec.bridgeOutFallbackToken != address(0)) {
fallbackAmount = IERC20(_exec.bridgeOutFallbackToken).balanceOf(address(pocket)); // e.g. hToken/anyToken
}
uint256 erc20Amount = IERC20(_exec.bridgeOutToken).balanceOf(address(pocket));
uint256 nativeAmount = address(pocket).balance;
// if the pocket does not have bridgeOutMin, we consider the transfer not arrived yet. in
// this case we tell the msgbus to revert the outter tx using the MSG::ABORT: prefix and
// our executor will retry sending this tx later.
//
// this bridgeOutMin is also a counter-measure to a DoS attack vector. if we assume the bridge
// funds have arrived once we see a balance in the pocket, an attacker can deposit a small
// amount of fund into the pocket and confuse this contract that the bridged fund has arrived.
// this triggers the refund logic branch and thus denying the dst swap for the victim.
// bridgeOutMin is determined by the server before sending out the transfer.
// bridgeOutMin = R * bridgeAmountIn where R is an arbitrary ratio that we feel effective in
// raising the attacker's attack cost.
if (fallbackAmount > _exec.bridgeOutFallbackMin) {
_claimPocketERC20(pocket, _exec.bridgeOutFallbackToken, fallbackAmount);
amount = _deductFee(fallbackAmount, _exec.feeInBridgeOutFallbackToken, _exec.bridgeOutFallbackToken);
token = _exec.bridgeOutFallbackToken;
} else if (erc20Amount > _exec.bridgeOutMin) {
_claimPocketERC20(pocket, _exec.bridgeOutToken, erc20Amount);
amount = _deductFee(erc20Amount, _exec.feeInBridgeOutToken, _exec.bridgeOutToken);
token = _exec.bridgeOutToken;
} else if (nativeAmount > _exec.bridgeOutMin) {
// no need to check before/after balance here since selfdestruct is guaranteed to
// send all native tokens from the pocket to this contract.
pocket.claim(address(0), 0);
require(_exec.bridgeOutToken == nativeWrap, "bridgeOutToken not nativeWrap");
amount = _deductFee(nativeAmount, _exec.feeInBridgeOutToken, _exec.bridgeOutToken);
IWETH(_exec.bridgeOutToken).deposit{value: amount}();
token = _exec.bridgeOutToken;
} else {
revert("MSG::ABORT:pocket is empty");
}
}
// since the call result of the transfer function in the pocket contract is not checked, we check
// the before and after balance of this contract to ensure that the amount is indeed received.
function _claimPocketERC20(
Pocket _pocket,
address _token,
uint256 _amount
) private {
uint256 balBefore = IERC20(_token).balanceOf(address(this));
_pocket.claim(_token, _amount);
uint256 balAfter = IERC20(_token).balanceOf(address(this));
require(balAfter - balBefore >= _amount, "insufficient fund claimed");
}
function _getPocketAddr(bytes32 _salt, address _deployer) private pure returns (address) {
// how to predict a create2 address:
// https://docs.soliditylang.org/en/v0.8.17/control-structures.html?highlight=create2#salted-contract-creations-create2
bytes32 hash = keccak256(
abi.encodePacked(bytes1(0xff), _deployer, _salt, keccak256(type(Pocket).creationCode))
);
return address(uint160(uint256(hash)));
}
function _deductFee(
uint256 _amount,
uint256 _fee,
address _token
) private returns (uint256 amount) {
uint256 fee;
// handle the case where amount received is not enough to pay fee
if (_amount > _fee) {
amount = _amount - _fee;
fee = _fee;
} else {
fee = _amount;
}
if (_token == nativeWrap) {
// TODO if the _executor param passed in from executeMessage is our executor, send fee
// to fee vault. otherwise, send fee to the _executor address
(bool ok, ) = feeVault.call{value: fee}("");
require(ok, "send native failed");
} else {
IERC20(_token).safeTransfer(feeVault, fee);
}
}
function _bridgeSend(
Types.BridgeInfo memory _bridge,
address _receiver,
address _token,
uint256 _amount
) private {
IBridgeAdapter bridge = bridges[keccak256(bytes(_bridge.bridgeProvider))];
IERC20(_token).safeIncreaseAllowance(address(bridge), _amount);
bridge.bridge{value: _bridge.nativeFee}(_bridge.toChainId, _receiver, _amount, _token, _bridge.bridgeParams);
}
function _executeSwap(
ICodec.SwapDescription memory _swap,
uint256 _amountIn,
address _tokenIn
)
private
returns (
bool ok,
uint256 amountOut,
address tokenOut
)
{
if (_swap.dex == address(0)) {
// nop swap
return (true, _amountIn, _tokenIn);
}
bytes4 selector = bytes4(_swap.data);
ICodec codec = getCodec(_swap.dex, selector);
address tokenIn;
(, tokenIn, tokenOut) = codec.decodeCalldata(_swap);
require(tokenIn == _tokenIn, "swap info mismatch");
bytes memory data = codec.encodeCalldataWithOverride(_swap.data, _amountIn, address(this));
IERC20(tokenIn).safeIncreaseAllowance(_swap.dex, _amountIn);
uint256 balBefore = IERC20(tokenOut).balanceOf(address(this));
(bool success, ) = _swap.dex.call(data);
if (!success) {
return (false, 0, tokenOut);
}
uint256 balAfter = IERC20(tokenOut).balanceOf(address(this));
return (true, balAfter - balBefore, tokenOut);
}
function _sendToken(
address _token,
uint256 _amount,
address _receiver,
bool _nativeOut
) private {
if (_nativeOut) {
require(_token == nativeWrap, "token is not nativeWrap");
IWETH(nativeWrap).withdraw(_amount);
(bool sent, ) = _receiver.call{value: _amount, gas: 50000}("");
require(sent, "send fail");
} else {
IERC20(_token).safeTransfer(_receiver, _amount);
}
}
function _removeFirst(Types.ExecutionInfo[] memory _execs)
private
pure
returns (Types.ExecutionInfo[] memory rest)
{
require(_execs.length > 0, "empty execs");
rest = new Types.ExecutionInfo[](_execs.length - 1);
for (uint256 i = 1; i < _execs.length; i++) {
rest[i - 1] = _execs[i];
}
}
function _verify(Types.ExecutionInfo[] memory _execs, Types.SourceInfo memory _src) private view {
require(_src.deadline > block.timestamp, "deadline exceeded");
bytes memory data = abi.encodePacked(
"chainhop quote",
uint64(block.chainid),
_src.amountIn,
_src.tokenIn,
_src.deadline
);
for (uint256 i = 1; i < _execs.length; i++) {
Types.ExecutionInfo memory e = _execs[i];
Types.BridgeInfo memory prevBridge = _execs[i - 1].bridge;
require(e.bridgeOutToken != address(0) && e.bridgeOutMin > 0 && e.feeInBridgeOutToken > 0, "invalid exec");
require(
e.bridgeOutFallbackToken == address(0) ||
(e.bridgeOutFallbackMin > 0 && e.feeInBridgeOutFallbackToken > 0),
"invalid fallback"
);
// bridged tokens and the chain id of the execution are encoded in the sig data so that
// no malicious user can temper the fee they have to pay on any execution steps
bytes memory execData = abi.encodePacked(
prevBridge.toChainId,
e.feeInBridgeOutToken,
e.bridgeOutToken,
e.feeInBridgeOutFallbackToken,
e.bridgeOutFallbackToken,
// native fee also needs to be agreed upon by chainhop for any subsequent bridge
// since the fee is provided by chainhop's executor
e.bridge.nativeFee
);
data = data.concat(execData);
}
bytes32 signHash = keccak256(data).toEthSignedMessageHash();
verifySig(signHash, _src.quoteSig);
}
}// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.7.0) (token/ERC20/utils/SafeERC20.sol)
pragma solidity ^0.8.0;
import "../IERC20.sol";
import "../extensions/draft-IERC20Permit.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'
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));
}
}
function safePermit(
IERC20Permit token,
address owner,
address spender,
uint256 value,
uint256 deadline,
uint8 v,
bytes32 r,
bytes32 s
) internal {
uint256 nonceBefore = token.nonces(owner);
token.permit(owner, spender, value, deadline, v, r, s);
uint256 nonceAfter = token.nonces(owner);
require(nonceAfter == nonceBefore + 1, "SafeERC20: permit did not succeed");
}
/**
* @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
require(abi.decode(returndata, (bool)), "SafeERC20: ERC20 operation did not succeed");
}
}
}// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.6.0) (token/ERC20/IERC20.sol)
pragma solidity ^0.8.0;
/**
* @dev Interface of the ERC20 standard as defined in the EIP.
*/
interface IERC20 {
/**
* @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);
/**
* @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 `to`.
*
* Returns a boolean value indicating whether the operation succeeded.
*
* Emits a {Transfer} event.
*/
function transfer(address to, 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 `from` to `to` 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 from,
address to,
uint256 amount
) external returns (bool);
}// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.7.3) (utils/cryptography/ECDSA.sol)
pragma solidity ^0.8.0;
import "../Strings.sol";
/**
* @dev Elliptic Curve Digital Signature Algorithm (ECDSA) operations.
*
* These functions can be used to verify that a message was signed by the holder
* of the private keys of a given address.
*/
library ECDSA {
enum RecoverError {
NoError,
InvalidSignature,
InvalidSignatureLength,
InvalidSignatureS,
InvalidSignatureV
}
function _throwError(RecoverError error) private pure {
if (error == RecoverError.NoError) {
return; // no error: do nothing
} else if (error == RecoverError.InvalidSignature) {
revert("ECDSA: invalid signature");
} else if (error == RecoverError.InvalidSignatureLength) {
revert("ECDSA: invalid signature length");
} else if (error == RecoverError.InvalidSignatureS) {
revert("ECDSA: invalid signature 's' value");
} else if (error == RecoverError.InvalidSignatureV) {
revert("ECDSA: invalid signature 'v' value");
}
}
/**
* @dev Returns the address that signed a hashed message (`hash`) with
* `signature` or error string. This address can then be used for verification purposes.
*
* The `ecrecover` EVM opcode allows for malleable (non-unique) signatures:
* this function rejects them by requiring the `s` value to be in the lower
* half order, and the `v` value to be either 27 or 28.
*
* IMPORTANT: `hash` _must_ be the result of a hash operation for the
* verification to be secure: it is possible to craft signatures that
* recover to arbitrary addresses for non-hashed data. A safe way to ensure
* this is by receiving a hash of the original message (which may otherwise
* be too long), and then calling {toEthSignedMessageHash} on it.
*
* Documentation for signature generation:
* - with https://web3js.readthedocs.io/en/v1.3.4/web3-eth-accounts.html#sign[Web3.js]
* - with https://docs.ethers.io/v5/api/signer/#Signer-signMessage[ethers]
*
* _Available since v4.3._
*/
function tryRecover(bytes32 hash, bytes memory signature) internal pure returns (address, RecoverError) {
if (signature.length == 65) {
bytes32 r;
bytes32 s;
uint8 v;
// ecrecover takes the signature parameters, and the only way to get them
// currently is to use assembly.
/// @solidity memory-safe-assembly
assembly {
r := mload(add(signature, 0x20))
s := mload(add(signature, 0x40))
v := byte(0, mload(add(signature, 0x60)))
}
return tryRecover(hash, v, r, s);
} else {
return (address(0), RecoverError.InvalidSignatureLength);
}
}
/**
* @dev Returns the address that signed a hashed message (`hash`) with
* `signature`. This address can then be used for verification purposes.
*
* The `ecrecover` EVM opcode allows for malleable (non-unique) signatures:
* this function rejects them by requiring the `s` value to be in the lower
* half order, and the `v` value to be either 27 or 28.
*
* IMPORTANT: `hash` _must_ be the result of a hash operation for the
* verification to be secure: it is possible to craft signatures that
* recover to arbitrary addresses for non-hashed data. A safe way to ensure
* this is by receiving a hash of the original message (which may otherwise
* be too long), and then calling {toEthSignedMessageHash} on it.
*/
function recover(bytes32 hash, bytes memory signature) internal pure returns (address) {
(address recovered, RecoverError error) = tryRecover(hash, signature);
_throwError(error);
return recovered;
}
/**
* @dev Overload of {ECDSA-tryRecover} that receives the `r` and `vs` short-signature fields separately.
*
* See https://eips.ethereum.org/EIPS/eip-2098[EIP-2098 short signatures]
*
* _Available since v4.3._
*/
function tryRecover(
bytes32 hash,
bytes32 r,
bytes32 vs
) internal pure returns (address, RecoverError) {
bytes32 s = vs & bytes32(0x7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff);
uint8 v = uint8((uint256(vs) >> 255) + 27);
return tryRecover(hash, v, r, s);
}
/**
* @dev Overload of {ECDSA-recover} that receives the `r and `vs` short-signature fields separately.
*
* _Available since v4.2._
*/
function recover(
bytes32 hash,
bytes32 r,
bytes32 vs
) internal pure returns (address) {
(address recovered, RecoverError error) = tryRecover(hash, r, vs);
_throwError(error);
return recovered;
}
/**
* @dev Overload of {ECDSA-tryRecover} that receives the `v`,
* `r` and `s` signature fields separately.
*
* _Available since v4.3._
*/
function tryRecover(
bytes32 hash,
uint8 v,
bytes32 r,
bytes32 s
) internal pure returns (address, RecoverError) {
// EIP-2 still allows signature malleability for ecrecover(). Remove this possibility and make the signature
// unique. Appendix F in the Ethereum Yellow paper (https://ethereum.github.io/yellowpaper/paper.pdf), defines
// the valid range for s in (301): 0 < s < secp256k1n ÷ 2 + 1, and for v in (302): v ∈ {27, 28}. Most
// signatures from current libraries generate a unique signature with an s-value in the lower half order.
//
// If your library generates malleable signatures, such as s-values in the upper range, calculate a new s-value
// with 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFEBAAEDCE6AF48A03BBFD25E8CD0364141 - s1 and flip v from 27 to 28 or
// vice versa. If your library also generates signatures with 0/1 for v instead 27/28, add 27 to v to accept
// these malleable signatures as well.
if (uint256(s) > 0x7FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF5D576E7357A4501DDFE92F46681B20A0) {
return (address(0), RecoverError.InvalidSignatureS);
}
if (v != 27 && v != 28) {
return (address(0), RecoverError.InvalidSignatureV);
}
// If the signature is valid (and not malleable), return the signer address
address signer = ecrecover(hash, v, r, s);
if (signer == address(0)) {
return (address(0), RecoverError.InvalidSignature);
}
return (signer, RecoverError.NoError);
}
/**
* @dev Overload of {ECDSA-recover} that receives the `v`,
* `r` and `s` signature fields separately.
*/
function recover(
bytes32 hash,
uint8 v,
bytes32 r,
bytes32 s
) internal pure returns (address) {
(address recovered, RecoverError error) = tryRecover(hash, v, r, s);
_throwError(error);
return recovered;
}
/**
* @dev Returns an Ethereum Signed Message, created from a `hash`. This
* produces hash corresponding to the one signed with the
* https://eth.wiki/json-rpc/API#eth_sign[`eth_sign`]
* JSON-RPC method as part of EIP-191.
*
* See {recover}.
*/
function toEthSignedMessageHash(bytes32 hash) internal pure returns (bytes32) {
// 32 is the length in bytes of hash,
// enforced by the type signature above
return keccak256(abi.encodePacked("\x19Ethereum Signed Message:\n32", hash));
}
/**
* @dev Returns an Ethereum Signed Message, created from `s`. This
* produces hash corresponding to the one signed with the
* https://eth.wiki/json-rpc/API#eth_sign[`eth_sign`]
* JSON-RPC method as part of EIP-191.
*
* See {recover}.
*/
function toEthSignedMessageHash(bytes memory s) internal pure returns (bytes32) {
return keccak256(abi.encodePacked("\x19Ethereum Signed Message:\n", Strings.toString(s.length), s));
}
/**
* @dev Returns an Ethereum Signed Typed Data, created from a
* `domainSeparator` and a `structHash`. This produces hash corresponding
* to the one signed with the
* https://eips.ethereum.org/EIPS/eip-712[`eth_signTypedData`]
* JSON-RPC method as part of EIP-712.
*
* See {recover}.
*/
function toTypedDataHash(bytes32 domainSeparator, bytes32 structHash) internal pure returns (bytes32) {
return keccak256(abi.encodePacked("\x19\x01", domainSeparator, structHash));
}
}// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (security/ReentrancyGuard.sol)
pragma solidity ^0.8.0;
/**
* @dev Contract module that helps prevent reentrant calls to a function.
*
* Inheriting from `ReentrancyGuard` will make the {nonReentrant} modifier
* available, which can be applied to functions to make sure there are no nested
* (reentrant) calls to them.
*
* Note that because there is a single `nonReentrant` guard, functions marked as
* `nonReentrant` may not call one another. This can be worked around by making
* those functions `private`, and then adding `external` `nonReentrant` entry
* points to them.
*
* TIP: If you would like to learn more about reentrancy and alternative ways
* to protect against it, check out our blog post
* https://blog.openzeppelin.com/reentrancy-after-istanbul/[Reentrancy After Istanbul].
*/
abstract contract ReentrancyGuard {
// Booleans are more expensive than uint256 or any type that takes up a full
// word because each write operation emits an extra SLOAD to first read the
// slot's contents, replace the bits taken up by the boolean, and then write
// back. This is the compiler's defense against contract upgrades and
// pointer aliasing, and it cannot be disabled.
// The values being non-zero value makes deployment a bit more expensive,
// but in exchange the refund on every call to nonReentrant will be lower in
// amount. Since refunds are capped to a percentage of the total
// transaction's gas, it is best to keep them low in cases like this one, to
// increase the likelihood of the full refund coming into effect.
uint256 private constant _NOT_ENTERED = 1;
uint256 private constant _ENTERED = 2;
uint256 private _status;
constructor() {
_status = _NOT_ENTERED;
}
/**
* @dev Prevents a contract from calling itself, directly or indirectly.
* Calling a `nonReentrant` function from another `nonReentrant`
* function is not supported. It is possible to prevent this from happening
* by making the `nonReentrant` function external, and making it call a
* `private` function that does the actual work.
*/
modifier nonReentrant() {
// On the first call to nonReentrant, _notEntered will be true
require(_status != _ENTERED, "ReentrancyGuard: reentrant call");
// Any calls to nonReentrant after this point will fail
_status = _ENTERED;
_;
// By storing the original value once again, a refund is triggered (see
// https://eips.ethereum.org/EIPS/eip-2200)
_status = _NOT_ENTERED;
}
}// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.7.0) (proxy/utils/Initializable.sol)
pragma solidity ^0.8.2;
import "../../utils/Address.sol";
/**
* @dev This is a base contract to aid in writing upgradeable contracts, or any kind of contract that will be deployed
* behind a proxy. Since proxied contracts do not make use of a constructor, it's common to move constructor logic to an
* external initializer function, usually called `initialize`. It then becomes necessary to protect this initializer
* function so it can only be called once. The {initializer} modifier provided by this contract will have this effect.
*
* The initialization functions use a version number. Once a version number is used, it is consumed and cannot be
* reused. This mechanism prevents re-execution of each "step" but allows the creation of new initialization steps in
* case an upgrade adds a module that needs to be initialized.
*
* For example:
*
* [.hljs-theme-light.nopadding]
* ```
* contract MyToken is ERC20Upgradeable {
* function initialize() initializer public {
* __ERC20_init("MyToken", "MTK");
* }
* }
* contract MyTokenV2 is MyToken, ERC20PermitUpgradeable {
* function initializeV2() reinitializer(2) public {
* __ERC20Permit_init("MyToken");
* }
* }
* ```
*
* TIP: To avoid leaving the proxy in an uninitialized state, the initializer function should be called as early as
* possible by providing the encoded function call as the `_data` argument to {ERC1967Proxy-constructor}.
*
* CAUTION: When used with inheritance, manual care must be taken to not invoke a parent initializer twice, or to ensure
* that all initializers are idempotent. This is not verified automatically as constructors are by Solidity.
*
* [CAUTION]
* ====
* Avoid leaving a contract uninitialized.
*
* An uninitialized contract can be taken over by an attacker. This applies to both a proxy and its implementation
* contract, which may impact the proxy. To prevent the implementation contract from being used, you should invoke
* the {_disableInitializers} function in the constructor to automatically lock it when it is deployed:
*
* [.hljs-theme-light.nopadding]
* ```
* /// @custom:oz-upgrades-unsafe-allow constructor
* constructor() {
* _disableInitializers();
* }
* ```
* ====
*/
abstract contract Initializable {
/**
* @dev Indicates that the contract has been initialized.
* @custom:oz-retyped-from bool
*/
uint8 private _initialized;
/**
* @dev Indicates that the contract is in the process of being initialized.
*/
bool private _initializing;
/**
* @dev Triggered when the contract has been initialized or reinitialized.
*/
event Initialized(uint8 version);
/**
* @dev A modifier that defines a protected initializer function that can be invoked at most once. In its scope,
* `onlyInitializing` functions can be used to initialize parent contracts. Equivalent to `reinitializer(1)`.
*/
modifier initializer() {
bool isTopLevelCall = !_initializing;
require(
(isTopLevelCall && _initialized < 1) || (!Address.isContract(address(this)) && _initialized == 1),
"Initializable: contract is already initialized"
);
_initialized = 1;
if (isTopLevelCall) {
_initializing = true;
}
_;
if (isTopLevelCall) {
_initializing = false;
emit Initialized(1);
}
}
/**
* @dev A modifier that defines a protected reinitializer function that can be invoked at most once, and only if the
* contract hasn't been initialized to a greater version before. In its scope, `onlyInitializing` functions can be
* used to initialize parent contracts.
*
* `initializer` is equivalent to `reinitializer(1)`, so a reinitializer may be used after the original
* initialization step. This is essential to configure modules that are added through upgrades and that require
* initialization.
*
* Note that versions can jump in increments greater than 1; this implies that if multiple reinitializers coexist in
* a contract, executing them in the right order is up to the developer or operator.
*/
modifier reinitializer(uint8 version) {
require(!_initializing && _initialized < version, "Initializable: contract is already initialized");
_initialized = version;
_initializing = true;
_;
_initializing = false;
emit Initialized(version);
}
/**
* @dev Modifier to protect an initialization function so that it can only be invoked by functions with the
* {initializer} and {reinitializer} modifiers, directly or indirectly.
*/
modifier onlyInitializing() {
require(_initializing, "Initializable: contract is not initializing");
_;
}
/**
* @dev Locks the contract, preventing any future reinitialization. This cannot be part of an initializer call.
* Calling this in the constructor of a contract will prevent that contract from being initialized or reinitialized
* to any version. It is recommended to use this to lock implementation contracts that are designed to be called
* through proxies.
*/
function _disableInitializers() internal virtual {
require(!_initializing, "Initializable: contract is initializing");
if (_initialized < type(uint8).max) {
_initialized = type(uint8).max;
emit Initialized(type(uint8).max);
}
}
}// SPDX-License-Identifier: GPL-3.0-only
pragma solidity 0.8.15;
import "./MsgDataTypes.sol";
import "../interfaces/ICodec.sol";
library Types {
struct SourceInfo {
// A number unique enough to be used in request ID generation.
uint64 nonce;
// the unix timestamp before which the fee is valid
uint64 deadline;
// sig of sha3("executor fee", srcChainId, amountIn, tokenIn, deadline, toChainId, feeInBridgeOutToken, bridgeOutToken, feeInBridgeOutFallbackToken, bridgeOutFallbackToken[, toChainId, feeInBridgeOutToken, bridgeOutToken, feeInBridgeOutFallbackToken, bridgeOutFallbackToken]...)
// see _verifyQuote()
bytes quoteSig;
uint256 amountIn;
address tokenIn;
bool nativeIn;
}
function emptySourceInfo() internal pure returns (SourceInfo memory) {
return SourceInfo(0, 0, "", 0, address(0), false);
}
struct DestinationInfo {
// The receiving party (the user) of the final output token
// note that if an organization user's private key is breached, and if their original receiver is a contract
// address, the hacker could deploy a malicious contract with the same address on the different chain and hence
// get access to the user's pocket funds on that chain.
// WARNING users should make sure their own deployer key's safety or that the receiver is
// 1. not a reproducable address on any of the chains that chainhop supports
// 2. a contract that they already deployed on all the chains that chainhop supports
// 3. an EOA
address receiver;
bool nativeOut;
}
struct ExecutionInfo {
ICodec.SwapDescription swap;
BridgeInfo bridge;
address bridgeOutToken;
// some bridges utilize a intermediary token (e.g. hToken for Hop and anyToken for Multichain)
// in cases where there isn't enough underlying token liquidity on the dst chain, the user/pocket
// could receive this token as a fallback. remote ExecutionNode needs to know what this token is
// in order to check whether a fallback has happened and refund the user.
address bridgeOutFallbackToken;
// the minimum that remote ExecutionNode needs to receive in order to allow the swap message
// to execute. note that this differs from a normal slippages controlling variable and is
// purely used to deter DoS attacks (detailed in ExecutionNode).
uint256 bridgeOutMin;
uint256 bridgeOutFallbackMin;
// executor fee
uint256 feeInBridgeOutToken;
// in case the bridging result in in fallback tokens, this is the amount of the fee that
// chainhop charges
uint256 feeInBridgeOutFallbackToken;
}
struct BridgeInfo {
uint64 toChainId;
// bridge provider identifier
string bridgeProvider;
// Bridge transfers quoted and abi encoded by chainhop backend server.
// Bridge adapter implementations need to decode this themselves.
bytes bridgeParams;
// the native fee required by the bridge provider
uint256 nativeFee;
}
struct Message {
bytes32 id;
Types.ExecutionInfo[] execs;
Types.DestinationInfo dst;
}
}// SPDX-License-Identifier: GPL-3.0-only
pragma solidity 0.8.15;
import "./Ownable.sol";
import "@openzeppelin/contracts/proxy/utils/Initializable.sol";
import "../interfaces/IMessageReceiver.sol";
abstract contract MessageReceiver is IMessageReceiver, Ownable, Initializable {
event MessageBusUpdated(address messageBus);
// testMode is used for the ease of testing functions with the "onlyMessageBus" modifier.
// WARNING: when testMode is true, ANYONE can call executeMessage functions
// this variable can only be set during contract construction and is always not set on mainnets
bool public testMode;
address public messageBus;
constructor(bool _testMode, address _messageBus) {
testMode = _testMode;
messageBus = _messageBus;
}
function initMessageReceiver(bool _testMode, address _msgbus) internal onlyInitializing {
require(!_testMode || block.chainid == 31337); // only allow testMode on hardhat local network
testMode = _testMode;
messageBus = _msgbus;
emit MessageBusUpdated(messageBus);
}
function setMessageBus(address _msgbus) public onlyOwner {
messageBus = _msgbus;
emit MessageBusUpdated(messageBus);
}
modifier onlyMessageBus() {
requireMessageBus();
_;
}
function requireMessageBus() internal view {
if (!testMode) {
require(msg.sender == messageBus, "caller is not message bus");
}
}
/**
* @notice Called by MessageBus (MessageBusReceiver)
* @param _sender The address of the source app contract
* @param _srcChainId The source chain ID where the transfer is originated from
* @param _message Arbitrary message bytes originated from and encoded by the source app contract
* @param _executor Address who called the MessageBus execution function
*/
function executeMessage(
address _sender,
uint64 _srcChainId,
bytes calldata _message,
address _executor
) external payable virtual returns (ExecutionStatus) {}
/**
* @notice Called by MessageBus (MessageBusReceiver) to process refund of the original transfer from this contract
* @param _token The token address of the original transfer
* @param _amount The amount of the original transfer
* @param _message The same message associated with the original transfer
*/
function executeMessageWithTransferRefund(
address _token,
uint256 _amount,
bytes calldata _message
) external payable virtual returns (bool) {}
}// SPDX-License-Identifier: GPL-3.0-only
pragma solidity >=0.8.15;
import "./Pausable.sol";
import "./Ownable.sol";
abstract contract Pauser is Ownable, Pausable {
mapping(address => bool) public pausers;
event PauserAdded(address account);
event PauserRemoved(address account);
constructor() {
_addPauser(msg.sender);
}
modifier onlyPauser() {
require(isPauser(msg.sender), "Caller is not pauser");
_;
}
function pause() public onlyPauser {
_pause();
}
function unpause() public onlyPauser {
_unpause();
}
function isPauser(address account) public view returns (bool) {
return pausers[account];
}
function addPauser(address account) public onlyOwner {
_addPauser(account);
}
function removePauser(address account) public onlyOwner {
_removePauser(account);
}
function renouncePauser() public {
_removePauser(msg.sender);
}
function _addPauser(address account) private {
require(!isPauser(account), "Account is already pauser");
pausers[account] = true;
emit PauserAdded(account);
}
function _removePauser(address account) private {
require(isPauser(account), "Account is not pauser");
pausers[account] = false;
emit PauserRemoved(account);
}
}// SPDX-License-Identifier: GPL-3.0-only
pragma solidity >=0.8.15;
import "./Ownable.sol";
import "@openzeppelin/contracts/proxy/utils/Initializable.sol";
abstract contract NativeWrap is Ownable, Initializable {
address public nativeWrap;
event NativeWrapUpdated(address nativeWrap);
constructor(address _nativeWrap) {
nativeWrap = _nativeWrap;
}
function initNativeWrap(address _nativeWrap) internal onlyInitializing {
_setNativeWrap(_nativeWrap);
}
function setNativeWrap(address _nativeWrap) external onlyOwner {
_setNativeWrap(_nativeWrap);
}
function _setNativeWrap(address _nativeWrap) private {
nativeWrap = _nativeWrap;
emit NativeWrapUpdated(_nativeWrap);
}
receive() external payable {}
}// SPDX-License-Identifier: GPL-3.0-only
pragma solidity >=0.8.15;
library Bytes {
uint256 internal constant WORD_SIZE = 32;
function concat(bytes memory self, bytes memory other) internal pure returns (bytes memory) {
bytes memory ret = new bytes(self.length + other.length);
(uint256 src, uint256 srcLen) = fromBytes(self);
(uint256 src2, uint256 src2Len) = fromBytes(other);
(uint256 dest, ) = fromBytes(ret);
uint256 dest2 = dest + srcLen;
copy(src, dest, srcLen);
copy(src2, dest2, src2Len);
return ret;
}
function fromBytes(bytes memory bts) internal pure returns (uint256 addr, uint256 len) {
len = bts.length;
assembly {
addr := add(bts, 32)
}
}
function copy(
uint256 src,
uint256 dest,
uint256 len
) internal pure {
// Copy word-length chunks while possible
for (; len >= WORD_SIZE; len -= WORD_SIZE) {
assembly {
mstore(dest, mload(src))
}
dest += WORD_SIZE;
src += WORD_SIZE;
}
if (len == 0) return;
// Copy remaining bytes
uint256 mask = 256**(WORD_SIZE - len) - 1;
assembly {
let srcpart := and(mload(src), not(mask))
let destpart := and(mload(dest), mask)
mstore(dest, or(destpart, srcpart))
}
}
}// SPDX-License-Identifier: GPL-3.0-only
pragma solidity >=0.8.15;
interface IBridgeAdapter {
function bridge(
uint64 _dstChainId,
// the address that the fund is transfered to on the destination chain
address _receiver,
uint256 _amount,
address _token,
// Bridge transfers quoted and abi encoded by chainhop backend server.
// Bridge adapter implementations need to decode this themselves.
bytes memory _bridgeParams
) external payable returns (bytes memory bridgeResp);
}// SPDX-License-Identifier: GPL-3.0-only
pragma solidity >=0.8.0;
interface ICodec {
struct SwapDescription {
address dex; // the DEX to use for the swap, zero address implies no swap needed
bytes data; // the data to call the dex with
}
function decodeCalldata(SwapDescription calldata swap)
external
view
returns (
uint256 amountIn,
address tokenIn,
address tokenOut
);
function encodeCalldataWithOverride(
bytes calldata data,
uint256 amountInOverride,
address receiverOverride
) external pure returns (bytes memory swapCalldata);
}// SPDX-License-Identifier: GPL-3.0-only
pragma solidity 0.8.15;
import "../lib/Types.sol";
interface IExecutionNodeEvents {
/**
* @notice Emitted when operations on dst chain is done.
* @param id see _computeId()
* @param amountOut the amount of tokenOut from this step
* @param tokenOut the token that is outputted from this step
*/
event StepExecuted(bytes32 id, uint256 amountOut, address tokenOut);
event PocketFundClaimed(address receiver, uint256 erc20Amount, address token, uint256 nativeAmount);
}// SPDX-License-Identifier: GPL-3.0-only
pragma solidity >=0.8.15;
import "@openzeppelin/contracts/token/ERC20/IERC20.sol";
interface IWETH is IERC20 {
function deposit() external payable;
function withdraw(uint256) external;
}// SPDX-License-Identifier: GPL-3.0-only
pragma solidity >=0.8.0;
import "../lib/MsgDataTypes.sol";
interface IMessageBus {
event Executed(
MsgDataTypes.MsgType msgType,
bytes32 msgId,
MsgDataTypes.TxStatus status,
address indexed receiver,
uint64 srcChainId,
bytes32 srcTxHash
);
function liquidityBridge() external view returns (address);
function pegBridge() external view returns (address);
function pegBridgeV2() external view returns (address);
function pegVault() external view returns (address);
function pegVaultV2() external view returns (address);
function feeBase() external view returns (uint256);
function feePerByte() external view returns (uint256);
/**
* @notice Calculates the required fee for the message.
* @param _message Arbitrary message bytes to be decoded by the destination app contract.
@ @return The required fee.
*/
function calcFee(bytes calldata _message) external view returns (uint256);
/**
* @notice Sends a message to an app on another chain via MessageBus without an associated transfer.
* A fee is charged in the native gas token.
* @param _receiver The address of the destination app contract.
* @param _dstChainId The destination chain ID.
* @param _message Arbitrary message bytes to be decoded by the destination app contract.
*/
function sendMessage(
address _receiver,
uint256 _dstChainId,
bytes calldata _message
) external payable;
/**
* @notice Sends a message associated with a transfer to an app on another chain via MessageBus without an associated transfer.
* A fee is charged in the native token.
* @param _receiver The address of the destination app contract.
* @param _dstChainId The destination chain ID.
* @param _srcBridge The bridge contract to send the transfer with.
* @param _srcTransferId The transfer ID.
* @param _dstChainId The destination chain ID.
* @param _message Arbitrary message bytes to be decoded by the destination app contract.
*/
function sendMessageWithTransfer(
address _receiver,
uint256 _dstChainId,
address _srcBridge,
bytes32 _srcTransferId,
bytes calldata _message
) external payable;
/**
* @notice Withdraws message fee in the form of native gas token.
* @param _account The address receiving the fee.
* @param _cumulativeFee The cumulative fee credited to the account. Tracked by SGN.
* @param _sigs The list of signatures sorted by signing addresses in ascending order. A withdrawal must be
* signed-off by +2/3 of the sigsVerifier's current signing power to be delivered.
* @param _signers The sorted list of signers.
* @param _powers The signing powers of the signers.
*/
function withdrawFee(
address _account,
uint256 _cumulativeFee,
bytes[] calldata _sigs,
address[] calldata _signers,
uint256[] calldata _powers
) external;
/**
* @notice Execute a message with a successful transfer.
* @param _message Arbitrary message bytes originated from and encoded by the source app contract
* @param _transfer The transfer info.
* @param _sigs The list of signatures sorted by signing addresses in ascending order. A relay must be signed-off by
* +2/3 of the sigsVerifier's current signing power to be delivered.
* @param _signers The sorted list of signers.
* @param _powers The signing powers of the signers.
*/
function executeMessageWithTransfer(
bytes calldata _message,
MsgDataTypes.TransferInfo calldata _transfer,
bytes[] calldata _sigs,
address[] calldata _signers,
uint256[] calldata _powers
) external payable;
/**
* @notice Execute a message with a refunded transfer.
* @param _message Arbitrary message bytes originated from and encoded by the source app contract
* @param _transfer The transfer info.
* @param _sigs The list of signatures sorted by signing addresses in ascending order. A relay must be signed-off by
* +2/3 of the sigsVerifier's current signing power to be delivered.
* @param _signers The sorted list of signers.
* @param _powers The signing powers of the signers.
*/
function executeMessageWithTransferRefund(
bytes calldata _message, // the same message associated with the original transfer
MsgDataTypes.TransferInfo calldata _transfer,
bytes[] calldata _sigs,
address[] calldata _signers,
uint256[] calldata _powers
) external payable;
/**
* @notice Execute a message not associated with a transfer.
* @param _message Arbitrary message bytes originated from and encoded by the source app contract
* @param _sigs The list of signatures sorted by signing addresses in ascending order. A relay must be signed-off by
* +2/3 of the sigsVerifier's current signing power to be delivered.
* @param _signers The sorted list of signers.
* @param _powers The signing powers of the signers.
*/
function executeMessage(
bytes calldata _message,
MsgDataTypes.RouteInfo calldata _route,
bytes[] calldata _sigs,
address[] calldata _signers,
uint256[] calldata _powers
) external payable;
}// SPDX-License-Identifier: GPL-3.0-only
pragma solidity >=0.8.15;
import "@openzeppelin/contracts/proxy/utils/Initializable.sol";
import "../interfaces/IBridgeAdapter.sol";
import "../lib/Ownable.sol";
/**
* @title Manages a list of supported bridges
* @author lionelhoho
* @author Padoriku
*/
abstract contract BridgeRegistry is Ownable, Initializable {
event SupportedBridgesUpdated(string[] providers, address[] adapters);
mapping(bytes32 => IBridgeAdapter) public bridges;
function initBridgeRegistry(string[] memory _providers, address[] memory _adapters) internal onlyInitializing {
_setSupportedbridges(_providers, _adapters);
}
// to disable a bridge, set the bridge addr of the corresponding provider to address(0)
function setSupportedBridges(string[] memory _providers, address[] memory _adapters) external onlyOwner {
_setSupportedbridges(_providers, _adapters);
}
function _setSupportedbridges(string[] memory _providers, address[] memory _adapters) private {
require(_providers.length == _adapters.length, "params size mismatch");
for (uint256 i = 0; i < _providers.length; i++) {
bridges[keccak256(bytes(_providers[i]))] = IBridgeAdapter(_adapters[i]);
}
emit SupportedBridgesUpdated(_providers, _adapters);
}
}// SPDX-License-Identifier: GPL-3.0-only
pragma solidity >=0.8.15;
import "@openzeppelin/contracts/proxy/utils/Initializable.sol";
import "../interfaces/ICodec.sol";
import "../lib/Ownable.sol";
/**
* @title Manages a list supported dex
* @author Padoriku
*/
abstract contract DexRegistry is Ownable, Initializable {
event DexCodecUpdated(address dex, bytes4 selector, address codec);
// supported swap functions
// 0x3df02124 exchange(int128,int128,uint256,uint256)
// 0xa6417ed6 exchange_underlying(int128,int128,uint256,uint256)
// 0x44ee1986 exchange_underlying(int128,int128,uint256,uint256,address)
// 0x38ed1739 swapExactTokensForTokens(uint256,uint256,address[],address,uint256)
// 0xc04b8d59 exactInput((bytes,address,uint256,uint256,uint256))
// 0xb0431182 clipperSwap(address,address,uint256,uint256)
// 0xe449022e uniswapV3Swap(uint256,uint256,uint256[])
// 0x2e95b6c8 unoswap(address,uint256,uint256,bytes32[])
// 0x7c025200 swap(address,(address,address,address,address,uint256,uint256,uint256,bytes),bytes)
// 0xd0a3b665 fillOrderRFQ((uint256,address,address,address,address,uint256,uint256),bytes,uint256,uint256)
mapping(address => mapping(bytes4 => address)) public dexFunc2Codec;
function initDexRegistry(
address[] memory _dexList,
string[] memory _funcs,
address[] memory _codecs
) internal onlyInitializing {
_setDexCodecs(_dexList, _funcs, _codecs);
}
function setDexCodecs(
address[] memory _dexList,
string[] memory _funcs,
address[] memory _codecs
) external onlyOwner {
_setDexCodecs(_dexList, _funcs, _codecs);
}
function _setDexCodecs(
address[] memory _dexList,
string[] memory _funcs,
address[] memory _codecs
) private {
require(_dexList.length == _funcs.length && _dexList.length == _codecs.length, "codec lengths mismatch");
for (uint256 i = 0; i < _dexList.length; i++) {
bytes4 selector = bytes4(keccak256(bytes(_funcs[i])));
_setDexCodec(_dexList[i], selector, _codecs[i]);
}
}
function _setDexCodec(
address _dex,
bytes4 _selector,
address _codec
) private {
address codec = dexFunc2Codec[_dex][_selector];
require(codec != _codec, "nop");
dexFunc2Codec[_dex][_selector] = _codec;
emit DexCodecUpdated(_dex, _selector, _codec);
}
function getCodec(address _dex, bytes4 _selector) internal view returns (ICodec) {
require(dexFunc2Codec[_dex][_selector] != address(0), "unsupported dex");
return ICodec(dexFunc2Codec[_dex][_selector]);
}
}// SPDX-License-Identifier: GPL-3.0-only
pragma solidity >=0.8.15;
import "@openzeppelin/contracts/proxy/utils/Initializable.sol";
import "../lib/Ownable.sol";
/**
* @title Allows the owner to whitelist remote ExecutionNode addresses
* @author Padoriku
*/
abstract contract RemoteExecutionNodeRegistry is Ownable, Initializable {
// chainId => address mapping
mapping(uint64 => address) public remotes;
event RemotesUpdated(uint64[] chainIds, address[] remotes);
function setRemotes(uint64[] memory _chainIds, address[] memory _remotes) external onlyOwner {
_setRemotes(_chainIds, _remotes);
}
function _setRemotes(uint64[] memory _chainIds, address[] memory _remotes) private {
require(_chainIds.length == _remotes.length, "remotes length mismatch");
for (uint256 i = 0; i < _chainIds.length; i++) {
remotes[_chainIds[i]] = _remotes[i];
}
emit RemotesUpdated(_chainIds, _remotes);
}
modifier onlyRemoteExecutionNode(uint64 _chainId, address _remote) {
requireRemoteExecutionNode(_chainId, _remote);
_;
}
function requireRemoteExecutionNode(uint64 _chainId, address _remote) internal view {
require(remotes[_chainId] == _remote, "unknown remote");
}
}// SPDX-License-Identifier: GPL-3.0-only
pragma solidity >=0.8.15;
import "@openzeppelin/contracts/proxy/utils/Initializable.sol";
import "../lib/Ownable.sol";
/**
* @title Allows the owner to set fee account
* @author Padoriku
*/
abstract contract FeeVaultRegistry is Ownable, Initializable {
address public feeVault;
event FeeVaultUpdated(address from, address to);
function initFeeVaultRegistry(address _vault) internal onlyInitializing {
_setFeeVault(_vault);
}
function setFeeVault(address _vault) external onlyOwner {
_setFeeVault(_vault);
}
function _setFeeVault(address _vault) private {
address oldFeeCollector = feeVault;
feeVault = _vault;
emit FeeVaultUpdated(oldFeeCollector, _vault);
}
}// SPDX-License-Identifier: GPL-3.0-only
pragma solidity >=0.8.15;
import "@openzeppelin/contracts/utils/cryptography/ECDSA.sol";
import "@openzeppelin/contracts/proxy/utils/Initializable.sol";
import "./lib/Ownable.sol";
/**
* @title Allows owner to set signer, and verifies signatures
* @author Padoriku
*/
contract SigVerifier is Ownable, Initializable {
using ECDSA for bytes32;
address public signer;
event SignerUpdated(address from, address to);
function initSigVerifier(address _signer) internal onlyInitializing {
_setSigner(_signer);
}
function setSigner(address _signer) public onlyOwner {
_setSigner(_signer);
}
function _setSigner(address _signer) private {
address oldSigner = signer;
signer = _signer;
emit SignerUpdated(oldSigner, _signer);
}
function verifySig(bytes32 _hash, bytes memory _feeSig) internal view {
address _signer = _hash.recover(_feeSig);
require(_signer == signer, "invalid signer");
}
}// SPDX-License-Identifier: GPL-3.0-only
pragma solidity 0.8.15;
// the pocket is a contract that is to be created conterfactually on the dst chain in the scenario where
// there is a dst swap. the main problem the pocket tries to solve is to gain the ability to know when and
// by how much the bridged tokens are received.
// when chainhop backend builds a cross-chain swap, it calculates a swap id (see _computeSwapId in
// ExecutionNode) and the id is used as the salt in generating a pocket address on the dst chain.
// this address is then assigned as the receiver of the bridge out tokens on the dst chain to temporarily
// hold the funds until the actual pocket contract is deployed at the exact address during the message execution.
contract Pocket {
function claim(address _token, uint256 _amt) external {
address sender = msg.sender;
_token.call(abi.encodeWithSelector(0xa9059cbb, sender, _amt));
assembly {
// selfdestruct sends all native balance to sender
selfdestruct(sender)
}
}
}// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (token/ERC20/extensions/draft-IERC20Permit.sol)
pragma solidity ^0.8.0;
/**
* @dev Interface of the ERC20 Permit extension allowing approvals to be made via signatures, as defined in
* https://eips.ethereum.org/EIPS/eip-2612[EIP-2612].
*
* Adds the {permit} method, which can be used to change an account's ERC20 allowance (see {IERC20-allowance}) by
* presenting a message signed by the account. By not relying on {IERC20-approve}, the token holder account doesn't
* need to send a transaction, and thus is not required to hold Ether at all.
*/
interface IERC20Permit {
/**
* @dev Sets `value` as the allowance of `spender` over ``owner``'s tokens,
* given ``owner``'s signed approval.
*
* IMPORTANT: The same issues {IERC20-approve} has related to transaction
* ordering also apply here.
*
* Emits an {Approval} event.
*
* Requirements:
*
* - `spender` cannot be the zero address.
* - `deadline` must be a timestamp in the future.
* - `v`, `r` and `s` must be a valid `secp256k1` signature from `owner`
* over the EIP712-formatted function arguments.
* - the signature must use ``owner``'s current nonce (see {nonces}).
*
* For more information on the signature format, see the
* https://eips.ethereum.org/EIPS/eip-2612#specification[relevant EIP
* section].
*/
function permit(
address owner,
address spender,
uint256 value,
uint256 deadline,
uint8 v,
bytes32 r,
bytes32 s
) external;
/**
* @dev Returns the current nonce for `owner`. This value must be
* included whenever a signature is generated for {permit}.
*
* Every successful call to {permit} increases ``owner``'s nonce by one. This
* prevents a signature from being used multiple times.
*/
function nonces(address owner) external view returns (uint256);
/**
* @dev Returns the domain separator used in the encoding of the signature for {permit}, as defined by {EIP712}.
*/
// solhint-disable-next-line func-name-mixedcase
function DOMAIN_SEPARATOR() external view returns (bytes32);
}// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.7.0) (utils/Address.sol)
pragma solidity ^0.8.1;
/**
* @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
* ====
*
* [IMPORTANT]
* ====
* You shouldn't rely on `isContract` to protect against flash loan attacks!
*
* Preventing calls from contracts is highly discouraged. It breaks composability, breaks support for smart wallets
* like Gnosis Safe, and does not provide security since it can be circumvented by calling from a contract
* constructor.
* ====
*/
function isContract(address account) internal view returns (bool) {
// This method relies on extcodesize/address.code.length, which returns 0
// for contracts in construction, since the code is only stored at the end
// of the constructor execution.
return account.code.length > 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");
(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");
(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");
(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");
(bool success, bytes memory returndata) = target.delegatecall(data);
return verifyCallResult(success, returndata, errorMessage);
}
/**
* @dev Tool to verifies that a low level call was successful, and revert if it wasn't, either by bubbling the
* revert reason using the provided one.
*
* _Available since v4.3._
*/
function verifyCallResult(
bool success,
bytes memory returndata,
string memory errorMessage
) internal 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
/// @solidity memory-safe-assembly
assembly {
let returndata_size := mload(returndata)
revert(add(32, returndata), returndata_size)
}
} else {
revert(errorMessage);
}
}
}
}// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.7.0) (utils/Strings.sol)
pragma solidity ^0.8.0;
/**
* @dev String operations.
*/
library Strings {
bytes16 private constant _HEX_SYMBOLS = "0123456789abcdef";
uint8 private constant _ADDRESS_LENGTH = 20;
/**
* @dev Converts a `uint256` to its ASCII `string` decimal representation.
*/
function toString(uint256 value) internal pure returns (string memory) {
// Inspired by OraclizeAPI's implementation - MIT licence
// https://github.com/oraclize/ethereum-api/blob/b42146b063c7d6ee1358846c198246239e9360e8/oraclizeAPI_0.4.25.sol
if (value == 0) {
return "0";
}
uint256 temp = value;
uint256 digits;
while (temp != 0) {
digits++;
temp /= 10;
}
bytes memory buffer = new bytes(digits);
while (value != 0) {
digits -= 1;
buffer[digits] = bytes1(uint8(48 + uint256(value % 10)));
value /= 10;
}
return string(buffer);
}
/**
* @dev Converts a `uint256` to its ASCII `string` hexadecimal representation.
*/
function toHexString(uint256 value) internal pure returns (string memory) {
if (value == 0) {
return "0x00";
}
uint256 temp = value;
uint256 length = 0;
while (temp != 0) {
length++;
temp >>= 8;
}
return toHexString(value, length);
}
/**
* @dev Converts a `uint256` to its ASCII `string` hexadecimal representation with fixed length.
*/
function toHexString(uint256 value, uint256 length) internal pure returns (string memory) {
bytes memory buffer = new bytes(2 * length + 2);
buffer[0] = "0";
buffer[1] = "x";
for (uint256 i = 2 * length + 1; i > 1; --i) {
buffer[i] = _HEX_SYMBOLS[value & 0xf];
value >>= 4;
}
require(value == 0, "Strings: hex length insufficient");
return string(buffer);
}
/**
* @dev Converts an `address` with fixed length of 20 bytes to its not checksummed ASCII `string` hexadecimal representation.
*/
function toHexString(address addr) internal pure returns (string memory) {
return toHexString(uint256(uint160(addr)), _ADDRESS_LENGTH);
}
}// SPDX-License-Identifier: GPL-3.0-only
pragma solidity 0.8.15;
library MsgDataTypes {
// bridge operation type at the sender side (src chain)
enum BridgeSendType {
Null,
Liquidity,
PegDeposit,
PegBurn,
PegV2Deposit,
PegV2Burn,
PegV2BurnFrom
}
// bridge operation type at the receiver side (dst chain)
enum TransferType {
Null,
LqRelay, // relay through liquidity bridge
LqWithdraw, // withdraw from liquidity bridge
PegMint, // mint through pegged token bridge
PegWithdraw, // withdraw from original token vault
PegV2Mint, // mint through pegged token bridge v2
PegV2Withdraw // withdraw from original token vault v2
}
enum MsgType {
MessageWithTransfer,
MessageOnly
}
enum TxStatus {
Null,
Success,
Fail,
Fallback,
Pending // transient state within a transaction
}
struct TransferInfo {
TransferType t;
address sender;
address receiver;
address token;
uint256 amount;
uint64 wdseq; // only needed for LqWithdraw (refund)
uint64 srcChainId;
bytes32 refId;
bytes32 srcTxHash; // src chain msg tx hash
}
struct RouteInfo {
address sender;
address receiver;
uint64 srcChainId;
bytes32 srcTxHash; // src chain msg tx hash
}
struct MsgWithTransferExecutionParams {
bytes message;
TransferInfo transfer;
bytes[] sigs;
address[] signers;
uint256[] powers;
}
struct BridgeTransferParams {
bytes request;
bytes[] sigs;
address[] signers;
uint256[] powers;
}
}// SPDX-License-Identifier: GPL-3.0-only
pragma solidity ^0.8.0;
/**
* @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.
*
* This adds a normal func that setOwner if _owner is address(0). So we can't allow
* renounceOwnership. So we can support Proxy based upgradable contract
*/
abstract contract Ownable {
address private _owner;
event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);
/**
* @dev Initializes the contract setting the deployer as the initial owner.
*/
constructor() {
_setOwner(msg.sender);
}
/**
* @dev Only to be called by inherit contracts, in their init func called by Proxy
* we require _owner == address(0), which is only possible when it's a delegateCall
* because constructor sets _owner in contract state.
*/
function initOwner() internal {
require(_owner == address(0), "owner already set");
_setOwner(msg.sender);
}
/**
* @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() == msg.sender, "Ownable: caller is not the owner");
_;
}
/**
* @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");
_setOwner(newOwner);
}
function _setOwner(address newOwner) private {
address oldOwner = _owner;
_owner = newOwner;
emit OwnershipTransferred(oldOwner, newOwner);
}
}// SPDX-License-Identifier: GPL-3.0-only
pragma solidity >=0.8.0;
interface IMessageReceiver {
enum ExecutionStatus {
Fail, // execution failed, finalized
Success, // execution succeeded, finalized
Retry // execution rejected, can retry later
}
/**
* @notice Called by MessageBus (MessageBusReceiver)
* @param _sender The address of the source app contract
* @param _srcChainId The source chain ID where the transfer is originated from
* @param _message Arbitrary message bytes originated from and encoded by the source app contract
* @param _executor Address who called the MessageBus execution function
*/
function executeMessage(
address _sender,
uint64 _srcChainId,
bytes calldata _message,
address _executor
) external payable returns (ExecutionStatus);
/**
* @notice Called by MessageBus (MessageBusReceiver) to process refund of the original transfer from this contract
* @param _token The token address of the original transfer
* @param _amount The amount of the original transfer
* @param _message The same message associated with the original transfer
*/
function executeMessageWithTransferRefund(
address _token,
uint256 _amount,
bytes calldata _message
) external payable returns (bool);
}// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.7.0) (security/Pausable.sol)
pragma solidity ^0.8.0;
import "@openzeppelin/contracts/utils/Context.sol";
/**
* @dev modified version of OZ's Pausable to support Celer IM's message ABORT op code.
* @dev Contract module which allows children to implement an emergency stop
* mechanism that can be triggered by an authorized account.
*
* This module is used through inheritance. It will make available the
* modifiers `whenNotPaused` and `whenPaused`, which can be applied to
* the functions of your contract. Note that they will not be pausable by
* simply including this module, only once the modifiers are put in place.
*/
abstract contract Pausable is Context {
/**
* @dev Emitted when the pause is triggered by `account`.
*/
event Paused(address account);
/**
* @dev Emitted when the pause is lifted by `account`.
*/
event Unpaused(address account);
bool private _paused;
/**
* @dev Initializes the contract in unpaused state.
*/
constructor() {
_paused = false;
}
/**
* @dev Modifier to make a function callable only when the contract is not paused.
*
* Requirements:
*
* - The contract must not be paused.
*/
modifier whenNotPaused() {
_requireNotPaused();
_;
}
/**
* @dev Modifier to make a function callable only when the contract is paused.
*
* Requirements:
*
* - The contract must be paused.
*/
modifier whenPaused() {
_requirePaused();
_;
}
/**
* @dev Returns true if the contract is paused, and false otherwise.
*/
function paused() public view virtual returns (bool) {
return _paused;
}
/**
* @dev Throws if the contract is paused.
*/
function _requireNotPaused() internal view virtual {
require(!paused(), "MSG::ABORT:paused");
}
/**
* @dev Throws if the contract is not paused.
*/
function _requirePaused() internal view virtual {
require(paused(), "MSG::ABORT:not paused");
}
/**
* @dev Triggers stopped state.
*
* Requirements:
*
* - The contract must not be paused.
*/
function _pause() internal virtual whenNotPaused {
_paused = true;
emit Paused(_msgSender());
}
/**
* @dev Returns to normal state.
*
* Requirements:
*
* - The contract must be paused.
*/
function _unpause() internal virtual whenPaused {
_paused = false;
emit Unpaused(_msgSender());
}
}// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (utils/Context.sol)
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) {
return msg.data;
}
}{
"optimizer": {
"enabled": true,
"runs": 800
},
"outputSelection": {
"*": {
"*": [
"evm.bytecode",
"evm.deployedBytecode",
"devdoc",
"userdoc",
"metadata",
"abi"
]
}
},
"metadata": {
"useLiteralContent": true
},
"libraries": {}
}Contract Security Audit
- No Contract Security Audit Submitted- Submit Audit Here
Contract ABI
API[{"inputs":[{"internalType":"bool","name":"_testMode","type":"bool"},{"internalType":"address","name":"_messageBus","type":"address"},{"internalType":"address","name":"_nativeWrap","type":"address"}],"stateMutability":"nonpayable","type":"constructor"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"dex","type":"address"},{"indexed":false,"internalType":"bytes4","name":"selector","type":"bytes4"},{"indexed":false,"internalType":"address","name":"codec","type":"address"}],"name":"DexCodecUpdated","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"from","type":"address"},{"indexed":false,"internalType":"address","name":"to","type":"address"}],"name":"FeeVaultUpdated","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint8","name":"version","type":"uint8"}],"name":"Initialized","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"messageBus","type":"address"}],"name":"MessageBusUpdated","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"nativeWrap","type":"address"}],"name":"NativeWrapUpdated","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"previousOwner","type":"address"},{"indexed":true,"internalType":"address","name":"newOwner","type":"address"}],"name":"OwnershipTransferred","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"account","type":"address"}],"name":"Paused","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"account","type":"address"}],"name":"PauserAdded","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"account","type":"address"}],"name":"PauserRemoved","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"receiver","type":"address"},{"indexed":false,"internalType":"uint256","name":"erc20Amount","type":"uint256"},{"indexed":false,"internalType":"address","name":"token","type":"address"},{"indexed":false,"internalType":"uint256","name":"nativeAmount","type":"uint256"}],"name":"PocketFundClaimed","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint64[]","name":"chainIds","type":"uint64[]"},{"indexed":false,"internalType":"address[]","name":"remotes","type":"address[]"}],"name":"RemotesUpdated","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"from","type":"address"},{"indexed":false,"internalType":"address","name":"to","type":"address"}],"name":"SignerUpdated","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"bytes32","name":"id","type":"bytes32"},{"indexed":false,"internalType":"uint256","name":"amountOut","type":"uint256"},{"indexed":false,"internalType":"address","name":"tokenOut","type":"address"}],"name":"StepExecuted","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"string[]","name":"providers","type":"string[]"},{"indexed":false,"internalType":"address[]","name":"adapters","type":"address[]"}],"name":"SupportedBridgesUpdated","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"account","type":"address"}],"name":"Unpaused","type":"event"},{"inputs":[{"internalType":"address","name":"account","type":"address"}],"name":"addPauser","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"name":"bridges","outputs":[{"internalType":"contract IBridgeAdapter","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"_srcSender","type":"address"},{"internalType":"address","name":"_dstReceiver","type":"address"},{"internalType":"uint64","name":"_nonce","type":"uint64"},{"internalType":"address","name":"_token","type":"address"}],"name":"claimPocketFund","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"},{"internalType":"bytes4","name":"","type":"bytes4"}],"name":"dexFunc2Codec","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"_sender","type":"address"},{"internalType":"uint64","name":"_srcChainId","type":"uint64"},{"internalType":"bytes","name":"_message","type":"bytes"},{"internalType":"address","name":"","type":"address"}],"name":"executeMessage","outputs":[{"internalType":"enum IMessageReceiver.ExecutionStatus","name":"","type":"uint8"}],"stateMutability":"payable","type":"function"},{"inputs":[{"internalType":"address","name":"_token","type":"address"},{"internalType":"uint256","name":"_amount","type":"uint256"},{"internalType":"bytes","name":"_message","type":"bytes"}],"name":"executeMessageWithTransferRefund","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"payable","type":"function"},{"inputs":[],"name":"feeVault","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bool","name":"_testMode","type":"bool"},{"internalType":"address","name":"_messageBus","type":"address"},{"internalType":"address","name":"_nativeWrap","type":"address"},{"internalType":"address","name":"_signer","type":"address"},{"internalType":"address","name":"_feeVault","type":"address"},{"internalType":"address[]","name":"_dexList","type":"address[]"},{"internalType":"string[]","name":"_funcs","type":"string[]"},{"internalType":"address[]","name":"_codecs","type":"address[]"},{"internalType":"string[]","name":"_bridgeProviders","type":"string[]"},{"internalType":"address[]","name":"_bridgeAdapters","type":"address[]"}],"name":"init","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"account","type":"address"}],"name":"isPauser","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"messageBus","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"nativeWrap","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"owner","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"pause","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"paused","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"}],"name":"pausers","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint64","name":"","type":"uint64"}],"name":"remotes","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"account","type":"address"}],"name":"removePauser","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"renouncePauser","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_token","type":"address"}],"name":"resecueFund","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address[]","name":"_dexList","type":"address[]"},{"internalType":"string[]","name":"_funcs","type":"string[]"},{"internalType":"address[]","name":"_codecs","type":"address[]"}],"name":"setDexCodecs","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_vault","type":"address"}],"name":"setFeeVault","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_msgbus","type":"address"}],"name":"setMessageBus","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_nativeWrap","type":"address"}],"name":"setNativeWrap","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint64[]","name":"_chainIds","type":"uint64[]"},{"internalType":"address[]","name":"_remotes","type":"address[]"}],"name":"setRemotes","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_signer","type":"address"}],"name":"setSigner","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"string[]","name":"_providers","type":"string[]"},{"internalType":"address[]","name":"_adapters","type":"address[]"}],"name":"setSupportedBridges","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"signer","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"components":[{"components":[{"internalType":"address","name":"dex","type":"address"},{"internalType":"bytes","name":"data","type":"bytes"}],"internalType":"struct ICodec.SwapDescription","name":"swap","type":"tuple"},{"components":[{"internalType":"uint64","name":"toChainId","type":"uint64"},{"internalType":"string","name":"bridgeProvider","type":"string"},{"internalType":"bytes","name":"bridgeParams","type":"bytes"},{"internalType":"uint256","name":"nativeFee","type":"uint256"}],"internalType":"struct Types.BridgeInfo","name":"bridge","type":"tuple"},{"internalType":"address","name":"bridgeOutToken","type":"address"},{"internalType":"address","name":"bridgeOutFallbackToken","type":"address"},{"internalType":"uint256","name":"bridgeOutMin","type":"uint256"},{"internalType":"uint256","name":"bridgeOutFallbackMin","type":"uint256"},{"internalType":"uint256","name":"feeInBridgeOutToken","type":"uint256"},{"internalType":"uint256","name":"feeInBridgeOutFallbackToken","type":"uint256"}],"internalType":"struct Types.ExecutionInfo[]","name":"_execs","type":"tuple[]"},{"components":[{"internalType":"uint64","name":"nonce","type":"uint64"},{"internalType":"uint64","name":"deadline","type":"uint64"},{"internalType":"bytes","name":"quoteSig","type":"bytes"},{"internalType":"uint256","name":"amountIn","type":"uint256"},{"internalType":"address","name":"tokenIn","type":"address"},{"internalType":"bool","name":"nativeIn","type":"bool"}],"internalType":"struct Types.SourceInfo","name":"_src","type":"tuple"},{"components":[{"internalType":"address","name":"receiver","type":"address"},{"internalType":"bool","name":"nativeOut","type":"bool"}],"internalType":"struct Types.DestinationInfo","name":"_dst","type":"tuple"}],"name":"srcExecute","outputs":[],"stateMutability":"payable","type":"function"},{"inputs":[],"name":"testMode","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"newOwner","type":"address"}],"name":"transferOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"unpause","outputs":[],"stateMutability":"nonpayable","type":"function"},{"stateMutability":"payable","type":"receive"}]Contract Creation Code
60806040523480156200001157600080fd5b5060405162005d5c38038062005d5c8339810160408190526200003491620002ba565b8083836200004233620000b8565b60008054921515600160b01b0260ff60b01b1990931692909217909155600180546001600160a01b039283166001600160a01b0319918216178255600680549490931693169290921790556007556008805460ff19169055620000a53362000108565b620000af620001d1565b5050506200030a565b600080546001600160a01b038381166001600160a01b0319831681178455604051919092169283917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a35050565b6001600160a01b03811660009081526009602052604090205460ff1615620001775760405162461bcd60e51b815260206004820152601960248201527f4163636f756e7420697320616c7265616479207061757365720000000000000060448201526064015b60405180910390fd5b6001600160a01b038116600081815260096020908152604091829020805460ff1916600117905590519182527f6719d08c1888103bea251a4ed56406bd0c3e69723c8a1686e017e7bbe159b6f8910160405180910390a150565b600054600160a81b900460ff16156200023d5760405162461bcd60e51b815260206004820152602760248201527f496e697469616c697a61626c653a20636f6e747261637420697320696e697469604482015266616c697a696e6760c81b60648201526084016200016e565b60005460ff600160a01b909104811610156200029b576000805460ff60a01b191660ff60a01b17905560405160ff81527f7f26b83ff96e1f2b6a682f133852f6798a09c465da95921460cefb38474024989060200160405180910390a15b565b80516001600160a01b0381168114620002b557600080fd5b919050565b600080600060608486031215620002d057600080fd5b83518015158114620002e157600080fd5b9250620002f1602085016200029d565b915062000301604085016200029d565b90509250925092565b615a42806200031a6000396000f3fe6080604052600436106101dc5760003560e01c80636ef8d66d116101025780639c649fdf11610095578063cd9ea34211610064578063cd9ea34214610597578063d3ac0fbc146105b8578063eeaaa651146105d8578063f2fde38b1461060e57600080fd5b80639c649fdf146104f65780639e02c9f914610516578063a1a227fa14610557578063a591f97f1461057757600080fd5b806382dc1ec4116100d157806382dc1ec4146104835780638456cb59146104a35780638da5cb5b146104b8578063918ead76146104d657600080fd5b80636ef8d66d146103fe5780637228e5c4146104135780637a0f93561461043357806380f51c121461045357600080fd5b8063457bfa2f1161017a5780635b5a66a7116101495780635b5a66a7146103865780635c975abb146103a65780636b2c0f55146103be5780636c19e783146103de57600080fd5b8063457bfa2f146102ed57806346fbf68e1461030d578063478222c214610346578063547cad121461036657600080fd5b8063238ac933116101b6578063238ac93314610257578063289774a91461028f578063292e31ee146102a25780633f4ba83a146102d857600080fd5b806306b4771c146101e85780631cfcc0fc1461020a57806320be95f21461022a57600080fd5b366101e357005b600080fd5b3480156101f457600080fd5b506102086102033660046143eb565b61062e565b005b34801561021657600080fd5b50610208610225366004614590565b6107d0565b610242610238366004614652565b6000949350505050565b60405190151581526020015b60405180910390f35b34801561026357600080fd5b50600454610277906001600160a01b031681565b6040516001600160a01b03909116815260200161024e565b61020861029d366004614954565b610831565b3480156102ae57600080fd5b506102776102bd366004614ae1565b600a602052600090815260409020546001600160a01b031681565b3480156102e457600080fd5b50610208610ab2565b3480156102f957600080fd5b50600654610277906001600160a01b031681565b34801561031957600080fd5b506102426103283660046143eb565b6001600160a01b031660009081526009602052604090205460ff1690565b34801561035257600080fd5b50600554610277906001600160a01b031681565b34801561037257600080fd5b506102086103813660046143eb565b610b1b565b34801561039257600080fd5b506102086103a13660046143eb565b610bc7565b3480156103b257600080fd5b5060085460ff16610242565b3480156103ca57600080fd5b506102086103d93660046143eb565b610c27565b3480156103ea57600080fd5b506102086103f93660046143eb565b610c87565b34801561040a57600080fd5b50610208610ce7565b34801561041f57600080fd5b5061020861042e366004614b7e565b610cf0565b34801561043f57600080fd5b5061020861044e366004614c06565b610d57565b34801561045f57600080fd5b5061024261046e3660046143eb565b60096020526000908152604090205460ff1681565b34801561048f57600080fd5b5061020861049e3660046143eb565b611059565b3480156104af57600080fd5b506102086110b9565b3480156104c457600080fd5b506000546001600160a01b0316610277565b3480156104e257600080fd5b506102086104f1366004614c62565b611120565b610509610504366004614caf565b611181565b60405161024e9190614d2f565b34801561052257600080fd5b50610277610531366004614d57565b60026020908152600092835260408084209091529082529020546001600160a01b031681565b34801561056357600080fd5b50600154610277906001600160a01b031681565b34801561058357600080fd5b506102086105923660046143eb565b611460565b3480156105a357600080fd5b5060005461024290600160b01b900460ff1681565b3480156105c457600080fd5b506102086105d3366004614d9d565b6114c0565b3480156105e457600080fd5b506102776105f3366004614ec4565b6003602052600090815260409020546001600160a01b031681565b34801561061a57600080fd5b506102086106293660046143eb565b61165a565b336106416000546001600160a01b031690565b6001600160a01b03161461068a5760405162461bcd60e51b815260206004820181905260248201526000805160206159ed83398151915260448201526064015b60405180910390fd5b6001600160a01b03811661073f57600080546040516001600160a01b039091169047908381818185875af1925050503d80600081146106e5576040519150601f19603f3d011682016040523d82523d6000602084013e6106ea565b606091505b505090508061073b5760405162461bcd60e51b815260206004820152601260248201527f73656e64206e6174697665206661696c656400000000000000000000000000006044820152606401610681565b5050565b6107cd6107546000546001600160a01b031690565b6040516370a0823160e01b81523060048201526001600160a01b038416906370a0823190602401602060405180830381865afa158015610798573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906107bc9190614edd565b6001600160a01b0384169190611736565b50565b336107e36000546001600160a01b031690565b6001600160a01b0316146108275760405162461bcd60e51b815260206004820181905260248201526000805160206159ed8339815191526044820152606401610681565b61073b82826117ae565b6108396118da565b60026007540361088b5760405162461bcd60e51b815260206004820152601f60248201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c006044820152606401610681565b600260075582516108c45760405162461bcd60e51b815260206004820152600360248201526206e6f760ec1b6044820152606401610681565b60008260600151116109185760405162461bcd60e51b815260206004820152600860248201527f3020616d6f756e740000000000000000000000000000000000000000000000006044820152606401610681565b80516001600160a01b031661096f5760405162461bcd60e51b815260206004820152600a60248201527f30207265636569766572000000000000000000000000000000000000000000006044820152606401610681565b6000610984338360000151856000015161192d565b905060008460008151811061099b5761099b614ef6565b602002602001015190506001855111156109b9576109b9858561198d565b6000806109c586611cfd565b9150915060008211610a195760405162461bcd60e51b815260206004820152600f60248201527f616d6f756e74206d757374203e203000000000000000000000000000000000006044820152606401610681565b825151829082906001600160a01b031615610a94578451600190610a3e908686611e6b565b9094509250905080610a925760405162461bcd60e51b815260206004820152600960248201527f73776170206661696c00000000000000000000000000000000000000000000006044820152606401610681565b505b610aa1868a89848661218d565b505060016007555050505050505050565b3360009081526009602052604090205460ff16610b115760405162461bcd60e51b815260206004820152601460248201527f43616c6c6572206973206e6f74207061757365720000000000000000000000006044820152606401610681565b610b1961247a565b565b33610b2e6000546001600160a01b031690565b6001600160a01b031614610b725760405162461bcd60e51b815260206004820181905260248201526000805160206159ed8339815191526044820152606401610681565b600180546001600160a01b0319166001600160a01b0383169081179091556040519081527f3f8223bcd8b3b875473e9f9e14e1ad075451a2b5ffd31591655da9a01516bf5e906020015b60405180910390a150565b33610bda6000546001600160a01b031690565b6001600160a01b031614610c1e5760405162461bcd60e51b815260206004820181905260248201526000805160206159ed8339815191526044820152606401610681565b6107cd816124cc565b33610c3a6000546001600160a01b031690565b6001600160a01b031614610c7e5760405162461bcd60e51b815260206004820181905260248201526000805160206159ed8339815191526044820152606401610681565b6107cd8161251a565b33610c9a6000546001600160a01b031690565b6001600160a01b031614610cde5760405162461bcd60e51b815260206004820181905260248201526000805160206159ed8339815191526044820152606401610681565b6107cd816125d3565b610b193361251a565b33610d036000546001600160a01b031690565b6001600160a01b031614610d475760405162461bcd60e51b815260206004820181905260248201526000805160206159ed8339815191526044820152606401610681565b610d5283838361262d565b505050565b610d5f6118da565b600260075403610db15760405162461bcd60e51b815260206004820152601f60248201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c006044820152606401610681565b6002600755336001600160a01b03841614610e0e5760405162461bcd60e51b815260206004820152601760248201527f6f6e6c792072656365697665722063616e20636c61696d0000000000000000006044820152606401610681565b6000610e1b85858561192d565b9050600081604051610e2c9061431d565b8190604051809103906000f5905080158015610e4c573d6000803e3d6000fd5b506040516370a0823160e01b81526001600160a01b0380831660048301529192506000918516906370a0823190602401602060405180830381865afa158015610e99573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610ebd9190614edd565b90506001600160a01b0382163181151580610ed85750600081115b610f245760405162461bcd60e51b815260206004820152600f60248201527f706f636b657420697320656d70747900000000000000000000000000000000006044820152606401610681565b610f2f83868461270c565b8115610f4957610f496001600160a01b0386168884611736565b8015610ff9576000876001600160a01b03168261c35090604051600060405180830381858888f193505050503d8060008114610fa1576040519150601f19603f3d011682016040523d82523d6000602084013e610fa6565b606091505b5050905080610ff75760405162461bcd60e51b815260206004820152601560248201527f6661696c656420746f2073656e64206e617469766500000000000000000000006044820152606401610681565b505b604080516001600160a01b038981168252602082018590528716818301526060810183905290517f93792cbd2b72fa0c2850634d3177263b6f8dbe5c2245b5ad2522ef65b5a9b8d59181900360800190a150506001600755505050505050565b3361106c6000546001600160a01b031690565b6001600160a01b0316146110b05760405162461bcd60e51b815260206004820181905260248201526000805160206159ed8339815191526044820152606401610681565b6107cd816128aa565b3360009081526009602052604090205460ff166111185760405162461bcd60e51b815260206004820152601460248201527f43616c6c6572206973206e6f74207061757365720000000000000000000000006044820152606401610681565b610b19612967565b336111336000546001600160a01b031690565b6001600160a01b0316146111775760405162461bcd60e51b815260206004820181905260248201526000805160206159ed8339815191526044820152606401610681565b61073b82826129a4565b600061118b612ab7565b83856111978282612b22565b61119f6118da565b6002600754036111f15760405162461bcd60e51b815260206004820152601f60248201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c006044820152606401610681565b6002600755845160009061120e90870160209081019088016150bc565b905060008160200151511161124b5760405162461bcd60e51b815260206004820152600360248201526206e6f760ec1b6044820152606401610681565b60003490506000826020015160008151811061126957611269614ef6565b60200260200101519050600080611284856000015184612b96565b91509150816000036112f157845160408051918252600060208301526001600160a01b038316908201527f295612f9c20f128efb8df333990658b0f1b8083bc7b6dcf90750348cede4c299906060015b60405180910390a16112e584612eea565b97505050505050611451565b82606001516001600160a01b0316816001600160a01b03160361136b5761132381838760400151600001516000612fbf565b845160408051918252602082018490526001600160a01b038316908201527f295612f9c20f128efb8df333990658b0f1b8083bc7b6dcf90750348cede4c299906060016112d4565b825151829082906001600160a01b031615611414578451600190611390908686611e6b565b9094509250905080611412576113b184868a60400151600001516000612fbf565b875160408051918252602082018790526001600160a01b03861682820152517f295612f9c20f128efb8df333990658b0f1b8083bc7b6dcf90750348cede4c2999181900360600190a161140387612eea565b9a505050505050505050611451565b505b600061142f886000015189602001518a60400151858761218d565b905061143b8188615272565b965061144687612eea565b9a5050505050505050505b50506001600755949350505050565b336114736000546001600160a01b031690565b6001600160a01b0316146114b75760405162461bcd60e51b815260206004820181905260248201526000805160206159ed8339815191526044820152606401610681565b6107cd81613142565b600054600160a81b900460ff16158080156114e857506000546001600160a01b90910460ff16105b806115095750303b1580156115095750600054600160a01b900460ff166001145b61157b5760405162461bcd60e51b815260206004820152602e60248201527f496e697469616c697a61626c653a20636f6e747261637420697320616c72656160448201527f647920696e697469616c697a65640000000000000000000000000000000000006064820152608401610681565b600080547fffffffffffffffffffffff00ffffffffffffffffffffffffffffffffffffffff16600160a01b17905580156115c3576000805460ff60a81b1916600160a81b1790555b6115cb61319c565b6115d58b8b6131fe565b6115e0868686613302565b6115ea838361336f565b6115f3876133dc565b6115fc88613449565b611605896134b6565b801561164d576000805460ff60a81b19169055604051600181527f7f26b83ff96e1f2b6a682f133852f6798a09c465da95921460cefb38474024989060200160405180910390a15b5050505050505050505050565b3361166d6000546001600160a01b031690565b6001600160a01b0316146116b15760405162461bcd60e51b815260206004820181905260248201526000805160206159ed8339815191526044820152606401610681565b6001600160a01b03811661172d5760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201527f64647265737300000000000000000000000000000000000000000000000000006064820152608401610681565b6107cd81613523565b6040516001600160a01b038316602482015260448101829052610d5290849063a9059cbb60e01b906064015b60408051601f198184030181529190526020810180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff166001600160e01b031990931692909217909152613573565b80518251146117ff5760405162461bcd60e51b815260206004820152601760248201527f72656d6f746573206c656e677468206d69736d617463680000000000000000006044820152606401610681565b60005b825181101561189c5781818151811061181d5761181d614ef6565b6020026020010151600a600085848151811061183b5761183b614ef6565b602002602001015167ffffffffffffffff1667ffffffffffffffff16815260200190815260200160002060006101000a8154816001600160a01b0302191690836001600160a01b03160217905550808061189490615289565b915050611802565b507fe000e6cd4a5421450046ea059588823e2c45d75255bc2ce0031a7c64d32f8c1682826040516118ce9291906152e6565b60405180910390a15050565b60085460ff1615610b195760405162461bcd60e51b815260206004820152601160248201527f4d53473a3a41424f52543a7061757365640000000000000000000000000000006044820152606401610681565b6040516bffffffffffffffffffffffff19606085811b8216602084015284901b1660348201526001600160c01b031960c083901b1660488201526000906050016040516020818303038152906040528051906020012090505b9392505050565b42816020015167ffffffffffffffff16116119ea5760405162461bcd60e51b815260206004820152601160248201527f646561646c696e652065786365656465640000000000000000000000000000006044820152606401610681565b600046826060015183608001518460200151604051602001611a7494939291907f636861696e686f702071756f7465000000000000000000000000000000000000815260c094851b6001600160c01b0319908116600e830152601682019490945260609290921b6bffffffffffffffffffffffff1916603683015290921b16604a82015260520190565b60408051601f19818403018152919052905060015b8351811015611c97576000848281518110611aa657611aa6614ef6565b60200260200101519050600085600184611ac09190615272565b81518110611ad057611ad0614ef6565b602002602001015160200151905060006001600160a01b031682604001516001600160a01b031614158015611b09575060008260800151115b8015611b19575060008260c00151115b611b655760405162461bcd60e51b815260206004820152600c60248201527f696e76616c6964206578656300000000000000000000000000000000000000006044820152606401610681565b60608201516001600160a01b03161580611b92575060008260a00151118015611b92575060008260e00151115b611bde5760405162461bcd60e51b815260206004820152601060248201527f696e76616c69642066616c6c6261636b000000000000000000000000000000006044820152606401610681565b600081600001518360c0015184604001518560e001518660600151876020015160600151604051602001611c639695949392919060c09690961b6001600160c01b03191686526008860194909452606092831b6bffffffffffffffffffffffff199081166028870152603c86019290925290911b16605c830152607082015260900190565b60408051601f198184030181529190529050611c7f8582613658565b94505050508080611c8f90615289565b915050611a89565b508051602080830191909120604080517f19457468657265756d205369676e6564204d6573736167653a0a33320000000081850152603c8082019390935281518082039093018352605c0190528051910120611cf7818460400151613720565b50505050565b6000808260a0015115611e325760065460808401516001600160a01b03908116911614611d6c5760405162461bcd60e51b815260206004820152601660248201527f746f6b656e496e206e6f74206e617469766557726170000000000000000000006044820152606401610681565b8260600151341015611dc05760405162461bcd60e51b815260206004820152601a60248201527f696e73756666696369656e74206e617469766520616d6f756e740000000000006044820152606401610681565b600660009054906101000a90046001600160a01b03166001600160a01b031663d0e30db084606001516040518263ffffffff1660e01b81526004016000604051808303818588803b158015611e1457600080fd5b505af1158015611e28573d6000803e3d6000fd5b5050505050611e5a565b611e5a3330856060015186608001516001600160a01b031661378c909392919063ffffffff16565b505060608101516080909101519091565b8251600090819081906001600160a01b0316611e8f57506001915083905082612184565b60008660200151611e9f90615347565b90506000611eb18860000151836137c4565b90506000816001600160a01b031663358f0e1c8a6040518263ffffffff1660e01b8152600401611ee191906153d2565b606060405180830381865afa158015611efe573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611f2291906153e5565b95509150506001600160a01b0380821690881614611f825760405162461bcd60e51b815260206004820152601260248201527f7377617020696e666f206d69736d6174636800000000000000000000000000006044820152606401610681565b6020890151604051634c6da26960e01b81526000916001600160a01b03851691634c6da26991611fb8918d903090600401615428565b600060405180830381865afa158015611fd5573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f19168201604052611ffd919081019061545a565b8a51909150612017906001600160a01b038416908b613877565b6040516370a0823160e01b81523060048201526000906001600160a01b038716906370a0823190602401602060405180830381865afa15801561205e573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906120829190614edd565b905060008b600001516001600160a01b0316836040516120a2919061548f565b6000604051808303816000865af19150503d80600081146120df576040519150601f19603f3d011682016040523d82523d6000602084013e6120e4565b606091505b50509050806120ff5760008098509850505050505050612184565b6040516370a0823160e01b81523060048201526000906001600160a01b038916906370a0823190602401602060405180830381865afa158015612146573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061216a9190614edd565b905060016121788483615272565b99509950505050505050505b93509350939050565b600080856000815181106121a3576121a3614ef6565b602002602001015190506121b686613929565b9550855160001480156121d6575060208101515167ffffffffffffffff16155b15612241576121ef848487600001518860200151612fbf565b60408051888152602081018590526001600160a01b0386168183015290517f295612f9c20f128efb8df333990658b0f1b8083bc7b6dcf90750348cede4c2999181900360600190a16000915050612471565b84518651156123ff576020808301515167ffffffffffffffff166000908152600a90915260409020546001600160a01b0316806122c05760405162461bcd60e51b815260206004820152601060248201527f72656d6f7465206e6f7420666f756e64000000000000000000000000000000006044820152606401610681565b6122ca8982613a46565b9150600060405180606001604052808b81526020018a8152602001898152506040516020016122f991906154ab565b60408051601f198184030181529082905260015463299aee5160e11b83529092506000916001600160a01b0390911690635335dca29061233d9085906004016155f9565b602060405180830381865afa15801561235a573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061237e9190614edd565b600154602087015151604051634f9e72ad60e11b81529293506001600160a01b0390911691639f3ce55a9184916123bb918891889060040161560c565b6000604051808303818588803b1580156123d457600080fd5b505af11580156123e8573d6000803e3d6000fd5b505050505080866123f9919061563e565b95505050505b61240f8260200151828787613afa565b602082015160600151612422908461563e565b604080518a8152602081018790526001600160a01b0388168183015290519194507f295612f9c20f128efb8df333990658b0f1b8083bc7b6dcf90750348cede4c299919081900360600190a150505b95945050505050565b612482613bbc565b6008805460ff191690557f5db9ee0a495bf2e6ff9c91a7834c1ba4fdd244a5e8aa4e537bd38aeae4b073aa335b6040516001600160a01b03909116815260200160405180910390a1565b600680546001600160a01b0319166001600160a01b0383169081179091556040519081527fb878cd71628ac64b2df1872301925e01164824535b02e8601077749eeeb88c3d90602001610bbc565b6001600160a01b03811660009081526009602052604090205460ff166125825760405162461bcd60e51b815260206004820152601560248201527f4163636f756e74206973206e6f742070617573657200000000000000000000006044820152606401610681565b6001600160a01b038116600081815260096020908152604091829020805460ff1916905590519182527fcd265ebaf09df2871cc7bd4133404a235ba12eff2041bb89d9c714a2621c7c7e9101610bbc565b600480546001600160a01b038381166001600160a01b031983168117909355604080519190921680825260208201939093527f2d025324f0a785e8c12d0a0d91a9caa49df4ef20ff87e0df7213a1d4f3157beb91016118ce565b8151835114801561263f575080518351145b61268b5760405162461bcd60e51b815260206004820152601660248201527f636f646563206c656e67746873206d69736d61746368000000000000000000006044820152606401610681565b60005b8351811015611cf75760008382815181106126ab576126ab614ef6565b60200260200101518051906020012090506126f98583815181106126d1576126d1614ef6565b6020026020010151828585815181106126ec576126ec614ef6565b6020026020010151613c0e565b508061270481615289565b91505061268e565b6040516370a0823160e01b81523060048201526000906001600160a01b038416906370a0823190602401602060405180830381865afa158015612753573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906127779190614edd565b604051635569f64b60e11b81526001600160a01b038581166004830152602482018590529192509085169063aad3ec9690604401600060405180830381600087803b1580156127c557600080fd5b505af11580156127d9573d6000803e3d6000fd5b50506040516370a0823160e01b8152306004820152600092506001600160a01b03861691506370a0823190602401602060405180830381865afa158015612824573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906128489190614edd565b9050826128558383615272565b10156128a35760405162461bcd60e51b815260206004820152601960248201527f696e73756666696369656e742066756e6420636c61696d6564000000000000006044820152606401610681565b5050505050565b6001600160a01b03811660009081526009602052604090205460ff16156129135760405162461bcd60e51b815260206004820152601960248201527f4163636f756e7420697320616c726561647920706175736572000000000000006044820152606401610681565b6001600160a01b038116600081815260096020908152604091829020805460ff1916600117905590519182527f6719d08c1888103bea251a4ed56406bd0c3e69723c8a1686e017e7bbe159b6f89101610bbc565b61296f6118da565b6008805460ff191660011790557f62e78cea01bee320cd4e420270b5ea74000d11b0c9f74754ebdbfc544b05a2586124af3390565b80518251146129f55760405162461bcd60e51b815260206004820152601460248201527f706172616d732073697a65206d69736d617463680000000000000000000000006044820152606401610681565b60005b8251811015612a8557818181518110612a1357612a13614ef6565b602002602001015160036000858481518110612a3157612a31614ef6565b602002602001015180519060200120815260200190815260200160002060006101000a8154816001600160a01b0302191690836001600160a01b031602179055508080612a7d90615289565b9150506129f8565b507f68d2b5e14eb61b73f2dfa46a255dcba81a3b53259093a83c90da69c3ade70b9682826040516118ce929190615656565b600054600160b01b900460ff16610b19576001546001600160a01b03163314610b195760405162461bcd60e51b815260206004820152601960248201527f63616c6c6572206973206e6f74206d65737361676520627573000000000000006044820152606401610681565b67ffffffffffffffff82166000908152600a60205260409020546001600160a01b0382811691161461073b5760405162461bcd60e51b815260206004820152600e60248201527f756e6b6e6f776e2072656d6f74650000000000000000000000000000000000006044820152606401610681565b600080600084604051612ba89061431d565b8190604051809103906000f5905080158015612bc8573d6000803e3d6000fd5b5060608501519091506000906001600160a01b031615612c555760608501516040516370a0823160e01b81526001600160a01b038481166004830152909116906370a0823190602401602060405180830381865afa158015612c2e573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190612c529190614edd565b90505b60408086015190516370a0823160e01b81526001600160a01b03848116600483015260009216906370a0823190602401602060405180830381865afa158015612ca2573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190612cc69190614edd565b60a08701519091506001600160a01b0384163190831115612d1157612cf08488606001518561270c565b612d03838860e001518960600151613d00565b955086606001519450612edf565b8660800151821115612d4d57612d2c8488604001518461270c565b612d3f828860c001518960400151613d00565b955086604001519450612edf565b8660800151811115612e9757604051635569f64b60e11b815260006004820181905260248201526001600160a01b0385169063aad3ec9690604401600060405180830381600087803b158015612da257600080fd5b505af1158015612db6573d6000803e3d6000fd5b505060065460408a01516001600160a01b039081169116149150612e1e90505760405162461bcd60e51b815260206004820152601d60248201527f6272696467654f7574546f6b656e206e6f74206e6174697665577261700000006044820152606401610681565b612e31818860c001518960400151613d00565b955086604001516001600160a01b031663d0e30db0876040518263ffffffff1660e01b81526004016000604051808303818588803b158015612e7257600080fd5b505af1158015612e86573d6000803e3d6000fd5b505050505086604001519450612edf565b60405162461bcd60e51b815260206004820152601a60248201527f4d53473a3a41424f52543a706f636b657420697320656d7074790000000000006044820152606401610681565b505050509250929050565b60008115612fb757604051600090329061c35090859084818181858888f193505050503d8060008114612f39576040519150601f19603f3d011682016040523d82523d6000602084013e612f3e565b606091505b5050905080612fb55760405162461bcd60e51b815260206004820152602760248201527f6661696c656420746f20726566756e642072656d61696e696e67206e6174697660448201527f6520746f6b656e000000000000000000000000000000000000000000000000006064820152608401610681565b505b506001919050565b801561312e576006546001600160a01b038581169116146130225760405162461bcd60e51b815260206004820152601760248201527f746f6b656e206973206e6f74206e6174697665577261700000000000000000006044820152606401610681565b600654604051632e1a7d4d60e01b8152600481018590526001600160a01b0390911690632e1a7d4d90602401600060405180830381600087803b15801561306857600080fd5b505af115801561307c573d6000803e3d6000fd5b505050506000826001600160a01b03168461c35090604051600060405180830381858888f193505050503d80600081146130d2576040519150601f19603f3d011682016040523d82523d6000602084013e6130d7565b606091505b50509050806131285760405162461bcd60e51b815260206004820152600960248201527f73656e64206661696c00000000000000000000000000000000000000000000006044820152606401610681565b50611cf7565b611cf76001600160a01b0385168385611736565b600580546001600160a01b038381166001600160a01b031983168117909355604080519190921680825260208201939093527f47ffc4777a9849fd88ac272225845f7bbcfa9920f222b459c2e6b28156ce724991016118ce565b6000546001600160a01b0316156131f55760405162461bcd60e51b815260206004820152601160248201527f6f776e657220616c7265616479207365740000000000000000000000000000006044820152606401610681565b610b1933613523565b600054600160a81b900460ff1661326b5760405162461bcd60e51b815260206004820152602b60248201527f496e697469616c697a61626c653a20636f6e7472616374206973206e6f74206960448201526a6e697469616c697a696e6760a81b6064820152608401610681565b811580613279575046617a69145b61328257600080fd5b600080547fffffffffffffffffff00ffffffffffffffffffffffffffffffffffffffffffff16600160b01b84151502179055600180546001600160a01b0319166001600160a01b0383169081179091556040519081527f3f8223bcd8b3b875473e9f9e14e1ad075451a2b5ffd31591655da9a01516bf5e906020016118ce565b600054600160a81b900460ff16610d475760405162461bcd60e51b815260206004820152602b60248201527f496e697469616c697a61626c653a20636f6e7472616374206973206e6f74206960448201526a6e697469616c697a696e6760a81b6064820152608401610681565b600054600160a81b900460ff166111775760405162461bcd60e51b815260206004820152602b60248201527f496e697469616c697a61626c653a20636f6e7472616374206973206e6f74206960448201526a6e697469616c697a696e6760a81b6064820152608401610681565b600054600160a81b900460ff166114b75760405162461bcd60e51b815260206004820152602b60248201527f496e697469616c697a61626c653a20636f6e7472616374206973206e6f74206960448201526a6e697469616c697a696e6760a81b6064820152608401610681565b600054600160a81b900460ff16610cde5760405162461bcd60e51b815260206004820152602b60248201527f496e697469616c697a61626c653a20636f6e7472616374206973206e6f74206960448201526a6e697469616c697a696e6760a81b6064820152608401610681565b600054600160a81b900460ff16610c1e5760405162461bcd60e51b815260206004820152602b60248201527f496e697469616c697a61626c653a20636f6e7472616374206973206e6f74206960448201526a6e697469616c697a696e6760a81b6064820152608401610681565b600080546001600160a01b038381166001600160a01b0319831681178455604051919092169283917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a35050565b60006135c8826040518060400160405280602081526020017f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c6564815250856001600160a01b0316613e039092919063ffffffff16565b805190915015610d5257808060200190518101906135e691906156c3565b610d525760405162461bcd60e51b815260206004820152602a60248201527f5361666545524332303a204552433230206f7065726174696f6e20646964206e60448201527f6f742073756363656564000000000000000000000000000000000000000000006064820152608401610681565b606060008251845161366a919061563e565b67ffffffffffffffff81111561368257613682614408565b6040519080825280601f01601f1916602001820160405280156136ac576020820181803683370190505b5090506000806136c0868051602090910191565b915091506000806136d5878051602090910191565b9150915060006136e9868051602090910191565b50905060006136f8858361563e565b9050613705868387613e1a565b613710848285613e1a565b5094955050505050505b92915050565b600061372c8383613e98565b6004549091506001600160a01b03808316911614610d525760405162461bcd60e51b815260206004820152600e60248201527f696e76616c6964207369676e65720000000000000000000000000000000000006044820152606401610681565b6040516001600160a01b0380851660248301528316604482015260648101829052611cf79085906323b872dd60e01b90608401611762565b6001600160a01b0382811660009081526002602090815260408083206001600160e01b0319861684529091528120549091166138425760405162461bcd60e51b815260206004820152600f60248201527f756e737570706f727465642064657800000000000000000000000000000000006044820152606401610681565b506001600160a01b0391821660009081526002602090815260408083206001600160e01b031994909416835292905220541690565b604051636eb1769f60e11b81523060048201526001600160a01b038381166024830152600091839186169063dd62ed3e90604401602060405180830381865afa1580156138c8573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906138ec9190614edd565b6138f6919061563e565b6040516001600160a01b038516602482015260448101829052909150611cf790859063095ea7b360e01b90606401611762565b6060600082511161397c5760405162461bcd60e51b815260206004820152600b60248201527f656d7074792065786563730000000000000000000000000000000000000000006044820152606401610681565b6001825161398a9190615272565b67ffffffffffffffff8111156139a2576139a2614408565b6040519080825280602002602001820160405280156139db57816020015b6139c861432a565b8152602001906001900390816139c05790505b50905060015b8251811015613a40578281815181106139fc576139fc614ef6565b602002602001015182600183613a129190615272565b81518110613a2257613a22614ef6565b60200260200101819052508080613a3890615289565b9150506139e1565b50919050565b60008060ff60f81b838560405180602001613a609061431d565b6020820181038252601f19601f8201166040525080519060200120604051602001613ada94939291907fff0000000000000000000000000000000000000000000000000000000000000094909416845260609290921b6bffffffffffffffffffffffff191660018401526015830152603582015260550190565b60408051808303601f190181529190528051602090910120949350505050565b6020808501518051908201206000908152600390915260409020546001600160a01b0390811690613b2e9084168284613877565b6060850151855160408088015190516324c9401b60e01b81526001600160a01b038516936324c9401b939092613b6d928a9189918b91906004016156e0565b60006040518083038185885af1158015613b8b573d6000803e3d6000fd5b50505050506040513d6000823e601f3d908101601f19168201604052613bb4919081019061545a565b505050505050565b60085460ff16610b195760405162461bcd60e51b815260206004820152601560248201527f4d53473a3a41424f52543a6e6f742070617573656400000000000000000000006044820152606401610681565b6001600160a01b0380841660009081526002602090815260408083206001600160e01b03198716845290915290205481169082168103613c765760405162461bcd60e51b815260206004820152600360248201526206e6f760ec1b6044820152606401610681565b6001600160a01b0384811660008181526002602090815260408083206001600160e01b031989168085529083529281902080546001600160a01b03191695881695861790558051938452908301919091528101919091527f454003ca28aca3b395ad1720eedfe6ee23b22ae10af0a8bb39c206ca1ca5679b9060600160405180910390a150505050565b60008083851115613d1f57613d158486615272565b9150839050613d22565b50835b6006546001600160a01b0390811690841603613de1576005546040516000916001600160a01b03169083908381818185875af1925050503d8060008114613d85576040519150601f19603f3d011682016040523d82523d6000602084013e613d8a565b606091505b5050905080613ddb5760405162461bcd60e51b815260206004820152601260248201527f73656e64206e6174697665206661696c656400000000000000000000000000006044820152606401610681565b50613dfb565b600554613dfb906001600160a01b03858116911683611736565b509392505050565b6060613e128484600085613eb4565b949350505050565b60208110613e525782518252613e3160208361563e565b9150613e3e60208461563e565b9250613e4b602082615272565b9050613e1a565b80600003613e5f57505050565b60006001613e6e836020615272565b613e7a90610100615806565b613e849190615272565b935183518516941916939093179091525050565b6000806000613ea78585613ffc565b91509150613dfb81614041565b606082471015613f2c5760405162461bcd60e51b815260206004820152602660248201527f416464726573733a20696e73756666696369656e742062616c616e636520666f60448201527f722063616c6c00000000000000000000000000000000000000000000000000006064820152608401610681565b6001600160a01b0385163b613f835760405162461bcd60e51b815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e74726163740000006044820152606401610681565b600080866001600160a01b03168587604051613f9f919061548f565b60006040518083038185875af1925050503d8060008114613fdc576040519150601f19603f3d011682016040523d82523d6000602084013e613fe1565b606091505b5091509150613ff18282866141f7565b979650505050505050565b60008082516041036140325760208301516040840151606085015160001a61402687828585614230565b9450945050505061403a565b506000905060025b9250929050565b600081600481111561405557614055614d19565b0361405d5750565b600181600481111561407157614071614d19565b036140be5760405162461bcd60e51b815260206004820152601860248201527f45434453413a20696e76616c6964207369676e617475726500000000000000006044820152606401610681565b60028160048111156140d2576140d2614d19565b0361411f5760405162461bcd60e51b815260206004820152601f60248201527f45434453413a20696e76616c6964207369676e6174757265206c656e677468006044820152606401610681565b600381600481111561413357614133614d19565b0361418b5760405162461bcd60e51b815260206004820152602260248201527f45434453413a20696e76616c6964207369676e6174757265202773272076616c604482015261756560f01b6064820152608401610681565b600481600481111561419f5761419f614d19565b036107cd5760405162461bcd60e51b815260206004820152602260248201527f45434453413a20696e76616c6964207369676e6174757265202776272076616c604482015261756560f01b6064820152608401610681565b60608315614206575081611986565b8251156142165782518084602001fd5b8160405162461bcd60e51b815260040161068191906155f9565b6000807f7fffffffffffffffffffffffffffffff5d576e7357a4501ddfe92f46681b20a08311156142675750600090506003614314565b8460ff16601b1415801561427f57508460ff16601c14155b156142905750600090506004614314565b6040805160008082526020820180845289905260ff881692820192909252606081018690526080810185905260019060a0016020604051602081039080840390855afa1580156142e4573d6000803e3d6000fd5b5050604051601f1901519150506001600160a01b03811661430d57600060019250925050614314565b9150600090505b94509492505050565b6101da8061581383390190565b604080516101408101909152600061010082019081526060610120830152819081526020016143846040518060800160405280600067ffffffffffffffff1681526020016060815260200160608152602001600081525090565b815260200160006001600160a01b0316815260200160006001600160a01b03168152602001600081526020016000815260200160008152602001600081525090565b6001600160a01b03811681146107cd57600080fd5b80356143e6816143c6565b919050565b6000602082840312156143fd57600080fd5b8135611986816143c6565b634e487b7160e01b600052604160045260246000fd5b6040805190810167ffffffffffffffff8111828210171561444157614441614408565b60405290565b6040516080810167ffffffffffffffff8111828210171561444157614441614408565b604051610100810167ffffffffffffffff8111828210171561444157614441614408565b6040516060810167ffffffffffffffff8111828210171561444157614441614408565b604051601f8201601f1916810167ffffffffffffffff811182821017156144da576144da614408565b604052919050565b600067ffffffffffffffff8211156144fc576144fc614408565b5060051b60200190565b67ffffffffffffffff811681146107cd57600080fd5b600082601f83011261452d57600080fd5b8135602061454261453d836144e2565b6144b1565b82815260059290921b8401810191818101908684111561456157600080fd5b8286015b84811015614585578035614578816143c6565b8352918301918301614565565b509695505050505050565b600080604083850312156145a357600080fd5b823567ffffffffffffffff808211156145bb57600080fd5b818501915085601f8301126145cf57600080fd5b813560206145df61453d836144e2565b82815260059290921b840181019181810190898411156145fe57600080fd5b948201945b8386101561462557853561461681614506565b82529482019490820190614603565b9650508601359250508082111561463b57600080fd5b506146488582860161451c565b9150509250929050565b6000806000806060858703121561466857600080fd5b8435614673816143c6565b935060208501359250604085013567ffffffffffffffff8082111561469757600080fd5b818701915087601f8301126146ab57600080fd5b8135818111156146ba57600080fd5b8860208285010111156146cc57600080fd5b95989497505060200194505050565b600067ffffffffffffffff8211156146f5576146f5614408565b50601f01601f191660200190565b600082601f83011261471457600080fd5b813561472261453d826146db565b81815284602083860101111561473757600080fd5b816020850160208301376000918101602001919091529392505050565b60006040828403121561476657600080fd5b61476e61441e565b9050813561477b816143c6565b8152602082013567ffffffffffffffff81111561479757600080fd5b6147a384828501614703565b60208301525092915050565b6000608082840312156147c157600080fd5b6147c9614447565b905081356147d681614506565b8152602082013567ffffffffffffffff808211156147f357600080fd5b6147ff85838601614703565b6020840152604084013591508082111561481857600080fd5b5061482584828501614703565b6040830152506060820135606082015292915050565b80151581146107cd57600080fd5b80356143e68161483b565b600060c0828403121561486657600080fd5b60405160c0810167ffffffffffffffff828210818311171561488a5761488a614408565b816040528293508435915061489e82614506565b9082526020840135906148b082614506565b81602084015260408501359150808211156148ca57600080fd5b506148d785828601614703565b6040830152506060830135606082015260808301356148f5816143c6565b608082015261490660a08401614849565b60a08201525092915050565b60006040828403121561492457600080fd5b61492c61441e565b90508135614939816143c6565b815260208201356149498161483b565b602082015292915050565b60008060006080848603121561496957600080fd5b833567ffffffffffffffff8082111561498157600080fd5b818601915086601f83011261499557600080fd5b813560206149a561453d836144e2565b82815260059290921b8401810191818101908a8411156149c457600080fd5b8286015b84811015614aa4578035868111156149df57600080fd5b8701610100818e03601f190112156149f657600080fd5b6149fe61446a565b8582013588811115614a0f57600080fd5b614a1d8f8883860101614754565b825250604082013588811115614a3257600080fd5b614a408f88838601016147af565b8783015250614a51606083016143db565b6040820152614a62608083016143db565b606082015260a0820135608082015260c082013560a082015260e082013560c082015261010082013560e08201528085525050838301925083810190506149c8565b5097505087013592505080821115614abb57600080fd5b50614ac886828701614854565b925050614ad88560408601614912565b90509250925092565b600060208284031215614af357600080fd5b813561198681614506565b600082601f830112614b0f57600080fd5b81356020614b1f61453d836144e2565b82815260059290921b84018101918181019086841115614b3e57600080fd5b8286015b8481101561458557803567ffffffffffffffff811115614b625760008081fd5b614b708986838b0101614703565b845250918301918301614b42565b600080600060608486031215614b9357600080fd5b833567ffffffffffffffff80821115614bab57600080fd5b614bb78783880161451c565b94506020860135915080821115614bcd57600080fd5b614bd987838801614afe565b93506040860135915080821115614bef57600080fd5b50614bfc8682870161451c565b9150509250925092565b60008060008060808587031215614c1c57600080fd5b8435614c27816143c6565b93506020850135614c37816143c6565b92506040850135614c4781614506565b91506060850135614c57816143c6565b939692955090935050565b60008060408385031215614c7557600080fd5b823567ffffffffffffffff80821115614c8d57600080fd5b614c9986838701614afe565b9350602085013591508082111561463b57600080fd5b60008060008060808587031215614cc557600080fd5b8435614cd0816143c6565b93506020850135614ce081614506565b9250604085013567ffffffffffffffff811115614cfc57600080fd5b614d0887828801614703565b9250506060850135614c57816143c6565b634e487b7160e01b600052602160045260246000fd5b6020810160038310614d5157634e487b7160e01b600052602160045260246000fd5b91905290565b60008060408385031215614d6a57600080fd5b8235614d75816143c6565b915060208301356001600160e01b031981168114614d9257600080fd5b809150509250929050565b6000806000806000806000806000806101408b8d031215614dbd57600080fd5b614dc68b614849565b9950614dd460208c016143db565b9850614de260408c016143db565b9750614df060608c016143db565b9650614dfe60808c016143db565b955060a08b013567ffffffffffffffff80821115614e1b57600080fd5b614e278e838f0161451c565b965060c08d0135915080821115614e3d57600080fd5b614e498e838f01614afe565b955060e08d0135915080821115614e5f57600080fd5b614e6b8e838f0161451c565b94506101008d0135915080821115614e8257600080fd5b614e8e8e838f01614afe565b93506101208d0135915080821115614ea557600080fd5b50614eb28d828e0161451c565b9150509295989b9194979a5092959850565b600060208284031215614ed657600080fd5b5035919050565b600060208284031215614eef57600080fd5b5051919050565b634e487b7160e01b600052603260045260246000fd5b80516143e6816143c6565b60005b83811015614f32578181015183820152602001614f1a565b83811115611cf75750506000910152565b6000614f5161453d846146db565b9050828152838383011115614f6557600080fd5b611986836020830184614f17565b600082601f830112614f8457600080fd5b61198683835160208501614f43565b600060408284031215614fa557600080fd5b614fad61441e565b90508151614fba816143c6565b8152602082015167ffffffffffffffff811115614fd657600080fd5b6147a384828501614f73565b600060808284031215614ff457600080fd5b614ffc614447565b9050815161500981614506565b8152602082015167ffffffffffffffff8082111561502657600080fd5b818401915084601f83011261503a57600080fd5b61504985835160208501614f43565b6020840152604084015191508082111561506257600080fd5b5061506f84828501614f73565b6040830152506060820151606082015292915050565b60006040828403121561509757600080fd5b61509f61441e565b905081516150ac816143c6565b815260208201516149498161483b565b600060208083850312156150cf57600080fd5b825167ffffffffffffffff808211156150e757600080fd5b90840190608082870312156150fb57600080fd5b61510361448e565b82518152838301518281111561511857600080fd5b8301601f8101881361512957600080fd5b805161513761453d826144e2565b81815260059190911b8201860190868101908a83111561515657600080fd5b8784015b838110156152365780518781111561517157600080fd5b8501610100818e03601f1901121561518857600080fd5b61519061446a565b8a820151898111156151a157600080fd5b6151af8f8d83860101614f93565b8252506040820151898111156151c457600080fd5b6151d28f8d83860101614fe2565b8c830152506151e360608301614f0c565b60408201526151f460808301614f0c565b606082015260a0820151608082015260c082015160a082015260e082015160c082015261010082015160e082015280855250508883019250888101905061515a565b5080888601525050505061524d8760408501615085565b60408201529695505050505050565b634e487b7160e01b600052601160045260246000fd5b6000828210156152845761528461525c565b500390565b60006001820161529b5761529b61525c565b5060010190565b600081518084526020808501945080840160005b838110156152db5781516001600160a01b0316875295820195908201906001016152b6565b509495945050505050565b604080825283519082018190526000906020906060840190828701845b8281101561532957815167ffffffffffffffff1684529284019290840190600101615303565b5050508381038285015261533d81866152a2565b9695505050505050565b805160208201516001600160e01b031980821692919060048310156153765780818460040360031b1b83161693505b505050919050565b60008151808452615396816020860160208601614f17565b601f01601f19169290920160200192915050565b6001600160a01b0381511682526000602082015160406020850152613e12604085018261537e565b60208152600061198660208301846153aa565b6000806000606084860312156153fa57600080fd5b83519250602084015161540c816143c6565b604085015190925061541d816143c6565b809150509250925092565b60608152600061543b606083018661537e565b90508360208301526001600160a01b0383166040830152949350505050565b60006020828403121561546c57600080fd5b815167ffffffffffffffff81111561548357600080fd5b613e1284828501614f73565b600082516154a1818460208701614f17565b9190910192915050565b6000602080835260a08084018551838601528286015160806040818189015283835180865260c09550858a019150858160051b8b0101888601955060005b828110156155c85760bf198c830301845286516101008151818552615510828601826153aa565b9150508b8201518482038d86015267ffffffffffffffff81511682528c810151898e8401526155418a84018261537e565b9050888201518382038a850152615558828261537e565b9150506060808301518185015289850151935061557f8a8801856001600160a01b03169052565b808501516001600160a01b031690870152898401518a8701528c8401518d8701528b8401518c87015260e0938401519390950192909252505095890195928901926001016154e9565b5092909a015180516001600160a01b031660608b015260200151151560809099019890985298975050505050505050565b602081526000611986602083018461537e565b6001600160a01b038416815267ffffffffffffffff83166020820152606060408201526000612471606083018461537e565b600082198211156156515761565161525c565b500190565b6000604082016040835280855180835260608501915060608160051b8601019250602080880160005b838110156156ad57605f1988870301855261569b86835161537e565b9550938201939082019060010161567f565b50508584038187015250505061247181856152a2565b6000602082840312156156d557600080fd5b81516119868161483b565b67ffffffffffffffff8616815260006001600160a01b03808716602084015285604084015280851660608401525060a06080830152613ff160a083018461537e565b600181815b8085111561575d5781600019048211156157435761574361525c565b8085161561575057918102915b93841c9390800290615727565b509250929050565b6000826157745750600161371a565b816157815750600061371a565b816001811461579757600281146157a1576157bd565b600191505061371a565b60ff8411156157b2576157b261525c565b50506001821b61371a565b5060208310610133831016604e8410600b84101617156157e0575081810a61371a565b6157ea8383615722565b80600019048211156157fe576157fe61525c565b029392505050565b6000611986838361576556fe608060405234801561001057600080fd5b506101ba806100206000396000f3fe608060405234801561001057600080fd5b506004361061002b5760003560e01c8063aad3ec9614610030575b600080fd5b61004361003e366004610104565b610045565b005b604080513360248201819052604480830185905283518084039091018152606490920183526020820180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff1663a9059cbb60e01b179052915173ffffffffffffffffffffffffffffffffffffffff8516916100bc91610149565b6000604051808303816000865af19150503d80600081146100f9576040519150601f19603f3d011682016040523d82523d6000602084013e6100fe565b606091505b50505080ff5b6000806040838503121561011757600080fd5b823573ffffffffffffffffffffffffffffffffffffffff8116811461013b57600080fd5b946020939093013593505050565b6000825160005b8181101561016a5760208186018101518583015201610150565b81811115610179576000828501525b50919091019291505056fea2646970667358221220596a029e19ba353d69291cd33136a82a60ef181cd9690abbbe3fe4a98c3c68c064736f6c634300080f00334f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572a2646970667358221220b75e4ee5e2ad36c284fe4795679834ff37f5bbb6b76e4f0c10dd978570cd68c764736f6c634300080f003300000000000000000000000000000000000000000000000000000000000000000000000000000000000000000d71d18126e03646eb09fec929e2ae87b7cae69d0000000000000000000000004200000000000000000000000000000000000006
Deployed Bytecode
0x6080604052600436106101dc5760003560e01c80636ef8d66d116101025780639c649fdf11610095578063cd9ea34211610064578063cd9ea34214610597578063d3ac0fbc146105b8578063eeaaa651146105d8578063f2fde38b1461060e57600080fd5b80639c649fdf146104f65780639e02c9f914610516578063a1a227fa14610557578063a591f97f1461057757600080fd5b806382dc1ec4116100d157806382dc1ec4146104835780638456cb59146104a35780638da5cb5b146104b8578063918ead76146104d657600080fd5b80636ef8d66d146103fe5780637228e5c4146104135780637a0f93561461043357806380f51c121461045357600080fd5b8063457bfa2f1161017a5780635b5a66a7116101495780635b5a66a7146103865780635c975abb146103a65780636b2c0f55146103be5780636c19e783146103de57600080fd5b8063457bfa2f146102ed57806346fbf68e1461030d578063478222c214610346578063547cad121461036657600080fd5b8063238ac933116101b6578063238ac93314610257578063289774a91461028f578063292e31ee146102a25780633f4ba83a146102d857600080fd5b806306b4771c146101e85780631cfcc0fc1461020a57806320be95f21461022a57600080fd5b366101e357005b600080fd5b3480156101f457600080fd5b506102086102033660046143eb565b61062e565b005b34801561021657600080fd5b50610208610225366004614590565b6107d0565b610242610238366004614652565b6000949350505050565b60405190151581526020015b60405180910390f35b34801561026357600080fd5b50600454610277906001600160a01b031681565b6040516001600160a01b03909116815260200161024e565b61020861029d366004614954565b610831565b3480156102ae57600080fd5b506102776102bd366004614ae1565b600a602052600090815260409020546001600160a01b031681565b3480156102e457600080fd5b50610208610ab2565b3480156102f957600080fd5b50600654610277906001600160a01b031681565b34801561031957600080fd5b506102426103283660046143eb565b6001600160a01b031660009081526009602052604090205460ff1690565b34801561035257600080fd5b50600554610277906001600160a01b031681565b34801561037257600080fd5b506102086103813660046143eb565b610b1b565b34801561039257600080fd5b506102086103a13660046143eb565b610bc7565b3480156103b257600080fd5b5060085460ff16610242565b3480156103ca57600080fd5b506102086103d93660046143eb565b610c27565b3480156103ea57600080fd5b506102086103f93660046143eb565b610c87565b34801561040a57600080fd5b50610208610ce7565b34801561041f57600080fd5b5061020861042e366004614b7e565b610cf0565b34801561043f57600080fd5b5061020861044e366004614c06565b610d57565b34801561045f57600080fd5b5061024261046e3660046143eb565b60096020526000908152604090205460ff1681565b34801561048f57600080fd5b5061020861049e3660046143eb565b611059565b3480156104af57600080fd5b506102086110b9565b3480156104c457600080fd5b506000546001600160a01b0316610277565b3480156104e257600080fd5b506102086104f1366004614c62565b611120565b610509610504366004614caf565b611181565b60405161024e9190614d2f565b34801561052257600080fd5b50610277610531366004614d57565b60026020908152600092835260408084209091529082529020546001600160a01b031681565b34801561056357600080fd5b50600154610277906001600160a01b031681565b34801561058357600080fd5b506102086105923660046143eb565b611460565b3480156105a357600080fd5b5060005461024290600160b01b900460ff1681565b3480156105c457600080fd5b506102086105d3366004614d9d565b6114c0565b3480156105e457600080fd5b506102776105f3366004614ec4565b6003602052600090815260409020546001600160a01b031681565b34801561061a57600080fd5b506102086106293660046143eb565b61165a565b336106416000546001600160a01b031690565b6001600160a01b03161461068a5760405162461bcd60e51b815260206004820181905260248201526000805160206159ed83398151915260448201526064015b60405180910390fd5b6001600160a01b03811661073f57600080546040516001600160a01b039091169047908381818185875af1925050503d80600081146106e5576040519150601f19603f3d011682016040523d82523d6000602084013e6106ea565b606091505b505090508061073b5760405162461bcd60e51b815260206004820152601260248201527f73656e64206e6174697665206661696c656400000000000000000000000000006044820152606401610681565b5050565b6107cd6107546000546001600160a01b031690565b6040516370a0823160e01b81523060048201526001600160a01b038416906370a0823190602401602060405180830381865afa158015610798573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906107bc9190614edd565b6001600160a01b0384169190611736565b50565b336107e36000546001600160a01b031690565b6001600160a01b0316146108275760405162461bcd60e51b815260206004820181905260248201526000805160206159ed8339815191526044820152606401610681565b61073b82826117ae565b6108396118da565b60026007540361088b5760405162461bcd60e51b815260206004820152601f60248201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c006044820152606401610681565b600260075582516108c45760405162461bcd60e51b815260206004820152600360248201526206e6f760ec1b6044820152606401610681565b60008260600151116109185760405162461bcd60e51b815260206004820152600860248201527f3020616d6f756e740000000000000000000000000000000000000000000000006044820152606401610681565b80516001600160a01b031661096f5760405162461bcd60e51b815260206004820152600a60248201527f30207265636569766572000000000000000000000000000000000000000000006044820152606401610681565b6000610984338360000151856000015161192d565b905060008460008151811061099b5761099b614ef6565b602002602001015190506001855111156109b9576109b9858561198d565b6000806109c586611cfd565b9150915060008211610a195760405162461bcd60e51b815260206004820152600f60248201527f616d6f756e74206d757374203e203000000000000000000000000000000000006044820152606401610681565b825151829082906001600160a01b031615610a94578451600190610a3e908686611e6b565b9094509250905080610a925760405162461bcd60e51b815260206004820152600960248201527f73776170206661696c00000000000000000000000000000000000000000000006044820152606401610681565b505b610aa1868a89848661218d565b505060016007555050505050505050565b3360009081526009602052604090205460ff16610b115760405162461bcd60e51b815260206004820152601460248201527f43616c6c6572206973206e6f74207061757365720000000000000000000000006044820152606401610681565b610b1961247a565b565b33610b2e6000546001600160a01b031690565b6001600160a01b031614610b725760405162461bcd60e51b815260206004820181905260248201526000805160206159ed8339815191526044820152606401610681565b600180546001600160a01b0319166001600160a01b0383169081179091556040519081527f3f8223bcd8b3b875473e9f9e14e1ad075451a2b5ffd31591655da9a01516bf5e906020015b60405180910390a150565b33610bda6000546001600160a01b031690565b6001600160a01b031614610c1e5760405162461bcd60e51b815260206004820181905260248201526000805160206159ed8339815191526044820152606401610681565b6107cd816124cc565b33610c3a6000546001600160a01b031690565b6001600160a01b031614610c7e5760405162461bcd60e51b815260206004820181905260248201526000805160206159ed8339815191526044820152606401610681565b6107cd8161251a565b33610c9a6000546001600160a01b031690565b6001600160a01b031614610cde5760405162461bcd60e51b815260206004820181905260248201526000805160206159ed8339815191526044820152606401610681565b6107cd816125d3565b610b193361251a565b33610d036000546001600160a01b031690565b6001600160a01b031614610d475760405162461bcd60e51b815260206004820181905260248201526000805160206159ed8339815191526044820152606401610681565b610d5283838361262d565b505050565b610d5f6118da565b600260075403610db15760405162461bcd60e51b815260206004820152601f60248201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c006044820152606401610681565b6002600755336001600160a01b03841614610e0e5760405162461bcd60e51b815260206004820152601760248201527f6f6e6c792072656365697665722063616e20636c61696d0000000000000000006044820152606401610681565b6000610e1b85858561192d565b9050600081604051610e2c9061431d565b8190604051809103906000f5905080158015610e4c573d6000803e3d6000fd5b506040516370a0823160e01b81526001600160a01b0380831660048301529192506000918516906370a0823190602401602060405180830381865afa158015610e99573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610ebd9190614edd565b90506001600160a01b0382163181151580610ed85750600081115b610f245760405162461bcd60e51b815260206004820152600f60248201527f706f636b657420697320656d70747900000000000000000000000000000000006044820152606401610681565b610f2f83868461270c565b8115610f4957610f496001600160a01b0386168884611736565b8015610ff9576000876001600160a01b03168261c35090604051600060405180830381858888f193505050503d8060008114610fa1576040519150601f19603f3d011682016040523d82523d6000602084013e610fa6565b606091505b5050905080610ff75760405162461bcd60e51b815260206004820152601560248201527f6661696c656420746f2073656e64206e617469766500000000000000000000006044820152606401610681565b505b604080516001600160a01b038981168252602082018590528716818301526060810183905290517f93792cbd2b72fa0c2850634d3177263b6f8dbe5c2245b5ad2522ef65b5a9b8d59181900360800190a150506001600755505050505050565b3361106c6000546001600160a01b031690565b6001600160a01b0316146110b05760405162461bcd60e51b815260206004820181905260248201526000805160206159ed8339815191526044820152606401610681565b6107cd816128aa565b3360009081526009602052604090205460ff166111185760405162461bcd60e51b815260206004820152601460248201527f43616c6c6572206973206e6f74207061757365720000000000000000000000006044820152606401610681565b610b19612967565b336111336000546001600160a01b031690565b6001600160a01b0316146111775760405162461bcd60e51b815260206004820181905260248201526000805160206159ed8339815191526044820152606401610681565b61073b82826129a4565b600061118b612ab7565b83856111978282612b22565b61119f6118da565b6002600754036111f15760405162461bcd60e51b815260206004820152601f60248201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c006044820152606401610681565b6002600755845160009061120e90870160209081019088016150bc565b905060008160200151511161124b5760405162461bcd60e51b815260206004820152600360248201526206e6f760ec1b6044820152606401610681565b60003490506000826020015160008151811061126957611269614ef6565b60200260200101519050600080611284856000015184612b96565b91509150816000036112f157845160408051918252600060208301526001600160a01b038316908201527f295612f9c20f128efb8df333990658b0f1b8083bc7b6dcf90750348cede4c299906060015b60405180910390a16112e584612eea565b97505050505050611451565b82606001516001600160a01b0316816001600160a01b03160361136b5761132381838760400151600001516000612fbf565b845160408051918252602082018490526001600160a01b038316908201527f295612f9c20f128efb8df333990658b0f1b8083bc7b6dcf90750348cede4c299906060016112d4565b825151829082906001600160a01b031615611414578451600190611390908686611e6b565b9094509250905080611412576113b184868a60400151600001516000612fbf565b875160408051918252602082018790526001600160a01b03861682820152517f295612f9c20f128efb8df333990658b0f1b8083bc7b6dcf90750348cede4c2999181900360600190a161140387612eea565b9a505050505050505050611451565b505b600061142f886000015189602001518a60400151858761218d565b905061143b8188615272565b965061144687612eea565b9a5050505050505050505b50506001600755949350505050565b336114736000546001600160a01b031690565b6001600160a01b0316146114b75760405162461bcd60e51b815260206004820181905260248201526000805160206159ed8339815191526044820152606401610681565b6107cd81613142565b600054600160a81b900460ff16158080156114e857506000546001600160a01b90910460ff16105b806115095750303b1580156115095750600054600160a01b900460ff166001145b61157b5760405162461bcd60e51b815260206004820152602e60248201527f496e697469616c697a61626c653a20636f6e747261637420697320616c72656160448201527f647920696e697469616c697a65640000000000000000000000000000000000006064820152608401610681565b600080547fffffffffffffffffffffff00ffffffffffffffffffffffffffffffffffffffff16600160a01b17905580156115c3576000805460ff60a81b1916600160a81b1790555b6115cb61319c565b6115d58b8b6131fe565b6115e0868686613302565b6115ea838361336f565b6115f3876133dc565b6115fc88613449565b611605896134b6565b801561164d576000805460ff60a81b19169055604051600181527f7f26b83ff96e1f2b6a682f133852f6798a09c465da95921460cefb38474024989060200160405180910390a15b5050505050505050505050565b3361166d6000546001600160a01b031690565b6001600160a01b0316146116b15760405162461bcd60e51b815260206004820181905260248201526000805160206159ed8339815191526044820152606401610681565b6001600160a01b03811661172d5760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201527f64647265737300000000000000000000000000000000000000000000000000006064820152608401610681565b6107cd81613523565b6040516001600160a01b038316602482015260448101829052610d5290849063a9059cbb60e01b906064015b60408051601f198184030181529190526020810180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff166001600160e01b031990931692909217909152613573565b80518251146117ff5760405162461bcd60e51b815260206004820152601760248201527f72656d6f746573206c656e677468206d69736d617463680000000000000000006044820152606401610681565b60005b825181101561189c5781818151811061181d5761181d614ef6565b6020026020010151600a600085848151811061183b5761183b614ef6565b602002602001015167ffffffffffffffff1667ffffffffffffffff16815260200190815260200160002060006101000a8154816001600160a01b0302191690836001600160a01b03160217905550808061189490615289565b915050611802565b507fe000e6cd4a5421450046ea059588823e2c45d75255bc2ce0031a7c64d32f8c1682826040516118ce9291906152e6565b60405180910390a15050565b60085460ff1615610b195760405162461bcd60e51b815260206004820152601160248201527f4d53473a3a41424f52543a7061757365640000000000000000000000000000006044820152606401610681565b6040516bffffffffffffffffffffffff19606085811b8216602084015284901b1660348201526001600160c01b031960c083901b1660488201526000906050016040516020818303038152906040528051906020012090505b9392505050565b42816020015167ffffffffffffffff16116119ea5760405162461bcd60e51b815260206004820152601160248201527f646561646c696e652065786365656465640000000000000000000000000000006044820152606401610681565b600046826060015183608001518460200151604051602001611a7494939291907f636861696e686f702071756f7465000000000000000000000000000000000000815260c094851b6001600160c01b0319908116600e830152601682019490945260609290921b6bffffffffffffffffffffffff1916603683015290921b16604a82015260520190565b60408051601f19818403018152919052905060015b8351811015611c97576000848281518110611aa657611aa6614ef6565b60200260200101519050600085600184611ac09190615272565b81518110611ad057611ad0614ef6565b602002602001015160200151905060006001600160a01b031682604001516001600160a01b031614158015611b09575060008260800151115b8015611b19575060008260c00151115b611b655760405162461bcd60e51b815260206004820152600c60248201527f696e76616c6964206578656300000000000000000000000000000000000000006044820152606401610681565b60608201516001600160a01b03161580611b92575060008260a00151118015611b92575060008260e00151115b611bde5760405162461bcd60e51b815260206004820152601060248201527f696e76616c69642066616c6c6261636b000000000000000000000000000000006044820152606401610681565b600081600001518360c0015184604001518560e001518660600151876020015160600151604051602001611c639695949392919060c09690961b6001600160c01b03191686526008860194909452606092831b6bffffffffffffffffffffffff199081166028870152603c86019290925290911b16605c830152607082015260900190565b60408051601f198184030181529190529050611c7f8582613658565b94505050508080611c8f90615289565b915050611a89565b508051602080830191909120604080517f19457468657265756d205369676e6564204d6573736167653a0a33320000000081850152603c8082019390935281518082039093018352605c0190528051910120611cf7818460400151613720565b50505050565b6000808260a0015115611e325760065460808401516001600160a01b03908116911614611d6c5760405162461bcd60e51b815260206004820152601660248201527f746f6b656e496e206e6f74206e617469766557726170000000000000000000006044820152606401610681565b8260600151341015611dc05760405162461bcd60e51b815260206004820152601a60248201527f696e73756666696369656e74206e617469766520616d6f756e740000000000006044820152606401610681565b600660009054906101000a90046001600160a01b03166001600160a01b031663d0e30db084606001516040518263ffffffff1660e01b81526004016000604051808303818588803b158015611e1457600080fd5b505af1158015611e28573d6000803e3d6000fd5b5050505050611e5a565b611e5a3330856060015186608001516001600160a01b031661378c909392919063ffffffff16565b505060608101516080909101519091565b8251600090819081906001600160a01b0316611e8f57506001915083905082612184565b60008660200151611e9f90615347565b90506000611eb18860000151836137c4565b90506000816001600160a01b031663358f0e1c8a6040518263ffffffff1660e01b8152600401611ee191906153d2565b606060405180830381865afa158015611efe573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611f2291906153e5565b95509150506001600160a01b0380821690881614611f825760405162461bcd60e51b815260206004820152601260248201527f7377617020696e666f206d69736d6174636800000000000000000000000000006044820152606401610681565b6020890151604051634c6da26960e01b81526000916001600160a01b03851691634c6da26991611fb8918d903090600401615428565b600060405180830381865afa158015611fd5573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f19168201604052611ffd919081019061545a565b8a51909150612017906001600160a01b038416908b613877565b6040516370a0823160e01b81523060048201526000906001600160a01b038716906370a0823190602401602060405180830381865afa15801561205e573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906120829190614edd565b905060008b600001516001600160a01b0316836040516120a2919061548f565b6000604051808303816000865af19150503d80600081146120df576040519150601f19603f3d011682016040523d82523d6000602084013e6120e4565b606091505b50509050806120ff5760008098509850505050505050612184565b6040516370a0823160e01b81523060048201526000906001600160a01b038916906370a0823190602401602060405180830381865afa158015612146573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061216a9190614edd565b905060016121788483615272565b99509950505050505050505b93509350939050565b600080856000815181106121a3576121a3614ef6565b602002602001015190506121b686613929565b9550855160001480156121d6575060208101515167ffffffffffffffff16155b15612241576121ef848487600001518860200151612fbf565b60408051888152602081018590526001600160a01b0386168183015290517f295612f9c20f128efb8df333990658b0f1b8083bc7b6dcf90750348cede4c2999181900360600190a16000915050612471565b84518651156123ff576020808301515167ffffffffffffffff166000908152600a90915260409020546001600160a01b0316806122c05760405162461bcd60e51b815260206004820152601060248201527f72656d6f7465206e6f7420666f756e64000000000000000000000000000000006044820152606401610681565b6122ca8982613a46565b9150600060405180606001604052808b81526020018a8152602001898152506040516020016122f991906154ab565b60408051601f198184030181529082905260015463299aee5160e11b83529092506000916001600160a01b0390911690635335dca29061233d9085906004016155f9565b602060405180830381865afa15801561235a573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061237e9190614edd565b600154602087015151604051634f9e72ad60e11b81529293506001600160a01b0390911691639f3ce55a9184916123bb918891889060040161560c565b6000604051808303818588803b1580156123d457600080fd5b505af11580156123e8573d6000803e3d6000fd5b505050505080866123f9919061563e565b95505050505b61240f8260200151828787613afa565b602082015160600151612422908461563e565b604080518a8152602081018790526001600160a01b0388168183015290519194507f295612f9c20f128efb8df333990658b0f1b8083bc7b6dcf90750348cede4c299919081900360600190a150505b95945050505050565b612482613bbc565b6008805460ff191690557f5db9ee0a495bf2e6ff9c91a7834c1ba4fdd244a5e8aa4e537bd38aeae4b073aa335b6040516001600160a01b03909116815260200160405180910390a1565b600680546001600160a01b0319166001600160a01b0383169081179091556040519081527fb878cd71628ac64b2df1872301925e01164824535b02e8601077749eeeb88c3d90602001610bbc565b6001600160a01b03811660009081526009602052604090205460ff166125825760405162461bcd60e51b815260206004820152601560248201527f4163636f756e74206973206e6f742070617573657200000000000000000000006044820152606401610681565b6001600160a01b038116600081815260096020908152604091829020805460ff1916905590519182527fcd265ebaf09df2871cc7bd4133404a235ba12eff2041bb89d9c714a2621c7c7e9101610bbc565b600480546001600160a01b038381166001600160a01b031983168117909355604080519190921680825260208201939093527f2d025324f0a785e8c12d0a0d91a9caa49df4ef20ff87e0df7213a1d4f3157beb91016118ce565b8151835114801561263f575080518351145b61268b5760405162461bcd60e51b815260206004820152601660248201527f636f646563206c656e67746873206d69736d61746368000000000000000000006044820152606401610681565b60005b8351811015611cf75760008382815181106126ab576126ab614ef6565b60200260200101518051906020012090506126f98583815181106126d1576126d1614ef6565b6020026020010151828585815181106126ec576126ec614ef6565b6020026020010151613c0e565b508061270481615289565b91505061268e565b6040516370a0823160e01b81523060048201526000906001600160a01b038416906370a0823190602401602060405180830381865afa158015612753573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906127779190614edd565b604051635569f64b60e11b81526001600160a01b038581166004830152602482018590529192509085169063aad3ec9690604401600060405180830381600087803b1580156127c557600080fd5b505af11580156127d9573d6000803e3d6000fd5b50506040516370a0823160e01b8152306004820152600092506001600160a01b03861691506370a0823190602401602060405180830381865afa158015612824573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906128489190614edd565b9050826128558383615272565b10156128a35760405162461bcd60e51b815260206004820152601960248201527f696e73756666696369656e742066756e6420636c61696d6564000000000000006044820152606401610681565b5050505050565b6001600160a01b03811660009081526009602052604090205460ff16156129135760405162461bcd60e51b815260206004820152601960248201527f4163636f756e7420697320616c726561647920706175736572000000000000006044820152606401610681565b6001600160a01b038116600081815260096020908152604091829020805460ff1916600117905590519182527f6719d08c1888103bea251a4ed56406bd0c3e69723c8a1686e017e7bbe159b6f89101610bbc565b61296f6118da565b6008805460ff191660011790557f62e78cea01bee320cd4e420270b5ea74000d11b0c9f74754ebdbfc544b05a2586124af3390565b80518251146129f55760405162461bcd60e51b815260206004820152601460248201527f706172616d732073697a65206d69736d617463680000000000000000000000006044820152606401610681565b60005b8251811015612a8557818181518110612a1357612a13614ef6565b602002602001015160036000858481518110612a3157612a31614ef6565b602002602001015180519060200120815260200190815260200160002060006101000a8154816001600160a01b0302191690836001600160a01b031602179055508080612a7d90615289565b9150506129f8565b507f68d2b5e14eb61b73f2dfa46a255dcba81a3b53259093a83c90da69c3ade70b9682826040516118ce929190615656565b600054600160b01b900460ff16610b19576001546001600160a01b03163314610b195760405162461bcd60e51b815260206004820152601960248201527f63616c6c6572206973206e6f74206d65737361676520627573000000000000006044820152606401610681565b67ffffffffffffffff82166000908152600a60205260409020546001600160a01b0382811691161461073b5760405162461bcd60e51b815260206004820152600e60248201527f756e6b6e6f776e2072656d6f74650000000000000000000000000000000000006044820152606401610681565b600080600084604051612ba89061431d565b8190604051809103906000f5905080158015612bc8573d6000803e3d6000fd5b5060608501519091506000906001600160a01b031615612c555760608501516040516370a0823160e01b81526001600160a01b038481166004830152909116906370a0823190602401602060405180830381865afa158015612c2e573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190612c529190614edd565b90505b60408086015190516370a0823160e01b81526001600160a01b03848116600483015260009216906370a0823190602401602060405180830381865afa158015612ca2573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190612cc69190614edd565b60a08701519091506001600160a01b0384163190831115612d1157612cf08488606001518561270c565b612d03838860e001518960600151613d00565b955086606001519450612edf565b8660800151821115612d4d57612d2c8488604001518461270c565b612d3f828860c001518960400151613d00565b955086604001519450612edf565b8660800151811115612e9757604051635569f64b60e11b815260006004820181905260248201526001600160a01b0385169063aad3ec9690604401600060405180830381600087803b158015612da257600080fd5b505af1158015612db6573d6000803e3d6000fd5b505060065460408a01516001600160a01b039081169116149150612e1e90505760405162461bcd60e51b815260206004820152601d60248201527f6272696467654f7574546f6b656e206e6f74206e6174697665577261700000006044820152606401610681565b612e31818860c001518960400151613d00565b955086604001516001600160a01b031663d0e30db0876040518263ffffffff1660e01b81526004016000604051808303818588803b158015612e7257600080fd5b505af1158015612e86573d6000803e3d6000fd5b505050505086604001519450612edf565b60405162461bcd60e51b815260206004820152601a60248201527f4d53473a3a41424f52543a706f636b657420697320656d7074790000000000006044820152606401610681565b505050509250929050565b60008115612fb757604051600090329061c35090859084818181858888f193505050503d8060008114612f39576040519150601f19603f3d011682016040523d82523d6000602084013e612f3e565b606091505b5050905080612fb55760405162461bcd60e51b815260206004820152602760248201527f6661696c656420746f20726566756e642072656d61696e696e67206e6174697660448201527f6520746f6b656e000000000000000000000000000000000000000000000000006064820152608401610681565b505b506001919050565b801561312e576006546001600160a01b038581169116146130225760405162461bcd60e51b815260206004820152601760248201527f746f6b656e206973206e6f74206e6174697665577261700000000000000000006044820152606401610681565b600654604051632e1a7d4d60e01b8152600481018590526001600160a01b0390911690632e1a7d4d90602401600060405180830381600087803b15801561306857600080fd5b505af115801561307c573d6000803e3d6000fd5b505050506000826001600160a01b03168461c35090604051600060405180830381858888f193505050503d80600081146130d2576040519150601f19603f3d011682016040523d82523d6000602084013e6130d7565b606091505b50509050806131285760405162461bcd60e51b815260206004820152600960248201527f73656e64206661696c00000000000000000000000000000000000000000000006044820152606401610681565b50611cf7565b611cf76001600160a01b0385168385611736565b600580546001600160a01b038381166001600160a01b031983168117909355604080519190921680825260208201939093527f47ffc4777a9849fd88ac272225845f7bbcfa9920f222b459c2e6b28156ce724991016118ce565b6000546001600160a01b0316156131f55760405162461bcd60e51b815260206004820152601160248201527f6f776e657220616c7265616479207365740000000000000000000000000000006044820152606401610681565b610b1933613523565b600054600160a81b900460ff1661326b5760405162461bcd60e51b815260206004820152602b60248201527f496e697469616c697a61626c653a20636f6e7472616374206973206e6f74206960448201526a6e697469616c697a696e6760a81b6064820152608401610681565b811580613279575046617a69145b61328257600080fd5b600080547fffffffffffffffffff00ffffffffffffffffffffffffffffffffffffffffffff16600160b01b84151502179055600180546001600160a01b0319166001600160a01b0383169081179091556040519081527f3f8223bcd8b3b875473e9f9e14e1ad075451a2b5ffd31591655da9a01516bf5e906020016118ce565b600054600160a81b900460ff16610d475760405162461bcd60e51b815260206004820152602b60248201527f496e697469616c697a61626c653a20636f6e7472616374206973206e6f74206960448201526a6e697469616c697a696e6760a81b6064820152608401610681565b600054600160a81b900460ff166111775760405162461bcd60e51b815260206004820152602b60248201527f496e697469616c697a61626c653a20636f6e7472616374206973206e6f74206960448201526a6e697469616c697a696e6760a81b6064820152608401610681565b600054600160a81b900460ff166114b75760405162461bcd60e51b815260206004820152602b60248201527f496e697469616c697a61626c653a20636f6e7472616374206973206e6f74206960448201526a6e697469616c697a696e6760a81b6064820152608401610681565b600054600160a81b900460ff16610cde5760405162461bcd60e51b815260206004820152602b60248201527f496e697469616c697a61626c653a20636f6e7472616374206973206e6f74206960448201526a6e697469616c697a696e6760a81b6064820152608401610681565b600054600160a81b900460ff16610c1e5760405162461bcd60e51b815260206004820152602b60248201527f496e697469616c697a61626c653a20636f6e7472616374206973206e6f74206960448201526a6e697469616c697a696e6760a81b6064820152608401610681565b600080546001600160a01b038381166001600160a01b0319831681178455604051919092169283917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a35050565b60006135c8826040518060400160405280602081526020017f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c6564815250856001600160a01b0316613e039092919063ffffffff16565b805190915015610d5257808060200190518101906135e691906156c3565b610d525760405162461bcd60e51b815260206004820152602a60248201527f5361666545524332303a204552433230206f7065726174696f6e20646964206e60448201527f6f742073756363656564000000000000000000000000000000000000000000006064820152608401610681565b606060008251845161366a919061563e565b67ffffffffffffffff81111561368257613682614408565b6040519080825280601f01601f1916602001820160405280156136ac576020820181803683370190505b5090506000806136c0868051602090910191565b915091506000806136d5878051602090910191565b9150915060006136e9868051602090910191565b50905060006136f8858361563e565b9050613705868387613e1a565b613710848285613e1a565b5094955050505050505b92915050565b600061372c8383613e98565b6004549091506001600160a01b03808316911614610d525760405162461bcd60e51b815260206004820152600e60248201527f696e76616c6964207369676e65720000000000000000000000000000000000006044820152606401610681565b6040516001600160a01b0380851660248301528316604482015260648101829052611cf79085906323b872dd60e01b90608401611762565b6001600160a01b0382811660009081526002602090815260408083206001600160e01b0319861684529091528120549091166138425760405162461bcd60e51b815260206004820152600f60248201527f756e737570706f727465642064657800000000000000000000000000000000006044820152606401610681565b506001600160a01b0391821660009081526002602090815260408083206001600160e01b031994909416835292905220541690565b604051636eb1769f60e11b81523060048201526001600160a01b038381166024830152600091839186169063dd62ed3e90604401602060405180830381865afa1580156138c8573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906138ec9190614edd565b6138f6919061563e565b6040516001600160a01b038516602482015260448101829052909150611cf790859063095ea7b360e01b90606401611762565b6060600082511161397c5760405162461bcd60e51b815260206004820152600b60248201527f656d7074792065786563730000000000000000000000000000000000000000006044820152606401610681565b6001825161398a9190615272565b67ffffffffffffffff8111156139a2576139a2614408565b6040519080825280602002602001820160405280156139db57816020015b6139c861432a565b8152602001906001900390816139c05790505b50905060015b8251811015613a40578281815181106139fc576139fc614ef6565b602002602001015182600183613a129190615272565b81518110613a2257613a22614ef6565b60200260200101819052508080613a3890615289565b9150506139e1565b50919050565b60008060ff60f81b838560405180602001613a609061431d565b6020820181038252601f19601f8201166040525080519060200120604051602001613ada94939291907fff0000000000000000000000000000000000000000000000000000000000000094909416845260609290921b6bffffffffffffffffffffffff191660018401526015830152603582015260550190565b60408051808303601f190181529190528051602090910120949350505050565b6020808501518051908201206000908152600390915260409020546001600160a01b0390811690613b2e9084168284613877565b6060850151855160408088015190516324c9401b60e01b81526001600160a01b038516936324c9401b939092613b6d928a9189918b91906004016156e0565b60006040518083038185885af1158015613b8b573d6000803e3d6000fd5b50505050506040513d6000823e601f3d908101601f19168201604052613bb4919081019061545a565b505050505050565b60085460ff16610b195760405162461bcd60e51b815260206004820152601560248201527f4d53473a3a41424f52543a6e6f742070617573656400000000000000000000006044820152606401610681565b6001600160a01b0380841660009081526002602090815260408083206001600160e01b03198716845290915290205481169082168103613c765760405162461bcd60e51b815260206004820152600360248201526206e6f760ec1b6044820152606401610681565b6001600160a01b0384811660008181526002602090815260408083206001600160e01b031989168085529083529281902080546001600160a01b03191695881695861790558051938452908301919091528101919091527f454003ca28aca3b395ad1720eedfe6ee23b22ae10af0a8bb39c206ca1ca5679b9060600160405180910390a150505050565b60008083851115613d1f57613d158486615272565b9150839050613d22565b50835b6006546001600160a01b0390811690841603613de1576005546040516000916001600160a01b03169083908381818185875af1925050503d8060008114613d85576040519150601f19603f3d011682016040523d82523d6000602084013e613d8a565b606091505b5050905080613ddb5760405162461bcd60e51b815260206004820152601260248201527f73656e64206e6174697665206661696c656400000000000000000000000000006044820152606401610681565b50613dfb565b600554613dfb906001600160a01b03858116911683611736565b509392505050565b6060613e128484600085613eb4565b949350505050565b60208110613e525782518252613e3160208361563e565b9150613e3e60208461563e565b9250613e4b602082615272565b9050613e1a565b80600003613e5f57505050565b60006001613e6e836020615272565b613e7a90610100615806565b613e849190615272565b935183518516941916939093179091525050565b6000806000613ea78585613ffc565b91509150613dfb81614041565b606082471015613f2c5760405162461bcd60e51b815260206004820152602660248201527f416464726573733a20696e73756666696369656e742062616c616e636520666f60448201527f722063616c6c00000000000000000000000000000000000000000000000000006064820152608401610681565b6001600160a01b0385163b613f835760405162461bcd60e51b815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e74726163740000006044820152606401610681565b600080866001600160a01b03168587604051613f9f919061548f565b60006040518083038185875af1925050503d8060008114613fdc576040519150601f19603f3d011682016040523d82523d6000602084013e613fe1565b606091505b5091509150613ff18282866141f7565b979650505050505050565b60008082516041036140325760208301516040840151606085015160001a61402687828585614230565b9450945050505061403a565b506000905060025b9250929050565b600081600481111561405557614055614d19565b0361405d5750565b600181600481111561407157614071614d19565b036140be5760405162461bcd60e51b815260206004820152601860248201527f45434453413a20696e76616c6964207369676e617475726500000000000000006044820152606401610681565b60028160048111156140d2576140d2614d19565b0361411f5760405162461bcd60e51b815260206004820152601f60248201527f45434453413a20696e76616c6964207369676e6174757265206c656e677468006044820152606401610681565b600381600481111561413357614133614d19565b0361418b5760405162461bcd60e51b815260206004820152602260248201527f45434453413a20696e76616c6964207369676e6174757265202773272076616c604482015261756560f01b6064820152608401610681565b600481600481111561419f5761419f614d19565b036107cd5760405162461bcd60e51b815260206004820152602260248201527f45434453413a20696e76616c6964207369676e6174757265202776272076616c604482015261756560f01b6064820152608401610681565b60608315614206575081611986565b8251156142165782518084602001fd5b8160405162461bcd60e51b815260040161068191906155f9565b6000807f7fffffffffffffffffffffffffffffff5d576e7357a4501ddfe92f46681b20a08311156142675750600090506003614314565b8460ff16601b1415801561427f57508460ff16601c14155b156142905750600090506004614314565b6040805160008082526020820180845289905260ff881692820192909252606081018690526080810185905260019060a0016020604051602081039080840390855afa1580156142e4573d6000803e3d6000fd5b5050604051601f1901519150506001600160a01b03811661430d57600060019250925050614314565b9150600090505b94509492505050565b6101da8061581383390190565b604080516101408101909152600061010082019081526060610120830152819081526020016143846040518060800160405280600067ffffffffffffffff1681526020016060815260200160608152602001600081525090565b815260200160006001600160a01b0316815260200160006001600160a01b03168152602001600081526020016000815260200160008152602001600081525090565b6001600160a01b03811681146107cd57600080fd5b80356143e6816143c6565b919050565b6000602082840312156143fd57600080fd5b8135611986816143c6565b634e487b7160e01b600052604160045260246000fd5b6040805190810167ffffffffffffffff8111828210171561444157614441614408565b60405290565b6040516080810167ffffffffffffffff8111828210171561444157614441614408565b604051610100810167ffffffffffffffff8111828210171561444157614441614408565b6040516060810167ffffffffffffffff8111828210171561444157614441614408565b604051601f8201601f1916810167ffffffffffffffff811182821017156144da576144da614408565b604052919050565b600067ffffffffffffffff8211156144fc576144fc614408565b5060051b60200190565b67ffffffffffffffff811681146107cd57600080fd5b600082601f83011261452d57600080fd5b8135602061454261453d836144e2565b6144b1565b82815260059290921b8401810191818101908684111561456157600080fd5b8286015b84811015614585578035614578816143c6565b8352918301918301614565565b509695505050505050565b600080604083850312156145a357600080fd5b823567ffffffffffffffff808211156145bb57600080fd5b818501915085601f8301126145cf57600080fd5b813560206145df61453d836144e2565b82815260059290921b840181019181810190898411156145fe57600080fd5b948201945b8386101561462557853561461681614506565b82529482019490820190614603565b9650508601359250508082111561463b57600080fd5b506146488582860161451c565b9150509250929050565b6000806000806060858703121561466857600080fd5b8435614673816143c6565b935060208501359250604085013567ffffffffffffffff8082111561469757600080fd5b818701915087601f8301126146ab57600080fd5b8135818111156146ba57600080fd5b8860208285010111156146cc57600080fd5b95989497505060200194505050565b600067ffffffffffffffff8211156146f5576146f5614408565b50601f01601f191660200190565b600082601f83011261471457600080fd5b813561472261453d826146db565b81815284602083860101111561473757600080fd5b816020850160208301376000918101602001919091529392505050565b60006040828403121561476657600080fd5b61476e61441e565b9050813561477b816143c6565b8152602082013567ffffffffffffffff81111561479757600080fd5b6147a384828501614703565b60208301525092915050565b6000608082840312156147c157600080fd5b6147c9614447565b905081356147d681614506565b8152602082013567ffffffffffffffff808211156147f357600080fd5b6147ff85838601614703565b6020840152604084013591508082111561481857600080fd5b5061482584828501614703565b6040830152506060820135606082015292915050565b80151581146107cd57600080fd5b80356143e68161483b565b600060c0828403121561486657600080fd5b60405160c0810167ffffffffffffffff828210818311171561488a5761488a614408565b816040528293508435915061489e82614506565b9082526020840135906148b082614506565b81602084015260408501359150808211156148ca57600080fd5b506148d785828601614703565b6040830152506060830135606082015260808301356148f5816143c6565b608082015261490660a08401614849565b60a08201525092915050565b60006040828403121561492457600080fd5b61492c61441e565b90508135614939816143c6565b815260208201356149498161483b565b602082015292915050565b60008060006080848603121561496957600080fd5b833567ffffffffffffffff8082111561498157600080fd5b818601915086601f83011261499557600080fd5b813560206149a561453d836144e2565b82815260059290921b8401810191818101908a8411156149c457600080fd5b8286015b84811015614aa4578035868111156149df57600080fd5b8701610100818e03601f190112156149f657600080fd5b6149fe61446a565b8582013588811115614a0f57600080fd5b614a1d8f8883860101614754565b825250604082013588811115614a3257600080fd5b614a408f88838601016147af565b8783015250614a51606083016143db565b6040820152614a62608083016143db565b606082015260a0820135608082015260c082013560a082015260e082013560c082015261010082013560e08201528085525050838301925083810190506149c8565b5097505087013592505080821115614abb57600080fd5b50614ac886828701614854565b925050614ad88560408601614912565b90509250925092565b600060208284031215614af357600080fd5b813561198681614506565b600082601f830112614b0f57600080fd5b81356020614b1f61453d836144e2565b82815260059290921b84018101918181019086841115614b3e57600080fd5b8286015b8481101561458557803567ffffffffffffffff811115614b625760008081fd5b614b708986838b0101614703565b845250918301918301614b42565b600080600060608486031215614b9357600080fd5b833567ffffffffffffffff80821115614bab57600080fd5b614bb78783880161451c565b94506020860135915080821115614bcd57600080fd5b614bd987838801614afe565b93506040860135915080821115614bef57600080fd5b50614bfc8682870161451c565b9150509250925092565b60008060008060808587031215614c1c57600080fd5b8435614c27816143c6565b93506020850135614c37816143c6565b92506040850135614c4781614506565b91506060850135614c57816143c6565b939692955090935050565b60008060408385031215614c7557600080fd5b823567ffffffffffffffff80821115614c8d57600080fd5b614c9986838701614afe565b9350602085013591508082111561463b57600080fd5b60008060008060808587031215614cc557600080fd5b8435614cd0816143c6565b93506020850135614ce081614506565b9250604085013567ffffffffffffffff811115614cfc57600080fd5b614d0887828801614703565b9250506060850135614c57816143c6565b634e487b7160e01b600052602160045260246000fd5b6020810160038310614d5157634e487b7160e01b600052602160045260246000fd5b91905290565b60008060408385031215614d6a57600080fd5b8235614d75816143c6565b915060208301356001600160e01b031981168114614d9257600080fd5b809150509250929050565b6000806000806000806000806000806101408b8d031215614dbd57600080fd5b614dc68b614849565b9950614dd460208c016143db565b9850614de260408c016143db565b9750614df060608c016143db565b9650614dfe60808c016143db565b955060a08b013567ffffffffffffffff80821115614e1b57600080fd5b614e278e838f0161451c565b965060c08d0135915080821115614e3d57600080fd5b614e498e838f01614afe565b955060e08d0135915080821115614e5f57600080fd5b614e6b8e838f0161451c565b94506101008d0135915080821115614e8257600080fd5b614e8e8e838f01614afe565b93506101208d0135915080821115614ea557600080fd5b50614eb28d828e0161451c565b9150509295989b9194979a5092959850565b600060208284031215614ed657600080fd5b5035919050565b600060208284031215614eef57600080fd5b5051919050565b634e487b7160e01b600052603260045260246000fd5b80516143e6816143c6565b60005b83811015614f32578181015183820152602001614f1a565b83811115611cf75750506000910152565b6000614f5161453d846146db565b9050828152838383011115614f6557600080fd5b611986836020830184614f17565b600082601f830112614f8457600080fd5b61198683835160208501614f43565b600060408284031215614fa557600080fd5b614fad61441e565b90508151614fba816143c6565b8152602082015167ffffffffffffffff811115614fd657600080fd5b6147a384828501614f73565b600060808284031215614ff457600080fd5b614ffc614447565b9050815161500981614506565b8152602082015167ffffffffffffffff8082111561502657600080fd5b818401915084601f83011261503a57600080fd5b61504985835160208501614f43565b6020840152604084015191508082111561506257600080fd5b5061506f84828501614f73565b6040830152506060820151606082015292915050565b60006040828403121561509757600080fd5b61509f61441e565b905081516150ac816143c6565b815260208201516149498161483b565b600060208083850312156150cf57600080fd5b825167ffffffffffffffff808211156150e757600080fd5b90840190608082870312156150fb57600080fd5b61510361448e565b82518152838301518281111561511857600080fd5b8301601f8101881361512957600080fd5b805161513761453d826144e2565b81815260059190911b8201860190868101908a83111561515657600080fd5b8784015b838110156152365780518781111561517157600080fd5b8501610100818e03601f1901121561518857600080fd5b61519061446a565b8a820151898111156151a157600080fd5b6151af8f8d83860101614f93565b8252506040820151898111156151c457600080fd5b6151d28f8d83860101614fe2565b8c830152506151e360608301614f0c565b60408201526151f460808301614f0c565b606082015260a0820151608082015260c082015160a082015260e082015160c082015261010082015160e082015280855250508883019250888101905061515a565b5080888601525050505061524d8760408501615085565b60408201529695505050505050565b634e487b7160e01b600052601160045260246000fd5b6000828210156152845761528461525c565b500390565b60006001820161529b5761529b61525c565b5060010190565b600081518084526020808501945080840160005b838110156152db5781516001600160a01b0316875295820195908201906001016152b6565b509495945050505050565b604080825283519082018190526000906020906060840190828701845b8281101561532957815167ffffffffffffffff1684529284019290840190600101615303565b5050508381038285015261533d81866152a2565b9695505050505050565b805160208201516001600160e01b031980821692919060048310156153765780818460040360031b1b83161693505b505050919050565b60008151808452615396816020860160208601614f17565b601f01601f19169290920160200192915050565b6001600160a01b0381511682526000602082015160406020850152613e12604085018261537e565b60208152600061198660208301846153aa565b6000806000606084860312156153fa57600080fd5b83519250602084015161540c816143c6565b604085015190925061541d816143c6565b809150509250925092565b60608152600061543b606083018661537e565b90508360208301526001600160a01b0383166040830152949350505050565b60006020828403121561546c57600080fd5b815167ffffffffffffffff81111561548357600080fd5b613e1284828501614f73565b600082516154a1818460208701614f17565b9190910192915050565b6000602080835260a08084018551838601528286015160806040818189015283835180865260c09550858a019150858160051b8b0101888601955060005b828110156155c85760bf198c830301845286516101008151818552615510828601826153aa565b9150508b8201518482038d86015267ffffffffffffffff81511682528c810151898e8401526155418a84018261537e565b9050888201518382038a850152615558828261537e565b9150506060808301518185015289850151935061557f8a8801856001600160a01b03169052565b808501516001600160a01b031690870152898401518a8701528c8401518d8701528b8401518c87015260e0938401519390950192909252505095890195928901926001016154e9565b5092909a015180516001600160a01b031660608b015260200151151560809099019890985298975050505050505050565b602081526000611986602083018461537e565b6001600160a01b038416815267ffffffffffffffff83166020820152606060408201526000612471606083018461537e565b600082198211156156515761565161525c565b500190565b6000604082016040835280855180835260608501915060608160051b8601019250602080880160005b838110156156ad57605f1988870301855261569b86835161537e565b9550938201939082019060010161567f565b50508584038187015250505061247181856152a2565b6000602082840312156156d557600080fd5b81516119868161483b565b67ffffffffffffffff8616815260006001600160a01b03808716602084015285604084015280851660608401525060a06080830152613ff160a083018461537e565b600181815b8085111561575d5781600019048211156157435761574361525c565b8085161561575057918102915b93841c9390800290615727565b509250929050565b6000826157745750600161371a565b816157815750600061371a565b816001811461579757600281146157a1576157bd565b600191505061371a565b60ff8411156157b2576157b261525c565b50506001821b61371a565b5060208310610133831016604e8410600b84101617156157e0575081810a61371a565b6157ea8383615722565b80600019048211156157fe576157fe61525c565b029392505050565b6000611986838361576556fe608060405234801561001057600080fd5b506101ba806100206000396000f3fe608060405234801561001057600080fd5b506004361061002b5760003560e01c8063aad3ec9614610030575b600080fd5b61004361003e366004610104565b610045565b005b604080513360248201819052604480830185905283518084039091018152606490920183526020820180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff1663a9059cbb60e01b179052915173ffffffffffffffffffffffffffffffffffffffff8516916100bc91610149565b6000604051808303816000865af19150503d80600081146100f9576040519150601f19603f3d011682016040523d82523d6000602084013e6100fe565b606091505b50505080ff5b6000806040838503121561011757600080fd5b823573ffffffffffffffffffffffffffffffffffffffff8116811461013b57600080fd5b946020939093013593505050565b6000825160005b8181101561016a5760208186018101518583015201610150565b81811115610179576000828501525b50919091019291505056fea2646970667358221220596a029e19ba353d69291cd33136a82a60ef181cd9690abbbe3fe4a98c3c68c064736f6c634300080f00334f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572a2646970667358221220b75e4ee5e2ad36c284fe4795679834ff37f5bbb6b76e4f0c10dd978570cd68c764736f6c634300080f0033
Constructor Arguments (ABI-Encoded and is the last bytes of the Contract Creation Code above)
00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000d71d18126e03646eb09fec929e2ae87b7cae69d0000000000000000000000004200000000000000000000000000000000000006
-----Decoded View---------------
Arg [0] : _testMode (bool): False
Arg [1] : _messageBus (address): 0x0D71D18126E03646eb09FEc929e2ae87b7CAE69d
Arg [2] : _nativeWrap (address): 0x4200000000000000000000000000000000000006
-----Encoded View---------------
3 Constructor Arguments found :
Arg [0] : 0000000000000000000000000000000000000000000000000000000000000000
Arg [1] : 0000000000000000000000000d71d18126e03646eb09fec929e2ae87b7cae69d
Arg [2] : 0000000000000000000000004200000000000000000000000000000000000006
Loading...
Loading
Loading...
Loading
Loading...
Loading
Net Worth in USD
$0.00
Net Worth in ETH
0
Multichain Portfolio | 34 Chains
| Chain | Token | Portfolio % | Price | Amount | Value |
|---|
Loading...
Loading
Loading...
Loading
Loading...
Loading
[ Download: CSV Export ]
A contract address hosts a smart contract, which is a set of code stored on the blockchain that runs when predetermined conditions are met. Learn more about addresses in our Knowledge Base.