Overview
ETH Balance
0 ETH
ETH Value
$0.00Token Holdings
More Info
Private Name Tags
ContractCreator
Latest 4 from a total of 4 transactions
Latest 25 internal transactions (View All)
Advanced mode:
Parent Transaction Hash | Block | From | To | |||
---|---|---|---|---|---|---|
129037236 | 6 mins ago | 0.002688789225128 ETH | ||||
129037236 | 6 mins ago | 0.002688789225128 ETH | ||||
129037201 | 7 mins ago | 0.000107755165808 ETH | ||||
129037201 | 7 mins ago | 0.000108042775808 ETH | ||||
129037201 | 7 mins ago | 0.000215797941617 ETH | ||||
129028663 | 4 hrs ago | 0.0011376589345 ETH | ||||
129028663 | 4 hrs ago | 0.0011376589345 ETH | ||||
129028628 | 4 hrs ago | 0.000105569957808 ETH | ||||
129028628 | 4 hrs ago | 0.000105731567808 ETH | ||||
129028628 | 4 hrs ago | 0.000211301525617 ETH | ||||
129028075 | 5 hrs ago | 0.002450584620317 ETH | ||||
129028075 | 5 hrs ago | 0.002450584620317 ETH | ||||
129028037 | 5 hrs ago | 0.000105569957808 ETH | ||||
129028037 | 5 hrs ago | 0.000105731567808 ETH | ||||
129028037 | 5 hrs ago | 0.000211301525617 ETH | ||||
129024298 | 7 hrs ago | 0.00114299781908 ETH | ||||
129024298 | 7 hrs ago | 0.00114299781908 ETH | ||||
129024265 | 7 hrs ago | 0.000105352677808 ETH | ||||
129024265 | 7 hrs ago | 0.000105501687808 ETH | ||||
129024265 | 7 hrs ago | 0.000210854365617 ETH | ||||
129024119 | 7 hrs ago | 0.001143820277219 ETH | ||||
129024119 | 7 hrs ago | 0.001143820277219 ETH | ||||
129024082 | 7 hrs ago | 0.000105352677808 ETH | ||||
129024082 | 7 hrs ago | 0.000105501687808 ETH | ||||
129024082 | 7 hrs ago | 0.000210854365617 ETH |
Loading...
Loading
Contract Name:
AuraSrcSwapper
Compiler Version
v0.8.15+commit.e14f2714
Optimization Enabled:
Yes with 200 runs
Other Settings:
default evmVersion
Contract Source Code (Solidity Standard Json-Input format)
// SPDX-License-Identifier: MIT pragma solidity ^0.8.0; import "@openzeppelin-4/contracts/token/ERC20/ERC20.sol"; import "@openzeppelin-4/contracts/token/ERC20/utils/SafeERC20.sol"; import "../../interfaces/common/IWrappedNative.sol"; import "../../lz/NonblockingLzAp.sol"; import "../../utils/UniV3Actions.sol"; interface IOFT { function sendFrom( address _from, uint16 _dstChainId, bytes calldata _toAddress, uint256 _amount, address payable _refundAddress, address _zroPaymentAddress, bytes calldata _adapterParams ) external payable; function estimateSendFee( uint16 _dstChainId, bytes calldata _toAddress, uint256 _amount, bool _useZro, bytes calldata _adapterParams ) external view returns (uint256 nativeFee, uint256 zroFee); } // Swaps Aura and sends ETH back to src chain strategy contract AuraSrcSwapper is NonblockingLzApp { using SafeERC20 for IERC20; address public aura; address public native; address public stargate; bytes public auraSwapper; uint256 public gasLimit; struct SwapConfig { bool shouldSwap; address router; bytes path; address tokenFrom; address tokenTo; bool deadline; } SwapConfig public swapConfig; mapping(address => bool) public operators; // Operators allowed to call retry(). uint16 public dstChainId; uint16 private version = 1; // Errors error NotEnoughAura(); error NotEnoughEth(); error EtherTransferFailure(); error NotAuthorized(); event Swap(address _strategy, uint256 _amount); event SwapCompleted(address _strategy, uint256 _amount); event Error(); constructor ( address _aura, address _native, address _stargate, address _endpoint, bytes memory _auraSwapper, uint16 _dstChainId ) NonblockingLzApp(_endpoint) { aura = _aura; native = _native; stargate = _stargate; auraSwapper = _auraSwapper; dstChainId = _dstChainId; } modifier onlyAuth { if (!operators[msg.sender] && msg.sender != owner()) revert NotAuthorized(); _; } function _returnNative(address _strategy) public { if (msg.sender != address(this)) revert NotAuthorized(); if (swapConfig.shouldSwap) { uint256 bal = IERC20(swapConfig.tokenFrom).balanceOf(address(this)); _approveTokenIfNeeded(swapConfig.router, swapConfig.tokenFrom); if (swapConfig.deadline) UniV3Actions.swapV3WithDeadline(swapConfig.router, swapConfig.path, bal); else UniV3Actions.swapV3(swapConfig.router, swapConfig.path, bal); } uint256 _amount = address(this).balance; uint256 wrappedBalance = IERC20(native).balanceOf(address(this)); if (_amount > 0) IWrappedNative(native).deposit{ value: _amount}(); _amount += wrappedBalance; IERC20(native).safeTransfer(_strategy, _amount); emit SwapCompleted(_strategy, _amount); } function sgReceive( uint16 /*_chainId */, bytes memory /* _srcAddress */, uint256 /* _nonce */, address /*token*/, uint256 /*amountLD*/, bytes memory payload ) external payable { if (msg.sender != stargate) revert NotAuthorized(); address strategy = abi.decode(payload, (address)); try this._returnNative(strategy) { // Do Nothing } catch { emit Error(); } } function swapAura(uint256 _amount) external payable { IERC20(aura).safeTransferFrom(msg.sender, address(this), _amount); bytes memory adapterParams = abi.encodePacked(version, gasLimit); bytes memory payload = abi.encode(msg.sender, _amount); (uint256 transferGas, ) = IOFT(aura).estimateSendFee( dstChainId, auraSwapper, _amount, false, adapterParams ); (uint256 messageGas,) = lzEndpoint.estimateFees( dstChainId, address(this), payload, false, adapterParams ); IOFT(aura).sendFrom{value: transferGas}( address(this), dstChainId, auraSwapper, _amount, payable(msg.sender), address(0), '' ); _lzSend( // {value: messageFee} will be paid out of this contract! dstChainId, // destination chainId payload, // abi.encode()'ed bytes payable(msg.sender), // (msg.sender will be this contract) refund address (LayerZero will refund any extra gas back to caller of send() address(0x0), // future param, unused for this example adapterParams, // v1 adapterParams, specify custom destination gas qty messageGas ); emit Swap(msg.sender, _amount); } function estimate(uint256 _amount) external view returns (uint256 gasNeeded) { bytes memory adapterParams = abi.encodePacked(version, gasLimit); bytes memory payload = abi.encode(msg.sender, _amount); (uint256 transferGas, ) = IOFT(aura).estimateSendFee( dstChainId, auraSwapper, _amount, false, adapterParams ); (uint256 messageGas,) = lzEndpoint.estimateFees( dstChainId, address(this), payload, false, adapterParams ); return transferGas + messageGas; } function setOperator(address _operator, bool _status) external onlyOwner { operators[_operator] = _status; } function setBridgeConfig(uint256 _gasLimit, bytes memory _auraSwapper, address _stargate) external onlyOwner { if (_gasLimit > 0) gasLimit = _gasLimit; if (_auraSwapper.length > 0) auraSwapper = _auraSwapper; if (_stargate != address(0)) stargate = _stargate; } function setSwap(SwapConfig calldata _swapConfig) external onlyOwner { swapConfig = _swapConfig; } // recover any tokens sent on error function inCaseTokensGetStuck(address _token, bool _native) external onlyOwner { if (_native) { uint256 _nativeAmount = address(this).balance; (bool sent,) = msg.sender.call{value: _nativeAmount}(""); if (!sent) revert EtherTransferFailure(); } else { uint256 _amount = IERC20(_token).balanceOf(address(this)); IERC20(_token).safeTransfer(msg.sender, _amount); } } function _nonblockingLzReceive(uint16, bytes memory, uint64, bytes memory) internal override {} function _approveTokenIfNeeded(address token, address spender) private { if (IERC20(token).allowance(address(this), spender) == 0) { IERC20(token).safeApprove(spender, type(uint256).max); } } // allow this contract to receive ether receive() external payable {} }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.7.0) (access/Ownable.sol) pragma solidity ^0.8.0; import "../utils/Context.sol"; /** * @dev Contract module which provides a basic access control mechanism, where * there is an account (an owner) that can be granted exclusive access to * specific functions. * * By default, the owner account will be the one that deploys the contract. This * can later be changed with {transferOwnership}. * * This module is used through inheritance. It will make available the modifier * `onlyOwner`, which can be applied to your functions to restrict their use to * the owner. */ abstract contract Ownable is Context { address private _owner; event OwnershipTransferred(address indexed previousOwner, address indexed newOwner); /** * @dev Initializes the contract setting the deployer as the initial owner. */ constructor() { _transferOwnership(_msgSender()); } /** * @dev Throws if called by any account other than the owner. */ modifier onlyOwner() { _checkOwner(); _; } /** * @dev Returns the address of the current owner. */ function owner() public view virtual returns (address) { return _owner; } /** * @dev Throws if the sender is not the owner. */ function _checkOwner() internal view virtual { require(owner() == _msgSender(), "Ownable: caller is not the owner"); } /** * @dev Leaves the contract without owner. It will not be possible to call * `onlyOwner` functions anymore. Can only be called by the current owner. * * NOTE: Renouncing ownership will leave the contract without an owner, * thereby removing any functionality that is only available to the owner. */ function renounceOwnership() public virtual onlyOwner { _transferOwnership(address(0)); } /** * @dev Transfers ownership of the contract to a new account (`newOwner`). * Can only be called by the current owner. */ function transferOwnership(address newOwner) public virtual onlyOwner { require(newOwner != address(0), "Ownable: new owner is the zero address"); _transferOwnership(newOwner); } /** * @dev Transfers ownership of the contract to a new account (`newOwner`). * Internal function without access restriction. */ function _transferOwnership(address newOwner) internal virtual { address oldOwner = _owner; _owner = newOwner; emit OwnershipTransferred(oldOwner, newOwner); } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.8.0) (token/ERC20/ERC20.sol) pragma solidity ^0.8.0; import "./IERC20.sol"; import "./extensions/IERC20Metadata.sol"; import "../../utils/Context.sol"; /** * @dev Implementation of the {IERC20} interface. * * This implementation is agnostic to the way tokens are created. This means * that a supply mechanism has to be added in a derived contract using {_mint}. * For a generic mechanism see {ERC20PresetMinterPauser}. * * TIP: For a detailed writeup see our guide * https://forum.openzeppelin.com/t/how-to-implement-erc20-supply-mechanisms/226[How * to implement supply mechanisms]. * * We have followed general OpenZeppelin Contracts guidelines: functions revert * instead returning `false` on failure. This behavior is nonetheless * conventional and does not conflict with the expectations of ERC20 * applications. * * Additionally, an {Approval} event is emitted on calls to {transferFrom}. * This allows applications to reconstruct the allowance for all accounts just * by listening to said events. Other implementations of the EIP may not emit * these events, as it isn't required by the specification. * * Finally, the non-standard {decreaseAllowance} and {increaseAllowance} * functions have been added to mitigate the well-known issues around setting * allowances. See {IERC20-approve}. */ contract ERC20 is Context, IERC20, IERC20Metadata { mapping(address => uint256) private _balances; mapping(address => mapping(address => uint256)) private _allowances; uint256 private _totalSupply; string private _name; string private _symbol; /** * @dev Sets the values for {name} and {symbol}. * * The default value of {decimals} is 18. To select a different value for * {decimals} you should overload it. * * All two of these values are immutable: they can only be set once during * construction. */ constructor(string memory name_, string memory symbol_) { _name = name_; _symbol = symbol_; } /** * @dev Returns the name of the token. */ function name() public view virtual override returns (string memory) { return _name; } /** * @dev Returns the symbol of the token, usually a shorter version of the * name. */ function symbol() public view virtual override returns (string memory) { return _symbol; } /** * @dev Returns the number of decimals used to get its user representation. * For example, if `decimals` equals `2`, a balance of `505` tokens should * be displayed to a user as `5.05` (`505 / 10 ** 2`). * * Tokens usually opt for a value of 18, imitating the relationship between * Ether and Wei. This is the value {ERC20} uses, unless this function is * overridden; * * NOTE: This information is only used for _display_ purposes: it in * no way affects any of the arithmetic of the contract, including * {IERC20-balanceOf} and {IERC20-transfer}. */ function decimals() public view virtual override returns (uint8) { return 18; } /** * @dev See {IERC20-totalSupply}. */ function totalSupply() public view virtual override returns (uint256) { return _totalSupply; } /** * @dev See {IERC20-balanceOf}. */ function balanceOf(address account) public view virtual override returns (uint256) { return _balances[account]; } /** * @dev See {IERC20-transfer}. * * Requirements: * * - `to` cannot be the zero address. * - the caller must have a balance of at least `amount`. */ function transfer(address to, uint256 amount) public virtual override returns (bool) { address owner = _msgSender(); _transfer(owner, to, amount); return true; } /** * @dev See {IERC20-allowance}. */ function allowance(address owner, address spender) public view virtual override returns (uint256) { return _allowances[owner][spender]; } /** * @dev See {IERC20-approve}. * * NOTE: If `amount` is the maximum `uint256`, the allowance is not updated on * `transferFrom`. This is semantically equivalent to an infinite approval. * * Requirements: * * - `spender` cannot be the zero address. */ function approve(address spender, uint256 amount) public virtual override returns (bool) { address owner = _msgSender(); _approve(owner, spender, amount); return true; } /** * @dev See {IERC20-transferFrom}. * * Emits an {Approval} event indicating the updated allowance. This is not * required by the EIP. See the note at the beginning of {ERC20}. * * NOTE: Does not update the allowance if the current allowance * is the maximum `uint256`. * * Requirements: * * - `from` and `to` cannot be the zero address. * - `from` must have a balance of at least `amount`. * - the caller must have allowance for ``from``'s tokens of at least * `amount`. */ function transferFrom( address from, address to, uint256 amount ) public virtual override returns (bool) { address spender = _msgSender(); _spendAllowance(from, spender, amount); _transfer(from, to, amount); return true; } /** * @dev Atomically increases the allowance granted to `spender` by the caller. * * This is an alternative to {approve} that can be used as a mitigation for * problems described in {IERC20-approve}. * * Emits an {Approval} event indicating the updated allowance. * * Requirements: * * - `spender` cannot be the zero address. */ function increaseAllowance(address spender, uint256 addedValue) public virtual returns (bool) { address owner = _msgSender(); _approve(owner, spender, allowance(owner, spender) + addedValue); return true; } /** * @dev Atomically decreases the allowance granted to `spender` by the caller. * * This is an alternative to {approve} that can be used as a mitigation for * problems described in {IERC20-approve}. * * Emits an {Approval} event indicating the updated allowance. * * Requirements: * * - `spender` cannot be the zero address. * - `spender` must have allowance for the caller of at least * `subtractedValue`. */ function decreaseAllowance(address spender, uint256 subtractedValue) public virtual returns (bool) { address owner = _msgSender(); uint256 currentAllowance = allowance(owner, spender); require(currentAllowance >= subtractedValue, "ERC20: decreased allowance below zero"); unchecked { _approve(owner, spender, currentAllowance - subtractedValue); } return true; } /** * @dev Moves `amount` of tokens from `from` to `to`. * * This internal function is equivalent to {transfer}, and can be used to * e.g. implement automatic token fees, slashing mechanisms, etc. * * Emits a {Transfer} event. * * Requirements: * * - `from` cannot be the zero address. * - `to` cannot be the zero address. * - `from` must have a balance of at least `amount`. */ function _transfer( address from, address to, uint256 amount ) internal virtual { require(from != address(0), "ERC20: transfer from the zero address"); require(to != address(0), "ERC20: transfer to the zero address"); _beforeTokenTransfer(from, to, amount); uint256 fromBalance = _balances[from]; require(fromBalance >= amount, "ERC20: transfer amount exceeds balance"); unchecked { _balances[from] = fromBalance - amount; // Overflow not possible: the sum of all balances is capped by totalSupply, and the sum is preserved by // decrementing then incrementing. _balances[to] += amount; } emit Transfer(from, to, amount); _afterTokenTransfer(from, to, amount); } /** @dev Creates `amount` tokens and assigns them to `account`, increasing * the total supply. * * Emits a {Transfer} event with `from` set to the zero address. * * Requirements: * * - `account` cannot be the zero address. */ function _mint(address account, uint256 amount) internal virtual { require(account != address(0), "ERC20: mint to the zero address"); _beforeTokenTransfer(address(0), account, amount); _totalSupply += amount; unchecked { // Overflow not possible: balance + amount is at most totalSupply + amount, which is checked above. _balances[account] += amount; } emit Transfer(address(0), account, amount); _afterTokenTransfer(address(0), account, amount); } /** * @dev Destroys `amount` tokens from `account`, reducing the * total supply. * * Emits a {Transfer} event with `to` set to the zero address. * * Requirements: * * - `account` cannot be the zero address. * - `account` must have at least `amount` tokens. */ function _burn(address account, uint256 amount) internal virtual { require(account != address(0), "ERC20: burn from the zero address"); _beforeTokenTransfer(account, address(0), amount); uint256 accountBalance = _balances[account]; require(accountBalance >= amount, "ERC20: burn amount exceeds balance"); unchecked { _balances[account] = accountBalance - amount; // Overflow not possible: amount <= accountBalance <= totalSupply. _totalSupply -= amount; } emit Transfer(account, address(0), amount); _afterTokenTransfer(account, address(0), amount); } /** * @dev Sets `amount` as the allowance of `spender` over the `owner` s tokens. * * This internal function is equivalent to `approve`, and can be used to * e.g. set automatic allowances for certain subsystems, etc. * * Emits an {Approval} event. * * Requirements: * * - `owner` cannot be the zero address. * - `spender` cannot be the zero address. */ function _approve( address owner, address spender, uint256 amount ) internal virtual { require(owner != address(0), "ERC20: approve from the zero address"); require(spender != address(0), "ERC20: approve to the zero address"); _allowances[owner][spender] = amount; emit Approval(owner, spender, amount); } /** * @dev Updates `owner` s allowance for `spender` based on spent `amount`. * * Does not update the allowance amount in case of infinite allowance. * Revert if not enough allowance is available. * * Might emit an {Approval} event. */ function _spendAllowance( address owner, address spender, uint256 amount ) internal virtual { uint256 currentAllowance = allowance(owner, spender); if (currentAllowance != type(uint256).max) { require(currentAllowance >= amount, "ERC20: insufficient allowance"); unchecked { _approve(owner, spender, currentAllowance - amount); } } } /** * @dev Hook that is called before any transfer of tokens. This includes * minting and burning. * * Calling conditions: * * - when `from` and `to` are both non-zero, `amount` of ``from``'s tokens * will be transferred to `to`. * - when `from` is zero, `amount` tokens will be minted for `to`. * - when `to` is zero, `amount` of ``from``'s tokens will be burned. * - `from` and `to` are never both zero. * * To learn more about hooks, head to xref:ROOT:extending-contracts.adoc#using-hooks[Using Hooks]. */ function _beforeTokenTransfer( address from, address to, uint256 amount ) internal virtual {} /** * @dev Hook that is called after any transfer of tokens. This includes * minting and burning. * * Calling conditions: * * - when `from` and `to` are both non-zero, `amount` of ``from``'s tokens * has been transferred to `to`. * - when `from` is zero, `amount` tokens have been minted for `to`. * - when `to` is zero, `amount` of ``from``'s tokens have been burned. * - `from` and `to` are never both zero. * * To learn more about hooks, head to xref:ROOT:extending-contracts.adoc#using-hooks[Using Hooks]. */ function _afterTokenTransfer( address from, address to, uint256 amount ) internal virtual {} }
// 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 v4.4.1 (token/ERC20/extensions/IERC20Metadata.sol) pragma solidity ^0.8.0; import "../IERC20.sol"; /** * @dev Interface for the optional metadata functions from the ERC20 standard. * * _Available since v4.1._ */ interface IERC20Metadata is IERC20 { /** * @dev Returns the name of the token. */ function name() external view returns (string memory); /** * @dev Returns the symbol of the token. */ function symbol() external view returns (string memory); /** * @dev Returns the decimals places of the token. */ function decimals() external view returns (uint8); }
// 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.8.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.8.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 functionCallWithValue(target, data, 0, "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"); (bool success, bytes memory returndata) = target.call{value: value}(data); return verifyCallResultFromTarget(target, 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) { (bool success, bytes memory returndata) = target.staticcall(data); return verifyCallResultFromTarget(target, 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) { (bool success, bytes memory returndata) = target.delegatecall(data); return verifyCallResultFromTarget(target, success, returndata, errorMessage); } /** * @dev Tool to verify that a low level call to smart-contract was successful, and revert (either by bubbling * the revert reason or using the provided one) in case of unsuccessful call or if target was not a contract. * * _Available since v4.8._ */ function verifyCallResultFromTarget( address target, bool success, bytes memory returndata, string memory errorMessage ) internal view returns (bytes memory) { if (success) { if (returndata.length == 0) { // only check isContract if the call was successful and the return data is empty // otherwise we already know that it was a contract require(isContract(target), "Address: call to non-contract"); } return returndata; } else { _revert(returndata, errorMessage); } } /** * @dev Tool to verify that a low level call was successful, and revert if it wasn't, either by bubbling the * revert reason or 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 { _revert(returndata, errorMessage); } } function _revert(bytes memory returndata, string memory errorMessage) private pure { // 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 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; } }
// SPDX-License-Identifier: MIT pragma solidity ^0.8.0; interface IKyberElastic { struct ExactInputSingleParams { address tokenIn; address tokenOut; uint24 fee; address recipient; uint256 deadline; uint256 amountIn; uint256 minAmountOut; uint160 limitSqrtP; } /// @notice Swaps `amountIn` of one token for as much as possible of another token /// @param params The parameters necessary for the swap, encoded as `ExactInputSingleParams` in calldata /// @return amountOut The amount of the received token function swapExactInputSingle(ExactInputSingleParams calldata params) external payable returns (uint256 amountOut); struct ExactInputParams { bytes path; address recipient; uint256 deadline; uint256 amountIn; uint256 minAmountOut; } /// @notice Swaps `amountIn` of one token for as much as possible of another along the specified path /// @param params The parameters necessary for the multi-hop swap, encoded as `ExactInputParams` in calldata /// @return amountOut The amount of the received token function swapExactInput(ExactInputParams calldata params) external payable returns (uint256 amountOut); struct ExactOutputSingleParams { address tokenIn; address tokenOut; uint24 fee; address recipient; uint256 deadline; uint256 amountOut; uint256 maxAmountIn; uint160 limitSqrtP; } /// @notice Swaps as little as possible of one token for `amountOut` of another token /// @param params The parameters necessary for the swap, encoded as `ExactOutputSingleParams` in calldata /// @return amountIn The amount of the input token function swapExactOutputSingle(ExactOutputSingleParams calldata params) external payable returns (uint256 amountIn); struct ExactOutputParams { bytes path; address recipient; uint256 deadline; uint256 amountOut; uint256 maxAmountIn; } /// @notice Swaps as little as possible of one token for `amountOut` of another along the specified path (reversed) /// @param params The parameters necessary for the multi-hop swap, encoded as `ExactOutputParams` in calldata /// @return amountIn The amount of the input token function swapExactOutput(ExactOutputParams calldata params) external payable returns (uint256 amountIn); }
// SPDX-License-Identifier: MIT pragma solidity >=0.6.0 <0.9.0; interface ITraderJoeRouter { /** * @dev This enum represents the version of the pair requested * - V1: Joe V1 pair * - V2: LB pair V2. Also called legacyPair * - V2_1: LB pair V2.1 (current version) */ enum Version { V1, V2, V2_1 } /** * @dev The path parameters, such as: * - pairBinSteps: The list of bin steps of the pairs to go through * - versions: The list of versions of the pairs to go through * - tokenPath: The list of tokens in the path to go through */ struct Path { uint256[] pairBinSteps; Version[] versions; address[] tokenPath; } function swapExactTokensForTokens( uint256 amountIn, uint256 amountOutMin, Path memory path, address to, uint256 deadline ) external returns (uint256 amountOut); }
// SPDX-License-Identifier: MIT pragma solidity ^0.8.0; interface IUniswapRouterV3 { struct ExactInputSingleParams { address tokenIn; address tokenOut; uint24 fee; address recipient; uint256 amountIn; uint256 amountOutMinimum; uint160 sqrtPriceLimitX96; } /// @notice Swaps `amountIn` of one token for as much as possible of another token /// @param params The parameters necessary for the swap, encoded as `ExactInputSingleParams` in calldata /// @return amountOut The amount of the received token function exactInputSingle(ExactInputSingleParams calldata params) external payable returns (uint256 amountOut); struct ExactInputParams { bytes path; address recipient; uint256 amountIn; uint256 amountOutMinimum; } /// @notice Swaps `amountIn` of one token for as much as possible of another along the specified path /// @param params The parameters necessary for the multi-hop swap, encoded as `ExactInputParams` in calldata /// @return amountOut The amount of the received token function exactInput(ExactInputParams calldata params) external payable returns (uint256 amountOut); struct ExactOutputSingleParams { address tokenIn; address tokenOut; uint24 fee; address recipient; uint256 amountOut; uint256 amountInMaximum; uint160 sqrtPriceLimitX96; } /// @notice Swaps as little as possible of one token for `amountOut` of another token /// @param params The parameters necessary for the swap, encoded as `ExactOutputSingleParams` in calldata /// @return amountIn The amount of the input token function exactOutputSingle(ExactOutputSingleParams calldata params) external payable returns (uint256 amountIn); struct ExactOutputParams { bytes path; address recipient; uint256 amountOut; uint256 amountInMaximum; } /// @notice Swaps as little as possible of one token for `amountOut` of another along the specified path (reversed) /// @param params The parameters necessary for the multi-hop swap, encoded as `ExactOutputParams` in calldata /// @return amountIn The amount of the input token function exactOutput(ExactOutputParams calldata params) external payable returns (uint256 amountIn); }
// SPDX-License-Identifier: MIT pragma solidity >=0.6.0; pragma experimental ABIEncoderV2; interface IUniswapRouterV3WithDeadline { struct ExactInputSingleParams { address tokenIn; address tokenOut; uint24 fee; address recipient; uint256 deadline; uint256 amountIn; uint256 amountOutMinimum; uint160 sqrtPriceLimitX96; } /// @notice Swaps `amountIn` of one token for as much as possible of another token /// @param params The parameters necessary for the swap, encoded as `ExactInputSingleParams` in calldata /// @return amountOut The amount of the received token function exactInputSingle(ExactInputSingleParams calldata params) external payable returns (uint256 amountOut); struct ExactInputParams { bytes path; address recipient; uint256 deadline; uint256 amountIn; uint256 amountOutMinimum; } /// @notice Swaps `amountIn` of one token for as much as possible of another along the specified path /// @param params The parameters necessary for the multi-hop swap, encoded as `ExactInputParams` in calldata /// @return amountOut The amount of the received token function exactInput(ExactInputParams calldata params) external payable returns (uint256 amountOut); struct ExactOutputSingleParams { address tokenIn; address tokenOut; uint24 fee; address recipient; uint256 deadline; uint256 amountOut; uint256 amountInMaximum; uint160 sqrtPriceLimitX96; } /// @notice Swaps as little as possible of one token for `amountOut` of another token /// @param params The parameters necessary for the swap, encoded as `ExactOutputSingleParams` in calldata /// @return amountIn The amount of the input token function exactOutputSingle(ExactOutputSingleParams calldata params) external payable returns (uint256 amountIn); struct ExactOutputParams { bytes path; address recipient; uint256 deadline; uint256 amountOut; uint256 amountInMaximum; } /// @notice Swaps as little as possible of one token for `amountOut` of another along the specified path (reversed) /// @param params The parameters necessary for the multi-hop swap, encoded as `ExactOutputParams` in calldata /// @return amountIn The amount of the input token function exactOutput(ExactOutputParams calldata params) external payable returns (uint256 amountIn); }
// SPDX-License-Identifier: MIT pragma solidity >=0.6.0 <0.9.0; interface IWrappedNative { function deposit() external payable; function withdraw(uint256 wad) external; }
// SPDX-License-Identifier: MIT pragma solidity >=0.5.0; import "./ILayerZeroUserApplicationConfig.sol"; interface ILayerZeroEndpoint is ILayerZeroUserApplicationConfig { // @notice send a LayerZero message to the specified address at a LayerZero endpoint. // @param _dstChainId - the destination chain identifier // @param _destination - the address on destination chain (in bytes). address length/format may vary by chains // @param _payload - a custom bytes payload to send to the destination contract // @param _refundAddress - if the source transaction is cheaper than the amount of value passed, refund the additional amount to this address // @param _zroPaymentAddress - the address of the ZRO token holder who would pay for the transaction // @param _adapterParams - parameters for custom functionality. e.g. receive airdropped native gas from the relayer on destination function send(uint16 _dstChainId, bytes calldata _destination, bytes calldata _payload, address payable _refundAddress, address _zroPaymentAddress, bytes calldata _adapterParams) external payable; // @notice used by the messaging library to publish verified payload // @param _srcChainId - the source chain identifier // @param _srcAddress - the source contract (as bytes) at the source chain // @param _dstAddress - the address on destination chain // @param _nonce - the unbound message ordering nonce // @param _gasLimit - the gas limit for external contract execution // @param _payload - verified payload to send to the destination contract function receivePayload(uint16 _srcChainId, bytes calldata _srcAddress, address _dstAddress, uint64 _nonce, uint _gasLimit, bytes calldata _payload) external; // @notice get the inboundNonce of a lzApp from a source chain which could be EVM or non-EVM chain // @param _srcChainId - the source chain identifier // @param _srcAddress - the source chain contract address function getInboundNonce(uint16 _srcChainId, bytes calldata _srcAddress) external view returns (uint64); // @notice get the outboundNonce from this source chain which, consequently, is always an EVM // @param _srcAddress - the source chain contract address function getOutboundNonce(uint16 _dstChainId, address _srcAddress) external view returns (uint64); // @notice gets a quote in source native gas, for the amount that send() requires to pay for message delivery // @param _dstChainId - the destination chain identifier // @param _userApplication - the user app address on this EVM chain // @param _payload - the custom message to send over LayerZero // @param _payInZRO - if false, user app pays the protocol fee in native token // @param _adapterParam - parameters for the adapter service, e.g. send some dust native token to dstChain function estimateFees(uint16 _dstChainId, address _userApplication, bytes calldata _payload, bool _payInZRO, bytes calldata _adapterParam) external view returns (uint nativeFee, uint zroFee); // @notice get this Endpoint's immutable source identifier function getChainId() external view returns (uint16); // @notice the interface to retry failed message on this Endpoint destination // @param _srcChainId - the source chain identifier // @param _srcAddress - the source chain contract address // @param _payload - the payload to be retried function retryPayload(uint16 _srcChainId, bytes calldata _srcAddress, bytes calldata _payload) external; // @notice query if any STORED payload (message blocking) at the endpoint. // @param _srcChainId - the source chain identifier // @param _srcAddress - the source chain contract address function hasStoredPayload(uint16 _srcChainId, bytes calldata _srcAddress) external view returns (bool); // @notice query if the _libraryAddress is valid for sending msgs. // @param _userApplication - the user app address on this EVM chain function getSendLibraryAddress(address _userApplication) external view returns (address); // @notice query if the _libraryAddress is valid for receiving msgs. // @param _userApplication - the user app address on this EVM chain function getReceiveLibraryAddress(address _userApplication) external view returns (address); // @notice query if the non-reentrancy guard for send() is on // @return true if the guard is on. false otherwise function isSendingPayload() external view returns (bool); // @notice query if the non-reentrancy guard for receive() is on // @return true if the guard is on. false otherwise function isReceivingPayload() external view returns (bool); // @notice get the configuration of the LayerZero messaging library of the specified version // @param _version - messaging library version // @param _chainId - the chainId for the pending config change // @param _userApplication - the contract address of the user application // @param _configType - type of configuration. every messaging library has its own convention. function getConfig(uint16 _version, uint16 _chainId, address _userApplication, uint _configType) external view returns (bytes memory); // @notice get the send() LayerZero messaging library version // @param _userApplication - the contract address of the user application function getSendVersion(address _userApplication) external view returns (uint16); // @notice get the lzReceive() LayerZero messaging library version // @param _userApplication - the contract address of the user application function getReceiveVersion(address _userApplication) external view returns (uint16); }
// SPDX-License-Identifier: MIT pragma solidity >=0.5.0; interface ILayerZeroReceiver { // @notice LayerZero endpoint will invoke this function to deliver the message on the destination // @param _srcChainId - the source endpoint identifier // @param _srcAddress - the source sending contract address from the source chain // @param _nonce - the ordered message nonce // @param _payload - the signed payload is the UA bytes has encoded to be sent function lzReceive(uint16 _srcChainId, bytes calldata _srcAddress, uint64 _nonce, bytes calldata _payload) external; }
// SPDX-License-Identifier: MIT pragma solidity >=0.5.0; interface ILayerZeroUserApplicationConfig { // @notice set the configuration of the LayerZero messaging library of the specified version // @param _version - messaging library version // @param _chainId - the chainId for the pending config change // @param _configType - type of configuration. every messaging library has its own convention. // @param _config - configuration in the bytes. can encode arbitrary content. function setConfig(uint16 _version, uint16 _chainId, uint _configType, bytes calldata _config) external; // @notice set the send() LayerZero messaging library version to _version // @param _version - new messaging library version function setSendVersion(uint16 _version) external; // @notice set the lzReceive() LayerZero messaging library version to _version // @param _version - new messaging library version function setReceiveVersion(uint16 _version) external; // @notice Only when the UA needs to resume the message flow in blocking mode and clear the stored payload // @param _srcChainId - the chainId of the source chain // @param _srcAddress - the contract address of the source contract at the source chain function forceResumeReceive(uint16 _srcChainId, bytes calldata _srcAddress) external; }
// SPDX-License-Identifier: MIT pragma solidity ^0.8.0; import "@openzeppelin-4/contracts/access/Ownable.sol"; import "./interfaces/ILayerZeroReceiver.sol"; import "./interfaces/ILayerZeroUserApplicationConfig.sol"; import "./interfaces/ILayerZeroEndpoint.sol"; import "./util/BytesLib.sol"; /* * a generic LzReceiver implementation */ abstract contract LzApp is Ownable, ILayerZeroReceiver, ILayerZeroUserApplicationConfig { using BytesLib for bytes; // ua can not send payload larger than this by default, but it can be changed by the ua owner uint constant public DEFAULT_PAYLOAD_SIZE_LIMIT = 10000; ILayerZeroEndpoint public immutable lzEndpoint; mapping(uint16 => bytes) public trustedRemoteLookup; mapping(uint16 => mapping(uint16 => uint)) public minDstGasLookup; mapping(uint16 => uint) public payloadSizeLimitLookup; address public precrime; event SetPrecrime(address precrime); event SetTrustedRemote(uint16 _remoteChainId, bytes _path); event SetTrustedRemoteAddress(uint16 _remoteChainId, bytes _remoteAddress); event SetMinDstGas(uint16 _dstChainId, uint16 _type, uint _minDstGas); constructor(address _endpoint) { lzEndpoint = ILayerZeroEndpoint(_endpoint); } function lzReceive(uint16 _srcChainId, bytes calldata _srcAddress, uint64 _nonce, bytes calldata _payload) public virtual override { // lzReceive must be called by the endpoint for security require(_msgSender() == address(lzEndpoint), "LzApp: invalid endpoint caller"); bytes memory trustedRemote = trustedRemoteLookup[_srcChainId]; // if will still block the message pathway from (srcChainId, srcAddress). should not receive message from untrusted remote. require(_srcAddress.length == trustedRemote.length && trustedRemote.length > 0 && keccak256(_srcAddress) == keccak256(trustedRemote), "LzApp: invalid source sending contract"); _blockingLzReceive(_srcChainId, _srcAddress, _nonce, _payload); } // abstract function - the default behaviour of LayerZero is blocking. See: NonblockingLzApp if you dont need to enforce ordered messaging function _blockingLzReceive(uint16 _srcChainId, bytes memory _srcAddress, uint64 _nonce, bytes memory _payload) internal virtual; function _lzSend(uint16 _dstChainId, bytes memory _payload, address payable _refundAddress, address _zroPaymentAddress, bytes memory _adapterParams, uint _nativeFee) internal virtual { bytes memory trustedRemote = trustedRemoteLookup[_dstChainId]; require(trustedRemote.length != 0, "LzApp: destination chain is not a trusted source"); _checkPayloadSize(_dstChainId, _payload.length); lzEndpoint.send{value: _nativeFee}(_dstChainId, trustedRemote, _payload, _refundAddress, _zroPaymentAddress, _adapterParams); } function _checkGasLimit(uint16 _dstChainId, uint16 _type, bytes memory _adapterParams, uint _extraGas) internal view virtual { uint providedGasLimit = _getGasLimit(_adapterParams); uint minGasLimit = minDstGasLookup[_dstChainId][_type] + _extraGas; require(minGasLimit > 0, "LzApp: minGasLimit not set"); require(providedGasLimit >= minGasLimit, "LzApp: gas limit is too low"); } function _getGasLimit(bytes memory _adapterParams) internal pure virtual returns (uint gasLimit) { require(_adapterParams.length >= 34, "LzApp: invalid adapterParams"); assembly { gasLimit := mload(add(_adapterParams, 34)) } } function _checkPayloadSize(uint16 _dstChainId, uint _payloadSize) internal view virtual { uint payloadSizeLimit = payloadSizeLimitLookup[_dstChainId]; if (payloadSizeLimit == 0) { // use default if not set payloadSizeLimit = DEFAULT_PAYLOAD_SIZE_LIMIT; } require(_payloadSize <= payloadSizeLimit, "LzApp: payload size is too large"); } //---------------------------UserApplication config---------------------------------------- function getConfig(uint16 _version, uint16 _chainId, address, uint _configType) external view returns (bytes memory) { return lzEndpoint.getConfig(_version, _chainId, address(this), _configType); } // generic config for LayerZero user Application function setConfig(uint16 _version, uint16 _chainId, uint _configType, bytes calldata _config) external override onlyOwner { lzEndpoint.setConfig(_version, _chainId, _configType, _config); } function setSendVersion(uint16 _version) external override onlyOwner { lzEndpoint.setSendVersion(_version); } function setReceiveVersion(uint16 _version) external override onlyOwner { lzEndpoint.setReceiveVersion(_version); } function forceResumeReceive(uint16 _srcChainId, bytes calldata _srcAddress) external override onlyOwner { lzEndpoint.forceResumeReceive(_srcChainId, _srcAddress); } // _path = abi.encodePacked(remoteAddress, localAddress) // this function set the trusted path for the cross-chain communication function setTrustedRemote(uint16 _remoteChainId, bytes calldata _path) external onlyOwner { trustedRemoteLookup[_remoteChainId] = _path; emit SetTrustedRemote(_remoteChainId, _path); } function setTrustedRemoteAddress(uint16 _remoteChainId, bytes calldata _remoteAddress) external onlyOwner { trustedRemoteLookup[_remoteChainId] = abi.encodePacked(_remoteAddress, address(this)); emit SetTrustedRemoteAddress(_remoteChainId, _remoteAddress); } function getTrustedRemoteAddress(uint16 _remoteChainId) external view returns (bytes memory) { bytes memory path = trustedRemoteLookup[_remoteChainId]; require(path.length != 0, "LzApp: no trusted path record"); return path.slice(0, path.length - 20); // the last 20 bytes should be address(this) } function setPrecrime(address _precrime) external onlyOwner { precrime = _precrime; emit SetPrecrime(_precrime); } function setMinDstGas(uint16 _dstChainId, uint16 _packetType, uint _minGas) external onlyOwner { require(_minGas > 0, "LzApp: invalid minGas"); minDstGasLookup[_dstChainId][_packetType] = _minGas; emit SetMinDstGas(_dstChainId, _packetType, _minGas); } // if the size is 0, it means default size limit function setPayloadSizeLimit(uint16 _dstChainId, uint _size) external onlyOwner { payloadSizeLimitLookup[_dstChainId] = _size; } //--------------------------- VIEW FUNCTION ---------------------------------------- function isTrustedRemote(uint16 _srcChainId, bytes calldata _srcAddress) external view returns (bool) { bytes memory trustedSource = trustedRemoteLookup[_srcChainId]; return keccak256(trustedSource) == keccak256(_srcAddress); } }
// SPDX-License-Identifier: MIT pragma solidity ^0.8.0; import "./LzApp.sol"; import "./util/ExcessivelySafeCall.sol"; /* * the default LayerZero messaging behaviour is blocking, i.e. any failed message will block the channel * this abstract class try-catch all fail messages and store locally for future retry. hence, non-blocking * NOTE: if the srcAddress is not configured properly, it will still block the message pathway from (srcChainId, srcAddress) */ abstract contract NonblockingLzApp is LzApp { using ExcessivelySafeCall for address; constructor(address _endpoint) LzApp(_endpoint) {} mapping(uint16 => mapping(bytes => mapping(uint64 => bytes32))) public failedMessages; event MessageFailed(uint16 _srcChainId, bytes _srcAddress, uint64 _nonce, bytes _payload, bytes _reason); event RetryMessageSuccess(uint16 _srcChainId, bytes _srcAddress, uint64 _nonce, bytes32 _payloadHash); // overriding the virtual function in LzReceiver function _blockingLzReceive(uint16 _srcChainId, bytes memory _srcAddress, uint64 _nonce, bytes memory _payload) internal virtual override { (bool success, bytes memory reason) = address(this).excessivelySafeCall(gasleft(), 150, abi.encodeWithSelector(this.nonblockingLzReceive.selector, _srcChainId, _srcAddress, _nonce, _payload)); // try-catch all errors/exceptions if (!success) { _storeFailedMessage(_srcChainId, _srcAddress, _nonce, _payload, reason); } } function _storeFailedMessage(uint16 _srcChainId, bytes memory _srcAddress, uint64 _nonce, bytes memory _payload, bytes memory _reason) internal virtual { failedMessages[_srcChainId][_srcAddress][_nonce] = keccak256(_payload); emit MessageFailed(_srcChainId, _srcAddress, _nonce, _payload, _reason); } function nonblockingLzReceive(uint16 _srcChainId, bytes calldata _srcAddress, uint64 _nonce, bytes calldata _payload) public virtual { // only internal transaction require(_msgSender() == address(this), "NonblockingLzApp: caller must be LzApp"); _nonblockingLzReceive(_srcChainId, _srcAddress, _nonce, _payload); } //@notice override this function function _nonblockingLzReceive(uint16 _srcChainId, bytes memory _srcAddress, uint64 _nonce, bytes memory _payload) internal virtual; function retryMessage(uint16 _srcChainId, bytes calldata _srcAddress, uint64 _nonce, bytes calldata _payload) public payable virtual { // assert there is message to retry bytes32 payloadHash = failedMessages[_srcChainId][_srcAddress][_nonce]; require(payloadHash != bytes32(0), "NonblockingLzApp: no stored message"); require(keccak256(_payload) == payloadHash, "NonblockingLzApp: invalid payload"); // clear the stored message failedMessages[_srcChainId][_srcAddress][_nonce] = bytes32(0); // execute the message. revert if it fails again _nonblockingLzReceive(_srcChainId, _srcAddress, _nonce, _payload); emit RetryMessageSuccess(_srcChainId, _srcAddress, _nonce, payloadHash); } }
// SPDX-License-Identifier: Unlicense /* * @title Solidity Bytes Arrays Utils * @author Gonçalo Sá <[email protected]> * * @dev Bytes tightly packed arrays utility library for ethereum contracts written in Solidity. * The library lets you concatenate, slice and type cast bytes arrays both in memory and storage. */ pragma solidity >=0.8.0 <0.9.0; library BytesLib { function concat( bytes memory _preBytes, bytes memory _postBytes ) internal pure returns (bytes memory) { bytes memory tempBytes; assembly { // Get a location of some free memory and store it in tempBytes as // Solidity does for memory variables. tempBytes := mload(0x40) // Store the length of the first bytes array at the beginning of // the memory for tempBytes. let length := mload(_preBytes) mstore(tempBytes, length) // Maintain a memory counter for the current write location in the // temp bytes array by adding the 32 bytes for the array length to // the starting location. let mc := add(tempBytes, 0x20) // Stop copying when the memory counter reaches the length of the // first bytes array. let end := add(mc, length) for { // Initialize a copy counter to the start of the _preBytes data, // 32 bytes into its memory. let cc := add(_preBytes, 0x20) } lt(mc, end) { // Increase both counters by 32 bytes each iteration. mc := add(mc, 0x20) cc := add(cc, 0x20) } { // Write the _preBytes data into the tempBytes memory 32 bytes // at a time. mstore(mc, mload(cc)) } // Add the length of _postBytes to the current length of tempBytes // and store it as the new length in the first 32 bytes of the // tempBytes memory. length := mload(_postBytes) mstore(tempBytes, add(length, mload(tempBytes))) // Move the memory counter back from a multiple of 0x20 to the // actual end of the _preBytes data. mc := end // Stop copying when the memory counter reaches the new combined // length of the arrays. end := add(mc, length) for { let cc := add(_postBytes, 0x20) } lt(mc, end) { mc := add(mc, 0x20) cc := add(cc, 0x20) } { mstore(mc, mload(cc)) } // Update the free-memory pointer by padding our last write location // to 32 bytes: add 31 bytes to the end of tempBytes to move to the // next 32 byte block, then round down to the nearest multiple of // 32. If the sum of the length of the two arrays is zero then add // one before rounding down to leave a blank 32 bytes (the length block with 0). mstore(0x40, and( add(add(end, iszero(add(length, mload(_preBytes)))), 31), not(31) // Round down to the nearest 32 bytes. )) } return tempBytes; } function concatStorage(bytes storage _preBytes, bytes memory _postBytes) internal { assembly { // Read the first 32 bytes of _preBytes storage, which is the length // of the array. (We don't need to use the offset into the slot // because arrays use the entire slot.) let fslot := sload(_preBytes.slot) // Arrays of 31 bytes or less have an even value in their slot, // while longer arrays have an odd value. The actual length is // the slot divided by two for odd values, and the lowest order // byte divided by two for even values. // If the slot is even, bitwise and the slot with 255 and divide by // two to get the length. If the slot is odd, bitwise and the slot // with -1 and divide by two. let slength := div(and(fslot, sub(mul(0x100, iszero(and(fslot, 1))), 1)), 2) let mlength := mload(_postBytes) let newlength := add(slength, mlength) // slength can contain both the length and contents of the array // if length < 32 bytes so let's prepare for that // v. http://solidity.readthedocs.io/en/latest/miscellaneous.html#layout-of-state-variables-in-storage switch add(lt(slength, 32), lt(newlength, 32)) case 2 { // Since the new array still fits in the slot, we just need to // update the contents of the slot. // uint256(bytes_storage) = uint256(bytes_storage) + uint256(bytes_memory) + new_length sstore( _preBytes.slot, // all the modifications to the slot are inside this // next block add( // we can just add to the slot contents because the // bytes we want to change are the LSBs fslot, add( mul( div( // load the bytes from memory mload(add(_postBytes, 0x20)), // zero all bytes to the right exp(0x100, sub(32, mlength)) ), // and now shift left the number of bytes to // leave space for the length in the slot exp(0x100, sub(32, newlength)) ), // increase length by the double of the memory // bytes length mul(mlength, 2) ) ) ) } case 1 { // The stored value fits in the slot, but the combined value // will exceed it. // get the keccak hash to get the contents of the array mstore(0x0, _preBytes.slot) let sc := add(keccak256(0x0, 0x20), div(slength, 32)) // save new length sstore(_preBytes.slot, add(mul(newlength, 2), 1)) // The contents of the _postBytes array start 32 bytes into // the structure. Our first read should obtain the `submod` // bytes that can fit into the unused space in the last word // of the stored array. To get this, we read 32 bytes starting // from `submod`, so the data we read overlaps with the array // contents by `submod` bytes. Masking the lowest-order // `submod` bytes allows us to add that value directly to the // stored value. let submod := sub(32, slength) let mc := add(_postBytes, submod) let end := add(_postBytes, mlength) let mask := sub(exp(0x100, submod), 1) sstore( sc, add( and( fslot, 0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff00 ), and(mload(mc), mask) ) ) for { mc := add(mc, 0x20) sc := add(sc, 1) } lt(mc, end) { sc := add(sc, 1) mc := add(mc, 0x20) } { sstore(sc, mload(mc)) } mask := exp(0x100, sub(mc, end)) sstore(sc, mul(div(mload(mc), mask), mask)) } default { // get the keccak hash to get the contents of the array mstore(0x0, _preBytes.slot) // Start copying to the last used word of the stored array. let sc := add(keccak256(0x0, 0x20), div(slength, 32)) // save new length sstore(_preBytes.slot, add(mul(newlength, 2), 1)) // Copy over the first `submod` bytes of the new data as in // case 1 above. let slengthmod := mod(slength, 32) let mlengthmod := mod(mlength, 32) let submod := sub(32, slengthmod) let mc := add(_postBytes, submod) let end := add(_postBytes, mlength) let mask := sub(exp(0x100, submod), 1) sstore(sc, add(sload(sc), and(mload(mc), mask))) for { sc := add(sc, 1) mc := add(mc, 0x20) } lt(mc, end) { sc := add(sc, 1) mc := add(mc, 0x20) } { sstore(sc, mload(mc)) } mask := exp(0x100, sub(mc, end)) sstore(sc, mul(div(mload(mc), mask), mask)) } } } function slice( bytes memory _bytes, uint256 _start, uint256 _length ) internal pure returns (bytes memory) { require(_length + 31 >= _length, "slice_overflow"); require(_bytes.length >= _start + _length, "slice_outOfBounds"); bytes memory tempBytes; assembly { switch iszero(_length) case 0 { // Get a location of some free memory and store it in tempBytes as // Solidity does for memory variables. tempBytes := mload(0x40) // The first word of the slice result is potentially a partial // word read from the original array. To read it, we calculate // the length of that partial word and start copying that many // bytes into the array. The first word we copy will start with // data we don't care about, but the last `lengthmod` bytes will // land at the beginning of the contents of the new array. When // we're done copying, we overwrite the full first word with // the actual length of the slice. let lengthmod := and(_length, 31) // The multiplication in the next line is necessary // because when slicing multiples of 32 bytes (lengthmod == 0) // the following copy loop was copying the origin's length // and then ending prematurely not copying everything it should. let mc := add(add(tempBytes, lengthmod), mul(0x20, iszero(lengthmod))) let end := add(mc, _length) for { // The multiplication in the next line has the same exact purpose // as the one above. let cc := add(add(add(_bytes, lengthmod), mul(0x20, iszero(lengthmod))), _start) } lt(mc, end) { mc := add(mc, 0x20) cc := add(cc, 0x20) } { mstore(mc, mload(cc)) } mstore(tempBytes, _length) //update free-memory pointer //allocating the array padded to 32 bytes like the compiler does now mstore(0x40, and(add(mc, 31), not(31))) } //if we want a zero-length slice let's just return a zero-length array default { tempBytes := mload(0x40) //zero out the 32 bytes slice we are about to return //we need to do it because Solidity does not garbage collect mstore(tempBytes, 0) mstore(0x40, add(tempBytes, 0x20)) } } return tempBytes; } function toAddress(bytes memory _bytes, uint256 _start) internal pure returns (address) { require(_bytes.length >= _start + 20, "toAddress_outOfBounds"); address tempAddress; assembly { tempAddress := div(mload(add(add(_bytes, 0x20), _start)), 0x1000000000000000000000000) } return tempAddress; } function toUint8(bytes memory _bytes, uint256 _start) internal pure returns (uint8) { require(_bytes.length >= _start + 1 , "toUint8_outOfBounds"); uint8 tempUint; assembly { tempUint := mload(add(add(_bytes, 0x1), _start)) } return tempUint; } function toUint16(bytes memory _bytes, uint256 _start) internal pure returns (uint16) { require(_bytes.length >= _start + 2, "toUint16_outOfBounds"); uint16 tempUint; assembly { tempUint := mload(add(add(_bytes, 0x2), _start)) } return tempUint; } function toUint32(bytes memory _bytes, uint256 _start) internal pure returns (uint32) { require(_bytes.length >= _start + 4, "toUint32_outOfBounds"); uint32 tempUint; assembly { tempUint := mload(add(add(_bytes, 0x4), _start)) } return tempUint; } function toUint64(bytes memory _bytes, uint256 _start) internal pure returns (uint64) { require(_bytes.length >= _start + 8, "toUint64_outOfBounds"); uint64 tempUint; assembly { tempUint := mload(add(add(_bytes, 0x8), _start)) } return tempUint; } function toUint96(bytes memory _bytes, uint256 _start) internal pure returns (uint96) { require(_bytes.length >= _start + 12, "toUint96_outOfBounds"); uint96 tempUint; assembly { tempUint := mload(add(add(_bytes, 0xc), _start)) } return tempUint; } function toUint128(bytes memory _bytes, uint256 _start) internal pure returns (uint128) { require(_bytes.length >= _start + 16, "toUint128_outOfBounds"); uint128 tempUint; assembly { tempUint := mload(add(add(_bytes, 0x10), _start)) } return tempUint; } function toUint256(bytes memory _bytes, uint256 _start) internal pure returns (uint256) { require(_bytes.length >= _start + 32, "toUint256_outOfBounds"); uint256 tempUint; assembly { tempUint := mload(add(add(_bytes, 0x20), _start)) } return tempUint; } function toBytes32(bytes memory _bytes, uint256 _start) internal pure returns (bytes32) { require(_bytes.length >= _start + 32, "toBytes32_outOfBounds"); bytes32 tempBytes32; assembly { tempBytes32 := mload(add(add(_bytes, 0x20), _start)) } return tempBytes32; } function equal(bytes memory _preBytes, bytes memory _postBytes) internal pure returns (bool) { bool success = true; assembly { let length := mload(_preBytes) // if lengths don't match the arrays are not equal switch eq(length, mload(_postBytes)) case 1 { // cb is a circuit breaker in the for loop since there's // no said feature for inline assembly loops // cb = 1 - don't breaker // cb = 0 - break let cb := 1 let mc := add(_preBytes, 0x20) let end := add(mc, length) for { let cc := add(_postBytes, 0x20) // the next line is the loop condition: // while(uint256(mc < end) + cb == 2) } eq(add(lt(mc, end), cb), 2) { mc := add(mc, 0x20) cc := add(cc, 0x20) } { // if any of these checks fails then arrays are not equal if iszero(eq(mload(mc), mload(cc))) { // unsuccess: success := 0 cb := 0 } } } default { // unsuccess: success := 0 } } return success; } function equalStorage( bytes storage _preBytes, bytes memory _postBytes ) internal view returns (bool) { bool success = true; assembly { // we know _preBytes_offset is 0 let fslot := sload(_preBytes.slot) // Decode the length of the stored array like in concatStorage(). let slength := div(and(fslot, sub(mul(0x100, iszero(and(fslot, 1))), 1)), 2) let mlength := mload(_postBytes) // if lengths don't match the arrays are not equal switch eq(slength, mlength) case 1 { // slength can contain both the length and contents of the array // if length < 32 bytes so let's prepare for that // v. http://solidity.readthedocs.io/en/latest/miscellaneous.html#layout-of-state-variables-in-storage if iszero(iszero(slength)) { switch lt(slength, 32) case 1 { // blank the last byte which is the length fslot := mul(div(fslot, 0x100), 0x100) if iszero(eq(fslot, mload(add(_postBytes, 0x20)))) { // unsuccess: success := 0 } } default { // cb is a circuit breaker in the for loop since there's // no said feature for inline assembly loops // cb = 1 - don't breaker // cb = 0 - break let cb := 1 // get the keccak hash to get the contents of the array mstore(0x0, _preBytes.slot) let sc := keccak256(0x0, 0x20) let mc := add(_postBytes, 0x20) let end := add(mc, mlength) // the next line is the loop condition: // while(uint256(mc < end) + cb == 2) for {} eq(add(lt(mc, end), cb), 2) { sc := add(sc, 1) mc := add(mc, 0x20) } { if iszero(eq(sload(sc), mload(mc))) { // unsuccess: success := 0 cb := 0 } } } } } default { // unsuccess: success := 0 } } return success; } }
// SPDX-License-Identifier: MIT OR Apache-2.0 pragma solidity >=0.7.6; library ExcessivelySafeCall { uint256 constant LOW_28_MASK = 0x00000000ffffffffffffffffffffffffffffffffffffffffffffffffffffffff; /// @notice Use when you _really_ really _really_ don't trust the called /// contract. This prevents the called contract from causing reversion of /// the caller in as many ways as we can. /// @dev The main difference between this and a solidity low-level call is /// that we limit the number of bytes that the callee can cause to be /// copied to caller memory. This prevents stupid things like malicious /// contracts returning 10,000,000 bytes causing a local OOG when copying /// to memory. /// @param _target The address to call /// @param _gas The amount of gas to forward to the remote contract /// @param _maxCopy The maximum number of bytes of returndata to copy /// to memory. /// @param _calldata The data to send to the remote contract /// @return success and returndata, as `.call()`. Returndata is capped to /// `_maxCopy` bytes. function excessivelySafeCall( address _target, uint256 _gas, uint16 _maxCopy, bytes memory _calldata ) internal returns (bool, bytes memory) { // set up for assembly call uint256 _toCopy; bool _success; bytes memory _returnData = new bytes(_maxCopy); // dispatch message to recipient // by assembly calling "handle" function // we call via assembly to avoid memcopying a very large returndata // returned by a malicious contract assembly { _success := call( _gas, // gas _target, // recipient 0, // ether value add(_calldata, 0x20), // inloc mload(_calldata), // inlen 0, // outloc 0 // outlen ) // limit our copy to 256 bytes _toCopy := returndatasize() if gt(_toCopy, _maxCopy) { _toCopy := _maxCopy } // Store the length of the copied bytes mstore(_returnData, _toCopy) // copy the bytes from returndata[0:_toCopy] returndatacopy(add(_returnData, 0x20), 0, _toCopy) } return (_success, _returnData); } /// @notice Use when you _really_ really _really_ don't trust the called /// contract. This prevents the called contract from causing reversion of /// the caller in as many ways as we can. /// @dev The main difference between this and a solidity low-level call is /// that we limit the number of bytes that the callee can cause to be /// copied to caller memory. This prevents stupid things like malicious /// contracts returning 10,000,000 bytes causing a local OOG when copying /// to memory. /// @param _target The address to call /// @param _gas The amount of gas to forward to the remote contract /// @param _maxCopy The maximum number of bytes of returndata to copy /// to memory. /// @param _calldata The data to send to the remote contract /// @return success and returndata, as `.call()`. Returndata is capped to /// `_maxCopy` bytes. function excessivelySafeStaticCall( address _target, uint256 _gas, uint16 _maxCopy, bytes memory _calldata ) internal view returns (bool, bytes memory) { // set up for assembly call uint256 _toCopy; bool _success; bytes memory _returnData = new bytes(_maxCopy); // dispatch message to recipient // by assembly calling "handle" function // we call via assembly to avoid memcopying a very large returndata // returned by a malicious contract assembly { _success := staticcall( _gas, // gas _target, // recipient add(_calldata, 0x20), // inloc mload(_calldata), // inlen 0, // outloc 0 // outlen ) // limit our copy to 256 bytes _toCopy := returndatasize() if gt(_toCopy, _maxCopy) { _toCopy := _maxCopy } // Store the length of the copied bytes mstore(_returnData, _toCopy) // copy the bytes from returndata[0:_toCopy] returndatacopy(add(_returnData, 0x20), 0, _toCopy) } return (_success, _returnData); } /** * @notice Swaps function selectors in encoded contract calls * @dev Allows reuse of encoded calldata for functions with identical * argument types but different names. It simply swaps out the first 4 bytes * for the new selector. This function modifies memory in place, and should * only be used with caution. * @param _newSelector The new 4-byte selector * @param _buf The encoded contract args */ function swapSelector(bytes4 _newSelector, bytes memory _buf) internal pure { require(_buf.length >= 4); uint256 _mask = LOW_28_MASK; assembly { // load the first word of let _word := mload(add(_buf, 0x20)) // mask out the top 4 bytes // /x _word := and(_word, _mask) _word := or(_newSelector, _word) mstore(add(_buf, 0x20), _word) } } }
// SPDX-License-Identifier: MIT pragma solidity ^0.8.0; import "../interfaces/common/IKyberElastic.sol"; import "../interfaces/common/IUniswapRouterV3.sol"; import "../interfaces/common/IUniswapRouterV3WithDeadline.sol"; import "../interfaces/common/ITraderJoeRouter.sol"; library UniV3Actions { // kyber V3 swap function kyberSwap(address _router, bytes memory _path, uint256 _amount) internal returns (uint256 amountOut) { IKyberElastic.ExactInputParams memory swapParams = IKyberElastic.ExactInputParams({ path: _path, recipient: address(this), deadline: block.timestamp, amountIn: _amount, minAmountOut: 0 }); return IKyberElastic(_router).swapExactInput(swapParams); } // Uniswap V3 swap function swapV3(address _router, bytes memory _path, uint256 _amount) internal returns (uint256 amountOut) { IUniswapRouterV3.ExactInputParams memory swapParams = IUniswapRouterV3.ExactInputParams({ path: _path, recipient: address(this), amountIn: _amount, amountOutMinimum: 0 }); return IUniswapRouterV3(_router).exactInput(swapParams); } // Uniswap V3 swap with deadline function swapV3WithDeadline(address _router, bytes memory _path, uint256 _amount) internal returns (uint256 amountOut) { IUniswapRouterV3WithDeadline.ExactInputParams memory swapParams = IUniswapRouterV3WithDeadline.ExactInputParams({ path: _path, recipient: address(this), deadline: block.timestamp, amountIn: _amount, amountOutMinimum: 0 }); return IUniswapRouterV3WithDeadline(_router).exactInput(swapParams); } // Uniswap V3 swap with deadline function swapV3WithDeadline(address _router, bytes memory _path, uint256 _amount, address _to) internal returns (uint256 amountOut) { IUniswapRouterV3WithDeadline.ExactInputParams memory swapParams = IUniswapRouterV3WithDeadline.ExactInputParams({ path: _path, recipient: _to, deadline: block.timestamp, amountIn: _amount, amountOutMinimum: 0 }); return IUniswapRouterV3WithDeadline(_router).exactInput(swapParams); } function swapLiquidityBook(address _router, ITraderJoeRouter.Path memory _path, uint256 _amount, address _to) internal returns (uint256 amountOut) { return ITraderJoeRouter(_router).swapExactTokensForTokens( _amount, 0, _path, _to, block.timestamp ); } }
{ "optimizer": { "enabled": true, "runs": 200 }, "outputSelection": { "*": { "*": [ "evm.bytecode", "evm.deployedBytecode", "devdoc", "userdoc", "metadata", "abi" ] } }, "libraries": {} }
Contract Security Audit
- No Contract Security Audit Submitted- Submit Audit Here
[{"inputs":[{"internalType":"address","name":"_aura","type":"address"},{"internalType":"address","name":"_native","type":"address"},{"internalType":"address","name":"_stargate","type":"address"},{"internalType":"address","name":"_endpoint","type":"address"},{"internalType":"bytes","name":"_auraSwapper","type":"bytes"},{"internalType":"uint16","name":"_dstChainId","type":"uint16"}],"stateMutability":"nonpayable","type":"constructor"},{"inputs":[],"name":"EtherTransferFailure","type":"error"},{"inputs":[],"name":"NotAuthorized","type":"error"},{"inputs":[],"name":"NotEnoughAura","type":"error"},{"inputs":[],"name":"NotEnoughEth","type":"error"},{"anonymous":false,"inputs":[],"name":"Error","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint16","name":"_srcChainId","type":"uint16"},{"indexed":false,"internalType":"bytes","name":"_srcAddress","type":"bytes"},{"indexed":false,"internalType":"uint64","name":"_nonce","type":"uint64"},{"indexed":false,"internalType":"bytes","name":"_payload","type":"bytes"},{"indexed":false,"internalType":"bytes","name":"_reason","type":"bytes"}],"name":"MessageFailed","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":"uint16","name":"_srcChainId","type":"uint16"},{"indexed":false,"internalType":"bytes","name":"_srcAddress","type":"bytes"},{"indexed":false,"internalType":"uint64","name":"_nonce","type":"uint64"},{"indexed":false,"internalType":"bytes32","name":"_payloadHash","type":"bytes32"}],"name":"RetryMessageSuccess","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint16","name":"_dstChainId","type":"uint16"},{"indexed":false,"internalType":"uint16","name":"_type","type":"uint16"},{"indexed":false,"internalType":"uint256","name":"_minDstGas","type":"uint256"}],"name":"SetMinDstGas","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"precrime","type":"address"}],"name":"SetPrecrime","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint16","name":"_remoteChainId","type":"uint16"},{"indexed":false,"internalType":"bytes","name":"_path","type":"bytes"}],"name":"SetTrustedRemote","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint16","name":"_remoteChainId","type":"uint16"},{"indexed":false,"internalType":"bytes","name":"_remoteAddress","type":"bytes"}],"name":"SetTrustedRemoteAddress","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"_strategy","type":"address"},{"indexed":false,"internalType":"uint256","name":"_amount","type":"uint256"}],"name":"Swap","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"_strategy","type":"address"},{"indexed":false,"internalType":"uint256","name":"_amount","type":"uint256"}],"name":"SwapCompleted","type":"event"},{"inputs":[],"name":"DEFAULT_PAYLOAD_SIZE_LIMIT","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"_strategy","type":"address"}],"name":"_returnNative","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"aura","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"auraSwapper","outputs":[{"internalType":"bytes","name":"","type":"bytes"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"dstChainId","outputs":[{"internalType":"uint16","name":"","type":"uint16"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"_amount","type":"uint256"}],"name":"estimate","outputs":[{"internalType":"uint256","name":"gasNeeded","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint16","name":"","type":"uint16"},{"internalType":"bytes","name":"","type":"bytes"},{"internalType":"uint64","name":"","type":"uint64"}],"name":"failedMessages","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint16","name":"_srcChainId","type":"uint16"},{"internalType":"bytes","name":"_srcAddress","type":"bytes"}],"name":"forceResumeReceive","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"gasLimit","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint16","name":"_version","type":"uint16"},{"internalType":"uint16","name":"_chainId","type":"uint16"},{"internalType":"address","name":"","type":"address"},{"internalType":"uint256","name":"_configType","type":"uint256"}],"name":"getConfig","outputs":[{"internalType":"bytes","name":"","type":"bytes"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint16","name":"_remoteChainId","type":"uint16"}],"name":"getTrustedRemoteAddress","outputs":[{"internalType":"bytes","name":"","type":"bytes"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"_token","type":"address"},{"internalType":"bool","name":"_native","type":"bool"}],"name":"inCaseTokensGetStuck","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint16","name":"_srcChainId","type":"uint16"},{"internalType":"bytes","name":"_srcAddress","type":"bytes"}],"name":"isTrustedRemote","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"lzEndpoint","outputs":[{"internalType":"contract ILayerZeroEndpoint","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint16","name":"_srcChainId","type":"uint16"},{"internalType":"bytes","name":"_srcAddress","type":"bytes"},{"internalType":"uint64","name":"_nonce","type":"uint64"},{"internalType":"bytes","name":"_payload","type":"bytes"}],"name":"lzReceive","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint16","name":"","type":"uint16"},{"internalType":"uint16","name":"","type":"uint16"}],"name":"minDstGasLookup","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"native","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint16","name":"_srcChainId","type":"uint16"},{"internalType":"bytes","name":"_srcAddress","type":"bytes"},{"internalType":"uint64","name":"_nonce","type":"uint64"},{"internalType":"bytes","name":"_payload","type":"bytes"}],"name":"nonblockingLzReceive","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"}],"name":"operators","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"owner","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint16","name":"","type":"uint16"}],"name":"payloadSizeLimitLookup","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"precrime","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"renounceOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint16","name":"_srcChainId","type":"uint16"},{"internalType":"bytes","name":"_srcAddress","type":"bytes"},{"internalType":"uint64","name":"_nonce","type":"uint64"},{"internalType":"bytes","name":"_payload","type":"bytes"}],"name":"retryMessage","outputs":[],"stateMutability":"payable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_gasLimit","type":"uint256"},{"internalType":"bytes","name":"_auraSwapper","type":"bytes"},{"internalType":"address","name":"_stargate","type":"address"}],"name":"setBridgeConfig","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint16","name":"_version","type":"uint16"},{"internalType":"uint16","name":"_chainId","type":"uint16"},{"internalType":"uint256","name":"_configType","type":"uint256"},{"internalType":"bytes","name":"_config","type":"bytes"}],"name":"setConfig","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint16","name":"_dstChainId","type":"uint16"},{"internalType":"uint16","name":"_packetType","type":"uint16"},{"internalType":"uint256","name":"_minGas","type":"uint256"}],"name":"setMinDstGas","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_operator","type":"address"},{"internalType":"bool","name":"_status","type":"bool"}],"name":"setOperator","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint16","name":"_dstChainId","type":"uint16"},{"internalType":"uint256","name":"_size","type":"uint256"}],"name":"setPayloadSizeLimit","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_precrime","type":"address"}],"name":"setPrecrime","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint16","name":"_version","type":"uint16"}],"name":"setReceiveVersion","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint16","name":"_version","type":"uint16"}],"name":"setSendVersion","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"components":[{"internalType":"bool","name":"shouldSwap","type":"bool"},{"internalType":"address","name":"router","type":"address"},{"internalType":"bytes","name":"path","type":"bytes"},{"internalType":"address","name":"tokenFrom","type":"address"},{"internalType":"address","name":"tokenTo","type":"address"},{"internalType":"bool","name":"deadline","type":"bool"}],"internalType":"struct AuraSrcSwapper.SwapConfig","name":"_swapConfig","type":"tuple"}],"name":"setSwap","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint16","name":"_remoteChainId","type":"uint16"},{"internalType":"bytes","name":"_path","type":"bytes"}],"name":"setTrustedRemote","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint16","name":"_remoteChainId","type":"uint16"},{"internalType":"bytes","name":"_remoteAddress","type":"bytes"}],"name":"setTrustedRemoteAddress","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint16","name":"","type":"uint16"},{"internalType":"bytes","name":"","type":"bytes"},{"internalType":"uint256","name":"","type":"uint256"},{"internalType":"address","name":"","type":"address"},{"internalType":"uint256","name":"","type":"uint256"},{"internalType":"bytes","name":"payload","type":"bytes"}],"name":"sgReceive","outputs":[],"stateMutability":"payable","type":"function"},{"inputs":[],"name":"stargate","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"_amount","type":"uint256"}],"name":"swapAura","outputs":[],"stateMutability":"payable","type":"function"},{"inputs":[],"name":"swapConfig","outputs":[{"internalType":"bool","name":"shouldSwap","type":"bool"},{"internalType":"address","name":"router","type":"address"},{"internalType":"bytes","name":"path","type":"bytes"},{"internalType":"address","name":"tokenFrom","type":"address"},{"internalType":"address","name":"tokenTo","type":"address"},{"internalType":"bool","name":"deadline","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"newOwner","type":"address"}],"name":"transferOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint16","name":"","type":"uint16"}],"name":"trustedRemoteLookup","outputs":[{"internalType":"bytes","name":"","type":"bytes"}],"stateMutability":"view","type":"function"},{"stateMutability":"payable","type":"receive"}]
Contract Creation Code
60a06040526010805463ffff00001916620100001790553480156200002357600080fd5b5060405162003d7238038062003d7283398101604081905262000046916200015c565b82806200005333620000c6565b6001600160a01b03908116608052600680546001600160a01b03199081168a84161790915560078054821689841617905560088054909116918716919091179055506009620000a3838262000326565b506010805461ffff191661ffff9290921691909117905550620003f29350505050565b600080546001600160a01b038381166001600160a01b0319831681178455604051919092169283917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a35050565b80516001600160a01b03811681146200012e57600080fd5b919050565b634e487b7160e01b600052604160045260246000fd5b805161ffff811681146200012e57600080fd5b60008060008060008060c087890312156200017657600080fd5b620001818762000116565b955060206200019281890162000116565b9550620001a26040890162000116565b9450620001b26060890162000116565b60808901519094506001600160401b0380821115620001d057600080fd5b818a0191508a601f830112620001e557600080fd5b815181811115620001fa57620001fa62000133565b604051601f8201601f19908116603f0116810190838211818310171562000225576200022562000133565b816040528281528d868487010111156200023e57600080fd5b600093505b8284101562000262578484018601518185018701529285019262000243565b82841115620002745760008684830101525b8097505050505050506200028b60a0880162000149565b90509295509295509295565b600181811c90821680620002ac57607f821691505b602082108103620002cd57634e487b7160e01b600052602260045260246000fd5b50919050565b601f8211156200032157600081815260208120601f850160051c81016020861015620002fc5750805b601f850160051c820191505b818110156200031d5782815560010162000308565b5050505b505050565b81516001600160401b0381111562000342576200034262000133565b6200035a8162000353845462000297565b84620002d3565b602080601f831160018114620003925760008415620003795750858301515b600019600386901b1c1916600185901b1785556200031d565b600085815260208120601f198616915b82811015620003c357888601518255948401946001909101908401620003a2565b5085821015620003e25787850151600019600388901b60f8161c191681555b5050505050600190811b01905550565b6080516139256200044d60003960008181610698015281816107fc01528181610a4b01528181610af301528181610c3d01528181610e7d015281816112e901528181611ad001528181611f1201526121fb01526139256000f3fe6080604052600436106102495760003560e01c80637533d78811610139578063bac86af5116100b6578063df2a5b3b1161007a578063df2a5b3b14610743578063e13b7f5c14610763578063eb8d72b714610783578063f2fde38b146107a3578063f5ecbdbc146107c3578063f68016b7146107e357600080fd5b8063bac86af5146106ba578063baf3292d146106da578063c4461834146106fa578063cbed8b9c14610710578063d1deba1f1461073057600080fd5b80639f38369a116100fd5780639f38369a14610613578063a140559814610633578063a6c3d16514610653578063ab8236f314610673578063b353aaa71461068657600080fd5b80637533d7881461055d5780638cfd8f5c1461057d5780638da5cb5b146105b5578063950c8a74146105d35780639c792938146105f357600080fd5b806342d65a8d116101c75780635b8c41e61161018b5780635b8c41e61461049757806366ad5c8a146104e65780636bc6dd3d146105065780636c099dee14610528578063715018a61461054857600080fd5b806342d65a8d146103f057806343ab3b33146104105780634b0c2d021461043057806353da9f5114610450578063558a72971461047757600080fd5b80631275b64e1161020e5780631275b64e1461031457806313e7c9d81461032757806330c593f7146103675780633d8b38f6146103955780633f1f4fa4146103b557600080fd5b80621d35671461025557806307e0db17146102775780630df374831461029757806310ddb137146102b757806311b0b42d146102d757600080fd5b3661025057005b600080fd5b34801561026157600080fd5b50610275610270366004612a86565b6107f9565b005b34801561028357600080fd5b50610275610292366004612b19565b610a2a565b3480156102a357600080fd5b506102756102b2366004612b34565b610ab3565b3480156102c357600080fd5b506102756102d2366004612b19565b610ad2565b3480156102e357600080fd5b506007546102f7906001600160a01b031681565b6040516001600160a01b0390911681526020015b60405180910390f35b610275610322366004612b5e565b610b2a565b34801561033357600080fd5b50610357610342366004612b8c565b600f6020526000908152604090205460ff1681565b604051901515815260200161030b565b34801561037357600080fd5b506010546103829061ffff1681565b60405161ffff909116815260200161030b565b3480156103a157600080fd5b506103576103b0366004612ba9565b610d92565b3480156103c157600080fd5b506103e26103d0366004612b19565b60036020526000908152604090205481565b60405190815260200161030b565b3480156103fc57600080fd5b5061027561040b366004612ba9565b610e5e565b34801561041c57600080fd5b5061027561042b366004612cbe565b610ee4565b34801561043c57600080fd5b5061027561044b366004612d18565b610f3d565b34801561045c57600080fd5b50610465610f52565b60405161030b96959493929190612daa565b34801561048357600080fd5b50610275610492366004612e04565b611022565b3480156104a357600080fd5b506103e26104b2366004612e3d565b6005602090815260009384526040808520845180860184018051928152908401958401959095209452929052825290205481565b3480156104f257600080fd5b50610275610501366004612a86565b611055565b34801561051257600080fd5b5061051b611131565b60405161030b9190612e9a565b34801561053457600080fd5b506008546102f7906001600160a01b031681565b34801561055457600080fd5b506102756111bf565b34801561056957600080fd5b5061051b610578366004612b19565b6111d3565b34801561058957600080fd5b506103e2610598366004612ead565b600260209081526000928352604080842090915290825290205481565b3480156105c157600080fd5b506000546001600160a01b03166102f7565b3480156105df57600080fd5b506004546102f7906001600160a01b031681565b3480156105ff57600080fd5b506103e261060e366004612b5e565b6111ec565b34801561061f57600080fd5b5061051b61062e366004612b19565b611380565b34801561063f57600080fd5b5061027561064e366004612b8c565b611496565b34801561065f57600080fd5b5061027561066e366004612ba9565b61180d565b610275610681366004612ee0565b611889565b34801561069257600080fd5b506102f77f000000000000000000000000000000000000000000000000000000000000000081565b3480156106c657600080fd5b506102756106d5366004612e04565b611951565b3480156106e657600080fd5b506102756106f5366004612b8c565b611a55565b34801561070657600080fd5b506103e261271081565b34801561071c57600080fd5b5061027561072b366004612f7a565b611ab1565b61027561073e366004612a86565b611b46565b34801561074f57600080fd5b5061027561075e366004612fe8565b611d5c565b34801561076f57600080fd5b506006546102f7906001600160a01b031681565b34801561078f57600080fd5b5061027561079e366004612ba9565b611e0e565b3480156107af57600080fd5b506102756107be366004612b8c565b611e68565b3480156107cf57600080fd5b5061051b6107de366004613024565b611ee1565b3480156107ef57600080fd5b506103e2600a5481565b337f00000000000000000000000000000000000000000000000000000000000000006001600160a01b0316146108765760405162461bcd60e51b815260206004820152601e60248201527f4c7a4170703a20696e76616c696420656e64706f696e742063616c6c6572000060448201526064015b60405180910390fd5b61ffff86166000908152600160205260408120805461089490613071565b80601f01602080910402602001604051908101604052809291908181526020018280546108c090613071565b801561090d5780601f106108e25761010080835404028352916020019161090d565b820191906000526020600020905b8154815290600101906020018083116108f057829003601f168201915b50505050509050805186869050148015610928575060008151115b801561095057508051602082012060405161094690889088906130ab565b6040518091039020145b6109ab5760405162461bcd60e51b815260206004820152602660248201527f4c7a4170703a20696e76616c696420736f757263652073656e64696e6720636f6044820152651b9d1c9858dd60d21b606482015260840161086d565b610a218787878080601f01602080910402602001604051908101604052809392919081815260200183838082843760009201919091525050604080516020601f8a018190048102820181019092528881528a935091508890889081908401838280828437600092019190915250611f9492505050565b50505050505050565b610a3261200d565b6040516307e0db1760e01b815261ffff821660048201527f00000000000000000000000000000000000000000000000000000000000000006001600160a01b0316906307e0db17906024015b600060405180830381600087803b158015610a9857600080fd5b505af1158015610aac573d6000803e3d6000fd5b5050505050565b610abb61200d565b61ffff909116600090815260036020526040902055565b610ada61200d565b6040516310ddb13760e01b815261ffff821660048201527f00000000000000000000000000000000000000000000000000000000000000006001600160a01b0316906310ddb13790602401610a7e565b600654610b42906001600160a01b0316333084612067565b601054600a54604080516001600160f01b031962010000850460f01b1660208201526022808201939093528151808203909301835260428101825233606282015260828082018690528251808303909101815260a2820192839052600654632a205e3d60e01b90935292936000926001600160a01b031691632a205e3d91610bdc9161ffff90911690600990899087908a9060a601613138565b6040805180830381865afa158015610bf8573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610c1c9190613181565b5060105460405163040a7bb160e41b81529192506000916001600160a01b037f000000000000000000000000000000000000000000000000000000000000000016916340a7bb1091610c7d9161ffff16903090889087908b906004016131a5565b6040805180830381865afa158015610c99573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610cbd9190613181565b506006546010546040516328c82b1b60e11b81529293506001600160a01b03909116916351905636918591610d0791309161ffff909116906009908c9033906000906004016131ed565b6000604051808303818588803b158015610d2057600080fd5b505af1158015610d34573d6000803e3d6000fd5b5050601054610d51935061ffff16915085905033600088866120d2565b60408051338152602081018790527f562c219552544ec4c9d7a8eb850f80ea152973e315372bf4999fe7c953ea004f91015b60405180910390a15050505050565b61ffff831660009081526001602052604081208054829190610db390613071565b80601f0160208091040260200160405190810160405280929190818152602001828054610ddf90613071565b8015610e2c5780601f10610e0157610100808354040283529160200191610e2c565b820191906000526020600020905b815481529060010190602001808311610e0f57829003601f168201915b505050505090508383604051610e439291906130ab565b60405180910390208180519060200120149150509392505050565b610e6661200d565b6040516342d65a8d60e01b81526001600160a01b037f000000000000000000000000000000000000000000000000000000000000000016906342d65a8d90610eb690869086908690600401613271565b600060405180830381600087803b158015610ed057600080fd5b505af1158015610a21573d6000803e3d6000fd5b610eec61200d565b8215610ef857600a8390555b815115610f0d576009610f0b83826132d5565b505b6001600160a01b03811615610f3857600880546001600160a01b0319166001600160a01b0383161790555b505050565b610f4561200d565b80600b610f3882826134d9565b600b8054600c805460ff8316936101009093046001600160a01b0316929190610f7a90613071565b80601f0160208091040260200160405190810160405280929190818152602001828054610fa690613071565b8015610ff35780601f10610fc857610100808354040283529160200191610ff3565b820191906000526020600020905b815481529060010190602001808311610fd657829003601f168201915b50505050600283015460039093015491926001600160a01b03908116929081169150600160a01b900460ff1686565b61102a61200d565b6001600160a01b03919091166000908152600f60205260409020805460ff1916911515919091179055565b3330146110b35760405162461bcd60e51b815260206004820152602660248201527f4e6f6e626c6f636b696e674c7a4170703a2063616c6c6572206d7573742062656044820152650204c7a4170760d41b606482015260840161086d565b6111298686868080601f01602080910402602001604051908101604052809392919081815260200183838082843760009201919091525050604080516020601f8901819004810282018101909252878152899350915087908790819084018382808284376000920191909152506119ca92505050565b505050505050565b6009805461113e90613071565b80601f016020809104026020016040519081016040528092919081815260200182805461116a90613071565b80156111b75780601f1061118c576101008083540402835291602001916111b7565b820191906000526020600020905b81548152906001019060200180831161119a57829003601f168201915b505050505081565b6111c761200d565b6111d16000612277565b565b6001602052600090815260409020805461113e90613071565b601054600a54604080516001600160f01b031962010000850460f01b1660208201526022808201939093528151808203909301835260428101825233606282015260828082018690528251808303909101815260a2820192839052600654632a205e3d60e01b909352600094909285926001600160a01b0390911691632a205e3d916112889161ffff16906009908a9087908a9060a601613138565b6040805180830381865afa1580156112a4573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906112c89190613181565b5060105460405163040a7bb160e41b81529192506000916001600160a01b037f000000000000000000000000000000000000000000000000000000000000000016916340a7bb10916113299161ffff16903090889087908b906004016131a5565b6040805180830381865afa158015611345573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906113699190613181565b50905061137681836135b8565b9695505050505050565b61ffff81166000908152600160205260408120805460609291906113a390613071565b80601f01602080910402602001604051908101604052809291908181526020018280546113cf90613071565b801561141c5780601f106113f15761010080835404028352916020019161141c565b820191906000526020600020905b8154815290600101906020018083116113ff57829003601f168201915b5050505050905080516000036114745760405162461bcd60e51b815260206004820152601d60248201527f4c7a4170703a206e6f20747275737465642070617468207265636f7264000000604482015260640161086d565b61148f60006014835161148791906135d0565b8391906122c7565b9392505050565b3330146114b65760405163ea8e4eb560e01b815260040160405180910390fd5b600b5460ff16156116be57600d546040516370a0823160e01b81523060048201526000916001600160a01b0316906370a0823190602401602060405180830381865afa15801561150a573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061152e91906135e7565b600b54600d54919250611552916001600160a01b03610100909204821691166123d4565b600e54600160a01b900460ff161561161257600b54600c805461160c9261010090046001600160a01b0316919061158890613071565b80601f01602080910402602001604051908101604052809291908181526020018280546115b490613071565b80156116015780601f106115d657610100808354040283529160200191611601565b820191906000526020600020905b8154815290600101906020018083116115e457829003601f168201915b505050505083612461565b506116bc565b600b54600c80546116ba9261010090046001600160a01b0316919061163690613071565b80601f016020809104026020016040519081016040528092919081815260200182805461166290613071565b80156116af5780601f10611684576101008083540402835291602001916116af565b820191906000526020600020905b81548152906001019060200180831161169257829003601f168201915b505050505083612500565b505b505b6007546040516370a0823160e01b815230600482015247916000916001600160a01b03909116906370a0823190602401602060405180830381865afa15801561170b573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061172f91906135e7565b905081156117a157600760009054906101000a90046001600160a01b03166001600160a01b031663d0e30db0836040518263ffffffff1660e01b81526004016000604051808303818588803b15801561178757600080fd5b505af115801561179b573d6000803e3d6000fd5b50505050505b6117ab81836135b8565b6007549092506117c5906001600160a01b0316848461254d565b604080516001600160a01b0385168152602081018490527fe1f61daa382137eba3fb6f816783974e8b33b9c29b6b9f777ed315d7faefd59a91015b60405180910390a1505050565b61181561200d565b81813060405160200161182a93929190613600565b60408051601f1981840301815291815261ffff851660009081526001602052209061185590826132d5565b507f8c0400cfe2d1199b1a725c78960bcc2a344d869b80590d0f2bd005db15a572ce83838360405161180093929190613271565b6008546001600160a01b031633146118b45760405163ea8e4eb560e01b815260040160405180910390fd5b6000818060200190518101906118ca9190613626565b6040516314280ab360e31b81526001600160a01b0382166004820152909150309063a140559890602401600060405180830381600087803b15801561190e57600080fd5b505af192505050801561191f575060015b610a21576040517f726c6382ff9f085e7ed0027cf5eda8d6e099c840a04a63124cd8d0e161993c7b90600090a1610a21565b61195961200d565b80156119d0576040514790600090339083908381818185875af1925050503d80600081146119a3576040519150601f19603f3d011682016040523d82523d6000602084013e6119a8565b606091505b50509050806119ca57604051630ebf3bcd60e41b815260040160405180910390fd5b50505050565b6040516370a0823160e01b81523060048201526000906001600160a01b038416906370a0823190602401602060405180830381865afa158015611a17573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611a3b91906135e7565b9050610f386001600160a01b038416338361254d565b5050565b611a5d61200d565b600480546001600160a01b0319166001600160a01b0383169081179091556040519081527f5db758e995a17ec1ad84bdef7e8c3293a0bd6179bcce400dff5d4c3d87db726b9060200160405180910390a150565b611ab961200d565b6040516332fb62e760e21b81526001600160a01b037f0000000000000000000000000000000000000000000000000000000000000000169063cbed8b9c90611b0d9088908890889088908890600401613643565b600060405180830381600087803b158015611b2757600080fd5b505af1158015611b3b573d6000803e3d6000fd5b505050505050505050565b61ffff86166000908152600560205260408082209051611b6990889088906130ab565b90815260408051602092819003830190206001600160401b03871660009081529252902054905080611be95760405162461bcd60e51b815260206004820152602360248201527f4e6f6e626c6f636b696e674c7a4170703a206e6f2073746f726564206d65737360448201526261676560e81b606482015260840161086d565b808383604051611bfa9291906130ab565b604051809103902014611c595760405162461bcd60e51b815260206004820152602160248201527f4e6f6e626c6f636b696e674c7a4170703a20696e76616c6964207061796c6f616044820152601960fa1b606482015260840161086d565b61ffff87166000908152600560205260408082209051611c7c90899089906130ab565b90815260408051602092819003830181206001600160401b038916600090815290845282902093909355601f88018290048202830182019052868252611d14918991899089908190840183828082843760009201919091525050604080516020601f8a018190048102820181019092528881528a9350915088908890819084018382808284376000920191909152506119ca92505050565b7fc264d91f3adc5588250e1551f547752ca0cfa8f6b530d243b9f9f4cab10ea8e58787878785604051611d4b959493929190613671565b60405180910390a150505050505050565b611d6461200d565b60008111611dac5760405162461bcd60e51b81526020600482015260156024820152744c7a4170703a20696e76616c6964206d696e47617360581b604482015260640161086d565b61ffff83811660008181526002602090815260408083209487168084529482529182902085905581519283528201929092529081018290527f9d5c7c0b934da8fefa9c7760c98383778a12dfbfc0c3b3106518f43fb9508ac090606001611800565b611e1661200d565b61ffff83166000908152600160205260409020611e348284836133fa565b507ffa41487ad5d6728f0b19276fa1eddc16558578f5109fc39d2dc33c3230470dab83838360405161180093929190613271565b611e7061200d565b6001600160a01b038116611ed55760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201526564647265737360d01b606482015260840161086d565b611ede81612277565b50565b604051633d7b2f6f60e21b815261ffff808616600483015284166024820152306044820152606481018290526060907f00000000000000000000000000000000000000000000000000000000000000006001600160a01b03169063f5ecbdbc90608401600060405180830381865afa158015611f61573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f19168201604052611f8991908101906136ac565b90505b949350505050565b600080611ff75a60966366ad5c8a60e01b89898989604051602401611fbc9493929190613719565b60408051601f198184030181529190526020810180516001600160e01b03166001600160e01b0319909316929092179091523092919061257d565b9150915081611129576111298686868685612607565b6000546001600160a01b031633146111d15760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604482015260640161086d565b6040516001600160a01b03808516602483015283166044820152606481018290526119ca9085906323b872dd60e01b906084015b60408051601f198184030181529190526020810180516001600160e01b03166001600160e01b031990931692909217909152612695565b61ffff8616600090815260016020526040812080546120f090613071565b80601f016020809104026020016040519081016040528092919081815260200182805461211c90613071565b80156121695780601f1061213e57610100808354040283529160200191612169565b820191906000526020600020905b81548152906001019060200180831161214c57829003601f168201915b5050505050905080516000036121da5760405162461bcd60e51b815260206004820152603060248201527f4c7a4170703a2064657374696e6174696f6e20636861696e206973206e6f742060448201526f61207472757374656420736f7572636560801b606482015260840161086d565b6121e5878751612767565b60405162c5803160e81b81526001600160a01b037f0000000000000000000000000000000000000000000000000000000000000000169063c580310090849061223c908b9086908c908c908c908c90600401613757565b6000604051808303818588803b15801561225557600080fd5b505af1158015612269573d6000803e3d6000fd5b505050505050505050505050565b600080546001600160a01b038381166001600160a01b0319831681178455604051919092169283917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a35050565b6060816122d581601f6135b8565b10156123145760405162461bcd60e51b815260206004820152600e60248201526d736c6963655f6f766572666c6f7760901b604482015260640161086d565b61231e82846135b8565b845110156123625760405162461bcd60e51b8152602060048201526011602482015270736c6963655f6f75744f66426f756e647360781b604482015260640161086d565b60608215801561238157604051915060008252602082016040526123cb565b6040519150601f8416801560200281840101858101878315602002848b0101015b818310156123ba5780518352602092830192016123a2565b5050858452601f01601f1916604052505b50949350505050565b604051636eb1769f60e11b81523060048201526001600160a01b03828116602483015283169063dd62ed3e90604401602060405180830381865afa158015612420573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061244491906135e7565b600003611a5157611a516001600160a01b038316826000196127d8565b6040805160a081018252838152306020820152428183015260608101839052600060808201819052915163c04b8d5960e01b81526001600160a01b0386169063c04b8d59906124b49084906004016137be565b6020604051808303816000875af11580156124d3573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906124f791906135e7565b95945050505050565b60408051608081018252838152306020820152808201839052600060608201819052915163b858183f60e01b81526001600160a01b0386169063b858183f906124b4908490600401613816565b6040516001600160a01b038316602482015260448101829052610f3890849063a9059cbb60e01b9060640161209b565b6000606060008060008661ffff166001600160401b038111156125a2576125a2612bfb565b6040519080825280601f01601f1916602001820160405280156125cc576020820181803683370190505b50905060008087516020890160008d8df191503d9250868311156125ee578692505b828152826000602083013e909890975095505050505050565b8180519060200120600560008761ffff1661ffff168152602001908152602001600020856040516126389190613864565b9081526040805191829003602090810183206001600160401b0388166000908152915220919091557fe183f33de2837795525b4792ca4cd60535bd77c53b7e7030060bfcf5734d6b0c90610d839087908790879087908790613880565b60006126ea826040518060400160405280602081526020017f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c6564815250856001600160a01b03166128ed9092919063ffffffff16565b805190915015610f38578080602001905181019061270891906138d2565b610f385760405162461bcd60e51b815260206004820152602a60248201527f5361666545524332303a204552433230206f7065726174696f6e20646964206e6044820152691bdd081cdd58d8d9595960b21b606482015260840161086d565b61ffff82166000908152600360205260408120549081900361278857506127105b80821115610f385760405162461bcd60e51b815260206004820181905260248201527f4c7a4170703a207061796c6f61642073697a6520697320746f6f206c61726765604482015260640161086d565b8015806128525750604051636eb1769f60e11b81523060048201526001600160a01b03838116602483015284169063dd62ed3e90604401602060405180830381865afa15801561282c573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061285091906135e7565b155b6128bd5760405162461bcd60e51b815260206004820152603660248201527f5361666545524332303a20617070726f76652066726f6d206e6f6e2d7a65726f60448201527520746f206e6f6e2d7a65726f20616c6c6f77616e636560501b606482015260840161086d565b6040516001600160a01b038316602482015260448101829052610f3890849063095ea7b360e01b9060640161209b565b6060611f8c848460008585600080866001600160a01b031685876040516129149190613864565b60006040518083038185875af1925050503d8060008114612951576040519150601f19603f3d011682016040523d82523d6000602084013e612956565b606091505b509150915061296787838387612972565b979650505050505050565b606083156129e15782516000036129da576001600160a01b0385163b6129da5760405162461bcd60e51b815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e7472616374000000604482015260640161086d565b5081611f8c565b611f8c83838151156129f65781518083602001fd5b8060405162461bcd60e51b815260040161086d9190612e9a565b803561ffff81168114612a2257600080fd5b919050565b60008083601f840112612a3957600080fd5b5081356001600160401b03811115612a5057600080fd5b602083019150836020828501011115612a6857600080fd5b9250929050565b80356001600160401b0381168114612a2257600080fd5b60008060008060008060808789031215612a9f57600080fd5b612aa887612a10565b955060208701356001600160401b0380821115612ac457600080fd5b612ad08a838b01612a27565b9097509550859150612ae460408a01612a6f565b94506060890135915080821115612afa57600080fd5b50612b0789828a01612a27565b979a9699509497509295939492505050565b600060208284031215612b2b57600080fd5b61148f82612a10565b60008060408385031215612b4757600080fd5b612b5083612a10565b946020939093013593505050565b600060208284031215612b7057600080fd5b5035919050565b6001600160a01b0381168114611ede57600080fd5b600060208284031215612b9e57600080fd5b813561148f81612b77565b600080600060408486031215612bbe57600080fd5b612bc784612a10565b925060208401356001600160401b03811115612be257600080fd5b612bee86828701612a27565b9497909650939450505050565b634e487b7160e01b600052604160045260246000fd5b604051601f8201601f191681016001600160401b0381118282101715612c3957612c39612bfb565b604052919050565b60006001600160401b03821115612c5a57612c5a612bfb565b50601f01601f191660200190565b600082601f830112612c7957600080fd5b8135612c8c612c8782612c41565b612c11565b818152846020838601011115612ca157600080fd5b816020850160208301376000918101602001919091529392505050565b600080600060608486031215612cd357600080fd5b8335925060208401356001600160401b03811115612cf057600080fd5b612cfc86828701612c68565b9250506040840135612d0d81612b77565b809150509250925092565b600060208284031215612d2a57600080fd5b81356001600160401b03811115612d4057600080fd5b820160c0818503121561148f57600080fd5b60005b83811015612d6d578181015183820152602001612d55565b838111156119ca5750506000910152565b60008151808452612d96816020860160208601612d52565b601f01601f19169290920160200192915050565b8615158152600060018060a01b03808816602084015260c06040840152612dd460c0840188612d7e565b958116606084015293909316608082015290151560a090910152509392505050565b8015158114611ede57600080fd5b60008060408385031215612e1757600080fd5b8235612e2281612b77565b91506020830135612e3281612df6565b809150509250929050565b600080600060608486031215612e5257600080fd5b612e5b84612a10565b925060208401356001600160401b03811115612e7657600080fd5b612e8286828701612c68565b925050612e9160408501612a6f565b90509250925092565b60208152600061148f6020830184612d7e565b60008060408385031215612ec057600080fd5b612ec983612a10565b9150612ed760208401612a10565b90509250929050565b60008060008060008060c08789031215612ef957600080fd5b612f0287612a10565b955060208701356001600160401b0380821115612f1e57600080fd5b612f2a8a838b01612c68565b96506040890135955060608901359150612f4382612b77565b9093506080880135925060a08801359080821115612f6057600080fd5b50612f6d89828a01612c68565b9150509295509295509295565b600080600080600060808688031215612f9257600080fd5b612f9b86612a10565b9450612fa960208701612a10565b93506040860135925060608601356001600160401b03811115612fcb57600080fd5b612fd788828901612a27565b969995985093965092949392505050565b600080600060608486031215612ffd57600080fd5b61300684612a10565b925061301460208501612a10565b9150604084013590509250925092565b6000806000806080858703121561303a57600080fd5b61304385612a10565b935061305160208601612a10565b9250604085013561306181612b77565b9396929550929360600135925050565b600181811c9082168061308557607f821691505b6020821081036130a557634e487b7160e01b600052602260045260246000fd5b50919050565b8183823760009101908152919050565b600081546130c881613071565b8085526020600183811680156130e557600181146130ff5761312d565b60ff1985168884015283151560051b88018301955061312d565b866000528260002060005b858110156131255781548a820186015290830190840161310a565b890184019650505b505050505092915050565b61ffff8616815260a06020820152600061315560a08301876130bb565b856040840152841515606084015282810360808401526131758185612d7e565b98975050505050505050565b6000806040838503121561319457600080fd5b505080516020909101519092909150565b61ffff861681526001600160a01b038516602082015260a0604082018190526000906131d390830186612d7e565b841515606084015282810360808401526131758185612d7e565b600060018060a01b03808916835261ffff8816602084015260e0604084015261321960e08401886130bb565b6060840196909652938416608083015250911660a082015280820360c090910152600081526020019392505050565b81835281816020850137506000828201602090810191909152601f909101601f19169091010190565b61ffff84168152604060208201526000611f89604083018486613248565b601f821115610f3857600081815260208120601f850160051c810160208610156132b65750805b601f850160051c820191505b81811015611129578281556001016132c2565b81516001600160401b038111156132ee576132ee612bfb565b613302816132fc8454613071565b8461328f565b602080601f831160018114613337576000841561331f5750858301515b600019600386901b1c1916600185901b178555611129565b600085815260208120601f198616915b8281101561336657888601518255948401946001909101908401613347565b50858210156133845787850151600019600388901b60f8161c191681555b5050505050600190811b01905550565b600081356133a181612df6565b92915050565b600081356133a181612b77565b6000808335601e198436030181126133cb57600080fd5b8301803591506001600160401b038211156133e557600080fd5b602001915036819003821315612a6857600080fd5b6001600160401b0383111561341157613411612bfb565b6134258361341f8354613071565b8361328f565b6000601f84116001811461345957600085156134415750838201355b600019600387901b1c1916600186901b178355610aac565b600083815260209020601f19861690835b8281101561348a578685013582556020948501946001909201910161346a565b50868210156134a75760001960f88860031b161c19848701351681555b505060018560011b0183555050505050565b80546001600160a01b0319166001600160a01b0392909216919091179055565b81356134e481612df6565b815460ff19811691151560ff169182178355602084013561350481612b77565b6001600160a81b03199190911690911760089190911b610100600160a81b031617815561353460408301836133b4565b6135428183600186016133fa565b505061355c613553606084016133a7565b600283016134b9565b6003810161357561356f608085016133a7565b826134b9565b610f3861358460a08501613394565b82805460ff60a01b191691151560a01b60ff60a01b16919091179055565b634e487b7160e01b600052601160045260246000fd5b600082198211156135cb576135cb6135a2565b500190565b6000828210156135e2576135e26135a2565b500390565b6000602082840312156135f957600080fd5b5051919050565b8284823760609190911b6bffffffffffffffffffffffff19169101908152601401919050565b60006020828403121561363857600080fd5b815161148f81612b77565b600061ffff808816835280871660208401525084604083015260806060830152612967608083018486613248565b61ffff8616815260806020820152600061368f608083018688613248565b6001600160401b0394909416604083015250606001529392505050565b6000602082840312156136be57600080fd5b81516001600160401b038111156136d457600080fd5b8201601f810184136136e557600080fd5b80516136f3612c8782612c41565b81815285602083850101111561370857600080fd5b6124f7826020830160208601612d52565b61ffff851681526080602082015260006137366080830186612d7e565b6001600160401b038516604084015282810360608401526129678185612d7e565b61ffff8716815260c06020820152600061377460c0830188612d7e565b82810360408401526137868188612d7e565b6001600160a01b0387811660608601528616608085015283810360a085015290506137b18185612d7e565b9998505050505050505050565b602081526000825160a060208401526137da60c0840182612d7e565b905060018060a01b0360208501511660408401526040840151606084015260608401516080840152608084015160a08401528091505092915050565b60208152600082516080602084015261383260a0840182612d7e565b905060018060a01b03602085015116604084015260408401516060840152606084015160808401528091505092915050565b60008251613876818460208701612d52565b9190910192915050565b61ffff8616815260a06020820152600061389d60a0830187612d7e565b6001600160401b038616604084015282810360608401526138be8186612d7e565b905082810360808401526131758185612d7e565b6000602082840312156138e457600080fd5b815161148f81612df656fea2646970667358221220e10ab1d31e405627f73f7b2cfd2ede2e36cb1c63930c1577bb6fcc23cf33308b64736f6c634300080f00330000000000000000000000001509706a6c66ca549ff0cb464de88231ddbe213b0000000000000000000000004200000000000000000000000000000000000006000000000000000000000000b0d502e938ed5f4df2e681fe6e419ff29631d62b0000000000000000000000003c2269811836af69497e5f486a85d7316753cf6200000000000000000000000000000000000000000000000000000000000000c0000000000000000000000000000000000000000000000000000000000000006e00000000000000000000000000000000000000000000000000000000000000142ebde6d379bc0044e48929bcd958a40c170a2cdd000000000000000000000000
Deployed Bytecode
0x6080604052600436106102495760003560e01c80637533d78811610139578063bac86af5116100b6578063df2a5b3b1161007a578063df2a5b3b14610743578063e13b7f5c14610763578063eb8d72b714610783578063f2fde38b146107a3578063f5ecbdbc146107c3578063f68016b7146107e357600080fd5b8063bac86af5146106ba578063baf3292d146106da578063c4461834146106fa578063cbed8b9c14610710578063d1deba1f1461073057600080fd5b80639f38369a116100fd5780639f38369a14610613578063a140559814610633578063a6c3d16514610653578063ab8236f314610673578063b353aaa71461068657600080fd5b80637533d7881461055d5780638cfd8f5c1461057d5780638da5cb5b146105b5578063950c8a74146105d35780639c792938146105f357600080fd5b806342d65a8d116101c75780635b8c41e61161018b5780635b8c41e61461049757806366ad5c8a146104e65780636bc6dd3d146105065780636c099dee14610528578063715018a61461054857600080fd5b806342d65a8d146103f057806343ab3b33146104105780634b0c2d021461043057806353da9f5114610450578063558a72971461047757600080fd5b80631275b64e1161020e5780631275b64e1461031457806313e7c9d81461032757806330c593f7146103675780633d8b38f6146103955780633f1f4fa4146103b557600080fd5b80621d35671461025557806307e0db17146102775780630df374831461029757806310ddb137146102b757806311b0b42d146102d757600080fd5b3661025057005b600080fd5b34801561026157600080fd5b50610275610270366004612a86565b6107f9565b005b34801561028357600080fd5b50610275610292366004612b19565b610a2a565b3480156102a357600080fd5b506102756102b2366004612b34565b610ab3565b3480156102c357600080fd5b506102756102d2366004612b19565b610ad2565b3480156102e357600080fd5b506007546102f7906001600160a01b031681565b6040516001600160a01b0390911681526020015b60405180910390f35b610275610322366004612b5e565b610b2a565b34801561033357600080fd5b50610357610342366004612b8c565b600f6020526000908152604090205460ff1681565b604051901515815260200161030b565b34801561037357600080fd5b506010546103829061ffff1681565b60405161ffff909116815260200161030b565b3480156103a157600080fd5b506103576103b0366004612ba9565b610d92565b3480156103c157600080fd5b506103e26103d0366004612b19565b60036020526000908152604090205481565b60405190815260200161030b565b3480156103fc57600080fd5b5061027561040b366004612ba9565b610e5e565b34801561041c57600080fd5b5061027561042b366004612cbe565b610ee4565b34801561043c57600080fd5b5061027561044b366004612d18565b610f3d565b34801561045c57600080fd5b50610465610f52565b60405161030b96959493929190612daa565b34801561048357600080fd5b50610275610492366004612e04565b611022565b3480156104a357600080fd5b506103e26104b2366004612e3d565b6005602090815260009384526040808520845180860184018051928152908401958401959095209452929052825290205481565b3480156104f257600080fd5b50610275610501366004612a86565b611055565b34801561051257600080fd5b5061051b611131565b60405161030b9190612e9a565b34801561053457600080fd5b506008546102f7906001600160a01b031681565b34801561055457600080fd5b506102756111bf565b34801561056957600080fd5b5061051b610578366004612b19565b6111d3565b34801561058957600080fd5b506103e2610598366004612ead565b600260209081526000928352604080842090915290825290205481565b3480156105c157600080fd5b506000546001600160a01b03166102f7565b3480156105df57600080fd5b506004546102f7906001600160a01b031681565b3480156105ff57600080fd5b506103e261060e366004612b5e565b6111ec565b34801561061f57600080fd5b5061051b61062e366004612b19565b611380565b34801561063f57600080fd5b5061027561064e366004612b8c565b611496565b34801561065f57600080fd5b5061027561066e366004612ba9565b61180d565b610275610681366004612ee0565b611889565b34801561069257600080fd5b506102f77f0000000000000000000000003c2269811836af69497e5f486a85d7316753cf6281565b3480156106c657600080fd5b506102756106d5366004612e04565b611951565b3480156106e657600080fd5b506102756106f5366004612b8c565b611a55565b34801561070657600080fd5b506103e261271081565b34801561071c57600080fd5b5061027561072b366004612f7a565b611ab1565b61027561073e366004612a86565b611b46565b34801561074f57600080fd5b5061027561075e366004612fe8565b611d5c565b34801561076f57600080fd5b506006546102f7906001600160a01b031681565b34801561078f57600080fd5b5061027561079e366004612ba9565b611e0e565b3480156107af57600080fd5b506102756107be366004612b8c565b611e68565b3480156107cf57600080fd5b5061051b6107de366004613024565b611ee1565b3480156107ef57600080fd5b506103e2600a5481565b337f0000000000000000000000003c2269811836af69497e5f486a85d7316753cf626001600160a01b0316146108765760405162461bcd60e51b815260206004820152601e60248201527f4c7a4170703a20696e76616c696420656e64706f696e742063616c6c6572000060448201526064015b60405180910390fd5b61ffff86166000908152600160205260408120805461089490613071565b80601f01602080910402602001604051908101604052809291908181526020018280546108c090613071565b801561090d5780601f106108e25761010080835404028352916020019161090d565b820191906000526020600020905b8154815290600101906020018083116108f057829003601f168201915b50505050509050805186869050148015610928575060008151115b801561095057508051602082012060405161094690889088906130ab565b6040518091039020145b6109ab5760405162461bcd60e51b815260206004820152602660248201527f4c7a4170703a20696e76616c696420736f757263652073656e64696e6720636f6044820152651b9d1c9858dd60d21b606482015260840161086d565b610a218787878080601f01602080910402602001604051908101604052809392919081815260200183838082843760009201919091525050604080516020601f8a018190048102820181019092528881528a935091508890889081908401838280828437600092019190915250611f9492505050565b50505050505050565b610a3261200d565b6040516307e0db1760e01b815261ffff821660048201527f0000000000000000000000003c2269811836af69497e5f486a85d7316753cf626001600160a01b0316906307e0db17906024015b600060405180830381600087803b158015610a9857600080fd5b505af1158015610aac573d6000803e3d6000fd5b5050505050565b610abb61200d565b61ffff909116600090815260036020526040902055565b610ada61200d565b6040516310ddb13760e01b815261ffff821660048201527f0000000000000000000000003c2269811836af69497e5f486a85d7316753cf626001600160a01b0316906310ddb13790602401610a7e565b600654610b42906001600160a01b0316333084612067565b601054600a54604080516001600160f01b031962010000850460f01b1660208201526022808201939093528151808203909301835260428101825233606282015260828082018690528251808303909101815260a2820192839052600654632a205e3d60e01b90935292936000926001600160a01b031691632a205e3d91610bdc9161ffff90911690600990899087908a9060a601613138565b6040805180830381865afa158015610bf8573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610c1c9190613181565b5060105460405163040a7bb160e41b81529192506000916001600160a01b037f0000000000000000000000003c2269811836af69497e5f486a85d7316753cf6216916340a7bb1091610c7d9161ffff16903090889087908b906004016131a5565b6040805180830381865afa158015610c99573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610cbd9190613181565b506006546010546040516328c82b1b60e11b81529293506001600160a01b03909116916351905636918591610d0791309161ffff909116906009908c9033906000906004016131ed565b6000604051808303818588803b158015610d2057600080fd5b505af1158015610d34573d6000803e3d6000fd5b5050601054610d51935061ffff16915085905033600088866120d2565b60408051338152602081018790527f562c219552544ec4c9d7a8eb850f80ea152973e315372bf4999fe7c953ea004f91015b60405180910390a15050505050565b61ffff831660009081526001602052604081208054829190610db390613071565b80601f0160208091040260200160405190810160405280929190818152602001828054610ddf90613071565b8015610e2c5780601f10610e0157610100808354040283529160200191610e2c565b820191906000526020600020905b815481529060010190602001808311610e0f57829003601f168201915b505050505090508383604051610e439291906130ab565b60405180910390208180519060200120149150509392505050565b610e6661200d565b6040516342d65a8d60e01b81526001600160a01b037f0000000000000000000000003c2269811836af69497e5f486a85d7316753cf6216906342d65a8d90610eb690869086908690600401613271565b600060405180830381600087803b158015610ed057600080fd5b505af1158015610a21573d6000803e3d6000fd5b610eec61200d565b8215610ef857600a8390555b815115610f0d576009610f0b83826132d5565b505b6001600160a01b03811615610f3857600880546001600160a01b0319166001600160a01b0383161790555b505050565b610f4561200d565b80600b610f3882826134d9565b600b8054600c805460ff8316936101009093046001600160a01b0316929190610f7a90613071565b80601f0160208091040260200160405190810160405280929190818152602001828054610fa690613071565b8015610ff35780601f10610fc857610100808354040283529160200191610ff3565b820191906000526020600020905b815481529060010190602001808311610fd657829003601f168201915b50505050600283015460039093015491926001600160a01b03908116929081169150600160a01b900460ff1686565b61102a61200d565b6001600160a01b03919091166000908152600f60205260409020805460ff1916911515919091179055565b3330146110b35760405162461bcd60e51b815260206004820152602660248201527f4e6f6e626c6f636b696e674c7a4170703a2063616c6c6572206d7573742062656044820152650204c7a4170760d41b606482015260840161086d565b6111298686868080601f01602080910402602001604051908101604052809392919081815260200183838082843760009201919091525050604080516020601f8901819004810282018101909252878152899350915087908790819084018382808284376000920191909152506119ca92505050565b505050505050565b6009805461113e90613071565b80601f016020809104026020016040519081016040528092919081815260200182805461116a90613071565b80156111b75780601f1061118c576101008083540402835291602001916111b7565b820191906000526020600020905b81548152906001019060200180831161119a57829003601f168201915b505050505081565b6111c761200d565b6111d16000612277565b565b6001602052600090815260409020805461113e90613071565b601054600a54604080516001600160f01b031962010000850460f01b1660208201526022808201939093528151808203909301835260428101825233606282015260828082018690528251808303909101815260a2820192839052600654632a205e3d60e01b909352600094909285926001600160a01b0390911691632a205e3d916112889161ffff16906009908a9087908a9060a601613138565b6040805180830381865afa1580156112a4573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906112c89190613181565b5060105460405163040a7bb160e41b81529192506000916001600160a01b037f0000000000000000000000003c2269811836af69497e5f486a85d7316753cf6216916340a7bb10916113299161ffff16903090889087908b906004016131a5565b6040805180830381865afa158015611345573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906113699190613181565b50905061137681836135b8565b9695505050505050565b61ffff81166000908152600160205260408120805460609291906113a390613071565b80601f01602080910402602001604051908101604052809291908181526020018280546113cf90613071565b801561141c5780601f106113f15761010080835404028352916020019161141c565b820191906000526020600020905b8154815290600101906020018083116113ff57829003601f168201915b5050505050905080516000036114745760405162461bcd60e51b815260206004820152601d60248201527f4c7a4170703a206e6f20747275737465642070617468207265636f7264000000604482015260640161086d565b61148f60006014835161148791906135d0565b8391906122c7565b9392505050565b3330146114b65760405163ea8e4eb560e01b815260040160405180910390fd5b600b5460ff16156116be57600d546040516370a0823160e01b81523060048201526000916001600160a01b0316906370a0823190602401602060405180830381865afa15801561150a573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061152e91906135e7565b600b54600d54919250611552916001600160a01b03610100909204821691166123d4565b600e54600160a01b900460ff161561161257600b54600c805461160c9261010090046001600160a01b0316919061158890613071565b80601f01602080910402602001604051908101604052809291908181526020018280546115b490613071565b80156116015780601f106115d657610100808354040283529160200191611601565b820191906000526020600020905b8154815290600101906020018083116115e457829003601f168201915b505050505083612461565b506116bc565b600b54600c80546116ba9261010090046001600160a01b0316919061163690613071565b80601f016020809104026020016040519081016040528092919081815260200182805461166290613071565b80156116af5780601f10611684576101008083540402835291602001916116af565b820191906000526020600020905b81548152906001019060200180831161169257829003601f168201915b505050505083612500565b505b505b6007546040516370a0823160e01b815230600482015247916000916001600160a01b03909116906370a0823190602401602060405180830381865afa15801561170b573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061172f91906135e7565b905081156117a157600760009054906101000a90046001600160a01b03166001600160a01b031663d0e30db0836040518263ffffffff1660e01b81526004016000604051808303818588803b15801561178757600080fd5b505af115801561179b573d6000803e3d6000fd5b50505050505b6117ab81836135b8565b6007549092506117c5906001600160a01b0316848461254d565b604080516001600160a01b0385168152602081018490527fe1f61daa382137eba3fb6f816783974e8b33b9c29b6b9f777ed315d7faefd59a91015b60405180910390a1505050565b61181561200d565b81813060405160200161182a93929190613600565b60408051601f1981840301815291815261ffff851660009081526001602052209061185590826132d5565b507f8c0400cfe2d1199b1a725c78960bcc2a344d869b80590d0f2bd005db15a572ce83838360405161180093929190613271565b6008546001600160a01b031633146118b45760405163ea8e4eb560e01b815260040160405180910390fd5b6000818060200190518101906118ca9190613626565b6040516314280ab360e31b81526001600160a01b0382166004820152909150309063a140559890602401600060405180830381600087803b15801561190e57600080fd5b505af192505050801561191f575060015b610a21576040517f726c6382ff9f085e7ed0027cf5eda8d6e099c840a04a63124cd8d0e161993c7b90600090a1610a21565b61195961200d565b80156119d0576040514790600090339083908381818185875af1925050503d80600081146119a3576040519150601f19603f3d011682016040523d82523d6000602084013e6119a8565b606091505b50509050806119ca57604051630ebf3bcd60e41b815260040160405180910390fd5b50505050565b6040516370a0823160e01b81523060048201526000906001600160a01b038416906370a0823190602401602060405180830381865afa158015611a17573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611a3b91906135e7565b9050610f386001600160a01b038416338361254d565b5050565b611a5d61200d565b600480546001600160a01b0319166001600160a01b0383169081179091556040519081527f5db758e995a17ec1ad84bdef7e8c3293a0bd6179bcce400dff5d4c3d87db726b9060200160405180910390a150565b611ab961200d565b6040516332fb62e760e21b81526001600160a01b037f0000000000000000000000003c2269811836af69497e5f486a85d7316753cf62169063cbed8b9c90611b0d9088908890889088908890600401613643565b600060405180830381600087803b158015611b2757600080fd5b505af1158015611b3b573d6000803e3d6000fd5b505050505050505050565b61ffff86166000908152600560205260408082209051611b6990889088906130ab565b90815260408051602092819003830190206001600160401b03871660009081529252902054905080611be95760405162461bcd60e51b815260206004820152602360248201527f4e6f6e626c6f636b696e674c7a4170703a206e6f2073746f726564206d65737360448201526261676560e81b606482015260840161086d565b808383604051611bfa9291906130ab565b604051809103902014611c595760405162461bcd60e51b815260206004820152602160248201527f4e6f6e626c6f636b696e674c7a4170703a20696e76616c6964207061796c6f616044820152601960fa1b606482015260840161086d565b61ffff87166000908152600560205260408082209051611c7c90899089906130ab565b90815260408051602092819003830181206001600160401b038916600090815290845282902093909355601f88018290048202830182019052868252611d14918991899089908190840183828082843760009201919091525050604080516020601f8a018190048102820181019092528881528a9350915088908890819084018382808284376000920191909152506119ca92505050565b7fc264d91f3adc5588250e1551f547752ca0cfa8f6b530d243b9f9f4cab10ea8e58787878785604051611d4b959493929190613671565b60405180910390a150505050505050565b611d6461200d565b60008111611dac5760405162461bcd60e51b81526020600482015260156024820152744c7a4170703a20696e76616c6964206d696e47617360581b604482015260640161086d565b61ffff83811660008181526002602090815260408083209487168084529482529182902085905581519283528201929092529081018290527f9d5c7c0b934da8fefa9c7760c98383778a12dfbfc0c3b3106518f43fb9508ac090606001611800565b611e1661200d565b61ffff83166000908152600160205260409020611e348284836133fa565b507ffa41487ad5d6728f0b19276fa1eddc16558578f5109fc39d2dc33c3230470dab83838360405161180093929190613271565b611e7061200d565b6001600160a01b038116611ed55760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201526564647265737360d01b606482015260840161086d565b611ede81612277565b50565b604051633d7b2f6f60e21b815261ffff808616600483015284166024820152306044820152606481018290526060907f0000000000000000000000003c2269811836af69497e5f486a85d7316753cf626001600160a01b03169063f5ecbdbc90608401600060405180830381865afa158015611f61573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f19168201604052611f8991908101906136ac565b90505b949350505050565b600080611ff75a60966366ad5c8a60e01b89898989604051602401611fbc9493929190613719565b60408051601f198184030181529190526020810180516001600160e01b03166001600160e01b0319909316929092179091523092919061257d565b9150915081611129576111298686868685612607565b6000546001600160a01b031633146111d15760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604482015260640161086d565b6040516001600160a01b03808516602483015283166044820152606481018290526119ca9085906323b872dd60e01b906084015b60408051601f198184030181529190526020810180516001600160e01b03166001600160e01b031990931692909217909152612695565b61ffff8616600090815260016020526040812080546120f090613071565b80601f016020809104026020016040519081016040528092919081815260200182805461211c90613071565b80156121695780601f1061213e57610100808354040283529160200191612169565b820191906000526020600020905b81548152906001019060200180831161214c57829003601f168201915b5050505050905080516000036121da5760405162461bcd60e51b815260206004820152603060248201527f4c7a4170703a2064657374696e6174696f6e20636861696e206973206e6f742060448201526f61207472757374656420736f7572636560801b606482015260840161086d565b6121e5878751612767565b60405162c5803160e81b81526001600160a01b037f0000000000000000000000003c2269811836af69497e5f486a85d7316753cf62169063c580310090849061223c908b9086908c908c908c908c90600401613757565b6000604051808303818588803b15801561225557600080fd5b505af1158015612269573d6000803e3d6000fd5b505050505050505050505050565b600080546001600160a01b038381166001600160a01b0319831681178455604051919092169283917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a35050565b6060816122d581601f6135b8565b10156123145760405162461bcd60e51b815260206004820152600e60248201526d736c6963655f6f766572666c6f7760901b604482015260640161086d565b61231e82846135b8565b845110156123625760405162461bcd60e51b8152602060048201526011602482015270736c6963655f6f75744f66426f756e647360781b604482015260640161086d565b60608215801561238157604051915060008252602082016040526123cb565b6040519150601f8416801560200281840101858101878315602002848b0101015b818310156123ba5780518352602092830192016123a2565b5050858452601f01601f1916604052505b50949350505050565b604051636eb1769f60e11b81523060048201526001600160a01b03828116602483015283169063dd62ed3e90604401602060405180830381865afa158015612420573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061244491906135e7565b600003611a5157611a516001600160a01b038316826000196127d8565b6040805160a081018252838152306020820152428183015260608101839052600060808201819052915163c04b8d5960e01b81526001600160a01b0386169063c04b8d59906124b49084906004016137be565b6020604051808303816000875af11580156124d3573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906124f791906135e7565b95945050505050565b60408051608081018252838152306020820152808201839052600060608201819052915163b858183f60e01b81526001600160a01b0386169063b858183f906124b4908490600401613816565b6040516001600160a01b038316602482015260448101829052610f3890849063a9059cbb60e01b9060640161209b565b6000606060008060008661ffff166001600160401b038111156125a2576125a2612bfb565b6040519080825280601f01601f1916602001820160405280156125cc576020820181803683370190505b50905060008087516020890160008d8df191503d9250868311156125ee578692505b828152826000602083013e909890975095505050505050565b8180519060200120600560008761ffff1661ffff168152602001908152602001600020856040516126389190613864565b9081526040805191829003602090810183206001600160401b0388166000908152915220919091557fe183f33de2837795525b4792ca4cd60535bd77c53b7e7030060bfcf5734d6b0c90610d839087908790879087908790613880565b60006126ea826040518060400160405280602081526020017f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c6564815250856001600160a01b03166128ed9092919063ffffffff16565b805190915015610f38578080602001905181019061270891906138d2565b610f385760405162461bcd60e51b815260206004820152602a60248201527f5361666545524332303a204552433230206f7065726174696f6e20646964206e6044820152691bdd081cdd58d8d9595960b21b606482015260840161086d565b61ffff82166000908152600360205260408120549081900361278857506127105b80821115610f385760405162461bcd60e51b815260206004820181905260248201527f4c7a4170703a207061796c6f61642073697a6520697320746f6f206c61726765604482015260640161086d565b8015806128525750604051636eb1769f60e11b81523060048201526001600160a01b03838116602483015284169063dd62ed3e90604401602060405180830381865afa15801561282c573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061285091906135e7565b155b6128bd5760405162461bcd60e51b815260206004820152603660248201527f5361666545524332303a20617070726f76652066726f6d206e6f6e2d7a65726f60448201527520746f206e6f6e2d7a65726f20616c6c6f77616e636560501b606482015260840161086d565b6040516001600160a01b038316602482015260448101829052610f3890849063095ea7b360e01b9060640161209b565b6060611f8c848460008585600080866001600160a01b031685876040516129149190613864565b60006040518083038185875af1925050503d8060008114612951576040519150601f19603f3d011682016040523d82523d6000602084013e612956565b606091505b509150915061296787838387612972565b979650505050505050565b606083156129e15782516000036129da576001600160a01b0385163b6129da5760405162461bcd60e51b815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e7472616374000000604482015260640161086d565b5081611f8c565b611f8c83838151156129f65781518083602001fd5b8060405162461bcd60e51b815260040161086d9190612e9a565b803561ffff81168114612a2257600080fd5b919050565b60008083601f840112612a3957600080fd5b5081356001600160401b03811115612a5057600080fd5b602083019150836020828501011115612a6857600080fd5b9250929050565b80356001600160401b0381168114612a2257600080fd5b60008060008060008060808789031215612a9f57600080fd5b612aa887612a10565b955060208701356001600160401b0380821115612ac457600080fd5b612ad08a838b01612a27565b9097509550859150612ae460408a01612a6f565b94506060890135915080821115612afa57600080fd5b50612b0789828a01612a27565b979a9699509497509295939492505050565b600060208284031215612b2b57600080fd5b61148f82612a10565b60008060408385031215612b4757600080fd5b612b5083612a10565b946020939093013593505050565b600060208284031215612b7057600080fd5b5035919050565b6001600160a01b0381168114611ede57600080fd5b600060208284031215612b9e57600080fd5b813561148f81612b77565b600080600060408486031215612bbe57600080fd5b612bc784612a10565b925060208401356001600160401b03811115612be257600080fd5b612bee86828701612a27565b9497909650939450505050565b634e487b7160e01b600052604160045260246000fd5b604051601f8201601f191681016001600160401b0381118282101715612c3957612c39612bfb565b604052919050565b60006001600160401b03821115612c5a57612c5a612bfb565b50601f01601f191660200190565b600082601f830112612c7957600080fd5b8135612c8c612c8782612c41565b612c11565b818152846020838601011115612ca157600080fd5b816020850160208301376000918101602001919091529392505050565b600080600060608486031215612cd357600080fd5b8335925060208401356001600160401b03811115612cf057600080fd5b612cfc86828701612c68565b9250506040840135612d0d81612b77565b809150509250925092565b600060208284031215612d2a57600080fd5b81356001600160401b03811115612d4057600080fd5b820160c0818503121561148f57600080fd5b60005b83811015612d6d578181015183820152602001612d55565b838111156119ca5750506000910152565b60008151808452612d96816020860160208601612d52565b601f01601f19169290920160200192915050565b8615158152600060018060a01b03808816602084015260c06040840152612dd460c0840188612d7e565b958116606084015293909316608082015290151560a090910152509392505050565b8015158114611ede57600080fd5b60008060408385031215612e1757600080fd5b8235612e2281612b77565b91506020830135612e3281612df6565b809150509250929050565b600080600060608486031215612e5257600080fd5b612e5b84612a10565b925060208401356001600160401b03811115612e7657600080fd5b612e8286828701612c68565b925050612e9160408501612a6f565b90509250925092565b60208152600061148f6020830184612d7e565b60008060408385031215612ec057600080fd5b612ec983612a10565b9150612ed760208401612a10565b90509250929050565b60008060008060008060c08789031215612ef957600080fd5b612f0287612a10565b955060208701356001600160401b0380821115612f1e57600080fd5b612f2a8a838b01612c68565b96506040890135955060608901359150612f4382612b77565b9093506080880135925060a08801359080821115612f6057600080fd5b50612f6d89828a01612c68565b9150509295509295509295565b600080600080600060808688031215612f9257600080fd5b612f9b86612a10565b9450612fa960208701612a10565b93506040860135925060608601356001600160401b03811115612fcb57600080fd5b612fd788828901612a27565b969995985093965092949392505050565b600080600060608486031215612ffd57600080fd5b61300684612a10565b925061301460208501612a10565b9150604084013590509250925092565b6000806000806080858703121561303a57600080fd5b61304385612a10565b935061305160208601612a10565b9250604085013561306181612b77565b9396929550929360600135925050565b600181811c9082168061308557607f821691505b6020821081036130a557634e487b7160e01b600052602260045260246000fd5b50919050565b8183823760009101908152919050565b600081546130c881613071565b8085526020600183811680156130e557600181146130ff5761312d565b60ff1985168884015283151560051b88018301955061312d565b866000528260002060005b858110156131255781548a820186015290830190840161310a565b890184019650505b505050505092915050565b61ffff8616815260a06020820152600061315560a08301876130bb565b856040840152841515606084015282810360808401526131758185612d7e565b98975050505050505050565b6000806040838503121561319457600080fd5b505080516020909101519092909150565b61ffff861681526001600160a01b038516602082015260a0604082018190526000906131d390830186612d7e565b841515606084015282810360808401526131758185612d7e565b600060018060a01b03808916835261ffff8816602084015260e0604084015261321960e08401886130bb565b6060840196909652938416608083015250911660a082015280820360c090910152600081526020019392505050565b81835281816020850137506000828201602090810191909152601f909101601f19169091010190565b61ffff84168152604060208201526000611f89604083018486613248565b601f821115610f3857600081815260208120601f850160051c810160208610156132b65750805b601f850160051c820191505b81811015611129578281556001016132c2565b81516001600160401b038111156132ee576132ee612bfb565b613302816132fc8454613071565b8461328f565b602080601f831160018114613337576000841561331f5750858301515b600019600386901b1c1916600185901b178555611129565b600085815260208120601f198616915b8281101561336657888601518255948401946001909101908401613347565b50858210156133845787850151600019600388901b60f8161c191681555b5050505050600190811b01905550565b600081356133a181612df6565b92915050565b600081356133a181612b77565b6000808335601e198436030181126133cb57600080fd5b8301803591506001600160401b038211156133e557600080fd5b602001915036819003821315612a6857600080fd5b6001600160401b0383111561341157613411612bfb565b6134258361341f8354613071565b8361328f565b6000601f84116001811461345957600085156134415750838201355b600019600387901b1c1916600186901b178355610aac565b600083815260209020601f19861690835b8281101561348a578685013582556020948501946001909201910161346a565b50868210156134a75760001960f88860031b161c19848701351681555b505060018560011b0183555050505050565b80546001600160a01b0319166001600160a01b0392909216919091179055565b81356134e481612df6565b815460ff19811691151560ff169182178355602084013561350481612b77565b6001600160a81b03199190911690911760089190911b610100600160a81b031617815561353460408301836133b4565b6135428183600186016133fa565b505061355c613553606084016133a7565b600283016134b9565b6003810161357561356f608085016133a7565b826134b9565b610f3861358460a08501613394565b82805460ff60a01b191691151560a01b60ff60a01b16919091179055565b634e487b7160e01b600052601160045260246000fd5b600082198211156135cb576135cb6135a2565b500190565b6000828210156135e2576135e26135a2565b500390565b6000602082840312156135f957600080fd5b5051919050565b8284823760609190911b6bffffffffffffffffffffffff19169101908152601401919050565b60006020828403121561363857600080fd5b815161148f81612b77565b600061ffff808816835280871660208401525084604083015260806060830152612967608083018486613248565b61ffff8616815260806020820152600061368f608083018688613248565b6001600160401b0394909416604083015250606001529392505050565b6000602082840312156136be57600080fd5b81516001600160401b038111156136d457600080fd5b8201601f810184136136e557600080fd5b80516136f3612c8782612c41565b81815285602083850101111561370857600080fd5b6124f7826020830160208601612d52565b61ffff851681526080602082015260006137366080830186612d7e565b6001600160401b038516604084015282810360608401526129678185612d7e565b61ffff8716815260c06020820152600061377460c0830188612d7e565b82810360408401526137868188612d7e565b6001600160a01b0387811660608601528616608085015283810360a085015290506137b18185612d7e565b9998505050505050505050565b602081526000825160a060208401526137da60c0840182612d7e565b905060018060a01b0360208501511660408401526040840151606084015260608401516080840152608084015160a08401528091505092915050565b60208152600082516080602084015261383260a0840182612d7e565b905060018060a01b03602085015116604084015260408401516060840152606084015160808401528091505092915050565b60008251613876818460208701612d52565b9190910192915050565b61ffff8616815260a06020820152600061389d60a0830187612d7e565b6001600160401b038616604084015282810360608401526138be8186612d7e565b905082810360808401526131758185612d7e565b6000602082840312156138e457600080fd5b815161148f81612df656fea2646970667358221220e10ab1d31e405627f73f7b2cfd2ede2e36cb1c63930c1577bb6fcc23cf33308b64736f6c634300080f0033
Constructor Arguments (ABI-Encoded and is the last bytes of the Contract Creation Code above)
0000000000000000000000001509706a6c66ca549ff0cb464de88231ddbe213b0000000000000000000000004200000000000000000000000000000000000006000000000000000000000000b0d502e938ed5f4df2e681fe6e419ff29631d62b0000000000000000000000003c2269811836af69497e5f486a85d7316753cf6200000000000000000000000000000000000000000000000000000000000000c0000000000000000000000000000000000000000000000000000000000000006e00000000000000000000000000000000000000000000000000000000000000142ebde6d379bc0044e48929bcd958a40c170a2cdd000000000000000000000000
-----Decoded View---------------
Arg [0] : _aura (address): 0x1509706a6c66CA549ff0cB464de88231DDBe213B
Arg [1] : _native (address): 0x4200000000000000000000000000000000000006
Arg [2] : _stargate (address): 0xB0D502E938ed5f4df2E681fE6E419ff29631d62b
Arg [3] : _endpoint (address): 0x3c2269811836af69497E5F486A85D7316753cf62
Arg [4] : _auraSwapper (bytes): 0x2ebde6d379bc0044e48929bcd958a40c170a2cdd
Arg [5] : _dstChainId (uint16): 110
-----Encoded View---------------
8 Constructor Arguments found :
Arg [0] : 0000000000000000000000001509706a6c66ca549ff0cb464de88231ddbe213b
Arg [1] : 0000000000000000000000004200000000000000000000000000000000000006
Arg [2] : 000000000000000000000000b0d502e938ed5f4df2e681fe6e419ff29631d62b
Arg [3] : 0000000000000000000000003c2269811836af69497e5f486a85d7316753cf62
Arg [4] : 00000000000000000000000000000000000000000000000000000000000000c0
Arg [5] : 000000000000000000000000000000000000000000000000000000000000006e
Arg [6] : 0000000000000000000000000000000000000000000000000000000000000014
Arg [7] : 2ebde6d379bc0044e48929bcd958a40c170a2cdd000000000000000000000000
Loading...
Loading
Loading...
Loading
Multichain Portfolio | 30 Chains
Chain | Token | Portfolio % | Price | Amount | Value |
---|
[ Download: CSV Export ]
[ 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.